I have created a c++ complete project to hook GOG game and work perfectly (this add a unofficial Force Feedback support).
To to it I have found on github a custom version of d3d9.dll with with DllMain inside.
I have put in my code with detours with succefull hook the game without any problems.
Now I have used the some project to another GOG game but this time becouse there is no d3d9.dll inside I have used another github dll libogg.dll.
libogg don't have DllMain I have added it myself and my log confirm that both DLL_PROCESS_ATTACH and DLL_PROCESS_DETACH was called correcly.
Unfortunatenly I have many ussue to to hook, many times the app crash in "DetourAttach" and when work (random) the hook don't seem work correcly.
At the moment I don't have a prcise idea about why this happen.
Proably can depend by many reasons, but I have question:
What happen if for example libogg is not linked directly to a game exe but to another DLL that was linked to game exe ?
Can be a possible cause ? If yes, can be a good idea use zlib.dll that probably is linked direclty to a game exe ?
Or I'am not to right way ?