本文整理汇总了C++中SetUnhandledExceptionFilter函数的典型用法代码示例。如果您正苦于以下问题:C++ SetUnhandledExceptionFilter函数的具体用法?C++ SetUnhandledExceptionFilter怎么用?C++ SetUnhandledExceptionFilter使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetUnhandledExceptionFilter函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetUnhandledExceptionFilter
void CDebugMgr::EnableExceptionHandler()
{
if ( m_prevExceptionHandler ) return;
m_prevExceptionHandler = SetUnhandledExceptionFilter(CDebugMgr::ExceptionHandler);
}
示例2: InstallSignalHandlers
void InstallSignalHandlers(const char *ProgramName)
{
gFPEPreviousFilter = SetUnhandledExceptionFilter(FpeHandler);
}
示例3: WinMain
//.........这里部分代码省略.........
}
}
}
if (doIntroDialogs) {
needExit = ::DialogBoxParam( hInst, MAKEINTRESOURCE( IDD_URULOGIN_MAIN ), NULL, UruLoginDialogProc, (LPARAM)&loginParam ) <= 0;
}
if (doIntroDialogs && !needExit) {
HINSTANCE hRichEdDll = LoadLibrary("RICHED20.DLL");
INT_PTR val = ::DialogBoxParam( hInst, MAKEINTRESOURCE( IDD_URULOGIN_EULA ), NULL, UruTOSDialogProc, (LPARAM)hInst);
FreeLibrary(hRichEdDll);
if (val <= 0) {
DWORD error = GetLastError();
needExit = true;
}
}
curl_global_cleanup();
if (needExit) {
DeInitNetClientComm();
return PARABLE_NORMAL_EXIT;
}
NetCliAuthAutoReconnectEnable(true);
// VERY VERY FIRST--throw up our splash screen
HWND splashDialog = ::CreateDialog( hInst, MAKEINTRESOURCE( IDD_LOADING ), NULL, SplashDialogProc );
// Install our unhandled exception filter for trapping all those nasty crashes in release build
#ifndef HS_DEBUGGING
LPTOP_LEVEL_EXCEPTION_FILTER oldFilter;
oldFilter = SetUnhandledExceptionFilter( plCustomUnhandledExceptionFilter );
#endif
//
// Set up to log errors by using hsDebugMessage
//
DebugInit();
DebugMsgF("Plasma 2.0.%i.%i - %s", PLASMA2_MAJOR_VERSION, PLASMA2_MINOR_VERSION, plProduct::ProductString().c_str());
for (;;) {
// Create Window
if (!WinInit(hInst, nCmdShow) || gClient->GetDone())
break;
// We don't have multiplayer localized assets for Italian or Spanish, so force them to English in that case.
/* if (!plNetClientMgr::GetInstance()->InOfflineMode() &&
(plLocalization::GetLanguage() == plLocalization::kItalian ||
plLocalization::GetLanguage() == plLocalization::kSpanish))
{
plLocalization::SetLanguage(plLocalization::kEnglish);
}
*/
// Done with our splash now
::DestroyWindow( splashDialog );
if (!gClient)
break;
// Show the main window
ShowWindow(gClient->GetWindowHandle(), SW_SHOW);
gHasMouse = GetSystemMetrics(SM_MOUSEPRESENT);
示例4: installCrashHandler
void installCrashHandler()
{
SetUnhandledExceptionFilter(ExceptionHandler);
}
示例5: win32_seh_init
void win32_seh_init()
{
mono_old_win_toplevel_exception_filter = SetUnhandledExceptionFilter(seh_unhandled_exception_filter);
mono_win_vectored_exception_handle = AddVectoredExceptionHandler (1, seh_vectored_exception_handler);
}
示例6: debug_set_exception_handler
void debug_set_exception_handler()
{
#ifdef _MSC_VER
SetUnhandledExceptionFilter(Win32ExceptionHandler);
#endif
}
示例7: WinMain
//-----------------------------------------------------------------------------
// Name: WinMain()
// Desc: The application's entry point
//-----------------------------------------------------------------------------
INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR commandLine, INT )
{
// set up some xbmc specific relationships
XBMC::Context context;
//this can't be set from CAdvancedSettings::Initialize() because it will overwrite
//the loglevel set with the --debug flag
#ifdef _DEBUG
g_advancedSettings.m_logLevel = LOG_LEVEL_DEBUG;
g_advancedSettings.m_logLevelHint = LOG_LEVEL_DEBUG;
#else
g_advancedSettings.m_logLevel = LOG_LEVEL_NORMAL;
g_advancedSettings.m_logLevelHint = LOG_LEVEL_NORMAL;
#endif
CLog::SetLogLevel(g_advancedSettings.m_logLevel);
// Initializes CreateMiniDump to handle exceptions.
win32_exception::set_version(g_infoManager.GetVersion());
SetUnhandledExceptionFilter( CreateMiniDump );
// check if XBMC is already running
CreateMutex(NULL, FALSE, "XBMC Media Center");
if(GetLastError() == ERROR_ALREADY_EXISTS)
{
HWND m_hwnd = FindWindow("XBMC","XBMC");
if(m_hwnd != NULL)
{
// switch to the running instance
ShowWindow(m_hwnd,SW_RESTORE);
SetForegroundWindow(m_hwnd);
}
return 0;
}
#ifndef HAS_DX
if(CWIN32Util::GetDesktopColorDepth() < 32)
{
//FIXME: replace it by a SDL window for all ports
MessageBox(NULL, "Desktop Color Depth isn't 32Bit", "XBMC: Fatal Error", MB_OK|MB_ICONERROR);
return 0;
}
#endif
//Initialize COM
CoInitializeEx(NULL, COINIT_MULTITHREADED);
// Handle numeric values using the default/POSIX standard
setlocale(LC_NUMERIC, "C");
// If the command line passed to WinMain, commandLine, is not "" we need
// to process the command line arguments.
// Note that commandLine does not include the program name and can be
// equal to "" if no arguments were supplied. By contrast GetCommandLineW()
// does include the program name and is never equal to "".
g_advancedSettings.Initialize();
if (strlen(commandLine) != 0)
{
int argc;
LPWSTR* argvW = CommandLineToArgvW(GetCommandLineW(), &argc);
CStdString* strargvA = new CStdString[argc];
const char** argv = (const char**) LocalAlloc(LMEM_FIXED, argc*sizeof(char*));
for (int i = 0; i < argc; i++)
{
g_charsetConverter.wToUTF8(argvW[i], strargvA[i]);
argv[i] = strargvA[i].c_str();
}
// Parse the arguments
CAppParamParser appParamParser;
appParamParser.Parse(argv, argc);
// Clean up the storage we've used
LocalFree(argvW);
LocalFree(argv);
delete [] strargvA;
}
// Initialise Winsock
WSADATA wd;
WSAStartup(MAKEWORD(2,2), &wd);
// use 1 ms timer precision - like SDL initialization used to do
timeBeginPeriod(1);
#ifdef XBMC_TRACK_EXCEPTIONS
try
{
#endif
// Create and run the app
if(!g_application.Create())
{
MessageBox(NULL, "ERROR: Unable to create application. Exiting.", "XBMC: Error", MB_OK|MB_ICONERROR);
return 1;
}
#ifdef XBMC_TRACK_EXCEPTIONS
//.........这里部分代码省略.........
示例8: DllStop
void DllStop()
{
#if defined(SHOW_EXE_TIMINGS) || defined(SHOW_EXE_MSGBOX)
wchar_t szTimingMsg[512]; UNREFERENCED_PARAMETER(szTimingMsg);
HANDLE hTimingHandle = GetStdHandle(STD_OUTPUT_HANDLE);
#endif
print_timings(L"DllStop");
//gbDllStopCalled = TRUE; -- в конце
#ifdef HOOK_USE_DLLTHREAD
DllThreadClose();
#endif
#ifdef _DEBUG
wchar_t *szModule = (wchar_t*)calloc((MAX_PATH+1),sizeof(wchar_t));
if (!GetModuleFileName(NULL, szModule, MAX_PATH+1))
_wcscpy_c(szModule, MAX_PATH+1, L"GetModuleFileName failed");
const wchar_t* pszName = PointToName(szModule);
//if (!lstrcmpi(pszName, L"mingw32-make.exe"))
// GuiMessageBox(ghConEmuWnd, L"mingw32-make.exe terminating", L"ConEmuHk", MB_SYSTEMMODAL);
free(szModule);
#endif
// 120528 - Очистить буфер от мышиных событий, иначе получаются казусы.
// Если во время выполнения команды (например "dir c: /s")
// успеть дернуть мышкой - то при возврате в ФАР сразу пойдет фаровский драг
if (ghConWnd)
{
print_timings(L"FlushMouseEvents");
FlushMouseEvents();
}
#ifdef USE_PIPE_SERVER
if (gpHookServer)
{
print_timings(L"StopPipeServer");
gpHookServer->StopPipeServer();
free(gpHookServer);
gpHookServer = NULL;
}
#endif
#ifdef _DEBUG
if (ghGuiClientRetHook)
{
print_timings(L"unhookWindowsHookEx");
user->unhookWindowsHookEx(ghGuiClientRetHook);
}
#endif
if (/*!gbSkipInjects &&*/ gbHooksWasSet)
{
print_timings(L"ShutdownHooks");
gbHooksWasSet = FALSE;
// Завершить работу с реестром
DoneHooksReg();
// "Закрыть" хуки
ShutdownHooks();
}
//if (gnRunMode == RM_APPLICATION)
//{
print_timings(L"SendStopped");
SendStopped();
//}
if (gpConMap)
{
print_timings(L"gpConMap->CloseMap");
gpConMap->CloseMap();
gpConInfo = NULL;
delete gpConMap;
gpConMap = NULL;
}
//#ifndef TESTLINK
print_timings(L"CommonShutdown");
CommonShutdown();
print_timings(L"FinalizeHookedModules");
FinalizeHookedModules();
#ifndef _DEBUG
HeapDeinitialize();
#endif
#ifdef _DEBUG
#ifdef UseDebugExceptionFilter
// ?gfnPrevFilter?
// Вернуть. A value of NULL for this parameter specifies default handling within UnhandledExceptionFilter.
SetUnhandledExceptionFilter(NULL);
#endif
#endif
gbDllStopCalled = TRUE;
print_timings(L"DllStop - Done");
}
示例9: main
INT main(INT argc, CHAR* argv[])
{
#if defined(__WINDOWS__)
SetUnhandledExceptionFilter(MyUnhandledExceptionFilter);
_CrtSetDbgFlag(_CrtSetDbgFlag(0) | _CRTDBG_LEAK_CHECK_DF);
#endif
__ENTER_FUNCTION
if( argc>1 )
{
for( int i=1; i<argc; i++ )
{
if( strcmp(argv[i],"-ignoreassert")==0 )
{
g_Command_Assert=1 ;
}
else if( strcmp(argv[i],"-retryassert")==0 )
{
g_Command_Assert=2 ;
}
if( strcmp(argv[i],"-ignoremessagebox")==0 )
{
g_Command_IgnoreMessageBox=TRUE ;
}
if( strcmp(argv[i],"-singledb")==0 )
{
g_SingleDBConnection=1;
}
}
}
//时间管理器
g_pTimeManager = new TimeManager;
g_pTimeManager->Init();
g_pLog = new Log ;
Assert( g_pLog ) ;
BOOL ret = g_pLog->Init( ) ;
Assert(ret) ;
g_pLog->SaveLog(LOGIN_LOGFILE, "\r\n(###) main..." ) ;
g_pTimeManager->SetTime( ) ;
g_pLog->SaveLog(LOGIN_LOGFILE, "Login Starting... (%.10d)(%d)",
g_pTimeManager->Time2DWORD(),
g_pTimeManager->StartTime() ) ;
srand(g_pTimeManager->CurrentTime());
BOOL bRet = g_Login.Init();
Assert(bRet);
bRet = g_Login.Loop();
Assert(bRet);
bRet = g_Login.Exit();
Assert(bRet);
return 0;
__LEAVE_FUNCTION
return -1;
}
示例10: WinMain
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow )
{
int argc;
/* VLC does not change the thread locale, so gettext/libintil will use the
* user default locale as reference. */
/* gettext versions 0.18-0.18.1 will use the Windows Vista locale name
* if the GETTEXT_MUI environment variable is set. If not set or if running
* on Windows 2000/XP/2003 an hard-coded language ID list is used. This
* putenv() call may become redundant with later versions of gettext. */
putenv("GETTEXT_MUI=1");
#ifdef TOP_BUILDDIR
putenv("VLC_PLUGIN_PATH=Z:"TOP_BUILDDIR"/modules");
putenv("VLC_DATA_PATH=Z:"TOP_SRCDIR"/share");
#endif
HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0);
/* SetProcessDEPPolicy */
HINSTANCE h_Kernel32 = LoadLibraryW(L"kernel32.dll");
if(h_Kernel32)
{
BOOL (WINAPI * mySetProcessDEPPolicy)( DWORD dwFlags);
BOOL (WINAPI * mySetDllDirectoryA)(const char* lpPathName);
# define PROCESS_DEP_ENABLE 1
mySetProcessDEPPolicy = (BOOL WINAPI (*)(DWORD))
GetProcAddress(h_Kernel32, "SetProcessDEPPolicy");
if(mySetProcessDEPPolicy)
mySetProcessDEPPolicy(PROCESS_DEP_ENABLE);
/* Do NOT load any library from cwd. */
mySetDllDirectoryA = (BOOL WINAPI (*)(const char*))
GetProcAddress(h_Kernel32, "SetDllDirectoryA");
if(mySetDllDirectoryA)
mySetDllDirectoryA("");
FreeLibrary(h_Kernel32);
}
/* Args */
wchar_t **wargv = CommandLineToArgvW (GetCommandLine (), &argc);
if (wargv == NULL)
return 1;
char *argv[argc + 3];
BOOL crash_handling = TRUE;
int j = 0;
argv[j++] = FromWide( L"--media-library" );
argv[j++] = FromWide( L"--no-ignore-config" );
for (int i = 1; i < argc; i++)
{
if(!wcscmp(wargv[i], L"--no-crashdump"))
{
crash_handling = FALSE;
continue; /* don't give argument to libvlc */
}
argv[j++] = FromWide (wargv[i]);
}
argc = j;
argv[argc] = NULL;
LocalFree (wargv);
if(crash_handling)
{
static wchar_t path[MAX_PATH];
if( S_OK != SHGetFolderPathW( NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE,
NULL, SHGFP_TYPE_CURRENT, path ) )
fprintf( stderr, "Can't open the vlc conf PATH\n" );
swprintf( path+wcslen( path ), L"%s", L"\\vlc\\crashdump" );
crashdump_path = &path[0];
check_crashdump();
SetUnhandledExceptionFilter(vlc_exception_filter);
}
_setmode( STDIN_FILENO, _O_BINARY ); /* Needed for pipes */
/* Initialize libvlc */
libvlc_instance_t *vlc;
vlc = libvlc_new (argc, (const char **)argv);
if (vlc != NULL)
{
libvlc_set_user_agent (vlc, "VLC media player", "VLC/"PACKAGE_VERSION);
libvlc_add_intf (vlc, "globalhotkeys,none");
libvlc_add_intf (vlc, NULL);
libvlc_playlist_play (vlc, -1, 0, NULL);
libvlc_wait (vlc);
libvlc_release (vlc);
}
for (int i = 0; i < argc; i++)
free (argv[i]);
(void)hInstance; (void)hPrevInstance; (void)lpCmdLine; (void)nCmdShow;
//.........这里部分代码省略.........
示例11: crSetErrorMsg
int CCrashHandler::SetProcessExceptionHandlers(DWORD dwFlags)
{
crSetErrorMsg(_T("Unspecified error."));
// If 0 is specified as dwFlags, assume all handlers should be
// installed
if((dwFlags&0x1FF)==0)
dwFlags |= 0x1FFF;
if(dwFlags&CR_INST_STRUCTURED_EXCEPTION_HANDLER)
{
// Install top-level SEH handler
m_oldSehHandler = SetUnhandledExceptionFilter(SehHandler);
}
_set_error_mode(_OUT_TO_STDERR);
#if _MSC_VER>=1300
if(dwFlags&CR_INST_PURE_CALL_HANDLER)
{
// Catch pure virtual function calls.
// Because there is one _purecall_handler for the whole process,
// calling this function immediately impacts all threads. The last
// caller on any thread sets the handler.
// http://msdn.microsoft.com/en-us/library/t296ys27.aspx
m_prevPurec = _set_purecall_handler(PureCallHandler);
}
if(dwFlags&CR_INST_NEW_OPERATOR_ERROR_HANDLER)
{
// Catch new operator memory allocation exceptions
_set_new_mode(1); // Force malloc() to call new handler too
m_prevNewHandler = _set_new_handler(NewHandler);
}
#endif
#if _MSC_VER>=1400
if(dwFlags&CR_INST_INVALID_PARAMETER_HANDLER)
{
// Catch invalid parameter exceptions.
m_prevInvpar = _set_invalid_parameter_handler(InvalidParameterHandler);
}
#endif
#if _MSC_VER>=1300 && _MSC_VER<1400
if(dwFlags&CR_INST_SECURITY_ERROR_HANDLER)
{
// Catch buffer overrun exceptions
// The _set_security_error_handler is deprecated in VC8 C++ run time library
m_prevSec = _set_security_error_handler(SecurityHandler);
}
#endif
// Set up C++ signal handlers
if(dwFlags&CR_INST_SIGABRT_HANDLER)
{
#if _MSC_VER>=1400
_set_abort_behavior(_CALL_REPORTFAULT, _CALL_REPORTFAULT);
#endif
// Catch an abnormal program termination
m_prevSigABRT = signal(SIGABRT, SigabrtHandler);
}
if(dwFlags&CR_INST_SIGILL_HANDLER)
{
// Catch illegal instruction handler
m_prevSigINT = signal(SIGINT, SigintHandler);
}
if(dwFlags&CR_INST_TERMINATE_HANDLER)
{
// Catch a termination request
m_prevSigTERM = signal(SIGTERM, SigtermHandler);
}
crSetErrorMsg(_T("Success."));
return 0;
}
示例12: InitLanguageSupport
bool DolphinApp::OnInit()
{
InitLanguageSupport();
// Declarations and definitions
bool UseDebugger = false;
bool UseLogger = false;
bool selectVideoBackend = false;
bool selectAudioEmulation = false;
wxString videoBackendName;
wxString audioEmulationName;
wxString userPath;
#if wxUSE_CMDLINE_PARSER // Parse command lines
wxCmdLineEntryDesc cmdLineDesc[] =
{
{
wxCMD_LINE_SWITCH, "h", "help",
"Show this help message",
wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP
},
{
wxCMD_LINE_SWITCH, "d", "debugger",
"Opens the debugger",
wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL
},
{
wxCMD_LINE_SWITCH, "l", "logger",
"Opens the logger",
wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL
},
{
wxCMD_LINE_OPTION, "e", "exec",
"Loads the specified file (DOL,ELF,GCM,ISO,WAD)",
wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL
},
{
wxCMD_LINE_SWITCH, "b", "batch",
"Exit Dolphin with emulator",
wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL
},
{
wxCMD_LINE_OPTION, "V", "video_backend",
"Specify a video backend",
wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL
},
{
wxCMD_LINE_OPTION, "A", "audio_emulation",
"Low level (LLE) or high level (HLE) audio",
wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL
},
{
wxCMD_LINE_OPTION, "m", "movie",
"Play a movie file",
wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL
},
{
wxCMD_LINE_OPTION, "U", "user",
"User folder path",
wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL
},
{
wxCMD_LINE_NONE, nullptr, nullptr, nullptr, wxCMD_LINE_VAL_NONE, 0
}
};
// Gets the command line parameters
wxCmdLineParser parser(cmdLineDesc, argc, argv);
if (parser.Parse() != 0)
{
return false;
}
UseDebugger = parser.Found("debugger");
UseLogger = parser.Found("logger");
LoadFile = parser.Found("exec", &FileToLoad);
BatchMode = parser.Found("batch");
selectVideoBackend = parser.Found("video_backend", &videoBackendName);
selectAudioEmulation = parser.Found("audio_emulation", &audioEmulationName);
playMovie = parser.Found("movie", &movieFile);
if (parser.Found("user", &userPath))
{
File::CreateFullPath(WxStrToStr(userPath) + DIR_SEP);
File::GetUserPath(D_USER_IDX, userPath.ToStdString() + DIR_SEP);
}
#endif // wxUSE_CMDLINE_PARSER
// Register message box and translation handlers
RegisterMsgAlertHandler(&wxMsgAlert);
RegisterStringTranslator(&wxStringTranslator);
// "ExtendedTrace" looks freakin' dangerous!!!
#ifdef _WIN32
EXTENDEDTRACEINITIALIZE(".");
SetUnhandledExceptionFilter(&MyUnhandledExceptionFilter);
#elif wxUSE_ON_FATAL_EXCEPTION
wxHandleFatalExceptions(true);
#endif
//.........这里部分代码省略.........
示例13: main
int main(int argc, char *argv[])
{
double res = 0.;
int i;
#ifndef X64
int j;
#endif
char *buf;
#ifdef LINUX
stack_t sigstack;
#endif
#ifdef USE_DYNAMO
dynamorio_app_init();
dynamorio_app_start();
#endif
#ifdef LINUX
/* our modrm16 tests clobber esp so we need an alternate stack */
sigstack.ss_sp = (char *) malloc(ALT_STACK_SIZE);
sigstack.ss_size = ALT_STACK_SIZE;
sigstack.ss_flags = SS_ONSTACK;
i = sigaltstack(&sigstack, NULL);
assert(i == 0);
intercept_signal(SIGILL, (handler_3_t) signal_handler, true);
intercept_signal(SIGSEGV, (handler_3_t) signal_handler, true);
#else
SetUnhandledExceptionFilter((LPTOP_LEVEL_EXCEPTION_FILTER) our_top_handler);
#endif
buf = allocate_mem(7*256+1, ALLOW_READ|ALLOW_WRITE|ALLOW_EXEC);
assert(buf != NULL);
#ifndef X64
print("Jumping to a sequence of every addr16 modrm byte\n");
for (j=0; j<256; j++) {
int mod = ((j >> 6) & 0x3); /* top 2 bits */
int reg = ((j >> 3) & 0x7); /* middle 3 bits */
int rm = (j & 0x7); /* bottom 3 bits */
# if defined(LINUX) || defined(X64)
buf[j*7 + 0] = 0x65; /* gs: */
# else
buf[j*7 + 0] = 0x64; /* fs: */
# endif
buf[j*7 + 1] = 0x67; /* addr16 */
buf[j*7 + 2] = 0x8b; /* load */
# ifdef WINDOWS
/* Windows can't handle stack pointer being off */
if (reg == 4) { /* xsp */
buf[j*7 + 3] = j | 0x8;
} else
buf[j*7 + 3] = j; /* nearly every single modrm byte */
# else
buf[j*7 + 3] = j; /* every single modrm byte */
# endif
if (mod == 1) {
buf[j*7 + 4] = 0x03; /* disp */
buf[j*7 + 5] = 0xc3;
} else if (mod == 2 || (mod == 0 && rm == 6)) {
buf[j*7 + 4] = 0x03; /* disp */
buf[j*7 + 5] = 0x00; /* disp */
} else {
buf[j*7 + 4] = 0xc3; /* ret */
buf[j*7 + 5] = 0xc3;
}
buf[j*7 + 6] = 0xc3;
}
buf[256*7] = 0xcc;
print_access_vio = false;
for (j=0; j<256; j++) {
i = SIGSETJMP(mark);
if (i == 0)
test_modrm16(&buf[j*7]);
else
continue;
}
print("Done with modrm test: tested %d\n", j);
count = 0;
print_access_vio = true;
#endif /* !X64 */
/* multi-byte nop tests (case 9862) */
i = SIGSETJMP(mark);
if (i == 0) {
print("Testing nops\n");
test_nops();
print("Done with nops\n");
}
/* SSE3 and 3DNow instrs will not run on all processors so we can't have this
* regression test fully test everything: for now its main use is running
* manually on the proper machines, or manually verifying decoding of these,
* but we'll leave as a suite/ regression test.
*/
/* SSE3 tests: mostly w/ modrm of (%edx) */
i = SIGSETJMP(mark);
if (i == 0) {
print("Testing SSE3\n");
test_sse3(buf);
//.........这里部分代码省略.........
示例14: TerminateCrashHandler
void TerminateCrashHandler()
{
SetUnhandledExceptionFilter(nullptr);
}
示例15: DllMain
BOOL WINAPI DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
BOOL lbAllow = TRUE;
switch(ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
{
gnDllState = ds_DllProcessAttach;
#ifdef _DEBUG
HANDLE hProcHeap = GetProcessHeap();
#endif
HeapInitialize();
ghOurModule = (HMODULE)hModule;
ghConWnd = GetConsoleWindow();
if (ghConWnd)
GetConsoleTitle(gsInitConTitle, countof(gsInitConTitle));
gnSelfPID = GetCurrentProcessId();
ghWorkingModule = (u64)hModule;
gfGetRealConsoleWindow = GetConsoleWindow;
user = (UserImp*)calloc(1, sizeof(*user));
GetMainThreadId(); // Инициализировать gnHookMainThreadId
gcchLastWriteConsoleMax = 4096;
gpszLastWriteConsole = (wchar_t*)calloc(gcchLastWriteConsoleMax,sizeof(*gpszLastWriteConsole));
gInQueue.Initialize(512, NULL);
#ifdef _DEBUG
gAllowAssertThread = am_Pipe;
#endif
#ifdef _DEBUG
#ifdef UseDebugExceptionFilter
gfnPrevFilter = SetUnhandledExceptionFilter(HkExceptionFilter);
#endif
#endif
#ifdef SHOW_STARTED_MSGBOX
if (!IsDebuggerPresent())
{
::MessageBox(ghConEmuWnd, L"ConEmuHk*.dll loaded", L"ConEmu hooks", MB_SYSTEMMODAL);
}
#endif
#ifdef _DEBUG
DWORD dwConMode = -1;
GetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), &dwConMode);
#endif
//_ASSERTE(ghHeap == NULL);
//ghHeap = HeapCreate(HEAP_GENERATE_EXCEPTIONS, 200000, 0);
wchar_t szEvtName[64];
msprintf(szEvtName, countof(szEvtName), CECONEMUROOTPROCESS, gnSelfPID);
HANDLE hRootProcessFlag = OpenEvent(SYNCHRONIZE|EVENT_MODIFY_STATE, FALSE, szEvtName);
DWORD nWaitRoot = -1;
if (hRootProcessFlag)
{
nWaitRoot = WaitForSingleObject(hRootProcessFlag, 0);
gbSelfIsRootConsoleProcess = (nWaitRoot == WAIT_OBJECT_0);
}
SafeCloseHandle(hRootProcessFlag);
#ifdef HOOK_USE_DLLTHREAD
_ASSERTEX(FALSE && "Hooks starting in background thread?");
//HANDLE hEvents[2];
//hEvents[0] = CreateEvent(NULL, FALSE, FALSE, NULL);
//hEvents[1] =
ghStartThread = CreateThread(NULL, 0, DllStart, NULL/*(LPVOID)(hEvents[0])*/, 0, &gnStartThreadID);
if (ghStartThread == NULL)
{
//_ASSERTE(ghStartThread!=NULL);
wchar_t szMsg[128]; DWORD nErrCode = GetLastError();
msprintf(szMsg, countof(szMsg),
L"Failed to start DllStart thread!\nErrCode=0x%08X\nPID=%u",
nErrCode, GetCurrentProcessId());
GuiMessageBox(ghConEmuWnd, szMsg, L"ConEmu hooks", 0);
}
else
{
DWORD nThreadWait = WaitForSingleObject(ghStartThread, 5000);
DllThreadClose();
}
//DWORD nThreadWait = WaitForMultipleObjects(hEvents, countof(hEvents), FALSE, INFINITE);
//CloseHandle(hEvents[0]);
#else
DllStart(NULL);
#endif
user->setAllowLoadLibrary();
}
break;
case DLL_THREAD_ATTACH:
{
gnDllThreadCount++;
if (gbHooksWasSet)
InitHooksRegThread();
}
break;
//.........这里部分代码省略.........