dtwinver.gif (7742 bytes)DtWinVer

 

Features
History
API Reference
Notes
Contacting the Author

 

 

 

Features

Enclosed is a routine which provides a comprehensive method to determine which OS the program that calls it is running on. All methods it uses are fully documented on various articles on the MSDN CD. The routine provides the emulated OS aswell as the underlying OS. e.g to a Dos program Windows 95 looks like MS-DOS 7.0. A full list of the OS’s it can detect are:

Some of the possible scenarios it can report on are:

 

 

 

History

8 May 1997:

13 September 1998

 

 

 

 

API

 

GetOSVersion
IsUnderlyingWindows95
IsUnderlyingWindows98

 

 

GetOSVersion

BOOL GetOSVersion(LPOS_VERSION_INFO lpVersionInformation)

Parameters

lpVersionInformation A pointer to a structure of the following form:

typedef struct _OS_VERSION_INFO
{
DWORD dwOSVersionInfoSize;
 
//What version of OS is being emulated
DWORD dwEmulatedMajorVersion;
DWORD dwEmulatedMinorVersion;
DWORD dwEmulatedBuildNumber;
DWORD dwEmulatedPlatformId;
#ifdef _WIN32
TCHAR szEmulatedCSDVersion[128];
#else
char szEmulatedCSDVersion[128];
#endif
//What version of OS is really running
DWORD dwUnderlyingMajorVersion;
DWORD dwUnderlyingMinorVersion;
DWORD dwUnderlyingBuildNumber;
DWORD dwUnderlyingPlatformId;
#ifdef _WIN32
TCHAR szUnderlyingCSDVersion[128];
#else
char szUnderlyingCSDVersion[128];
#endif
} OS_VERSION_INFO, *POS_VERSION_INFO, FAR *LPOS_VERSION_INFO;

This will be filled in upon a successful return from the function.

Return Value

TRUE if the function was successful otherwise FALSE.

 

IsUnderlyingWindows95

BOOL IsUnderlyingWindows95(LPOS_VERSION_INFO lpVersionInformation);

Remarks

TRUE if the structure sent in represents Windows 95 otherwise FALSE. See the code in test.cpp for its usage.

 

IsUnderlyingWindows98

BOOL IsUnderlyingWindows98(LPOS_VERSION_INFO lpVersionInformation);

Remarks

TRUE if the structure sent in represents Windows 98 otherwise FALSE. See the code in test.cpp for its usage.

 

 

 

Notes

The code uses some C++’isms and uses MFC header files. If you want, it would be a very simple matter of commenting a few lines here and there to get it to work on any standard "C" compiler on any PC OS. 3 mak files are also included which builds a simple application which reports the OS version, through a message box on Windows and stdio in Dos.

The mak files are:

Areas where the code may prove useful are:

 

 

 

CONTACTING THE AUTHOR

PJ Naughter
Email:
pjn@indigo.ie
Web:
http://indigo.ie/~pjn
13th September 1998