You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note that the CharSet is not specified, which means the runtime will assume a ANSI charset, whereas the native RtlGetVersion() expects Unicode. This means the szCSDVersion field will not correctly be marshalled and Marshal.SizeOf<NtDll.RTL_OSVERSIONINFOEX>() returns 148 instead of 276.
Hi,
this is a similar issue as CommunityToolkit/WindowsCommunityToolkit#2095.
On Windows,
RuntimeInformation.OSDescription
callsInterop.RtlGetVersion()
using theRTL_OSVERSIONINFOEX
structure, which is currently defined as follows:https://github.com/dotnet/corefx/blob/a75d30306975040b0e22390d04a3b3de094d1817/src/Common/src/Interop/Windows/NtDll/Interop.RTL_OSVERSIONINFOEX.cs#L12-L22
Note that the CharSet is not specified, which means the runtime will assume a ANSI charset, whereas the native
RtlGetVersion()
expects Unicode. This means theszCSDVersion
field will not correctly be marshalled andMarshal.SizeOf<NtDll.RTL_OSVERSIONINFOEX>()
returns 148 instead of 276.The declaration should be changed to:
Code
Run the following C# program with .NET Core on Windows 7 SP1:
Actual Output:
Expected Output:
Thanks!
The text was updated successfully, but these errors were encountered: