Little Fighter Empire - Forums
Patching exe to load DLL - Printable Version

+- Little Fighter Empire - Forums (https://lf-empire.de/forum)
+-- Forum: Little Fighter 2 Zone (https://lf-empire.de/forum/forumdisplay.php?fid=7)
+--- Forum: [2.0] Exe Editing (https://lf-empire.de/forum/forumdisplay.php?fid=43)
+---- Forum: Tutorials (https://lf-empire.de/forum/forumdisplay.php?fid=44)
+---- Thread: Patching exe to load DLL (/showthread.php?tid=2521)

Pages: 1 2


Patching exe to load DLL - Boop - 04-05-2009

What you need:
IIDKing v2.01
OllyDBG

1.Open IIDKing and Open LF2 with it.
2.Press "Click to pick DLL(s) and their API(s) to add.
3.Browse to C:/windows/system32/kernel32.dll
4.Scroll down in the window appeared until you see "LoadLibaryA"
5.Select it and press "Add them!"
Should be at this stage:
[Image: iddking.png]

Just press "Add them!!" and you are finished.

IDDKing made a txt file in your lf2 directory. Open it. It should say something like:
Code:
kernel32.dll::LoadLibraryA->call dword ptr [74f134]

Now it is time for Olly.

1.Open lf2 in olly.
*The first line selected is the called the Entry point.
2.Change the call at the entry point to call an empty location at the bottom of the file. For example:
    ASM-Code:
;before
CALL 00445B31
;after
CALL 00446A61


3.Now at 00446A61(or where ever you choose to call), put the original call again( CALL 00445B31).
4.Scroll up a few lines(I did it at 00446A4E), right click, binary> edit. Type in rarara.dll (in the ASCII box).
5.Now scroll back to the call and write PUSH X (X being where you wrote the dll name, for me its 00446A4E).
6.Remember the txt that IDDKing made? Open it and copy paste the call part (call dword ptr [74f134]), then paste it into olly after the push.
7.return to the rest of the code. (RET command, it is a asm command thingy)

Example:
Code:
00446333   . 72 61 72 61 72>ASCII "rarara.dll",0
0044633E  /$ 68 33634400    PUSH lf2_load.00446333                   ; /FileName = "rarara.dll"
00446343  |. FF15 34F17400  CALL DWORD PTR DS:[<&kernel32.LoadLibrar>; \LoadLibraryA
00446349  |. FF15 2E634400  CALL DWORD PTR DS:[44632E]               ;  lf2_load.00445AA1
0044634F  \. C3             RETN

You're done :).

PS: Make sure the exe you are patching is based on the no-num version... Otherwise the DLL won't work.


RE: Patching exe to load DLL - 1477 - 05-04-2009

Grrr....I tried to patch my exe and set up the compiler following your directions over six times....even tried doing it on the original LF2 program. When I tested my own exe, it wouldn't load the DLL file. However, when I patched the original LF2 program, the game freezes up after I highlight and enter 'Fight' on the character selection menu.

I know I compiled the DLL file correctly because the lf2loaddll.exe Silva attached loads the DLL properly. When I opened it up on Olly, I noticed that the EXE was coded differently (although I'm not 100% sure how so).

I'm also 100% sure I followed all the directions properly (I even tried deleting both RADSM and MASM and starting all over again to no avail).

By the way, I have Windows XP Service Pack 3.

So then, what could be the problem :D?


~Solomon Leung


RE: Patching exe to load DLL - Boop - 05-04-2009

The exe you are using probably differs from mine. Get the no num version : http://littlefighter.com/lf2_v20_no_numlock.zip

and try patching it. If it works, it means you're exe is different somehow, so all the patch addresses in the source code have to be changed... Good luck :D.


RE: Patching exe to load DLL - 1477 - 05-05-2009


My EXE is the no num-lock version. And yes, I changed the EXE a bit, but I only ResHacked some background pictures, and changed some ID limits regarding to stage mode.

What could be the problem? I know it's not the "No-Num" problem.


~Solomon Leung


RE: Patching exe to load DLL - Boop - 05-05-2009

(05-05-2009, 04:23 AM)1477 Wrote:  ResHacked some background pictures

That.


RE: Patching exe to load DLL - 1477 - 05-05-2009

I also tried patching the regular, original no-num EXE with no other changes. The program crashes when I enter 'Fight' at the character selection screen.

I'm also sure I compiled the DLL file correctly, because the lf2loaddll.exe works.

Grr...What can be the problem?
Sorry for this seeming spam, but I'm completely clueless as to how I can fix this issue.

EDIT, @Silva: Uploaded DLL, Original EXE, and "Patched" EXE for your viewing :D.


~Solomon Leung


RE: Patching exe to load DLL - Boop - 05-05-2009

Can you upload the exe + dll ?


RE: Patching exe to load DLL - genevrier - 05-11-2009

Silva, I think I know why 1477 can't do the patch:
Quote:7.Jump back to the rest of the code (the line after the Entry Point, 004456E5).

It was previously a call to this loadlibrary procedure, so the way to jumping back is 'retn'. 1477 may use a 'jmp' so the exe is crashed.


RE: Patching exe to load DLL - Boop - 05-11-2009

Thanks, I updated the first post. Hopefully now people will have less problems with it.

*read first post*


RE: Patching exe to load DLL - 1477 - 05-11-2009

Thanks Genevrier and Lord Silva for clearing that part up.
I can now patch the original LF2.exe :D.
Problem Solved.

Sorry for extremely short post :D...


~Solomon Leung