microsoft / Detours

Detours is a software package for monitoring and instrumenting API calls on Windows. It is distributed in source code form.
MIT License
5k stars 978 forks source link

DetourEnumerateImports() needs a thunk for pfImportFile #260

Open luke727 opened 1 year ago

luke727 commented 1 year ago

Description

DetourEnumerateImports() internally invokes DetourEnumerateImportsEx() and uses an intermediate thunk callback to wrap pfImportFunc. Unfortunately it does not also do the same for pfImportFile, so the client callback ends up getting a pointer to &context instead of the client-supplied pContext. It's easy enough to fix by adding a similar intermediate thunk callback to wrap pfImportFile.

https://github.com/microsoft/Detours/blob/734ac64899c44933151c1335f6ef54a590219221/src/modules.cpp#L667

Version

    https://github.com/microsoft/Detours/commit/734ac64899c44933151c1335f6ef54a590219221