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*好像没见过