View previous topic :: View next topic |
Author |
Message |
chaoslink
Joined: 23 Aug 2006 Posts: 37
|
Posted: Mon Jun 25, 2007 19:59 Post subject: |
|
|
Papillon - You may be interested in what I've done with Detours. I have it hooking for both windows and linux (Detours also provides a "preload" type function such that you can spawn a child process with a specific DLL loaded).
I'm still fixing up some issues, but it is finally coming along. |
|
Back to top |
|
|
mckillroy
Joined: 16 May 2005 Posts: 40
|
Posted: Sat Nov 17, 2007 11:25 Post subject: |
|
|
Did anyone make Detours compile under VC++Express 2005?
The downloadable package relies on a make file with platform switches and such - would be convenient to have it inside the project. _________________ /McKillroy
a.k.a Yorlik |
|
Back to top |
|
|
chaoslink
Joined: 23 Aug 2006 Posts: 37
|
Posted: Sat Nov 17, 2007 17:59 Post subject: |
|
|
I actually am not using all of detours, just some code ripped out of it, so I can't help you there.
I'm still blocked because I'm unsure what the correct window method signature for SetLocalString is (the code using madcodehook has some assembly around it setting up the stack properly) |
|
Back to top |
|
|
mckillroy
Joined: 16 May 2005 Posts: 40
|
Posted: Sat Nov 17, 2007 23:32 Post subject: |
|
|
Just finished my first successful server session using detours.
I ripped out some stuff from the withdll.cpp demo to make it work.
I could play the demo module with the time plugin.
Now cross your fingers it will work on wine/Solaris too !
Cheers
McK.
a.k.a. Yorlik
EDIT: It worked !
HEUREKA ! (again)
EDIT2: I posted a quick and dirty tutorial on how to do it on my website:
http://arcanima.org/node/1077
Its not yet really beutiful, I just wanted to provide a quick orientation how I made it work.
Hopefully things can go upstream soonish.
Cheers! _________________ /McKillroy
a.k.a Yorlik |
|
Back to top |
|
|
mckillroy
Joined: 16 May 2005 Posts: 40
|
Posted: Mon Nov 19, 2007 1:39 Post subject: |
|
|
I changed the code a little today.
The solution now no longer needs the detoured.dll file as usually intended by the SDk authors for control reasons, since I elimeinated all references to this nag library and its exported function.
I'm going to change the controller.cpp and move the code I imported there to the sources for the modified microsoft static library - thus the GPLed code of NWNX4 won't get polluted with Microsofts proprietary stuff I am using here - only a function call and a header file include will be left.
If anyone is interested in the code let me know.
I'd be happy to have some people helping test it for stability on wine and the other plugins as well, since I only tried the time plugin so far.
I believe its a safe and stable replacement for madchook. _________________ /McKillroy
a.k.a Yorlik |
|
Back to top |
|
|
GodBeastX
Joined: 09 Aug 2006 Posts: 65
|
Posted: Tue Nov 20, 2007 18:41 Post subject: |
|
|
I found a light CDetour class someone made for game hacking. Works great, replaces enough opcodes to get a JMP op and then passes you pointer to original to call. Easy as pie, and you just link in 2 .cpp files to your project. I'm using it to hook socket calls on NWN2Server to stop the flooding. |
|
Back to top |
|
|
mckillroy
Joined: 16 May 2005 Posts: 40
|
Posted: Tue Nov 20, 2007 21:06 Post subject: |
|
|
GodBeastX wrote: | I found a light CDetour class someone made for game hacking. Works great, replaces enough opcodes to get a JMP op and then passes you pointer to original to call. Easy as pie, and you just link in 2 .cpp files to your project. I'm using it to hook socket calls on NWN2Server to stop the flooding. |
Linky ?? _________________ /McKillroy
a.k.a Yorlik |
|
Back to top |
|
|
mckillroy
Joined: 16 May 2005 Posts: 40
|
Posted: Tue Nov 20, 2007 21:28 Post subject: |
|
|
I just uploaded the altered test distribution I used to make the version using detours.
If anyone is interested send me a note and register an account on
http://www.arcanima.org
I will activate the account and give you SVN access then.
The (password protected) SVN repository is at
https://svn.arcanima.org/nwnx4exp
Mind the "S" in the https - or you'll get an error when downloading.
I changed some filenames and added a special tag to avoid naming conflicts with the official distribution here.
Once we have a version on NWNX4 which is stable on wine, the SVN repository will get deleted, because I don't want to create a fork.
Its just a temporary development help to review the code and test and maybe incorporate it after modifications.
Cheers _________________ /McKillroy
a.k.a Yorlik
Last edited by mckillroy on Wed Nov 21, 2007 21:02; edited 1 time in total |
|
Back to top |
|
|
GodBeastX
Joined: 09 Aug 2006 Posts: 65
|
|
Back to top |
|
|
Darnah
Joined: 06 Jun 2007 Posts: 15
|
Posted: Wed Nov 21, 2007 11:26 Post subject: |
|
|
Would the db-connection works with this solution? And when yes, can someone post, how a noob in such things can implement this, please? |
|
Back to top |
|
|
mckillroy
Joined: 16 May 2005 Posts: 40
|
Posted: Wed Nov 21, 2007 13:17 Post subject: |
|
|
In the moment I'm working on testing the solution.
Theoretically all plugins should work, since the major problem of the crashes under wine came from the way of the Dll injection, not from the modules.
Once the Dll is injected into the server and has done its hooking work there is no difference.
It scans for plugins and loads them (tested with the time plugin) and starts the IPC Server used to communicate with the NWNX4_EXP_GUI.exe - same stuff like in the official NWNX4.
Of course there may be problems with specific modules on wine - but these should be independent from the problem described above.
Once I have it working with MySQL I'll post here.
Test help welcome.
Setting up the binaries on wine is not more complicated than with the official NWN2 and NWNX4 distribution.
Just copy all the stuff in the directory in your wine environment, set up the ini files and then with
wine NWNX4_EXP_GUI
you would start it.
( I changed the executable and the dll file name to avoid confusion with the official distribution).
So - if you are able to set up MySQL and the NWNX4 Link on Windows, you can do it with the modified version as well. _________________ /McKillroy
a.k.a Yorlik |
|
Back to top |
|
|
Darnah
Joined: 06 Jun 2007 Posts: 15
|
Posted: Wed Nov 21, 2007 16:08 Post subject: |
|
|
My major problem is , that madcodehook doesn't work with 64bit systems. Because of this, i search for another solution.
I run NwN2 under a windows system, but i think, it will run under windows, when it works with wine.
I don't have any knowledge about compiling under windows and working with threads. |
|
Back to top |
|
|
mckillroy
Joined: 16 May 2005 Posts: 40
|
Posted: Wed Nov 21, 2007 16:59 Post subject: |
|
|
If you want i can send you the compiled binaries for testing. You'd just need 2 files: NWNX4_EXP_GUI.exe and NWNX4_EXP_hook.dll the other files you could take from the regular distribution.
Maybe just PM me an email addy and I'll send you a zip as attachment - or if you wish I'll set you up a temporary download link on my website. _________________ /McKillroy
a.k.a Yorlik |
|
Back to top |
|
|
Darnah
Joined: 06 Jun 2007 Posts: 15
|
Posted: Wed Nov 21, 2007 19:36 Post subject: |
|
|
First: The hook could be loaded within 64bit windows.
Now i will check, if database support works. |
|
Back to top |
|
|
mckillroy
Joined: 16 May 2005 Posts: 40
|
Posted: Wed Nov 21, 2007 20:59 Post subject: |
|
|
Darnah wrote: | First: The hook could be loaded within 64bit windows.
Now i will check, if database support works. |
This is awesome !
Detour doesn't yet have full 64 bit support, but if the hook could be loaded
it means the function we need is not affected by this.
If the hook dll loads and you see the IPC server working and the success message for the loaded hook functions the most crucial step has been done.
If a special plugin doesn't work this is another problem. If only one of the plugins works the basic stuff has been achieved.
Cheers _________________ /McKillroy
a.k.a Yorlik |
|
Back to top |
|
|
|