• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ AddVectoredExceptionHandler函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中AddVectoredExceptionHandler函数的典型用法代码示例。如果您正苦于以下问题:C++ AddVectoredExceptionHandler函数的具体用法?C++ AddVectoredExceptionHandler怎么用?C++ AddVectoredExceptionHandler使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了AddVectoredExceptionHandler函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: RemoveVectoredExceptionHandler

PVOID dyn_AddVectoredExceptionHandler
(ULONG isFirst, PVECTORED_EXCEPTION_HANDLER handler)
{
   PVOID handlerHandle;
   if (isFirst) {
      RemoveVectoredExceptionHandler(fake_AVEH_handle);
      handlerHandle = AddVectoredExceptionHandler(isFirst,handler);
      fake_AVEH_handle = AddVectoredExceptionHandler
         (isFirst,(PVECTORED_EXCEPTION_HANDLER)dyn_trapHandler);
   }
   else {
      handlerHandle = AddVectoredExceptionHandler(isFirst,handler);
   }
   return handlerHandle;
}
开发者ID:aiaxun,项目名称:patharmor,代码行数:15,代码来源:RTwinnt.c


示例2: ut_sigaction

/*
 * ut_sigaction -- a sigaction that cannot return < 0
 */
int
ut_sigaction(const char *file, int line, const char *func,
		int signum, struct sigaction *act, struct sigaction *oldact)
{
#ifndef _WIN32
	int retval = sigaction(signum, act, oldact);
	if (retval != 0)
		ut_fatal(file, line, func, "!sigaction: %s", strsignal(signum));
	return retval;
#else
	if (signum == SIGABRT) {
		DWORD dwMode = GetErrorMode();
		SetErrorMode(dwMode | SEM_NOGPFAULTERRORBOX |
			SEM_FAILCRITICALERRORS);
		_set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
	}
	if (signum == SIGSEGV) {
		Sa_handler = act->sa_handler;
		Signum = signum;
		AddVectoredExceptionHandler(0, exception_handler);
	}

	_crt_signal_t retval = signal(signum, act->sa_handler);
	if (retval == SIG_ERR)
		ut_fatal(file, line, func, "!signal: %d", signum);

	if (oldact != NULL) {
		oldact->sa_handler = retval;
	}
	return 0;
#endif
}
开发者ID:JLLLinn,项目名称:nvml,代码行数:35,代码来源:ut_signal.c


示例3: main

int main(int argc, char *argv[])
{
	if (argc != 2 && argc != 3) {
		fprintf(stderr, "Usage: %s <filename>\n", argv[0]);
		return 1;
	}

	if (argc == 3)
		fault_count_fname = argv[2];
	else
		fault_count_fname = "fault_cnt.out";

	so_init_loader();

	if (AddVectoredExceptionHandler(HANDLER_CALL_FIRST,
					(PVECTORED_EXCEPTION_HANDLER)test_segv_handler) < 0) {
		fprintf(stderr, "cannot set signal handler\n");
		return 1;
	}

	so_execute(argv[1], argv+1);

	// Shouldn't reach here
	return 1;
}
开发者ID:murarugeorgec,项目名称:so-assignments,代码行数:25,代码来源:run_test.c


示例4: DYNINSTinitializeTrapHandler

/* registers the trap handler by calling AddVectoredExceptionHandler
 */
int DYNINSTinitializeTrapHandler()
{
   fake_AVEH_handle = AddVectoredExceptionHandler
      (RT_TRUE, (PVECTORED_EXCEPTION_HANDLER)dyn_trapHandler);
   rtdebug_printf("RTLIB: added vectored trap handler\n");
   return fake_AVEH_handle != 0;
}
开发者ID:aiaxun,项目名称:patharmor,代码行数:9,代码来源:RTwinnt.c


示例5: SetSignalHandler

