According to MSDN, GetVersionEx (the de facto way of getting the current windows version) has become deprecated as of Windows 8.1. Apparently it returns wrong values (corresponding to Windows 8) if called on a windows 8.1 or 10 machine. However, it can be made to return correctly if the application's manifest is modified correspondingly. But I'm not sure this is such a good solution since
GetVersionEx may be altered or unavailable for releases after Windows 8.1
I was thinking of simply reading the information I need from this registry key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion .
Is there any reason I should avoid doing this, given the current situation (API deprecation) ?
Is there any reason I should avoid doing this?
It is plausible that a future version of Windows will not contain the information that you need in that registry key.
Related
I tried to figure out how to manage compatibility settings for some older programs in an automated way. This Super User question How can I set the compatibility mode for an executable from the command line? already helped a lot pointing onto the registry key being used for compatibility settings.
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
Sadly, there is one tiny detail remaining unanswered so far. I tried to figure out what changes in application's property dialogue does by inspecting the related registry value, and it seemed so simple! But I'm irritated by the tilde char preceding the known compatibility switches, for example:
~ WINXPSP3
~ MSIAUTO
~ RUNASADMIN WINXPSP3
I tried searching the web for it but without success. I found this ~ flag being used in Windows 8.1 (and Windows 8), but not in earlier Windows versions.
Does anyone know more about it?
When is it used?
What does it mean?
Is there any reliable reference?
Most likely, the ~ (tilde) is indeed for Windows 8. I've noticed, in similar situations, on Windows 7, the # (hash) character (followed by space).
How can I find all the installed versions of Firefox browser on Windows XP ? Is there, for example, a special windows registry key where all the versions are stored ? I need this information in order to code a program that tells me what are these installed versions on my Windows XP. I am not asking you to code the program for me, I just ask where I can find that information.
There are some registry keys accessible under
HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla
In Windows CE 5.0, after changing some registry values, the changes don't take effect and I must restart Windows.
How can this be done without restarting Windows?
I was tasked to do this early this week for CE4 so I thought I'd share my findings here (whether or not it's still needed) -- after I updated the registry, I ran this "SaveRegistry.exe" tool from the manufacturer's SDK; see these links for a start and look through your manufacturer's files/setup/install CDs as you may find SDK or sample code:
http://www.microlise.net/VRC8900net/secondary_html/os_version.htm
and
http://www.garz-fricke.de/download.php?fid=380&lg=en
This tool was done in C++ but you can call the executable from whatever language you used.
If type of your registry is hive, you may call RegFlushKey API function.
I need take an old software that was built in 4D 2004 (you probably never heard about 4D but it doesn't matter) and make it compatible with Windows 7 by fooling it and making him believe he's running under Windows XP.
I thought the application was getting the version number of windows from HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion and that I could change this value but I was wrong… Even if I change the values in the registry, the version number of windows returned by my application is always the same:
498139398 for Windows 7
170393861 for windows XP
Those value contains the windows version (this link explain how to extract the version number) but I don’t know where it was taken from.
If you google those numbers, you’ll find out that other applications are referring to the same version number.
I tried to find what registry was used by the application with a Process Monitor but none of the registry accessed by the application seems to be related to a windows version.
Does anyone have a clue of where those values might be coming from? Could it be outside the registry / hardcoded somewhere?
Windows already has tools to do this. Have you tried right-clicking on the program, selecting Properties and looking at the Compatibility tab?
For more complex tricks investigate "Microsoft Application Compatibility Toolkit".
Using either the registry or the file system. The reason for the restriction is that I am doing this as an MSI conditional statement.
Cheers!
under registry key
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion
look for key pair:
CurrentVersion = Microsoft Windows NT 5.1.2600 Service Pack 3
You should find enough information to determine the OS service pack (in the worst case you can always use the build string) in the following registry key:
HKLM\Software\Microsoft\Windows NT\CurrentVersion
If you're using an MSI, you should be able to use the VersionNT and ServicePackLevel properties right in the conditional statement.
eg. The following code checks for Windows XP sp3 or greater:
VersionNT=501 And ServicePackLevel>2
You can also check the WindowsBuild property if you also need the build number.
The VerifyVersionInfo function should allow you to check the version of Windows being run meets your application's requirements, without the pitfalls that can occur with checking for an exact version with GetVersionEx (such as breaking on major version changes - your application will most likely run on Vista, and Windows 7, and future versions not yet developed).
"Run" (Windows key + r or start/run) msinfo32 or sysdm.cpl