On Thu, Nov 15, 2007 at 01:12:07PM +0100, Chris McKillroy wrote:
Hello everybody,
I recently run into the following problem:
I tried to use a DLL injection into a process started by a controller Process using an external code hooking dll (http://www.madshi.net/madCodeHookDescription.htm) to achieve some sort of datalink. In a windows environment the solution works stable and perfectly. (Controller Process NWNX4 as provided by nwnx4.org, child process nwn2server.exe, as provided by Obsidian - all legal and intended use).
Under Solaris10 (wine version 0.9.49) the child process regularly crashed upon creation, respectivley when the dll was injected.
After a lengthy debugging session it appeared that kernel32.dll.so always gets loaded to a varying address by the runtime linker, which seems to crash the whole procedure.
I succeeded making a kernel32.dll.so which gets loaded to a constant address in Solaris by using the tool "crle" on Solarice, but I couldn't control the address - it appeared to be somewhat arbitrary which base address was chosen. The crash problem remained.
I would like to try if the procedure would work if I could get a kernel32.dll.so which always gets loaded to the same address 0x7bf0000, as in standard windows.
After a posting to the Solaris Linker mailing list we got an answer (http://mail.opensolaris.org/pipermail/tools-linking/2007-November/000945.htm...) which was designed to work with the SUN toolchain.
My question now is: How would I have to change things (makefile or whatsever) to get kernel32.dll.so linked in a way to achive that it will be loaded to address 0x7bf0000each time under Solaris.
For Linux we use the ELF tool "prelink".
It should however be possible write a LD linker script to do the same.
Not sure if this is applicable to Solaris.
Ciao, Marcus