void SetSignalHandler(const FuzzingOptions& Options) {
  HandlerOpt = &Options;

  if (Options.UnitTimeoutSec > 0)
    Timer.SetTimer(Options.UnitTimeoutSec / 2 + 1);

  if (Options.HandleInt || Options.HandleTerm)
    if (!SetConsoleCtrlHandler(CtrlHandler, TRUE)) {
      DWORD LastError = GetLastError();
      Printf("libFuzzer: SetConsoleCtrlHandler failed (Error code: %lu).\n",
        LastError);
      exit(1);
    }

  if (Options.HandleSegv || Options.HandleBus || Options.HandleIll ||
      Options.HandleFpe)
    if (!AddVectoredExceptionHandler(1, ExceptionHandler)) {
      Printf("libFuzzer: AddVectoredExceptionHandler failed.\n");
      exit(1);
    }

  if (Options.HandleAbrt)
    if (SIG_ERR == signal(SIGABRT, CrashHandler)) {
      Printf("libFuzzer: signal failed with %d\n", errno);
      exit(1);
    }
}
开发者ID:anupam128,项目名称:llvm,代码行数:27,代码来源:FuzzerUtilWindows.cpp


示例6: main

int main(int argc, char **argv) {
  std::set_new_handler([]() {
    errs() << "new: " << strerror(errno) << '\n';
    exit(1);
  });

  sys::PrintStackTraceOnErrorSignal(argv[0], true);
  PrettyStackTraceProgram _(argc, argv);

#ifdef _WIN32
  AddVectoredExceptionHandler(0, stackOverflow);
#endif

  cl::AddExtraVersionPrinter([](raw_ostream &os) {
    os << "Ayane (https://github.com/russellw/ayane):\n";
    os << "  Ayane version " version "\n";
#ifndef __OPTIMIZE__
    os << "  DEBUG build";
#else
    os << "  Optimized build";
#endif
#ifndef NDEBUG
    os << " with assertions";
#endif
    os << ".\n";
  });
  cl::ParseCommandLineOptions(argc, argv);

  for (auto filename : inputFilenames) {
    parsePython(filename);
    outs() << filename << '\n';
    outs().flush();
  }
  return 0;
}
开发者ID:russellw,项目名称:ayane,代码行数:35,代码来源:main.cpp


示例7: HookInt3

    /// <summary>
    /// Perform int3 hook
    /// </summary>
    /// <returns>true on success</returns>
    bool HookInt3()
    {
        this->_newCode[0] = 0xCC;
        this->_origSize = sizeof( this->_newCode[0] );

        // Setup handler
        if (this->_vecHandler == nullptr)
            this->_vecHandler = AddVectoredExceptionHandler( 1, &DetourBase::VectoredHandler );

        if (!this->_vecHandler)
            return false;

        this->_breakpoints.insert( std::make_pair( this->_original, (DetourBase*)this ) );

        // Save original code
        memcpy( this->_origCode, this->_original, this->_origSize );

        // Write break instruction
        DWORD flOld = 0;
        VirtualProtect( this->_original, this->_origSize, PAGE_EXECUTE_READWRITE, &flOld );
        memcpy( this->_original, this->_newCode, this->_origSize );
        VirtualProtect( this->_original, this->_origSize, flOld, &flOld );

        WriteProcessMemory( GetCurrentProcess(), this->_original, this->_newCode, this->_origSize, NULL );

        return this->_hooked = TRUE;
    }
开发者ID:AnyMaster,项目名称:Blackbone,代码行数:31,代码来源:LocalHook.hpp


示例8: DllMain

