NtImpersonateClientOfPort - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
#ifndef _NTLPCAPI_H

/**
 * The NtImpersonateClientOfPort routine impersonates the client that sent a message.
 *
 * \param PortHandle Handle to the communication port.
 * \param Message Pointer to the message from the client to impersonate.
 * \return NTSTATUS Successful or errant status.
 */
NTSYSCALLAPI
NTSTATUS
NTAPI
NtImpersonateClientOfPort(
    _In_ HANDLE PortHandle,
    _In_ PPORT_MESSAGE Message
    );

#endif

View code on GitHub
#ifndef _NTZWAPI_H

NTSYSCALLAPI
NTSTATUS
NTAPI
ZwImpersonateClientOfPort(
    _In_ HANDLE PortHandle,
    _In_ PPORT_MESSAGE Message
    );

#endif

View code on GitHub

NtDoc

No description available.

NTinternals.net (undocumented.ntinternals.net)

NtImpersonateClientOfPort is called by LPC server process to get security context of client. That means: client's Token Object is associated with calling server thread (like NtSetInformationThread with ThreadImpersonationToken information class).

PortHandle

HANDLE to Port Object opened with NtAcceptConnectPort call.

Request

Pointer to LPC_MESSAGE structure contains reason of impersonation.

Documented by

See also