home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 June / Chip_2002-06_cd1.bin / zkuste / delphi / kompon / d56 / MSYSINFO.ZIP / Int / MiTeC_ToolHelp32.int < prev    next >
Encoding:
Text File  |  2002-03-01  |  8.8 KB  |  280 lines

  1.  
  2. {*******************************************************}
  3. {                                                       }
  4. {       MiTeC System Information Component              }
  5. {           version 7.0 for Delphi 5,6                  }
  6. {      Tool Help Functions, Types, and Definitions      }
  7. {                                                       }
  8. {       Copyright ⌐ 1997,2002 Michal Mutl               }
  9. {                                                       }
  10. {*******************************************************}
  11.  
  12. {$INCLUDE MITEC_DEF.INC}
  13.  
  14. unit MiTeC_ToolHelp32;
  15.  
  16. {$WEAKPACKAGEUNIT}
  17.  
  18. interface
  19.  
  20. uses Windows;
  21.  
  22. {$HPPEMIT '#include <tlhelp32.h>'}
  23.  
  24. const
  25. {$EXTERNALSYM MAX_MODULE_NAME32}
  26.   MAX_MODULE_NAME32 = 255;
  27.  
  28. (****** Shapshot function **********************************************)
  29.  
  30. {$EXTERNALSYM CreateToolhelp32Snapshot}
  31. function CreateToolhelp32Snapshot(dwFlags, th32ProcessID: DWORD): THandle;
  32.  
  33. type
  34.   TCreateToolhelp32Snapshot = function (dwFlags, th32ProcessID: DWORD): THandle stdcall;
  35. const
  36. {$EXTERNALSYM TH32CS_SNAPHEAPLIST}
  37.   TH32CS_SNAPHEAPLIST = $00000001;
  38. {$EXTERNALSYM TH32CS_SNAPPROCESS}
  39.   TH32CS_SNAPPROCESS  = $00000002;
  40. {$EXTERNALSYM TH32CS_SNAPTHREAD}
  41.   TH32CS_SNAPTHREAD   = $00000004;
  42. {$EXTERNALSYM TH32CS_SNAPMODULE}
  43.   TH32CS_SNAPMODULE   = $00000008;
  44. {$EXTERNALSYM TH32CS_SNAPALL}
  45.   TH32CS_SNAPALL      = TH32CS_SNAPHEAPLIST or TH32CS_SNAPPROCESS or
  46.     TH32CS_SNAPTHREAD or TH32CS_SNAPMODULE;
  47. {$EXTERNALSYM TH32CS_INHERIT}
  48.   TH32CS_INHERIT      = $80000000;
  49.  
  50. type
  51. {$EXTERNALSYM tagHEAPLIST32}
  52.   tagHEAPLIST32 = record
  53.     dwSize: DWORD;
  54.     th32ProcessID: DWORD;
  55.     th32HeapID: DWORD;
  56.     dwFlags: DWORD;
  57.   end;
  58. {$EXTERNALSYM HEAPLIST32}
  59.   HEAPLIST32 = tagHEAPLIST32;
  60. {$EXTERNALSYM PHEAPLIST32}
  61.   PHEAPLIST32 = ^tagHEAPLIST32;
  62. {$EXTERNALSYM LPHEAPLIST32}
  63.   LPHEAPLIST32 = ^tagHEAPLIST32;
  64.   THeapList32 = tagHEAPLIST32;
  65.  
  66. const
  67. {$EXTERNALSYM HF32_DEFAULT}
  68.   HF32_DEFAULT = 1;
  69. {$EXTERNALSYM HF32_SHARED}
  70.   HF32_SHARED  = 2;
  71.  
  72. {$EXTERNALSYM Heap32ListFirst}
  73. function Heap32ListFirst(hSnapshot: THandle; var lphl: THeapList32): BOOL;
  74. {$EXTERNALSYM Heap32ListNext}
  75. function Heap32ListNext(hSnapshot: THandle; var lphl: THeapList32): BOOL;
  76.  
  77. type
  78.   THeap32ListFirst = function (hSnapshot: THandle; var lphl: THeapList32): BOOL stdcall;
  79.   THeap32ListNext = function (hSnapshot: THandle; var lphl: THeapList32): BOOL stdcall;
  80.  
  81. type
  82. {$EXTERNALSYM tagHEAPENTRY32}
  83.   tagHEAPENTRY32 = record
  84.     dwSize: DWORD;
  85.     hHandle: THandle;
  86.     dwAddress: DWORD;
  87.     dwBlockSize: DWORD;
  88.     dwFlags: DWORD;
  89.     dwLockCount: DWORD;
  90.     dwResvd: DWORD;
  91.     th32ProcessID: DWORD;
  92.     th32HeapID: DWORD;
  93.   end;
  94. {$EXTERNALSYM HEAPENTRY32}
  95.   HEAPENTRY32 = tagHEAPENTRY32;
  96. {$EXTERNALSYM PHEAPENTRY32}
  97.   PHEAPENTRY32 = ^tagHEAPENTRY32;
  98. {$EXTERNALSYM LPHEAPENTRY32}
  99.   LPHEAPENTRY32 = ^tagHEAPENTRY32;
  100.   THeapEntry32 = tagHEAPENTRY32;
  101.  
  102. const
  103. {$EXTERNALSYM LF32_FIXED}
  104.   LF32_FIXED    = $00000001;
  105. {$EXTERNALSYM LF32_FREE}
  106.   LF32_FREE     = $00000002;
  107. {$EXTERNALSYM LF32_MOVEABLE}
  108.   LF32_MOVEABLE = $00000004;
  109.  
  110. {$EXTERNALSYM Heap32First}
  111. function Heap32First(var lphe: THeapEntry32; th32ProcessID, th32HeapID: DWORD): BOOL;
  112. {$EXTERNALSYM Heap32Next}
  113. function Heap32Next(var lphe: THeapEntry32): BOOL;
  114. {$EXTERNALSYM Toolhelp32ReadProcessMemory}
  115. function Toolhelp32ReadProcessMemory(th32ProcessID: DWORD; lpBaseAddress: Pointer;
  116.   var lpBuffer; cbRead: DWORD; var lpNumberOfBytesRead: DWORD): BOOL;
  117.  
  118. type
  119.   THeap32First = function (var lphe: THeapEntry32; th32ProcessID,
  120.     th32HeapID: DWORD): BOOL stdcall;
  121.   THeap32Next = function (var lphe: THeapEntry32): BOOL stdcall;
  122.   TToolhelp32ReadProcessMemory = function (th32ProcessID: DWORD;
  123.     lpBaseAddress: Pointer; var lpBuffer; cbRead: DWORD;
  124.     var lpNumberOfBytesRead: DWORD): BOOL stdcall;
  125.  
  126. type
  127. {$EXTERNALSYM tagPROCESSENTRY32W}
  128.   tagPROCESSENTRY32W = packed record
  129.     dwSize: DWORD;
  130.     cntUsage: DWORD;
  131.     th32ProcessID: DWORD;
  132.     th32DefaultHeapID: DWORD;
  133.     th32ModuleID: DWORD;
  134.     cntThreads: DWORD;
  135.     th32ParentProcessID: DWORD;
  136.     pcPriClassBase: Longint;
  137.     dwFlags: DWORD;
  138.     szExeFile: array[0..MAX_PATH - 1] of WChar;
  139.   end;
  140. {$EXTERNALSYM PROCESSENTRY32W}
  141.   PROCESSENTRY32W = tagPROCESSENTRY32W;
  142. {$EXTERNALSYM PPROCESSENTRY32W}
  143.   PPROCESSENTRY32W = ^tagPROCESSENTRY32W;
  144. {$EXTERNALSYM LPPROCESSENTRY32W}
  145.   LPPROCESSENTRY32W = ^tagPROCESSENTRY32W;
  146.   TProcessEntry32W = tagPROCESSENTRY32W;
  147.  
  148. {$EXTERNALSYM Process32FirstW}
  149. function Process32FirstW(hSnapshot: THandle; var lppe: TProcessEntry32W): BOOL;
  150. {$EXTERNALSYM Process32NextW}
  151. function Process32NextW(hSnapshot: THandle; var lppe: TProcessEntry32W): BOOL;
  152.  
  153. type
  154.   TProcess32FirstW = function (hSnapshot: THandle; var lppe: TProcessEntry32W): BOOL stdcall;
  155.   TProcess32NextW = function (hSnapshot: THandle; var lppe: TProcessEntry32W): BOOL stdcall;
  156.  
  157. {$EXTERNALSYM tagPROCESSENTRY32}
  158.   tagPROCESSENTRY32 = packed record
  159.     dwSize: DWORD;
  160.     cntUsage: DWORD;
  161.     th32ProcessID: DWORD;
  162.     th32DefaultHeapID: DWORD;
  163.     th32ModuleID: DWORD;
  164.     cntThreads: DWORD;
  165.     th32ParentProcessID: DWORD;
  166.     pcPriClassBase: Longint;
  167.     dwFlags: DWORD;
  168.     szExeFile: array[0..MAX_PATH - 1] of Char;
  169.   end;
  170. {$EXTERNALSYM PROCESSENTRY32}
  171.   PROCESSENTRY32 = tagPROCESSENTRY32;
  172. {$EXTERNALSYM PPROCESSENTRY32}
  173.   PPROCESSENTRY32 = ^tagPROCESSENTRY32;
  174. {$EXTERNALSYM LPPROCESSENTRY32}
  175.   LPPROCESSENTRY32 = ^tagPROCESSENTRY32;
  176.   TProcessEntry32 = tagPROCESSENTRY32;
  177.  
  178. {$EXTERNALSYM Process32First}
  179. function Process32First(hSnapshot: THandle; var lppe: TProcessEntry32): BOOL;
  180. {$EXTERNALSYM Process32Next}
  181. function Process32Next(hSnapshot: THandle; var lppe: TProcessEntry32): BOOL;
  182.  
  183. type
  184.   TProcess32First = function (hSnapshot: THandle; var lppe: TProcessEntry32): BOOL stdcall;
  185.   TProcess32Next = function (hSnapshot: THandle; var lppe: TProcessEntry32): BOOL stdcall;
  186.  
  187. type
  188. {$EXTERNALSYM tagTHREADENTRY32}
  189.   tagTHREADENTRY32 = record
  190.     dwSize: DWORD;
  191.     cntUsage: DWORD;
  192.     th32ThreadID: DWORD;
  193.     th32OwnerProcessID: DWORD;
  194.     tpBasePri: Longint;
  195.     tpDeltaPri: Longint;
  196.     dwFlags: DWORD;
  197.   end;
  198. {$EXTERNALSYM THREADENTRY32}
  199.   THREADENTRY32 = tagTHREADENTRY32;
  200. {$EXTERNALSYM PTHREADENTRY32}
  201.   PTHREADENTRY32 = ^tagTHREADENTRY32;
  202. {$EXTERNALSYM LPTHREADENTRY32}
  203.   LPTHREADENTRY32 = ^tagTHREADENTRY32;
  204.   TThreadEntry32 = tagTHREADENTRY32;
  205.  
  206. {$EXTERNALSYM Thread32First}
  207. function Thread32First(hSnapshot: THandle; var lpte: TThreadEntry32): BOOL; stdcall;
  208. {$EXTERNALSYM Thread32Next}
  209. function Thread32Next(hSnapshot: THandle; var lpte: TThreadENtry32): BOOL; stdcall;
  210.  
  211. type
  212.   TThread32First = function (hSnapshot: THandle; var lpte: TThreadEntry32): BOOL stdcall;
  213.   TThread32Next = function (hSnapshot: THandle; var lpte: TThreadENtry32): BOOL stdcall;
  214.  
  215. type
  216. {$EXTERNALSYM tagMODULEENTRY32}
  217.   tagMODULEENTRY32 = record
  218.     dwSize: DWORD;
  219.     th32ModuleID: DWORD;
  220.     th32ProcessID: DWORD;
  221.     GlblcntUsage: DWORD;
  222.     ProccntUsage: DWORD;
  223.     modBaseAddr: PBYTE;
  224.     modBaseSize: DWORD;
  225.     hModule: HMODULE;
  226.     szModule: array[0..MAX_MODULE_NAME32] of Char;
  227.     szExePath: array[0..MAX_PATH - 1] of Char;
  228.   end;
  229. {$EXTERNALSYM MODULEENTRY32}
  230.   MODULEENTRY32 = tagMODULEENTRY32;
  231. {$EXTERNALSYM PMODULEENTRY32}
  232.   PMODULEENTRY32 = ^tagMODULEENTRY32;
  233. {$EXTERNALSYM LPMODULEENTRY32}
  234.   LPMODULEENTRY32 = ^tagMODULEENTRY32;
  235.   TModuleEntry32 = tagMODULEENTRY32;
  236.  
  237. {$EXTERNALSYM Module32First}
  238. function Module32First(hSnapshot: THandle; var lpme: TModuleEntry32): BOOL;
  239. {$EXTERNALSYM Module32Next}
  240. function Module32Next(hSnapshot: THandle; var lpme: TModuleEntry32): BOOL;
  241.  
  242. type
  243.   TModule32First = function (hSnapshot: THandle; var lpme: TModuleEntry32): BOOL stdcall;
  244.   TModule32Next = function (hSnapshot: THandle; var lpme: TModuleEntry32): BOOL stdcall;
  245.  
  246. {$EXTERNALSYM tagMODULEENTRY32W}
  247.   tagMODULEENTRY32W = record
  248.     dwSize: DWORD;
  249.     th32ModuleID: DWORD;
  250.     th32ProcessID: DWORD;
  251.     GlblcntUsage: DWORD;
  252.     ProccntUsage: DWORD;
  253.     modBaseAddr: PBYTE;
  254.     modBaseSize: DWORD;
  255.     hModule: HMODULE;
  256.     szModule: array[0..MAX_MODULE_NAME32] of WChar;
  257.     szExePath: array[0..MAX_PATH - 1] of WChar;
  258.   end;
  259. {$EXTERNALSYM MODULEENTRY32}
  260.   MODULEENTRY32W = tagMODULEENTRY32W;
  261. {$EXTERNALSYM PMODULEENTRY32}
  262.   PMODULEENTRY32W = ^tagMODULEENTRY32W;
  263. {$EXTERNALSYM LPMODULEENTRY32}
  264.   LPMODULEENTRY32W = ^tagMODULEENTRY32W;
  265.   TModuleEntry32W = tagMODULEENTRY32W;
  266.  
  267. {$EXTERNALSYM Module32First}
  268. function Module32FirstW(hSnapshot: THandle; var lpme: TModuleEntry32W): BOOL;
  269. {$EXTERNALSYM Module32Next}
  270. function Module32NextW(hSnapshot: THandle; var lpme: TModuleEntry32W): BOOL;
  271.  
  272. type
  273.   TModule32FirstW = function (hSnapshot: THandle; var lpme: TModuleEntry32W): BOOL stdcall;
  274.   TModule32NextW = function (hSnapshot: THandle; var lpme: TModuleEntry32W): BOOL stdcall;
  275.  
  276.  
  277. implementation
  278.  
  279.  
  280.