Download source files - 58 Kb
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 versions it can detect are:
- Windows 3.0
- Windows 3.1
- Windows 3.11
- Windows for Workgroups
- Win32s (if you can call this an OS <g>)
- Windows CE 1.0
- Windows CE 2.0
- Windows CE 2.1
- Windows CE 2.11
- Windows CE 3.0
- Windows 95
- Windows 95 Service Pack 1
- Windows 95 OEM Service Release 2
- Windows 98
- Windows 98 Service Pack 1
- Windows 98 Second Edition
- NT Workstation, Server 3.1
- NT Workstation, Server, PDC, BDC 3.5
- NT Workstation, Server, PDC, BDC 3.51
- NT Workstation, Server, PDC, BDC 4.0
- Windows 2000 Professional
- Windows 2000 Server / Advanced Server
- Windows NT Terminal Server
- Windows NT Enterprise Edition
Some of the possible scenarios it can report on are:
- "You are running an emulated Dos v5.50 On NT".
- "You are running an emulated Windows 3.95 on Windows 95 v4.0 Build 950".
- "You are running Windows for Workgroups on DOS v6.22"
- "You are running NT Server v3.51"
- "You are running an application on Windows NT Terminal Server."
- "This NT machine is acting as a stand alone server, primary domain controller or
backup domain controller."
V1.1 (8 May 1997)
- Fix to remove Unicode and
TCHAR code when being compiled for Win16.
V1.2 (13 September 1998)
- Updated the sample app plus the
DtWinVer code to explicitly support Windows 98.
V1.3 (23 June 1999)
- UNICODE enabled the code.
- Removed need for the
- Added support for detecting Build Number of 95 and 98 from DOS code path.
- Now ships as standard with VC 5 workspace files.
- Added explicit support for Windows 95 SP 1.
- Added explicit support for Windows 95 OSR 2.
- Added explicit support for Windows 98 Second Edition.
- Added explicit support for Windows 2000.
- Added explicit support for Windows CE.
- Added explicit support for Windows Terminal Servers.
- Added explicit support for NT Stand Alone Servers.
- Added explicit support for NT Primary Domain Controllers.
- Added explicit support for NT Backup Domain Controllers.
V1.31 (23 July 1999)
- Tested out support for Windows 98 SE, minor changes required.
V1.32 (26 July 1999)
- Added explicit support for Windows 98 SP 1.
V1.33 (28 July 1999)
- Fixed a problem when application is build in non-huge/large memory model in Win16.
- Added explicit support for returning NT and Win9x service pack information from Win32
and Win16 code paths.
- Updated test program to not bother reporting on any info which does not exist. e.g.
if there is no service pack installed, then we don't bother displaying any info about
- Added explicit support for NT Enterprise Edition.
V1.34 (2 February 2000)
- Fixed a minor copy and paste bug in the test program.
- BOOL GetOSVersion(LPOS_VERSION_INFO lpVersionInformation);
TRUE if the function was successful otherwise FALSE.
- lpVersionInformation -- A pointer to a structure of the following form:
typedef struct _OS_VERSION_INFO
} OS_VERSION_INFO, *POS_VERSION_INFO, FAR *LPOS_VERSION_INFO;
This will be filled in upon a successful return from the function.
Internally this function is called when you click on the "..." button on the UI. You are free
to use this independently of the DDX / DDV code to call up a directory picker dialog in your
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 / workspace 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:
- dosver.mak (VC 1.5x for Dos)
- winver.mak (VC 1.5x for Win16)
- winver32.dsp/dsw (VC 5 for Win32)
Areas where the code may prove useful are:
- A Dos program wants to know if it can be allowed access to hardware ports which is not available on NT,
but is available on Dos, Windows 3.x & Windows 95.
- A Win32 program wants to know if the Windows 95 UI is available.
- A Win16 program wants to know if it can call the Win32 API via generic thunking.
- Checking for the existence of a certain Service pack on Windows 95 or 98.
- Add support for Windows 2000 Advanced Server.
- Add support for Windows 2000 Datacenter Server.
- Add support for Embedded Windows NT.
- Add support for differentiating between NT Server / Workstation from 16 bit Windows code path.
2 February 2000