QuerySecurityContextToken function (sspi.h)

Obtains the access token for a client security context and uses it directly.

Syntax

KSECDDDECLSPEC SECURITY_STATUS SEC_ENTRY QuerySecurityContextToken(
  [in]  PCtxtHandle phContext,
  [out] void        **Token
);

Parameters

[in] phContext

Handle of the context to query.

[out] Token

Returned handle to the access token.

Return value

If the function succeeds, the function returns SEC_E_OK.

If the function fails, it returns a nonzero error code. One possible error code return is SEC_E_INVALID_HANDLE.

Remarks

This function is called by a server application to control impersonation outside the SSPI layer, such as when launching a child process. The handle returned must be closed with CloseHandle when the handle is no longer needed.

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header sspi.h (include Security.h)
Library Secur32.lib
DLL Secur32.dll

See also

CloseHandle

SSPI Functions