NTSTATUS NtImpersonateClientOfPort( __in HANDLE PortHandle, __in PPORT_MESSAGE Message ); Routine Description: This procedure is used by the server thread to temporarily acquire the identifier set of a client thread. This service establishes an impersonation token for the calling thread. The impersonation token corresponds to the context provided by the port client. The client must currently be waiting for a reply to the specified message. This service returns an error status code if the client thread is not waiting for a reply to the message. The security quality of service parameters specified by the client upon connection dictate what use the server will have of the client's security context. For complicated or extended impersonation needs, the server may open a copy of the client's token (using NtOpenThreadToken()). This must be done while impersonating the client. Arguments: PortHandle - Specifies the handle of the communication port that the message was received from. Message - Specifies an address of a message that was received from the client that is to be impersonated. The ClientId field of the message identifies the client thread that is to be impersonated. The client thread must be waiting for a reply to the message in order to impersonate the client. Return Value: NTSTATUS - Status code that indicates whether or not the operation was successful.