If your injector may start the application, the easiest way is probably to specify the CREATE_SUSPENDED flag when calling CreateProcess. It causes the primary thread of the process to be created in suspended state. You can then inject your DLL. Once you're done with it, resume the primary thread by using the handle returned via the process information structure to start the program.
| QUOTE |
Also will the appropriate dll have to be loaded before the dll is loaded?
|
No. When loading PE files via Windows API (e.g. LoadLibrary, CreateProcess, etc.), Windows resolves all (non-delay) imports listed in the image's import table, or refuses to load the file if it is unable to.