From 20277b8b799b89915dc74e1e900b98206b5fb616 Mon Sep 17 00:00:00 2001 From: Lightczx <1686188646@qq.com> Date: Fri, 2 Feb 2024 10:38:40 +0800 Subject: [PATCH] Add callconv on win32 apis --- src/Snap.Hutao/Snap.Hutao/Win32/AdvApi32.cs | 12 ++++---- .../Snap.Hutao/Win32/ApiMsWinNetIsolation.cs | 8 +++--- src/Snap.Hutao/Snap.Hutao/Win32/ComCtl32.cs | 6 ++-- src/Snap.Hutao/Snap.Hutao/Win32/DwmApi.cs | 2 +- src/Snap.Hutao/Snap.Hutao/Win32/Gdi32.cs | 2 +- src/Snap.Hutao/Snap.Hutao/Win32/Kernel32.cs | 28 +++++++++---------- src/Snap.Hutao/Snap.Hutao/Win32/Ole32.cs | 6 ++-- src/Snap.Hutao/Snap.Hutao/Win32/Shell32.cs | 2 +- src/Snap.Hutao/Snap.Hutao/Win32/User32.cs | 28 +++++++++---------- 9 files changed, 47 insertions(+), 47 deletions(-) diff --git a/src/Snap.Hutao/Snap.Hutao/Win32/AdvApi32.cs b/src/Snap.Hutao/Snap.Hutao/Win32/AdvApi32.cs index 58e2ec54..fb7f78c9 100644 --- a/src/Snap.Hutao/Snap.Hutao/Win32/AdvApi32.cs +++ b/src/Snap.Hutao/Snap.Hutao/Win32/AdvApi32.cs @@ -14,7 +14,7 @@ namespace Snap.Hutao.Win32; [SuppressMessage("", "SYSLIB1054")] internal static class AdvApi32 { - [DllImport("ADVAPI32.dll", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)] + [DllImport("ADVAPI32.dll", CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)] [SupportedOSPlatform("windows5.1.2600")] public static unsafe extern BOOL ConvertSidToStringSidW(PSID Sid, PWSTR* StringSid); @@ -26,7 +26,7 @@ internal static class AdvApi32 } } - [DllImport("ADVAPI32.dll", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)] + [DllImport("ADVAPI32.dll", CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)] [SupportedOSPlatform("windows5.1.2600")] public static unsafe extern BOOL ConvertStringSidToSidW(PCWSTR StringSid, PSID* Sid); @@ -41,19 +41,19 @@ internal static class AdvApi32 } } - [DllImport("ADVAPI32.dll", ExactSpelling = true, SetLastError = true)] + [DllImport("ADVAPI32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true, SetLastError = true)] [SupportedOSPlatform("windows5.1.2600")] public static extern BOOL EqualSid(PSID pSid1, PSID pSid2); - [DllImport("ADVAPI32.dll", ExactSpelling = true)] + [DllImport("ADVAPI32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)] [SupportedOSPlatform("windows5.0")] public static extern WIN32_ERROR RegCloseKey(HKEY hKey); - [DllImport("ADVAPI32.dll", ExactSpelling = true)] + [DllImport("ADVAPI32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)] [SupportedOSPlatform("windows5.0")] public static extern WIN32_ERROR RegNotifyChangeKeyValue(HKEY hKey, BOOL bWatchSubtree, REG_NOTIFY_FILTER dwNotifyFilter, [AllowNull] HANDLE hEvent, BOOL fAsynchronous); - [DllImport("ADVAPI32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)] + [DllImport("ADVAPI32.dll", CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Unicode, ExactSpelling = true)] [SupportedOSPlatform("windows5.0")] public static unsafe extern WIN32_ERROR RegOpenKeyExW(HKEY hKey, [AllowNull] PCWSTR lpSubKey, [AllowNull] uint ulOptions, REG_SAM_FLAGS samDesired, HKEY* phkResult); diff --git a/src/Snap.Hutao/Snap.Hutao/Win32/ApiMsWinNetIsolation.cs b/src/Snap.Hutao/Snap.Hutao/Win32/ApiMsWinNetIsolation.cs index 29fffef3..470be684 100644 --- a/src/Snap.Hutao/Snap.Hutao/Win32/ApiMsWinNetIsolation.cs +++ b/src/Snap.Hutao/Snap.Hutao/Win32/ApiMsWinNetIsolation.cs @@ -15,7 +15,7 @@ namespace Snap.Hutao.Win32; [SuppressMessage("", "SYSLIB1054")] internal static class ApiMsWinNetIsolation { - [DllImport("api-ms-win-net-isolation-l1-1-0.dll", ExactSpelling = true)] + [DllImport("api-ms-win-net-isolation-l1-1-0.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)] [SupportedOSPlatform("windows8.0")] public static unsafe extern uint NetworkIsolationEnumAppContainers(uint Flags, uint* pdwNumPublicAppCs, INET_FIREWALL_APP_CONTAINER** ppPublicAppCs); @@ -32,7 +32,7 @@ internal static class ApiMsWinNetIsolation } } - [DllImport("api-ms-win-net-isolation-l1-1-0.dll", ExactSpelling = true)] + [DllImport("api-ms-win-net-isolation-l1-1-0.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)] [SupportedOSPlatform("windows8.0")] public static unsafe extern uint NetworkIsolationFreeAppContainers(INET_FIREWALL_APP_CONTAINER* pPublicAppCs); @@ -46,7 +46,7 @@ internal static class ApiMsWinNetIsolation } } - [DllImport("api-ms-win-net-isolation-l1-1-0.dll", ExactSpelling = true)] + [DllImport("api-ms-win-net-isolation-l1-1-0.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)] [SupportedOSPlatform("windows8.0")] public static unsafe extern uint NetworkIsolationGetAppContainerConfig(uint* pdwNumPublicAppCs, SID_AND_ATTRIBUTES** appContainerSids); @@ -63,7 +63,7 @@ internal static class ApiMsWinNetIsolation } } - [DllImport("api-ms-win-net-isolation-l1-1-0.dll", ExactSpelling = true)] + [DllImport("api-ms-win-net-isolation-l1-1-0.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)] [SupportedOSPlatform("windows8.0")] public static unsafe extern uint NetworkIsolationSetAppContainerConfig(uint dwNumPublicAppCs, SID_AND_ATTRIBUTES* appContainerSids); diff --git a/src/Snap.Hutao/Snap.Hutao/Win32/ComCtl32.cs b/src/Snap.Hutao/Snap.Hutao/Win32/ComCtl32.cs index af0736aa..f1cb95ba 100644 --- a/src/Snap.Hutao/Snap.Hutao/Win32/ComCtl32.cs +++ b/src/Snap.Hutao/Snap.Hutao/Win32/ComCtl32.cs @@ -12,15 +12,15 @@ namespace Snap.Hutao.Win32; [SuppressMessage("", "SYSLIB1054")] internal static class ComCtl32 { - [DllImport("COMCTL32.dll", ExactSpelling = true)] + [DllImport("COMCTL32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)] [SupportedOSPlatform("windows5.1.2600")] public static extern LRESULT DefSubclassProc(HWND hWnd, uint uMsg, WPARAM wParam, LPARAM lParam); - [DllImport("COMCTL32.dll", ExactSpelling = true)] + [DllImport("COMCTL32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)] [SupportedOSPlatform("windows5.1.2600")] public static extern BOOL RemoveWindowSubclass(HWND hWnd, [MarshalAs(UnmanagedType.FunctionPtr)] SUBCLASSPROC pfnSubclass, nuint uIdSubclass); - [DllImport("COMCTL32.dll", ExactSpelling = true)] + [DllImport("COMCTL32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)] [SupportedOSPlatform("windows5.1.2600")] public static unsafe extern BOOL SetWindowSubclass(HWND hWnd, [MarshalAs(UnmanagedType.FunctionPtr)] SUBCLASSPROC pfnSubclass, nuint uIdSubclass, nuint dwRefData); } \ No newline at end of file diff --git a/src/Snap.Hutao/Snap.Hutao/Win32/DwmApi.cs b/src/Snap.Hutao/Snap.Hutao/Win32/DwmApi.cs index b9269a79..318c8751 100644 --- a/src/Snap.Hutao/Snap.Hutao/Win32/DwmApi.cs +++ b/src/Snap.Hutao/Snap.Hutao/Win32/DwmApi.cs @@ -13,7 +13,7 @@ namespace Snap.Hutao.Win32; [SuppressMessage("", "SYSLIB1054")] internal static class DwmApi { - [DllImport("dwmapi.dll", ExactSpelling = true)] + [DllImport("dwmapi.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)] [SupportedOSPlatform("windows6.0.6000")] public static unsafe extern HRESULT DwmSetWindowAttribute(HWND hwnd, uint dwAttribute, void* pvAttribute, uint cbAttribute); diff --git a/src/Snap.Hutao/Snap.Hutao/Win32/Gdi32.cs b/src/Snap.Hutao/Snap.Hutao/Win32/Gdi32.cs index bb910fa6..da046eb1 100644 --- a/src/Snap.Hutao/Snap.Hutao/Win32/Gdi32.cs +++ b/src/Snap.Hutao/Snap.Hutao/Win32/Gdi32.cs @@ -12,7 +12,7 @@ namespace Snap.Hutao.Win32; [SuppressMessage("", "SYSLIB1054")] internal static class Gdi32 { - [DllImport("GDI32.dll", ExactSpelling = true)] + [DllImport("GDI32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)] [SupportedOSPlatform("windows5.0")] public static extern int GetDeviceCaps([AllowNull] HDC hdc, int index); diff --git a/src/Snap.Hutao/Snap.Hutao/Win32/Kernel32.cs b/src/Snap.Hutao/Snap.Hutao/Win32/Kernel32.cs index eba85da9..d9ed6fa4 100644 --- a/src/Snap.Hutao/Snap.Hutao/Win32/Kernel32.cs +++ b/src/Snap.Hutao/Snap.Hutao/Win32/Kernel32.cs @@ -15,14 +15,14 @@ namespace Snap.Hutao.Win32; [SuppressMessage("", "SYSLIB1054")] internal static class Kernel32 { - [DllImport("KERNEL32.dll", ExactSpelling = true, SetLastError = true)] + [DllImport("KERNEL32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)] public static extern BOOL AllocConsole(); - [DllImport("KERNEL32.dll", ExactSpelling = true, SetLastError = true)] + [DllImport("KERNEL32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)] [SupportedOSPlatform("windows5.0")] public static extern BOOL CloseHandle(HANDLE hObject); - [DllImport("KERNEL32.dll", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)] + [DllImport("KERNEL32.dll", CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)] [SupportedOSPlatform("windows5.1.2600")] public static unsafe extern HANDLE CreateEventW([AllowNull] SECURITY_ATTRIBUTES* lpEventAttributes, BOOL bManualReset, BOOL bInitialState, [AllowNull] PCWSTR lpName); @@ -38,10 +38,10 @@ internal static class Kernel32 } } - [DllImport("KERNEL32.dll", ExactSpelling = true, SetLastError = true)] + [DllImport("KERNEL32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)] public static extern BOOL FreeConsole(); - [DllImport("KERNEL32.dll", ExactSpelling = true, SetLastError = true)] + [DllImport("KERNEL32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)] public static unsafe extern BOOL GetConsoleMode(HANDLE hConsoleHandle, CONSOLE_MODE* lpMode); [SuppressMessage("", "SH002")] @@ -54,10 +54,10 @@ internal static class Kernel32 } } - [DllImport("KERNEL32.dll", ExactSpelling = true, SetLastError = true)] + [DllImport("KERNEL32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)] public static extern HANDLE GetStdHandle(STD_HANDLE nStdHandle); - [DllImport("KERNEL32.dll", ExactSpelling = true)] + [DllImport("KERNEL32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)] public static unsafe extern BOOL K32EnumProcessModules(HANDLE hProcess, HMODULE* lphModule, uint cb, uint* lpcbNeeded); [DebuggerStepThrough] @@ -72,7 +72,7 @@ internal static class Kernel32 } } - [DllImport("KERNEL32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)] + [DllImport("KERNEL32.dll", CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Unicode, ExactSpelling = true)] public static extern uint K32GetModuleBaseNameW(HANDLE hProcess, [AllowNull] HMODULE hModule, PWSTR lpBaseName, uint nSize); [DebuggerStepThrough] @@ -84,7 +84,7 @@ internal static class Kernel32 } } - [DllImport("KERNEL32.dll", ExactSpelling = true)] + [DllImport("KERNEL32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)] public static unsafe extern BOOL K32GetModuleInformation(HANDLE hProcess, HMODULE hModule, MODULEINFO* lpmodinfo, uint cb); [DebuggerStepThrough] @@ -96,7 +96,7 @@ internal static class Kernel32 } } - [DllImport("KERNEL32.dll", ExactSpelling = true, SetLastError = true)] + [DllImport("KERNEL32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)] [SupportedOSPlatform("windows5.1.2600")] public static unsafe extern BOOL ReadProcessMemory(HANDLE hProcess, void* lpBaseAddress, void* lpBuffer, nuint nSize, [MaybeNull] nuint* lpNumberOfBytesRead); @@ -125,10 +125,10 @@ internal static class Kernel32 } } - [DllImport("KERNEL32.dll", ExactSpelling = true, SetLastError = true)] + [DllImport("KERNEL32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)] public static extern BOOL SetConsoleMode(HANDLE hConsoleHandle, CONSOLE_MODE dwMode); - [DllImport("KERNEL32.dll", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)] + [DllImport("KERNEL32.dll", CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)] public static extern BOOL SetConsoleTitleW(PCWSTR lpConsoleTitle); [DebuggerStepThrough] @@ -140,11 +140,11 @@ internal static class Kernel32 } } - [DllImport("KERNEL32.dll", ExactSpelling = true, SetLastError = true)] + [DllImport("KERNEL32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)] [SupportedOSPlatform("windows5.1.2600")] public static extern BOOL SetEvent(HANDLE hEvent); - [DllImport("KERNEL32.dll", ExactSpelling = true, SetLastError = true)] + [DllImport("KERNEL32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)] [SupportedOSPlatform("windows5.1.2600")] public static unsafe extern BOOL WriteProcessMemory(HANDLE hProcess, void* lpBaseAddress, void* lpBuffer, nuint nSize, nuint* lpNumberOfBytesWritten); diff --git a/src/Snap.Hutao/Snap.Hutao/Win32/Ole32.cs b/src/Snap.Hutao/Snap.Hutao/Win32/Ole32.cs index 28500591..527fe151 100644 --- a/src/Snap.Hutao/Snap.Hutao/Win32/Ole32.cs +++ b/src/Snap.Hutao/Snap.Hutao/Win32/Ole32.cs @@ -13,7 +13,7 @@ namespace Snap.Hutao.Win32; [SuppressMessage("", "SYSLIB1054")] internal static class Ole32 { - [DllImport("OLE32.dll", ExactSpelling = true)] + [DllImport("OLE32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)] [SupportedOSPlatform("windows5.0")] public static unsafe extern HRESULT CoCreateInstance(Guid* rclsid, [AllowNull] IUnknown pUnkOuter, CLSCTX dwClsContext, Guid* riid, void** ppv); @@ -33,11 +33,11 @@ internal static class Ole32 } } - [DllImport("OLE32.dll", ExactSpelling = true)] + [DllImport("OLE32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)] [SupportedOSPlatform("windows5.0")] public static unsafe extern void CoTaskMemFree([AllowNull] void* pv); - [DllImport("OLE32.dll", ExactSpelling = true)] + [DllImport("OLE32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)] public static unsafe extern HRESULT CoWaitForMultipleObjects(uint dwFlags, uint dwTimeout, uint cHandles, HANDLE* pHandles, uint* lpdwindex); [SuppressMessage("", "SH002")] diff --git a/src/Snap.Hutao/Snap.Hutao/Win32/Shell32.cs b/src/Snap.Hutao/Snap.Hutao/Win32/Shell32.cs index 7e2ee942..d527265c 100644 --- a/src/Snap.Hutao/Snap.Hutao/Win32/Shell32.cs +++ b/src/Snap.Hutao/Snap.Hutao/Win32/Shell32.cs @@ -13,7 +13,7 @@ namespace Snap.Hutao.Win32; [SuppressMessage("", "SYSLIB1054")] internal static class Shell32 { - [DllImport("SHELL32.dll", ExactSpelling = true)] + [DllImport("SHELL32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)] [SupportedOSPlatform("windows6.0.6000")] public static unsafe extern HRESULT SHCreateItemFromParsingName(PCWSTR pszPath, [AllowNull] IBindCtx pbc, Guid* riid, void** ppv); diff --git a/src/Snap.Hutao/Snap.Hutao/Win32/User32.cs b/src/Snap.Hutao/Snap.Hutao/Win32/User32.cs index 2da89af9..c37fad58 100644 --- a/src/Snap.Hutao/Snap.Hutao/Win32/User32.cs +++ b/src/Snap.Hutao/Snap.Hutao/Win32/User32.cs @@ -15,11 +15,11 @@ namespace Snap.Hutao.Win32; [SuppressMessage("", "SYSLIB1054")] internal static class User32 { - [DllImport("USER32.dll", ExactSpelling = true)] + [DllImport("USER32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)] [SupportedOSPlatform("windows5.1.2600")] public static extern BOOL AttachThreadInput(uint idAttach, uint idAttachTo, BOOL fAttach); - [DllImport("USER32.dll", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)] + [DllImport("USER32.dll", CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)] [SupportedOSPlatform("windows5.0")] public static extern HWND FindWindowExW([AllowNull] HWND hWndParent, [AllowNull] HWND hWndChildAfter, [AllowNull] PCWSTR lpszClass, [AllowNull] PCWSTR lpszWindow); @@ -35,23 +35,23 @@ internal static class User32 } } - [DllImport("USER32.dll", ExactSpelling = true)] + [DllImport("USER32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)] [SupportedOSPlatform("windows5.0")] public static extern HDC GetDC([AllowNull] HWND hWnd); - [DllImport("USER32.dll", ExactSpelling = true)] + [DllImport("USER32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)] [SupportedOSPlatform("windows10.0.14393")] public static extern uint GetDpiForWindow(HWND hwnd); - [DllImport("USER32.dll", ExactSpelling = true)] + [DllImport("USER32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)] [SupportedOSPlatform("windows5.0")] public static extern HWND GetForegroundWindow(); - [DllImport("USER32.dll", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)] + [DllImport("USER32.dll", CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)] [SupportedOSPlatform("windows5.0")] public static extern nint GetWindowLongPtrW(HWND hWnd, WINDOW_LONG_PTR_INDEX nIndex); - [DllImport("USER32.dll", ExactSpelling = true, SetLastError = true)] + [DllImport("USER32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)] [SupportedOSPlatform("windows5.0")] public static unsafe extern BOOL GetWindowPlacement(HWND hWnd, WINDOWPLACEMENT* lpwndpl); @@ -64,7 +64,7 @@ internal static class User32 } } - [DllImport("USER32.dll", ExactSpelling = true)] + [DllImport("USER32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)] [SupportedOSPlatform("windows5.0")] public static unsafe extern uint GetWindowThreadProcessId(HWND hWnd, [MaybeNull] uint* lpdwProcessId); @@ -77,15 +77,15 @@ internal static class User32 } } - [DllImport("USER32.dll", ExactSpelling = true, SetLastError = true)] + [DllImport("USER32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)] [SupportedOSPlatform("windows6.0.6000")] public static extern BOOL RegisterHotKey([AllowNull] HWND hWnd, int id, HOT_KEY_MODIFIERS fsModifiers, uint vk); - [DllImport("USER32.dll", ExactSpelling = true)] + [DllImport("USER32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)] [SupportedOSPlatform("windows5.0")] public static extern int ReleaseDC([AllowNull] HWND hWnd, HDC hDC); - [DllImport("USER32.dll", ExactSpelling = true, SetLastError = true)] + [DllImport("USER32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true, SetLastError = true)] [SupportedOSPlatform("windows5.0")] public static unsafe extern uint SendInput(uint cInputs, INPUT* pInputs, int cbSize); @@ -98,15 +98,15 @@ internal static class User32 } } - [DllImport("USER32.dll", ExactSpelling = true)] + [DllImport("USER32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)] [SupportedOSPlatform("windows5.0")] public static extern BOOL SetForegroundWindow(HWND hWnd); - [DllImport("USER32.dll", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)] + [DllImport("USER32.dll", CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)] [SupportedOSPlatform("windows5.0")] public static extern nint SetWindowLongPtrW(HWND hWnd, WINDOW_LONG_PTR_INDEX nIndex, nint dwNewLong); - [DllImport("USER32.dll", ExactSpelling = true, SetLastError = true)] + [DllImport("USER32.dll", CallingConvention = CallingConvention.Winapi, ExactSpelling = true)] [SupportedOSPlatform("windows5.0")] public static extern BOOL UnregisterHotKey([AllowNull] HWND hWnd, int id); } \ No newline at end of file