Seite 2 von 2

Re: PBOSL Process

Verfasst: 09.07.2010 20:52
von broozar
verzeihung, ist so ein automatismus bei mir.

danke, aber ich bin immernoch auf dem holzweg. ich benutze jetzt
SetRights("SeDebugPrivilege")
aber hinten kommt immer noch ein "Unknown Process" raus. ich hab das als erste zeile in die GetProcessFileName2(PID) Procedure gepackt, testweise in meine helper function die ich aufrufe, ohne erfolg. habe auch MSDN bemüht, aber die c++ samples sind mir zu hoch.

bin noch über #PROCESS_ALL_ACCESS bei OpenProcess_() gestolpert, keine änderung.

Re: PBOSL Process

Verfasst: 09.07.2010 22:54
von edel
Versuch mal das hier :

Code: Alles auswählen

Structure PROCESSINFO
  SnapShot.i
  ProcessEntry.PROCESSENTRY32
  firstrun.i
EndStructure

Global _ExamineProcessInfo.PROCESSINFO

Procedure.i NextProcess()
  
  If _ExamineProcessInfo\firstrun
    _ExamineProcessInfo\firstrun = #False
    ProcedureReturn #True
  EndIf
  
  If Process32Next_(_ExamineProcessInfo\SnapShot, _ExamineProcessInfo\ProcessEntry)    
    ProcedureReturn #True
  EndIf
  
  ProcedureReturn #False
  
EndProcedure

Procedure.s GetProcessName()
  ProcedureReturn PeekS(@_ExamineProcessInfo\ProcessEntry\szExeFile)
EndProcedure

Procedure.i GetProcessPID()
  ProcedureReturn _ExamineProcessInfo\ProcessEntry\th32ProcessID
EndProcedure

Procedure.i ExamineProcess()
  
  Protected result.i
  
  If _ExamineProcessInfo\SnapShot
    CloseHandle_(_ExamineProcessInfo\SnapShot)
  EndIf
  
  _ExamineProcessInfo\firstrun = #True
  
  _ExamineProcessInfo\SnapShot = CreateToolhelp32Snapshot_(#TH32CS_SNAPPROCESS,#Null)
  
  If _ExamineProcessInfo\SnapShot
    
    ClearStructure(_ExamineProcessInfo\ProcessEntry, PROCESSENTRY32)
    
    _ExamineProcessInfo\ProcessEntry\dwSize = SizeOf(PROCESSENTRY32)
    
    result = Process32First_(_ExamineProcessInfo\SnapShot, _ExamineProcessInfo\ProcessEntry)
    
  EndIf 
  
  ProcedureReturn result
EndProcedure

If ExamineProcess()
  
  While NextProcess()
      ip = GetProcessPID()
      name$ = GetProcessName()
    
      Debug Str(ip)+"    "+ name$
      
    
  Wend
  
EndIf

Re: PBOSL Process

Verfasst: 10.07.2010 15:50
von broozar
wow, ich danke dir. klappt hervorragend!