logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Alternatives to MadCHook.dll
Goto page Previous  1, 2, 3, 4, 5, 6  Next
 
Post new topic   Reply to topic    nwnx.org Forum Index -> Development
View previous topic :: View next topic  
Author Message
Darnah



Joined: 06 Jun 2007
Posts: 15

PostPosted: Wed Nov 21, 2007 22:17    Post subject: Reply with quote

I've tested the timer and the mysql plugin and both are work fine. I think, that sqlite will work, too, but i don't have a sqlite database, so i couldn't test it.

Watchdog works fine, too.


Last edited by Darnah on Thu Nov 22, 2007 0:41; edited 1 time in total
Back to top
View user's profile Send private message
mckillroy



Joined: 16 May 2005
Posts: 40

PostPosted: Wed Nov 21, 2007 23:27    Post subject: Reply with quote

Darnah wrote:
I've tested the timer and the mysql plugin and both are work fine. I think, that sqlite will work, too, but i don't have a sqlite database, so i couldn't test it.

Watchdog works finy, too.


Now that makes me happy to hear.
_________________
/McKillroy
a.k.a Yorlik
Back to top
View user's profile Send private message
Darnah



Joined: 06 Jun 2007
Posts: 15

PostPosted: Thu Nov 22, 2007 0:42    Post subject: Reply with quote

I just can say, creat work!!
Back to top
View user's profile Send private message
mckillroy



Joined: 16 May 2005
Posts: 40

PostPosted: Thu Nov 22, 2007 22:43    Post subject: Reply with quote

Thanks for the flowers, but I must say I had some great help by various resources:

- I never used VC++ Express 2005 before, and the setup help provioded here was working very well for me.
- The code for NWNX4 is nicely structured and easily understandable
- I had good luck with meeting some really skilled guys on #winehq and on #Opensolaris in the freenode IRC network who helped me debug the problem and who gave me the hint that Detours would probably work on wine.
- The changes I made are really a simple hack replacing one function with some reused code.

Its all community work.

*Cheers for the collective intelligence of the net*
_________________
/McKillroy
a.k.a Yorlik
Back to top
View user's profile Send private message
Gryphyn



Joined: 20 Jan 2005
Posts: 431

PostPosted: Thu Nov 29, 2007 23:29    Post subject: Reply with quote

This just appeared on CodeProject - it (or something similar) may be an option.

Mini Hook Engine

Cheers
Gryphyn
Back to top
View user's profile Send private message
Ilrilan



Joined: 29 Aug 2006
Posts: 11

PostPosted: Fri Nov 30, 2007 6:31    Post subject: Reply with quote

Original MadCHook.dll works fine on Vista x64 - in my combined version of the nwnx hook. Here is plugin list, which loaded and worked fine:

Code:
NWN Extender 4 V.0.0.8
(c) 2007 by Ingmar Stieger (Papillon)
added compatibility with 0.0.7 - Ilrilan
visit us at http://www.nwnx.org

* Loading plugins...
* Loading plugin xp_character.dll: Successfully registered as class: CHARACTER
* Loading plugin xp_chat.dll: Successfully registered as class: CHAT
* Loading plugin xp_craft.dll: Successfully registered as class: CRAFTER
* Loading plugin xp_functions.dll: Successfully registered as class: FUNCTIONS
* Loading plugin xp_leto.dll: Successfully registered as class: LETO
* Loading plugin xp_mysql.dll: Successfully registered as class: SQL
* Loading plugin xp_profiler.dll: Successfully registered as class: PROFILER
* Loading plugin xp_time.dll: Successfully registered as class: TIME
* Disabling general protection fault error dialog.
* NWNX4 activated.
* NWNX4 shutting down...
* NWNX4 shutdown successfull.


Why do you search any alternatives?
Back to top
View user's profile Send private message
Gryphyn



Joined: 20 Jan 2005
Posts: 431

PostPosted: Fri Nov 30, 2007 6:45    Post subject: Reply with quote

Ilrilan wrote:
Why do you search any alternatives?


Not searched, Just happened upon...
The Mini-Hook is code that we could possibly take on without any reliance on 3rd party stuff.
I'll just flag what I see, others will make the choices.

Cheers
Gryphyn
Back to top
View user's profile Send private message
Papillon
x-man


Joined: 28 Dec 2004
Posts: 1060
Location: Germany

PostPosted: Sat Dec 01, 2007 0:49    Post subject: Reply with quote

Great work, mckillroy !

