Skip to content

Add SlimDetoursDetachEx to allow to free the trampoline manually #19

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

m417z
Copy link

@m417z m417z commented Apr 10, 2025

Usage example:

// Detach but don't free trampoline.
SlimDetoursTransactionBegin();
PVOID pTrampoline = NULL;
DETOUR_DETACH_OPTIONS Options;
Options.ppTrampolineToFreeManually = &pTrampoline;
SlimDetoursDetachEx(pPointer, pDetour, &Options);
SlimDetoursTransactionCommit();

// Make sure the trampoline can be safely freed.
Sleep(1000);

// Free trampoline.
SlimDetoursFreeTrampoline(pTrampoline);

I don't find it very elegant, but it can help address #12.

Depends on #17 (will be rebased once it's merged).

m417z added 2 commits April 10, 2025 22:49
Similar to the implementation in SlimDetoursTransactionCommit.
@m417z m417z force-pushed the free-trampoline-manually branch from 6e5792c to 21fb49a Compare April 10, 2025 19:50
@m417z m417z marked this pull request as draft April 10, 2025 21:09
@m417z m417z force-pushed the free-trampoline-manually branch 2 times, most recently from e46faaa to 942a4f7 Compare April 11, 2025 15:12
Usage example:

SlimDetoursTransactionBegin();
PVOID pTrampoline = NULL;
DETOUR_DETACH_OPTIONS Options;
Options.ppTrampolineToFreeManually = &pTrampoline;
SlimDetoursDetachEx(pPointer, pDetour, &Options);
SlimDetoursTransactionCommit();
Sleep(1000);
SlimDetoursFreeTrampoline(pTrampoline);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant