$PBExportHeader$n_processlist.sru forward global type n_processlist from nonvisualobject end type type processentry32 from structure within n_processlist end type end forward type processentry32 from structure unsignedlong dwsize unsignedlong cntusage unsignedlong th32processid longptr th32defaultheapid unsignedlong th32moduleid unsignedlong cntthreads unsignedlong th32parentprocessid long pcpriclassbase unsignedlong dwflags character szexefile[260] end type global type n_processlist from nonvisualobject autoinstantiate end type type prototypes Function longptr CreateToolhelp32Snapshot ( & ulong dwFlags, & ulong th32ProcessID & ) Library "kernel32.dll" Function boolean CloseHandle ( & longptr hObject & ) Library "kernel32.dll" Function boolean Process32First ( & longptr hSnapshot, & Ref PROCESSENTRY32 lppe & ) Library "kernel32.dll" Alias For "Process32FirstW" Function boolean Process32Next ( & longptr hSnapshot, & Ref PROCESSENTRY32 lppe & ) Library "kernel32.dll" Alias For "Process32NextW" Function longptr OpenProcess ( & ulong dwDesiredAccess, & boolean bInheritHandle, & ulong dwProcessId & ) Library "kernel32.dll" Function boolean QueryFullProcessImageName ( & longptr hProcess, & ulong dwFlags, & Ref string lpExeName, & Ref ulong lpdwSize & ) Library "kernel32.dll" Alias For "QueryFullProcessImageNameW" end prototypes forward prototypes public function long processlist (ref unsignedlong aul_processid[], ref string as_exefilename[], ref string as_fullexefile[]) end prototypes public function long processlist (ref unsignedlong aul_processid[], ref string as_exefilename[], ref string as_fullexefile[]);// -------------------------------------------------------------- // ProcessList - Return a list of processes // -------------------------------------------------------------- PROCESSENTRY32 lstr_pe32 Constant ULong TH32CS_SNAPPROCESS = 2 Constant ULong PROCESS_QUERY_INFORMATION = 1024 // 0x0400 Constant ULong PROCESS_NAME_NATIVE = 1 Environment le_env Long ll_next Longptr lptr_SnapShot, lptr_Process String ls_empty[], ls_FullName ULong lul_empty[], lul_dwSize aul_ProcessId = lul_empty as_ExeFileName = ls_empty as_FullExeFile = ls_empty GetEnvironment(le_env) If le_env.ProcessBitness = 32 Then lstr_pe32.dwSize = 556 Else lstr_pe32.dwSize = 568 End If lptr_SnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0) If lptr_SnapShot > 0 Then If Process32First(lptr_SnapShot, lstr_pe32) Then Do If lstr_pe32.th32ProcessID > 0 Then lptr_Process = OpenProcess(PROCESS_QUERY_INFORMATION, & False, lstr_pe32.th32ProcessID) If lptr_Process > 0 Then ll_next ++ aul_ProcessId[ll_next] = lstr_pe32.th32ProcessID as_ExeFileName[ll_next] = String(lstr_pe32.szExeFile) as_FullExeFile[ll_next] = "" lul_dwSize = 260 ls_FullName = Space(lul_dwSize) If QueryFullProcessImageName(lptr_Process, & 0, ls_FullName, lul_dwSize) Then as_FullExeFile[ll_next] = ls_FullName End If CloseHandle(lptr_Process) End If End If Loop While Process32Next(lptr_SnapShot, lstr_pe32) End If CloseHandle(lptr_SnapShot) End If Return ll_next end function on n_processlist.create call super::create TriggerEvent( this, "constructor" ) end on on n_processlist.destroy TriggerEvent( this, "destructor" ) call super::destroy end on
- Sources
- TopWiz
- processlist
- PB
- n_processlist.sru
File: n_processlist.sru
Size: 3528
Date: Fri, 30 May 2025 01:46:34 +0200
Size: 3528
Date: Fri, 30 May 2025 01:46:34 +0200
- nonvisualobject autoinstantiate n_processlist(sru)