Skip to content
This repository was archived by the owner on Jul 26, 2023. It is now read-only.

Commit bc93e82

Browse files
authored
Merge pull request #576 from yyjdelete/patch-1
Fix broken defines
2 parents aa31123 + d76b686 commit bc93e82

File tree

4 files changed

+18
-12
lines changed

4 files changed

+18
-12
lines changed

src/Kernel32/PublicAPI.Unshipped.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -272,13 +272,13 @@ static extern PInvoke.Kernel32.CreateThread(PInvoke.Kernel32.SECURITY_ATTRIBUTES
272272
static extern PInvoke.Kernel32.DosDateTimeToFileTime(ushort wFatDate, ushort wFatTime, PInvoke.Kernel32.FILETIME* lpFileTime) -> bool
273273
static extern PInvoke.Kernel32.FlushInstructionCache(PInvoke.Kernel32.SafeObjectHandle hProcess, void* lpcBaseAddress, System.UIntPtr dwSize) -> bool
274274
static extern PInvoke.Kernel32.FlushProcessWriteBuffers() -> void
275-
static extern PInvoke.Kernel32.GetCurrentProcessToken() -> PInvoke.Kernel32.SafeObjectHandle
275+
static PInvoke.Kernel32.GetCurrentProcessToken() -> PInvoke.Kernel32.SafeObjectHandle
276276
static extern PInvoke.Kernel32.GetCurrentProcessorNumber() -> uint
277277
static extern PInvoke.Kernel32.GetCurrentProcessorNumberEx(PInvoke.Kernel32.PROCESSOR_NUMBER* ProcNumber) -> void
278278
static extern PInvoke.Kernel32.GetCurrentThread() -> PInvoke.Kernel32.SafeObjectHandle
279-
static extern PInvoke.Kernel32.GetCurrentThreadEffectiveToken() -> PInvoke.Kernel32.SafeObjectHandle
279+
static PInvoke.Kernel32.GetCurrentThreadEffectiveToken() -> PInvoke.Kernel32.SafeObjectHandle
280280
static extern PInvoke.Kernel32.GetCurrentThreadStackLimits(out System.UIntPtr LowLimit, out System.UIntPtr HighLimit) -> void
281-
static extern PInvoke.Kernel32.GetCurrentThreadToken() -> PInvoke.Kernel32.SafeObjectHandle
281+
static PInvoke.Kernel32.GetCurrentThreadToken() -> PInvoke.Kernel32.SafeObjectHandle
282282
static extern PInvoke.Kernel32.GetNativeSystemInfo(PInvoke.Kernel32.SYSTEM_INFO* lpSystemInfo) -> void
283283
static extern PInvoke.Kernel32.GetPriorityClass(PInvoke.Kernel32.SafeObjectHandle hProcess) -> PInvoke.Kernel32.ProcessPriorityClass
284284
static extern PInvoke.Kernel32.GetProcessHandleCount(PInvoke.Kernel32.SafeObjectHandle hProcess, out uint pdwHandleCount) -> bool
@@ -293,4 +293,4 @@ static extern PInvoke.Kernel32.SetFilePointerEx(PInvoke.Kernel32.SafeObjectHandl
293293
static extern PInvoke.Kernel32.SetProcessInformation(PInvoke.Kernel32.SafeObjectHandle hProcess, PInvoke.Kernel32.PROCESS_INFORMATION_CLASS ProcessInformationClass, void* ProcessInformation, uint ProcessInformationSize) -> bool
294294
static readonly PInvoke.Kernel32.PROCESS_MEMORY_EXHAUSTION_INFO.PME_FAILFAST_ON_COMMIT_FAIL_DISABLE -> System.UIntPtr
295295
static readonly PInvoke.Kernel32.PROCESS_MEMORY_EXHAUSTION_INFO.PME_FAILFAST_ON_COMMIT_FAIL_ENABLE -> System.UIntPtr
296-
static readonly PInvoke.Kernel32.SafePseudoConsoleHandle.Invalid -> PInvoke.Kernel32.SafePseudoConsoleHandle
296+
static readonly PInvoke.Kernel32.SafePseudoConsoleHandle.Invalid -> PInvoke.Kernel32.SafePseudoConsoleHandle

src/Kernel32/storebanned/Kernel32.cs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3237,8 +3237,10 @@ public static unsafe extern bool DosDateTimeToFileTime(
32373237
/// You do not need to close the pseudo-handle when you no longer need it.If you call the <see cref="CloseHandle(IntPtr)"/> function with a
32383238
/// pseudo-handle, the function has no effect.
32393239
/// </remarks>
3240-
[DllImport(nameof(Kernel32))]
3241-
public static extern SafeObjectHandle GetCurrentProcessToken();
3240+
public static SafeObjectHandle GetCurrentProcessToken()
3241+
{
3242+
return new SafeObjectHandle(new IntPtr(-4), false);
3243+
}
32423244

32433245
/// <summary>
32443246
/// Retrieves a pseudo-handle that you can use as a shorthand way to refer to the token that is currently in effect for the thread,
@@ -3258,8 +3260,10 @@ public static unsafe extern bool DosDateTimeToFileTime(
32583260
/// You do not need to close the pseudo-handle when you no longer need it.If you call the <see cref="CloseHandle(IntPtr)"/> function with a
32593261
/// pseudo-handle, the function has no effect.
32603262
/// </remarks>
3261-
[DllImport(nameof(Kernel32))]
3262-
public static extern SafeObjectHandle GetCurrentThreadEffectiveToken();
3263+
public static SafeObjectHandle GetCurrentThreadEffectiveToken()
3264+
{
3265+
return new SafeObjectHandle(new IntPtr(-6), false);
3266+
}
32633267

32643268
/// <summary>
32653269
/// Retrieves a pseudo-handle that you can use as a shorthand way to refer to the impersonation token that was assigned to the current thread.
@@ -3277,8 +3281,10 @@ public static unsafe extern bool DosDateTimeToFileTime(
32773281
/// You do not need to close the pseudo-handle when you no longer need it.If you call the CloseHandle function with a pseudo-handle, the function
32783282
/// has no effect.
32793283
/// </remarks>
3280-
[DllImport(nameof(Kernel32))]
3281-
public static extern SafeObjectHandle GetCurrentThreadToken();
3284+
public static SafeObjectHandle GetCurrentThreadToken()
3285+
{
3286+
return new SafeObjectHandle(new IntPtr(-5), false);
3287+
}
32823288

32833289
/// <summary>
32843290
/// Retrieves the number of open handles that belong to the specified process.

src/User32/User32.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1321,7 +1321,7 @@ public static extern unsafe bool GetMenuInfo(
13211321
/// <param name="hMenu">A handle to the menu that contains the item whose identifier is to be retrieved.</param>
13221322
/// <param name="nPos">The zero-based relative position of the menu item whose identifier is to be retrieved.</param>
13231323
/// <returns>The return value is the identifier of the specified menu item. If the menu item identifier is NULL or if the specified item opens a submenu, the return value is -1.</returns>
1324-
[DllImport(nameof(User32))]
1324+
[DllImport(nameof(User32), EntryPoint = "GetMenuItemID")]
13251325
public static extern uint GetMenuItemId(IntPtr hMenu, int nPos);
13261326

13271327
#pragma warning disable SA1629 // Documentation text should end with a period

src/UxTheme/UxTheme.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public static extern SafeThemeHandle OpenThemeData(
5555
/// UxTheme API's seamlessly</item>
5656
/// </list>
5757
/// </remarks>
58-
[DllImport(nameof(User32), CharSet = CharSet.Unicode)]
58+
[DllImport(nameof(UxTheme), CharSet = CharSet.Unicode)]
5959
public static extern SafeThemeHandle OpenThemeDataForDpi(
6060
IntPtr hwnd,
6161
[MarshalAs(UnmanagedType.LPWStr)] string pszClassIdList,

0 commit comments

Comments
 (0)