public static void ThrowLastError() { ((HRESULT)Win32Error.GetLastError()).ThrowIfFailed(); // Only expecting to call this when we're expecting a failed GetLastError() Verify.Fail(); }
internal static OSVERSIONINFOEX RtlGetVersion() { var osVersionInfo = new OSVERSIONINFOEX { OSVersionInfoSize = Marshal.SizeOf(typeof(OSVERSIONINFOEX)) }; _RtlGetVersion(ref osVersionInfo); var err = Win32Error.GetLastError(); if (!err.Equals(Win32Error.ERROR_SUCCESS)) { if (osVersionInfo.MajorVersion == 0) { err.ToHRESULT().ThrowIfFailed(); } } return(osVersionInfo); }