BOOL APIENTRY DllMain ( HMODULE hModule, DWORD  reason, LPVOID lpReserved ) {
    if ( reason == DLL_PROCESS_ATTACH ) {
        Offsets.Initialize();

        Engine.Initialize();

		CreateHackMenu();

        HMODULE aCI = GetModuleHandleA ( "libnp.dll" );
		
        if ( aCI != NULL ) {
            MessageBoxA ( NULL, "This Hack doesn't support this game version", "Game Version Not Supported", MB_OK | MB_ICONERROR );
            exit ( 1 );
        }
		aCI = GetModuleHandleA ( "teknomw3.dll" );
		if ( aCI != NULL ) {
            MessageBoxA ( NULL, "This Hack doesn't support this game version", "Game Version Not Supported", MB_OK | MB_ICONERROR );
            exit ( 1 );
        }
		
		MessageBoxA(NULL, "Hack sucesfully injected. Press INSERT or DELETE do show up the menu.\nIf it doesn't work... IDK what could be wwrong...", "Sucess", MB_OK);

        Engine.UiShowList = ( tUiShowList ) Hook.DetourFunction ( ( BYTE* ) Offsets.UIShowList_OFFS, ( BYTE* ) &hkUIShowList, 5 );
		
		AddVectoredExceptionHandler(1,pVectoredExceptionHandler); 
		*(DWORD*)Offsets.dwDVar = 0x0; //Set DVar to 0 so that an exception happens at 0x5A14F7
    }
    return TRUE;
}
开发者ID:vice655,项目名称:c-knowledge,代码行数:29,代码来源:DllMain.cpp


示例9: c_to_factor_toplevel

void c_to_factor_toplevel(CELL quot)
{
	if(!AddVectoredExceptionHandler(0, (void*)exception_handler))
		fatal_error("AddVectoredExceptionHandler failed", 0);
	c_to_factor(quot);
	RemoveVectoredExceptionHandler((void*)exception_handler);
}
开发者ID:ehird,项目名称:factor,代码行数:7,代码来源:os-windows-nt.c


示例10: assert

void CEeExecutor::AddExceptionHandler()
{
    assert(g_eeExecutor == nullptr);
    g_eeExecutor = this;

#if defined(_WIN32)
    m_handler = AddVectoredExceptionHandler(TRUE, &CEeExecutor::HandleException);
    assert(m_handler != NULL);
#elif defined(__ANDROID__)
    struct sigaction sigAction;
    sigAction.sa_handler	= nullptr;
    sigAction.sa_sigaction	= &HandleException;
    sigAction.sa_flags		= SA_SIGINFO;
    sigemptyset(&sigAction.sa_mask);
    int result = sigaction(SIGSEGV, &sigAction, nullptr);
    assert(result >= 0);
#elif defined(__APPLE__)
    kern_return_t result = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &m_port);
    assert(result == KERN_SUCCESS);

    m_handlerThread = std::thread([this] () {
        HandlerThreadProc();
    });

    result = mach_port_insert_right(mach_task_self(), m_port, m_port, MACH_MSG_TYPE_MAKE_SEND);
    assert(result == KERN_SUCCESS);

    result = thread_set_exception_ports(mach_thread_self(), EXC_MASK_BAD_ACCESS, m_port, EXCEPTION_STATE | MACH_EXCEPTION_CODES, STATE_FLAVOR);
    assert(result == KERN_SUCCESS);

    result = mach_port_mod_refs(mach_task_self(), m_port, MACH_PORT_RIGHT_SEND, -1);
    assert(result == KERN_SUCCESS);
#endif
}
开发者ID:SirNade,项目名称:Play-,代码行数:34,代码来源:EeExecutor.cpp


示例11: main

int main(int argc, char **argv)
{
		int tid1 = 10, tid2 = 30;
		AddVectoredExceptionHandler(1, CustomExceptionHandler);
		
		if ((hThreads[0] = CreateThread(NULL, 0, thredFunc, &tid1, 0, NULL)) == NULL)
		{
			printf ("Thread1 cannot be created! Error: %d", GetLastError());
			return -1;
		}
		if ((hThreads[1] = CreateThread(NULL, 0, thredFunc, &tid2, 0, NULL)) == NULL)
		{
			printf ("Thread2 cannot be created! Error: %d", GetLastError());
			return -1;
		}
		printf("Threads created!\n");
		Sleep(6000);
/*		
		printf("Queueing user APCs...\n");
		QueueUserAPC(threadAPC, hThreads[0], tid1);
		QueueUserAPC(threadAPC, hThreads[1], tid2);
		Sleep(3000);
*/
		printf("Raising exception in all threads!\n");
		RaiseExceptionInThread(hThreads[0], throwCustomException);
		RaiseExceptionInThread(hThreads[1], throwCustomException);

		WaitForMultipleObjects(2, hThreads, TRUE, INFINITE);

		return 0;
}
开发者ID:alexsardan,项目名称:MTCP-windows,代码行数:31,代码来源:main.c


