API
BaseSnapshot
Bases: abc.ABC
Base class for all *Snapshot
classes.
Source code in tlhelp32/_base.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
|
close()
Close the underlying snapshot handle and free up resources.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
Whether the underlying handle was closed successfully. |
Source code in tlhelp32/_base.py
97 98 99 100 101 102 103 104 105 |
|
Snapshot
Bases: BaseSnapshot
All-in-one snapshot.
Source code in tlhelp32/snapshot.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
|
__init__(pid=0, include_32bit=False)
Create a snapshot containing the heaps, modules, processes and threads.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pid |
int
|
The PID of the process whose modules and heaps are to be enumerated. Defaults to 0. If it is 0, then the enumeration takes place for the current / calling process. |
0
|
include_32bit |
bool
|
Passed to |
False
|
Raises:
Type | Description |
---|---|
CreationFailedError
|
If the call fails internally. |
Source code in tlhelp32/snapshot.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
|
heaps()
property
Iterator for the heaps present in the snapshot.
Source code in tlhelp32/snapshot.py
51 52 53 54 |
|
modules()
property
Iterator for the modules present in the snapshot.
Source code in tlhelp32/snapshot.py
56 57 58 59 |
|
processes()
property
Iterator for the processes present in the snapshot.
Source code in tlhelp32/snapshot.py
61 62 63 64 |
|
threads()
property
Iterator for the threads present in the snapshot.
Source code in tlhelp32/snapshot.py
66 67 68 69 |
|
HeapListSnapshot
Bases: BaseSnapshot
Enumerates the heaps used by a particular process.
Enumerating (a.k.a. walking) the heap is an expensive operation, look for
ways to avoid redoing it or use the Win32 HeapWalk
function instead for
a much better performance.
Source code in tlhelp32/heap.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
|
__init__(pid=0)
Create a module snapshot.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pid |
int
|
The PID of the process whose modules are to be enumerated. Defaults to 0. If it is 0, then the modules for the current/calling process are enumerated. |
0
|
Raises:
Type | Description |
---|---|
CreationFailedError
|
If the call fails internally. |
Source code in tlhelp32/heap.py
127 128 129 130 131 132 133 134 135 136 137 138 139 |
|
ModuleSnapshot
Bases: BaseSnapshot
Enumerates the modules belonging to a particular process.
Source code in tlhelp32/module.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
|
__init__(pid=0, include_32bit=False)
Create a module snapshot.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pid |
int
|
The PID of the process whose modules are to be enumerated. Defaults to 0. If it is 0, then the modules for the current/calling process are enumerated. |
0
|
include_32bit |
bool
|
Enumerate 32-bit modules also. Valid only for 64-bit processes, else this parameter is ignored. Defaults to False. |
False
|
Raises:
Type | Description |
---|---|
CreationFailedError
|
If the call fails internally. |
Source code in tlhelp32/module.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
|
ProcessSnapshot
Bases: BaseSnapshot
Enumerates all the processes residing in the system address space.
Source code in tlhelp32/process.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
|
__init__()
Create a process snapshot.
Raises:
Type | Description |
---|---|
CreationFailedError
|
If the call fails internally. |
Source code in tlhelp32/process.py
42 43 44 45 46 47 48 49 |
|
ThreadSnapshot
Bases: BaseSnapshot
Enumerates all the threads executing on the system.
Source code in tlhelp32/thread.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
|
__init__()
Create a thread snapshot.
Raises:
Type | Description |
---|---|
CreationFailedError
|
If the call fails internally. |
Source code in tlhelp32/thread.py
42 43 44 45 46 47 48 49 |
|