Export (0) Print
Expand All
Expand Minimize

ExportSecurityContext function

The ExportSecurityContext function creates a serialized representation of a security context that can later be imported into a different process by calling ImportSecurityContext. The process that imports the security context must be running on the same computer as the process that called ExportSecurityContext.

Syntax


SECURITY_STATUS SEC_Entry ExportSecurityContext(
  _In_       PCtxtHandle phContext,
  _In_       Ulong fFlags,
  _Out_      PSecBuffer pPackedContext,
  _Out_opt_  HANDLE *pToken
);

Parameters

phContext [in]

A handle of the security context to be exported.

fFlags [in]

This parameter can be a bitwise-OR combination of the following values.

ValueMeaning
SECPKG_CONTEXT_EXPORT_RESET_NEW
1 (0x1)

The new security context is reset to its initial state.

SECPKG_CONTEXT_EXPORT_DELETE_OLD
2 (0x2)

The old security context is deleted.

SECPKG_CONTEXT_EXPORT_TO_KERNEL
4 (0x4)

This value is not supported.

Windows Server 2003 and Windows XP/2000:  The security context is to be exported to the kernel.

This value is supported only in Schannel kernel mode.

 

pPackedContext [out]

A pointer to a buffer of type SECBUFFER_EMPTY that receives the serialized security context. When you have finished using this context, free it by calling the FreeContextBuffer function.

pToken [out, optional]

A pointer to receive the handle of the context's token.

When you have finished using the user token, release the handle by calling the CloseHandle 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_INSUFFICIENT_MEMORY

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

SEC_E_INVALID_HANDLE

The phContext parameter does not point to a valid handle.

SEC_E_NOT_SUPPORTED

Schannel kernel mode does not support this function.

 

Requirements

Minimum supported client

Windows XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

Header

Sspi.h (include Security.h)

Library

Secur32.lib

DLL

Secur32.dll

See also

SSPI Functions
FreeContextBuffer
ImportSecurityContext

 

 

Community Additions

ADD
Show:
© 2014 Microsoft