[1166] | 1 | /**
|
---|
| 2 | * This file has no copyright assigned and is placed in the Public Domain.
|
---|
| 3 | * This file is part of the mingw-w64 runtime package.
|
---|
| 4 | * No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
---|
| 5 | */
|
---|
| 6 | #ifndef _INC_TOOLHELP32
|
---|
| 7 | #define _INC_TOOLHELP32
|
---|
| 8 |
|
---|
| 9 | #ifdef __cplusplus
|
---|
| 10 | extern "C" {
|
---|
| 11 | #endif
|
---|
| 12 |
|
---|
| 13 | #define MAX_MODULE_NAME32 255
|
---|
| 14 |
|
---|
| 15 | HANDLE WINAPI CreateToolhelp32Snapshot(DWORD dwFlags,DWORD th32ProcessID);
|
---|
| 16 |
|
---|
| 17 | #define TH32CS_SNAPHEAPLIST 0x00000001
|
---|
| 18 | #define TH32CS_SNAPPROCESS 0x00000002
|
---|
| 19 | #define TH32CS_SNAPTHREAD 0x00000004
|
---|
| 20 | #define TH32CS_SNAPMODULE 0x00000008
|
---|
| 21 | #define TH32CS_SNAPMODULE32 0x00000010
|
---|
| 22 | #define TH32CS_SNAPALL (TH32CS_SNAPHEAPLIST | TH32CS_SNAPPROCESS | TH32CS_SNAPTHREAD | TH32CS_SNAPMODULE)
|
---|
| 23 | #define TH32CS_INHERIT 0x80000000
|
---|
| 24 |
|
---|
| 25 | typedef struct tagHEAPLIST32 {
|
---|
| 26 | SIZE_T dwSize;
|
---|
| 27 | DWORD th32ProcessID;
|
---|
| 28 | ULONG_PTR th32HeapID;
|
---|
| 29 | DWORD dwFlags;
|
---|
| 30 | } HEAPLIST32;
|
---|
| 31 | typedef HEAPLIST32 *PHEAPLIST32;
|
---|
| 32 | typedef HEAPLIST32 *LPHEAPLIST32;
|
---|
| 33 |
|
---|
| 34 | #define HF32_DEFAULT 1
|
---|
| 35 | #define HF32_SHARED 2
|
---|
| 36 |
|
---|
| 37 | WINBOOL WINAPI Heap32ListFirst(HANDLE hSnapshot,LPHEAPLIST32 lphl);
|
---|
| 38 | WINBOOL WINAPI Heap32ListNext(HANDLE hSnapshot,LPHEAPLIST32 lphl);
|
---|
| 39 |
|
---|
| 40 | typedef struct tagHEAPENTRY32 {
|
---|
| 41 | SIZE_T dwSize;
|
---|
| 42 | HANDLE hHandle;
|
---|
| 43 | ULONG_PTR dwAddress;
|
---|
| 44 | SIZE_T dwBlockSize;
|
---|
| 45 | DWORD dwFlags;
|
---|
| 46 | DWORD dwLockCount;
|
---|
| 47 | DWORD dwResvd;
|
---|
| 48 | DWORD th32ProcessID;
|
---|
| 49 | ULONG_PTR th32HeapID;
|
---|
| 50 | } HEAPENTRY32;
|
---|
| 51 | typedef HEAPENTRY32 *PHEAPENTRY32;
|
---|
| 52 | typedef HEAPENTRY32 *LPHEAPENTRY32;
|
---|
| 53 |
|
---|
| 54 | #define LF32_FIXED 0x00000001
|
---|
| 55 | #define LF32_FREE 0x00000002
|
---|
| 56 | #define LF32_MOVEABLE 0x00000004
|
---|
| 57 |
|
---|
| 58 | WINBOOL WINAPI Heap32First(LPHEAPENTRY32 lphe,DWORD th32ProcessID,ULONG_PTR th32HeapID);
|
---|
| 59 | WINBOOL WINAPI Heap32Next(LPHEAPENTRY32 lphe);
|
---|
| 60 | WINBOOL WINAPI Toolhelp32ReadProcessMemory(DWORD th32ProcessID,LPCVOID lpBaseAddress,LPVOID lpBuffer,SIZE_T cbRead,SIZE_T *lpNumberOfBytesRead);
|
---|
| 61 |
|
---|
| 62 | typedef struct tagPROCESSENTRY32W {
|
---|
| 63 | DWORD dwSize;
|
---|
| 64 | DWORD cntUsage;
|
---|
| 65 | DWORD th32ProcessID;
|
---|
| 66 | ULONG_PTR th32DefaultHeapID;
|
---|
| 67 | DWORD th32ModuleID;
|
---|
| 68 | DWORD cntThreads;
|
---|
| 69 | DWORD th32ParentProcessID;
|
---|
| 70 | LONG pcPriClassBase;
|
---|
| 71 | DWORD dwFlags;
|
---|
| 72 | WCHAR szExeFile[MAX_PATH];
|
---|
| 73 | } PROCESSENTRY32W;
|
---|
| 74 | typedef PROCESSENTRY32W *PPROCESSENTRY32W;
|
---|
| 75 | typedef PROCESSENTRY32W *LPPROCESSENTRY32W;
|
---|
| 76 |
|
---|
| 77 | WINBOOL WINAPI Process32FirstW(HANDLE hSnapshot,LPPROCESSENTRY32W lppe);
|
---|
| 78 | WINBOOL WINAPI Process32NextW(HANDLE hSnapshot,LPPROCESSENTRY32W lppe);
|
---|
| 79 |
|
---|
| 80 | typedef struct tagPROCESSENTRY32 {
|
---|
| 81 | DWORD dwSize;
|
---|
| 82 | DWORD cntUsage;
|
---|
| 83 | DWORD th32ProcessID;
|
---|
| 84 | ULONG_PTR th32DefaultHeapID;
|
---|
| 85 | DWORD th32ModuleID;
|
---|
| 86 | DWORD cntThreads;
|
---|
| 87 | DWORD th32ParentProcessID;
|
---|
| 88 | LONG pcPriClassBase;
|
---|
| 89 | DWORD dwFlags;
|
---|
| 90 | CHAR szExeFile[MAX_PATH];
|
---|
| 91 | } PROCESSENTRY32;
|
---|
| 92 | typedef PROCESSENTRY32 *PPROCESSENTRY32;
|
---|
| 93 | typedef PROCESSENTRY32 *LPPROCESSENTRY32;
|
---|
| 94 |
|
---|
| 95 | WINBOOL WINAPI Process32First(HANDLE hSnapshot,LPPROCESSENTRY32 lppe);
|
---|
| 96 | WINBOOL WINAPI Process32Next(HANDLE hSnapshot,LPPROCESSENTRY32 lppe);
|
---|
| 97 |
|
---|
| 98 | #if defined(UNICODE)
|
---|
| 99 | #define Process32First Process32FirstW
|
---|
| 100 | #define Process32Next Process32NextW
|
---|
| 101 | #define PROCESSENTRY32 PROCESSENTRY32W
|
---|
| 102 | #define PPROCESSENTRY32 PPROCESSENTRY32W
|
---|
| 103 | #define LPPROCESSENTRY32 LPPROCESSENTRY32W
|
---|
| 104 | #endif
|
---|
| 105 |
|
---|
| 106 | typedef struct tagTHREADENTRY32 {
|
---|
| 107 | DWORD dwSize;
|
---|
| 108 | DWORD cntUsage;
|
---|
| 109 | DWORD th32ThreadID;
|
---|
| 110 | DWORD th32OwnerProcessID;
|
---|
| 111 | LONG tpBasePri;
|
---|
| 112 | LONG tpDeltaPri;
|
---|
| 113 | DWORD dwFlags;
|
---|
| 114 | } THREADENTRY32;
|
---|
| 115 | typedef THREADENTRY32 *PTHREADENTRY32;
|
---|
| 116 | typedef THREADENTRY32 *LPTHREADENTRY32;
|
---|
| 117 |
|
---|
| 118 | WINBOOL WINAPI Thread32First(HANDLE hSnapshot,LPTHREADENTRY32 lpte);
|
---|
| 119 | WINBOOL WINAPI Thread32Next(HANDLE hSnapshot,LPTHREADENTRY32 lpte);
|
---|
| 120 |
|
---|
| 121 | typedef struct tagMODULEENTRY32W {
|
---|
| 122 | DWORD dwSize;
|
---|
| 123 | DWORD th32ModuleID;
|
---|
| 124 | DWORD th32ProcessID;
|
---|
| 125 | DWORD GlblcntUsage;
|
---|
| 126 | DWORD ProccntUsage;
|
---|
| 127 | BYTE *modBaseAddr;
|
---|
| 128 | DWORD modBaseSize;
|
---|
| 129 | HMODULE hModule;
|
---|
| 130 | WCHAR szModule[MAX_MODULE_NAME32 + 1];
|
---|
| 131 | WCHAR szExePath[MAX_PATH];
|
---|
| 132 | } MODULEENTRY32W;
|
---|
| 133 | typedef MODULEENTRY32W *PMODULEENTRY32W;
|
---|
| 134 | typedef MODULEENTRY32W *LPMODULEENTRY32W;
|
---|
| 135 |
|
---|
| 136 | WINBOOL WINAPI Module32FirstW(HANDLE hSnapshot,LPMODULEENTRY32W lpme);
|
---|
| 137 | WINBOOL WINAPI Module32NextW(HANDLE hSnapshot,LPMODULEENTRY32W lpme);
|
---|
| 138 |
|
---|
| 139 | typedef struct tagMODULEENTRY32 {
|
---|
| 140 | DWORD dwSize;
|
---|
| 141 | DWORD th32ModuleID;
|
---|
| 142 | DWORD th32ProcessID;
|
---|
| 143 | DWORD GlblcntUsage;
|
---|
| 144 | DWORD ProccntUsage;
|
---|
| 145 | BYTE *modBaseAddr;
|
---|
| 146 | DWORD modBaseSize;
|
---|
| 147 | HMODULE hModule;
|
---|
| 148 | char szModule[MAX_MODULE_NAME32 + 1];
|
---|
| 149 | char szExePath[MAX_PATH];
|
---|
| 150 | } MODULEENTRY32;
|
---|
| 151 | typedef MODULEENTRY32 *PMODULEENTRY32;
|
---|
| 152 | typedef MODULEENTRY32 *LPMODULEENTRY32;
|
---|
| 153 |
|
---|
| 154 | WINBOOL WINAPI Module32First(HANDLE hSnapshot,LPMODULEENTRY32 lpme);
|
---|
| 155 | WINBOOL WINAPI Module32Next(HANDLE hSnapshot,LPMODULEENTRY32 lpme);
|
---|
| 156 |
|
---|
| 157 | #if defined(UNICODE)
|
---|
| 158 | #define Module32First Module32FirstW
|
---|
| 159 | #define Module32Next Module32NextW
|
---|
| 160 | #define MODULEENTRY32 MODULEENTRY32W
|
---|
| 161 | #define PMODULEENTRY32 PMODULEENTRY32W
|
---|
| 162 | #define LPMODULEENTRY32 LPMODULEENTRY32W
|
---|
| 163 | #endif
|
---|
| 164 |
|
---|
| 165 | #ifdef __cplusplus
|
---|
| 166 | }
|
---|
| 167 | #endif
|
---|
| 168 | #endif
|
---|