This topic has not yet been rated - Rate this topic

ImportSecurityContext function

Applies to: desktop apps only

The ImportSecurityContext function imports a security context. The security context must have been exported to the process calling ImportSecurityContext by a previous call to ExportSecurityContext.

Syntax

SECURITY_STATUS SEC_Entry ImportSecurityContext(
  __in      PSECURITY_STRING *pszPackage,
  __in      PSecBuffer pPackedContext,
  __in_opt  HANDLE pToken,
  __out     PCtxtHandle phContext
);

Parameters

pszPackage [in]

A string that contains the name of the security package to which the security context was exported.

pPackedContext [in]

A pointer to a buffer that contains the serialized security context created by ExportSecurityContext.

pToken [in, optional]

A handle to the context's token.

phContext [out]

A handle of the new security context created from pPackedContext. When you have finished using the context, delete it by calling the DeleteSecurityContext function.

Return value

If the function succeeds, the function returns SEC_E_OK.

If the function fails, it returns one of the following error codes.

Return codeDescription
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

There is not enough memory available to complete the requested action.

SEC_E_INTERNAL_ERROR

An error occurred that did not map to an SSPI error code.

 

Requirements

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Sspi.h (include Security.h)

Library

Secur32.lib

DLL

Secur32.dll

Unicode and ANSI names

ImportSecurityContextW (Unicode) and ImportSecurityContextA (ANSI)

See also

SSPI Functions
ExportSecurityContext
FreeContextBuffer

 

 

Send comments about this topic to Microsoft

Build date: 3/13/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