Jump to content
dummzeuch

Getting the Windows version revisited

Recommended Posts

In my last blog post Getting the Windows version, I claimed that there is no way to get the actual version number of Windows 10 without reading the version information of the Kernel32.dll and interpreting it 1.

Since then I have been told that there is actually a Registry key that contains the Windows version:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion

It has several entries that can be used to get the same version info that the Winver tool displays to the user. On Windows 10 that’s:

  • ProductName
  • ReleaseId
  • CurrentBuildNumber
  • UBR

On my test installation they get me
“Windows 10 Pro” Version “1809” (OS Build “17762”.”437″)

(The quotes denote values read from the registry.)

 

https://blog.dummzeuch.de/2019/04/22/getting-the-windows-version-revisited/

 

Just to make it clear: The above text is not the full blog post.

Edited by dummzeuch
  • Thanks 4

Share this post


Link to post
Guest

I simply use:

 

      Add(TOSVersion.ToString);
      Add('');
      Add('Architecture: ' + OSArchitectureToStr(TOSVersion.Architecture));
      Add('Name: ' + TOSVersion.Name);
      Add('Build: ' + IntToStr(TOSVersion.Build));
      Add('Major: ' + IntToStr(TOSVersion.Major));
      Add('Minor: ' + IntToStr(TOSVersion.Minor));
      Add('Service Pack - Major: ' + IntToStr(TOSVersion.ServicePackMajor));
      Add('Service Pack - Minor: ' + IntToStr(TOSVersion.ServicePackMinor));

 

which works for Windows and macOS and yields:

 

Windows 10 (Version 10.0, Build 18362, 64-bit Edition)

Architecture: IntelX64
Name: Windows 10
Build: 18362
Major: 10
Minor: 0
Service Pack - Major: 0
Service Pack - Minor: 0


Mac OS X (Version 10.14.5)

Architecture: IntelX64
Name: Mac OS X
Build: 0
Major: 10
Minor: 14
Service Pack - Major: 5
Service Pack - Minor: 0

 

 

Edited by Guest
Premature posting :)

Share this post


Link to post
36 minutes ago, OzTrev said:

I simply use:

 

 TOSVersion

I'm aware of TOSVersion, but it's simply not available in some of the Delphi versions I frequently use. As stated in the blog post, the method(s) described there even work(s) with Delphi 6.

  • Like 1

Share this post


Link to post
Guest

My apologies, it was not clear from your forum post (and I didn't read the blog).

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×