microsoft / Detours

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

Enable control over import ordinal and add DetourUpdateDllWithDll #236

Closed JohnMcPMS closed 1 year ago

JohnMcPMS commented 2 years ago

This change is largely about being able to control the import ordinal set in UPDATE_IMPORTS_XX, but also includes a new function DetourUpdateDllWithDll which is similar to DetourUpdateProcessWithDllEx.

Additional parameters for DetourUpdateProcessWithDllEx are added to make DetourUpdateProcessWithDllEx2. I wasn't sure what the natural next name was for post-Ex (I assume it isn't ExEx). Maybe it should be DetourUpdateProcessWithDllAndOrdinals instead?

Microsoft Reviewers: Open in CodeFlow
JohnMcPMS commented 2 years ago

Needs review.

jaykrell commented 2 years ago

Windows has started with "2" and "3", and perhaps, taking parameters in structs. Though the struct thing..is still wierd -- size or flags, etc.? Years ago "we" formulated the general case is that you need maybe like: flags in flags honored out flags ignored out (honored+ignored=in for success)

or perhaps flags required in flags ignorable in flags honored out (of the ignorable ones)

But even this might not suffice -- imagine a caller wants to probe what flags are understood. Perhaps a simpler and more complete design: FooGetKnownFlags() and then caller can decide, and pass no more than that.