Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add better support for detouring at instruction addresses with DHooks #1969
base: master
Are you sure you want to change the base?
Add better support for detouring at instruction addresses with DHooks #1969
Changes from 4 commits
c1a5bf9
154ceb2
45020bd
7ec67d9
657b3dd
42b1e5e
e906917
19f15c0
ddb9066
e0e3cfb
abba523
eb780f0
5adeef8
1799c7e
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be useful if you could skip instructions similar to the "supercede" mode for function calls.
Imagine a mid-function detour on something like
mov eax, 0x1000
where you'd want to change the constant. If you add a detour, change eax, and return, the original instruction would still be executed and your detour had no effect.I guess you can work around this by detouring after that instruction for now, but that could force you into jump target territory for no reason. I guess we can improve that in an additional PR. This feature is pretty advanced and you should be knowing what you're doing when going this way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't even consider jump targets. Having a post routine would improve the situation, but it won't solve all cases as you mentioned yourself:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, don't really need a whole post routine for a single instruction, just a supercede implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess that would just be conditionally replacing the
m_pTrampoline
jump with am_pTrampoline + instruction size
jump?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay that does seem to work. One problem is that you can't change params and supercede at the same time currently. Should I add
MRES_ChangedSupercede = -3
toenum MRESReturn
and implement that? Or just have it update params automatically when usingMRES_Supercede
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thought about changing
MRESReturn
based on what you said about skipping a specified number of bytesDoes returning
MRES_Handled
actually do something different to returningMRES_Ignored
?