Handles
Cheat sheet · https://pcornel.dk/topic.php?topic=3009
Answer
A handle is a value a process uses to refer to an object managed by Windows, such as a file, registry key, event, mutex, process, thread, token or section. The handle is meaningful in the context of the process handle table and carries granted access rights.
Remember
- A handle value is process-relative; the same numeric value in another process can refer to a different object.
- Open handles keep references to objects until they are closed/released.
- Handles have access rights, so having a handle does not imply unrestricted access.
- Some handles can be inherited by child processes when both creation and inheritance settings allow it.
- A steadily increasing handle count can indicate a leak, but the object types and workload must be checked.
First checks
Get-Process | Sort CPU -Desc | Select -First 10 Name,Id,CPU,WS— top processesGet-CimInstance Win32_Process -Filter "ProcessId=<pid>" | Select Name,ParentProcessId,CommandLine— command line and parenttasklist /v— processes with user and statustaskkill /PID <pid> /T— stop a process tree
Verify in this order
process opens objects (files, keys, events) → handles in its table → closed when done
Where it usually breaks
First mismatch in definition/configuration → security context → service/task/process creation → runtime state → output/side effect → event/performance evidence; preserve identity/native error/pre-state before mutation.
Processes → Handles reference map
| Item | Meaning | Evidence boundary |
|---|---|---|
| Handle value | Process-local reference | interpret only with owning PID |
| Object type | File/process/thread/event/etc. | narrows what resource is referenced |
| Object name | Named path/object when exposed | links runtime reference to resource |
| Granted access | Rights on the handle | what operations this reference allows |
| Handle count | Aggregate process metric | trend/object mix needed before calling it a leak |
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=3009