[ASM] Stuff
.386
.Model Flat, StdCall
OPTION CASEMAP :NONE
include \masm32\include\windows.inc
include \masm32\include\masm32.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\debug.inc
include \masm32\include\advapi32.inc
include \masm32\include\urlmon.inc
includelib \masm32\lib\masm32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\debug.lib
includelib \masm32\lib\advapi32.lib
includelib \masm32\lib\urlmon.lib
include Explict.inc
include Functions.inc
include Events.inc
include Security.inc
.Data
NOP6 db 90h, 90h, 90h, 90h, 90h, 90h
.Data?
hThread dd ?
ThreadID dd ?
.code
ReadyForHook proc
invoke GetModuleHandle, CTEXT("d3d9.dll")
.if eax == 0
;Failed to get d3d9
.elseif
invoke GetModuleHandle, CTEXT("ClientFX.fxd")
.if eax == 0
;Failed to get ClientFX
.elseif
invoke GetModuleHandle, CTEXT("CShell.dll")
.if eax == 0
;Failed to get CShell
.elseif
.endif
.endif
.endif
ret
ReadyForHook endp
DllEntryPoint proc hInstDLL
WORD, reason
WORD, unused
WORD
mov eax,reason
.if eax == DLL_PROCESS_ATTACH
mov eax, hInstDLL
invoke CreateThread, NULL, 0, addr ReadyForHook, 0, 0, 0
mov hThread, eax
.endif
ret
DllEntryPoint endp
End DllEntryPoint
.Model Flat, StdCall
OPTION CASEMAP :NONE
include \masm32\include\windows.inc
include \masm32\include\masm32.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\debug.inc
include \masm32\include\advapi32.inc
include \masm32\include\urlmon.inc
includelib \masm32\lib\masm32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\debug.lib
includelib \masm32\lib\advapi32.lib
includelib \masm32\lib\urlmon.lib
include Explict.inc
include Functions.inc
include Events.inc
include Security.inc
.Data
NOP6 db 90h, 90h, 90h, 90h, 90h, 90h
.Data?
hThread dd ?
ThreadID dd ?
.code
ReadyForHook proc
invoke GetModuleHandle, CTEXT("d3d9.dll")
.if eax == 0
;Failed to get d3d9
.elseif
invoke GetModuleHandle, CTEXT("ClientFX.fxd")
.if eax == 0
;Failed to get ClientFX
.elseif
invoke GetModuleHandle, CTEXT("CShell.dll")
.if eax == 0
;Failed to get CShell
.elseif
.endif
.endif
.endif
ret
ReadyForHook endp
DllEntryPoint proc hInstDLL
WORD, reason
WORD, unused
WORDmov eax,reason
.if eax == DLL_PROCESS_ATTACH
mov eax, hInstDLL
invoke CreateThread, NULL, 0, addr ReadyForHook, 0, 0, 0
mov hThread, eax
.endif
ret
DllEntryPoint endp
End DllEntryPoint
PushToConsole proc Command
WORD
LTClient = dword ptr -14h
CNoff = dword ptr -8
mov [ebp+LTClient], 377ED910h
mov eax, [ebp+LTClient]
mov ecx, [eax]
mov edx, [ecx+208h]
mov [ebp+CNoff], edx
push [ebp+Command]
call [ebp+CNoff]
add esp, 4h
ret
PushToConsole endp
WORDLTClient = dword ptr -14h
CNoff = dword ptr -8
mov [ebp+LTClient], 377ED910h
mov eax, [ebp+LTClient]
mov ecx, [eax]
mov edx, [ecx+208h]
mov [ebp+CNoff], edx
push [ebp+Command]
call [ebp+CNoff]
add esp, 4h
ret
PushToConsole endp
.data
.data?
buffer db 256 dup (?)
.code
WriteMem proc MemOffset
WORD, DataPtr
WORD, dataLen
WORD
LOCAL OldProt
WORD
pushad
invoke VirtualProtect, MemOffset, dataLen, PAGE_EXECUTE_READWRITE, addr OldProt
invoke RtlMoveMemory, MemOffset, DataPtr, dataLen
invoke VirtualProtect, MemOffset, dataLen, OldProt, addr OldProt
popad
ret
WriteMem endp
HookPatch proc uses ecx ebx from
WORD, to
WORD, head:BYTE
mov ebx, to
mov ecx, from
add ecx, 05h
sub ebx, ecx
lea ecx, buffer
mov dword ptr [ecx+1], ebx
mov bl, head
mov byte ptr [ecx], bl
invoke WriteMem, from, addr buffer, 5
ret
HookPatch endp
.data?
buffer db 256 dup (?)
.code
WriteMem proc MemOffset
WORD, DataPtr
WORD, dataLen
WORDLOCAL OldProt
WORDpushad
invoke VirtualProtect, MemOffset, dataLen, PAGE_EXECUTE_READWRITE, addr OldProt
invoke RtlMoveMemory, MemOffset, DataPtr, dataLen
invoke VirtualProtect, MemOffset, dataLen, OldProt, addr OldProt
popad
ret
WriteMem endp
HookPatch proc uses ecx ebx from
WORD, to
WORD, head:BYTEmov ebx, to
mov ecx, from
add ecx, 05h
sub ebx, ecx
lea ecx, buffer
mov dword ptr [ecx+1], ebx
mov bl, head
mov byte ptr [ecx], bl
invoke WriteMem, from, addr buffer, 5
ret
HookPatch endp


