CopyContext function (winbase.h)

Copies a source context structure (including any XState) onto an initialized destination context structure.

Syntax

BOOL CopyContext(
  [in, out] PCONTEXT Destination,
  [in]      DWORD    ContextFlags,
  [in]      PCONTEXT Source
);

Parameters

[in, out] Destination

A pointer to a CONTEXT structure that receives the context copied from the Source. The CONTEXT structure should be initialized by calling InitializeContext before calling this function.

[in] ContextFlags

Flags specifying the pieces of the Source CONTEXT structure that will be copied into the destination. This must be a subset of the ContextFlags specified when calling InitializeContext on the Destination CONTEXT.

[in] Source

A pointer to a CONTEXT structure from which to copy processor context data.

Return value

This function returns TRUE if the context was copied successfully, otherwise FALSE. To get extended error information, call GetLastError.

Remarks

The function copies data from the Source CONTEXT over the corresponding data in the Destination CONTEXT, including extended context if any is present. The Destination CONTEXT must have been initialized with InitializeContext to ensure proper alignment and initialization. If any data is present in the Destination CONTEXT and the corresponding flag is not set in the Source CONTEXT or in the ContextFlags parameter, the data remains valid in the Destination.

Windows 7 with SP1 and Windows Server 2008 R2 with SP1:  The AVX API is first implemented on Windows 7 with SP1 and Windows Server 2008 R2 with SP1 . Since there is no SDK for SP1, that means there are no available headers and library files to work with. In this situation, a caller must declare the needed functions from this documentation and get pointers to them using GetModuleHandle on "Kernel32.dll", followed by calls to GetProcAddress. See Working with XState Context for details.

Requirements

Requirement Value
Minimum supported client Windows 7 with SP1 [desktop apps only]
Minimum supported server Windows Server 2008 R2 with SP1 [desktop apps only]
Target Platform Windows
Header winbase.h (include Windows.h)
Library Kernel32.lib
DLL Kernel32.dll

See also

CONTEXT

InitializeContext

Intel AVX

Working with XState Context