-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
detours crash on DetourAttach #145
Comments
HI, I have solved the problem. I have added:
before call: DetourTransactionBegin(); However I suggest to manage the error (ex.. "Target Application not ready") becouse when a application crash is very hard to find the cause becouse can depend by too much factors. |
This problem will be automatically fixed, when PR 144 is merged, because it provides a new extension API: LONG WINAPI DetourTransactionBegin()
{
return DetourTransactionBeginEx(FALSE);
} Perhaps the official can consider adding a
I didn't do that, but the official can really consider adding a parameter for stability. |
Thank you ! I have another question: Sometime when detour call the funciton crash and now always is easy to find the cause. I suspect that IDA not always return the correct number of parameters or types, but the crash can also depend by other factiors. My question is there is a way to add some managaed error exception ? For example eneble some log file that write the error ? If no, can be a good idea if is possible do it in the future. Thanks ! |
You can define the |
thank you ! there is a sample sorcce code that use DETOUR_DEBUG / DETOUR_TRACE ? I like to see it. |
create a c++ source file named #define DETOUR_DEBUG
#undef _ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE
typedef long NTSTATUS;
#include <ntstatus.h>
#define WIN32_NO_STATUS
#define DETOURS_INTERNAL
#include "detours.h"
#include "detours.cpp"
#include "disasm.cpp"
#include "image.cpp"
#include "modules.cpp"
#include "creatwth.cpp" include this file to your Detours sample project without precompiled header (.pch) file for this source file, then |
thanks ! if I do it what happen when there is an detour error ? |
Output a message to visual studio debug output window or break at the place of fatal error. |
Hi,
I have used detours on 2 projects. In the first project work fine.
The second project crash always when I use DetourAttach:
// This row cause crash
DetourAttach(&(LPVOID&)AddressOfHookDamageFunction, &HookDamageSub);
The second project is a 90% copy of the first project.
AddressOfHookDamageFunction = 0x72DD81 (this is stored in (ffback.ini)
Becouse is very hard understand why this happen. I attach the entere project:
BattleZone CC.zip
just open:
dllmain.cpp
goto "Init_Detour" and you find the line with DetourAttach.
To be honest I have no idea about this situation and I not sure if this is a bug,
Can you please verify ?
The text was updated successfully, but these errors were encountered: