replace Marshal.GetLastWin32Error() after dll load failures with Marshal.GetLastSystemError()

This commit is contained in:
Aytackydln committed 2025-09-05 00:14:16 +02:00
1 parent 13f3dde185
commit 00eec7ab80
6 files changed
+6 -6

No files matched your search

@@ -47,7 +47,7 @@ internal static class _CoolerMasterSDK
#if NET6_0
if (_handle == IntPtr.Zero) throw new RGBDeviceException($"CoolerMaster LoadLibrary failed with error code {Marshal.GetLastPInvokeError()}");
#else
if (_handle == 0) throw new RGBDeviceException($"CoolerMaster LoadLibrary failed with error code {Marshal.GetLastWin32Error()}");
if (_handle == 0) throw new RGBDeviceException($"CoolerMaster LoadLibrary failed with error code {Marshal.GetLastSystemError()}");
#endif
_getSDKVersionPointer = (GetSDKVersionPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_handle, "GetCM_SDK_DllVer"), typeof(GetSDKVersionPointer));