inject: Major refactoring

This addresses one major issue and multiple minor ones:
Major:
Inject's debugger is not attached to the process before
injecting DLL files. This misses out on OutputDebugString
calls by anything logging in the DllMain functions of the hook
dlls.

Minor:
- Fix coloring of log entries
- Add ASCII header to easily determine start
- Fix file logging, log _everything_ to a single log file
- Enhance inject's debugger: log further debug events to incrase
visibility on issues, proper exception handling for inject
- Re-iterated code structure of inject
This commit is contained in:
icex2
2020-09-02 19:53:06 +00:00
parent de894ae5ce
commit 54b321c7d9
9 changed files with 1093 additions and 419 deletions
+11 -11
View File
@@ -48,15 +48,15 @@ bool options_read_cmdline(struct options *options, int argc, char **argv)
void options_print_usage(void)
{
fprintf(stderr,
"inject build " __DATE__ " " __TIME__
", gitrev " STRINGIFY(GITREV) "\n"
"Usage: inject hook.dll... app.exe [hooks options...]\n"
"You can specify one or multiple hook.dll files, e.g. inject.exe "
"hook1.dll hook2.dll app.exe"
"\n"
" The following options can be specified after the exe path:\n"
"\n"
" -D Enable debugging output\n"
" -R Halt the injected process until a debugger is attached\n"
" -Y [filename] Log to a file in addition to the console\n");
"inject build " __DATE__ " " __TIME__
", gitrev " STRINGIFY(GITREV) "\n"
"Usage: inject hook.dll... app.exe [hooks options...]\n"
"You can specify one or multiple hook.dll files, e.g. inject.exe "
"hook1.dll hook2.dll app.exe"
"\n"
" The following options can be specified after the exe path:\n"
"\n"
" -D Enable debugging output\n"
" -R Halt the injected process until a debugger is attached\n"
" -Y [filename] Log to a file in addition to the console\n");
}