|
发表于 2009-12-14 20:27:42
|
显示全部楼层
本帖最后由 netegg 于 2009-12-15 00:24 编辑
#Include <WinAPI.au3>
#include <Array.au3>
; #FUNCTION#;===============================================================================
;
; Name...........: _ProcessGetLoadedModules
; Description ...: Returns an array containing the full path of the loaded modules
; Syntax.........: _ProcessGetLoadedModules($iPID)
; Parameters ....:
; Return values .: Success - An array with all the paths
; : Failure - -1 and @error=1 if the specified process couldn't be opened.
; Author ........: Andreas Karlsson (monoceres)
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........;
; Example .......; No
;
;;==========================================================================================
Func _ProcessGetLoadedModules($iPID)
Local Const $PROCESS_QUERY_INFORMATION=0x0400
Local Const $PROCESS_VM_READ=0x0010
Local $aCall, $hPsapi=DllOpen("Psapi.dll")
Local $hProcess, $tModulesStruct
$tModulesStruct=DllStructCreate("hwnd [200]")
Local $SIZEOFHWND = DllStructGetSize($tModulesStruct)/200
$hProcess=_WinAPI_OpenProcess(BitOR($PROCESS_QUERY_INFORMATION,$PROCESS_VM_READ),False,$iPID)
If Not $hProcess Then Return SetError(1,0,-1)
$aCall=DllCall($hPsapi,"int","EnumProcessModules","ptr",$hProcess,"ptr",DllStructGetPtr($tModulesStruct),"dword",DllStructGetSize($tModulesStruct),"dword*","")
If $aCall[4]>DllStructGetSize($tModulesStruct) Then
$tModulesStruct=DllStructCreate("hwnd ["&$aCall[4]/$SIZEOFHWND&"]")
$aCall=DllCall($hPsapi,"int","EnumProcessModules","ptr",$hProcess,"ptr",DllStructGetPtr($tModulesStruct),"dword",$aCall[4],"dword*","")
EndIf
Local $aReturn[$aCall[4]/$SIZEOFHWND]
For $i=0 To Ubound($aReturn)-1
$aCall=DllCall($hPsapi,"dword","GetModuleFileNameExW","ptr",$hProcess,"int",DllStructGetData($tModulesStruct,1,$i+1),"wstr","","dword",65536)
$aReturn[$i]=$aCall[3]
Next
_WinAPI_CloseHandle($hProcess)
DllClose($hPsapi)
Return $aReturn
EndFunc
$LIST = ProcessList()
$MODULES = _ProcessGetLoadedModules($LIST[5][1])
_ArrayDisplay($MODULES,$LIST[5][0]) |
评分
-
查看全部评分
|