This is the mail archive of the
win32-x11@sources.redhat.com
mailing list for the win32-x11 project.
The right approach to loading a program with a dll
- From: David Fraser <davidf at sjsoft dot com>
- To: win32-x11 at sources dot redhat dot com
- Date: Sat, 21 Sep 2002 18:14:02 +0200
- Subject: The right approach to loading a program with a dll
Hi
Basically start a child application with the flag CREATE_SUSPENDED
(which creates the process, loads it into memory, but doesn't start
running it, putting the main thread in suspend mode) and then go through
a routine that manually inserts a dll into the memory of the child process.
On Win 95/98 the child process has to be run with DEBUG_PROCESS API but
under NT/2000/XP it doesn't.
Attached simple code to demo the loading in suspended mode although it
doesn't yet inject the dll (which is obviously the hard bit)
Can be demonstrated by running ./wrapX11 notepad.exe with notepad.exe
in the current directory.
Can be compiled with g++ -o wrapX11.exe wrapX11.cpp under mingw/cygwin
David