Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ProductName in Windows registry, it is localized for different languages?

I'm attempting to detect the difference between Windows 7, Windows 8/Windows 8.1, and Windows 10 in my C# application. I'm attempting to determine this by using

 HKLM\Software\Microsoft\WindowsNT\CurrentVersion\ProductName

as I can check whether this value contains "Windows 7", "Windows 8", or "Windows 10" reliably.

My question: is the ProductName registry value localized when Windows is using a different language pack? Will this reliably return the above values in English, or does it change based on OS language?

Before I get hammered for not using other methods of determining the operating system that everyone likes to recommend... using OSVersion is out since it does not always return the correct values. Additionally, GetVersion and GetVersionEx are also not an option since they are not recommended after Windows 8.1, they misidentify Windows 10 as Windows 8. The recommended Version Helper functions that are suppose to replace those methods are not available in C#. If anyone knows of another reliable way to determine the difference between those operating systems, please let me know.

like image 306
CODe Avatar asked Oct 31 '22 22:10

CODe


1 Answers

Windows 10 企业版(Enterprise) in Chinese:

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName = Windows 10 Enterprise

which suggests the value is not localized.

like image 139
jingyu9575 Avatar answered Nov 08 '22 21:11

jingyu9575