How to make new hooks
-
Well, that’s my question ^^
I’ve tried to learn something about with IDA, but this thing just cracks my mind %) Because:
1. I found few understandable manuals.
2. Main issue - no manuals about how to do it with FL itself.Soooo…… may be somebody will be the first at writing some tutorial about this ::) Would be very appreciated
-
Ok, I don’t really know what you want to accomplish, so i give a short general answer, mayber that helps
Well it all depends on your background knowledge. If you know c++ you can start and write some simple flhook stuff using existing functions and methods. Thats were the “easy” part ends. If you want to hook some new functions you need to find the entrypoint offset of that funktion and add that to the corresponding array in flhook and also write a simple asm inline function which pushes the given paramaters onto the stack (you also have to watch out for the ecx register, this is sometimes used for the “this” pointer depending on the type of function call) and then call your new function. I don’t know how deep you knowledge is and what you really want to accomplish, but my opinion is: If you don’t know much about pointers, asm etc. try to avoid using it until you are really well familiar with the way it works, because you can have unforeseen results when messing with memory content.
If you are looking for the function offset look in the names list of IDA, the second column is the entrypoint offset which you need to get the program jump into your function.
To hook FL itself you could modifiy the hooking parts of FLHook and throw all the server stuff out - thats what I did to get clienthooking to work.
If you dont know anything about programming… Well better don’t try to learn it with modifying FLHook, pick something not soo heavy. Hopefully the plugin version of Flhook will make things easier then (at least serverside…).
-
The plugin version is designed so you as a developer do not have to create your own hooks. This however relies on me to install new hooks.
So, if you want to have something specific hooked, just make a post in the plugin version forum and I’ll see what i can come up with.
-
Er… may be i wasn’t clear enough.
I want to know how to make and install new hooks on functions, and some manual about it applying to Freelancer (both server and client).
May be with examples of how to obtain address, at which hook must be installed and what must be done at this address. I.e: i thought that i must rewrite address where function is called, but after Schmackbolzen’s post i’m not sure -.-To w0dk4:
yeah, plugin version will solve this problem, but i also want to hook some functions in client, i.e. to upgrade my client anticheat. -
Er… may be i wasn’t clear enough.
I want to know how to make and install new hooks on functions, and some manual about it applying to Freelancer (both server and client).
May be with examples of how to obtain address, at which hook must be installed and what must be done at this address. I.e: i thought that i must rewrite address where function is called, but after Schmackbolzen’s post i’m not sure -.-It’s not that easy. You have to have knowledge about:
- How hooking works in geneneral (basicly you overwrite the jump address of a specific function in the memory area of the program, i think thats what you meant)
- How the stack and the corresponding registers work (x86)
- How function calls work in assembler (x86)
- And of course assembler in general
That’s why no one wants to write a tutorial, it’s just too much you would have to cover. But if you already have that knowedge it should not be that hard to write own hooks (at least for me it wasn’t). Just look how Mc_Horst in FLHook did it.
-
Yeah, the bottom line is you need to understand the concept of assembly and c++ programming and the calling conventions etc. etc. to create new hooks.
The easiest hooks however are those mainly used in FLHook, that hook into the import section of a .dll (i.e. remoteclient.dll imports all the IServerImpl functions from server.dll, that is where FLHook kicks in and intercepts in remoteclient.dll)
-
bump ^^
Well, i made some progress since july and things became more clear to me and i even created simple dll for the client.
But i still can’t fully understand the way how IServerImpl is hooked in flhook. Does it have something to do with vftables?
May be anyone can desribe it more closely?