示例12: swprintf

CPipeServer::CPipeServer(void)
{
	attached=FALSE;
	swprintf(datapipename, 256,L"\\\\.\\pipe\\cemonodc_pid%d", GetCurrentProcessId());
	//swprintf(eventpipename, 256,L"\\\\.\\pipe\\cemonodc_pid%d_events", GetCurrentProcessId());

	AddVectoredExceptionHandler(1, ErrorFilter);
}
开发者ID:Akheon23,项目名称:cheat-engine,代码行数:8,代码来源:PipeServer.cpp


示例13: Interrupt_3

BOOL Interrupt_3()
{
	PVOID Handle = AddVectoredExceptionHandler(1, VectoredHandler);
	SwallowedException = TRUE;
	__debugbreak();
	RemoveVectoredExceptionHandler(Handle);
	return SwallowedException;
}
开发者ID:security-geeks,项目名称:al-khaser,代码行数:8,代码来源:Interrupt_3.cpp


示例14: HwDetourAttach

BOOL HwDetourAttach( DWORD dwLineAddress, DWORD dwType, DWORD dwMonitorLen, DWORD dwExceptionHandler)
{
	HANDLE hThreadSnap;
	THREADENTRY32 te32;
	static BOOL bExceptionHandlerSet = FALSE;

	if (bExceptionHandlerSet == FALSE)
	{
		g_hVectorHandle = 
			AddVectoredExceptionHandler(1, (PVECTORED_EXCEPTION_HANDLER)VectoredHandler);
		bExceptionHandlerSet = !bExceptionHandlerSet;
	}


	BOOL bHaveFreeDbgBreak = FALSE;
	for(int i = 0; i < 4; i++)
	{
		if( TRUE == g_ExceptionInfo[i].bIsFree)
		{
			bHaveFreeDbgBreak = TRUE;
			break;
		}
	}
	if (bHaveFreeDbgBreak == FALSE)
	{
		return FALSE;
	}
	hThreadSnap =  CreateToolhelp32Snapshot(  TH32CS_SNAPTHREAD, NULL  );
	if(  hThreadSnap == INVALID_HANDLE_VALUE  ) 
		return FALSE; 
	te32.dwSize = sizeof(  THREADENTRY32  ); 
	if(  Thread32First(  hThreadSnap, &te32 ) )
	{
		do
		{  
			if(  te32.th32OwnerProcessID != GetCurrentProcessId() || 
				 te32.th32ThreadID		 == GetCurrentThreadId() )
				continue;

			InstDbgBreak2Thrd(  te32.th32ThreadID, dwLineAddress, dwType, dwMonitorLen );


		} while(  Thread32Next(  hThreadSnap, &te32 ) );
	}

	for(int i = 0; i < 4; i++)
	{
		if( TRUE == g_ExceptionInfo[i].bIsFree)
		{
			g_ExceptionInfo[i].bIsFree = FALSE;
			g_ExceptionInfo[i].dwLineAddr = dwLineAddress;
			g_ExceptionInfo[i].dwAccessType = dwType;
			g_ExceptionInfo[i].dwExceptionHanler = dwExceptionHandler;
			break;
		}
	}
	return TRUE;
}
开发者ID:danieljiang0415,项目名称:gh,代码行数:58,代码来源:dbghook.cpp


示例15: _fork_override_cygwin_exceptions

int
_fork_override_cygwin_exceptions()
{
    HANDLE hr;
    hr = AddVectoredExceptionHandler(1, &_fork_cygwin_exception_handler);
    assert(hr != NULL);
    hr = AddVectoredContinueHandler(1, &_fork_cygwin_continue_handler);
    assert(hr != NULL);
}
开发者ID:talos-vulndev,项目名称:afl-cygwin,代码行数:9,代码来源:winapi.c


示例16: main

