tListMod

Gets a list modules / module-handles of a particular running process. {95/98 & NT}

 

Syntax:

tListMod ( process-id , flag)

Parameters:

(i) process id process-id of a particular process. (obtained by tListProc)

(i) flag 0 - both module-name and module-handle
1 - module-name only.
2 - module-handle only.

Returns:

(i) module list a tab delimited list of module-names and/or module-handles, depending on flag specified.

 

This function is used to determine which DLLs have been loaded by a particular process.

 

If flag' 2 is specified, the 'module list' is returned in the following format:

 

[modulename|modulehandle]@TAB[modulename|modulehandle]

 

On Win95, when run in debug mode from Winbatch Studio WinBatch.EXE doesn't show up in the tproclist or Taskinfo. Hence none of the modules are listed in tListMod. This is expected behavior.

 

Note:

In order to grab module information tListMod attempts to open the process. Opening the process fails for the Idle and CSRSS processes because their access restrictions prevent user-level code from opening them. tListProc includes these processes. You will need to handle the access restriction errors using ErrorMode.

 

Example:

AddExtender("WWPRC44I.DLL",0,"WWPRC64I.DLL")
proclist=tListProc()
process=AskItemlist("All processes",proclist,@TAB,@UNSORTED,@SINGLE)
; parse off process id
procid=ItemExtract(2,process,"|")
procname=ItemExtract(1,process,"|")
ErrorMode(@OFF)
modlist=tListMod(procid,0)
ErrorMode(@CANCEL)
If modlist == 0
   err = tGetLastError()
   modlist = StrCat("Unable to list modules, Lasterror ",err)
EndIf
module=AskItemlist("List of modules for %procNAME%",modlist,@TAB,@UNSORTED,@SINGLE)
If module == "" Then Exit
modhandle=ItemExtract(2,module,"|")
modname=ItemExtract(1,module,"|")
info=tGetModInfo(procid, modhandle)
addr=ItemExtract(1,info,@TAB)
size=ItemExtract(2,info,@TAB)
entry=ItemExtract(3,info,@TAB)
str=StrCat("load address of the module: ",addr,@CRLF,"linear space that the module occupies.: ",size,@CRLF,"entry point of the module: ",entry)
Message("Module information on %modname%",str)
Exit
See Also:

tListProc