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 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
chris421



Joined: 07 Apr 2005
Posts: 53

PostPosted: Fri Jun 09, 2006 18:20    Post subject: Alternatives to MadCHook.dll Reply with quote

Doesn't sound like much is being done at madshi to update to x64 support. Could the dependency on this third-party dll be removed / replaced? Maybe you guys can try emailing him.

http://www.madshi.net/madCodeHookDescription.htm

This is pretty devastating for all potentially new NWNX users come NWN2.
Back to top
View user's profile Send private message
Papillon
x-man


Joined: 28 Dec 2004
Posts: 1060
Location: Germany

PostPosted: Tue Jun 13, 2006 10:32    Post subject: Reply with quote

Uhm, could you please explain why this would be devastating ? There will not be a NWN2-64 either...
_________________
Papillon
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
NoMercy



Joined: 03 Jan 2005
Posts: 123
Location: UK

PostPosted: Wed Jun 14, 2006 2:09    Post subject: Reply with quote

With pretty much all new procesors which arn't 'budget' supporting 64bit (AMD64/EM64T), and Vista on the horizon, I'd never rule out the possibility that the'll be a 64 bit version of NWN2.

But that said, the'll always be a version which will run on older machines and operating systems. at best it's a buffering period, at worst it's a complete cop-out excuse :)
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
chris421



Joined: 07 Apr 2005
Posts: 53

PostPosted: Wed Jun 14, 2006 5:29    Post subject: Reply with quote

Madshi doesn't, and has made no commitment to, work under x64.

Neverwinter Nights 2, while not being a x64 app itself, will likely bring droves of new players and hosters to the community, the bulk of whom will probably have never heard of NWNX.

After they realize the default NWN2 database is slow/impractical/unmanageable and stumble onto NWNX, the incompatibility of their OSes (with MadCHook) may be enough to discourage the NWN2 PW community before it even gets started.

I currently run 32-bit R2, SQL2K5 SP1, IIS, a large RAMDisk, NWNX-ODBC, and nwserver 1.67 on a dual-core 64-bit cpu with 4gb of ram. I plan to go quad-core with 8gb of ram sometime early 2007. So x64 is not just a buzzword for me; I have a legitimate need beyond 32-bit OS memory constraints.

If you can remove a dependency on Madshi's release schedule and just compile your own flavor(s) of his dll, you should probably do so. He offers the Delphi source, and the C++ if you ask nicely. Smile
Back to top
View user's profile Send private message
Papillon
x-man


Joined: 28 Dec 2004
Posts: 1060
Location: Germany

PostPosted: Wed Jun 14, 2006 10:42    Post subject: Reply with quote

Well, at least he is working on Vista support. Even if he would send me the source code, I doubt I would be able to create a 64bit version (Delphi... shudder).

OTOH, I hooked the Linux server without a library like madcodehook, so it should be possible to do this on Windows as well...
_________________
Papillon
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
chris421



Joined: 07 Apr 2005
Posts: 53

PostPosted: Wed Jun 14, 2006 17:48    Post subject: Reply with quote

He never really specifies Vista 32 or 64, which I assume will release in two flavors.

Regardless, I'm sure you'd have a long list of volunteers to help QA a homebrewed windows hooking solution.

Glad to see the renewed activity on the project. Thanks!
Back to top
View user's profile Send private message
MagnumMan



Joined: 01 Apr 2005
Posts: 8
Location: MA

PostPosted: Mon Dec 11, 2006 17:00    Post subject: x64 Support Reply with quote

Amia (www.amiaworld.net) is running on x86-64. We're using a pre-release madCHook which allows us to run on x86-64, along with NWNX2 32-bit, nwserver 32-bit, and mysql 64-bit. madshi said that this support would come in the next official release in an email I have stored from May 2006. In any case I know it is possible since we're doing it, perhaps a donation to madshi would be in order - I certainly made one.
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Papillon
x-man


Joined: 28 Dec 2004
Posts: 1060
Location: Germany

PostPosted: Mon Dec 11, 2006 17:16    Post subject: Reply with quote

