PssDuplicateSnapshot function (processsnapshot.h)

Duplicates a snapshot handle from one process to another.

Syntax

DWORD PssDuplicateSnapshot(
  [in]           HANDLE              SourceProcessHandle,
  [in]           HPSS                SnapshotHandle,
  [in]           HANDLE              TargetProcessHandle,
  [out]          HPSS                *TargetSnapshotHandle,
  [in, optional] PSS_DUPLICATE_FLAGS Flags
);

Parameters

[in] SourceProcessHandle

A handle to the source process from which the original snapshot was captured. The handle must have PROCESS_VM_READ and PROCESS_DUP_HANDLE rights.

[in] SnapshotHandle

A handle to the snapshot to duplicate. This handle must be in the context of the source process.

[in] TargetProcessHandle

A handle to the target process that receives the duplicate snapshot. The handle must have PROCESS_VM_OPERATION, PROCESS_VM_WRITE, and PROCESS_DUP_HANDLE rights.

[out] TargetSnapshotHandle

A handle to the duplicate snapshot that this function creates, in the context of the target process.

[in, optional] Flags

The duplication flags. For more information, see PSS_DUPLICATE_FLAGS.

Return value

This function returns ERROR_SUCCESS on success or the following error code.

Return code Description
ERROR_INVALID_HANDLE
The specified handle is invalid.
 

All error codes are defined in winerror.h. Use FormatMessage with the FORMAT_MESSAGE_FROM_SYSTEM flag to get a message for an error code.

Requirements

Requirement Value
Minimum supported client Windows 8.1 [desktop apps only]
Minimum supported server Windows Server 2012 R2 [desktop apps only]
Target Platform Windows
Header processsnapshot.h
DLL Kernel32.dll

See also

Process Snapshotting