Re: Windows Version numbers for Windows 2008

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



That's not uncommon. For many structures passed to API functions, you have
to specify the size of the structure. And this is precisely so there's
backwards compatibility among versions of Windows. I've never put it to
the
test, but I've always been under the impression that if you specify a
structure size larger than the version of Windows supports, you'll corrupt
memory

That would be a contradiction. There's not much
point to the backward compatibility if it won't work.
And there would be no point to specifying the allotted
size unless the function is using that as a guide to
how much data it can write.

I just found a curious thing, though, in trying various
tests. If I use an OSVERSIONINFO it works fine, and
if I use an OSVERSIONINFOEX it works fine (Win98).
In both cases I'm calling GetVersionEx. That makes sense.
But I found some odd things:

If I use
OSV.dwOSVersionInfoSize = Len(OSV) + 4
or
OSV.dwOSVersionInfoSize = 2 * Len(OSV)
or
OSV.dwOSVersionInfoSize = 164 '-- correct number is 156


it doesn't crash, but all of the members return 0!
Also, if I add extra members to the structure, like
extra1 as long
extra2 as long
it doesn't crash but all members return 0.

I assumed that I could use any size Type structure,
and send anything in the size member, as long as I
specify a size big enough and look for the data at the
right offset. But the function -- or maybe VB? -- seems
to have some kind of safety in place that prevents me
from using an invalid structure size, even when it's too big!
I can't account for that. I don't see how VB could know
about the Types, since I have to declare them, so maybe
it's built into kernel32 to check for a valid structure?


In my circa 98 copy of MSDN it has this:

lpVersionInformation
Pointer to an OSVERSIONINFO data structure that the function
fills with operating system version information. .....
Windows NT 5.0 and later: This member can be a pointer to an
OSVERSIONINFOEX structure.

It also notes, under the GetVersion listing, that GetVersionEx
is not an NT call but rather an improved version because it
returns version data in a structure rather than as a long flag
variable. So maybe the OSVERSIONEX structure was there from
the beginning; just not needed on Win9x.

So now I'm very curious what is enforcing the size of the
structure, but I think we've at least established that all
systems can use GetVersioEx and that all can use either
structure.







.



Relevant Pages

  • Re: ASM objects?
    ... > Mind explaining what Borland's OWL is about? ... "Microsoft" is written multiple times on the Windows loading screen (it ... endianness thereafter... ... smart to specify and when it's actually far, ...
    (alt.lang.asm)
  • RE: W2K Professional Install with original CD (pre-service packs)...a
    ... install up, then when I rebooted it was time for the critical patch to .NET ... only valid club members can have that. ... old thing was this Windows 2000 Professional CD that never existed before the ... svchost.exe trying to access the Internet. ...
    (microsoft.public.win2000.setup)
  • Re: Distribution list update
    ... OL2000 is on Windows XP. ... >>> members, just not the members of the distribution lists. ... >>> different client ...
    (microsoft.public.exchange.clients)
  • Re: Creating a C++ like message loop in .NET threaded classes.
    ... Just grab your good ol' C++ message loop knowledge and write the same code in .NET, calling API functions such as GetMessage and DispatchMessage through P/Invoke. ... control over Windows message processing (or maybe it's in the .NET and I ... Now I don't necessarily want the code of these members ... the object processes the message when its thread is ...
    (microsoft.public.dotnet.framework)
  • Re: users last-logon-timestamp
    ... Otherwise memberOf will only match the direct members. ... Co-author of "The .NET Developer's Guide to Directory Services Programming" ... Also, lastLogonTimestamp is a "normal" date time, so you don't need to ... we are at windows 2000 native mode with mixed Windows ...
    (microsoft.public.windows.server.active_directory)