Platform SDK: Logon Authentication

ImportSecurityContext

The ImportSecurityContext function imports a security context exported into the current process by ExportSecurityContext.

SECURITY_STATUS SEC_Entry ImportSecurityContext(
  PSECURITY_STRING *pszPackage, 
  PSecBuffer pPackedContext, 
  void SEC_FAR *pToken, 
  PCtxtHandle phContext 
);

Parameters

pszPackage
[in] String containing the name of the security package where the credential was exported.
pPackedContext
[in] Pointer to a buffer that contains the serialized security context created by ExportSecurityContext. This context must be freed by the application with FreeContextBuffer.
pToken
[in, optional] Optional pointer to a handle of the context's token.
phContext
[out] Handle of the new security context created from pPackedContext.

Return Values

If the function succeeds, the return value is SEC_E_OK.

If the function fails, the return value can be one of the following error codes.

Value Meaning
SEC_E_UNKNOWN_CREDENTIALS The credentials supplied to the package were not recognized.
SEC_E_NO_CREDENTIALS No credentials are available in the security package.
SEC_E_NOT_OWNER The caller of the function does not have the necessary credentials.
SEC_E_INSUFFICIENT_MEMORY Not enough memory is available to complete the request.
SEC_E_INTERNAL_ERROR The Local Security Authority (LSA) cannot be contacted.

Remarks

The prototype for this function can be found in sspi.h.

Requirements

  Windows NT/2000: Requires Windows NT 3.51 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Sspi.h; include Security.h.
  Library: Use Secur32.lib.
  Unicode: Implemented as Unicode and ANSI versions on Windows NT/2000.

See Also

ExportSecurityContext, FreeContextBuffer