[1.6 servicing] Add DetourFinishHelperProcess export #4937
Merged
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.
Cherry-pick Add DetourFinishHelperProcess export #4934 to 1.6.x servicing
Add
DetourFinishHelperProcess
export to help withDetourIsHelperProcess()
and avoid stack overflow.Per https://github.com/microsoft/Detours/wiki/Using-Detours
DetourFinishHelperProcess implies this is only relevant when cross bit-ness across process creation
Sample code and most related references don't make this clear but the samples do implement this albeit obscurely buried in build logic e.g. https://github.com/microsoft/Detours/blob/main/samples/simple/Makefile line 36+ (notice the
/export:DetourFinishHelperProcess,@1,NONAME
)We don't use DetourCreateProcessWithDllEx but have seen a seemingly similar issue
SVCHOSTGROUP_*_STACK_OVERFLOW_c0000005_Microsoft.WindowsAppRuntime.dll!DetourEnumerateModules
where DllMain() in Microsoft.WindowsAppRuntime.dll calledDetourIsHelperProcess()
calledDetourFindPayloadEx()
calledDetourEnumerateModules()
and boom.Unclear why this would happen despite reviewing Detours' implementation in detail but
A similar reported issue is a crash when combining
Unclear why that combination causes grief but it does, and there's enough variables in the mix this export may be the fix. At a minimum it's's a bug to call
DetourIsHelperProcess()
without the export so worst case we're less wrong, best case it cures the strange crash. Fingers crossed.https://task.ms/55384281