PssFreeSnapshot function (processsnapshot.h)

Frees a snapshot.

Syntax

DWORD PssFreeSnapshot(
  [in] HANDLE ProcessHandle,
  [in] HPSS   SnapshotHandle
);

Parameters

[in] ProcessHandle

A handle to the process that contains the snapshot. The handle must have PROCESS_VM_READ, PROCESS_VM_OPERATION, and PROCESS_DUP_HANDLE rights. If the snapshot was captured from the current process, or duplicated into the current process, then pass in the result of GetCurrentProcess.

[in] SnapshotHandle

A handle to the snapshot to free.

Return value

This function returns ERROR_SUCCESS on success or one of the following error codes.

Return code Description
ERROR_INVALID_HANDLE
The specified handle is invalid.
ERROR_NOT_SUPPORTED
The remote snapshot was not created with PSS_CREATE_USE_VM_ALLOCATIONS.
 

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.

Remarks

This API can free snapshot handles in the context of either the local or remote processes. If the snapshot was captured in the local process with PssCaptureSnapshot, or duplicated into the local process with PssDuplicateSnapshot, then specify the result of GetCurrentProcess as the process handle. If the snapshot is in the context of a remote process (for example, duplicated into the remote process), then specify the handle to that process.

The operation does not protect against concurrent access to the same descriptor.

For remote process frees, only snapshot handles that were created with PSS_CREATE_USE_VM_ALLOCATIONS or duplicated remotely can be freed by this API.

The behavior of this routine on a descriptor that has already been freed is undefined.

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