From 86eff93d9e48c45c411d3fb884e523300664125b Mon Sep 17 00:00:00 2001 From: gpetrou <4172445+gpetrou@users.noreply.github.com> Date: Wed, 8 Jun 2022 23:24:01 +0300 Subject: [PATCH] Use LibraryImport in some Interop User32 (#7172) --- global.json | 4 ++-- .../src/Interop/User32/Interop.ActivateKeyboardLayout.cs | 4 ++-- .../User32/Interop.AreDpiAwarenessContextsEqual.cs | 4 ++-- .../src/Interop/User32/Interop.BlockInput.cs | 4 ++-- .../src/Interop/User32/Interop.CallNextHookEx.cs | 4 ++-- .../src/Interop/User32/Interop.CallWindowProcW.cs | 4 ++-- .../src/Interop/User32/Interop.ClipCursor.cs | 4 ++-- .../src/Interop/User32/Interop.CloseDesktop.cs | 4 ++-- .../src/Interop/User32/Interop.CopyImage.cs | 4 ++-- .../src/Interop/User32/Interop.CreateAcceleratorTableW.cs | 4 ++-- .../src/Interop/User32/Interop.CreateMenu.cs | 4 ++-- .../src/Interop/User32/Interop.CreatePopupMenu.cs | 4 ++-- .../src/Interop/User32/Interop.DefFrameProcW.cs | 4 ++-- .../src/Interop/User32/Interop.DefMDIChildProcW.cs | 4 ++-- .../src/Interop/User32/Interop.DefWindowProcW.cs | 4 ++-- .../Interop/User32/Interop.DestroyAcceleratorTable.cs.cs | 4 ++-- .../src/Interop/User32/Interop.DestroyCursor.cs | 5 ++--- .../src/Interop/User32/Interop.DestroyIcon.cs | 4 ++-- .../src/Interop/User32/Interop.DestroyMenu.cs | 4 ++-- .../src/Interop/User32/Interop.DestroyWindow.cs | 4 ++-- .../src/Interop/User32/Interop.DrawIcon.cs | 4 ++-- .../src/Interop/User32/Interop.DrawIconEx.cs | 4 ++-- .../src/Interop/User32/Interop.DrawMenuBar.cs | 4 ++-- .../src/Interop/User32/Interop.EnableMenuItem.cs | 4 ++-- .../src/Interop/User32/Interop.EnableScrollBar.cs | 4 ++-- .../src/Interop/User32/Interop.EnableWindow.cs | 4 ++-- .../src/Interop/User32/Interop.EndDialog.cs | 4 ++-- .../src/Interop/User32/Interop.EndPaint.cs | 4 ++-- .../src/Interop/User32/Interop.GetActiveWindow.cs | 4 ++-- .../src/Interop/User32/Interop.GetAncestor.cs | 4 ++-- .../src/Interop/User32/Interop.GetAsyncKeyState.cs | 4 ++-- .../src/Interop/User32/Interop.GetCapture.cs | 4 ++-- .../src/Interop/User32/Interop.GetCaretBlinkTime.cs | 4 ++-- .../src/Interop/User32/Interop.GetClipboardFormatNameW.cs | 4 ++-- .../src/Interop/User32/Interop.GetCursor.cs | 4 ++-- .../src/Interop/User32/Interop.GetDesktopWindow.cs | 4 ++-- .../src/Interop/User32/Interop.GetDlgItem.cs | 4 ++-- .../src/Interop/User32/Interop.GetDoubleClickTime.cs | 4 ++-- .../src/Interop/User32/Interop.GetDpiForSystem.cs | 4 ++-- .../src/Interop/User32/Interop.GetDpiForWindow.cs | 4 ++-- .../src/Interop/User32/Interop.GetFocus.cs | 4 ++-- .../src/Interop/User32/Interop.GetForegroundWindow.cs | 4 ++-- .../src/Interop/User32/Interop.GetGuiResources.cs | 4 ++-- .../src/Interop/User32/Interop.GetKeyState.cs | 4 ++-- .../src/Interop/User32/Interop.GetKeyboardLayout.cs | 4 ++-- .../src/Interop/User32/Interop.GetKeyboardLayoutList.cs | 4 ++-- .../src/Interop/User32/Interop.GetKeyboardState.cs | 4 ++-- .../src/Interop/User32/Interop.GetMenu.cs | 4 ++-- .../src/Interop/User32/Interop.GetMenuItemCount.cs | 4 ++-- .../src/Interop/User32/Interop.GetMenuItemID.cs | 4 ++-- .../src/Interop/User32/Interop.GetMessageTime.cs | 4 ++-- .../src/Interop/User32/Interop.GetParent.cs | 4 ++-- .../src/Interop/User32/Interop.GetProcessWindowStation.cs | 4 ++-- .../src/Interop/User32/Interop.GetSubMenu.cs | 4 ++-- .../src/Interop/User32/Interop.GetSystemMenu.cs | 4 ++-- .../src/Interop/User32/Interop.GetSystemMetrics.cs | 8 ++++---- .../src/Interop/User32/Interop.GetWindow.cs | 4 ++-- .../src/Interop/User32/Interop.GetWindowLong.cs | 8 ++++---- .../src/Interop/User32/Interop.GetWindowText.cs | 4 ++-- .../Interop/User32/Interop.GetWindowThreadProcessId.cs | 4 ++-- .../src/Interop/User32/Interop.HideCaret.cs | 4 ++-- .../src/Interop/User32/Interop.InvalidateRect.cs | 4 ++-- .../src/Interop/User32/Interop.IsChild.cs | 4 ++-- .../src/Interop/User32/Interop.IsProcessDPIAware.cs | 4 ++-- .../Interop/User32/Interop.IsValidDpiAwarenessContext.cs | 4 ++-- .../src/Interop/User32/Interop.IsWindow.cs | 4 ++-- .../src/Interop/User32/Interop.IsWindowEnabled.cs | 4 ++-- .../src/Interop/User32/Interop.IsWindowUnicode.cs | 4 ++-- .../src/Interop/User32/Interop.IsWindowVisible.cs | 4 ++-- .../src/Interop/User32/Interop.IsZoomed.cs | 4 ++-- .../src/Interop/User32/Interop.KillTimer.cs | 4 ++-- .../src/Interop/User32/Interop.LoadCursorW.cs | 4 ++-- .../src/Interop/User32/Interop.MapWindowPoints.cs | 4 ++-- .../src/Interop/User32/Interop.MessageBeep.cs | 4 ++-- .../src/Interop/User32/Interop.MonitorFromWindow.cs | 4 ++-- .../Interop/User32/Interop.MsgWaitForMultipleObjectsEx.cs | 4 ++-- .../src/Interop/User32/Interop.OemKeyScan.cs | 4 ++-- .../src/Interop/User32/Interop.OpenInputDesktop.cs | 4 ++-- .../src/Interop/User32/Interop.PostMessageW.cs | 4 ++-- .../src/Interop/User32/Interop.PostQuitMessage.cs | 4 ++-- .../src/Interop/User32/Interop.PostThreadMessageW.cs | 4 ++-- .../src/Interop/User32/Interop.ReleaseCapture.cs | 4 ++-- .../src/Interop/User32/Interop.RemoveMenuItem.cs | 4 ++-- .../src/Interop/User32/Interop.ScrollWindowEx.cs | 4 ++-- .../src/Interop/User32/Interop.SendDlgItemMessageW.cs | 4 ++-- .../src/Interop/User32/Interop.SendInput.cs | 4 ++-- .../src/Interop/User32/Interop.SendMessageTimeoutW.cs | 4 ++-- .../src/Interop/User32/Interop.SendMessageW.cs | 4 ++-- .../src/Interop/User32/Interop.SetActiveWindow.cs | 4 ++-- .../src/Interop/User32/Interop.SetCapture.cs | 4 ++-- .../src/Interop/User32/Interop.SetClassLong.cs | 8 ++++---- .../src/Interop/User32/Interop.SetCursor.cs | 4 ++-- .../src/Interop/User32/Interop.SetCursorPos.cs | 4 ++-- .../src/Interop/User32/Interop.SetFocus.cs | 4 ++-- .../src/Interop/User32/Interop.SetForegroundWindow.cs | 4 ++-- .../src/Interop/User32/Interop.SetKeyboardState.cs | 4 ++-- .../Interop/User32/Interop.SetLayeredWindowAttributes.cs | 4 ++-- .../src/Interop/User32/Interop.SetMenu.cs | 4 ++-- .../src/Interop/User32/Interop.SetMenuDefaultItem.cs | 4 ++-- .../src/Interop/User32/Interop.SetParent.cs | 4 ++-- .../src/Interop/User32/Interop.SetProcessDPIAware.cs | 4 ++-- .../User32/Interop.SetProcessDpiAwarenessContext.cs | 4 ++-- .../src/Interop/User32/Interop.SetScrollPos.cs | 4 ++-- .../src/Interop/User32/Interop.SetTimer.cs | 4 ++-- .../src/Interop/User32/Interop.SetWindowLong.cs | 8 ++++---- .../src/Interop/User32/Interop.SetWindowPos.cs | 4 ++-- .../src/Interop/User32/Interop.SetWindowRgn.cs | 4 ++-- .../src/Interop/User32/Interop.SetWindowsHookExW.cs | 4 ++-- .../src/Interop/User32/Interop.ShowCaret.cs | 4 ++-- .../src/Interop/User32/Interop.ShowCursor.cs | 4 ++-- .../src/Interop/User32/Interop.ShowWindow.cs | 4 ++-- .../src/Interop/User32/Interop.UnhookWindowsHookEx.cs | 4 ++-- .../src/Interop/User32/Interop.UpdateWindow.cs | 4 ++-- .../src/Interop/User32/Interop.ValidateRect.cs | 4 ++-- .../src/Interop/User32/Interop.WaitMessage.cs | 4 ++-- 115 files changed, 238 insertions(+), 239 deletions(-) diff --git a/global.json b/global.json index a95e3355f20..1a53284f385 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "tools": { - "dotnet": "7.0.100-preview.3.22154.3", + "dotnet": "7.0.100-preview.5.22228.6", "runtimes": { "dotnet/x64": [ "$(VSRedistCommonNetCoreSharedFrameworkx6470PackageVersion)" @@ -11,7 +11,7 @@ } }, "sdk": { - "version": "7.0.100-preview.3.22154.3" + "version": "7.0.100-preview.5.22228.6" }, "msbuild-sdks": { "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22306.2", diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.ActivateKeyboardLayout.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.ActivateKeyboardLayout.cs index 5de537019e2..7ee7516be45 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.ActivateKeyboardLayout.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.ActivateKeyboardLayout.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern IntPtr ActivateKeyboardLayout(IntPtr hkl, uint Flags); + [LibraryImport(Libraries.User32)] + public static partial IntPtr ActivateKeyboardLayout(IntPtr hkl, uint Flags); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.AreDpiAwarenessContextsEqual.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.AreDpiAwarenessContextsEqual.cs index 5f42771aacf..93fc6ad68a8 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.AreDpiAwarenessContextsEqual.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.AreDpiAwarenessContextsEqual.cs @@ -9,8 +9,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true, EntryPoint = "AreDpiAwarenessContextsEqual", SetLastError = true)] - private static extern BOOL AreDpiAwarenessContextsEqualInternal(IntPtr dpiContextA, IntPtr dpiContextB); + [LibraryImport(Libraries.User32, EntryPoint = "AreDpiAwarenessContextsEqual", SetLastError = true)] + private static partial BOOL AreDpiAwarenessContextsEqualInternal(IntPtr dpiContextA, IntPtr dpiContextB); /// /// Tries to compare two DPIawareness context values. Return true if they were equal. diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.BlockInput.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.BlockInput.cs index 1428d1c69d6..4ced2d33a5b 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.BlockInput.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.BlockInput.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern BOOL BlockInput(BOOL fBlockIt); + [LibraryImport(Libraries.User32)] + public static partial BOOL BlockInput(BOOL fBlockIt); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.CallNextHookEx.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.CallNextHookEx.cs index 5929cb3b3a7..1eac86f2445 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.CallNextHookEx.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.CallNextHookEx.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern nint CallNextHookEx(IntPtr hhook, User32.HC nCode, nint wparam, nint lparam); + [LibraryImport(Libraries.User32)] + public static partial nint CallNextHookEx(IntPtr hhook, User32.HC nCode, nint wparam, nint lparam); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.CallWindowProcW.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.CallWindowProcW.cs index ffc33fc6d32..0465b055d4a 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.CallWindowProcW.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.CallWindowProcW.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern IntPtr CallWindowProcW( + [LibraryImport(Libraries.User32)] + public static partial IntPtr CallWindowProcW( IntPtr wndProc, IntPtr hWnd, WM msg, diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.ClipCursor.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.ClipCursor.cs index 948743c0424..10114d59e71 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.ClipCursor.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.ClipCursor.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static unsafe extern BOOL ClipCursor(RECT* rcClip); + [LibraryImport(Libraries.User32)] + public static unsafe partial BOOL ClipCursor(RECT* rcClip); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.CloseDesktop.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.CloseDesktop.cs index fd91eab768e..1ddc35767ed 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.CloseDesktop.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.CloseDesktop.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true, SetLastError = true)] - public static extern BOOL CloseDesktop(IntPtr hDesktop); + [LibraryImport(Libraries.User32, SetLastError = true)] + public static partial BOOL CloseDesktop(IntPtr hDesktop); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.CopyImage.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.CopyImage.cs index 5b00a9f1f20..61c3380c070 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.CopyImage.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.CopyImage.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern IntPtr CopyImage(IntPtr hImage, IMAGE type, int cx, int cy, LR flags); + [LibraryImport(Libraries.User32)] + public static partial IntPtr CopyImage(IntPtr hImage, IMAGE type, int cx, int cy, LR flags); public static IntPtr CopyImage(IHandle hImage, IMAGE type, int cx, int cy, LR flags) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.CreateAcceleratorTableW.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.CreateAcceleratorTableW.cs index 9dc930f1270..fadb66f0140 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.CreateAcceleratorTableW.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.CreateAcceleratorTableW.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public unsafe static extern IntPtr CreateAcceleratorTableW(ACCEL* paccel, int cAccel); + [LibraryImport(Libraries.User32)] + public unsafe static partial IntPtr CreateAcceleratorTableW(ACCEL* paccel, int cAccel); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.CreateMenu.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.CreateMenu.cs index 227535bb324..b98ea6b6bb8 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.CreateMenu.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.CreateMenu.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern IntPtr CreateMenu(); + [LibraryImport(Libraries.User32)] + public static partial IntPtr CreateMenu(); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.CreatePopupMenu.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.CreatePopupMenu.cs index b7b3b6d03b3..5304ec48e3d 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.CreatePopupMenu.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.CreatePopupMenu.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern IntPtr CreatePopupMenu(); + [LibraryImport(Libraries.User32)] + public static partial IntPtr CreatePopupMenu(); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.DefFrameProcW.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.DefFrameProcW.cs index 8348ec449aa..929c33168c6 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.DefFrameProcW.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.DefFrameProcW.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern IntPtr DefFrameProcW(IntPtr hWnd, IntPtr hWndClient, WM msg, IntPtr wParam, IntPtr lParam); + [LibraryImport(Libraries.User32)] + public static partial IntPtr DefFrameProcW(IntPtr hWnd, IntPtr hWndClient, WM msg, IntPtr wParam, IntPtr lParam); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.DefMDIChildProcW.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.DefMDIChildProcW.cs index 04bc6bbb938..1bdb8689a47 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.DefMDIChildProcW.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.DefMDIChildProcW.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern IntPtr DefMDIChildProcW(IntPtr hWnd, WM msg, IntPtr wParam, IntPtr lParam); + [LibraryImport(Libraries.User32)] + public static partial IntPtr DefMDIChildProcW(IntPtr hWnd, WM msg, IntPtr wParam, IntPtr lParam); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.DefWindowProcW.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.DefWindowProcW.cs index 0609958f000..9fb9c46674a 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.DefWindowProcW.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.DefWindowProcW.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern IntPtr DefWindowProcW( + [LibraryImport(Libraries.User32)] + public static partial IntPtr DefWindowProcW( IntPtr hWnd, WM msg, IntPtr wParam, diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.DestroyAcceleratorTable.cs.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.DestroyAcceleratorTable.cs.cs index 167c1a902c9..25ff9869d26 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.DestroyAcceleratorTable.cs.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.DestroyAcceleratorTable.cs.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern BOOL DestroyAcceleratorTable(IntPtr hAccel); + [LibraryImport(Libraries.User32)] + public static partial BOOL DestroyAcceleratorTable(IntPtr hAccel); public static BOOL DestroyAcceleratorTable(HandleRef hAccel) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.DestroyCursor.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.DestroyCursor.cs index 3fdd577b27d..4e2bcec688b 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.DestroyCursor.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.DestroyCursor.cs @@ -8,8 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - - public static extern BOOL DestroyCursor(IntPtr hCurs); + [LibraryImport(Libraries.User32)] + public static partial BOOL DestroyCursor(IntPtr hCurs); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.DestroyIcon.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.DestroyIcon.cs index ec3904942b1..e04e4b54fa6 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.DestroyIcon.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.DestroyIcon.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true, SetLastError = true)] - public extern static BOOL DestroyIcon(IntPtr handle); + [LibraryImport(Libraries.User32, SetLastError = true)] + public static partial BOOL DestroyIcon(IntPtr handle); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.DestroyMenu.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.DestroyMenu.cs index 00cbecaac87..047f7be3d77 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.DestroyMenu.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.DestroyMenu.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern BOOL DestroyMenu(IntPtr hMenu); + [LibraryImport(Libraries.User32)] + public static partial BOOL DestroyMenu(IntPtr hMenu); public static BOOL DestroyMenu(HandleRef hMenu) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.DestroyWindow.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.DestroyWindow.cs index 95cafdc09b3..5d0cfcca230 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.DestroyWindow.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.DestroyWindow.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern BOOL DestroyWindow(IntPtr hWnd); + [LibraryImport(Libraries.User32)] + public static partial BOOL DestroyWindow(IntPtr hWnd); public static BOOL DestroyWindow(IHandle hWnd) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.DrawIcon.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.DrawIcon.cs index 8b6a53d42f3..ce5317172cd 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.DrawIcon.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.DrawIcon.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern BOOL DrawIcon(IntPtr hDC, int x, int y, IntPtr hIcon); + [LibraryImport(Libraries.User32)] + public static partial BOOL DrawIcon(IntPtr hDC, int x, int y, IntPtr hIcon); public static BOOL DrawIcon(IntPtr hDC, int x, int y, IHandle hIcon) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.DrawIconEx.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.DrawIconEx.cs index 6140eaf88ae..f10b5ba2766 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.DrawIconEx.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.DrawIconEx.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern BOOL DrawIconEx( + [LibraryImport(Libraries.User32)] + public static partial BOOL DrawIconEx( Gdi32.HDC hDC, int xLeft, int yTop, diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.DrawMenuBar.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.DrawMenuBar.cs index 8ee02a90295..61c30efc424 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.DrawMenuBar.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.DrawMenuBar.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - private static extern BOOL DrawMenuBar(IntPtr hWnd); + [LibraryImport(Libraries.User32)] + private static partial BOOL DrawMenuBar(IntPtr hWnd); public static BOOL DrawMenuBar(IHandle hWnd) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.EnableMenuItem.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.EnableMenuItem.cs index 22a3e2687f0..b2b5c852734 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.EnableMenuItem.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.EnableMenuItem.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern BOOL EnableMenuItem(IntPtr hMenu, SC uIDEnableItem, MF uEnable); + [LibraryImport(Libraries.User32)] + public static partial BOOL EnableMenuItem(IntPtr hMenu, SC uIDEnableItem, MF uEnable); public static BOOL EnableMenuItem(HandleRef hMenu, SC uIDEnableItem, MF uEnable) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.EnableScrollBar.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.EnableScrollBar.cs index 28340f0fe29..9741fd5d5f5 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.EnableScrollBar.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.EnableScrollBar.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true, SetLastError = true)] - public static extern BOOL EnableScrollBar(IntPtr hWnd, SB wSBflags, ESB wArrows); + [LibraryImport(Libraries.User32, SetLastError = true)] + public static partial BOOL EnableScrollBar(IntPtr hWnd, SB wSBflags, ESB wArrows); public static BOOL EnableScrollBar(IHandle hWnd, SB wSBflags, ESB wArrows) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.EnableWindow.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.EnableWindow.cs index edbafbde1a1..b01b0f45ec3 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.EnableWindow.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.EnableWindow.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern BOOL EnableWindow(IntPtr hWnd, BOOL bEnable); + [LibraryImport(Libraries.User32)] + public static partial BOOL EnableWindow(IntPtr hWnd, BOOL bEnable); public static BOOL EnableWindow(HandleRef hWnd, BOOL bEnable) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.EndDialog.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.EndDialog.cs index 62f5fe5131c..a1502c70d77 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.EndDialog.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.EndDialog.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern BOOL EndDialog(IntPtr hDlg, IntPtr nResult); + [LibraryImport(Libraries.User32)] + public static partial BOOL EndDialog(IntPtr hDlg, IntPtr nResult); public static BOOL EndDialog(HandleRef hDlg, IntPtr nResult) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.EndPaint.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.EndPaint.cs index 2daa82a9067..f9ecdc3e5c6 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.EndPaint.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.EndPaint.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public unsafe static extern BOOL EndPaint(IntPtr hWnd, PAINTSTRUCT* lpPaint); + [LibraryImport(Libraries.User32)] + public unsafe static partial BOOL EndPaint(IntPtr hWnd, PAINTSTRUCT* lpPaint); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetActiveWindow.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetActiveWindow.cs index 096514afae0..a5c0a0b7579 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetActiveWindow.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetActiveWindow.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern IntPtr GetActiveWindow(); + [LibraryImport(Libraries.User32)] + public static partial IntPtr GetActiveWindow(); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetAncestor.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetAncestor.cs index ee953586bbb..1cfeaeed804 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetAncestor.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetAncestor.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern IntPtr GetAncestor(IntPtr hwnd, GA flags); + [LibraryImport(Libraries.User32)] + public static partial IntPtr GetAncestor(IntPtr hwnd, GA flags); public static IntPtr GetAncestor(IHandle hwnd, GA flags) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetAsyncKeyState.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetAsyncKeyState.cs index 76af71c6da4..05a06c062f2 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetAsyncKeyState.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetAsyncKeyState.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern short GetAsyncKeyState(int vkey); + [LibraryImport(Libraries.User32)] + public static partial short GetAsyncKeyState(int vkey); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetCapture.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetCapture.cs index 3045cb5a051..d6a166c7bbf 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetCapture.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetCapture.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern IntPtr GetCapture(); + [LibraryImport(Libraries.User32)] + public static partial IntPtr GetCapture(); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetCaretBlinkTime.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetCaretBlinkTime.cs index 4e099f91ddb..c61c5fb84bc 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetCaretBlinkTime.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetCaretBlinkTime.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern uint GetCaretBlinkTime(); + [LibraryImport(Libraries.User32)] + public static partial uint GetCaretBlinkTime(); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetClipboardFormatNameW.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetClipboardFormatNameW.cs index febc2eab84a..3a1e62e56f2 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetClipboardFormatNameW.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetClipboardFormatNameW.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - private static unsafe extern int GetClipboardFormatNameW(uint format, char* lpszFormatName, int cchMaxCount); + [LibraryImport(Libraries.User32)] + private static unsafe partial int GetClipboardFormatNameW(uint format, char* lpszFormatName, int cchMaxCount); public static unsafe string? GetClipboardFormatNameW(uint format) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetCursor.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetCursor.cs index 879072f2e93..a62d7eb92cb 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetCursor.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetCursor.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern IntPtr GetCursor(); + [LibraryImport(Libraries.User32)] + public static partial IntPtr GetCursor(); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetDesktopWindow.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetDesktopWindow.cs index 71f8b2d9edc..b5cf5c056c8 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetDesktopWindow.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetDesktopWindow.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern IntPtr GetDesktopWindow(); + [LibraryImport(Libraries.User32)] + public static partial IntPtr GetDesktopWindow(); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetDlgItem.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetDlgItem.cs index bea80b4b560..ff7999ae2ff 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetDlgItem.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetDlgItem.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern IntPtr GetDlgItem(IntPtr hWnd, DialogItemID nIDDlgItem); + [LibraryImport(Libraries.User32)] + public static partial IntPtr GetDlgItem(IntPtr hWnd, DialogItemID nIDDlgItem); public static IntPtr GetDlgItem(IHandle hWnd, DialogItemID nIDDlgItem) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetDoubleClickTime.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetDoubleClickTime.cs index 3de9a1ec1a0..2478499cf77 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetDoubleClickTime.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetDoubleClickTime.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern uint GetDoubleClickTime(); + [LibraryImport(Libraries.User32)] + public static partial uint GetDoubleClickTime(); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetDpiForSystem.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetDpiForSystem.cs index 3e5fd9e13aa..c7023404702 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetDpiForSystem.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetDpiForSystem.cs @@ -9,7 +9,7 @@ internal static partial class Interop internal static partial class User32 { // This is only available on Windows 1607 and later. Avoids needing a DC to get the DPI. - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern uint GetDpiForSystem(); + [LibraryImport(Libraries.User32)] + public static partial uint GetDpiForSystem(); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetDpiForWindow.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetDpiForWindow.cs index 92a77ac7835..58c84861769 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetDpiForWindow.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetDpiForWindow.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern uint GetDpiForWindow(IntPtr hwnd); + [LibraryImport(Libraries.User32)] + public static partial uint GetDpiForWindow(IntPtr hwnd); public static uint GetDpiForWindow(IHandle hwnd) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetFocus.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetFocus.cs index fb350fd3f44..51f16a2e7bf 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetFocus.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetFocus.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern IntPtr GetFocus(); + [LibraryImport(Libraries.User32)] + public static partial IntPtr GetFocus(); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetForegroundWindow.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetForegroundWindow.cs index e1bf5a0b147..b424e4efe38 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetForegroundWindow.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetForegroundWindow.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern IntPtr GetForegroundWindow(); + [LibraryImport(Libraries.User32)] + public static partial IntPtr GetForegroundWindow(); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetGuiResources.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetGuiResources.cs index 96cbf47be5f..2df7227a157 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetGuiResources.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetGuiResources.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true, SetLastError = true)] - public static extern uint GetGuiResources(IntPtr hProcess, GR uiFlags); + [LibraryImport(Libraries.User32, SetLastError = true)] + public static partial uint GetGuiResources(IntPtr hProcess, GR uiFlags); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetKeyState.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetKeyState.cs index 4c2e0d8b241..63b1c58c4c4 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetKeyState.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetKeyState.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern short GetKeyState(int keyCode); + [LibraryImport(Libraries.User32)] + public static partial short GetKeyState(int keyCode); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetKeyboardLayout.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetKeyboardLayout.cs index a629d4183d2..6dac6ec698a 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetKeyboardLayout.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetKeyboardLayout.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern IntPtr GetKeyboardLayout(uint idThread); + [LibraryImport(Libraries.User32)] + public static partial IntPtr GetKeyboardLayout(uint idThread); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetKeyboardLayoutList.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetKeyboardLayoutList.cs index 707784a0a92..87e60544f49 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetKeyboardLayoutList.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetKeyboardLayoutList.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public unsafe static extern int GetKeyboardLayoutList(int nBuff, IntPtr* lpList); + [LibraryImport(Libraries.User32)] + public unsafe static partial int GetKeyboardLayoutList(int nBuff, IntPtr* lpList); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetKeyboardState.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetKeyboardState.cs index 6a172229079..d583aa389ba 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetKeyboardState.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetKeyboardState.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public unsafe static extern BOOL GetKeyboardState(byte* lpKeyState); + [LibraryImport(Libraries.User32)] + public unsafe static partial BOOL GetKeyboardState(byte* lpKeyState); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetMenu.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetMenu.cs index b32f3ee5fc8..1b6eabe0fec 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetMenu.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetMenu.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern IntPtr GetMenu(IntPtr hWnd); + [LibraryImport(Libraries.User32)] + public static partial IntPtr GetMenu(IntPtr hWnd); public static IntPtr GetMenu(IHandle hWnd) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetMenuItemCount.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetMenuItemCount.cs index ffa4423288c..13dd2f11e7d 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetMenuItemCount.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetMenuItemCount.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern int GetMenuItemCount(IntPtr hMenu); + [LibraryImport(Libraries.User32)] + public static partial int GetMenuItemCount(IntPtr hMenu); public static int GetMenuItemCount(HandleRef hMenu) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetMenuItemID.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetMenuItemID.cs index 3b759f7db5f..5ff87082cfc 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetMenuItemID.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetMenuItemID.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern int GetMenuItemID(IntPtr hMenu, int nPos); + [LibraryImport(Libraries.User32)] + public static partial int GetMenuItemID(IntPtr hMenu, int nPos); public static int GetMenuItemID(HandleRef hMenu, int nPos) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetMessageTime.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetMessageTime.cs index 864298b43b6..e8780189d8d 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetMessageTime.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetMessageTime.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern int GetMessageTime(); + [LibraryImport(Libraries.User32)] + public static partial int GetMessageTime(); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetParent.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetParent.cs index a9482b70d1c..66eae3ed97d 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetParent.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetParent.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern IntPtr GetParent(IntPtr hWnd); + [LibraryImport(Libraries.User32)] + public static partial IntPtr GetParent(IntPtr hWnd); public static IntPtr GetParent(IHandle hWnd) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetProcessWindowStation.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetProcessWindowStation.cs index 012826584e8..c45ed848f38 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetProcessWindowStation.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetProcessWindowStation.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern IntPtr GetProcessWindowStation(); + [LibraryImport(Libraries.User32)] + public static partial IntPtr GetProcessWindowStation(); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetSubMenu.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetSubMenu.cs index 477be09b8be..5aa050819f2 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetSubMenu.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetSubMenu.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern IntPtr GetSubMenu(IntPtr hMenu, int nPos); + [LibraryImport(Libraries.User32)] + public static partial IntPtr GetSubMenu(IntPtr hMenu, int nPos); public static IntPtr GetSubMenu(HandleRef hMenu, int nPos) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetSystemMenu.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetSystemMenu.cs index fa7eac744d1..94d734f26fa 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetSystemMenu.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetSystemMenu.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern IntPtr GetSystemMenu(IntPtr hWnd, BOOL bRevert); + [LibraryImport(Libraries.User32)] + public static partial IntPtr GetSystemMenu(IntPtr hWnd, BOOL bRevert); public static IntPtr GetSystemMenu(HandleRef hWnd, BOOL bRevert) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetSystemMetrics.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetSystemMetrics.cs index 8fb3413a3d7..24ca327502e 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetSystemMetrics.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetSystemMetrics.cs @@ -90,11 +90,11 @@ public enum SystemMetric SM_CYSIZEFRAME = SM_CYFRAME } - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern int GetSystemMetrics(SystemMetric nIndex); + [LibraryImport(Libraries.User32)] + public static partial int GetSystemMetrics(SystemMetric nIndex); - [DllImport(Libraries.User32, ExactSpelling = true)] - private static extern int GetSystemMetricsForDpi(SystemMetric nIndex, uint dpi); + [LibraryImport(Libraries.User32)] + private static partial int GetSystemMetricsForDpi(SystemMetric nIndex, uint dpi); /// /// Tries to get system metrics for the dpi. dpi is ignored if "GetSystemMetricsForDpi" is not available on the OS that this application is running. diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetWindow.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetWindow.cs index 91283f7e8af..18991a7f7c5 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetWindow.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetWindow.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern IntPtr GetWindow(IntPtr hWnd, GW uCmd); + [LibraryImport(Libraries.User32)] + public static partial IntPtr GetWindow(IntPtr hWnd, GW uCmd); public static IntPtr GetWindow(IHandle hWnd, GW uCmd) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetWindowLong.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetWindowLong.cs index 77c9ac540f0..b2421ac349f 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetWindowLong.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetWindowLong.cs @@ -9,11 +9,11 @@ internal static partial class Interop internal static partial class User32 { // We only ever call this on 32 bit so IntPtr is correct - [DllImport(Libraries.User32, ExactSpelling = true, SetLastError = true)] - private static extern nint GetWindowLongW(IntPtr hWnd, GWL nIndex); + [LibraryImport(Libraries.User32, SetLastError = true)] + private static partial nint GetWindowLongW(IntPtr hWnd, GWL nIndex); - [DllImport(Libraries.User32, ExactSpelling = true, SetLastError = true)] - public static extern nint GetWindowLongPtrW(IntPtr hWnd, GWL nIndex); + [LibraryImport(Libraries.User32, SetLastError = true)] + public static partial nint GetWindowLongPtrW(IntPtr hWnd, GWL nIndex); public static nint GetWindowLong(IntPtr hWnd, GWL nIndex) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetWindowText.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetWindowText.cs index 395407b8037..cd44e828ae1 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetWindowText.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetWindowText.cs @@ -9,8 +9,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern int GetWindowTextLengthW(IntPtr hWnd); + [LibraryImport(Libraries.User32)] + public static partial int GetWindowTextLengthW(IntPtr hWnd); public static int GetWindowTextLengthW(HandleRef hWnd) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetWindowThreadProcessId.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetWindowThreadProcessId.cs index feb009da0b9..2cd06f95d67 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetWindowThreadProcessId.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.GetWindowThreadProcessId.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId); + [LibraryImport(Libraries.User32)] + public static partial uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId); public static uint GetWindowThreadProcessId(IHandle hWnd, out uint lpdwProcessId) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.HideCaret.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.HideCaret.cs index 0d0f2a1f4af..10690eed063 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.HideCaret.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.HideCaret.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern BOOL HideCaret(IntPtr hWnd); + [LibraryImport(Libraries.User32)] + public static partial BOOL HideCaret(IntPtr hWnd); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.InvalidateRect.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.InvalidateRect.cs index 7729ea2a298..6f4bb0cf143 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.InvalidateRect.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.InvalidateRect.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public unsafe static extern BOOL InvalidateRect(IntPtr hWnd, RECT* lpRect, BOOL bErase); + [LibraryImport(Libraries.User32)] + public unsafe static partial BOOL InvalidateRect(IntPtr hWnd, RECT* lpRect, BOOL bErase); public unsafe static BOOL InvalidateRect(HandleRef hWnd, RECT* lpRect, BOOL bErase) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.IsChild.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.IsChild.cs index 40df29abee3..daa0b6797cb 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.IsChild.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.IsChild.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern BOOL IsChild(IntPtr hWndParent, IntPtr hWnd); + [LibraryImport(Libraries.User32)] + public static partial BOOL IsChild(IntPtr hWndParent, IntPtr hWnd); public static BOOL IsChild(IntPtr hWndParent, HandleRef hWnd) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.IsProcessDPIAware.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.IsProcessDPIAware.cs index 0e385d7ad12..b70f38193b9 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.IsProcessDPIAware.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.IsProcessDPIAware.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern BOOL IsProcessDPIAware(); + [LibraryImport(Libraries.User32)] + public static partial BOOL IsProcessDPIAware(); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.IsValidDpiAwarenessContext.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.IsValidDpiAwarenessContext.cs index dafce1d14a0..59662ea44e2 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.IsValidDpiAwarenessContext.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.IsValidDpiAwarenessContext.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern BOOL IsValidDpiAwarenessContext(IntPtr value); + [LibraryImport(Libraries.User32)] + public static partial BOOL IsValidDpiAwarenessContext(IntPtr value); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.IsWindow.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.IsWindow.cs index b6b65685b2a..83afbf8f18b 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.IsWindow.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.IsWindow.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern BOOL IsWindow(IntPtr hWnd); + [LibraryImport(Libraries.User32)] + public static partial BOOL IsWindow(IntPtr hWnd); public static BOOL IsWindow(HandleRef hWnd) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.IsWindowEnabled.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.IsWindowEnabled.cs index 3c165996bf2..2ed3b6cf1bc 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.IsWindowEnabled.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.IsWindowEnabled.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern BOOL IsWindowEnabled(IntPtr hWnd); + [LibraryImport(Libraries.User32)] + public static partial BOOL IsWindowEnabled(IntPtr hWnd); public static BOOL IsWindowEnabled(IHandle hWnd) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.IsWindowUnicode.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.IsWindowUnicode.cs index 32073edb1d9..06ae3775416 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.IsWindowUnicode.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.IsWindowUnicode.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern BOOL IsWindowUnicode(IntPtr hWnd); + [LibraryImport(Libraries.User32)] + public static partial BOOL IsWindowUnicode(IntPtr hWnd); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.IsWindowVisible.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.IsWindowVisible.cs index c083fc20a0e..22fd948b9c1 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.IsWindowVisible.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.IsWindowVisible.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern BOOL IsWindowVisible(IntPtr hWnd); + [LibraryImport(Libraries.User32)] + public static partial BOOL IsWindowVisible(IntPtr hWnd); public static BOOL IsWindowVisible(IHandle hWnd) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.IsZoomed.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.IsZoomed.cs index 4c21cf5455b..e4a474288ad 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.IsZoomed.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.IsZoomed.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern BOOL IsZoomed(IntPtr hWnd); + [LibraryImport(Libraries.User32)] + public static partial BOOL IsZoomed(IntPtr hWnd); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.KillTimer.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.KillTimer.cs index 420cf47432a..697199c4cab 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.KillTimer.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.KillTimer.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern BOOL KillTimer(IntPtr hWnd, IntPtr uIDEvent); + [LibraryImport(Libraries.User32)] + public static partial BOOL KillTimer(IntPtr hWnd, IntPtr uIDEvent); public static BOOL KillTimer(HandleRef hWnd, IntPtr uIDEvent) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.LoadCursorW.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.LoadCursorW.cs index 2ac10417ddf..103cc946de7 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.LoadCursorW.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.LoadCursorW.cs @@ -31,7 +31,7 @@ public static class CursorResourceId public const int IDC_HELP = 32651; } - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern IntPtr LoadCursorW(IntPtr hInstance, IntPtr lpCursorName); + [LibraryImport(Libraries.User32)] + public static partial IntPtr LoadCursorW(IntPtr hInstance, IntPtr lpCursorName); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.MapWindowPoints.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.MapWindowPoints.cs index a3cf812a241..542ce11b03a 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.MapWindowPoints.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.MapWindowPoints.cs @@ -9,8 +9,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public unsafe static extern int MapWindowPoints(IntPtr hWndFrom, IntPtr hWndTo, Point* lpPoints, uint cPoints); + [LibraryImport(Libraries.User32)] + public unsafe static partial int MapWindowPoints(IntPtr hWndFrom, IntPtr hWndTo, Point* lpPoints, uint cPoints); public unsafe static int MapWindowPoint(IHandle hWndFrom, IHandle hWndTo, ref Point lpPoints) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.MessageBeep.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.MessageBeep.cs index 59f948dc038..a50b8795e08 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.MessageBeep.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.MessageBeep.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, SetLastError = true, ExactSpelling = true)] - public static extern BOOL MessageBeep(MB type); + [LibraryImport(Libraries.User32, SetLastError = true)] + public static partial BOOL MessageBeep(MB type); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.MonitorFromWindow.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.MonitorFromWindow.cs index 92f7a16c879..b1a8c0944c2 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.MonitorFromWindow.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.MonitorFromWindow.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern IntPtr MonitorFromWindow(IntPtr hwnd, MONITOR dwFlags); + [LibraryImport(Libraries.User32)] + public static partial IntPtr MonitorFromWindow(IntPtr hwnd, MONITOR dwFlags); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.MsgWaitForMultipleObjectsEx.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.MsgWaitForMultipleObjectsEx.cs index a51006e6931..bee3ed47be9 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.MsgWaitForMultipleObjectsEx.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.MsgWaitForMultipleObjectsEx.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern uint MsgWaitForMultipleObjectsEx(uint nCount, IntPtr pHandles, uint dwMilliseconds, QS dwWakeMask, MWMO dwFlags); + [LibraryImport(Libraries.User32)] + public static partial uint MsgWaitForMultipleObjectsEx(uint nCount, IntPtr pHandles, uint dwMilliseconds, QS dwWakeMask, MWMO dwFlags); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.OemKeyScan.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.OemKeyScan.cs index 7916aaa0ffb..b8cc73005e7 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.OemKeyScan.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.OemKeyScan.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern uint OemKeyScan(ushort wAsciiVal); + [LibraryImport(Libraries.User32)] + public static partial uint OemKeyScan(ushort wAsciiVal); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.OpenInputDesktop.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.OpenInputDesktop.cs index 1c63ea53386..08cc25d6c19 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.OpenInputDesktop.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.OpenInputDesktop.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true, SetLastError = true)] - public static extern IntPtr OpenInputDesktop(DF dwFlags, BOOL fInherit, DESKTOP dwDesiredAccess); + [LibraryImport(Libraries.User32, SetLastError = true)] + public static partial IntPtr OpenInputDesktop(DF dwFlags, BOOL fInherit, DESKTOP dwDesiredAccess); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.PostMessageW.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.PostMessageW.cs index 9582ec18a61..009f9b57e49 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.PostMessageW.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.PostMessageW.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern BOOL PostMessageW( + [LibraryImport(Libraries.User32)] + public static partial BOOL PostMessageW( IntPtr hWnd, WM Msg, nint wParam = default, diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.PostQuitMessage.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.PostQuitMessage.cs index 6f98150b850..0c40091d1d5 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.PostQuitMessage.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.PostQuitMessage.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern void PostQuitMessage(int nExitCode); + [LibraryImport(Libraries.User32)] + public static partial void PostQuitMessage(int nExitCode); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.PostThreadMessageW.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.PostThreadMessageW.cs index 7fcd10b7767..b1a9e18280c 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.PostThreadMessageW.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.PostThreadMessageW.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern int PostThreadMessageW(uint id, WM msg, IntPtr wparam, IntPtr lparam); + [LibraryImport(Libraries.User32)] + public static partial int PostThreadMessageW(uint id, WM msg, IntPtr wparam, IntPtr lparam); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.ReleaseCapture.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.ReleaseCapture.cs index f0cd3e3ab8e..908589f81e7 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.ReleaseCapture.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.ReleaseCapture.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern BOOL ReleaseCapture(); + [LibraryImport(Libraries.User32)] + public static partial BOOL ReleaseCapture(); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.RemoveMenuItem.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.RemoveMenuItem.cs index 0a9c224d19d..e58685cd57b 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.RemoveMenuItem.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.RemoveMenuItem.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern BOOL RemoveMenu(IntPtr hMenu, uint uPosition, MF uFlags); + [LibraryImport(Libraries.User32)] + public static partial BOOL RemoveMenu(IntPtr hMenu, uint uPosition, MF uFlags); public static BOOL RemoveMenu(HandleRef hMenu, uint uPosition, MF uFlags) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.ScrollWindowEx.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.ScrollWindowEx.cs index 53a92acbe27..f1ab0eac6d2 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.ScrollWindowEx.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.ScrollWindowEx.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public unsafe static extern int ScrollWindowEx( + [LibraryImport(Libraries.User32)] + public unsafe static partial int ScrollWindowEx( IntPtr hWnd, int dx, int dy, diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SendDlgItemMessageW.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SendDlgItemMessageW.cs index 53406f86a9a..54c2a1db3e9 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SendDlgItemMessageW.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SendDlgItemMessageW.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern IntPtr SendDlgItemMessageW(IntPtr hDlg, DialogItemID nIDDlgItem, WM Msg, IntPtr wParam = default, IntPtr lParam = default); + [LibraryImport(Libraries.User32)] + public static partial IntPtr SendDlgItemMessageW(IntPtr hDlg, DialogItemID nIDDlgItem, WM Msg, IntPtr wParam = default, IntPtr lParam = default); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SendInput.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SendInput.cs index 088b6621fb7..e4072890586 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SendInput.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SendInput.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true, SetLastError = true)] - public unsafe static extern uint SendInput(uint cInputs, INPUT* pInputs, int cbSize); + [LibraryImport(Libraries.User32, SetLastError = true)] + public unsafe static partial uint SendInput(uint cInputs, INPUT* pInputs, int cbSize); public unsafe static uint SendInput(uint cInputs, Span pInputs, int cbSize) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SendMessageTimeoutW.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SendMessageTimeoutW.cs index c02f923bb15..98de6c9ab01 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SendMessageTimeoutW.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SendMessageTimeoutW.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern IntPtr SendMessageTimeoutW( + [LibraryImport(Libraries.User32)] + public static partial IntPtr SendMessageTimeoutW( IntPtr hWnd, WM Msg, IntPtr wParam, diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SendMessageW.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SendMessageW.cs index 2ff1d822592..3d94b55b702 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SendMessageW.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SendMessageW.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern nint SendMessageW( + [LibraryImport(Libraries.User32)] + public static partial nint SendMessageW( IntPtr hWnd, WM Msg, nint wParam = default, diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetActiveWindow.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetActiveWindow.cs index bdb45afd480..58ea0efd67c 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetActiveWindow.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetActiveWindow.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true, SetLastError = true)] - public static extern IntPtr SetActiveWindow(IntPtr hWnd); + [LibraryImport(Libraries.User32, SetLastError = true)] + public static partial IntPtr SetActiveWindow(IntPtr hWnd); public static IntPtr SetActiveWindow(HandleRef hWnd) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetCapture.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetCapture.cs index 294e4a7b2f4..18a1b640b8f 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetCapture.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetCapture.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern IntPtr SetCapture(IntPtr hWnd); + [LibraryImport(Libraries.User32)] + public static partial IntPtr SetCapture(IntPtr hWnd); public static IntPtr SetCapture(IHandle handle) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetClassLong.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetClassLong.cs index e71539e33e9..48880a0193e 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetClassLong.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetClassLong.cs @@ -9,11 +9,11 @@ internal static partial class Interop internal static partial class User32 { // We only ever call this on 32 bit so IntPtr is correct - [DllImport(Libraries.User32, ExactSpelling = true)] - private static extern IntPtr SetClassLongW(IntPtr hwnd, GCL nIndex, IntPtr dwNewLong); + [LibraryImport(Libraries.User32)] + private static partial IntPtr SetClassLongW(IntPtr hwnd, GCL nIndex, IntPtr dwNewLong); - [DllImport(Libraries.User32, ExactSpelling = true)] - private static extern IntPtr SetClassLongPtrW(IntPtr hwnd, GCL nIndex, IntPtr dwNewLong); + [LibraryImport(Libraries.User32)] + private static partial IntPtr SetClassLongPtrW(IntPtr hwnd, GCL nIndex, IntPtr dwNewLong); public static IntPtr SetClassLong(IntPtr hWnd, GCL nIndex, IntPtr dwNewLong) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetCursor.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetCursor.cs index 73413c77af8..06215714e30 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetCursor.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetCursor.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - private static extern IntPtr SetCursor(IntPtr hCursor); + [LibraryImport(Libraries.User32)] + private static partial IntPtr SetCursor(IntPtr hCursor); public static IntPtr SetCursor(IHandle? hCursor) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetCursorPos.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetCursorPos.cs index 20f2329478c..a0dfa3266bf 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetCursorPos.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetCursorPos.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern BOOL SetCursorPos(int x, int y); + [LibraryImport(Libraries.User32)] + public static partial BOOL SetCursorPos(int x, int y); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetFocus.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetFocus.cs index e016d50c6dd..110018c9d8a 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetFocus.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetFocus.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true, SetLastError = true)] - public static extern IntPtr SetFocus(IntPtr hWnd); + [LibraryImport(Libraries.User32, SetLastError = true)] + public static partial IntPtr SetFocus(IntPtr hWnd); public static IntPtr SetFocus(HandleRef hWnd) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetForegroundWindow.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetForegroundWindow.cs index 25c2eeeab84..d52335ae238 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetForegroundWindow.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetForegroundWindow.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern BOOL SetForegroundWindow(IntPtr hWnd); + [LibraryImport(Libraries.User32)] + public static partial BOOL SetForegroundWindow(IntPtr hWnd); public static BOOL SetForegroundWindow(IHandle hWnd) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetKeyboardState.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetKeyboardState.cs index 9b2d0530430..8dc27ab815c 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetKeyboardState.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetKeyboardState.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public unsafe static extern BOOL SetKeyboardState(byte* lpKeyState); + [LibraryImport(Libraries.User32)] + public unsafe static partial BOOL SetKeyboardState(byte* lpKeyState); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetLayeredWindowAttributes.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetLayeredWindowAttributes.cs index 153880aea79..0eeef28e761 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetLayeredWindowAttributes.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetLayeredWindowAttributes.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true, SetLastError = true)] - public static extern BOOL SetLayeredWindowAttributes(IntPtr hwnd, int crKey, byte bAlpha, LWA dwFlags); + [LibraryImport(Libraries.User32, SetLastError = true)] + public static partial BOOL SetLayeredWindowAttributes(IntPtr hwnd, int crKey, byte bAlpha, LWA dwFlags); public static BOOL SetLayeredWindowAttributes(IHandle hwnd, int crKey, byte bAlpha, LWA dwFlags) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetMenu.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetMenu.cs index c3196fbc6f4..bd08f82c817 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetMenu.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetMenu.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public extern static BOOL SetMenu(IntPtr hWnd, IntPtr hMenu); + [LibraryImport(Libraries.User32)] + public static partial BOOL SetMenu(IntPtr hWnd, IntPtr hMenu); public static BOOL SetMenu(IHandle hWnd, IntPtr hMenu) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetMenuDefaultItem.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetMenuDefaultItem.cs index f6486f658e2..69c82f85482 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetMenuDefaultItem.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetMenuDefaultItem.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern BOOL SetMenuDefaultItem(IntPtr hwnd, int uItem, BOOL fByPos); + [LibraryImport(Libraries.User32)] + public static partial BOOL SetMenuDefaultItem(IntPtr hwnd, int uItem, BOOL fByPos); public static BOOL SetMenuDefaultItem(HandleRef hwnd, int uItem, BOOL fByPos) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetParent.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetParent.cs index a7bcb218984..69f489a9df7 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetParent.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetParent.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true, SetLastError = true)] - public static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndChildNewParent); + [LibraryImport(Libraries.User32, SetLastError = true)] + public static partial IntPtr SetParent(IntPtr hWndChild, IntPtr hWndChildNewParent); public static IntPtr SetParent(IntPtr hWndChild, HandleRef hWndChildNewParent) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetProcessDPIAware.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetProcessDPIAware.cs index 1c754a4ee7d..0560477d7c6 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetProcessDPIAware.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetProcessDPIAware.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern BOOL SetProcessDPIAware(); + [LibraryImport(Libraries.User32)] + public static partial BOOL SetProcessDPIAware(); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetProcessDpiAwarenessContext.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetProcessDpiAwarenessContext.cs index 655133f0546..121358f517e 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetProcessDpiAwarenessContext.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetProcessDpiAwarenessContext.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern BOOL SetProcessDpiAwarenessContext(IntPtr value); + [LibraryImport(Libraries.User32)] + public static partial BOOL SetProcessDpiAwarenessContext(IntPtr value); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetScrollPos.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetScrollPos.cs index 57189476ada..533c83f69aa 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetScrollPos.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetScrollPos.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true, SetLastError = true)] - public static extern int SetScrollPos(IntPtr hWnd, SB nBar, int nPos, BOOL bRedraw); + [LibraryImport(Libraries.User32, SetLastError = true)] + public static partial int SetScrollPos(IntPtr hWnd, SB nBar, int nPos, BOOL bRedraw); public static int SetScrollPos(IHandle hWnd, SB nBar, int nPos, BOOL bRedraw) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetTimer.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetTimer.cs index 70fc6004e30..8809e7dbb23 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetTimer.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetTimer.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern IntPtr SetTimer(IntPtr hWnd, IntPtr nIDEvent, uint uElapse, IntPtr lpTimerFunc); + [LibraryImport(Libraries.User32)] + public static partial IntPtr SetTimer(IntPtr hWnd, IntPtr nIDEvent, uint uElapse, IntPtr lpTimerFunc); public static IntPtr SetTimer(IHandle hWnd, IntPtr nIDEvent, uint uElapse, IntPtr lpTimerFunc) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetWindowLong.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetWindowLong.cs index 759d0c961d0..812b110b511 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetWindowLong.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetWindowLong.cs @@ -9,11 +9,11 @@ internal static partial class Interop internal static partial class User32 { // We only ever call this on 32 bit so IntPtr is correct - [DllImport(Libraries.User32, ExactSpelling = true, SetLastError = true)] - private static extern IntPtr SetWindowLongW(IntPtr hWnd, GWL nIndex, nint dwNewLong); + [LibraryImport(Libraries.User32, SetLastError = true)] + private static partial IntPtr SetWindowLongW(IntPtr hWnd, GWL nIndex, nint dwNewLong); - [DllImport(Libraries.User32, ExactSpelling = true, SetLastError = true)] - public static extern IntPtr SetWindowLongPtrW(IntPtr hWnd, GWL nIndex, nint dwNewLong); + [LibraryImport(Libraries.User32, SetLastError = true)] + public static partial IntPtr SetWindowLongPtrW(IntPtr hWnd, GWL nIndex, nint dwNewLong); public static IntPtr SetWindowLong(IntPtr hWnd, GWL nIndex, nint dwNewLong) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetWindowPos.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetWindowPos.cs index 7d2d9f48d83..7a31fa9cc0e 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetWindowPos.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetWindowPos.cs @@ -14,8 +14,8 @@ internal static partial class User32 public static IntPtr HWND_NOTOPMOST = (IntPtr)(-2); public static IntPtr HWND_MESSAGE = (IntPtr)(-3); - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern BOOL SetWindowPos( + [LibraryImport(Libraries.User32)] + public static partial BOOL SetWindowPos( IntPtr hWnd, IntPtr hWndInsertAfter, int x = 0, diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetWindowRgn.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetWindowRgn.cs index 31a9612ec9e..5b0e28c6bde 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetWindowRgn.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetWindowRgn.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - private static extern int SetWindowRgn(IntPtr hwnd, IntPtr hrgn, BOOL fRedraw); + [LibraryImport(Libraries.User32)] + private static partial int SetWindowRgn(IntPtr hwnd, IntPtr hrgn, BOOL fRedraw); public static int SetWindowRgn(IHandle hwnd, Gdi32.HRGN hrgn, BOOL fRedraw) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetWindowsHookExW.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetWindowsHookExW.cs index b93fe448a8d..4b82c1b338b 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetWindowsHookExW.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.SetWindowsHookExW.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true, SetLastError = true)] - public static extern IntPtr SetWindowsHookExW(WH idHook, HOOKPROC lpfn, IntPtr hmod, uint dwThreadId); + [LibraryImport(Libraries.User32, SetLastError = true)] + public static partial IntPtr SetWindowsHookExW(WH idHook, HOOKPROC lpfn, IntPtr hmod, uint dwThreadId); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.ShowCaret.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.ShowCaret.cs index 64e13194b4a..3c0fb502d7a 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.ShowCaret.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.ShowCaret.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern BOOL ShowCaret(IntPtr hWnd); + [LibraryImport(Libraries.User32)] + public static partial BOOL ShowCaret(IntPtr hWnd); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.ShowCursor.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.ShowCursor.cs index f721d310204..3e1980c8465 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.ShowCursor.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.ShowCursor.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public extern static int ShowCursor(BOOL bShow); + [LibraryImport(Libraries.User32)] + public static partial int ShowCursor(BOOL bShow); } } diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.ShowWindow.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.ShowWindow.cs index d013671dd0f..20b2fe02137 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.ShowWindow.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.ShowWindow.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern BOOL ShowWindow(IntPtr hWnd, SW nCmdShow); + [LibraryImport(Libraries.User32)] + public static partial BOOL ShowWindow(IntPtr hWnd, SW nCmdShow); public static BOOL ShowWindow(IHandle hWnd, SW nCmdShow) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.UnhookWindowsHookEx.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.UnhookWindowsHookEx.cs index ecf38a2683e..90ee03dfb16 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.UnhookWindowsHookEx.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.UnhookWindowsHookEx.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true, SetLastError = true)] - public static extern BOOL UnhookWindowsHookEx(IntPtr hhk); + [LibraryImport(Libraries.User32, SetLastError = true)] + public static partial BOOL UnhookWindowsHookEx(IntPtr hhk); public static BOOL UnhookWindowsHookEx(HandleRef hhk) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.UpdateWindow.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.UpdateWindow.cs index ca4bf820aa8..cb0825a181b 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.UpdateWindow.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.UpdateWindow.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern BOOL UpdateWindow(IntPtr hWnd); + [LibraryImport(Libraries.User32)] + public static partial BOOL UpdateWindow(IntPtr hWnd); public static BOOL UpdateWindow(IHandle hWnd) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.ValidateRect.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.ValidateRect.cs index a84a559d352..4aaf3677e42 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.ValidateRect.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.ValidateRect.cs @@ -8,8 +8,8 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public unsafe static extern BOOL ValidateRect(IntPtr hWnd, RECT* lpRect); + [LibraryImport(Libraries.User32)] + public unsafe static partial BOOL ValidateRect(IntPtr hWnd, RECT* lpRect); public unsafe static BOOL ValidateRect(IHandle hWnd, RECT* lpRect) { diff --git a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.WaitMessage.cs b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.WaitMessage.cs index 462e1d3b69e..1d9863939a1 100644 --- a/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.WaitMessage.cs +++ b/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.WaitMessage.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class User32 { - [DllImport(Libraries.User32, ExactSpelling = true)] - public static extern BOOL WaitMessage(); + [LibraryImport(Libraries.User32)] + public static partial BOOL WaitMessage(); } }