找回密码
 加入
搜索
查看: 1418|回复: 8

au3能枚举出进程所调用的模块吗?

  [复制链接]
发表于 2009-12-14 17:23:49 | 显示全部楼层 |阅读模式
本帖最后由 landays 于 2009-12-14 20:54 编辑

au3能枚举出进程所调用的模块吗?

==============
问题解决,标准答案在4楼
非常感谢netegg

评分

参与人数 1金钱 +5 收起 理由
afan + 5 感谢主动将修改帖子分类为[已解决],请继续 ...

查看全部评分

发表于 2009-12-14 20:12:59 | 显示全部楼层
好像见过,我找找看,估计留底儿了
 楼主| 发表于 2009-12-14 20:16:19 | 显示全部楼层
多谢楼上的帮忙找找
论坛里我搜索了很多帖子都没相关内容
发表于 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])

评分

参与人数 1金钱 +20 收起 理由
afan + 20

查看全部评分

 楼主| 发表于 2009-12-14 20:38:07 | 显示全部楼层
不对。。我需要的是能返回某个进程调用的DLL等文件信息
你这个是显示PID与父ID和内存占用信息
不过还是多谢了
发表于 2009-12-14 20:39:22 | 显示全部楼层
改了,再看看
 楼主| 发表于 2009-12-14 20:48:46 | 显示全部楼层
OK 就是这个 多谢
发表于 2009-12-15 18:54:34 | 显示全部楼层
强!!!!!!!!!!
发表于 2009-12-18 09:18:48 | 显示全部楼层
学习一下      枚举
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-6-9 10:48 , Processed in 0.083734 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表