| |
|
|
|
Description:
CreateToolhelp32Snapshot power a Schnappschuß of ongoing Prozessen, Threads and DLL’s.
Deklaration:
Def @CreateToolhelp32Snapshot(2) !kernel32,CreateToolhelp32Snapshot
Parameter:
1.Parameter: ? Happen?, The The manner the Schnappschusses to determine as LongIntwert. ? Happen? can with | add go => -$80000000 = Schnappschußhandle can vererbt go. -$4 = Threadliste becomes created. -$2 = Prozessliste becomes created. -$8 = From one Process loaded DLL’s go gelistet. -$1 = Created Heapliste one Prozesses. 2.Parameter: ID one Prozesses (0 for actually Process). If $8 or $1 not specify get, has this Parameter no weight.
Return Value:
Open lever on the Schnappschuß.
Examples:
CompileMarkSeparationDef @CreateToolhelp32Snapshot(2) !"kernel32","CreateToolhelp32Snapshot"
Def @Process32First(2) !"kernel32","Process32First"
Def @Process32Next(2) !"kernel32","Process32Next"
Def @CloseHandle(1) !"kernel32","CloseHandle"
Def @TerminateProcess(2) !"kernel32","TerminateProcess"
Def @OpenProcess(3) !"kernel32","OpenProcess"
Def &TH32CS_SNAPPROCESS 2
Def &PROCESS_TERMINATE 1
Declare PROCESSENTRY#
Struct PROCESSENTRY32 =dwSize&,cntUsage&,th32ProcessID&,th32DefaultHeapID&,th32ModuleID&,cntThreads&,th32ParentProcessID&,pcPriClassBase&,dwFlags&,szExeFile$(260)
Proc actua
parameters prozess$, delete%
declare lenname&
declare hSnapshot&, Result&, hProcess&, proz_anzahl&, term_ok&
Dim PROCESSENTRY#, PROCESSENTRY32
Long PROCESSENTRY#,0 =296
clear proz_anzahl&, term_ok&
lenname& = len(prozess$)
prozess$ = Lower$(prozess$)
hSnapshot& = CreateToolhelp32Snapshot(&TH32CS_SNAPPROCESS, 0)
IfNot hSnapshot& = -1
Result& = Process32First(hSnapshot&, PROCESSENTRY#)
messagebox(str$(GetLastError()),"Err",48)
messagebox(str$(Result&),str$(hSnapshot&),48)
While Result&
messagebox(Lower$(Right$(PROCESSENTRY#.szExeFile$,lenname&)),"",48)
if Lower$(Right$(PROCESSENTRY#.szExeFile$,lenname&)) = prozess$
if delete% = 1
hProcess& = @OpenProcess(&PROCESS_TERMINATE, 0, PROCESSENTRY#.th32ProcessID&)
sendmessage(hProcess&,$0010,0,0)
term_ok& = @TerminateProcess(hProcess&, 0)
@CloseHandle(hProcess&)
sleep 100
endif
proz_anzahl& = proz_anzahl& + (delete%<>1) + term_ok&
endif
Result& = Process32Next(hSnapshot&, PROCESSENTRY#)
EndWhile
endif
@CloseHandle(hSnapshot&)
Dispose PROCESSENTRY#
return proz_anzahl&
Endproc
@WinEXEC("NotePad.exe",1)
Sleep 10000
actua s3>"Notepad.exe",1
[keywords:2a51069288] Tasks processes lists List Taskmanager DLLs Threads Show [/keywords:2a51069288] |
|
|
| |
|
|