Calling CRT from system spawned thread

85 Views Asked by At

System uses Create{Remote}Thread instead of _beginthread for callbacks like ServiceMain, RegisterServiceCtrlHandlerEx, HandlerRoutine (SetConsoleCtrlHandler), etc. Does it mean that it is unsafe to call statically linked CRT from these threads?

1

There are 1 best solutions below

0
OwnageIsMagic On BEST ANSWER

In modern (UCRT based) runtime _beginthread{ex} doesn't do any initialization. It only provide minor services like preventing module from unloading while thread is running and optionally initialize WinRT (RoInitialize).