; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
.486 ; create 32 bit code
.model flat, stdcall ; 32 bit memory model
option casemap :none ; case sensitive
; include files
; ~~~~~~~~~~~~~
include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include HackLib.inc
; libraries
; ~~~~~~~~~
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib HackLib.lib
; ----------------------------------------
; prototypes for local procedures go here
; ----------------------------------------
.data
hInstance dd ?
junk byte 20 dup (000h)
n1 db "DDInitFullScreen",0
n2 db "DDInitWindowScreen",0
ndll db "dxengine.dll",0
nwindow db "window.dll",0
hdll1 HANDLE ?
hdll2 HANDLE ?
aDDInitFullScreen PVOID ?
aDDInitWindowScreen PVOID ?
oldprotect DWORD ?
noldprotect DWORD ?
.code
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
ThreadProc proc p1:DWORD, p2:DWORD
invoke LoadLibrary,addr nwindow
mov hdll2, eax
invoke GetModuleHandle,addr ndll
mov hdll1, eax
invoke GetProcAddress,hdll1,addr n1
mov aDDInitFullScreen, eax
invoke GetProcAddress,hdll2,addr n2
mov aDDInitWindowScreen, eax
invoke VirtualProtect,aDDInitFullScreen,5,PAGE_EXECUTE_READWRITE,addr oldprotect
invoke HookFunctionJMP, aDDInitFullScreen, aDDInitWindowScreen,addr junk,5
invoke VirtualProtect,aDDInitFullScreen,5,oldprotect,addr noldprotect
invoke ExitThread,0
ret
ThreadProc endp
LibMain proc instance:DWORD,reason:DWORD,unused:DWORD
.if reason == DLL_PROCESS_ATTACH
push instance
pop hInstance
mov eax, TRUE
invoke CreateThread,0,0,addr ThreadProc,0,0,addr junk
.elseif reason == DLL_PROCESS_DETACH
.elseif reason == DLL_THREAD_ATTACH
.elseif reason == DLL_THREAD_DETACH
.endif
ret
LibMain endp
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
comment * -----------------------------------------------------
You should add the procedures your DLL requires AFTER
the LibMain procedure. For each procedure that you
wish to EXPORT you must place its name in the "sp3W.def"
file so that the linker will know which procedures to
put in the EXPORT table in the DLL. Use the following
syntax AFTER the LIBRARY name on the 1st line.
LIBRARY sp3W
EXPORTS YourProcName
EXPORTS AnotherProcName
------------------------------------------------------- *
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
end LibMain