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

Fix broken defines - #576

Merged
AArnott merged 2 commits into
dotnet:masterfrom
yyjdelete:patch-1
Apr 14, 2021
Merged

AArnott merged 2 commits into
dotnet:masterfrom
yyjdelete:patch-1

Conversation

@yyjdelete

Copy link
Copy Markdown
Contributor

No description provided.

/// </remarks>
[DllImport(nameof(Kernel32))]
public static extern SafeObjectHandle GetCurrentProcessToken();
public static SafeObjectHandle GetCurrentProcessToken()

Copy link
Copy Markdown
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)

@AArnott AArnott left a comment

Copy link
Copy Markdown
Collaborator

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