Reliable way to get Windows Version from registry - windows

I'm checking the windows version in an installer (made with NSIS) by checking the following registry key:
HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" "CurrentVersion"
According to this post and this page from MSDN, the currentVersion number for Windows 10 should be 10.0.
I just installed the Windows 10 Pro Insider Preview and the version number given in the registry is still 6.3, instead of 10.10 as it should.
Is there another reliable way in registry to detect Windows 10?

Instead of reading the value CurrentVersion, read the new values CurrentMajorVersionNumber (which is 10) and CurrentMinorVersionNumber (which is 0) under Windows 10. Those 2 keys are new in Windows 10 to detect Windows Version from Registry.

There's also a human-readable string in the registry called "ProductName"
using Microsoft.Win32;
private string getOSInfo()
{
string registry_key = #"SOFTWARE\Microsoft\Windows NT\CurrentVersion";
var key = Registry.LocalMachine.OpenSubKey(registry_key);
var value = key.GetValue("ProductName");
return value.ToString();
}

Try
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ReleaseId
Which gives me 10 and 1709.

See Peter Bright's article at https://arstechnica.com/information-technology/2014/11/why-windows-10-isnt-version-6-any-more-and-why-it-will-probably-work/ for more insight on why you see the answers you do. As you already saw from #magicandre1981, the CurrentMajorVersionNumber key will give you the "10" you want. You can get 10.0 from System.Environment.OSVersion if the application manifest explicitly designates your app for Windows 10, as stated in the referenced article. Without it, Environment.OSVersion will give you 6.2.9200, which is the same as Windows 8. So, your Windows 10 version is 10.0, 6.3, or 6.2, depending on how you ask the question.

Related

Why does Windows 10 report its version as 6.3? [duplicate]

I'm checking the windows version in an installer (made with NSIS) by checking the following registry key:
HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" "CurrentVersion"
According to this post and this page from MSDN, the currentVersion number for Windows 10 should be 10.0.
I just installed the Windows 10 Pro Insider Preview and the version number given in the registry is still 6.3, instead of 10.10 as it should.
Is there another reliable way in registry to detect Windows 10?
Instead of reading the value CurrentVersion, read the new values CurrentMajorVersionNumber (which is 10) and CurrentMinorVersionNumber (which is 0) under Windows 10. Those 2 keys are new in Windows 10 to detect Windows Version from Registry.
There's also a human-readable string in the registry called "ProductName"
using Microsoft.Win32;
private string getOSInfo()
{
string registry_key = #"SOFTWARE\Microsoft\Windows NT\CurrentVersion";
var key = Registry.LocalMachine.OpenSubKey(registry_key);
var value = key.GetValue("ProductName");
return value.ToString();
}
Try
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ReleaseId
Which gives me 10 and 1709.
See Peter Bright's article at https://arstechnica.com/information-technology/2014/11/why-windows-10-isnt-version-6-any-more-and-why-it-will-probably-work/ for more insight on why you see the answers you do. As you already saw from #magicandre1981, the CurrentMajorVersionNumber key will give you the "10" you want. You can get 10.0 from System.Environment.OSVersion if the application manifest explicitly designates your app for Windows 10, as stated in the referenced article. Without it, Environment.OSVersion will give you 6.2.9200, which is the same as Windows 8. So, your Windows 10 version is 10.0, 6.3, or 6.2, depending on how you ask the question.

Watin - how I can do the testing on different versions of Internet Explorer?

I need to do tests on different versions of Internet Explorer browser, but not WATIN.CORE.IE a method that would alter the version of browser used. I hope you understand my problem.
You will need multiple virtual machines each installed with a different version of ie because you cannot install ie versions side by side (There are a few hacks but you never get a true representation).
You can query the registry to get the IE version.
To output the full version number to the NUnit console do the following.
var ieKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(#"SOFTWARE\Microsoft\Internet Explorer");
if (ieKey == null)
{
Console.WriteLine("IE key not found");
}
else
{
Console.WriteLine("Version:" + (string)ieKey.GetValue("Version"));
}
The above was verified using: Windows 7, IE8 and WatiN 2.0
Thanks be to Jeroen as the registry call is copied verbatim out of IE.cs

Problem with expression blend on 64bit laptop

I'm trying to run expression "blend" on my laptop, but when i run project i get an error message with the following solution:
I don't know where I'm supposed to do this.
I got the answer from an expression blend help forum.
I solved the problem as follows.
Using regedit.exe I navigated to th registry path
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
and selected the key Platform. Platform had the value MCD.
Then I deleted only the value MCD. After this the key Platform was still there but empty. I closed Regedit, restarted my PC and run Blend 4.

check if UAC is enabled with VB6

is it possible to check if UAC is enabled with VB6 on win7 and vista?
i know it has to do with reading a value in the registry, i have see .net versions, but i need a vb6 sample code
thanks
DevX.com has an example of how to read the registry using VB6.
You'll have to add this constant: Const HKEY_LOCAL_MACHINE = &H80000002...it's missing from the sample.
You'll want to read the HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System key's EnableLUA value. 1 == enabled.
There's also a decent example at freevbcode.com.

Where to change assemblyinformation-defaults?

our system-administrator has installed visual studio 2008 on my pc and didn't enter our companys name. Now i have the problem, that I always have to change the name in the assembly-information manually, because the pc-manufacturer is automatically inserted to the assembly-informations. Does anybody know where I can change the default-values for the assemblyinformations in visual-studio, because I alway forget to change the company and copyright value.
Try this post. This will help you set the company name attribute permanently via registry.
Answer: Set the value of the registry key for HKLM\Software\Microsoft\Windows NT\CurrentVersion\RegisteredOrganization For 64 bit OS, the registry key is HKLM\Software\Wow6432Node\Microsoft\Windows NT\CurrentVersion\RegisteredOrganization

Resources