How to determine "real" OS version if Windows returns the "compatible" version

How to determine "real" OS version if Windows returns the "compatible" version

Post by Piete » Wed, 02 Jul 2003 05:41:09


Windows can return version information that will make an application think
it is runnin gon an older OS. This is normall done for compatiblity reasons
to make older apps run on newer OS'es.

We have an app that when running on Windows 2003 gets told by
GetVersionInfoEx() that the OS is Windows 2000.

How do we circumvent Windows compatibility result and get the real OS
version?
 
 
 

How to determine "real" OS version if Windows returns the "compatible" version

Post by Gary Chans » Wed, 02 Jul 2003 14:06:20


What do you mean by "the OS is Windows 2000"?

Unless your program is running in "Windows 2000" compatibility mode,
GetVersionEx should return
dwMajorVersion = 5
and
dwMinorVersion = 2 - Windows 2003
dwMinorVersion = 1 - Windows XP
dwMinorVersion = 0 - Windows 2000

--

-GJC
-Software Consultant (Embedded systems and Real Time Controls)
XXXX@XXXXX.COM

-War is the last resort of the incompetent.

 
 
 

How to determine "real" OS version if Windows returns the "compatible" version

Post by Ivan Brugi » Wed, 02 Jul 2003 14:21:27

Any API-based method is doomed to be circumvented.
Since Microsoft owns the loader, the loader is free to map
the GetVersionInfoEx / RtlGetVersion API to an equivalent
API for good App-Compat reasons.

The correct approach is not to rely on a certain OS version to work,
but to test the existence of all the explicitely required services from the
OS.
There are too many application that installs fine on a default machine,
but, as soon as IE-Hardened is installed,
or as soon as some less known service is stopped they cease to work.

For your problem, you need an external "trusted source" (a service or a
driver)
that is free from the App-Compat problems.
Look for example at the Win32_OperatingSystem class in MSDN.
It's a service that populates that class, and that service is free form
App-Compat.


--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included script samples are subject to the terms specified at
http://www.yqcomputer.com/




reasons
 
 
 

How to determine "real" OS version if Windows returns the "compatible" version

Post by Piete » Thu, 03 Jul 2003 07:39:17

Thanks, I'll give it a try.



the
rights.


think