.486
.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\gdi32.inc
include \masm32\include\debug.inc
includelib \masm32\lib\masm32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\gdi32.lib
includelib \masm32\lib\debug.lib
include Tools.inc
include Game.inc
thread_Hotkeys proto :DWORD, :DWORD, :DWORD
thread_Callback proto :DWORD, :DWORD, :DWORD
thread_Hook proto
.data
szWindow db "StarCraft II", 0
.data?
thread_HookID dd ?
thread_HotkeysID dd ?
.code
DllEntryPoint proc hInstDLL:DWORD, lpReason:DWORD, lpReserved:DWORD
mov eax, lpReason
.if (eax == DLL_PROCESS_ATTACH)
; Check that the game version is correct.
mov eax, hook_01
mov al, byte ptr [eax]
mov bl, byte ptr [h01_Reset]
.if (al != bl)
ret
.endif
; Set up the hooking thread.
invoke CreateThread, NULL, 0, addr thread_Hook, 0, 0, addr thread_HookID
.endif
ret
DllEntryPoint endp
thread_Hotkeys proc nCode:DWORD, wParam:DWORD, lParam:DWORD
; Hotkey callback thread.
push eax
mov eax, lParam
or eax, 00FFFFFFh
.if (nCode == HC_ACTION && eax != 0C0FFFFFFh)
.if (wParam == VK_F5)
.if (mState == 00h)
; Change to full mode.
invoke Tools_PatchMemory, hook_01, addr h01_Reset, 6
invoke Tools_PatchMemory, hook_02, addr h02_Full, 2
mov mState, 01h
.elseif (mState == 01h)
; Change to shared vision mode.
invoke Tools_PatchMemory, hook_01, addr h01_Shared, 6
invoke Tools_PatchMemory, hook_02, addr h02_Reset, 2
mov mState, 02h
.elseif (mState == 02h)
; Change to enemy vision mode.
invoke Tools_PatchMemory, hook_01, addr h01_Enemy, 6
invoke Tools_PatchMemory, hook_02, addr h02_Reset, 2
mov mState, 03h
.elseif (mState == 03h)
invoke Tools_PatchMemory, hook_01, addr h01_Reset, 6
invoke Tools_PatchMemory, hook_02, addr h02_Reset, 2
mov mState, 00h
.endif
.endif
.endif
pop eax
invoke CallNextHookEx, thread_HotkeysID, nCode, wParam, lParam
ret
thread_Hotkeys endp
thread_Hook proc
; Hook setting thread.
; Show the ad.
invoke MessageBox, NULL, CTEXT("Injected, you can close this now"), CTEXT("Injection Stats"), MB_OK
; Get the device context.
invoke Tools_GetDeviceContext, addr szWindow
; Get the process ID.
invoke FindWindow, 0, addr szWindow
.if (eax == 0)
invoke FindWindow, addr szWindow, 0 ;korean/taiwan client fix
.endif
invoke GetWindowThreadProcessId, eax, 0
.if (eax != 0)
; Set the hotkey hook.
invoke SetWindowsHookEx, WH_KEYBOARD, addr thread_Hotkeys, NULL, eax
; Save our thread handle and sleep.
mov thread_HotkeysID, eax
invoke Sleep, -1
.endif
thread_Hook endp
End DllEntryPoint
|