How to determine Windows version 11? (RtlGetNtVersionNumbers returns Windows 10) lazarus / 21-General ---------------------------------------------------------------------- dculp · 2025-04-06 13:55 I'm trying to determine the Windows version on my Windows 11 computer. I use the following code from BobDog (https://forum.lazarus.freepascal.org/index.php/topic,60982.15.html - page 2, reply 18). However, although my computer is Win11, RtlGetNtVersionNumbers returns - Major version 10 Minor version 0 build number 26100 Thanks. Lazarus 3.8 (rev lazarus_3_8) FPC 3.2.2 i386-win32-win32/win64 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program Windows_version_100a; {$mode objfpc}{$H+} procedure RtlGetNtVersionNumbers(major:pointer;minor:pointer;build:pointer)cdecl external 'ntdll.dll' name 'RtlGetNtVersionNumbers'; procedure getversion(var maj,min,bld:dword);beginRtlGetNtVersionNumbers(@maj,@mi n,@bld);bld:=lo(bld);end; varmaj,min,bld:dword;beginmaj:=0;min:=0;bld: =0;getversion(maj,min,bld);writeln('Major version ',maj);writeln('Minor version ',min);writeln('build number ',bld);writeln('press return to end . . .');readln;end. ---------------------------------------------------------------------- TRon · 2025-04-06 14:02 https://www.lifewire.com/windows-version-numbers-2625171 ---------------------------------------------------------------------- dculp · 2025-04-06 14:13 @TRon - Your link gives a list of the Windows versions. I need the Pascal code (or code that I can modify to Pascal) that will return the Windows 11 version (rather than returning Win10 when I'm actually running Win11). ---------------------------------------------------------------------- TRon · 2025-04-06 14:16 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i if bld >= 22000 then writeln('windows 11'); ---------------------------------------------------------------------- AlexTP · 2025-04-06 14:39 I just added some info to the wiki, https://wiki.freepascal.org/Windows_version . ---------------------------------------------------------------------- 440bx · 2025-04-06 16:57 It used to be that RtlGetNtVersionNumbers returned the true Windows version but, no longer Somewhere along Win 10, the implementation changed and now the function returns values that are stored "somewhere" (likely the PEB), telling the calling program the version is whatever Windows wants the program to think it is. I don't run Windows 11 (and never will) but, if I were running it and needed some way of finding out the version number, I'd check the product version of csrss.exe, that exe is a critical component of Windows and usually accurate information about Windows can be had by "inspecting" that file. Try this, use Explorer to go to system32, find csrss.exe, right click on it and select properties.  The properties window has a "version" tab.  Look in that tab.  If the product version says "10.xx.xx" then, it's quite likely cumbersome and possibly difficult to tell Win11 from Win10 (but, there is probably a way, fortunately, I don't have to find out and, won't have to find out either ) HTH. ---------------------------------------------------------------------- dculp · 2025-04-06 17:20 @AlexTP - I tried the code from your link but I get numerous compiler errors linked the closing "end." statement. It seems to think this is a Windows program but I want to run it as a console. (I've added LCL package as a required package for Win32Proc.) It makes no difference whether WindowsVersionName is actually called (can comment out). Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program windows_version_200a; {$mode objfpc}{$H+} uses    Win32Proc; var VersionName: string; function WindowsVersionName: string;begin  Result:= '?';   case WindowsVersion of    wv95:     Result:= 'Windows 95';    wvNT4:    Result:= 'Windows NT v.4';    wv98:     Result:= 'Windows 98';    wvMe:     Result:= 'Windows Me';    wv2000:   Result:= 'Windows 2000';    wvXP:     Result:= 'Windows XP';    wvServer2003: Result:= 'Windows Server 2003';    wvVista:  Result:= 'Windows Vista';    wv7:      Result:= 'Windows 7';    wv8:      Result:= 'Windows 8';    wv8_1:    Result:= 'Windows 8.1';    wv10:   Result:= 'Windows 10';    wv11:     Result:= 'Windows 11';    //etc.    //see possible values in the unit "win32proc" in "lcl/interfaces/win32/win32proc.pp"  end;end; begin  VersionName:= WindowsVersionName;end. ---------------------------------------------------------------------- dculp · 2025-04-06 17:41 @440bx - There is no csrss.exe in my Windows\System32 folder. It is only in the following folder (doesn't look promising) and the Properties doesn't have a Version tab. C:\Windows\WinSxS\amd64_microsoft-windows- csrss_31bf3856ad364e35_10.0.26100.1_none_55d78c384ca248d1\ ---------------------------------------------------------------------- 440bx · 2025-04-06 19:53 @dculp if not under system32 then maybe syswow64.  There should definitely be a copy of csrss.exe somewhere in a Windows subdirectory.  I am amazed that csrss.exe would not have version information.  That would be quite a departure. Would you please check again for a copy of csrss.exe in some Windows subdirectory ? and then try getting the version from that file. Just in case, if you use Process Hacker, System Informer or Process Explorer, you can find the running copy of csrss.exe and get information about it by right clicking on it and selecting properties.  In the worst case, check out the "Strings" tab, one of the listed strings should reveal the csrss.exe version. The Windows little system utilities often fall very short of providing relevant information, that's why I don't even mention them. HTH. ---------------------------------------------------------------------- dculp · 2025-04-06 21:33 @440bx - I searched my entire C: drive for csrss*. (I use FreeCommander with "Show hidden files".) Only 2 files were found - csrss.exe.mui in C:\Windows\WinSxS\amd64_microsoft-windows- csrss.resources_31bf3856ad364e35_10.0.26100.1_en-us_d784b37749fd398a\ csrss.exe in C:\Windows\WinSxS\amd64_microsoft-windows- csrss_31bf3856ad364e35_10.0.26100.1_none_55d78c384ca248d1\ In the Properties\Details tab for the latter file, the version is 10.0.26100.1, date modified 4/1/2024. Per my original post, 26100 is the build number returned by RtlGetNtVersionNumbers; however, RtlGetNtVersionNumbers also indicates that the Major Version is 10. ---------------------------------------------------------------------- 440bx · 2025-04-06 22:26 @dculp, Thank you for checking. I have to say, I am very surprised that no csrss.exe is found in a subdirectory of Windows.  Another question for you: when you ask for system information from the Control Panel, does it say you're running Win 10 or Win 11 ?  The reason I ask is because if it says Win 11, a disassembly of the .cpl file might show where it's getting that value from.  Who knows, maybe it checks that the build number is greater than some value and if it is, it shows Win 11.  I wouldn't put it past MS to do something like that. ---------------------------------------------------------------------- dculp · 2025-04-07 01:17 Actually csrss.exe was found in Windows subdirectory WinSxS\amd64_microsoft-windows- csrss_31bf3856ad364e35_10.0.26100.1_none_55d78c384ca248d1\ Note that the subdirectory name contains the Windows version number 10.0.26100.1. My Win11 System Information shows -    OS Name   Microsoft Windows 11 Pro    Version      10.0.26100 Build 26100 ---------------------------------------------------------------------- 440bx · 2025-04-07 02:16 Quote from: dculp on April 07, 2025, 03:17:27 amActually csrss.exe was found in Windows subdirectory WinSxS\amd64_microsoft-windows- csrss_31bf3856ad364e35_10.0.26100.1_none_55d78c384ca248d1\ Note that the subdirectory name contains the Windows version number 10.0.26100.1. I expected a copy in Windows\system32 because that's where it resides in the original installation.  Strange that it isn't there. Quote from: dculp on April 07, 2025, 03:17:27 amMy Win11 System Information shows -    OS Name   Microsoft Windows 11 Pro    Version      10.0.26100 Build 26100 That makes sense.  The "OS Name" is _not_ the same thing as the OS Version.  Notice that the OS Version still says 10.  The OS Name is probably in the registry. Maybe regedit can find a string "Microsoft Windows 11 Pro" somewhere in there. Might be worth a try. ---------------------------------------------------------------------- H₂SO₄ · 2025-04-07 05:05 I've been successfully using the following function to check for specific build numbers. Not exactly what you asked for, but maybe it helps: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {$push}{$packrecords C} function VerSetConditionMask(ConditionMask: ULONGLONG; TypeMask: DWORD; Condition: BYTE): ULONGLONG; stdcall;       external kernel32 name 'VerSetConditionMask';function VerifyVersionInfo(lpVersionInformation: LPVOID; dwTypeMask: DWORD; dwlConditionMask: DWORDLONG): BOOL; stdcall;         external kernel32 name 'VerifyVersionInfoA'; /// Returns True if the build number of the currently running Windows version is greater than or equal to [BuildNumber].function WindowsBuildNewerThan(BuildNumber: DWORD): Boolean;const  VER_BUILDNUMBER = $00000004;  VER_GREATER_EQUAL = $03;type  OSVERSIONINFOEX = record    dwOSVersionInfoSize, dwMajorVersion, dwMinorVersion: DWORD;    dwBuildNumber, dwPlatformId: DWORD;    szCSDVersion: array[0..127] of CHAR;    wServicePackMajor, wServicePackMinor: WORD;    wSuiteMask: WORD;    wProductType: BYTE;  wReserved: BYTE;  end;var  Version: OSVERSIONINFOEX;begin  Version := Default(OSVERSIONINFOEX);  Version.dwOSVersionInfoSize := SizeOf(Version);  Version.dwBuildNumber := BuildNumber;  Result := VerifyVersionInfo(@Version, VER_BUILDNUMBER, // Make sure the .exe has a manifest (i.e. at .rsrc/MANIFEST/1)                              VerSetConditionMask(0, VER_BUILDNUMBER, VER_GREATER_EQUAL));end; {$pop} ---------------------------------------------------------------------- Zvoni · 2025-04-07 08:06 Errr..... Look it up in the Registry? Code: [Select]Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion ---------------------------------------------------------------------- dseligo · 2025-04-07 08:28 Quote from: Zvoni on April 07, 2025, 10:06:27 amErrr..... Look it up in the Registry? Code: [Select]Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion This is from my Windows' System, About: Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Edition Windows 11 ProVersion 24H2Installed on    ‎07.‎12.‎2024.OS build      26100.3476Experience      Windows Feature Experience Pack 1000.26100.54.0 In attachment is screenshot of registry key you suggested. ---------------------------------------------------------------------- Zvoni · 2025-04-07 09:31 You're right. Just found other sites reporting that the "Product Name" Reg-Keys for Win11 still report Win10. OTOH, "10.0.22000" is the initial Build for Windows 11 Soooo... Query above Reg-Keys (in my Screenshot WinREVersion resp. LCUVer in dseligo's Screenshot) additionally to Reg-Key "CurrentBuild"/"CurrentBuildNumber"? Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i If Major='10' And Minor='0' And Build>='22000' Then Win11 Else Win10 Which is basically what TRon posted in Reply 3 ---------------------------------------------------------------------- dculp · 2025-04-07 10:00 Quote from: AlexTP on April 06, 2025, 04:39:19 pmI just added some info to the wiki, https://wiki.freepascal.org/Windows_version . In your code "Using Win32Proc Lazarus unit", I stripped everything out except the uses statement and begin..end (code #1 below). I still get the attached compiler error messages. If I remove the Win32Proc uses then it compiles without errors. When I hover over Win32Proc I get -    unit Win32Proc    D:\Lazarus_32bit_3.8.x\lcl\interfaces\win32\win32proc.pp(17,6)    Package LCL In win32proc.pp it specifically says, "This file is part of the Lazarus Component Library (LCL)". In the Project Inspector I have the LCL package installed under Required Packages (see attached) so I assume that I wouldn't need Win32Proc in my uses statement. However, if I remove it (code #2)  then I get compiler errors "Identifier not found" for WindowsVersion and all of the identifiers in the case statement (which are all in win32proc.pp). Also, "duplicate case label" and other errors. What am I missing? Code #1 - Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program windows_version_211a; uses  Win32Proc; beginend. Code #2 - Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program windows_version_200a; {$mode objfpc}{$H+} // uses    Win32Proc; var VersionName: string; function WindowsVersionName: string;begin  Result:= '?';   case WindowsVersion of    wv95:     Result:= 'Windows 95';    wvNT4:    Result:= 'Windows NT v.4';    wv98:     Result:= 'Windows 98';    wvMe:     Result:= 'Windows Me';    wv2000:   Result:= 'Windows 2000';    wvXP:     Result:= 'Windows XP';    wvServer2003: Result:= 'Windows Server 2003';    wvVista:  Result:= 'Windows Vista';    wv7:      Result:= 'Windows 7';    wv8:      Result:= 'Windows 8';    wv8_1:    Result:= 'Windows 8.1';    wv10:   Result:= 'Windows 10';    wv11:     Result:= 'Windows 11';    //etc.    //see possible values in the unit "win32proc" in "lcl/interfaces/win32/win32proc.pp"  end;end; begin  VersionName:= WindowsVersionName;end. ---------------------------------------------------------------------- Zvoni · 2025-04-07 10:05 Quote from: dculp on April 07, 2025, 12:00:48 pmWhat am I missing? That TRon and me basically gave you the Solution in regards to using the WinApi-Solution from your first post ---------------------------------------------------------------------- dculp · 2025-04-07 10:31 @Zvoni - I agree. However, I still want to understand why my code won't compile, even if it may not be the best solution to my original question. ---------------------------------------------------------------------- Zvoni · 2025-04-07 10:48 Quote from: dculp on April 07, 2025, 12:31:19 pm@Zvoni - I agree. However, I still want to understand why my code won't compile, even if it may not be the best solution to my original question. Just because you declared a required Package, doesn't mean, that your Program "USES" the units within.... ---------------------------------------------------------------------- dculp · 2025-04-07 11:02 So what do I need to do to get this to compile? Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program windows_version_211a; uses  Win32Proc; beginend. ---------------------------------------------------------------------- Fibonacci · 2025-04-07 12:58 Quote from: dculp on April 07, 2025, 01:02:40 pmSo what do I need to do to get this to compile? Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program windows_version_211a; uses  Win32Proc; beginend.  1. Add LCL to the project packages 2. Add unit Interfaces to the uses On my Windows 10, it shows Windows 8 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses Windows; procedure RtlGetNtVersionNumbers(MajorVersion, MinorVersion, BuildNumber: PDWORD); stdcall; external 'ntdll.dll'; function winGetVersion: dword;var  major, minor: dword;begin  RtlGetNtVersionNumbers(@major, @minor, nil);  result := (major*100)+(minor*10);end; function winGetBuild: dword;var  build: dword;begin  RtlGetNtVersionNumbers(nil, nil, @build);  result := pword(@build)^;end; begin  writeln('Windows 10 or newer? ', winGetVersion >= 1000);  writeln('Windows 11 or newer? ', (winGetVersion >= 1000) and (winGetBuild >= 22000));  readln;end. ---------------------------------------------------------------------- LV · 2025-04-07 14:07 I'm using Windows 11, and I think it would be interesting to check it out.  Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program DetectWindows11; uses  Windows, SysUtils; procedure RtlGetNtVersionNumbers(out MajorVersion, MinorVersion, BuildNumber: DWORD); stdcall; external 'ntdll.dll'; function IsWindows11OrNewer: Boolean;var  Major, Minor, BuildNumberPart: DWORD;  BuildNumber: DWORD;begin  RtlGetNtVersionNumbers(Major, Minor, BuildNumberPart);  BuildNumber := BuildNumberPart shr 16; // Extract build number from high 16 bits  Result := (Major = 10) and (Minor = 0) and (BuildNumber >= 22000);end; begin  if IsWindows11OrNewer then    Writeln('Windows 11 or newer detected.')  else    Writeln('Windows 10 or older detected.');  Readln;end.  output: Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Windows 11 or newer detected.  or Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit Unit1; {$mode objfpc}{$H+} interface uses  Windows, Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls; type  { TForm1 }  TForm1 = class(TForm)    Memo1: TMemo;    Button1: TButton;    procedure Button1Click(Sender: TObject);  private    procedure DetectWindowsVersion;  end; var  Form1: TForm1; implementation {$R *.lfm} procedure RtlGetNtVersionNumbers(out MajorVersion, MinorVersion, BuildNumber: DWORD); stdcall; external 'ntdll.dll'; { TForm1 } // Procedure to detect Windows version and output the result to Memo1procedure TForm1.DetectWindowsVersion;var  Major, Minor, BuildPart, Build: DWORD;begin  // Get version numbers  RtlGetNtVersionNumbers(Major, Minor, BuildPart);   // Extract build number from high 16 bits  Build := BuildPart shr 16;   Memo1.Lines.Add('Windows version detected:');  Memo1.Lines.Add(Format('Major: %d, Minor: %d, Build: %d', [Major, Minor, Build]));   // Determine if Windows 11 or newer  if (Major = 10) and (Minor = 0) then  begin    if Build >= 22000 then      Memo1.Lines.Add('Windows 11 or newer detected.')    else      Memo1.Lines.Add('Windows 10 detected.');  end  else    Memo1.Lines.Add('Older than Windows 10 detected.');end; procedure TForm1.Button1Click(Sender: TObject);begin  Memo1.Clear;  DetectWindowsVersion;end; end.  output: Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Windows version detected:Major: 10, Minor: 0, Build: 61440Windows 11 or newer detected. ---------------------------------------------------------------------- LV · 2025-04-07 14:24 Sorry, the program has an error with the Windows build.  Needs to be corrected. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit Unit1; {$mode objfpc}{$H+} interface uses  Windows, Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls; type  { TForm1 }  TForm1 = class(TForm)    Memo1: TMemo;    Button1: TButton;    procedure Button1Click(Sender: TObject);  private    procedure DetectWindowsVersion;  end; var  Form1: TForm1; procedure RtlGetNtVersionNumbers(out MajorVersion, MinorVersion, BuildNumber: DWORD); stdcall;  external 'ntdll.dll'; implementation {$R *.lfm} procedure TForm1.DetectWindowsVersion;var  Major, Minor, Build: DWORD;begin  // Get version numbers from ntdll.dll  RtlGetNtVersionNumbers(Major, Minor, Build);   // Correct build number (mask to low 16 bits)  Build := Build and $FFFF;   Memo1.Lines.Add('Windows version detected:');  Memo1.Lines.Add('Major: ' + UIntToStr(Major) + ', Minor: ' + UIntToStr(Minor) + ', Build: ' + UIntToStr(Build));   if (Major = 10) and (Minor = 0) then  begin    if Build >= 22000 then      Memo1.Lines.Add('Windows 11 or newer detected.')    else      Memo1.Lines.Add('Windows 10 detected.');  end  else    Memo1.Lines.Add('Older than Windows 10 detected.');end; procedure TForm1.Button1Click(Sender: TObject);begin  Memo1.Clear;  DetectWindowsVersion;end; end.  output: Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Windows version detected:Major: 10, Minor: 0, Build: 26100Windows 11 or newer detected. ---------------------------------------------------------------------- Ericktux · 2025-04-08 06:32 Hi friend, this works for me so far:  Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit Unit1; {$mode objfpc}{$H+} interface uses  Classes, SysUtils,  ComObj, ComCtrls, ActiveX,  Forms, Controls, Graphics, Dialogs, StdCtrls; type   { TForm1 }   TForm1 = class(TForm)    Button1: TButton;    procedure Button1Click(Sender: TObject);  private   public      function nombre_windows:string;  end; var  Form1: TForm1; implementation {$R *.lfm} { TForm1 } function TForm1.nombre_windows: string;const  wbemFlagForwardOnly = $00000020;var  FSWbemLocator : OLEVariant;  FWMIService   : OLEVariant;  FWbemObjectSet: OLEVariant;  FWbemObject   : OLEVariant;  oEnum         : IEnumvariant;  iValue        : LongWord;begin;  FSWbemLocator := CreateOleObject('WbemScripting.SWbemLocator');  FWMIService   := FSWbemLocator.ConnectServer('localhost', 'root\CIMV2', '', '');  FWbemObjectSet:= FWMIService.ExecQuery('SELECT Caption FROM Win32_OperatingSystem','WQL',wbemFlagForwardOnly);  //FWbemObjectSet:= FWMIService.ExecQuery('SELECT Name, Version FROM Win32_OperatingSystem','WQL',wbemFlagForwardOnly);  // ORIGINAL  oEnum         := IUnknown(FWbemObjectSet._NewEnum) as IEnumVariant;  if oEnum.Next(1, FWbemObject, iValue) = 0 then  begin    if DirectoryExists('c:\windows\syswow64') then    Result:=FWbemObject.Caption+' x64'    else    Result:=FWbemObject.Caption+' x86';    FWbemObject:=Unassigned;  end;End; procedure TForm1.Button1Click(Sender: TObject);begin  ShowMessage('Sistema Operativo : '#13+nombre_windows);end; end. ---------------------------------------------------------------------- VisualLab · 2025-04-08 09:44 Quote from: dculp on April 06, 2025, 11:33:56 pm@440bx - I searched my entire C: drive for csrss*. (I use FreeCommander with "Show hidden files".) Only 2 files were found - csrss.exe.mui in C:\Windows\WinSxS\amd64_microsoft-windows- csrss.resources_31bf3856ad364e35_10.0.26100.1_en-us_d784b37749fd398a\ csrss.exe in C:\Windows\WinSxS\amd64_microsoft-windows- csrss_31bf3856ad364e35_10.0.26100.1_none_55d78c384ca248d1\ In the Properties\Details tab for the latter file, the version is 10.0.26100.1, date modified 4/1/2024. Per my original post, 26100 is the build number returned by RtlGetNtVersionNumbers; however, RtlGetNtVersionNumbers also indicates that the Major Version is 10. Hmm... Strange. I checked Windows 11 Professional 64-bit (installed on a virtual machine). The file "csrss.exe" is present in the directory "C:\Windows\System32". Maybe something broke in your installation? ---------------------------------------------------------------------- 440bx · 2025-04-08 09:53 Quote from: VisualLab on April 08, 2025, 11:44:17 amHmm... Strange. I checked Windows 11 Professional 64-bit (installed on a virtual machine). The file "csrss.exe" is present in the directory "C:\Windows\System32". yes, it's really strange he can't find csrss.exe there. ---------------------------------------------------------------------- Zvoni · 2025-04-08 09:58 Irrespective of above: I'm wondering how long it will take TS to finally get it, that the Major Version Number for Win11 is still 10????? The difference between Win10 and Win11 is the BUILD-Number (as many times already mentioned!) ---------------------------------------------------------------------- jcmontherock · 2025-04-08 10:06 I have the same thing: I found 'csrss.exe' in my native windows. When I try to execute it I received the following error msg: 'csrss.exe' n’est pas reconnu en tant que commande interne ou externe, un programme exécutable ou un fichier de commandes. ---------------------------------------------------------------------- dculp · 2025-04-08 14:24 For https://wiki.freepascal.org/Windows_version I get the following for Win10 and Win11 - VersionName = Windows 8 From sysutils    Win32MajorVersion = 6    Win32MinorVersion = 2    Win32BuildNumber = 9200 (the site shows 22000) Tracing the code backward indicates that the problem with the link's code lies in GetVersionEx(versioninfo) in redef.inc -   {SysUtils initialization calls Procedure LoadVersionInfo; which establishes -     GetVersionEx(versioninfo); (redef.inc)       where versioninfo establishes the values in the next lines (global vars in SysUtils) -         Win32Platform:=versionInfo.dwPlatformId;         Win32MajorVersion:=versionInfo.dwMajorVersion;         Win32MinorVersion:=versionInfo.dwMinorVersion;         Win32BuildNumber:=versionInfo.dwBuildNumber;   Win32Proc.pp initialization calls procedure UpdateWindowsVersion;   which uses the above info to establish WindowsVersion} ---------------------------------------------------------------------- Fibonacci · 2025-04-08 14:35 Quote from: dculp on April 08, 2025, 04:24:25 pmTracing the code backward indicates that the problem with the link's code lies in GetVersionEx(versioninfo) in redef.inc - GetVersionEx is deprecated QuoteWith the release of Windows 8.1, the behavior of the GetVersionEx API has changed in the value it will return for the operating system version. The value returned by the GetVersionEx function now depends on how the application is manifested. Applications not manifested for Windows 8.1 or Windows 10 will return the Windows 8 OS version value (6.2). Once an application is manifested for a given operating system version, GetVersionEx will always return the version that the application is manifested for in future releases. ---------------------------------------------------------------------- dculp · 2025-04-08 14:52 Quote from: Fibonacci on April 08, 2025, 04:35:58 pmQuote from: dculp on April 08, 2025, 04:24:25 pmTracing the code backward indicates that the problem with the link's code lies in GetVersionEx(versioninfo) in redef.inc - GetVersionEx is deprecated QuoteWith the release of Windows 8.1, the behavior of the GetVersionEx API has changed in the value it will return for the operating system version. The value returned by the GetVersionEx function now depends on how the application is manifested. Applications not manifested for Windows 8.1 or Windows 10 will return the Windows 8 OS version value (6.2). Once an application is manifested for a given operating system version, GetVersionEx will always return the version that the application is manifested for in future releases. Does "application" refer to Lazarus itself or the app that I generate with Lazarus? What is "manifested"? ---------------------------------------------------------------------- Fibonacci · 2025-04-08 14:57 Your app Manifest is a resource embedded in the application. See Project Options -> Application - Use manifest resource Manifested = contains an embedded manifest (or as a separate .manifest file) ---------------------------------------------------------------------- dculp · 2025-04-08 15:12 Checking "Use manifest resource" now shows correct Windows version - VersionName = Windows 11 From sysutils    Win32MajorVersion = 10    Win32MinorVersion = 0    Win32BuildNumber = 26100 Why isn't "Use manifest resource" the default? Does it cause problems? ---------------------------------------------------------------------- Fibonacci · 2025-04-08 16:17 It is the default for the GUI app template, which is the default when you open Lazarus ---------------------------------------------------------------------- Remy Lebeau · 2025-04-08 17:40 Quote from: dculp on April 08, 2025, 05:12:46 pmChecking "Use manifest resource" now shows correct Windows version - An app manifest must explicitly declare which individual Windows versions are supported by your app.  Windows Vista, 7, 8, 8.11, and 10/112 have distinct supportedOS guids defined. When your app runs on a given Windows version and your app manifest does not declare support for that version, then version-reporting APIs will not behave as expected.  That is why your app thought Windows 11 was Windows 8 v6.2.9200 until you added a manifest that declared support for Windows 11. 1: Windows 8.1 has its own supportedOS guid, likely because it introduced major API behavioral changes. 2: Windows 10 and 11 share the same supportedOS guid, likely because Windows 11 is v10.0.22000+ and not v11.0.0+, as you might expect. When Microsoft eventually releases a new Windows version that increases the major version number, or otherwise introduces major behavioral changes, then there will likely be a new supportedOS guid defined, which your existing app manifest will not refer to yet, and so all version-reporting APIs will not behave as expected again when your app is run on those newer Windows versions, until you update your app manifest accordingly.  This is why you should not rely on OS version numbers being accurate.  And certainly don't rely on them for detecting available OS functionality, only for logging at best. ---------------------------------------------------------------------- VisualLab · 2025-04-09 09:01 Quote from: Remy Lebeau on April 08, 2025, 07:40:08 pmAn app manifest must explicitly declare which individual Windows versions are supported by your app.  Windows Vista, 7, 8, 8.11, and 10/112 have distinct supportedOS guids defined. When your app runs on a given Windows version and your app manifest does not declare support for that version, then version-reporting APIs will not behave as expected.  That is why your app thought Windows 11 was Windows 8 v6.2.9200 until you added a manifest that declared support for Windows 11. 1: Windows 8.1 has its own supportedOS guid, likely because it introduced major API behavioral changes. 2: Windows 10 and 11 share the same supportedOS guid, likely because Windows 11 is v10.0.22000+ and not v11.0.0+, as you might expect. When Microsoft eventually releases a new Windows version that increases the major version number, or otherwise introduces major behavioral changes, then there will likely be a new supportedOS guid defined, which your existing app manifest will not refer to yet, and so all version-reporting APIs will not behave as expected again when your app is run on those newer Windows versions, until you update your app manifest accordingly.  This is why you should not rely on OS version numbers being accurate.  And certainly don't rely on them for detecting available OS functionality, only for logging at best. People at Microsoft (decision makers) are causing more and more chaos (mess) in the system (including WinAPI). They started to break more than they fix or improve with Windows 8. They let up a bit with the first versions of version 10. And then the system breakdown accelerated again. There are probably too many clerks and "managers" in this company and not enough real IT engineers. The effects of the generational change are clearly visible. ---------------------------------------------------------------------- paule32 · 2025-04-10 12:44 I don't know: how to use Windows 10 or 11 anymore ? The Support is ending 23. October 2025 ! No cumulative Updates No more secured Support No more right mind thinkings, if Microsoft jumps to ARM CPU. This means, you need new Hardware. This means, you need new Software. This means, you need new Lessons for the Employees for Seminat's of the new Software. This means, you have new Costs - either lesser or more ... I would not sugget to use Linux - because Linux is Free, but using tailored Software, and you have too many Derivates - the Jungle of Software with different binary Format each together. This means, you need Money to buy a CD with a Linux Distribution of your desire. This means: Windows Users should stay on Microsoft and NOT jumping like a Frog from one System to the next - that would be give QUARK -___- I don't dislike Linux, but on my Expierences Windows is the better thing... Conclusion: - each System has its own pros and cons. - Windows is backward compatible in the most cases. - This means: a Windows 7 Application can be run in Windows 8 - to jump to an other System is dumb ---------------------------------------------------------------------- Nicole · 2025-04-10 15:05 when I hit Win + R and there "Winver", - I get it. So there shall be a way to run one of the Windows shells by "run". Case you should not prefer Zvonis solution, which looks very elegant to me, I search you my notes howTo call the shells. ---------------------------------------------------------------------- paule32 · 2025-04-10 18:13 Hello Nicole, I have bundle a Python Console Application that you can download there: https://github.com/paule32/WindowsVersion It comes with Python Code Script and a compiled Windows 11 Pro EXE Application. The EXE was build with a github.com CI Workflow File. Feel free to use it, and send me a like :-) HTH - Hope this Helps. ---------------------------------------------------------------------- PascalDragon · 2025-04-10 18:45 Quote from: jcmontherock on April 08, 2025, 12:06:41 pmI have the same thing: I found 'csrss.exe' in my native windows. When I try to execute it I received the following error msg: csrss.exe is not a Windows application, but a native NT application as this is what provides the Windows subsystem on top of the NT kernel.