Procedure GetProcessList(List Process.PrsInfo())
If OpenLibrary(0, "psapi.dll")
EnumProcesses = GetFunction(0, "EnumProcesses")
EnumProcessModules = GetFunction(0, "EnumProcessModules")
GetModuleBaseName = GetFunction(0, "GetModuleBaseNameA")
CallFunctionFast(EnumProcesses, ProcessesArray(), #NbProcessesMax, @nProcesses)
For k = 0 To nProcesses >> 2
hProcess = OpenProcess_(#PROCESS_QUERY_INFORMATION | #PROCESS_VM_READ, #False, ProcessesArray(k))
If hProcess
CallFunctionFast(EnumProcessModules, hProcess, @BaseModule, 4, @cbNeeded)
Prozess$ = Space(cbNeeded)
CallFunctionFast(GetModuleBaseName, hProcess, BaseModule, @Prozess$, cbNeeded)
If Len(Prozess$) <> 0 ;z.B. System
;AddGadgetItem(Gadget, -1, Prozess$ + Chr(10) + Str(ProcessesArray(k)))
Debug Prozess$+" "+Str(ProcessesArray(k))
AddElement(Process())
Process()\path=Prozess$
Process()\pid=Str(ProcessesArray(k))
EndIf
CloseHandle_(hProcess)
EndIf
Next
CloseLibrary(0)
EndIf
EndProcedure
沒有留言:
張貼留言