DtWinVer is a comprehensive portable OS detection utility that works as a C++ class.
It can provide you with details not only for the underlying OS but also for any emulated systems. There is an extensive list of OS versions that this utility will detect. It covers DOS up to Windows 10 Mobile, and since it is so large, we won't include it in this listing, but you can view it here.
The DtWinVer zip file contains sources for the detection routine and includes project files to create a test program for DOS, Win16, Win32, Windows x64, Windows CE, Windows on ARM, and Windows ARM64.
Some of the possible scenarios it can report on are:
-Running an emulated DOS v5.50 On Windows 2000 Server Build 2195 Service Pack 2 -Running an emulated Windows 3.95 on Windows 95 v4.0 Build 950 -Running Windows for Workgroups on DOS v6.22 -Running NT Server v3.51 -Running an application on Windows NT Terminal Server. -This NT machine acts as a stand-alone server, primary domain controller, or backup domain controller. -Running on an underlying OS of Windows 8.1 Pro build 9431, the emulated OS is Windows 8 Pro Build 9200. -Running on an underlying OS of Windows 10 Pro build 9841 (The Windows 10 Technical Preview build), the emulated OS is Windows 8 Pro Build 9200.