You are correct in that I am not actually running under a Windows 98 OS. I am trying to find out how to tell which OS I am actually running under (without using the GetVersion and GetVersionEx routines).
Main Topics
Browse All TopicsI have an application that runs on Windows 98. To get it to run under Windows XP, I use the Windows 98 compatibility mode. I need to be able to find out whether the operating system I'm running under is really XP or 98. If I'm running the application on Windows XP and use the GetVersion or GetVersionEx call, it tells me I'm always running under Windows 98 (because of the Win 98 compatibility mode). Is there a way to find out the "real" operating system I'm running under while still running in Win 98 compatibility mode??
Thanks in advance for any information you can shed on this.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
when a change is made to the dialog where you select the compatability mode a registry key is edited. That key is:
HKEY_CURRENT_USER\Software
It will create a NAME with the address of where the file is stored (i.e. c:\program files\Windows98Program
It will create a data value out beside that name with the version being used (i.e. WIN95, WIN98, etc.etc.)
So the only questionis how to avoid using the GetVersion routine. I guess you are using a program like Visual Basic?
You could create a batch file with the following command line in it:
REG QUERY "HKCU\Software\Microsoft\W
or
REG QUERY "HKCU\Software\Microsoft\W
I'm sorry - I must not be explaining myself very well. When the application is running on XP, everything I do indicates that the operating system is 98 (because of the Windows 98 compatibility mode). This includes the calls to GetVersion and even the registry entry that you found. I want to find out what the "real" operating system is independent of the compatibility mode. If I'm running on XP, I want something that tells me "You're on XP". If I'm running on 98, I want something that tells me "You're on 98".
Thanks for looking into this......
Have you tried accessing WMI and querying what OperatingSystem is running ?
example, commandline: wmic OS get Name
Can also be aquired without using wmic but rather your custom program interfacing WMI.
example in vbscript (not my tool of choice but ok for this example) :
'---snip begin vbscript, save as .VBS, execute with scripting host like cscript.exe----
Set oWMI = GetObject("winmgmts:")
For Each oOs in oWMI.InstancesOf("Win32_Op
wscript.echo "name: " & oOs.Name
Next
'---- snip end vbscript---
I am trying to do this with an MFC VC++ executable. I have never done WMI in MFC although I think you can with some WMI COM object?? Sometimes COM objects are a pain in the butt in VC++. I will try this if you really think that it would work?? I was really looking for something simple, such as some Win32 routine that returns some value that is unique in XP, or some file or registry entry that is only available on an XP system.
Thanks for the suggestion and let me know what you think.
Well i guess it depends on what your requirements for deployment are.
The quick 'n dirty would be to look for a file that exists in xp but not in win98.
This methods successrate depends on how customized the enduser's system is.
Comparing fileversions of apps won't work because version.dll will translate versioninfo.
You could check if your applications process uses one or more of shimeng.dll, aclayers.dll or acgenral.dll, acspecfc.dll,aclua.dll,AcX
If it does, it's using a shim (id est, it's in compatibility mode.)
Regarding WMI in (visual) c++ , this link has working source:
http://www.codeproject.com
In "Using WMIDlg.cpp" file in example source from codeproject, :
Replace BSTR strQuery = (L"Select * from win32_Processor");
with BSTR strQuery = (L"Select * from Win32_OperatingSystem");
and replace BSTR strClassProp = SysAllocString(L"LoadPerce
with BSTR strClassProp = SysAllocString(L"Name");
and you should have proof of concept and decent example. (also, you might have to link in wbemuuid.lib as an additional dependencie.)
More of WMI on MSDN (example and step by step guide)
http://msdn.microsoft.com/
http://msdn.microsoft.com/
Good luck!
//priich
I see that WMI requires the .NET framework for all of the older operating systems and I'm not sure that is something that we want to impose on our users since many still run Windows 98. Also, I must not have the latest SDK and couldn't compile the example from Code Project.
The WMI solution is still a good one, though, so I will give you the points unless I hear of a non-WMI solution that works.
Thanks priich
Ohh i forgot about that. WMI is not standard in windows 98, it doesn't really require the .NET framework to my knowledge but you need to install Windows Managment Instrumentation core on older operating systems.
(can be found at: http://www.microsoft.com/d
)
I agree, the solution seems less elegant when it may require additional downloads.
Howabout this one then ?
//----snip example code below----
//do not forget to #include <tlhelp32.h>
HANDLE hModuleSnap = NULL;
hModuleSnap = CreateToolhelp32Snapshot( TH32CS_SNAPMODULE, 0 );
MODULEENTRY32* moduleInfo = new MODULEENTRY32;
moduleInfo->dwSize = sizeof (MODULEENTRY32);
while (Module32Next(hModuleSnap,
{
if ((_stricmp(moduleInfo->szM
{
cout<<endl<<"Since "<<moduleInfo->szModule<< " is loaded, this app is in compat mode.";
//set variable here
}
}
CloseHandle(hModuleSnap);
delete moduleInfo;
//----snip end example code----
It iterates through the modules (dlls) loaded by the owning process and if it finds that the acgenral shim is loaded then, well set your marker.
This should work on any 32-bit windows except windows NT4 on which it will crash and burn since toolhelp32 API is not available on windows nt4.
Business Accounts
Answer for Membership
by: spywherePosted on 2004-07-02 at 07:54:55ID: 11457231
Compatability Mode just means that the Windows XP Operating System has created an environment withing it's shell to allow 16bit application to run. I don't think you are actually running a Windows 98 OS.