GetVersion() brown paper bag fix

Andreas Mohr andi at rhlx01.fht-esslingen.de
Sun Nov 2 11:20:11 CST 2003


Hi all,

I'm sure very many programs will fail in case of incorrect Win95 or Win98
GetVersion return numbers, thorough patch testing may have been very useful.

Luckily mine didn't fail because of that, but instead because of wrong
default win version, win95 (but it would probably also fail once I set the
version to win98 without that patch...)

Andreas Mohr
-------------- next part --------------
Index: dlls/kernel/version.c
===================================================================
RCS file: /home/wine/wine/dlls/kernel/version.c,v
retrieving revision 1.1
diff -u -r1.1 version.c
--- dlls/kernel/version.c	24 Sep 2003 05:26:00 -0000	1.1
+++ dlls/kernel/version.c	2 Nov 2003 17:15:18 -0000
@@ -196,6 +196,15 @@
 
 /***********************************************************************
  *         GetVersion   (KERNEL32.@)
+ *
+ * Win31   0x80000a03
+ * Win95   0xc0000004
+ * Win98   0xc0000a04
+ * WinME   0xc0005a04
+ * NT351   0x04213303
+ * NT4     0x05650004
+ * Win2000 0x08930005
+ * WinXP   0x0a280105
  */
 DWORD WINAPI GetVersion(void)
 {
@@ -205,7 +214,9 @@
     if (RtlGetVersion( &info ) != STATUS_SUCCESS) return 0;
 
     return MAKELONG( MAKEWORD( info.dwMajorVersion, info.dwMinorVersion ),
-                     LOWORD(info.dwBuildNumber) | ((info.dwPlatformId ^ 2) << 14) );
+                     info.dwPlatformId == VER_PLATFORM_WIN32_NT ?
+		     LOWORD(info.dwBuildNumber) : 0
+		     | ((info.dwPlatformId ^ 2) << 14) );
 }
 
 


More information about the wine-patches mailing list