Hi,
Found attached bug. Curiously, the test doesn't fail even if wine is pretending to be Windows 95 :)
ChangeLog: Fixed typo "Major" -> "Minor"
BTW, After the patch, the test for WIN98 or later is:
#define WIN98_PLUS(version) (version.dwMajorVersion==4 && \ version.dwMinorVersion>0)
but, MS's documentation: http://msdn.microsoft.com/library/en-us/sysinfo/sysinfo_49iw.asp suggests something more like:
#define WIN98_PLUS(version) \ ( (version.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) && \ ( (version.dwMajorVersion > 4) || \ (version.dwMajorVersion==4 && version.dwMinorVersion>0)))
Is this more correct?
---- Paul Millar
but, MS's documentation: http://msdn.microsoft.com/library/en-us/sysinfo/sysinfo_49iw.asp suggests something more like:
#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
For instance, GetLongPathName is only defined for Win2k and later an Win98 and later (thus no NT4.0): http://msdn.microsoft.com/library/en-us/fileio/filesio_2cv9.asp
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)
Thanks, .Geoff
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
Paul Millar wrote:
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?
NT4.0 has a minor==0, so no, my test will not allow it to pass. However, I was not aware of how dwPlatformID was defined (and I miscounted parentheses in your macro).
I think the method you proposed would be more robust than the way I implemented the check, but currently my method should work fine for all availiable MS platforms. Perhaps it would be best to make a test.h somewhere and put all of these kind of definitions someplace so we don't need to redefine them for each test.
I'm happy that someone is at least looking at my tests though :)
.Geoff
On Wed, 24 Apr 2002, Geoffrey Hausheer wrote:
NT4.0 has a minor==0, so no, my test will not allow it to pass.
Yes, the dangers of sending emails when you're in a rush ...
However, I was not aware of how dwPlatformID was defined (and I miscounted parentheses in your macro).
Its easy to make mistakes (speaking as someone who just made such a mistake :)
I think the method you proposed would be more robust than the way I implemented the check, but currently my method should work fine for all availiable MS platforms.
Agreed. I probably would be more robust, but I, too, doubt the existing code will cause any problems (once Major>0 is replaced with Minor>0) .. I was just curious. BTW, it's not really my macro, I just translated it from MS's documented example on their page about GetVersionExA.
Perhaps it would be best to make a test.h somewhere and put all of these kind of definitions someplace so we don't need to redefine them for each test.
Hmmm, was there an email about that a while ago? I thought Alexandre wasn't happy with the idea, but I can't remember why...
Cheers,
---- Paul Millar
Paul Millar paulm@astro.gla.ac.uk writes:
Perhaps it would be best to make a test.h somewhere and put all of these kind of definitions someplace so we don't need to redefine them for each test.
Hmmm, was there an email about that a while ago? I thought Alexandre wasn't happy with the idea, but I can't remember why...
Version checks are a bad idea because this is not how Wine is implemented. For instance GetLongPathName under Wine doesn't try to fail if you are running with -winver win95, it just works. Adding version checks in the tests just means that some functions won't get tested if you run with the wrong version.
The right way is to always call the function no matter the version, and check that the call either succeeds as expected, or fails in the way that it's supposed to fail on a platform that doesn't support it.