GetVersion() brown paper bag fix (#2)
Andreas Mohr
andi at rhlx01.fht-esslingen.de
Sun Nov 2 15:26:38 CST 2003
Thanks to Marcus for hint, resubmitting!
---
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 21:24:33 -0000
@@ -196,16 +196,30 @@
/***********************************************************************
* GetVersion (KERNEL32.@)
+ *
+ * Win31 0x80000a03
+ * Win95 0xc0000004
+ * Win98 0xc0000a04
+ * WinME 0xc0005a04
+ * NT351 0x04213303
+ * NT4 0x05650004
+ * Win2000 0x08930005
+ * WinXP 0x0a280105
*/
DWORD WINAPI GetVersion(void)
{
RTL_OSVERSIONINFOEXW info;
+ DWORD result = 0;
info.dwOSVersionInfoSize = sizeof(info);
if (RtlGetVersion( &info ) != STATUS_SUCCESS) return 0;
- return MAKELONG( MAKEWORD( info.dwMajorVersion, info.dwMinorVersion ),
- LOWORD(info.dwBuildNumber) | ((info.dwPlatformId ^ 2) << 14) );
+ result |= MAKEWORD( info.dwMajorVersion, info.dwMinorVersion );
+ if (info.dwPlatformId == VER_PLATFORM_WIN32_NT)
+ result |= LOWORD(info.dwBuildNumber) << 16;
+ result |= (info.dwPlatformId ^ 2) << 30;
+
+ return result;
}
More information about the wine-patches
mailing list