Major refactoring of the inject.exe tool which addresses the following major and minor issues (copy-paste from commit message):
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
Screenshot:
_Merges refactor-inject -> master_
Major refactoring of the `inject.exe` tool which addresses the following major and minor issues (copy-paste from commit message):
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
Screenshot:

added 4 commits
<ul><li>01779035 - util: Add signal module introducing signal and exception handling</li><li>1c18422f - util/log: Add log_error which logs errors but does not abort</li><li>4d01397a - inject: Major refactoring</li><li>48a035c4 - inject: Fix windows psapi mess by explicitly defining version</li></ul>
[Compare with previous version](/djhackers/bemanitools/-/merge_requests/46/diffs?diff_id=1285&start_sha=8138a7747b9c6dc5d7db2c789dc9e075aed16d92)
This is probably useful to port over to launcher / occur in log_writer_stdout
In GitLab by @xyen on Sep 1, 2020, 04:45
Commented on [src/main/inject/logger.c line 97](https://github.com/djhackersdev/bemanitools/compare/5de9fdee437e8aba712627c48e3080ac289f93b7..2280e17f1ef4dd4b647cf7385d8c73be408bf40e#diff-b4f75f2a0dc972fbede6b993011be338R97)
This is probably useful to port over to launcher / occur in log_writer_stdout
Why do we need the filesize? you never seem to actually use it.
In GitLab by @xyen on Sep 1, 2020, 04:45
Commented on [src/main/inject/debugger.c line 40](https://github.com/djhackersdev/bemanitools/compare/3ab55b9ef02a1e052b4ca16c61a021092eced6d1..b87fa7995c2d7ad9bfd435605f81764a8158f8d8#diff-3391f44a35cb1c9d87265871235aa177R40)
Why do we need the filesize? you never seem to actually use it.
This probably fits better in util's, and if we ever write a stack unwinder / crash handler it'll be useful there as well.
In GitLab by @xyen on Sep 1, 2020, 04:45
Commented on [src/main/inject/debugger.c line 196](https://github.com/djhackersdev/bemanitools/compare/3ab55b9ef02a1e052b4ca16c61a021092eced6d1..b87fa7995c2d7ad9bfd435605f81764a8158f8d8#diff-3391f44a35cb1c9d87265871235aa177R196)
This probably fits better in util's, and if we ever write a stack unwinder / crash handler it'll be useful there as well.
keep the naming as log_fatal, so we know that it'll hang / kill after calling this log message
In GitLab by @xyen on Sep 1, 2020, 04:45
Commented on [src/main/util/log.h line 25](https://github.com/djhackersdev/bemanitools/compare/3ab55b9ef02a1e052b4ca16c61a021092eced6d1..8062eeac3758c753dafaf42c58e14e0835057017#diff-6714a0d43d809ad5c819681cb86fe6a3R25)
keep the naming as log_fatal, so we know that it'll hang / kill after calling this log message
It checks if the file size is > 0 afterwards. But I don't think that's super valuable and a file size of 1 byte would not be valid and be caught there. Removed.
It checks if the file size is > 0 afterwards. But I don't think that's super valuable and a file size of 1 byte would not be valid and be caught there. Removed.
Actually, there is something already in util/signal.c. Avoiding that duplicated code by exposing exception_code_to_str and using it in innject/debugger.c.
Actually, there is something already in `util/signal.c`. Avoiding that duplicated code by exposing `exception_code_to_str` and using it in `innject/debugger.c`.
There are situations when I still want something logged as an error because it is an error but the application should shut down gracefully. See the various spots in inject/main.c. For example, remote process created but hooking fails -> you want to cleanup the remote process to avoid having a zombie floating around that you have to kill with task manager all the time.
There are situations when I still want something logged as an error because it is an error but the application should shut down gracefully. See the various spots in `inject/main.c`. For example, remote process created but hooking fails -> you want to cleanup the remote process to avoid having a zombie floating around that you have to kill with task manager all the time.
changed this line in [version 4 of the diff](/djhackers/bemanitools/-/merge_requests/46/diffs?diff_id=1299&start_sha=b87fa7995c2d7ad9bfd435605f81764a8158f8d8#166e980a51a4b2d4545188eb0c1039fe9252193a_196_189)
changed this line in [version 4 of the diff](/djhackers/bemanitools/-/merge_requests/46/diffs?diff_id=1299&start_sha=b87fa7995c2d7ad9bfd435605f81764a8158f8d8#166e980a51a4b2d4545188eb0c1039fe9252193a_40_40)
changed this line in [version 5 of the diff](/djhackers/bemanitools/-/merge_requests/46/diffs?diff_id=1300&start_sha=8062eeac3758c753dafaf42c58e14e0835057017#7e9307f89d16d0d17f3f2b7b8ca24d93bbf49e76_25_25)
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Merges refactor-inject -> master
Major refactoring of the
inject.exetool which addresses the following major and minor issues (copy-paste from commit message):Major:
Minor:
Screenshot:

added 4 commits
Compare with previous version
added 1 commit
Compare with previous version
In GitLab by @xyen on Sep 1, 2020, 04:45
Commented on src/main/inject/logger.c line 97
This is probably useful to port over to launcher / occur in log_writer_stdout
In GitLab by @xyen on Sep 1, 2020, 04:45
Commented on src/main/inject/debugger.c line 40
Why do we need the filesize? you never seem to actually use it.
In GitLab by @xyen on Sep 1, 2020, 04:45
Commented on src/main/inject/debugger.c line 196
This probably fits better in util's, and if we ever write a stack unwinder / crash handler it'll be useful there as well.
In GitLab by @xyen on Sep 1, 2020, 04:45
Commented on src/main/util/log.h line 25
keep the naming as log_fatal, so we know that it'll hang / kill after calling this log message
It checks if the file size is > 0 afterwards. But I don't think that's super valuable and a file size of 1 byte would not be valid and be caught there. Removed.
Actually, there is something already in
util/signal.c. Avoiding that duplicated code by exposingexception_code_to_strand using it ininnject/debugger.c.There are situations when I still want something logged as an error because it is an error but the application should shut down gracefully. See the various spots in
inject/main.c. For example, remote process created but hooking fails -> you want to cleanup the remote process to avoid having a zombie floating around that you have to kill with task manager all the time.changed this line in version 4 of the diff
changed this line in version 4 of the diff
added 5 commits
Compare with previous version
changed this line in version 5 of the diff
added 1 commit
Compare with previous version
Decided to go for
log_warning+ "ERROR" string in the message in direct messaging with Xyen and Tau.resolved all threads
In GitLab by @xyen on Sep 2, 2020, 21:52
approved this merge request
added 29 commits
mastere934a4ab- Makefile: Fix clang format command3f0ea853- Makefile: Fix minor inconsistencya20cc7c4- util/log: Add TODO pointing out design flaw5d2104ad- util: Add signal module introducing signal and exception handling806afe6e- util/log: Add log_error which logs errors but does not abort189ff755- inject: Major refactoring19820943- inject: Fix windows psapi mess by explicitly defining version8343449b- inject/logger: Add timestamps to log messagesb7694894- util/signal: Expose signal_exception_code_to_strafba1d5a- inject/debugger: Avoid code dupe2280e17f- util/log: Remove log_error, replace occurances with log_warningCompare with previous version