找回密码
 加入
搜索
查看: 1939|回复: 3

[AU3基础] 3.3.7.2的winapiex中没有找到_WinAPI_ProcessGetLoadedModules函数

[复制链接]
发表于 2011-9-3 21:59:50 | 显示全部楼层 |阅读模式
如题,之前3.3.6.1找不到_WinAPI_EnumProcessModules
升级后,又找不到_WinAPI_ProcessGetLoadedModules函数了
发表于 2011-9-3 23:51:23 | 显示全部楼层
本帖最后由 netegg 于 2011-9-3 23:54 编辑
Func _WinAPI_EnumProcessModules($PID = 0)

        If Not $PID Then
                $PID = _WinAPI_GetCurrentProcessID()
                If Not $PID Then
                        Return SetError(1, 0, 0)
                EndIf
        EndIf

        Local $hProcess, $tPtr, $Access, $Count, $Ret, $Result = 0

        If _WinAPI_GetVersion() < '6.0' Then
                $Access = 0x00000410
        Else
                $Access = 0x00001010
        EndIf
        $hProcess = DllCall('kernel32.dll', 'ptr', 'OpenProcess', 'dword', $Access, 'int', 0, 'dword', $PID)
        If (@error) Or (Not $hProcess[0]) Then
                Return SetError(1, 0, 0)
        EndIf
        Do
                $Ret = DllCall(@SystemDir & '\psapi.dll', 'int', 'EnumProcessModules', 'ptr', $hProcess[0], 'ptr', 0, 'dword', 0, 'dword*', 0)
                If (@error) Or (Not $Ret[0]) Then
                        ExitLoop
                EndIf
                If @AutoItX64 Then
                        $Count = $Ret[4] / 8
                Else
                        $Count = $Ret[4] / 4
                EndIf
                $tPtr = DllStructCreate('ptr[' & $Count & ']')
                If Not IsDllStruct($tPtr) Then
                        ExitLoop
                EndIf
                $Ret = DllCall(@SystemDir & '\psapi.dll', 'int', 'EnumProcessModules', 'ptr', $hProcess[0], 'ptr', DllStructGetPtr($tPtr), 'dword', DllStructGetSize($tPtr), 'dword*', 0)
                If (@error) Or (Not $Ret[0]) Then
                        ExitLoop
                EndIf
                $Result = 1
        Until 1
        _WinAPI_CloseHandle($hProcess[0])
        If Not $Result Then
                Return SetError(1, 0, 0)
        EndIf
        Dim $Result[$Count + 1][2] = [[$Count]]
        For $i = 1 To $Count
                $Result[$i][0] = DllStructGetData($tPtr, 1, $i)
                $Result[$i][1] = _WinAPI_GetModuleFileName($Result[$i][0])
        Next
        Return $Result
EndFunc   ;==>_WinAPI_EnumProcessModules
好像不对,那个loaded*好像没见过
 楼主| 发表于 2011-9-4 23:35:43 | 显示全部楼层
回复 2# netegg


    在汉化的winapiex中看到的 有这么个函数。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2011-9-5 01:17:18 | 显示全部楼层
[au3]; #FUNCTION#;===============================================================================
;
; Name...........: _WinAPI_ProcessGetLoadedModules
; Description ...: Returns an array containing the full path of the loaded modules
; Syntax.........: _WinAPI_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) & ProgAndy
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........;
; Example .......; No
;
;;==========================================================================================
Func _WinAPI_ProcessGetLoadedModules($iPID)
        Local $tModulesStruct = DllStructCreate("hwnd [200]")
        Local $SIZEOFHWND = DllStructGetSize($tModulesStruct) / 200
        Local $hProcess = _WinAPI_OpenProcess(BitOR(0x400, 0x10), False, $iPID)
        If Not $hProcess Then Return SetError(1, 0, -1)
        Local $Ret = DllCall("Psapi.dll", "int", "EnumProcessModules", "ptr", $hProcess, "ptr", DllStructGetPtr($tModulesStruct), "dword", DllStructGetSize($tModulesStruct), "dword*", "")
        If $Ret[4] > DllStructGetSize($tModulesStruct) Then
                $tModulesStruct = DllStructCreate("hwnd [" & $Ret[4] / $SIZEOFHWND & "]")
                $Ret = DllCall("Psapi.dll", "int", "EnumProcessModules", "ptr", $hProcess, "ptr", DllStructGetPtr($tModulesStruct), "dword", $Ret[4], "dword*", "")
        EndIf
        Local $aReturn[$Ret[4] / $SIZEOFHWND]
        For $i = 0 To UBound($aReturn) - 1

                $Ret = DllCall("Psapi.dll", "dword", "GetModuleFileNameExW", "ptr", $hProcess, "ptr", DllStructGetData($tModulesStruct, 1, $i + 1), "wstr", "", "dword", 65536)
                $aReturn[$i] = $Ret[3]

        Next
        _WinAPI_CloseHandle($hProcess)
        Return $aReturn
EndFunc   ;==>_WinAPI_ProcessGetLoadedModules
[/au3]
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-6-17 06:13 , Processed in 0.086917 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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