Browse Source

Correct RtlGetVersion usage

pull/5377/head
MichalPetryka 5 years ago
committed by GitHub
parent
commit
b8d3f85636
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs

6
src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs

@ -1432,15 +1432,15 @@ namespace Avalonia.Win32.Interop
} }
[DllImport("ntdll")] [DllImport("ntdll")]
private static extern int RtlGetVersion(out RTL_OSVERSIONINFOEX lpVersionInformation); private static extern int RtlGetVersion(ref RTL_OSVERSIONINFOEX lpVersionInformation);
internal static Version RtlGetVersion() internal static Version RtlGetVersion()
{ {
RTL_OSVERSIONINFOEX v = new RTL_OSVERSIONINFOEX(); RTL_OSVERSIONINFOEX v = new RTL_OSVERSIONINFOEX();
v.dwOSVersionInfoSize = (uint)Marshal.SizeOf(v); v.dwOSVersionInfoSize = (uint)Marshal.SizeOf(v);
if (RtlGetVersion(out v) == 0) if (RtlGetVersion(ref v) == 0)
{ {
return new Version((int)v.dwMajorVersion, (int)v.dwMinorVersion, (int)v.dwBuildNumber, (int)v.dwPlatformId); return new Version((int)v.dwMajorVersion, (int)v.dwMinorVersion, (int)v.dwBuildNumber);
} }
else else
{ {

Loading…
Cancel
Save