$aProc_List = _ProcessListEx() $sProc_List = "" For $i = 1 To $aProc_List[0][0] $sProc_List &= $aProc_List[$i][0] & ":" & $aProc_List[$i][1] & " [" & $aProc_List[$i][2] & "]" & @CRLF Next MsgBox(0, "Process by MrCreatoR ( _ProcessListEx())", $sProc_List) ;======================================================================== Func _ProcessListEx($sProcName = "") Local $aProcList If $sProcName <> "" Then $aProcList = ProcessList($sProcName) Else $aProcList = ProcessList() EndIf If @error Then Return SetError(1, 0, '') Local $hKernel32_Dll = DllOpen('Kernel32.dll') Local $hPsapi_Dll = DllOpen('Psapi.dll') Local $aRet, $sFilePath, $tFilePath Local $aRet_List[$aProcList[0][0]+1][3] If $hKernel32_Dll = -1 Then Return SetError(2, 0, '') If $hPsapi_Dll = -1 Then $hPsapi_Dll = DllOpen(@SystemDir & '\Psapi.dll') If $hPsapi_Dll = -1 Then $hPsapi_Dll = DllOpen(@WindowsDir & '\Psapi.dll') If $hPsapi_Dll = -1 Then Return SetError(3, 0, '') For $i = 1 To UBound($aProcList) - 1 $sFilePath = "" $tFilePath = DllStructCreate("wchar[300]") ; Открытие процесса $aRet = DllCall($hKernel32_Dll, 'ptr', 'OpenProcess', 'int', BitOR(0x400, 0x10), 'int', 0, 'int', $aProcList[$i][1]) If $aRet[0] <> 0 Then ; Получение пути к файлу образа DllCall($hPsapi_Dll, "dword", "GetModuleFileNameExW", _ "ptr", $aRet[0], "ptr", 0, "ptr", DllStructGetPtr($tFilePath), "dword", 300) ; Закрытие описателя и возврат значения DllCall($hKernel32_Dll, 'ptr', 'CloseHandle', 'ptr', $aRet[0]) $sFilePath = DllStructGetData($tFilePath, 1) EndIf $aRet_List[0][0] += 1 $aRet_List[$aRet_List[0][0]][0] = $aProcList[$i][0] ;Process Name $aRet_List[$aRet_List[0][0]][1] = $aProcList[$i][1] ;PID (Process ID) $aRet_List[$aRet_List[0][0]][2] = $sFilePath ;Process File Path $tFilePath = 0 Next DllClose($hKernel32_Dll) DllClose($hPsapi_Dll) ReDim $aRet_List[$aRet_List[0][0] + 1][3] If $aRet_List[0][0] < 1 Then Return SetError(4, 0, '') Return $aRet_List EndFunc |