07-22-2009, 01:03 PM
(07-22-2009, 12:53 PM)naruto hyuuga Wrote: i used the newest exe to load the dll when i build it doesn't work
am i suppose to modify the "?"
in hDC dd ? because i didn't and its not working
i.e not making background transparent
rarara.asm:
Code:
; Based on Masm32 Dll Plugin Example for Damnation by Drakken
; Modified for LF2 by Silva
; Contributions by: genevrier
.386
.Model Flat, StdCall
OPTION CASEMAP :NONE
include \masm32\include\windows.inc
include \masm32\include\gdi32.inc
include \masm32\include\masm32.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\masm32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\gdi32.lib
include rarara.inc
include generic.inc
.code
DllEntryPoint proc hInstDLL:DWORD, reason:DWORD, unused:DWORD
mov eax,reason
.if eax == DLL_PROCESS_ATTACH ; Called when our dll loaded
call DLLStartup ; Memory patches and jmp patches
.elseif reason == DLL_PROCESS_DETACH
push NULL
call PostQuitMessage
.endif
ret
DllEntryPoint endp
DLLStartup proc
; Here you can put the patches you want to use when the dll loads
; Also you should put all your jump patches here
invoke JmpPatch,00401290h, addr draw_text
ret
DLLStartup endp
End DllEntryPoint
generic.inc:
Code:
.data
hDC dd ?
.code
draw_text proc
var_4 = dword ptr -4
lpString = dword ptr 4
arg_4 = dword ptr 8
arg_8 = dword ptr 0Ch
arg_C = dword ptr 10h
push esi
mov esi, [esp+4+lpString]
mov eax, [esi]
mov edx, [eax+44h]
push edi
lea ecx, [esp+8+lpString]
push ecx
push esi
call edx ;Magic Call #1
mov edi, eax
test edi, edi
jl short loc_4012FC
mov eax, [esp+0Ch+arg_4]
mov ecx, [esp+0Ch]
push ebx
push TRANSPARENT ; mode
push ecx ; HDC
mov hDC, ecx
call ds:SetBkMode
mov edx, [esp+10h+arg_8]
mov eax, [esp+10h]
push edx ; COLORREF
push eax ; HDC
call ds:SetTextColor
mov ebx, [esp+10h+lpString]
push ebx ; lpString
call ds:lstrlenA
mov ecx, [esp+24h]
mov edx, [esp+10h+arg_C]
push eax ; int
mov eax, [esp+14h]
push ebx ; LPCSTR
push ecx ; int
push edx ; int
push eax ; HDC
call ds:TextOutA
mov edx, [esp+10h]
mov ecx, [esi]
mov eax, [ecx+68h]
push edx
push esi
call eax ; Magic Call 2
mov eax, edi
pop ebx
loc_4012FC: ; CODE XREF: sub_401290+17j
pop edi
pop esi
ret
draw_text endp
I've also attached the compiled dll, which I tested with the new exe, and it works perfectly. If you still can't get it to work, just give up.
10 ʏᴇᴀʀs sɪɴᴄᴇ ɪʀᴄ ɢᴏᴏᴅ.ɪ ᴡᴀʟᴋ ᴛʜʀᴏᴜɢʜ ᴛʜᴇ ᴇᴍᴘᴛʏ sᴛʀᴇᴇᴛs ᴛʀʏɪɴɢ ᴛᴏ ᴛʜɪɴᴋ ᴏғ sᴏᴍᴇᴛʜɪɴɢ ᴇʟsᴇ ʙᴜᴛ ᴍʏ ᴘᴀᴛʜ ᴀʟᴡᴀʏs ʟᴇᴀᴅs ᴛᴏ ᴛʜᴇ ɪʀᴄ. ɪ sᴛᴀʀᴇ ᴀᴛ ᴛʜᴇ sᴄʀᴇᴇɴ ғᴏʀ ʜᴏᴜʀs ᴀɴᴅ ᴛʀʏ ᴛᴏ sᴜᴍᴍᴏɴ ᴛʜᴇ ɢᴏᴏᴅ ɪʀᴄ. ɪ ᴡᴀᴛᴄʜ ᴏᴛʜᴇʀ ɪʀᴄ ᴄʜᴀɴɴᴇʟs ʙᴜᴛ ɪᴛ ɪs ɴᴏ ɢᴏᴏᴅ. ɪ ᴘᴇsᴛᴇʀ ᴢᴏʀᴛ ᴀɴᴅ ᴛʀʏ ᴛᴏ ʀᴇsɪsᴛ ʜɪs sᴇxɪɴᴇss ʙᴜᴛ ɪᴛ ɪs ᴀʟʟ ᴍᴇᴀɴɪɴɢʟᴇss. ᴛʜᴇ ᴇɴᴅ ɪs ɴᴇᴀʀ.ɪ ᴛʜᴇɴ ᴜsᴜᴀʟʟʏ ʀᴇᴀᴅ sᴏᴍᴇ ᴏʟᴅ ɪʀᴄ ʟᴏɢs ᴀɴᴅ ᴄʀʏ ᴍʏsᴇʟғ ᴛᴏ sʟᴇᴇᴘ.