You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Provide 2 new ways to patch: GetPatchInformationFunctions and DllPreLoadHook
Going forward, `DllPreLoadHook` will be the preferred way to patch.
This gives more control to the user (if they need to do partial patching for example), and is easier to understand (less "magic").
// Must be exposed by the patch dll and return the action to take for a given extra action index
36
-
// Note that the returned pointer must be valid until the end of the patching, and not be reused between GetExtraPatchAction calls since we will fill the detouredPatchedFunction field.
// This will always be filled, but for convenience `detouredPatchedFunctionPointerAddress` may point to your own variable instead of detouredPatchedFunctionPointer.
23
+
void* detouredPatchedFunctionPointer = nullptr;
38
24
};
39
25
26
+
extern"C"
27
+
{
28
+
// Old API, where one had to export GetBaseOrdinal+GetLastOrdinal+GetPatchAction (and optionally GetExtraPatchActionsCount+GetExtraPatchAction), or expose all through GetPatchInformationFunctions
29
+
// Please use DllPreLoadHook now, as it gives you more freedom and should now be the preferred API.
30
+
// For compatibility and ease of use, and/or if you need multi-dll support, you may use GetPatchInformationFunctions
PatchAction_AlreadyPatched, // Nothing was done because the function was already replaced
57
+
PatchAction_CircularPatching, // Nothing was done because the function had been replaced in the other direction before
58
+
PatchAction_PatchFunctionWasPatched, // Nothing was done because the source function had already been replaced before
59
+
PatchAction_BadInput, // Input parameters are invalid
60
+
PatchAction_PatchFailed, // Patching utility failed with an unknown reason. It might be due to a breakpoint being placed at the beginning of the target function, or the target function being patched by another system
61
+
};
62
+
63
+
// Convenience function for all kind of patching with sanity checks
64
+
// Similar in spirit to the old API, except you are the one calling the patching functions.
65
+
//
66
+
// originalDllOffset is the offset (function or address) relative to the base of the original dll. Note that it may be the source or destination of replacement depending on `patchAction`.
67
+
// patchDllAddr is the address of the patch dll (function or address of pointer). Note that it may be the source or destination of replacement depending on `patchAction`.
68
+
// patchAction is the action you want to do (see the enum)
69
+
// realPatchedFunctionPointerStorageAddress is used to store the address of the unpatched function, it may be used to call the function that was replaced from the patch itself. Use nullptr if you do not need it.
0 commit comments