Skywing
Joined: 03 Jan 2008 Posts: 321
|
Posted: Thu Jan 03, 2008 19:14 Post subject: Patch to fix NWNX4 not working on Srv03 x64 + other fixes |
|
|
Hi,
It seems that madCHook does not work properly as a Wow64 process under Srv03 x64. It does not even attempt to inject the specified hook DLL into the process when CreateProcessEx is called.
I have imported some code I wrote a few years ago that accomplishes the same thing in principle as the madCHook CreateProcessEx routine, with the added bonus that it actually works properly on Windows x64 (for 32-bit processes). Also, source code for that is being made available, so you may be able to cut the dependency on madCHook entirely now.
Additionally, I took the time to move all of the hook dll initialization logic out of DllMain. No more creating windows and other horrible nastiness bits under the loader lock, now, for the injection code now calls an export on the hook dll outside of the loader lock to do it's initialization.
I also added a mechanism by which NWNX4Controller can wait for NWN2Server to get it's message loop pumping. This was necessary because I noticed that sometimes NWNX4Controller would fail to establish the DDE link (as far as I could tell, a race condition where it would give up waiting because NWN2Server was not pumping messages yet). The change I made (create a hidden window that we wait until we get a response to WM_NULL) seems to address this in my tests.
Finally, I also fixed a couple of memory and handle leaks in NWNX4Controller itself.
The changes are available as a diff against the latest SVN revisions + full files as well, at the following url: http://www.nynaeve.net/Skywing/nwnx4_patch.zip |
|