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 comment indicates that RtlGetVersion() doesn't set the ProductType in the OSVERSIONINFOEX structure. However, actually RtlGetVersion() sets this property, but OSVERSIONINFOEX isn't set to use Unicode, which is why the properties are not correctly filled as the string field (CSDVersion) will have the incorrect size (128 instead of 256 bytes).
so that it uses the wide variant (GetVersionExW). But I think it can also be removed because RtlGetVersion should work correctly now.
Environment
Nuget Package(s): Microsoft.Toolkit.Win32.UI.Controls
Package Version(s): 3.0.0-preview
Windows 10 Build Number:
- [X] April 2018 Update (17134)
App min and target version:
- [X] April 2018 Update (17134)
Device form factor:
- [X] Desktop
Visual Studio
- [X] 2017 (version: 15.7.0)
Thank you!
The text was updated successfully, but these errors were encountered:
kpreisser
changed the title
OSVERSIONINFOEX uses incorrect charset with RtlGetVersion
OSVERSIONINFOEX uses incorrect charset with RtlGetVersion()
May 14, 2018
I'm submitting a...
Current behavior
Hi, please see the following code in
OSVersionHelper.cs
(branchrel/3.0.0-preview
):https://github.com/windows-toolkit/WindowsCommunityToolkit/blob/280ae1ed883e1c46bbc491c4545f52808e818fa2/Microsoft.Toolkit.Win32.UI.Controls/Interop/OSVersionHelper.cs#L128-L129
Note that the comment indicates that
RtlGetVersion()
doesn't set the ProductType in theOSVERSIONINFOEX
structure. However, actuallyRtlGetVersion()
sets this property, butOSVERSIONINFOEX
isn't set to use Unicode, which is why the properties are not correctly filled as the string field (CSDVersion
) will have the incorrect size (128 instead of 256 bytes).Currently, the struct is defined as follows:
https://github.com/windows-toolkit/WindowsCommunityToolkit/blob/280ae1ed883e1c46bbc491c4545f52808e818fa2/Microsoft.Toolkit.Win32.UI.Controls/Interop/Win32/OSVERSIONINFOEX.cs#L17-L18
Here,
Marshal.SizeOf(typeof(OSVERSIONINFOEX))
will return156
.Expected behavior
The declaration should be changed to:
In that case,
Marshal.SizeOf(typeof(OSVERSIONINFOEX))
will return284
, and the remaining properties likeProductType
should now be set correctly.Note that the declaration of
GetVersionEx()
should then also be changed fromto e.g.:
so that it uses the wide variant (
GetVersionExW
). But I think it can also be removed becauseRtlGetVersion
should work correctly now.Environment
Thank you!
The text was updated successfully, but these errors were encountered: