Actually csrss.exe was found in Windows subdirectory WinSxS\amd64_microsoft-windows-csrss_31bf3856ad364e35_10.0.26100.1_none_55d78c384ca248d1\I expected a copy in Windows\system32 because that's where it resides in the original installation. Strange that it isn't there.
Note that the subdirectory name contains the Windows version number 10.0.26100.1.
My Win11 System Information shows -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.
OS Name Microsoft Windows 11 Pro
Version 10.0.26100 Build 26100
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion
Errr..... Look it up in the Registry?Code: [Select]Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion
I just added some info to the wiki, https://wiki.freepascal.org/Windows_version .
What am I missing?That TRon and me basically gave you the Solution in regards to using the WinApi-Solution from your first post
@Zvoni -Just because you declared a required Package, doesn't mean, that your Program "USES" the units within....
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.
So what do I need to do to get this to compile?
program windows_version_211a; uses Win32Proc; begin end.
@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".yes, it's really strange he can't find csrss.exe there.
Tracing the code backward indicates that the problem with the link's code lies in GetVersionEx(versioninfo) in redef.inc -
With 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.
Tracing the code backward indicates that the problem with the link's code lies in GetVersionEx(versioninfo) in redef.inc -
GetVersionEx is deprecatedQuoteWith 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.
Checking "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.
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: