PssDuplicateSnapshot function

Duplicates a snapshot handle from one process to another.

Syntax

DWORD PssDuplicateSnapshot(
  HANDLE              SourceProcessHandle,
  HPSS                SnapshotHandle,
  HANDLE              TargetProcessHandle,
  HPSS                *TargetSnapshotHandle,
  PSS_DUPLICATE_FLAGS Flags
);

Parameters

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.

SnapshotHandle

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

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.

TargetSnapshotHandle

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

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

   
Windows version Windows 8.1 [desktop apps only] Windows Server 2012 R2 [desktop apps only]
Target Platform Windows
Header processsnapshot.h
DLL Kernel32.dll

See Also

Process Snapshotting