Now that we have an alternative to the madcodehook library, could somebody please fill me in on the advantages/disadvantages of both hooking methods ?

I think I understood that it works on Wine/Linux, which in itself would be enough reasons for me to merge this into the main NWNX branch.
_________________
Papillon
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
mckillroy



Joined: 16 May 2005
Posts: 40

PostPosted: Mon Dec 03, 2007 2:01    Post subject: Reply with quote

Actually the really good work is not done by the madcodehook, but by the NWNX4_hook.dll assembler magic.

MadCodeHook, If I understood right with the help of some guys much better than I am, does a "CreateRemoteThread" and hides this by using crypted strings.
So - the trick seems to be quite trivial.

Detour on the other hand hacks the PE header of the memory image of the loaded process in a way that it now requires the dll in question.
This circumvents the address problems we had in wine before, since the runtime loader itself does all the work.
I don't see any drawbacks from the detour method, but I have to admit I didn't yet understand ALL the details.

There might be license issues for commercial use with Detours, but since we are all non commercial it shouldn't be a problem.
Maybe it would be wise to put the dll injecting code into a dll, so everyone could write his own dll injector if desired.

I must say I was quite astonished to hear it worked in 64 bit .. maybe Detour is better in this than thought, since they don't yet have full 64 bit support officially.


Again: If anyone wants the code I hacked, or the binaries - let me know.
I set up a protected SVN repository I'd be happy to share with anyone interested.
Once there has been enough testing we can merge it into the main code once Papillon agrees.
_________________
/McKillroy
a.k.a Yorlik
Back to top
View user's profile Send private message
cadderly



Joined: 05 Dec 2007
Posts: 8

PostPosted: Thu Dec 06, 2007 22:55    Post subject: Reply with quote

First of all hi everybody Smile

After some technical assistance from McKillroy I want to give you a feedback about his solution on Fedora 7.

System: Fedora Core 7
kernel: 2.6.23
wine: 0.9.49
NWN4: 1.08

nwnx starts: OK
nwnx loads new Hook: OK
nwnx loads modules (mysql, timer, sqlite): OK
nwnx starts server: OK
nwnx starts demo module: OK
nwnx starts other test module: OK
nwnx starts/stops server: OK
nwnx autoreloads server: OK
initialisation of mysql via demo: OK
timer mod : OK
initialisation of sqlite via demo: not testet but I think that will work too

The only problem that occured was that the server goes to idle mode and wont accept logins when the reload_if_empty flag is set in nwplayer.ini and 0 players are on server. Turning off the flag solves the problem

I am working on the problem to get it running on our debian server. ATM i can say that it doesnt work with wine 0.9.25 from the stable debian branch. Ill give you a report as soon as possible

Thanks mckillroy for your help


Last edited by cadderly on Thu Dec 06, 2007 23:30; edited 1 time in total
Back to top
View user's profile Send private message
mckillroy



Joined: 16 May 2005
Posts: 40

PostPosted: Thu Dec 06, 2007 23:14    Post subject: Reply with quote

I'm glad to see after all you could solve it!

