Skip to content

Commit d471a03

Browse files
authored
Use GeneratedDllImport in Microsoft.Win32.SystemEvents (#61609)
1 parent 3b71d3b commit d471a03

27 files changed

+56
-54
lines changed

src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetCurrentThreadId.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ internal static partial class Interop
88
{
99
internal static partial class Kernel32
1010
{
11-
[DllImport(Libraries.Kernel32, ExactSpelling = true)]
11+
[GeneratedDllImport(Libraries.Kernel32, ExactSpelling = true)]
1212
[SuppressGCTransition]
13-
public static extern int GetCurrentThreadId();
13+
public static partial int GetCurrentThreadId();
1414
}
1515
}

src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetModuleHandle.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ internal static partial class Interop
88
{
99
internal static partial class Kernel32
1010
{
11-
[DllImport(Libraries.Kernel32, EntryPoint = "GetModuleHandleW", CharSet = CharSet.Unicode, SetLastError = true)]
12-
internal static extern IntPtr GetModuleHandle(string? moduleName);
11+
[GeneratedDllImport(Libraries.Kernel32, EntryPoint = "GetModuleHandleW", CharSet = CharSet.Unicode, SetLastError = true)]
12+
internal static partial IntPtr GetModuleHandle(string? moduleName);
1313
}
1414
}

src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetProcAddress.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ internal static partial class Interop
1010
{
1111
internal static partial class Kernel32
1212
{
13-
[DllImport(Libraries.Kernel32, CharSet = CharSet.Ansi, BestFitMapping = false)]
14-
public static extern IntPtr GetProcAddress(SafeLibraryHandle hModule, string lpProcName);
13+
[GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Ansi)]
14+
public static partial IntPtr GetProcAddress(SafeLibraryHandle hModule, string lpProcName);
1515

16-
[DllImport(Libraries.Kernel32, CharSet = CharSet.Ansi, BestFitMapping = false)]
17-
public static extern IntPtr GetProcAddress(IntPtr hModule, string lpProcName);
16+
[GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Ansi)]
17+
public static partial IntPtr GetProcAddress(IntPtr hModule, string lpProcName);
1818
}
1919
}

src/libraries/Common/src/Interop/Windows/Kernel32/Interop.SetConsoleCtrlHandler.Delegate.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ internal static partial class Kernel32
1111
{
1212
internal delegate bool ConsoleCtrlHandlerRoutine(int controlType);
1313

14-
[DllImport(Libraries.Kernel32, SetLastError = true)]
15-
internal static extern bool SetConsoleCtrlHandler(ConsoleCtrlHandlerRoutine handler, bool addOrRemove);
14+
[GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
15+
internal static partial bool SetConsoleCtrlHandler(ConsoleCtrlHandlerRoutine handler, bool addOrRemove);
1616
}
1717
}

src/libraries/Common/src/Interop/Windows/User32/Interop.CreateWindowEx.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ internal static partial class Interop
88
{
99
internal static partial class User32
1010
{
11-
[DllImport(Libraries.User32, CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
12-
public static extern IntPtr CreateWindowExW(
11+
[GeneratedDllImport(Libraries.User32, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
12+
public static partial IntPtr CreateWindowExW(
1313
int exStyle,
1414
string lpszClassName,
1515
string lpszWindowName,

src/libraries/Common/src/Interop/Windows/User32/Interop.DefWindowProc.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ internal static partial class Interop
88
{
99
internal static partial class User32
1010
{
11-
[DllImport(Libraries.User32, CharSet = CharSet.Unicode, ExactSpelling = true)]
12-
public static extern IntPtr DefWindowProcW(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);
11+
[GeneratedDllImport(Libraries.User32, CharSet = CharSet.Unicode, ExactSpelling = true)]
12+
public static partial IntPtr DefWindowProcW(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);
1313
}
1414
}

src/libraries/Common/src/Interop/Windows/User32/Interop.DestroyWindow.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ internal static partial class Interop
88
{
99
internal static partial class User32
1010
{
11-
[DllImport(Libraries.User32, ExactSpelling = true)]
12-
public static extern bool DestroyWindow(IntPtr hWnd);
11+
[GeneratedDllImport(Libraries.User32, ExactSpelling = true)]
12+
public static partial bool DestroyWindow(IntPtr hWnd);
1313
}
1414
}

src/libraries/Common/src/Interop/Windows/User32/Interop.DispatchMessage.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ internal static partial class Interop
88
{
99
internal static partial class User32
1010
{
11-
[DllImport(Libraries.User32, CharSet = CharSet.Unicode, ExactSpelling = true)]
12-
public static extern int DispatchMessageW([In] ref MSG msg);
11+
[GeneratedDllImport(Libraries.User32, CharSet = CharSet.Unicode, ExactSpelling = true)]
12+
public static partial int DispatchMessageW(ref MSG msg);
1313
}
1414
}

src/libraries/Common/src/Interop/Windows/User32/Interop.FindWindow.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ internal static partial class Interop
88
{
99
internal static partial class User32
1010
{
11-
[DllImport(Libraries.User32, CharSet=CharSet.Auto, ExactSpelling = true)]
12-
public static extern IntPtr FindWindowW(string lpClassName, string lpWindowName);
11+
[GeneratedDllImport(Libraries.User32, CharSet = CharSet.Unicode, ExactSpelling = true)]
12+
public static partial IntPtr FindWindowW(string lpClassName, string lpWindowName);
1313
}
1414
}

src/libraries/Common/src/Interop/Windows/User32/Interop.GetClassInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ internal static partial class Interop
88
{
99
internal static partial class User32
1010
{
11-
[DllImport(Libraries.User32, CharSet = CharSet.Unicode, ExactSpelling = true)]
12-
public static extern bool GetClassInfoW(IntPtr hInst, string lpszClass, ref WNDCLASS wc);
11+
[GeneratedDllImport(Libraries.User32, CharSet = CharSet.Unicode, ExactSpelling = true)]
12+
public static partial bool GetClassInfoW(IntPtr hInst, string lpszClass, ref WNDCLASS wc);
1313
}
1414
}

0 commit comments

Comments
 (0)