Skip to content
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

Feature/enable disable #73

Merged
merged 1 commit into from
May 15, 2024
Merged

Conversation

cursey
Copy link
Owner

@cursey cursey commented May 13, 2024

This PR allows you to create hooks that start disabled and allows you to explicitly enable or disable them.

Closes #72

@cursey cursey changed the base branch from main to test/thread-trapping May 13, 2024 01:12
@cursey cursey mentioned this pull request May 13, 2024
@cursey cursey merged commit d943581 into test/thread-trapping May 15, 2024
5 checks passed
@cursey cursey deleted the feature/enable-disable branch May 15, 2024 04:04
@ThirteenAG
Copy link

I noticed that I'm having a crash on exit with current main branch code in some games, only in debug, while https://github.com/cursey/safetyhook/releases/tag/v0.4.1 works fine.

Unhandled exception at 0x65F2F130 (CoreUIComponents.dll) in Condemned.exe: 0xC0000602:  A fail fast exception occurred. Exception handlers will not be invoked and the process will be terminated immediately.
 	CoreUIComponents.dll!Cn::FailFast::Do(struct _EXCEPTION_RECORD *,struct _CONTEXT *)	Unknown	Symbols loaded.
 	CoreUIComponents.dll!Cn::Com::NativeEntry::NoContext_Prologue(struct Cn::Engine::GCHandleGlobalEntry *,void *)	Unknown	Symbols loaded.
 	CoreUIComponents.dll!Microsoft__CoreUI__MessagingInterop__EndpointHandler$ExportThunk(void *,void *,int)	Unknown	Symbols loaded.
 	CoreMessaging.dll!CFlat::SehSafe::Execute<<lambda_86901e9a619e5b71a38c1a71cbd0b6f1>>()	Unknown	Symbols loaded.
...
 	user32.dll!__InternalCallWinProc@20()	Unknown	Symbols loaded.
 	user32.dll!UserCallWinProcCheckWow(struct _ACTIVATION_CONTEXT *,void *,struct HWND__ *,enum _WM_VALUE,unsigned int,long,void *,int)	Unknown	Symbols loaded.
 	user32.dll!DispatchClientMessage()	Unknown	Symbols loaded.
 	user32.dll!___fnDWORD@4()	Unknown	Symbols loaded.
 	ntdll.dll!_KiUserCallbackDispatcher@12()	Unknown	Symbols loaded.
 	user32.dll!_PeekMessageW@20()	Unknown	Symbols loaded.
 	user32.dll!DialogBox2(struct HWND__ *,struct HWND__ *,int,int)	Unknown	Symbols loaded.
 	user32.dll!InternalDialogBox(void *,struct DLGTEMPLATE *,struct HWND__ *,int (*)(struct HWND__ *,unsigned int,unsigned int,long),long,unsigned int)	Unknown	Symbols loaded.
 	user32.dll!_SoftModalMessageBox@4()	Unknown	Symbols loaded.
 	user32.dll!MessageBoxWorker(struct _MSGBOXDATA *)	Unknown	Symbols loaded.
 	user32.dll!_MessageBoxTimeoutW@24()	Unknown	Symbols loaded.
 	user32.dll!_MessageBoxW@16()	Unknown	Symbols loaded.
 	Condemned.WidescreenFix.asi!__acrt_MessageBoxW(HWND__ * hwnd=0x00000000, const wchar_t * text=0x001924fc, const wchar_t * caption=0x609a0688, unsigned int type=0x00012012) Line 751	C++	Symbols loaded.
 	Condemned.WidescreenFix.asi!__crt_char_traits<wchar_t>::message_box<HWND__ *,wchar_t const * const &,wchar_t const * const &,unsigned int const &>(HWND__ * && <args_0>=0x00000000, const wchar_t * const & <args_1>=0x001924fc, const wchar_t * const & <args_2>=0x609a0688, const unsigned int & <args_3>=0x00012012) Line 122	C++	Symbols loaded.
 	Condemned.WidescreenFix.asi!common_show_message_box<wchar_t>(const wchar_t * const text=0x001924fc, const wchar_t * const caption=0x609a0688, const unsigned int type=0x00012012) Line 75	C++	Symbols loaded.
 	Condemned.WidescreenFix.asi!__acrt_show_wide_message_box(const wchar_t * text=0x001924fc, const wchar_t * caption=0x609a0688, unsigned int type=0x00012012) Line 93	C++	Symbols loaded.
 	Condemned.WidescreenFix.asi!common_message_window<wchar_t>(const int report_type=0x00000001, void * const return_address=0x608b1d2c, const wchar_t * const file_name=0x00000000, const wchar_t * const line_number=0x00000000, const wchar_t * const module_name=0x00000000, const wchar_t * const user_message=0x001957e8) Line 409	C++	Symbols loaded.
 	Condemned.WidescreenFix.asi!__acrt_MessageWindowW(const int report_type=0x00000001, void * const return_address=0x608b1d2c, const wchar_t * const file_name=0x00000000, const wchar_t * const line_number=0x00000000, const wchar_t * const module_name=0x00000000, const wchar_t * const user_message=0x001957e8) Line 464	C++	Symbols loaded.
 	Condemned.WidescreenFix.asi!_VCrtDbgReportW(int nRptType=0x00000001, void * returnAddress=0x608b1d2c, const wchar_t * szFile=0x00000000, int nLine=0x00000000, const wchar_t * szModule=0x00000000, const wchar_t * szFormat=0x60996298, char * arglist=0x0019c84c) Line 673	C++	Symbols loaded.
...
 	Condemned.WidescreenFix.asi!safetyhook::InlineHook::disable::__l2::<lambda_1>::operator()() Line 812	C++	Symbols loaded.
...
 	Condemned.WidescreenFix.asi!safetyhook::trap_threads(unsigned char * from=0x032b0165, unsigned char * to=0x03d1d5d3, unsigned int len=0x00000005, const std::function<void __cdecl(void)> & run_fn={...}) Line 1498	C++	Symbols loaded.
 	Condemned.WidescreenFix.asi!safetyhook::InlineHook::disable() Line 811	C++	Symbols loaded.
 	Condemned.WidescreenFix.asi!safetyhook::InlineHook::destroy() Line 820	C++	Symbols loaded.
 	Condemned.WidescreenFix.asi!safetyhook::InlineHook::~InlineHook() Line 559	C++	Symbols loaded.
>	Condemned.WidescreenFix.asi!safetyhook::MidHook::~MidHook() Line 837	C++	Symbols loaded.
 	Condemned.WidescreenFix.asi!safetyhook::MidHook::`scalar deleting destructor'(unsigned int)	C++	Non-user code. Symbols loaded.
...
 	Condemned.WidescreenFix.asi!_cexit() Line 307	C++	Symbols loaded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants