MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / AppInitBasicSetup

Function AppInitBasicSetup

src/init.cpp:874–922  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

872};
873
874bool AppInitBasicSetup()
875{
876 // ********************************************************* Step 1: setup
877#ifdef _MSC_VER
878 // Turn off Microsoft heap dump noise
879 _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
880 _CrtSetReportFile(_CRT_WARN, CreateFileA("NUL", GENERIC_WRITE, 0, nullptr, OPEN_EXISTING, 0, 0));
881 // Disable confusing "helpful" text message on abort, Ctrl-C
882 _set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
883#endif
884#ifdef WIN32
885 // Enable Data Execution Prevention (DEP)
886 // Minimum supported OS versions: WinXP SP3, WinVista >= SP1, Win Server 2008
887 // A failure is non-critical and needs no further attention!
888#ifndef PROCESS_DEP_ENABLE
889 // We define this here, because GCCs winbase.h limits this to _WIN32_WINNT >= 0x0601 (Windows 7),
890 // which is not correct. Can be removed, when GCCs winbase.h is fixed!
891#define PROCESS_DEP_ENABLE 0x00000001
892#endif
893 typedef BOOL (WINAPI *PSETPROCDEPPOL)(DWORD);
894 PSETPROCDEPPOL setProcDEPPol = (PSETPROCDEPPOL)GetProcAddress(GetModuleHandleA("Kernel32.dll"), "SetProcessDEPPolicy");
895 if (setProcDEPPol != nullptr) setProcDEPPol(PROCESS_DEP_ENABLE);
896#endif
897
898 if (!SetupNetworking())
899 return InitError("Initializing networking failed");
900
901#ifndef WIN32
902 if (!gArgs.GetBoolArg("-sysperms", false)) {
903 umask(077);
904 }
905
906 // Clean shutdown on SIGTERM
907 registerSignalHandler(SIGTERM, HandleSIGTERM);
908 registerSignalHandler(SIGINT, HandleSIGTERM);
909
910 // Reopen debug.log on SIGHUP
911 registerSignalHandler(SIGHUP, HandleSIGHUP);
912
913 // Ignore SIGPIPE, otherwise it will bring the daemon down if the client closes unexpectedly
914 signal(SIGPIPE, SIG_IGN);
915#else
916 SetConsoleCtrlHandler(consoleCtrlHandler, true);
917#endif
918
919 std::set_new_handler(new_handler_terminate);
920
921 return true;
922}
923
924bool AppInitParameterInteraction()
925{

Callers 2

AppInitFunction · 0.85
baseInitializeMethod · 0.85

Calls 4

SetupNetworkingFunction · 0.85
InitErrorFunction · 0.85
registerSignalHandlerFunction · 0.85
GetBoolArgMethod · 0.80

Tested by

no test coverage detected