source: Include/api_tlhelp32.sbp@ 195

Last change on this file since 195 was 1, checked in by (none), 18 years ago
File size: 3.8 KB
Line 
1' api_tlhelp32.sbp
2
3#ifndef _INC_TOOLHELP32
4#define _INC_TOOLHELP32
5
6Const MAX_MODULE_NAME32 = 255
7
8
9
10'-----------------------
11' Shapshot function
12'-----------------------
13
14Const TH32CS_SNAPHEAPLIST = &H00000001
15Const TH32CS_SNAPPROCESS = &H00000002
16Const TH32CS_SNAPTHREAD = &H00000004
17Const TH32CS_SNAPMODULE = &H00000008
18Const TH32CS_SNAPALL = (TH32CS_SNAPHEAPLIST or TH32CS_SNAPPROCESS or TH32CS_SNAPTHREAD or TH32CS_SNAPMODULE)
19Const TH32CS_INHERIT = &H80000000
20Declare Function CreateToolhelp32Snapshot Lib "kernel32" (dwFlags As DWord, th32ProcessID As DWord) As HANDLE
21
22
23
24'-----------------------
25' heap walking
26'-----------------------
27
28Type HEAPLIST32
29 dwSize As DWord
30 th32ProcessID As DWord
31 th32HeapID As DWord
32 dwFlags As DWord
33End Type
34TypeDef PHEAPLIST32 = *HEAPLIST32
35TypeDef LPHEAPLIST32 = *HEAPLIST32
36
37'dwFlags
38Const HF32_DEFAULT = 1 ' process's default heap
39Const HF32_SHARED = 2 ' is shared heap
40
41Declare Function Heap32ListFirst Lib "kernel32" (hSnapshot As HANDLE, ByRef hi As HEAPLIST32) As BOOL
42Declare Function Heap32ListNext Lib "kernel32" (hSnapshot As HANDLE, ByRef hi As HEAPLIST32) As BOOL
43
44Type 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
54End Type
55TypeDef PHEAPENTRY32 = *HEAPENTRY32
56TypeDef LPHEAPENTRY32 = *HEAPENTRY32
57
58'dwFlags
59Const LF32_FIXED = &H00000001
60Const LF32_FREE = &H00000002
61Const LF32_MOVEABLE = &H00000004
62
63Declare Function Heap32First Lib "kernel32" (ByRef he As HEAPENTRY32, th32ProcessID As DWord, th32HeapID As DWord) As BOOL
64Declare Function Heap32Next Lib "kernel32" (ByRef he As HEAPENTRY32) As BOOL
65
66Declare 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
74Type 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
85End Type
86TypeDef PPROCESSENTRY32 = *PROCESSENTRY32
87TypeDef LPPROCESSENTRY32 = *PROCESSENTRY32
88
89Declare Function Process32First Lib "kernel32" (hSnapshot As HANDLE, ByRef pe As PROCESSENTRY32) As BOOL
90Declare Function Process32Next Lib "kernel32" (hSnapshot As HANDLE, ByRef pe As PROCESSENTRY32) As BOOL
91
92
93
94'-----------------------
95' Thread walking
96'-----------------------
97
98Type 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
106End Type
107TypeDef PTHREADENTRY32 = *THREADENTRY32
108TypeDef LPTHREADENTRY32 = *THREADENTRY32
109
110Declare Function Thread32First Lib "kernel32" (hSnapshot As HANDLE, ByRef te As THREADENTRY32) As BOOL
111Declare Function Thread32Next Lib "kernel32" (hSnapshot As HANDLE, ByRef te As THREADENTRY32) As BOOL
112
113
114
115'-----------------------
116' Module walking
117'-----------------------
118
119Type 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
130End Type
131TypeDef PMODULEENTRY32 = *MODULEENTRY32
132TypeDef LPMODULEENTRY32 = *MODULEENTRY32
133
134Declare Function Module32First Lib "kernel32" (hSnapshot As HANDLE, ByRef me As MODULEENTRY32) As BOOL
135Declare Function Module32Next Lib "kernel32" (hSnapshot As HANDLE, ByRef me As MODULEENTRY32) As BOOL
136
137
138
139#endif ' _INC_TOOLHELP32
Note: See TracBrowser for help on using the repository browser.