Skip to contentSkip to conversation

Report Windows bitness

PATCH In review Lev Stipakov 2 participants 3 messages Feb 7, 2016 – Feb 26, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Report Windows bitness

Trac #599

---
 src/openvpn/win32.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
src/openvpn/win32.c +16 -0
index 6c6ac4c..5702304 100644
@@ -1323,6 +1323,20 @@ win32_version_info()
     }
 }
 
+bool
+win32_is_64bit()
+{
+#if defined(_WIN64)
+    return true;  // 64-bit programs run only on Win64
+#elif defined(_WIN32)
+    // 32-bit programs run on both 32-bit and 64-bit Windows
+    BOOL f64 = FALSE;
+    return IsWow64Process(GetCurrentProcess(), &f64) && f64;
+#else
+    return false; // Win64 does not support Win16
+#endif
+}
+
 const char *
 win32_version_string(struct gc_arena *gc, bool add_name)
 {
@@ -1349,6 +1363,8 @@ win32_version_string(struct gc_arena *gc, bool add_name)
             break;
     }
 
+    buf_printf (&out, win32_is_64bit() ? " 64bit" : " 32bit");
+
     return (const char *)out.data;
 }
 
Signature · 1 line
1.9.1
#1 lore raw

ACK. Looks reasonable, tested with a 32bit binary on 64bit windows, works (have not tested all possible combinations due to resource constraints, will test as soon as buildbot provides installers)

Your patch has been applied to the master branch.

I'll apply this to release/2.3 as well as it nicely complements 84eb66bf78b0 (but want to have this tested on all platforms first)

commit 15f78acfae2f99b74a72b5766559f28c2d1d3cac (master)

Author: Lev Stipakov
Date:   Sun Feb 7 22:21:32 2016 +0200
     Report Windows bitness

     Signed-off-by: Lev Stipakov <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: http://article.gmane.org/gmane.network.openvpn.devel/11086
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#2 lore raw

Hi,

Quoted 10 lines · Gert Doering

ACK. Looks reasonable, tested with a 32bit binary on 64bit windows, works (have not tested all possible combinations due to resource constraints, will test as soon as buildbot provides installers)

Your patch has been applied to the master branch.

I'll apply this to release/2.3 as well as it nicely complements 84eb66bf78b0 (but want to have this tested on all platforms first)

commit 15f78acfae2f99b74a72b5766559f28c2d1d3cac (master)

commit 6a8e946174509ca50c63842f155ce5c90cfe43e0 (release/2.3)

this has now also been applied to the release/2.3 branch - I've tested it on a number of different win7 machines (32bit only, 32-on-64, ...) and it seems to do the right thing for all my systems.

Haven't built an XP binary yet, haven't tested on 8/10, but the code looks like it *should* not cause issues... (and if the build breaks for XP, Samuli's Windows-Buildbot will tell me RSN)

gert

Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...