; killbart1.asm
; Help from Tedd,sinsi,Nordwind64,Herbert,...
;
; Terminates bartshel.exe!!
; (A badly behaved program no longer needed after connection.)
;
; FREEWARE, but not finished yet
;
; Future plans: Detect when connected and run 10 secs after connection
.586
.model flat, stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib
include \masm32\include\user32.inc
includelib \masm32\lib\user32.lib
.data
AppName db "Terminate",0
nice_guy db "bartshel.exe",0
errSnapshot db "CreateToolhelp32Snapshot failed.",0
errProcFirst db "Process32First failed.",0
.data?
hSnapshot HANDLE ?
ProcEnt PROCESSENTRY32 <?>
.code
start:
invoke CreateToolhelp32Snapshot, TH32CS_SNAPPROCESS,0
.IF (eax != INVALID_HANDLE_VALUE)
mov hSnapshot,eax
mov [ProcEnt.dwSize],SIZEOF ProcEnt
invoke Process32First, hSnapshot,ADDR ProcEnt
.IF (eax)
@@:
invoke lstrcmpi, ADDR nice_guy ,ADDR [ProcEnt.szExeFile]
.IF (eax == 0)
invoke OpenProcess, PROCESS_TERMINATE,FALSE,[ProcEnt.th32ProcessID]
.IF (eax)
invoke TerminateProcess, eax,0
.ELSE
;failed for some reason
.ENDIF
.ENDIF
invoke Process32Next, hSnapshot,ADDR ProcEnt
test eax,eax
jnz @B
.ELSE
invoke MessageBox, NULL,ADDR errProcFirst,ADDR AppName,MB_OK or MB_ICONERROR
.ENDIF
invoke CloseHandle, hSnapshot
.ELSE
invoke MessageBox, NULL,ADDR errSnapshot,ADDR AppName,MB_OK or MB_ICONERROR
.ENDIF
invoke ExitProcess, NULL
end start
'Help?' - that's a verbatim copy! :dazzled:
(Wait, you changed "evil" to "nice_guy" and you're killing bartshel rather than notepad ::))
http://www.masm32.com/board/index.php?topic=7304.msg54027#msg54027