Wie kann ich x32 UND x64 Prozesse mit allen Infos (Structure ProcessEntry32) ermitteln ?
Ich bekomme nur von den x86 Prozessen alle Daten (Iconhandle,Name,Pfad usw)
nur von den x64'ern nichts ausser der PID...
(Im Namen sind z.B. wirre Zeichen)
Ich nutze von Thorium die Prozedur um die Daten zu ermitteln :
Code: Alles auswählen
Structure PROCESSENTRY32s
dwsize.l
cntusage.l
th32ProcessID.l
th32DefaultHeapID.l
th32ModuleID.l
cntThreads.l
th32ParentProcessID.l
pcPriClassBase.l
dwFlags.l
szExeFile.s{1024}
EndStructure
Structure PLI_ProcessInfo
Name.s
Path.s
PID.i
ParentID.i
ThreadsCnt.i
PriorityClass.i
Icon.i
WorkingSetSize.i
EndStructure
;
Procedure GetProcessList(List Tasks.PLI_ProcessInfo(), Icons = #False)
;######
;###### Author : Thorium
;###### Quelle : http://www.purebasic.fr/german/viewtopic.php?f=11&t=12401
;###### Modifiziert von Array auf LinkList
;######
ClearList(Tasks())
Protected ProcessSnapHandle, ModuleSnapHandle, RetVal, i, ProcessID, ExePath, IconHandle, SystemAppIcon
Protected ProcessEntry.PROCESSENTRY32s
Protected ModuleEntry.MODULEENTRY32
Protected ProcessListCnt = 0
ProcessEntry\dwSize = SizeOf(ProcessEntry)
ModuleEntry\dwSize = SizeOf(ModuleEntry)
;laufende Prozesse ermitteln
ExePath = AllocateMemory(1024)
ProcessSnapHandle = CreateToolhelp32Snapshot_(#TH32CS_SNAPPROCESS,0)
RetVal = Process32First_(ProcessSnapHandle,ProcessEntry)
While RetVal = #True
ProcessListCnt = ProcessListCnt + 1
AddElement(Tasks())
Tasks()\Name = PeekS(@ProcessEntry\szExeFile)
Tasks()\PID = ProcessEntry\th32ProcessID
Tasks()\ParentID = ProcessEntry\th32ParentProcessID
Tasks()\ThreadsCnt = ProcessEntry\cntThreads
Tasks()\PriorityClass = ProcessEntry\pcPriClassBase
;Tasks()\WorkingSetSize = GetMemoryUsage(Tasks()\PID)
Debug Tasks()\Name
If ProcessEntry\th32ProcessID <> 0
ModuleSnapHandle = CreateToolhelp32Snapshot_(#TH32CS_SNAPMODULE,ProcessEntry\th32ProcessID)
If ModuleSnapHandle
If Module32First_(ModuleSnapHandle,ModuleEntry)
Tasks()\Path = GetPathPart(Trim(PeekS(@ModuleEntry\szExePath)))
EndIf
CloseHandle_(ModuleSnapHandle)
EndIf
EndIf
If Icons
PokeS(ExePath,Tasks()\Path + Tasks()\Name)
IconHandle = ExtractIcon_(0,ExePath,0)
If IconHandle = 0
IconHandle = SystemAppIcon
EndIf
Tasks()\Icon = IconHandle
EndIf
RetVal = Process32Next_(ProcessSnapHandle,ProcessEntry)
Wend
CloseHandle_(ProcessSnapHandle)
FreeMemory(ExePath)
ProcedureReturn ListSize(Tasks())
EndProcedure