MCPcopy Create free account
hub / github.com/beefytech/Beef / BfpSystem_Init

Function BfpSystem_Init

BeefySysLib/platform/win/Platform.cpp:950–987  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

948}
949
950BFP_EXPORT void BFP_CALLTYPE BfpSystem_Init(int version, BfpSystemInitFlags flags)
951{
952 gCrashErrorFunc = Crash_Error;
953 InitCPUFreq();
954
955 ::_set_error_mode(_OUT_TO_STDERR);
956
957#ifdef _DEBUG
958 ::_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG);
959#endif
960
961 ::CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
962 ::SetErrorMode(SEM_FAILCRITICALERRORS);
963
964 if (version != BFP_VERSION)
965 {
966 char msg[1024];
967 sprintf(msg, "Bfp build version '%d' does not match requested version '%d'", BFP_VERSION, version);
968 BfpSystem_FatalError(msg, "BFP FATAL ERROR");
969 }
970
971 if ((flags & BfpSystemInitFlag_InstallCrashCatcher) != 0)
972 {
973 // Set up a handler for pure virtual function calls
974 _set_purecall_handler(HandlePureVirtualFunctionCall);
975 // Set up a handler for invalid parameters such as printf(NULL);
976 _set_invalid_parameter_handler(HandleInvalidParameter);
977
978 // Set up a handler for abort(). This is done in two steps.
979 // First we ask the CRT to call an abort handler. This is the
980 // default, but explicitly setting it seems like a good idea.
981 _set_abort_behavior(_CALL_REPORTFAULT, _CALL_REPORTFAULT);
982 // Then we install our abort handler.
983 sOldSIGABRTHandler = signal(SIGABRT, &AbortHandler);
984 if (sOldSIGABRTHandler == SIG_ERR)
985 sOldSIGABRTHandler = nullptr;
986 }
987}
988
989BFP_EXPORT void BFP_CALLTYPE BfpSystem_InitCrashCatcher(BfpSystemInitFlags flags)
990{

Callers 3

FuzzInitFunction · 0.50
mainFunction · 0.50
InitMethod · 0.50

Calls 6

InitCPUFreqFunction · 0.85
_set_purecall_handlerFunction · 0.85
_set_abort_behaviorFunction · 0.85
BfpSystem_FatalErrorFunction · 0.70
_CrtSetReportModeFunction · 0.50

Tested by

no test coverage detected