I talked to him about it, and he told me the same ("next version"). But he promised to create a special version for NWNX that supports 64bit as well. As soon as I get it, I'll replace the standard version.
_________________
Papillon
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
chaoslink



Joined: 23 Aug 2006
Posts: 37

PostPosted: Tue Dec 19, 2006 21:47    Post subject: Reply with quote

I've altered NWNX to use (cross-platform) functionality pulled from Microsoft's Detours library. My dev machine has been down so I need some time to clean things up, but I can offer this to the community. It removes the need for any assembly in the hook code (the detours code does some dissasembling of the instructions for trampolining runtime).
Back to top
View user's profile Send private message
Papillon
x-man


Joined: 28 Dec 2004
Posts: 1060
Location: Germany

PostPosted: Tue Dec 19, 2006 22:04    Post subject: Reply with quote

As I said in my PM to you a while ago, I'm interested to see your solution Wink.
_________________
Papillon
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
chaoslink



Joined: 23 Aug 2006
Posts: 37

PostPosted: Wed Dec 20, 2006 0:49    Post subject: Reply with quote

yeah, I'm getting there... when I got my copy of the NWN2 beta my machine died, so it has been a rough road to recovery Very Happy

*edit: I have it tested under linux, I just need to double-check that it compiles and runs correctly under windows.*
Back to top
View user's profile Send private message
chaoslink



Joined: 23 Aug 2006
Posts: 37

PostPosted: Fri Dec 29, 2006 22:21    Post subject: Reply with quote

I've finally got visual studio re-installed and the project moved over to my windows dev machine. There's more linux-specific code that I didn't realize at first which still needs some cross-platform magic applied. Stay tuned.

BTW, this is a modification of the linux NWNX2 source to be cross-platform and to use the detours code, so the windows version will be command-line and function the same as the linux version. If I can grab a copy of the source code for both platforms for each of the bundled plug-ins, I will try to give them the same treatement.
Back to top
View user's profile Send private message
Papillon
x-man


Joined: 28 Dec 2004
Posts: 1060
Location: Germany

PostPosted: Sun Dec 31, 2006 1:14    Post subject: Reply with quote

Cool, I am interested how things will turn out on Windows. And I'm curious how the hooking is done with Detours...
_________________
Papillon
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
chaoslink



Joined: 23 Aug 2006
Posts: 37

PostPosted: Sun Dec 31, 2006 1:23    Post subject: Reply with quote

Papillon wrote:
Cool, I am interested how things will turn out on Windows. And I'm curious how the hooking is done with Detours...


Locating the function is the same. Once the function has been located, I just supply the function address to the detours code along with a function pointer to the trampoline.

the detours code disassembles part of the original function to determine proper instruction boundaries, and copies it to another location in memory with a jump to the next portion of the function. It then replaces the original portion with a jump to the trampoline and returns a pointer to the location of the copied portion. This can be used to execute the original code from the trampoline.

It's Microsoft's code, and it was written for Windows. Luckily the portion of it I described above works under Linux as well (probably for any x86 OS). There are some Windows specific functions I'm using to preload the DLL since there is no LD_PRELOAD for Windows.
Back to top
View user's profile Send private message
Grinning Fool



Joined: 12 Feb 2005
Posts: 264

PostPosted: Mon Jan 01, 2007 13:35    Post subject: Reply with quote

Quote:
the detours code disassembles part of the original function to determine proper instruction boundaries, and copies it to another location in memory with a jump to the next portion of the function. It then replaces the original portion with a jump to the trampoline and returns a pointer to the location of the copied portion. This can be used to execute the original code from the trampoline.

Wouldn't that do Really Bad Things in terms of whatever is in place to protect access to system memory, especially under Vista?

(Actually, I kind of hope it would, or that I'm missing something obvious -- otherwise, I'm not holding out much hope for Vista's security enhancements)
_________________
Khalidine, a NWN2 persistent world

Looking for volunteers.
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 1, 2, 3, 4, 5, 6  Next
Page 1 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