PssFreeSnapshot function

Frees a snapshot.


DWORD PssFreeSnapshot(
  HANDLE ProcessHandle,
  HPSS   SnapshotHandle



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.


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
The specified handle is invalid.
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.


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.


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