DtWinVer v1.74
Features
DtWinVer is a C++ class 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:
- Dos
- 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 CE.Net
- Windows CE 5
- Windows 95 Gold
- Windows 95 Service Pack 1
- Windows 95B aka OEM Service
Release 2[.1]
- Windows 95C aka OEM Service
Release 2.5
- Windows 98
- Windows 98 Service Pack 1
- Windows 98 Second Edition
- Windows Millennium Edition
- NT 3.1
- NT 3.5
- NT 3.51
- All flavours of NT, 2000 and
XP Service packs
- NT 4.0
- NT Workstation, Server, PDC,
BDC, DataCenter, Enterprise
- Windows 2000
- Windows 2000 Professional,
Server, Domain Controller, DataCenter and Advanced Server
- Windows Terminal Services and
Back Office
- Windows XP Starter Edition, XP Personal & XP
Professional
- Windows Server 2003, Windows
Server 2003 (Web Edition), Windows Server 2003 Domain Controller,
DataCenter, Enterprise Server & 64 bit Editions
- Windows Server 2003 R2,
Windows Server 2003 R2 (Web Edition), Windows Server 2003 R2 Domain
Controller, DataCenter, Enterprise Server & 64 bit Editions
- Embedded Windows NT / 2000 / XP.
- XP Media Center Edition
- Windows XP Tablet PC Edition
- Windows Vista (All SKU's including Starter Edition, Home Basic N, Home
Basic, Home Premium, Business N, Business, Enterprise and Ultimate).
- Windows Longhorn Server.
- Windows Server 2003, Computer Cluster Edition
- Windows Storage Server 2003 R2
- Windows "Security Application" mode
- BackOffice components installed
Some of the possible scenarios it
can report on are:
- "You are running an emulated
Dos v5.50 On Windows 2000 Server Build 2195 Service Pack 2"
- "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 this 32 bit
process on the WOW64 layer of 64 bit Windows"
- "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.
Copyright
You are allowed to include the source code in any product (commercial,
shareware, freeware or otherwise) when your product is released in binary form.
You are allowed to modify the source code in any way you want except you cannot
modify the copyright details at the top of each module. If you want to
distribute source code with your application, then you are only allowed to
distribute versions released by the author. This is to maintain a single
distribution point for the source code.
History
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 (22 June 1998)
- UNICODE enabled the code.
- Removed need for the dwOSVersionInfoSize variable.
- 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 Server's.
- Added explicit support for NT Stand Alone Server's.
- Added explicit support for NT Primary Domain Controller's.
- Added explicit support for NT Backup Domain Controller's.
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 service packs.
- Added explicit support for NT Enterprise Edition.
v1.34 (2 February 2000)
- Fixed a minor copy and paste bug in the test program.
v1.35 (30 June 2000)
- Added explicit support for Windows Millennium Edition
v1.4 (29 January 2001)
- Added explicit support for XP Personal
- Added explicit support for XP Professional
- Added explicit support for XP Server
- Added explicit support for XP Advanced Server
- Added explicit support for XP Datacenter
- Added explicit support for XP 64 bit (all flavours)
- Made all the code into a C++ class called COSVersion
- Rewrote all the generic thunk code to be easier to follow
- Generic thunk code now uses CallProcEx32W
- Added explicit support for BackOffice Small Business Edition
- Added explicit support for Terminal Services
- 16 bit code path now can determine ProductSuite and ProductType type thro
additional generic thunk code
- Provided a 64 bit test binary and make batch file (make64.bat) for those
lucky enough to have an Itanium processor and a beta of 64 bit Windows XP.
- Provided a Embedded C++ workspace and X86 Release binary.
- Updated copyright information
v1.41 (10 February 2001)
- Updated function names etc following MS decision to call Whistler "Windows
XP".
v1.42 (10 October 2001)
- Added code to 32 bit code path to detect if we are being run under 64 bit
Windows. Also updated the sample app to distinguish between emulated 64 bit
and underlying 64 bit.
- Updated the sample app to call XP Server its proper name which will be
"Windows.NET Server"
v1.5 (13 December 2001)
- Major upgrade. Now 16 bit DOS path can return as much information as
native Win32 code. This is achieved by spawning off the Win32 utility
WriteVer with a special command line option. Please note that if you intend
deploying dtwinver then you must now ship the writever.exe file in addition
to linking in the dtwinver code into your application. Also this utility
needs to be in the path or current directory when the dtwinver code is
executing. Thanks to Chaz Angell for prompted me into finding a solution for
this last major item missing in dtwinver.
23 March 2002
- Updated Win32 and Win64 apps to have version info in them. No changes
have been made to the main dtwinver code.
v1.6 (30 August 2002)
- Provided an update CE workspace to work correctly in eMbedded Visual C++
v3. All build configurations for eVC 3 have also been provided.
- Optimized the usage of _tcscat and _tcscpy in the test app which comes
with Dtwinver.cpp
- OEM Info string and Platform Type string is now returned for CE code path
- Fixed display of minor version number for example Windows.Net is version
number v5.20 but should be shown as 5.2 to be consistent with what the
native ver command displays
- Provided a new CE workspace to work correctly in eMbedded Visual C++ v4.
All build configurations for eVC 4 have also been provided.
v1.61 (8 October 2002)
- Now uses OSVERSIONINFOEX it possible in the Win32 or Win64 code paths.
This provides for more reliably detection of Windows XP Home Edition.
- Renamed the functions which detect Windows .NET Server 2003. Also updated
the test code which prints out these names
- Provided explicit support for Windows .NET Web Server
- Fixed a bug in the display of the minor OS version number on Windows .NET
Server.
- Made the project for WriteVer a VC 5 project instead of VC 6 which it was
up until now.
- Reworked the internal function WhichNTProduct to use a constant input
string parameter
- Added explicit support for Windows NT / 2000 / XP Embedded
- Added explicit support for detecting Terminal Services in remote admin
mode
v1.62 (11 October 2002)
- Fixed a problem where on Windows XP, the test program will include the
text "(Standard Edition)"
- Added two variables to the OS_VERSION_INFO structure to report the minor
service pack number
- Removed the OS_VERSION_INFO structure from the global namespace
- Removed all static member variables from the class
- Added a member variable to the OS_VERSION_INFO to return the various
"suites" installed
- Reduced the number of calls to WriteVer to 1 when called from dos
code path.
- Completely reworked the internal WhichNTProduct method
- General tidy up of the header file
- Completely reworked the ValidateProductSuite method
- Now only 1 call is made to WhichNTProduct throughout a single call to
COSVersion::GetVersion
- Now only 1 call is made to ValidateProductSuite throughout a single call
to COSVersion::GetVersion
- Fixed an unitialized variable problem in COSVersion::IsUnderlying64Bit
- Changed "WhichNTProduct" method to "GetNTOSTypeFromRegistry"
- Changed "ValidateProductSuite" method to
"GetProductSuiteDetailsFromRegistry".
- Now correctly reports on Terminal Services being in Remote Admin Mode on
OS which do not support calling GetVersionEx using an OSVERSIONINFOEX
structure i.e any NT 4 install prior to SP6.
- 16 bit Windows code path now reports as much NT information as the Win32
code path
- Fixed a bug in COSVersion::GetInfoBySpawingWriteVer which was failing if
it encountered an empty CSD string. This was spotted on Windows .NET Server
which since it is in beta still (as of October 2002) does not have any
service pack!.
v1.63 (10 January 2003)
- Update to support MS deciding to change the name of their Whistler Server
product. The product will now be called "Windows Server 2003".
v1.64 (30 January 2003)
- Added explicit support for detecting NT Service Pack 6a
v1.65 (8 February 2003)
- Added explicit support for detecting Windows XP Service Pack 1a
- Added support to determine the HAL on NT Kernels. Thanks to Christian
Kaiser for suggesting this addition.
v1.66 (12 February 2003)
- Fixed a compiler warning in GetNTServicePackFromRegistry which occurs when
the code is compiled with the Watcom compiler. Thanks to Christian Kaiser
for reporting this.
v1.67 (8 March 2003)
- Updated a comment in COSVersion::GetProductSuiteDetailsFromRegistry re NT
Embedded.
- A comment from John A. Vorchak: On NTe (NT Embedded) and XPE (XP
Embedded), all of the versions (of DTWinver) work just fine so long as the
components to support them are included in the images, which itself is kind
of a crap shoot. I think that you would probably find that most images will
not support the DOS or Win16 versions however most will support the Win32.
Many of the images that folks build either do not include the DOS subsystem
and some of them do not include Explorer, so it really can't be said that
all builds will support them however it is not difficult for a developer to
understand which version would work for them as they understand their target
systems better than anyone and at least one version would certainly work for
almost all images. As far as Win2k (Server Appliance Kit), I haven't done
enough testing with that platform, nor do I currently have any built images
with the SAK to say positively or otherwise. More than likely you would find
no problems with the SAK images since they typically follow W2k much more
than NTe or XPE do. Author: If you are writing for an embedded OS, then
there is little use for DTWinver!!, since the developer has very tight
control over the runtime environment. Also if you do use DTWinver on an
embedded version of Windows, you will probably compile in the dtwinver code
rather than ship the sample binaries I include in the dtwinver download.
v1.68 (10 April 2004)
- Removed a number of unreferenced variable warnings when you compile the
code on VS.NET 2003. Thanks to Edward Livingston for reporting these issues.
- Now includes support for Windows XP Media Center Edition. Please note that
if you want to do specific version checking of what version of Media Center
you have installed then you should use my CVersionInfo classes at
http://www.naughter.com/versioninfo.html in conjunction with the following
information which I culled from
http://salloway.org.uk/mediacenter/2004/version.htm which describes
the various version numbers of ehshell.exe in \Windows\ehome to the
corresponding versions of XP Media Center Edition.
Windows XP Media Center Edition: 2002 |
Build Information |
Ident Tag |
5.1.2600.1106 |
First released version of Windows Media Center |
N/A |
5.1.2600.1142 |
Highest released build of Media Center 2002
(provided via Q815487) |
1.5 |
Windows XP Media Center Edition: 2004 |
Build Information |
Ident Tag |
5.1.2600.1217 |
Release build of Windows Media Center 2004
(upgrade over previous MCE 2002 build). |
2.0 |
5.1.2600.1321 |
December 2003 Hotfix for Media Center 2004
version (provided via Q830786) |
2.7 |
5.1.2600.2096 |
Media Center Version included with Windows
XP Service Pack 2 Release Candidate 1. This version can be installed
over a current MCE 2002 or 2004 using the Windows XP Service Pack 2
installer. If you have any build between 1322 and 2095 assume this
to be a beta version. |
2.8 |
5.1.2600.2149 |
Media Center Version included with Windows
XP Service Pack 2 Release Candidate 2 . This version can be
installed over a current MCE 2002 or 2004 using the Windows XP
Service Pack 2 installer. If you have any build between 2097 and
2148 assume this to be a beta interim build. |
2.8 |
5.1.2600.2180 |
Media Center version included in the final
version of Windows XP Service Pack 2. This version can be installed
over a current MCE 2002 or 2004 using the Windows XP Service Pack 2
installer. Media Center 2004 and 2005 share the same build number,
the MCE 2004 version of 2180 was compiled on the 4th August 2004.
This information can be seen in ehshell.exe's properties. |
2.8 |
Windows XP Media Center Edition: 2005 |
Build Information |
Ident Tag |
5.1.2700.2180 |
Release Build of Windows XP
Media Center 2005 built on top of Windows XP SP2. Note: This version
is not included with Service Pack 2 even though the minor build
number is the same. Media Center 2004 and 2005 share the same build
number, but the MCE 2005 version of 2180 was compiled on the 10th
August 2004. This information can be seen in ehshell.exe's
properties. |
3.0 |
5.1.2700.2230 |
Version of Media Center provided
by 'Update Rollup 1 for Windows XP Media Center Edition 2005' which
contains various updates for Windows XP Media Center Edition 2005
such as HDTV (ATSC) support for users in the United States, and
Teletext fixes for the UK. This update is recommended for all
Windows XP Media Center Edition 2005 customers.
|
3.1 |
5.1.2700.2231
(German Only)
|
Version of Media Center provided
by the German vesion of Update Rollup 1 for Windows XP Media Center
Edition 2005'. Specifically this corrects a German only string
localization issue. German visitors to Windows Update will
automatically get 2231 from rollup 1, all other languages 2230.
|
3.1 |
5.1.2710.2732 |
Major update to Media Center
2005, this year’s release of Media Center is provided as an update
rather than a whole separate edition. For more details see:
Here
|
4.0 |
5.1.2715.2773 |
Version of Media Center provided
with KB908250 for Update Rollup 2. Mainly a fix for non USA DVB-T/Teletext
issues, but also includes greater support for optical drives
(Matsushita DVD RAM UJ-846s) and some interoperability improvements
for some third party software |
4.0 |
5.1.2715.2812 |
January 2006 rollup patch for
Media Center 2005 with rollup 2 (KB912067). This update corrects a
number of issues including Media Center taking minutes to return
from hibernation, video stutter after hibernation/stand by (S4/S3),
Media Center might stop responding when Alt+Tab is pressed and
Taiwan also gains the [supported] ability to use hybrid tuner cards
(Digital/Analogue). |
4.0 |
- dtwinver now returns the processor architecture via a call to
GetSystemInfo or GetNativeSystemInfo. This is used to differentiate between
64 Bit Windows on Itanium and AMD64 processors.
- Renamed the global preprocesor defines used by dtwinver to use more unique
names
- Added make files and binaries for AMD64 processors.
v1.69 (26 June 2005)
- INTEL_PROCESSOR enum is now more correctly know as IA32 which means x86 32
bit.
- Fixed a bug where the OS_VERSION_INFO parameter was not be zero set in the
function COSVersion::GetVersion. Thanks to "Remio" for reporting this issue.
v1.70 (29 June 2005)
- Added support for detecting if code is running on Tablet PC Edition of
Windows.
- Code now uses GetSystemMetrics call in preference to direct registry calls
to detect Media Center Edition of Windows.
- Renamed the functions which differentiate between the different OEM
Service Release versions of Windows 95. They are OSR 2[.1] = Win95B, OSR2.5
= Win95C. For the gory details please see the KB article at
http://support.microsoft.com/kb/q158238/. The code now also explicitly
supports Win95C.
v1.71 (22 July 2005)
- Now includes support for Windows Vista, formerly Windows codename
"Longhorn".
v1.72 (6 September 2005)
- Renamed some of the functions
which detect Longhorn Server. Previously the functions were incorrectly
referring to Vista Server. Vista is the name of the Windows Client. As of
yet, a product name has not been picked for Longhorn Server.
- Now includes support for
Windows Server 2003 R2.
- Now includes support for
Windows XP Starter Edition and any future versions such as Windows Vista
Starter Edition
v1.73 (17 May 2006)
- Updated copyright details.
- Updated documentation to use the same style as the web site.
- Updated documentation on version numbers which XP Media Center can have.
- Added support for Windows Server 2003, Computer Cluster Edition
- Added support for Windows Storage Server 2003 R2
- Added support for detecting if Windows is installed in a "Security
Application" mode
- Added support for detecting BackOffice components are installed
- Provided Visual Studio 2005 solution to build DtWinver with.
v1.74 (21 September 2006)
- Included support for detecting all the different types of Vista SKU's,
namely: Windows Vista Starter Edition, Windows Vista Home Basic N, Windows
Vista Home Basic, Windows Vista Home Premium, Windows Vista Business N,
Windows Vista Business, Windows Vista Enterprise, and Windows Vista
Ultimate.
- Fixed a bug in the displaying of unknown versions of Windows in the
sample app
API
The API provided is through a C++ class namely "COSVersion". It provides a
number of functions, the most important being "GetVersion" which does the actual
version detection. There are a number of additional functions which tell you if
a certain "flavour" of an operating system is installed. For more info on how to
use the function, please see the code in test.cpp.
Notes
The code uses C++ but does not
use MFC. 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.dsw (VC 5/6 for
Win32).
- winverce3.vcw (Embedded Visual
C++ 3 for Windows CE).
- winverce4.vcw (Embedded Visual
C++ 4 for Windows CE).
- makeIA64.bat (Batch file which
will built a IA64 bit binary for 64 bit Windows on the Itanium processor)
- makeAMD64.bat (Batch file
which will built a x64 bit binary for 64 bit Windows on the AMD64/EMT64
processors)
- winver32.sln (Visual Studio 2005 solution for Win32 and x64)
Also included in the winver32
workspace is a sub project to build the WriteVer executable needed for the 16
bit DOS code path in DtWinVer.
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.
Planned Enhancements
- Provide support for detecting extensions such as MMX, SSE[2][3], 3DNow etc
etc.
- Support detecting the different SKU's of Windows Vista
Contacting the Author
PJ Naughter
Email: pjna@naughter.com
Web: http://www.naughter.com
21 September 2006