Home > database >  Excuse me, how to achieve operation in PB in the user name of a process?
Excuse me, how to achieve operation in PB in the user name of a process?

Time:09-21

Excuse me, how to achieve operation in PB in the user name of a process?
A process name known, how to get Windows "task manager" - "process" in name of "image" of "user name"?

CodePudding user response:

Won't, help,

CodePudding user response:

Don't know, search the MSDN

CodePudding user response:

The search on the net, as without this information

CodePudding user response:

Call the Windows API

CodePudding user response:

Can say about it?

CodePudding user response:

A gain process list example the following code into w_demo. SRW import PBL can

Mainly used several WINDOWS API:

EnumProcesses//The EnumProcesses function retrieves The process identifier for each process object in The system
OpenProcess

EnumProcessModules//The EnumProcessModules function retrieves a handle for each module in The specified process.

GetModuleFileNameEx//process name

API statement example in a

 $PBExportHeader $w_demo. SRW 
Forward
Global type w_demo from window
End type
Type lb_1 from listbox within w_demo
End type
End forward

Global type w_demo from window
The integer width=1847
The integer height=1612
Boolean titlebar=true
String title="EnumProcesses Demo (F5 To Refresh)"
Boolean controlmenu=true
Boolean minbox=true
Boolean maxbox=true
Boolean the resizable=true
Long backcolor=67108864
String icon="Information! "
Boolean center=true
Lb_1 lb_1
End type
Global w_demo w_demo

The type as
The Function Long EnumProcesses (Ref ULong lpidProcess [], Long cb, Ref Long cbNeeded) Library 'psapi. DLL'
The Function Long OpenProcess (Long dwDesiredAccess, Int bInheritHandle, Long dwProcessId) Library 'kernel32. DLL'
The Function Long GetModuleFileNameEx (Long hProcess, Long hModule, Ref String ModuleName, Long nSize) Library 'psapi. DLL' Alias For "GetModuleFileNameExA; ANSI
"The Function Long EnumProcessModules (Long hProcess, Ref ULong lphModule [], Long cb, Ref Long cbNeeded) Library 'psapi. DLL'
The Function Long GetModuleBaseName (Long hProcess, Long hModule, Ref String lpBaseName, Long nSize) Library 'psapi. DLL' Alias For "GetModuleBaseNameA; ANSI
"The Function Long CloseHandle (Long Handle) Library 'kernel32. DLL'
The FUNCTION ulong IsWindow (ulong HWND) LIBRARY "user32. DLL
"The FUNCTION ulong GetWindowText (ulong HWND, ref string lpString, ulong CCH) LIBRARY "user32. DLL" ALIAS FOR "GetWindowTextA; ANSI
"
End as
Forward as
Public subroutine of_enumprocesses ()
End as

Public subroutine of_enumprocesses (); Constant Long PROCESS_VM_READ=16
Constant Long PROCESS_QUERY_INFORMATION=1024
Constant Long PROCESS_ALL_ACCESS=2035711
Long ll_size
Long ll_index
Long ll_index1
Long ll_index2
Long ll_hprocess
Long ll_modulebytes
Long ll_processbytes
Long ll_modulecount
Long ll_processcount

String ls_modulename

ULong ll_modules []
ULong ll_processes []


//Set cursor.
SetPointer (HourGlass!

//Reset the listbox.
For ll_index=lb_1. TotalItems () To Step 1-1
Lb_1. Called DeleteItem (ll_index)
Next

//Initialize the Process array.
For ll_index1=1024 To 1 Step - 1
Ll_processes [ll_index1]=0
Next

//Initialize the Module array.
For ll_index2=1024 To 1 Step - 1
Ll_modules [ll_index2]=0
Next

//the Size of each array (i.e. for 1024 x 4 bytes).
Ll_size=4096

//Get the the Processes.
If EnumProcesses (ll_processes [], ll_size ll_processbytes) & gt; 0 Then
//Determine the number of the Processes.
Ll_processcount=(ll_processbytes/4)

//Loop through the Processes.
For ll_index1=1 To ll_processcount
//Get the access rights to read and query Process.
Ll_hprocess=OpenProcess (PROCESS_ALL_ACCESS, 0, ll_processes [ll_index1])
//)


//Ensure we have the handle to a process.
If ll_hprocess & gt; 0 Then

//Get the Moudles for a specified Process.
If EnumProcessModules (ll_hprocess, ll_modules [], ll_size, ll_modulebytes) & lt;> 0 Then
//Determine the number of Modules.
Ll_modulecount=(ll_modulebytes/4)

//I could have continued to loop through all of these modules for each process,
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related