int main(int argc, char *argv[])
{
	AddVectoredExceptionHandler(1,clsCrashHandler::ErrorReporter);

    if (!IsUserAdmin())
    {
        MessageBoxW(NULL,L"You didn´t start the debugger with admin rights!\r\nThis could cause problems with some features!",L"Nanomite",MB_OK);
    }

	clsMemManager clsMManage = clsMemManager();
	//Tests - 500bytes, 100000 rounds
	//Test using malloc and free:  8750 
	//Test using clsMemManager:  31
	//
	//Test - 1014bytes, 100000 rounds
	//Test using malloc and free:  9187 
	//Test using clsMemManager:  31

	//DWORD dwStartTick = GetTickCount();

	//DWORD pMem[100000];
	//for(int i = 0; i < 100000; i++)
	//{
	//	pMem[i] = (DWORD)malloc(512);
	//}

	//for(int i = 0; i < 100000; i++)
	//{
	//	free((void*)pMem[i]);
	//}
	//qDebug() << "Test using malloc and free: " << GetTickCount() - dwStartTick;

	//
	//dwStartTick = GetTickCount();
	//for(int i = 0; i < 100000; i++)
	//{
	//	pMem[i] = (DWORD)clsMemManager::CAlloc(512);
	//}
	//
	//for(int i = 0; i < 100000; i++)
	//{
	//	clsMemManager::CFree((void*)pMem[i]);
	//}
	//qDebug() << "Test using clsMemManager: " << GetTickCount() - dwStartTick;

	
	QApplication a(argc, argv);
	qtDLGNanomite w;
	w.show();

#ifdef _DEBUG
	return a.exec(); 
#else
	// ugly workaround for cruntime crash caused by new override!
	TerminateProcess(GetCurrentProcess(),a.exec());
#endif
}
开发者ID:zyan03,项目名称:Nanomite,代码行数:57,代码来源:main.cpp


示例17: RegisterHandler

void RegisterHandler(ExceptionHandler *h)
{
	if (!h)
		return;

	if (!h_)
	{
		h_ = AddVectoredExceptionHandler(1, &OnExceptionThunk);
	}
	handlers_.emplace_back(h);
}
开发者ID:mvpete,项目名称:CPPUnitTest2,代码行数:11,代码来源:ExceptionHandler.cpp


示例18: InstallExceptionHandler

void InstallExceptionHandler()
{
	// Make sure this is only called once per process execution
	// Instead, could make a Uninstall function, but whatever..
	static bool handlerInstalled = false;
	if (handlerInstalled)
		return;

	AddVectoredExceptionHandler(TRUE, Handler);
	handlerInstalled = true;
}
开发者ID:CryZe,项目名称:dolphin,代码行数:11,代码来源:MemTools.cpp


示例19: main2

ForceInline Void main2(Int argc, WChar **argv)
{
    CMscDecl md;

    AddVectoredExceptionHandler(True, VectoredHandler);
    for (int i = 1; i != argc ; i++)
    {
        wprintf(L"Peeking \"%s\" ... ", *++argv);
        printf("%s\n", md.PeekText(*argv) ? "OK" : "failed");
    }
}
开发者ID:Emiyasviel,项目名称:Arianrhod,代码行数:11,代码来源:main.cpp


示例20: AddVectoredExceptionHandler

 FatalConditionHandler::FatalConditionHandler() {
     isSet = true;
     // 32k seems enough for Catch to handle stack overflow,
     // but the value was found experimentally, so there is no strong guarantee
     guaranteeSize = 32 * 1024;
     exceptionHandlerHandle = nullptr;
     // Register as first handler in current chain
     exceptionHandlerHandle = AddVectoredExceptionHandler(1, handleVectoredException);
     // Pass in guarantee size to be filled
     SetThreadStackGuarantee(&guaranteeSize);
 }
开发者ID:sakamoto-poteko,项目名称:Catch2,代码行数:11,代码来源:catch_fatal_condition.cpp



注:本文中的AddVectoredExceptionHandler函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ AddVertex函数代码示例发布时间:2022-05-30
下一篇:
C++ AddValueToSplayTree函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap