forked from UnigramDev/Unigram
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdllmain.cpp
32 lines (26 loc) · 831 Bytes
/
dllmain.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "pch.h"
#include "NativeUtils.h"
#include "DebugUtils.h"
using namespace winrt::Telegram::Native::implementation;
LONG WINAPI Filter(EXCEPTION_POINTERS* exceptionInfo)
{
if (NativeUtils::Callback)
{
NativeUtils::Callback(NativeUtils::GetBackTrace(exceptionInfo->ExceptionRecord->ExceptionCode));
}
// This code would allow the app to continue running,
// but there are great chances to make a big mess.
//if (exceptionInfo->ExceptionRecord->ExceptionFlags & EXCEPTION_NONCONTINUABLE)
//{
return EXCEPTION_EXECUTE_HANDLER;
//}
//return EXCEPTION_CONTINUE_EXECUTION;
}
STDAPI_(BOOL) DllMain(_In_opt_ HINSTANCE hinst, DWORD reason, _In_opt_ void* reserved)
{
if (reason == DLL_THREAD_ATTACH)
{
SetUnhandledExceptionFilter(Filter);
}
return TRUE;
}