I'm running Windows 10 Professional 1809 build 17763.
The value of HKLM\SOFTWARE\ WOW6432Node\Microsoft\Windows NT\CurrentVersion\EditionID
is "Enterprise"
, which is wrong.
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\EditionID
is "Professional"
, which is correct.
Is this a specific problem with my Windows installation? If not, how would you solve it if you would develop in 32 bit?
My original code is in C++. Because I didn't understand the issue first, I reimplemented it in C#. I would appreciate solutions in C# or C++ and I'm confident that I can solve the issue in one language given a solution in the other language. Thank you!
using System;
using System.Collections.Generic;
using Microsoft.Win32;
class Program
{
static void Main(string[] args) {
List<string> valueNames = new List<string> { "ProductName", "EditionID" };
foreach (var valueName in valueNames) {
string value = (string)Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", valueName, "Key not found");
Console.WriteLine($"{valueName}: {value}");
}
}
}
//---- C++ version
#include "Registry.hpp" // Modern C++ Wrappers for Win32 Registry Access APIs by Giovanni Dicanio
const std::wstring subKey{ L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion" };
const std::wstring value{ L"EditionID" };
std::wstring ws = win32::RegGetString(HKEY_LOCAL_MACHINE, subKey, value);
this->windowsEdition = std::string(ws.begin(), ws.end());
EditionID
should be "Professional"
, but is "Enterprise"
.