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

Fix broken defines #576

Merged
merged 2 commits into from
Apr 14, 2021
Merged

Fix broken defines #576

merged 2 commits into from
Apr 14, 2021

Conversation

yyjdelete
Copy link
Contributor

No description provided.

@@ -3237,8 +3237,10 @@ public static partial class Kernel32
/// 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
/// pseudo-handle, the function has no effect.
/// </remarks>
[DllImport(nameof(Kernel32))]
public static extern SafeObjectHandle GetCurrentProcessToken();
public static SafeObjectHandle GetCurrentProcessToken()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 3 apis is not exported in Kernel32.dll, and the original define in processthreadsapi.h looks like

#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8)

FORCEINLINE
HANDLE
GetCurrentProcessToken (
    VOID
    )
{
    return (HANDLE)(LONG_PTR) -4;
}

FORCEINLINE
HANDLE
GetCurrentThreadToken (
    VOID
    )
{
    return (HANDLE)(LONG_PTR) -5;
}

FORCEINLINE
HANDLE
GetCurrentThreadEffectiveToken (
    VOID
    )
{
    return (HANDLE)(LONG_PTR) -6;
}

#endif // (_WIN32_WINNT >= _WIN32_WINNT_WIN8)

Copy link
Collaborator

@AArnott AArnott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. This all looks great.

@AArnott AArnott added the auto-merge Auto-completes a PR when reviews and checks pass label Apr 14, 2021
@AArnott AArnott merged commit bc93e82 into dotnet:master Apr 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-merge Auto-completes a PR when reviews and checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants