1 | ' api_tlhelp32.sbp
|
---|
2 |
|
---|
3 | #ifndef _INC_TOOLHELP32
|
---|
4 | #define _INC_TOOLHELP32
|
---|
5 |
|
---|
6 | Const MAX_MODULE_NAME32 = 255
|
---|
7 |
|
---|
8 |
|
---|
9 |
|
---|
10 | '-----------------------
|
---|
11 | ' Shapshot function
|
---|
12 | '-----------------------
|
---|
13 |
|
---|
14 | Const TH32CS_SNAPHEAPLIST = &H00000001
|
---|
15 | Const TH32CS_SNAPPROCESS = &H00000002
|
---|
16 | Const TH32CS_SNAPTHREAD = &H00000004
|
---|
17 | Const TH32CS_SNAPMODULE = &H00000008
|
---|
18 | Const TH32CS_SNAPALL = (TH32CS_SNAPHEAPLIST or TH32CS_SNAPPROCESS or TH32CS_SNAPTHREAD or TH32CS_SNAPMODULE)
|
---|
19 | Const TH32CS_INHERIT = &H80000000
|
---|
20 | Declare Function CreateToolhelp32Snapshot Lib "kernel32" (dwFlags As DWord, th32ProcessID As DWord) As HANDLE
|
---|
21 |
|
---|
22 |
|
---|
23 |
|
---|
24 | '-----------------------
|
---|
25 | ' heap walking
|
---|
26 | '-----------------------
|
---|
27 |
|
---|
28 | Type HEAPLIST32
|
---|
29 | dwSize As DWord
|
---|
30 | th32ProcessID As DWord
|
---|
31 | th32HeapID As DWord
|
---|
32 | dwFlags As DWord
|
---|
33 | End Type
|
---|
34 | TypeDef PHEAPLIST32 = *HEAPLIST32
|
---|
35 | TypeDef LPHEAPLIST32 = *HEAPLIST32
|
---|
36 |
|
---|
37 | 'dwFlags
|
---|
38 | Const HF32_DEFAULT = 1 ' process's default heap
|
---|
39 | Const HF32_SHARED = 2 ' is shared heap
|
---|
40 |
|
---|
41 | Declare Function Heap32ListFirst Lib "kernel32" (hSnapshot As HANDLE, ByRef hi As HEAPLIST32) As BOOL
|
---|
42 | Declare Function Heap32ListNext Lib "kernel32" (hSnapshot As HANDLE, ByRef hi As HEAPLIST32) As BOOL
|
---|
43 |
|
---|
44 | Type HEAPENTRY32
|
---|
45 | dwSize As DWord
|
---|
46 | hHandle As DWord
|
---|
47 | dwAddress As DWord
|
---|
48 | dwBlockSize As DWord
|
---|
49 | dwFlags As DWord
|
---|
50 | dwLockCount As DWord
|
---|
51 | dwResvd As DWord
|
---|
52 | th32ProcessID As DWord
|
---|
53 | th32HeapID As DWord
|
---|
54 | End Type
|
---|
55 | TypeDef PHEAPENTRY32 = *HEAPENTRY32
|
---|
56 | TypeDef LPHEAPENTRY32 = *HEAPENTRY32
|
---|
57 |
|
---|
58 | 'dwFlags
|
---|
59 | Const LF32_FIXED = &H00000001
|
---|
60 | Const LF32_FREE = &H00000002
|
---|
61 | Const LF32_MOVEABLE = &H00000004
|
---|
62 |
|
---|
63 | Declare Function Heap32First Lib "kernel32" (ByRef he As HEAPENTRY32, th32ProcessID As DWord, th32HeapID As DWord) As BOOL
|
---|
64 | Declare Function Heap32Next Lib "kernel32" (ByRef he As HEAPENTRY32) As BOOL
|
---|
65 |
|
---|
66 | Declare Function Toolhelp32ReadProcessMemory Lib "kernel32" (th32ProcessID As DWord, lpBaseAddress As VoidPtr, lpBuffer As VoidPtr, cbRead As DWord, ByRef NumberOfBytesRead As DWord) As BOOL
|
---|
67 |
|
---|
68 |
|
---|
69 |
|
---|
70 | '-----------------------
|
---|
71 | ' Process walking
|
---|
72 | '-----------------------
|
---|
73 |
|
---|
74 | Type PROCESSENTRY32
|
---|
75 | dwSize As DWord
|
---|
76 | cntUsage As DWord
|
---|
77 | th32ProcessID As DWord
|
---|
78 | th32DefaultHeapID As DWord
|
---|
79 | th32ModuleID As DWord
|
---|
80 | cntThreads As DWord
|
---|
81 | th32ParentProcessID As DWord
|
---|
82 | pcPriClassBase As Long
|
---|
83 | dwFlags As DWord
|
---|
84 | szExeFile[ELM(MAX_PATH)] As Byte
|
---|
85 | End Type
|
---|
86 | TypeDef PPROCESSENTRY32 = *PROCESSENTRY32
|
---|
87 | TypeDef LPPROCESSENTRY32 = *PROCESSENTRY32
|
---|
88 |
|
---|
89 | Declare Function Process32First Lib "kernel32" (hSnapshot As HANDLE, ByRef pe As PROCESSENTRY32) As BOOL
|
---|
90 | Declare Function Process32Next Lib "kernel32" (hSnapshot As HANDLE, ByRef pe As PROCESSENTRY32) As BOOL
|
---|
91 |
|
---|
92 |
|
---|
93 |
|
---|
94 | '-----------------------
|
---|
95 | ' Thread walking
|
---|
96 | '-----------------------
|
---|
97 |
|
---|
98 | Type THREADENTRY32
|
---|
99 | dwSize As DWord
|
---|
100 | cntUsage As DWord
|
---|
101 | th32ThreadID As DWord
|
---|
102 | th32OwnerProcessID As DWord
|
---|
103 | tpBasePri As Long
|
---|
104 | tpDeltaPri As Long
|
---|
105 | dwFlags As DWord
|
---|
106 | End Type
|
---|
107 | TypeDef PTHREADENTRY32 = *THREADENTRY32
|
---|
108 | TypeDef LPTHREADENTRY32 = *THREADENTRY32
|
---|
109 |
|
---|
110 | Declare Function Thread32First Lib "kernel32" (hSnapshot As HANDLE, ByRef te As THREADENTRY32) As BOOL
|
---|
111 | Declare Function Thread32Next Lib "kernel32" (hSnapshot As HANDLE, ByRef te As THREADENTRY32) As BOOL
|
---|
112 |
|
---|
113 |
|
---|
114 |
|
---|
115 | '-----------------------
|
---|
116 | ' Module walking
|
---|
117 | '-----------------------
|
---|
118 |
|
---|
119 | Type MODULEENTRY32
|
---|
120 | dwSize As DWord
|
---|
121 | th32ModuleID As DWord
|
---|
122 | th32ProcessID As DWord
|
---|
123 | GlblcntUsage As DWord
|
---|
124 | ProccntUsage As DWord
|
---|
125 | modBaseAddr As *Byte
|
---|
126 | modBaseSize As DWord
|
---|
127 | hModule As HANDLE
|
---|
128 | szModule[ELM(MAX_MODULE_NAME32 + 1)] As Byte
|
---|
129 | szExePath[ELM(MAX_PATH)] As Byte
|
---|
130 | End Type
|
---|
131 | TypeDef PMODULEENTRY32 = *MODULEENTRY32
|
---|
132 | TypeDef LPMODULEENTRY32 = *MODULEENTRY32
|
---|
133 |
|
---|
134 | Declare Function Module32First Lib "kernel32" (hSnapshot As HANDLE, ByRef me As MODULEENTRY32) As BOOL
|
---|
135 | Declare Function Module32Next Lib "kernel32" (hSnapshot As HANDLE, ByRef me As MODULEENTRY32) As BOOL
|
---|
136 |
|
---|
137 |
|
---|
138 |
|
---|
139 | #endif ' _INC_TOOLHELP32
|
---|