From 1de0e063fec8d7cd2fdc2bac9d2eeaee54dfbc69 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Wed, 25 Aug 2004 15:32:50 +0000 Subject: [PATCH] New function. Returns the Windows version code like GetVersion(), except 2004-08-25 Tor Lillqvist * glib/gwin32.c (g_win32_get_windows_version): New function. Returns the Windows version code like GetVersion(), except that one can pretend to be running on Win9x by setting the G_WIN32_PRETEND_WIN9X environment variable. This is mainly for debugging purposed. * glib/gwin32.h: Declare it. Define macros G_WIN32_WINDOWS_IS_NT_BASED and G_WIN32_HAVE_WIDECHAR_API to test Windows features at run-time. --- ChangeLog | 11 +++++++++++ ChangeLog.pre-2-10 | 11 +++++++++++ ChangeLog.pre-2-12 | 11 +++++++++++ ChangeLog.pre-2-6 | 11 +++++++++++ ChangeLog.pre-2-8 | 11 +++++++++++ glib/gwin32.c | 17 +++++++++++++++++ glib/gwin32.h | 5 +++++ 7 files changed, 77 insertions(+) diff --git a/ChangeLog b/ChangeLog index 4e66a7d..cdbc98a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2004-08-25 Tor Lillqvist + + * glib/gwin32.c (g_win32_get_windows_version): New + function. Returns the Windows version code like GetVersion(), + except that one can pretend to be running on Win9x by setting the + G_WIN32_PRETEND_WIN9X environment variable. This is mainly for + debugging purposed. + + * glib/gwin32.h: Declare it. Define macros G_WIN32_WINDOWS_IS_NT_BASED + and G_WIN32_HAVE_WIDECHAR_API to test Windows features at run-time. + 2004-08-25 Matthias Clasen * configure.in: Post-release version bump. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 4e66a7d..cdbc98a 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,14 @@ +2004-08-25 Tor Lillqvist + + * glib/gwin32.c (g_win32_get_windows_version): New + function. Returns the Windows version code like GetVersion(), + except that one can pretend to be running on Win9x by setting the + G_WIN32_PRETEND_WIN9X environment variable. This is mainly for + debugging purposed. + + * glib/gwin32.h: Declare it. Define macros G_WIN32_WINDOWS_IS_NT_BASED + and G_WIN32_HAVE_WIDECHAR_API to test Windows features at run-time. + 2004-08-25 Matthias Clasen * configure.in: Post-release version bump. diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 4e66a7d..cdbc98a 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,14 @@ +2004-08-25 Tor Lillqvist + + * glib/gwin32.c (g_win32_get_windows_version): New + function. Returns the Windows version code like GetVersion(), + except that one can pretend to be running on Win9x by setting the + G_WIN32_PRETEND_WIN9X environment variable. This is mainly for + debugging purposed. + + * glib/gwin32.h: Declare it. Define macros G_WIN32_WINDOWS_IS_NT_BASED + and G_WIN32_HAVE_WIDECHAR_API to test Windows features at run-time. + 2004-08-25 Matthias Clasen * configure.in: Post-release version bump. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 4e66a7d..cdbc98a 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,14 @@ +2004-08-25 Tor Lillqvist + + * glib/gwin32.c (g_win32_get_windows_version): New + function. Returns the Windows version code like GetVersion(), + except that one can pretend to be running on Win9x by setting the + G_WIN32_PRETEND_WIN9X environment variable. This is mainly for + debugging purposed. + + * glib/gwin32.h: Declare it. Define macros G_WIN32_WINDOWS_IS_NT_BASED + and G_WIN32_HAVE_WIDECHAR_API to test Windows features at run-time. + 2004-08-25 Matthias Clasen * configure.in: Post-release version bump. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 4e66a7d..cdbc98a 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,14 @@ +2004-08-25 Tor Lillqvist + + * glib/gwin32.c (g_win32_get_windows_version): New + function. Returns the Windows version code like GetVersion(), + except that one can pretend to be running on Win9x by setting the + G_WIN32_PRETEND_WIN9X environment variable. This is mainly for + debugging purposed. + + * glib/gwin32.h: Declare it. Define macros G_WIN32_WINDOWS_IS_NT_BASED + and G_WIN32_HAVE_WIDECHAR_API to test Windows features at run-time. + 2004-08-25 Matthias Clasen * configure.in: Post-release version bump. diff --git a/glib/gwin32.c b/glib/gwin32.c index 5d0bb62..b8c69df 100644 --- a/glib/gwin32.c +++ b/glib/gwin32.c @@ -1297,3 +1297,20 @@ g_win32_get_package_installation_subdirectory (gchar *package, return dirname; } + +guint +g_win32_get_windows_version (void) +{ + static gboolean beenhere = FALSE; + static guint version; + + if (!beenhere) + { + if (getenv ("G_WIN32_PRETEND_WIN9X")) + version = 0x80000004; + else + version = GetVersion (); + beenhere = TRUE; + } + return version; +} diff --git a/glib/gwin32.h b/glib/gwin32.h index 5aca580..0bc7320 100644 --- a/glib/gwin32.h +++ b/glib/gwin32.h @@ -93,6 +93,11 @@ gchar* g_win32_get_package_installation_subdirectory (gchar *package, gchar *dll_name, gchar *subdir); +guint g_win32_get_windows_version (void); + +#define G_WIN32_IS_NT_BASED() (g_win32_get_windows_version () < 0x80000000) +#define G_WIN32_HAVE_WIDECHAR_API() (G_WIN32_IS_NT_BASED ()) + G_END_DECLS #endif /* G_PLATFORM_WIN32 */ -- 2.7.4