My own tests have been with wine 0.9.48 and 0.9.49.
older versions (I don't know from which wine version on it was solved)
seem to have problems with the "NtQueryVirtualMemory" function.

Seems like Debian users will have to compile a new version for their own or
download it from winehq:

http://www.winehq.org/site/download

sometimes they have newer versions there,
than in the "stable" Debian branch.
_________________
/McKillroy
a.k.a Yorlik
Back to top
View user's profile Send private message
cadderly



Joined: 05 Dec 2007
Posts: 8

PostPosted: Fri Dec 07, 2007 0:05    Post subject: Reply with quote

System: Debian 4 Edge
kernel: 2.6.8-2-686
wine: 0.9.49
NWN4: 1.08

nwnx starts: OK
nwnx loads new Hook: OK
nwnx loads modules (mysql, timer, sqlite): OK
nwnx starts server: OK
nwnx starts demo module: OK
nwnx starts/stops server: OK
nwnx autoreloads server: OK
initialisation of mysql via demo: OK
timer mod : OK


Very Happy
Back to top
View user's profile Send private message
mckillroy



Joined: 16 May 2005
Posts: 40

PostPosted: Tue Dec 11, 2007 23:20    Post subject: Reply with quote

I uploaded the altered binaries to the vault for your testing pleasure. Once the solution has made its way to the main NWNX4 branch I'll delete it from there:

http://nwvault.ign.com/View.php?view=NWN2Other.Detail&id=163
_________________
/McKillroy
a.k.a Yorlik
Back to top
View user's profile Send private message
xeopherith



Joined: 14 Dec 2007
Posts: 8

PostPosted: Mon Dec 17, 2007 5:01    Post subject: Reply with quote

http://arcanima.org/forum/viewtopic.php?f=1&t=57

I need a compiled version of NWNX4 that doesn't use Madchook.dll due to the lack of 64bit support.
The original NWNX4 from the nwnx webpage seems to have nearly no functionality. It doesn't recognize when the server process is loaded due to madchook. However, when using the nwnx gui, the server gui loads and displays information correctly and the ini file loads my configuration.

Originally I had this problem when trying to compile NWNX4 with the changes listed in http://arcanima.org/node/1077
The controller and gui do not compile successfully. Everything else does.

----Controller----

1>c:\temp\nwnx\src\controller\controller.cpp(132) : error C3861:'arrayof': identifier not found
1>c:\temp\nwnx\src\controller\controller.cpp(145) : error C3861:'DoesDllExportOrdinal1': identifier not found
1>c:\temp\nwnx\src\controller\controller.cpp(161) : error C3861:'arrayof': identifier not found
1>c:\temp\nwnx\src\controller\controller.cpp(177) : error C3861:'DoesDllExportOrdinal1': identifier not found
1>c:\temp\nwnx\src\controller\controller.cpp(196) : error C3861:'arrayof': identifier not found
1>c:\temp\nwnx\src\controller\controller.cpp(198) : error C3861:'arrayof': identifier not found
1>c:\temp\nwnx\src\controller\controller.cpp(217) : error C2065: 'π' :undeclared identifier

----GUI----

1>c:\temp\nwnx\src\controller\controller.cpp(132) : error C3861:'arrayof': identifier not found
1>c:\temp\nwnx\src\controller\controller.cpp(145) : error C3861:'DoesDllExportOrdinal1': identifier not found
1>c:\temp\nwnx\src\controller\controller.cpp(161) : error C3861:'arrayof': identifier not found
1>c:\temp\nwnx\src\controller\controller.cpp(177) : error C3861:'DoesDllExportOrdinal1': identifier not found
1>c:\temp\nwnx\src\controller\controller.cpp(196) : error C3861:'arrayof': identifier not found
1>c:\temp\nwnx\src\controller\controller.cpp(198) : error C3861:'arrayof': identifier not found
1>c:\temp\nwnx\src\controller\controller.cpp(217) : error C2065: 'π' :undeclared identifier

mckillroy replied with:
What exactly are you trying ?

1.) Did you use the tutorial on arcanima.org to build a wine compliant
version of NWNX4 ?
If yes, I'd suggest you make an account on arcanima and ask me again
to give you SVN access
to the hacked source code I used. But this is definitely not a newbie task.

2.) If you only want a wine compliant version of NWNX4, you can
download the supplemental files from nwvault here:
http://nwvault.ign.com/View.php?view=NW ... ail&id=163

3.) Or did you try to build the standard NWNX4?
If this is the case you should drop your questions at the forums at
http://nwnx.org


This gave me the idea to just try and use the supplemental files. After trying these files I ran into issues:

The files uploaded to the NWN2 Vault http://nwvault.ign.com/View.php?view=NW ... ail&id=163 seem to have more functionality in that the plugins load properly. However the server would start and no config (server name or module to load) I ran the gui and found that the actual nwn server gui doesn't load properly. Even though some drop down menus function, the server gui doesn't appear to be functional whatsoever.

I tested the problem on my server and while troubleshooting I was curious to see if my 32bit workstation had the same problem as the 64bit server. My workstation behaves in the exact same manner. Originally I thought I was troubleshooting a problem cause by running on a 64 bit operating system.

Here is a link http://lsotet.com/temp/nwnx4logandscreenshot.rar to the log files from the re-compiled nwnx4 hosted in the vault, a screenshot of the server interface when it is loaded by the recompiled nwnx4, and a log from a program called filemon that shows disk activity while loading the "NWNX4_EXP_GUI.exe"
Back to top
View user's profile Send private message
xeopherith



Joined: 14 Dec 2007
Posts: 8

PostPosted: Mon Dec 17, 2007 5:40    Post subject: Reply with quote

Ah HA!

Problem in the above post goes away when you run nwnx4_exp_controller (and the rest of nwnx4) from within the neverwinter nights 2 folder.

awesome!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Development All times are GMT + 2 Hours
Goto page Previous  1, 2, 3, 4, 5, 6  Next
Page 4 of 6

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group