20 #include <winpr/config.h>
22 #include <winpr/crt.h>
23 #include <winpr/pool.h>
24 #include <winpr/library.h>
26 #ifdef WINPR_THREAD_POOL
29 typedef BOOL(WINAPI* pCallbackMayRunLong_t)(PTP_CALLBACK_INSTANCE pci);
30 static INIT_ONCE init_once_module = INIT_ONCE_STATIC_INIT;
31 static pCallbackMayRunLong_t pCallbackMayRunLong = NULL;
33 static BOOL CALLBACK init_module(
PINIT_ONCE once, PVOID param, PVOID* context)
35 HMODULE kernel32 = LoadLibraryA(
"kernel32.dll");
38 GetProcAddressAs(kernel32,
"CallbackMayRunLong", pCallbackMayRunLong_t);
43 BOOL winpr_CallbackMayRunLong(PTP_CALLBACK_INSTANCE pci)
46 InitOnceExecuteOnce(&init_once_module, init_module, NULL, NULL);
47 if (pCallbackMayRunLong)
48 return pCallbackMayRunLong(pci);