;/*****************************************************************************\
;                                                                             *
; tlhelp32.h -  WIN32 tool help functions, types, and definitions             *
;                                                                             *
; Version 1.0                                                                 *
;                                                                             *
; NOTE: windows.h/winbase.h must be #included first                           *
;                                                                             *
; Copyright 1994 - 1998 Microsoft Corp.   All rights reserved.                *
;                                                                             *
;\*****************************************************************************/

;
; converted to FASM by comrade
; comrade2k@hotmail.com
; http://comrade.ownz.com/
;
; 2008-05-17
;

MAX_MODULE_NAME32 = 255

;/****** Shapshot function **********************************************/

;
; The th32ProcessID argument is only used if TH32CS_SNAPHEAPLIST or
; TH32CS_SNAPMODULE is specified. th32ProcessID == 0 means the current
; process.
;
; NOTE that all of the snapshots are global except for the heap and module
;      lists which are process specific. To enumerate the heap or module
;      state for all WIN32 processes call with TH32CS_SNAPALL and the
;      current process. Then for each process in the TH32CS_SNAPPROCESS
;      list that isn't the current process, do a call with just
;      TH32CS_SNAPHEAPLIST and/or TH32CS_SNAPMODULE.
;
; dwFlags
;
TH32CS_SNAPHEAPLIST = 0x00000001
TH32CS_SNAPPROCESS  = 0x00000002
TH32CS_SNAPTHREAD   = 0x00000004
TH32CS_SNAPMODULE   = 0x00000008
TH32CS_SNAPALL	    = (TH32CS_SNAPHEAPLIST OR TH32CS_SNAPPROCESS OR TH32CS_SNAPTHREAD OR TH32CS_SNAPMODULE)
TH32CS_INHERIT	    = 0x80000000

;
; Use CloseHandle to destroy the snapshot
;

;/****** heap walking ***************************************************/

struct HEAPLIST32
	dwSize		dd ?
	th32ProcessID	dd ?	; owning process
	th32HeapID	dd ?	;  heap (in owning process's context!)
	dwFlags 	dd ?
ends

;
; dwFlags
;
HF32_DEFAULT	  = 1  ; process's default heap
HF32_SHARED	  = 2  ; is shared heap

struct HEAPENTRY32
	dwSize		dd ?
	hHandle 	dd ?	; Handle of this heap block
	dwAddress	dd ?	; Linear address of start of block
	dwBlockSize	dd ?	; Size of block in bytes
	dwFlags 	dd ?
	dwLockCount	dd ?
	dwResvd 	dd ?
	th32ProcessID	dd ?	; owning process
	th32HeapID	dd ?	; heap block is in
ends

;
; dwFlags
;
LF32_FIXED    = 0x00000001
LF32_FREE     = 0x00000002
LF32_MOVEABLE = 0x00000004

;/***** Process walking *************************************************/

struct PROCESSENTRY32
	dwSize			dd ?
	cntUsage		dd ?
	th32ProcessID		dd ?	; this process
	th32DefaultHeapID	dd ?
	th32ModuleID		dd ?	; associated exe
	cntThreads		dd ?
	th32ParentProcessID	dd ?	; this process's parent process
	pcPriClassBase		dd ?	; Base priority of process's threads
	dwFlags 		dd ?
	szExeFile		TCHAR MAX_PATH dup (?) ; Path
ends


;/***** Thread walking **************************************************/

struct THREADENTRY32
	dwSize			dd ?
	cntUsage		dd ?
	th32ThreadID		dd ?	; this thread
	th32OwnerProcessID	dd ?	; Process this thread is associated with
	tpBasePri		dd ?
	tpDeltaPri		dd ?
	dwFlags 		dd ?
ends

;/***** Module walking *************************************************/

struct MODULEENTRY32
	dwSize			dd ?
	th32ModuleID		dd ?	; This module
	th32ProcessID		dd ?	; owning process
	GlblcntUsage		dd ?	; Global usage count on the module
	ProccntUsage		dd ?	; Module usage count in th32ProcessID's context
	modBaseAddr		dd ?	; Base address of module in th32ProcessID's context
	modBaseSize		dd ?	; Size in bytes of module starting at modBaseAddr
	hModule 		dd ?	; The hModule of this module in th32ProcessID's context
	szModule		TCHAR (MAX_MODULE_NAME32 + 1) dup (?)
	szExePath		TCHAR MAX_PATH dup (?)
ends

;
; NOTE CAREFULLY that the modBaseAddr and hModule fields are valid ONLY
; in th32ProcessID's process context.
;
