issue with Steam and wglSwapBuffers
issue with Steam and wglSwapBuffers
I know I've reported this before with madcodehook v2 however, after fully upgrading to madcodehook v3, and completing all our testing, there is still an issue with Steam and madcodehook and hooking the function "wglSwapBuffers" causing a stack overflow.
I have no clue who's "bug" it is. I know previously we have tracked it down to the fact that there is a difference between a 6 byte jump (madcodehook) and a 5 byte jump (steam).
Just an interoperability FYI. The best game to test this with is Counter-Strike 1.6.
We have worked around this ourselves by implementing our own 5 byte function hook for this function because if this is a bug on Steam's side we will never expect a bug fix for this, and if this is a madcodehook bug we don't have the resources to fund madshi for a fix and we know this is a low priority.
I have no clue who's "bug" it is. I know previously we have tracked it down to the fact that there is a difference between a 6 byte jump (madcodehook) and a 5 byte jump (steam).
Just an interoperability FYI. The best game to test this with is Counter-Strike 1.6.
We have worked around this ourselves by implementing our own 5 byte function hook for this function because if this is a bug on Steam's side we will never expect a bug fix for this, and if this is a madcodehook bug we don't have the resources to fund madshi for a fix and we know this is a low priority.
P.S: Not sure if you alreay tried this, but newer madCodeHook versions have this new API:
You could try calling this on wglSwapBuffers before installing your own API hook. That would remove Steam's API hook. Maybe doing so works around the problem?
Code: Select all
// restores the original code of the API/function (only first 6 bytes)
// the original code is read from the dll file on harddisk
// you can use this function e.g. to remove the hook of another hook library
// don't use this to uninstall your own hooks, use UnhookCode for that purpose
function RestoreCode (code: pointer) : bool; stdcall;
What is the parameter for RestoreCode??? What do I have to provide there?madshi wrote:P.S: Not sure if you alreay tried this, but newer madCodeHook versions have this new API:
You could try calling this on wglSwapBuffers before installing your own API hook. That would remove Steam's API hook. Maybe doing so works around the problem?Code: Select all
// restores the original code of the API/function (only first 6 bytes) // the original code is read from the dll file on harddisk // you can use this function e.g. to remove the hook of another hook library // don't use this to uninstall your own hooks, use UnhookCode for that purpose function RestoreCode (code: pointer) : bool; stdcall;
You need to provide RestoreCode with the address of the original API. Depending on which API hooking method was used, GetProcAddress may return the address of the original API or not. E.g. when the export table was patched, GetProcAddress will return the address of the hook callback function and not the original API address. But then RestoreCode does not uninstall import or export table patches, anyway, so it's not much of a problem. The purpose of RestoreCode is *not* to unhook all kinds of API hooks. The purpose of RestoreCode is more limited/specific. RestoreCode does just what it claims to do, namely restoring the original API code of any given API. The only reason why I implemented RestoreCode is a situation like the topic of this thread, namely where multiple hooking libraries collide and installing madCodeHook API hooks results in stability issues. RestoreCode *may* help in this situation - or not, depending on how the other API hooking library behaves.