dtwinver.gif (7742 bytes)DtWinVer v1.3

 

Features
History
API Reference
Notes
Enhancements
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 as well 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

v1.1 (8 May 1997)

v1.2 (13 September 1998)

v1.3 (13 September 1998)

 

 

 

API

GetOSVersion

BOOL GetOSVersion(LPOS_VERSION_INFO lpVersionInformation)

Parameters

lpVersionInformation A pointer to a structure of the following form:

typedef struct _OS_VERSION_INFO
{
//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.

 

 

 

Notes

The code uses some C++’isms and uses MFC header files. If you want, it would be a very simple matter of commenting out 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:

 

 

 

Planned Enhancements

 

 

 

Contacting the Author

PJ Naughter
Email:
pjn@indigo.ie
Web:
http://indigo.ie/~pjn
23rd June 1999