Hi Geoff,
On Tue, 23 Apr 2002, Geoffrey Hausheer wrote: [...]
#define WIN98_PLUS(version) \ ( (version.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) && \ ( (version.dwMajorVersion > 4) || \ (version.dwMajorVersion==4 && version.dwMinorVersion>0)))
Is this more correct?
I don't think so. If you look at my test, you'll see that I explicitly check for WIN98+ OR Win2k+ (that is, for some functions, the only valid operating systems are Win2k, Winxp, win98, and winme. The code above would allow nt4.0 in there too. The following link is how I defined the macros: http://msdn.microsoft.com/library/en-us/sysinfo/sysinfo_3a0i.asp
Ok, When I posted the fix I didn't know the major and minor versions of the various MS OSs. The above link has almost all the information (it doesn't have maj/min versions for Win3.x). If I've got this right, then the following table should summarise the data:
dwMajorVersion dwMinorVersion dwPlatformID Win3x+Win32s ? ? VER_PLATFORM_WIN32s Win95 4 0 VER_PLATFORM_WIN32_WINDOWS Win98 4 10 VER_PLATFORM_WIN32_WINDOWS WinME 4 90 VER_PLATFORM_WIN32_WINDOWS NT3.51 3 51 VER_PLATFORM_WIN32_NT NT4.0 4 0 VER_PLATFORM_WIN32_NT Win2k 5 0 VER_PLATFORM_WIN32_NT WINXP 5 1 VER_PLATFORM_WIN32_NT WIN.NET 5 1 VER_PLATFORM_WIN32_NT
So, NT3.51 and NT4.0 should both fail the above WIN98_PLUS test (as version.dwPlatformId != VER_PLATFORM_WIN32_WINDOWS). If the test is (Major == 4, Minor > 0) then this would include NT4.0, or am I missing something?
Is something in the test causing a failure? I've tested them on win2k and win98 (the only real Microsoft OS that I have access too)
Nothing's going wrong. I'm not testing these against any real MS OS, but I came across the code and was curious :)
Cheers,
Paul.
---- Paul Millar