mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-14 00:14:11 +09:00
[nodiscard] fix all InitOnceExecuteOnce usages
This commit is contained in:
@@ -704,7 +704,8 @@ FREERDP_ENTRY_POINT(UINT VCAPITYPE ffmpeg_freerdp_tsmf_client_decoder_subsystem_
|
||||
*sptr = nullptr;
|
||||
|
||||
TSMFFFmpegDecoder* decoder = nullptr;
|
||||
InitOnceExecuteOnce(&g_Initialized, InitializeAvCodecs, nullptr, nullptr);
|
||||
if (!InitOnceExecuteOnce(&g_Initialized, InitializeAvCodecs, nullptr, nullptr))
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
WLog_DBG(TAG, "TSMFDecoderEntry FFMPEG");
|
||||
decoder = (TSMFFFmpegDecoder*)calloc(1, sizeof(TSMFFFmpegDecoder));
|
||||
|
||||
|
||||
@@ -678,7 +678,8 @@ static BOOL h264_context_init(H264_CONTEXT* h264)
|
||||
return FALSE;
|
||||
|
||||
h264->subsystem = nullptr;
|
||||
InitOnceExecuteOnce(&subsystems_once, h264_register_subsystems, nullptr, nullptr);
|
||||
if (!InitOnceExecuteOnce(&subsystems_once, h264_register_subsystems, nullptr, nullptr))
|
||||
return FALSE;
|
||||
|
||||
for (size_t i = 0; i < MAX_SUBSYSTEMS; i++)
|
||||
{
|
||||
|
||||
@@ -172,7 +172,8 @@ int rfx_rlgr_decode(RLGR_MODE mode, const BYTE* WINPR_RESTRICT pSrcData, UINT32
|
||||
wBitStream s_bs = WINPR_C_ARRAY_INIT;
|
||||
const SSIZE_T DstSize = rDstSize;
|
||||
|
||||
InitOnceExecuteOnce(&rfx_rlgr_init_once, rfx_rlgr_init, nullptr, nullptr);
|
||||
if (!InitOnceExecuteOnce(&rfx_rlgr_init_once, rfx_rlgr_init, nullptr, nullptr))
|
||||
return -1;
|
||||
|
||||
k = 1;
|
||||
kp = k << LSGR;
|
||||
|
||||
@@ -154,6 +154,9 @@ static void* channel_event_entry_clone(const void* data)
|
||||
|
||||
rdpChannels* freerdp_channels_new(freerdp* instance)
|
||||
{
|
||||
if (!InitOnceExecuteOnce(&g_ChannelHandlesOnce, init_channel_handles_table, nullptr, nullptr))
|
||||
return nullptr;
|
||||
|
||||
wObject* obj = nullptr;
|
||||
rdpChannels* channels = nullptr;
|
||||
channels = (rdpChannels*)calloc(1, sizeof(rdpChannels));
|
||||
@@ -161,8 +164,6 @@ rdpChannels* freerdp_channels_new(freerdp* instance)
|
||||
if (!channels)
|
||||
return nullptr;
|
||||
|
||||
InitOnceExecuteOnce(&g_ChannelHandlesOnce, init_channel_handles_table, nullptr, nullptr);
|
||||
|
||||
if (!g_ChannelHandles)
|
||||
goto error;
|
||||
if (!InitializeCriticalSectionAndSpinCount(&channels->channelsLock, 4000))
|
||||
|
||||
@@ -829,7 +829,8 @@ static BOOL tls_prepare(rdpTls* tls, BIO* underlying, SSL_METHOD* method, int op
|
||||
if (settings->TlsSecretsFile)
|
||||
{
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10101000L
|
||||
InitOnceExecuteOnce(&secrets_file_idx_once, secrets_file_init_cb, nullptr, nullptr);
|
||||
if (!InitOnceExecuteOnce(&secrets_file_idx_once, secrets_file_init_cb, nullptr, nullptr))
|
||||
return FALSE;
|
||||
|
||||
if (secrets_file_idx != -1)
|
||||
{
|
||||
|
||||
@@ -156,7 +156,8 @@ static BOOL scard_status_transition(SCardContext* context)
|
||||
memcpy(reader->rgbAtr, ATR, sizeof(ATR));
|
||||
}
|
||||
{
|
||||
InitOnceExecuteOnce(&g_ReaderNameWGuard, g_ReaderNameWInit, nullptr, nullptr);
|
||||
if (!InitOnceExecuteOnce(&g_ReaderNameWGuard, g_ReaderNameWInit, nullptr, nullptr))
|
||||
return FALSE;
|
||||
SCARD_READERSTATEW* reader = &context->readerStateW[0];
|
||||
reader->szReader = g_ReaderNameW;
|
||||
reader->dwEventState = SCARD_STATE_PRESENT;
|
||||
@@ -564,7 +565,8 @@ LONG WINAPI Emulate_SCardListReadersW(SmartcardEmulationContext* smartcard, SCAR
|
||||
|
||||
WINPR_UNUSED(mszGroups); /* Not required */
|
||||
|
||||
InitOnceExecuteOnce(&g_ReaderNameWGuard, g_ReaderNameWInit, nullptr, nullptr);
|
||||
if (!InitOnceExecuteOnce(&g_ReaderNameWGuard, g_ReaderNameWInit, nullptr, nullptr))
|
||||
return FALSE;
|
||||
if (SCARD_S_SUCCESS == status)
|
||||
{
|
||||
SCardContext* value = HashTable_GetItemValue(smartcard->contexts, (const void*)hContext);
|
||||
|
||||
@@ -1274,8 +1274,7 @@ end:
|
||||
static BOOL load_layout_file(void)
|
||||
{
|
||||
static INIT_ONCE once = INIT_ONCE_STATIC_INIT;
|
||||
InitOnceExecuteOnce(&once, load_layouts, nullptr, nullptr);
|
||||
return TRUE;
|
||||
return InitOnceExecuteOnce(&once, load_layouts, nullptr, nullptr);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -360,14 +360,19 @@ void primitives_uninit(void)
|
||||
/* ------------------------------------------------------------------------- */
|
||||
static void setup(void)
|
||||
{
|
||||
InitOnceExecuteOnce(&generic_primitives_InitOnce, primitives_init_generic_cb, nullptr, nullptr);
|
||||
if (!InitOnceExecuteOnce(&generic_primitives_InitOnce, primitives_init_generic_cb, nullptr,
|
||||
nullptr))
|
||||
return;
|
||||
#if defined(HAVE_CPU_OPTIMIZED_PRIMITIVES)
|
||||
InitOnceExecuteOnce(&cpu_primitives_InitOnce, primitives_init_cpu_cb, nullptr, nullptr);
|
||||
if (!InitOnceExecuteOnce(&cpu_primitives_InitOnce, primitives_init_cpu_cb, nullptr, nullptr))
|
||||
return;
|
||||
#endif
|
||||
#if defined(WITH_OPENCL)
|
||||
InitOnceExecuteOnce(&gpu_primitives_InitOnce, primitives_init_gpu_cb, nullptr, nullptr);
|
||||
if (!InitOnceExecuteOnce(&gpu_primitives_InitOnce, primitives_init_gpu_cb, nullptr, nullptr))
|
||||
return;
|
||||
#endif
|
||||
InitOnceExecuteOnce(&auto_primitives_InitOnce, primitives_auto_init_cb, nullptr, nullptr);
|
||||
if (!InitOnceExecuteOnce(&auto_primitives_InitOnce, primitives_auto_init_cb, nullptr, nullptr))
|
||||
return;
|
||||
}
|
||||
|
||||
primitives_t* primitives_get(void)
|
||||
@@ -378,13 +383,17 @@ primitives_t* primitives_get(void)
|
||||
|
||||
primitives_t* primitives_get_generic(void)
|
||||
{
|
||||
InitOnceExecuteOnce(&generic_primitives_InitOnce, primitives_init_generic_cb, nullptr, nullptr);
|
||||
if (!InitOnceExecuteOnce(&generic_primitives_InitOnce, primitives_init_generic_cb, nullptr,
|
||||
nullptr))
|
||||
return nullptr;
|
||||
return &pPrimitivesGeneric;
|
||||
}
|
||||
|
||||
primitives_t* primitives_get_by_type(primitive_hints type)
|
||||
{
|
||||
InitOnceExecuteOnce(&generic_primitives_InitOnce, primitives_init_generic_cb, nullptr, nullptr);
|
||||
if (!InitOnceExecuteOnce(&generic_primitives_InitOnce, primitives_init_generic_cb, nullptr,
|
||||
nullptr))
|
||||
return nullptr;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
|
||||
@@ -91,8 +91,7 @@ static BOOL CALLBACK init_app_details(WINPR_ATTR_UNUSED PINIT_ONCE once,
|
||||
WINPR_ATTR_NODISCARD
|
||||
static BOOL initializeApplicationDetails(void)
|
||||
{
|
||||
InitOnceExecuteOnce(&s_freerdp_app_details_once, init_app_details, nullptr, nullptr);
|
||||
return TRUE;
|
||||
return InitOnceExecuteOnce(&s_freerdp_app_details_once, init_app_details, nullptr, nullptr);
|
||||
}
|
||||
|
||||
BOOL freerdp_setApplicationDetails(const char* vendor, const char* product, SSIZE_T version)
|
||||
|
||||
@@ -44,7 +44,8 @@ static BOOL CALLBACK init_module(PINIT_ONCE once, PVOID param, PVOID* context)
|
||||
BOOL winpr_CallbackMayRunLong(WINPR_ATTR_UNUSED PTP_CALLBACK_INSTANCE pci)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
InitOnceExecuteOnce(&init_once_module, init_module, nullptr, nullptr);
|
||||
if (!InitOnceExecuteOnce(&init_once_module, init_module, nullptr, nullptr))
|
||||
return FALSE;
|
||||
if (pCallbackMayRunLong)
|
||||
return pCallbackMayRunLong(pci);
|
||||
#endif
|
||||
|
||||
@@ -64,7 +64,8 @@ VOID SetEventWhenCallbackReturns(WINPR_ATTR_UNUSED PTP_CALLBACK_INSTANCE pci,
|
||||
WINPR_ATTR_UNUSED HANDLE evt)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
InitOnceExecuteOnce(&init_once_module, init_module, nullptr, nullptr);
|
||||
if (!InitOnceExecuteOnce(&init_once_module, init_module, nullptr, nullptr))
|
||||
return;
|
||||
if (pSetEventWhenCallbackReturns)
|
||||
{
|
||||
pSetEventWhenCallbackReturns(pci, evt);
|
||||
@@ -79,7 +80,8 @@ VOID ReleaseSemaphoreWhenCallbackReturns(WINPR_ATTR_UNUSED PTP_CALLBACK_INSTANCE
|
||||
WINPR_ATTR_UNUSED HANDLE sem, WINPR_ATTR_UNUSED DWORD crel)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
InitOnceExecuteOnce(&init_once_module, init_module, nullptr, nullptr);
|
||||
if (!InitOnceExecuteOnce(&init_once_module, init_module, nullptr, nullptr))
|
||||
return;
|
||||
if (pReleaseSemaphoreWhenCallbackReturns)
|
||||
{
|
||||
pReleaseSemaphoreWhenCallbackReturns(pci, sem, crel);
|
||||
@@ -94,7 +96,8 @@ VOID ReleaseMutexWhenCallbackReturns(WINPR_ATTR_UNUSED PTP_CALLBACK_INSTANCE pci
|
||||
WINPR_ATTR_UNUSED HANDLE mut)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
InitOnceExecuteOnce(&init_once_module, init_module, nullptr, nullptr);
|
||||
if (!InitOnceExecuteOnce(&init_once_module, init_module, nullptr, nullptr))
|
||||
return;
|
||||
if (pReleaseMutexWhenCallbackReturns)
|
||||
{
|
||||
pReleaseMutexWhenCallbackReturns(pci, mut);
|
||||
@@ -109,7 +112,8 @@ VOID LeaveCriticalSectionWhenCallbackReturns(WINPR_ATTR_UNUSED PTP_CALLBACK_INST
|
||||
WINPR_ATTR_UNUSED PCRITICAL_SECTION pcs)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
InitOnceExecuteOnce(&init_once_module, init_module, nullptr, nullptr);
|
||||
if (!InitOnceExecuteOnce(&init_once_module, init_module, nullptr, nullptr))
|
||||
return;
|
||||
if (pLeaveCriticalSectionWhenCallbackReturns)
|
||||
{
|
||||
pLeaveCriticalSectionWhenCallbackReturns(pci, pcs);
|
||||
@@ -123,7 +127,8 @@ VOID FreeLibraryWhenCallbackReturns(WINPR_ATTR_UNUSED PTP_CALLBACK_INSTANCE pci,
|
||||
WINPR_ATTR_UNUSED HMODULE mod)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
InitOnceExecuteOnce(&init_once_module, init_module, nullptr, nullptr);
|
||||
if (!InitOnceExecuteOnce(&init_once_module, init_module, nullptr, nullptr))
|
||||
return;
|
||||
if (pFreeLibraryWhenCallbackReturns)
|
||||
{
|
||||
pFreeLibraryWhenCallbackReturns(pci, mod);
|
||||
@@ -137,7 +142,8 @@ VOID FreeLibraryWhenCallbackReturns(WINPR_ATTR_UNUSED PTP_CALLBACK_INSTANCE pci,
|
||||
VOID DisassociateCurrentThreadFromCallback(WINPR_ATTR_UNUSED PTP_CALLBACK_INSTANCE pci)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
InitOnceExecuteOnce(&init_once_module, init_module, nullptr, nullptr);
|
||||
if (!InitOnceExecuteOnce(&init_once_module, init_module, nullptr, nullptr))
|
||||
return;
|
||||
if (pDisassociateCurrentThreadFromCallback)
|
||||
{
|
||||
pDisassociateCurrentThreadFromCallback(pci);
|
||||
|
||||
@@ -58,7 +58,8 @@ PTP_CLEANUP_GROUP winpr_CreateThreadpoolCleanupGroup(void)
|
||||
{
|
||||
PTP_CLEANUP_GROUP cleanupGroup = nullptr;
|
||||
#ifdef _WIN32
|
||||
InitOnceExecuteOnce(&init_once_module, init_module, nullptr, nullptr);
|
||||
if (!InitOnceExecuteOnce(&init_once_module, init_module, nullptr, nullptr))
|
||||
return nullptr;
|
||||
|
||||
if (pCreateThreadpoolCleanupGroup)
|
||||
return pCreateThreadpoolCleanupGroup();
|
||||
@@ -97,7 +98,8 @@ VOID winpr_CloseThreadpoolCleanupGroupMembers(WINPR_ATTR_UNUSED PTP_CLEANUP_GROU
|
||||
WINPR_ATTR_UNUSED PVOID pvCleanupContext)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
InitOnceExecuteOnce(&init_once_module, init_module, nullptr, nullptr);
|
||||
if (!InitOnceExecuteOnce(&init_once_module, init_module, nullptr, nullptr))
|
||||
return;
|
||||
|
||||
if (pCloseThreadpoolCleanupGroupMembers)
|
||||
{
|
||||
@@ -119,7 +121,8 @@ VOID winpr_CloseThreadpoolCleanupGroupMembers(WINPR_ATTR_UNUSED PTP_CLEANUP_GROU
|
||||
VOID winpr_CloseThreadpoolCleanupGroup(PTP_CLEANUP_GROUP ptpcg)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
InitOnceExecuteOnce(&init_once_module, init_module, nullptr, nullptr);
|
||||
if (!InitOnceExecuteOnce(&init_once_module, init_module, nullptr, nullptr))
|
||||
return;
|
||||
|
||||
if (pCloseThreadpoolCleanupGroup)
|
||||
{
|
||||
|
||||
@@ -173,7 +173,8 @@ PTP_POOL winpr_CreateThreadpool(PVOID reserved)
|
||||
{
|
||||
PTP_POOL pool = nullptr;
|
||||
#ifdef _WIN32
|
||||
InitOnceExecuteOnce(&init_once_module, init_module, nullptr, nullptr);
|
||||
if (!InitOnceExecuteOnce(&init_once_module, init_module, nullptr, nullptr))
|
||||
return nullptr;
|
||||
if (pCreateThreadpool)
|
||||
return pCreateThreadpool(reserved);
|
||||
#else
|
||||
@@ -194,7 +195,8 @@ PTP_POOL winpr_CreateThreadpool(PVOID reserved)
|
||||
VOID winpr_CloseThreadpool(PTP_POOL ptpp)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
InitOnceExecuteOnce(&init_once_module, init_module, nullptr, nullptr);
|
||||
if (!InitOnceExecuteOnce(&init_once_module, init_module, nullptr, nullptr))
|
||||
return;
|
||||
if (pCloseThreadpool)
|
||||
{
|
||||
pCloseThreadpool(ptpp);
|
||||
@@ -221,7 +223,8 @@ BOOL winpr_SetThreadpoolThreadMinimum(PTP_POOL ptpp, DWORD cthrdMic)
|
||||
{
|
||||
BOOL rc = FALSE;
|
||||
#ifdef _WIN32
|
||||
InitOnceExecuteOnce(&init_once_module, init_module, nullptr, nullptr);
|
||||
if (!InitOnceExecuteOnce(&init_once_module, init_module, nullptr, nullptr))
|
||||
return FALSE;
|
||||
if (pSetThreadpoolThreadMinimum)
|
||||
return pSetThreadpoolThreadMinimum(ptpp, cthrdMic);
|
||||
#endif
|
||||
@@ -251,7 +254,8 @@ fail:
|
||||
VOID winpr_SetThreadpoolThreadMaximum(PTP_POOL ptpp, DWORD cthrdMost)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
InitOnceExecuteOnce(&init_once_module, init_module, nullptr, nullptr);
|
||||
if (!InitOnceExecuteOnce(&init_once_module, init_module, nullptr, nullptr))
|
||||
return;
|
||||
if (pSetThreadpoolThreadMaximum)
|
||||
{
|
||||
pSetThreadpoolThreadMaximum(ptpp, cthrdMost);
|
||||
|
||||
@@ -73,7 +73,8 @@ PTP_WORK winpr_CreateThreadpoolWork(PTP_WORK_CALLBACK pfnwk, PVOID pv, PTP_CALLB
|
||||
{
|
||||
PTP_WORK work = nullptr;
|
||||
#ifdef _WIN32
|
||||
InitOnceExecuteOnce(&init_once_module, init_module, nullptr, nullptr);
|
||||
if (!InitOnceExecuteOnce(&init_once_module, init_module, nullptr, nullptr))
|
||||
return nullptr;
|
||||
|
||||
if (pCreateThreadpoolWork)
|
||||
return pCreateThreadpoolWork(pfnwk, pv, pcbe);
|
||||
@@ -106,7 +107,8 @@ PTP_WORK winpr_CreateThreadpoolWork(PTP_WORK_CALLBACK pfnwk, PVOID pv, PTP_CALLB
|
||||
VOID winpr_CloseThreadpoolWork(PTP_WORK pwk)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
InitOnceExecuteOnce(&init_once_module, init_module, nullptr, nullptr);
|
||||
if (!InitOnceExecuteOnce(&init_once_module, init_module, nullptr, nullptr))
|
||||
return;
|
||||
|
||||
if (pCloseThreadpoolWork)
|
||||
{
|
||||
@@ -130,7 +132,8 @@ VOID winpr_SubmitThreadpoolWork(PTP_WORK pwk)
|
||||
PTP_POOL pool = nullptr;
|
||||
PTP_CALLBACK_INSTANCE callbackInstance = nullptr;
|
||||
#ifdef _WIN32
|
||||
InitOnceExecuteOnce(&init_once_module, init_module, nullptr, nullptr);
|
||||
if (!InitOnceExecuteOnce(&init_once_module, init_module, nullptr, nullptr))
|
||||
return;
|
||||
|
||||
if (pSubmitThreadpoolWork)
|
||||
{
|
||||
@@ -160,7 +163,8 @@ BOOL winpr_TrySubmitThreadpoolCallback(WINPR_ATTR_UNUSED PTP_SIMPLE_CALLBACK pfn
|
||||
WINPR_ATTR_UNUSED PTP_CALLBACK_ENVIRON pcbe)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
InitOnceExecuteOnce(&init_once_module, init_module, nullptr, nullptr);
|
||||
if (!InitOnceExecuteOnce(&init_once_module, init_module, nullptr, nullptr))
|
||||
return FALSE;
|
||||
|
||||
if (pTrySubmitThreadpoolCallback)
|
||||
return pTrySubmitThreadpoolCallback(pfns, pv, pcbe);
|
||||
@@ -177,7 +181,8 @@ VOID winpr_WaitForThreadpoolWorkCallbacks(PTP_WORK pwk,
|
||||
PTP_POOL pool = nullptr;
|
||||
|
||||
#ifdef _WIN32
|
||||
InitOnceExecuteOnce(&init_once_module, init_module, nullptr, nullptr);
|
||||
if (!InitOnceExecuteOnce(&init_once_module, init_module, nullptr, nullptr))
|
||||
return;
|
||||
|
||||
if (pWaitForThreadpoolWorkCallbacks)
|
||||
{
|
||||
|
||||
@@ -45,7 +45,8 @@ static const SCardApiFunctionTable* g_SCardApi = nullptr;
|
||||
#define str(s) #s
|
||||
|
||||
#define SCARDAPI_STUB_CALL_LONG(_name, ...) \
|
||||
InitOnceExecuteOnce(&g_Initialized, InitializeSCardApiStubs, nullptr, nullptr); \
|
||||
if (!InitOnceExecuteOnce(&g_Initialized, InitializeSCardApiStubs, nullptr, nullptr)) \
|
||||
return SCARD_E_NO_SERVICE; \
|
||||
if (!g_SCardApi || !g_SCardApi->pfn##_name) \
|
||||
{ \
|
||||
WLog_DBG( \
|
||||
@@ -57,7 +58,8 @@ static const SCardApiFunctionTable* g_SCardApi = nullptr;
|
||||
return g_SCardApi->pfn##_name(__VA_ARGS__)
|
||||
|
||||
#define SCARDAPI_STUB_CALL_HANDLE(_name) \
|
||||
InitOnceExecuteOnce(&g_Initialized, InitializeSCardApiStubs, nullptr, nullptr); \
|
||||
if (!InitOnceExecuteOnce(&g_Initialized, InitializeSCardApiStubs, nullptr, nullptr)) \
|
||||
return nullptr; \
|
||||
if (!g_SCardApi || !g_SCardApi->pfn##_name) \
|
||||
{ \
|
||||
WLog_DBG( \
|
||||
@@ -69,7 +71,8 @@ static const SCardApiFunctionTable* g_SCardApi = nullptr;
|
||||
return g_SCardApi->pfn##_name()
|
||||
|
||||
#define SCARDAPI_STUB_CALL_VOID(_name) \
|
||||
InitOnceExecuteOnce(&g_Initialized, InitializeSCardApiStubs, nullptr, nullptr); \
|
||||
if (!InitOnceExecuteOnce(&g_Initialized, InitializeSCardApiStubs, nullptr, nullptr)) \
|
||||
return; \
|
||||
if (!g_SCardApi || !g_SCardApi->pfn##_name) \
|
||||
{ \
|
||||
WLog_DBG( \
|
||||
|
||||
@@ -38,6 +38,20 @@ WINPR_PRAGMA_DIAG_POP
|
||||
|
||||
#include "sspi.h"
|
||||
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#define IFCALLRESULT(_default_return, _cb, ...) \
|
||||
__extension__({ \
|
||||
if (_cb == nullptr) \
|
||||
{ \
|
||||
WLog_VRB("com.winpr.api", "IFCALLRESULT(" #_cb ") == nullptr"); \
|
||||
} \
|
||||
((_cb != nullptr) ? _cb(__VA_ARGS__) : (_default_return)); \
|
||||
})
|
||||
#else
|
||||
#define IFCALLRESULT(_default_return, _cb, ...) \
|
||||
((_cb != nullptr) ? _cb(__VA_ARGS__) : (_default_return))
|
||||
#endif
|
||||
|
||||
WINPR_PRAGMA_DIAG_PUSH
|
||||
WINPR_PRAGMA_DIAG_IGNORED_MISSING_PROTOTYPES
|
||||
|
||||
@@ -490,14 +504,16 @@ BOOL IsSecurityStatusError(SECURITY_STATUS status)
|
||||
|
||||
SecurityFunctionTableW* SEC_ENTRY InitSecurityInterfaceExW(DWORD flags)
|
||||
{
|
||||
InitOnceExecuteOnce(&g_Initialized, InitializeSspiModuleInt, &flags, nullptr);
|
||||
if (!InitOnceExecuteOnce(&g_Initialized, InitializeSspiModuleInt, &flags, nullptr))
|
||||
return nullptr;
|
||||
WLog_Print(g_Log, WLOG_DEBUG, "InitSecurityInterfaceExW");
|
||||
return g_SspiW;
|
||||
}
|
||||
|
||||
SecurityFunctionTableA* SEC_ENTRY InitSecurityInterfaceExA(DWORD flags)
|
||||
{
|
||||
InitOnceExecuteOnce(&g_Initialized, InitializeSspiModuleInt, &flags, nullptr);
|
||||
if (!InitOnceExecuteOnce(&g_Initialized, InitializeSspiModuleInt, &flags, nullptr))
|
||||
return nullptr;
|
||||
WLog_Print(g_Log, WLOG_DEBUG, "InitSecurityInterfaceExA");
|
||||
return g_SspiA;
|
||||
}
|
||||
@@ -506,20 +522,27 @@ SecurityFunctionTableA* SEC_ENTRY InitSecurityInterfaceExA(DWORD flags)
|
||||
* Standard SSPI API
|
||||
*/
|
||||
|
||||
/* Package Management */
|
||||
|
||||
SECURITY_STATUS SEC_ENTRY sspi_EnumerateSecurityPackagesW(ULONG* pcPackages,
|
||||
PSecPkgInfoW* ppPackageInfo)
|
||||
static SECURITY_STATUS sspi_init(void)
|
||||
{
|
||||
SECURITY_STATUS status = 0;
|
||||
InitOnceExecuteOnce(&g_Initialized, InitializeSspiModuleInt, nullptr, nullptr);
|
||||
if (!InitOnceExecuteOnce(&g_Initialized, InitializeSspiModuleInt, nullptr, nullptr))
|
||||
return SEC_E_INTERNAL_ERROR;
|
||||
|
||||
if (!(g_SspiW && g_SspiW->EnumerateSecurityPackagesW))
|
||||
if (!g_SspiA || !g_SspiW)
|
||||
{
|
||||
WLog_Print(g_Log, WLOG_WARN, "Security module does not provide an implementation");
|
||||
|
||||
return SEC_E_UNSUPPORTED_FUNCTION;
|
||||
}
|
||||
return SEC_E_OK;
|
||||
}
|
||||
/* Package Management */
|
||||
|
||||
SECURITY_STATUS SEC_ENTRY sspi_EnumerateSecurityPackagesW(ULONG* pcPackages,
|
||||
PSecPkgInfoW* ppPackageInfo)
|
||||
{
|
||||
SECURITY_STATUS status = sspi_init();
|
||||
if (status != SEC_E_OK)
|
||||
return status;
|
||||
|
||||
status = g_SspiW->EnumerateSecurityPackagesW(pcPackages, ppPackageInfo);
|
||||
WLog_Print(g_Log, WLOG_DEBUG, "EnumerateSecurityPackagesW: %s (0x%08" PRIX32 ")",
|
||||
@@ -530,17 +553,11 @@ SECURITY_STATUS SEC_ENTRY sspi_EnumerateSecurityPackagesW(ULONG* pcPackages,
|
||||
SECURITY_STATUS SEC_ENTRY sspi_EnumerateSecurityPackagesA(ULONG* pcPackages,
|
||||
PSecPkgInfoA* ppPackageInfo)
|
||||
{
|
||||
SECURITY_STATUS status = 0;
|
||||
InitOnceExecuteOnce(&g_Initialized, InitializeSspiModuleInt, nullptr, nullptr);
|
||||
|
||||
if (!(g_SspiA && g_SspiA->EnumerateSecurityPackagesA))
|
||||
{
|
||||
WLog_Print(g_Log, WLOG_WARN, "Security module does not provide an implementation");
|
||||
|
||||
return SEC_E_UNSUPPORTED_FUNCTION;
|
||||
}
|
||||
|
||||
status = g_SspiA->EnumerateSecurityPackagesA(pcPackages, ppPackageInfo);
|
||||
SECURITY_STATUS status = sspi_init();
|
||||
if (status != SEC_E_OK)
|
||||
return status;
|
||||
status = IFCALLRESULT(SEC_E_UNSUPPORTED_FUNCTION, g_SspiA->EnumerateSecurityPackagesA,
|
||||
pcPackages, ppPackageInfo);
|
||||
WLog_Print(g_Log, WLOG_DEBUG, "EnumerateSecurityPackagesA: %s (0x%08" PRIX32 ")",
|
||||
GetSecurityStatusString(status), WINPR_CXX_COMPAT_CAST(UINT32, status));
|
||||
return status;
|
||||
@@ -548,14 +565,16 @@ SECURITY_STATUS SEC_ENTRY sspi_EnumerateSecurityPackagesA(ULONG* pcPackages,
|
||||
|
||||
SecurityFunctionTableW* SEC_ENTRY sspi_InitSecurityInterfaceW(void)
|
||||
{
|
||||
InitOnceExecuteOnce(&g_Initialized, InitializeSspiModuleInt, nullptr, nullptr);
|
||||
if (!InitOnceExecuteOnce(&g_Initialized, InitializeSspiModuleInt, nullptr, nullptr))
|
||||
return nullptr;
|
||||
WLog_Print(g_Log, WLOG_DEBUG, "InitSecurityInterfaceW");
|
||||
return g_SspiW;
|
||||
}
|
||||
|
||||
SecurityFunctionTableA* SEC_ENTRY sspi_InitSecurityInterfaceA(void)
|
||||
{
|
||||
InitOnceExecuteOnce(&g_Initialized, InitializeSspiModuleInt, nullptr, nullptr);
|
||||
if (!InitOnceExecuteOnce(&g_Initialized, InitializeSspiModuleInt, nullptr, nullptr))
|
||||
return nullptr;
|
||||
WLog_Print(g_Log, WLOG_DEBUG, "InitSecurityInterfaceA");
|
||||
return g_SspiA;
|
||||
}
|
||||
@@ -563,17 +582,11 @@ SecurityFunctionTableA* SEC_ENTRY sspi_InitSecurityInterfaceA(void)
|
||||
SECURITY_STATUS SEC_ENTRY sspi_QuerySecurityPackageInfoW(SEC_WCHAR* pszPackageName,
|
||||
PSecPkgInfoW* ppPackageInfo)
|
||||
{
|
||||
SECURITY_STATUS status = 0;
|
||||
InitOnceExecuteOnce(&g_Initialized, InitializeSspiModuleInt, nullptr, nullptr);
|
||||
|
||||
if (!(g_SspiW && g_SspiW->QuerySecurityPackageInfoW))
|
||||
{
|
||||
WLog_Print(g_Log, WLOG_WARN, "Security module does not provide an implementation");
|
||||
|
||||
return SEC_E_UNSUPPORTED_FUNCTION;
|
||||
}
|
||||
|
||||
status = g_SspiW->QuerySecurityPackageInfoW(pszPackageName, ppPackageInfo);
|
||||
SECURITY_STATUS status = sspi_init();
|
||||
if (status != SEC_E_OK)
|
||||
return status;
|
||||
status = IFCALLRESULT(SEC_E_UNSUPPORTED_FUNCTION, g_SspiW->QuerySecurityPackageInfoW,
|
||||
pszPackageName, ppPackageInfo);
|
||||
WLog_Print(g_Log, WLOG_DEBUG, "QuerySecurityPackageInfoW: %s (0x%08" PRIX32 ")",
|
||||
GetSecurityStatusString(status), WINPR_CXX_COMPAT_CAST(UINT32, status));
|
||||
return status;
|
||||
@@ -582,17 +595,11 @@ SECURITY_STATUS SEC_ENTRY sspi_QuerySecurityPackageInfoW(SEC_WCHAR* pszPackageNa
|
||||
SECURITY_STATUS SEC_ENTRY sspi_QuerySecurityPackageInfoA(SEC_CHAR* pszPackageName,
|
||||
PSecPkgInfoA* ppPackageInfo)
|
||||
{
|
||||
SECURITY_STATUS status = 0;
|
||||
InitOnceExecuteOnce(&g_Initialized, InitializeSspiModuleInt, nullptr, nullptr);
|
||||
|
||||
if (!(g_SspiA && g_SspiA->QuerySecurityPackageInfoA))
|
||||
{
|
||||
WLog_Print(g_Log, WLOG_WARN, "Security module does not provide an implementation");
|
||||
|
||||
return SEC_E_UNSUPPORTED_FUNCTION;
|
||||
}
|
||||
|
||||
status = g_SspiA->QuerySecurityPackageInfoA(pszPackageName, ppPackageInfo);
|
||||
SECURITY_STATUS status = sspi_init();
|
||||
if (status != SEC_E_OK)
|
||||
return status;
|
||||
status = IFCALLRESULT(SEC_E_UNSUPPORTED_FUNCTION, g_SspiA->QuerySecurityPackageInfoA,
|
||||
pszPackageName, ppPackageInfo);
|
||||
WLog_Print(g_Log, WLOG_DEBUG, "QuerySecurityPackageInfoA: %s (0x%08" PRIX32 ")",
|
||||
GetSecurityStatusString(status), WINPR_CXX_COMPAT_CAST(UINT32, status));
|
||||
return status;
|
||||
@@ -605,19 +612,12 @@ SECURITY_STATUS SEC_ENTRY sspi_AcquireCredentialsHandleW(
|
||||
void* pAuthData, SEC_GET_KEY_FN pGetKeyFn, void* pvGetKeyArgument, PCredHandle phCredential,
|
||||
PTimeStamp ptsExpiry)
|
||||
{
|
||||
SECURITY_STATUS status = 0;
|
||||
InitOnceExecuteOnce(&g_Initialized, InitializeSspiModuleInt, nullptr, nullptr);
|
||||
|
||||
if (!(g_SspiW && g_SspiW->AcquireCredentialsHandleW))
|
||||
{
|
||||
WLog_Print(g_Log, WLOG_WARN, "Security module does not provide an implementation");
|
||||
|
||||
return SEC_E_UNSUPPORTED_FUNCTION;
|
||||
}
|
||||
|
||||
status = g_SspiW->AcquireCredentialsHandleW(pszPrincipal, pszPackage, fCredentialUse, pvLogonID,
|
||||
pAuthData, pGetKeyFn, pvGetKeyArgument,
|
||||
phCredential, ptsExpiry);
|
||||
SECURITY_STATUS status = sspi_init();
|
||||
if (status != SEC_E_OK)
|
||||
return status;
|
||||
status = IFCALLRESULT(SEC_E_UNSUPPORTED_FUNCTION, g_SspiW->AcquireCredentialsHandleW,
|
||||
pszPrincipal, pszPackage, fCredentialUse, pvLogonID, pAuthData, pGetKeyFn,
|
||||
pvGetKeyArgument, phCredential, ptsExpiry);
|
||||
WLog_Print(g_Log, WLOG_DEBUG, "AcquireCredentialsHandleW: %s (0x%08" PRIX32 ")",
|
||||
GetSecurityStatusString(status), WINPR_CXX_COMPAT_CAST(UINT32, status));
|
||||
return status;
|
||||
@@ -628,19 +628,12 @@ SECURITY_STATUS SEC_ENTRY sspi_AcquireCredentialsHandleA(
|
||||
void* pAuthData, SEC_GET_KEY_FN pGetKeyFn, void* pvGetKeyArgument, PCredHandle phCredential,
|
||||
PTimeStamp ptsExpiry)
|
||||
{
|
||||
SECURITY_STATUS status = 0;
|
||||
InitOnceExecuteOnce(&g_Initialized, InitializeSspiModuleInt, nullptr, nullptr);
|
||||
|
||||
if (!(g_SspiA && g_SspiA->AcquireCredentialsHandleA))
|
||||
{
|
||||
WLog_Print(g_Log, WLOG_WARN, "Security module does not provide an implementation");
|
||||
|
||||
return SEC_E_UNSUPPORTED_FUNCTION;
|
||||
}
|
||||
|
||||
status = g_SspiA->AcquireCredentialsHandleA(pszPrincipal, pszPackage, fCredentialUse, pvLogonID,
|
||||
pAuthData, pGetKeyFn, pvGetKeyArgument,
|
||||
phCredential, ptsExpiry);
|
||||
SECURITY_STATUS status = sspi_init();
|
||||
if (status != SEC_E_OK)
|
||||
return status;
|
||||
status = IFCALLRESULT(SEC_E_UNSUPPORTED_FUNCTION, g_SspiA->AcquireCredentialsHandleA,
|
||||
pszPrincipal, pszPackage, fCredentialUse, pvLogonID, pAuthData, pGetKeyFn,
|
||||
pvGetKeyArgument, phCredential, ptsExpiry);
|
||||
WLog_Print(g_Log, WLOG_DEBUG, "AcquireCredentialsHandleA: %s (0x%08" PRIX32 ")",
|
||||
GetSecurityStatusString(status), WINPR_CXX_COMPAT_CAST(UINT32, status));
|
||||
return status;
|
||||
@@ -649,17 +642,11 @@ SECURITY_STATUS SEC_ENTRY sspi_AcquireCredentialsHandleA(
|
||||
SECURITY_STATUS SEC_ENTRY sspi_ExportSecurityContext(PCtxtHandle phContext, ULONG fFlags,
|
||||
PSecBuffer pPackedContext, HANDLE* pToken)
|
||||
{
|
||||
SECURITY_STATUS status = 0;
|
||||
InitOnceExecuteOnce(&g_Initialized, InitializeSspiModuleInt, nullptr, nullptr);
|
||||
|
||||
if (!(g_SspiW && g_SspiW->ExportSecurityContext))
|
||||
{
|
||||
WLog_Print(g_Log, WLOG_WARN, "Security module does not provide an implementation");
|
||||
|
||||
return SEC_E_UNSUPPORTED_FUNCTION;
|
||||
}
|
||||
|
||||
status = g_SspiW->ExportSecurityContext(phContext, fFlags, pPackedContext, pToken);
|
||||
SECURITY_STATUS status = sspi_init();
|
||||
if (status != SEC_E_OK)
|
||||
return status;
|
||||
status = IFCALLRESULT(SEC_E_UNSUPPORTED_FUNCTION, g_SspiW->ExportSecurityContext, phContext,
|
||||
fFlags, pPackedContext, pToken);
|
||||
WLog_Print(g_Log, WLOG_DEBUG, "ExportSecurityContext: %s (0x%08" PRIX32 ")",
|
||||
GetSecurityStatusString(status), WINPR_CXX_COMPAT_CAST(UINT32, status));
|
||||
return status;
|
||||
@@ -667,17 +654,10 @@ SECURITY_STATUS SEC_ENTRY sspi_ExportSecurityContext(PCtxtHandle phContext, ULON
|
||||
|
||||
SECURITY_STATUS SEC_ENTRY sspi_FreeCredentialsHandle(PCredHandle phCredential)
|
||||
{
|
||||
SECURITY_STATUS status = 0;
|
||||
InitOnceExecuteOnce(&g_Initialized, InitializeSspiModuleInt, nullptr, nullptr);
|
||||
|
||||
if (!(g_SspiW && g_SspiW->FreeCredentialsHandle))
|
||||
{
|
||||
WLog_Print(g_Log, WLOG_WARN, "Security module does not provide an implementation");
|
||||
|
||||
return SEC_E_UNSUPPORTED_FUNCTION;
|
||||
}
|
||||
|
||||
status = g_SspiW->FreeCredentialsHandle(phCredential);
|
||||
SECURITY_STATUS status = sspi_init();
|
||||
if (status != SEC_E_OK)
|
||||
return status;
|
||||
status = IFCALLRESULT(SEC_E_UNSUPPORTED_FUNCTION, g_SspiW->FreeCredentialsHandle, phCredential);
|
||||
WLog_Print(g_Log, WLOG_DEBUG, "FreeCredentialsHandle: %s (0x%08" PRIX32 ")",
|
||||
GetSecurityStatusString(status), WINPR_CXX_COMPAT_CAST(UINT32, status));
|
||||
return status;
|
||||
@@ -687,17 +667,11 @@ SECURITY_STATUS SEC_ENTRY sspi_ImportSecurityContextW(SEC_WCHAR* pszPackage,
|
||||
PSecBuffer pPackedContext, HANDLE pToken,
|
||||
PCtxtHandle phContext)
|
||||
{
|
||||
SECURITY_STATUS status = 0;
|
||||
InitOnceExecuteOnce(&g_Initialized, InitializeSspiModuleInt, nullptr, nullptr);
|
||||
|
||||
if (!(g_SspiW && g_SspiW->ImportSecurityContextW))
|
||||
{
|
||||
WLog_Print(g_Log, WLOG_WARN, "Security module does not provide an implementation");
|
||||
|
||||
return SEC_E_UNSUPPORTED_FUNCTION;
|
||||
}
|
||||
|
||||
status = g_SspiW->ImportSecurityContextW(pszPackage, pPackedContext, pToken, phContext);
|
||||
SECURITY_STATUS status = sspi_init();
|
||||
if (status != SEC_E_OK)
|
||||
return status;
|
||||
status = IFCALLRESULT(SEC_E_UNSUPPORTED_FUNCTION, g_SspiW->ImportSecurityContextW, pszPackage,
|
||||
pPackedContext, pToken, phContext);
|
||||
WLog_Print(g_Log, WLOG_DEBUG, "ImportSecurityContextW: %s (0x%08" PRIX32 ")",
|
||||
GetSecurityStatusString(status), WINPR_CXX_COMPAT_CAST(UINT32, status));
|
||||
return status;
|
||||
@@ -707,17 +681,11 @@ SECURITY_STATUS SEC_ENTRY sspi_ImportSecurityContextA(SEC_CHAR* pszPackage,
|
||||
PSecBuffer pPackedContext, HANDLE pToken,
|
||||
PCtxtHandle phContext)
|
||||
{
|
||||
SECURITY_STATUS status = 0;
|
||||
InitOnceExecuteOnce(&g_Initialized, InitializeSspiModuleInt, nullptr, nullptr);
|
||||
|
||||
if (!(g_SspiA && g_SspiA->ImportSecurityContextA))
|
||||
{
|
||||
WLog_Print(g_Log, WLOG_WARN, "Security module does not provide an implementation");
|
||||
|
||||
return SEC_E_UNSUPPORTED_FUNCTION;
|
||||
}
|
||||
|
||||
status = g_SspiA->ImportSecurityContextA(pszPackage, pPackedContext, pToken, phContext);
|
||||
SECURITY_STATUS status = sspi_init();
|
||||
if (status != SEC_E_OK)
|
||||
return status;
|
||||
status = IFCALLRESULT(SEC_E_UNSUPPORTED_FUNCTION, g_SspiA->ImportSecurityContextA, pszPackage,
|
||||
pPackedContext, pToken, phContext);
|
||||
WLog_Print(g_Log, WLOG_DEBUG, "ImportSecurityContextA: %s (0x%08" PRIX32 ")",
|
||||
GetSecurityStatusString(status), WINPR_CXX_COMPAT_CAST(UINT32, status));
|
||||
return status;
|
||||
@@ -726,17 +694,11 @@ SECURITY_STATUS SEC_ENTRY sspi_ImportSecurityContextA(SEC_CHAR* pszPackage,
|
||||
SECURITY_STATUS SEC_ENTRY sspi_QueryCredentialsAttributesW(PCredHandle phCredential,
|
||||
ULONG ulAttribute, void* pBuffer)
|
||||
{
|
||||
SECURITY_STATUS status = 0;
|
||||
InitOnceExecuteOnce(&g_Initialized, InitializeSspiModuleInt, nullptr, nullptr);
|
||||
|
||||
if (!(g_SspiW && g_SspiW->QueryCredentialsAttributesW))
|
||||
{
|
||||
WLog_Print(g_Log, WLOG_WARN, "Security module does not provide an implementation");
|
||||
|
||||
return SEC_E_UNSUPPORTED_FUNCTION;
|
||||
}
|
||||
|
||||
status = g_SspiW->QueryCredentialsAttributesW(phCredential, ulAttribute, pBuffer);
|
||||
SECURITY_STATUS status = sspi_init();
|
||||
if (status != SEC_E_OK)
|
||||
return status;
|
||||
status = IFCALLRESULT(SEC_E_UNSUPPORTED_FUNCTION, g_SspiW->QueryCredentialsAttributesW,
|
||||
phCredential, ulAttribute, pBuffer);
|
||||
WLog_Print(g_Log, WLOG_DEBUG, "QueryCredentialsAttributesW: %s (0x%08" PRIX32 ")",
|
||||
GetSecurityStatusString(status), WINPR_CXX_COMPAT_CAST(UINT32, status));
|
||||
return status;
|
||||
@@ -745,17 +707,11 @@ SECURITY_STATUS SEC_ENTRY sspi_QueryCredentialsAttributesW(PCredHandle phCredent
|
||||
SECURITY_STATUS SEC_ENTRY sspi_QueryCredentialsAttributesA(PCredHandle phCredential,
|
||||
ULONG ulAttribute, void* pBuffer)
|
||||
{
|
||||
SECURITY_STATUS status = 0;
|
||||
InitOnceExecuteOnce(&g_Initialized, InitializeSspiModuleInt, nullptr, nullptr);
|
||||
|
||||
if (!(g_SspiA && g_SspiA->QueryCredentialsAttributesA))
|
||||
{
|
||||
WLog_Print(g_Log, WLOG_WARN, "Security module does not provide an implementation");
|
||||
|
||||
return SEC_E_UNSUPPORTED_FUNCTION;
|
||||
}
|
||||
|
||||
status = g_SspiA->QueryCredentialsAttributesA(phCredential, ulAttribute, pBuffer);
|
||||
SECURITY_STATUS status = sspi_init();
|
||||
if (status != SEC_E_OK)
|
||||
return status;
|
||||
status = IFCALLRESULT(SEC_E_UNSUPPORTED_FUNCTION, g_SspiA->QueryCredentialsAttributesA,
|
||||
phCredential, ulAttribute, pBuffer);
|
||||
WLog_Print(g_Log, WLOG_DEBUG, "QueryCredentialsAttributesA: %s (0x%08" PRIX32 ")",
|
||||
GetSecurityStatusString(status), WINPR_CXX_COMPAT_CAST(UINT32, status));
|
||||
return status;
|
||||
@@ -770,19 +726,12 @@ SECURITY_STATUS SEC_ENTRY sspi_AcceptSecurityContext(PCredHandle phCredential,
|
||||
PSecBufferDesc pOutput, PULONG pfContextAttr,
|
||||
PTimeStamp ptsTimeStamp)
|
||||
{
|
||||
SECURITY_STATUS status = 0;
|
||||
InitOnceExecuteOnce(&g_Initialized, InitializeSspiModuleInt, nullptr, nullptr);
|
||||
|
||||
if (!(g_SspiW && g_SspiW->AcceptSecurityContext))
|
||||
{
|
||||
WLog_Print(g_Log, WLOG_WARN, "Security module does not provide an implementation");
|
||||
|
||||
return SEC_E_UNSUPPORTED_FUNCTION;
|
||||
}
|
||||
|
||||
status =
|
||||
g_SspiW->AcceptSecurityContext(phCredential, phContext, pInput, fContextReq, TargetDataRep,
|
||||
phNewContext, pOutput, pfContextAttr, ptsTimeStamp);
|
||||
SECURITY_STATUS status = sspi_init();
|
||||
if (status != SEC_E_OK)
|
||||
return status;
|
||||
status = IFCALLRESULT(SEC_E_UNSUPPORTED_FUNCTION, g_SspiW->AcceptSecurityContext, phCredential,
|
||||
phContext, pInput, fContextReq, TargetDataRep, phNewContext, pOutput,
|
||||
pfContextAttr, ptsTimeStamp);
|
||||
WLog_Print(g_Log, WLOG_DEBUG, "AcceptSecurityContext: %s (0x%08" PRIX32 ")",
|
||||
GetSecurityStatusString(status), WINPR_CXX_COMPAT_CAST(UINT32, status));
|
||||
return status;
|
||||
@@ -790,17 +739,11 @@ SECURITY_STATUS SEC_ENTRY sspi_AcceptSecurityContext(PCredHandle phCredential,
|
||||
|
||||
SECURITY_STATUS SEC_ENTRY sspi_ApplyControlToken(PCtxtHandle phContext, PSecBufferDesc pInput)
|
||||
{
|
||||
SECURITY_STATUS status = 0;
|
||||
InitOnceExecuteOnce(&g_Initialized, InitializeSspiModuleInt, nullptr, nullptr);
|
||||
|
||||
if (!(g_SspiW && g_SspiW->ApplyControlToken))
|
||||
{
|
||||
WLog_Print(g_Log, WLOG_WARN, "Security module does not provide an implementation");
|
||||
|
||||
return SEC_E_UNSUPPORTED_FUNCTION;
|
||||
}
|
||||
|
||||
status = g_SspiW->ApplyControlToken(phContext, pInput);
|
||||
SECURITY_STATUS status = sspi_init();
|
||||
if (status != SEC_E_OK)
|
||||
return status;
|
||||
status =
|
||||
IFCALLRESULT(SEC_E_UNSUPPORTED_FUNCTION, g_SspiW->ApplyControlToken, phContext, pInput);
|
||||
WLog_Print(g_Log, WLOG_DEBUG, "ApplyControlToken: %s (0x%08" PRIX32 ")",
|
||||
GetSecurityStatusString(status), WINPR_CXX_COMPAT_CAST(UINT32, status));
|
||||
return status;
|
||||
@@ -808,17 +751,11 @@ SECURITY_STATUS SEC_ENTRY sspi_ApplyControlToken(PCtxtHandle phContext, PSecBuff
|
||||
|
||||
SECURITY_STATUS SEC_ENTRY sspi_CompleteAuthToken(PCtxtHandle phContext, PSecBufferDesc pToken)
|
||||
{
|
||||
SECURITY_STATUS status = 0;
|
||||
InitOnceExecuteOnce(&g_Initialized, InitializeSspiModuleInt, nullptr, nullptr);
|
||||
|
||||
if (!(g_SspiW && g_SspiW->CompleteAuthToken))
|
||||
{
|
||||
WLog_Print(g_Log, WLOG_WARN, "Security module does not provide an implementation");
|
||||
|
||||
return SEC_E_UNSUPPORTED_FUNCTION;
|
||||
}
|
||||
|
||||
status = g_SspiW->CompleteAuthToken(phContext, pToken);
|
||||
SECURITY_STATUS status = sspi_init();
|
||||
if (status != SEC_E_OK)
|
||||
return status;
|
||||
status =
|
||||
IFCALLRESULT(SEC_E_UNSUPPORTED_FUNCTION, g_SspiW->CompleteAuthToken, phContext, pToken);
|
||||
WLog_Print(g_Log, WLOG_DEBUG, "CompleteAuthToken: %s (0x%08" PRIX32 ")",
|
||||
GetSecurityStatusString(status), WINPR_CXX_COMPAT_CAST(UINT32, status));
|
||||
return status;
|
||||
@@ -826,17 +763,10 @@ SECURITY_STATUS SEC_ENTRY sspi_CompleteAuthToken(PCtxtHandle phContext, PSecBuff
|
||||
|
||||
SECURITY_STATUS SEC_ENTRY sspi_DeleteSecurityContext(PCtxtHandle phContext)
|
||||
{
|
||||
SECURITY_STATUS status = 0;
|
||||
InitOnceExecuteOnce(&g_Initialized, InitializeSspiModuleInt, nullptr, nullptr);
|
||||
|
||||
if (!(g_SspiW && g_SspiW->DeleteSecurityContext))
|
||||
{
|
||||
WLog_Print(g_Log, WLOG_WARN, "Security module does not provide an implementation");
|
||||
|
||||
return SEC_E_UNSUPPORTED_FUNCTION;
|
||||
}
|
||||
|
||||
status = g_SspiW->DeleteSecurityContext(phContext);
|
||||
SECURITY_STATUS status = sspi_init();
|
||||
if (status != SEC_E_OK)
|
||||
return status;
|
||||
status = IFCALLRESULT(SEC_E_UNSUPPORTED_FUNCTION, g_SspiW->DeleteSecurityContext, phContext);
|
||||
WLog_Print(g_Log, WLOG_DEBUG, "DeleteSecurityContext: %s (0x%08" PRIX32 ")",
|
||||
GetSecurityStatusString(status), WINPR_CXX_COMPAT_CAST(UINT32, status));
|
||||
return status;
|
||||
@@ -844,17 +774,10 @@ SECURITY_STATUS SEC_ENTRY sspi_DeleteSecurityContext(PCtxtHandle phContext)
|
||||
|
||||
SECURITY_STATUS SEC_ENTRY sspi_FreeContextBuffer(void* pvContextBuffer)
|
||||
{
|
||||
SECURITY_STATUS status = 0;
|
||||
InitOnceExecuteOnce(&g_Initialized, InitializeSspiModuleInt, nullptr, nullptr);
|
||||
|
||||
if (!(g_SspiW && g_SspiW->FreeContextBuffer))
|
||||
{
|
||||
WLog_Print(g_Log, WLOG_WARN, "Security module does not provide an implementation");
|
||||
|
||||
return SEC_E_UNSUPPORTED_FUNCTION;
|
||||
}
|
||||
|
||||
status = g_SspiW->FreeContextBuffer(pvContextBuffer);
|
||||
SECURITY_STATUS status = sspi_init();
|
||||
if (status != SEC_E_OK)
|
||||
return status;
|
||||
status = IFCALLRESULT(SEC_E_UNSUPPORTED_FUNCTION, g_SspiW->FreeContextBuffer, pvContextBuffer);
|
||||
WLog_Print(g_Log, WLOG_DEBUG, "FreeContextBuffer: %s (0x%08" PRIX32 ")",
|
||||
GetSecurityStatusString(status), WINPR_CXX_COMPAT_CAST(UINT32, status));
|
||||
return status;
|
||||
@@ -862,17 +785,11 @@ SECURITY_STATUS SEC_ENTRY sspi_FreeContextBuffer(void* pvContextBuffer)
|
||||
|
||||
SECURITY_STATUS SEC_ENTRY sspi_ImpersonateSecurityContext(PCtxtHandle phContext)
|
||||
{
|
||||
SECURITY_STATUS status = 0;
|
||||
InitOnceExecuteOnce(&g_Initialized, InitializeSspiModuleInt, nullptr, nullptr);
|
||||
|
||||
if (!(g_SspiW && g_SspiW->ImpersonateSecurityContext))
|
||||
{
|
||||
WLog_Print(g_Log, WLOG_WARN, "Security module does not provide an implementation");
|
||||
|
||||
return SEC_E_UNSUPPORTED_FUNCTION;
|
||||
}
|
||||
|
||||
status = g_SspiW->ImpersonateSecurityContext(phContext);
|
||||
SECURITY_STATUS status = sspi_init();
|
||||
if (status != SEC_E_OK)
|
||||
return status;
|
||||
status =
|
||||
IFCALLRESULT(SEC_E_UNSUPPORTED_FUNCTION, g_SspiW->ImpersonateSecurityContext, phContext);
|
||||
WLog_Print(g_Log, WLOG_DEBUG, "ImpersonateSecurityContext: %s (0x%08" PRIX32 ")",
|
||||
GetSecurityStatusString(status), WINPR_CXX_COMPAT_CAST(UINT32, status));
|
||||
return status;
|
||||
@@ -883,19 +800,13 @@ SECURITY_STATUS SEC_ENTRY sspi_InitializeSecurityContextW(
|
||||
ULONG Reserved1, ULONG TargetDataRep, PSecBufferDesc pInput, ULONG Reserved2,
|
||||
PCtxtHandle phNewContext, PSecBufferDesc pOutput, PULONG pfContextAttr, PTimeStamp ptsExpiry)
|
||||
{
|
||||
SECURITY_STATUS status = 0;
|
||||
InitOnceExecuteOnce(&g_Initialized, InitializeSspiModuleInt, nullptr, nullptr);
|
||||
|
||||
if (!(g_SspiW && g_SspiW->InitializeSecurityContextW))
|
||||
{
|
||||
WLog_Print(g_Log, WLOG_WARN, "Security module does not provide an implementation");
|
||||
|
||||
return SEC_E_UNSUPPORTED_FUNCTION;
|
||||
}
|
||||
|
||||
status = g_SspiW->InitializeSecurityContextW(
|
||||
phCredential, phContext, pszTargetName, fContextReq, Reserved1, TargetDataRep, pInput,
|
||||
Reserved2, phNewContext, pOutput, pfContextAttr, ptsExpiry);
|
||||
SECURITY_STATUS status = sspi_init();
|
||||
if (status != SEC_E_OK)
|
||||
return status;
|
||||
status =
|
||||
IFCALLRESULT(SEC_E_UNSUPPORTED_FUNCTION, g_SspiW->InitializeSecurityContextW, phCredential,
|
||||
phContext, pszTargetName, fContextReq, Reserved1, TargetDataRep, pInput,
|
||||
Reserved2, phNewContext, pOutput, pfContextAttr, ptsExpiry);
|
||||
WLog_Print(g_Log, WLOG_DEBUG, "InitializeSecurityContextW: %s (0x%08" PRIX32 ")",
|
||||
GetSecurityStatusString(status), WINPR_CXX_COMPAT_CAST(UINT32, status));
|
||||
return status;
|
||||
@@ -906,19 +817,13 @@ SECURITY_STATUS SEC_ENTRY sspi_InitializeSecurityContextA(
|
||||
ULONG Reserved1, ULONG TargetDataRep, PSecBufferDesc pInput, ULONG Reserved2,
|
||||
PCtxtHandle phNewContext, PSecBufferDesc pOutput, PULONG pfContextAttr, PTimeStamp ptsExpiry)
|
||||
{
|
||||
SECURITY_STATUS status = 0;
|
||||
InitOnceExecuteOnce(&g_Initialized, InitializeSspiModuleInt, nullptr, nullptr);
|
||||
|
||||
if (!(g_SspiA && g_SspiA->InitializeSecurityContextA))
|
||||
{
|
||||
WLog_Print(g_Log, WLOG_WARN, "Security module does not provide an implementation");
|
||||
|
||||
return SEC_E_UNSUPPORTED_FUNCTION;
|
||||
}
|
||||
|
||||
status = g_SspiA->InitializeSecurityContextA(
|
||||
phCredential, phContext, pszTargetName, fContextReq, Reserved1, TargetDataRep, pInput,
|
||||
Reserved2, phNewContext, pOutput, pfContextAttr, ptsExpiry);
|
||||
SECURITY_STATUS status = sspi_init();
|
||||
if (status != SEC_E_OK)
|
||||
return status;
|
||||
status =
|
||||
IFCALLRESULT(SEC_E_UNSUPPORTED_FUNCTION, g_SspiA->InitializeSecurityContextA, phCredential,
|
||||
phContext, pszTargetName, fContextReq, Reserved1, TargetDataRep, pInput,
|
||||
Reserved2, phNewContext, pOutput, pfContextAttr, ptsExpiry);
|
||||
WLog_Print(g_Log, WLOG_DEBUG, "InitializeSecurityContextA: %s (0x%08" PRIX32 ")",
|
||||
GetSecurityStatusString(status), WINPR_CXX_COMPAT_CAST(UINT32, status));
|
||||
return status;
|
||||
@@ -927,17 +832,11 @@ SECURITY_STATUS SEC_ENTRY sspi_InitializeSecurityContextA(
|
||||
SECURITY_STATUS SEC_ENTRY sspi_QueryContextAttributesW(PCtxtHandle phContext, ULONG ulAttribute,
|
||||
void* pBuffer)
|
||||
{
|
||||
SECURITY_STATUS status = 0;
|
||||
InitOnceExecuteOnce(&g_Initialized, InitializeSspiModuleInt, nullptr, nullptr);
|
||||
|
||||
if (!(g_SspiW && g_SspiW->QueryContextAttributesW))
|
||||
{
|
||||
WLog_Print(g_Log, WLOG_WARN, "Security module does not provide an implementation");
|
||||
|
||||
return SEC_E_UNSUPPORTED_FUNCTION;
|
||||
}
|
||||
|
||||
status = g_SspiW->QueryContextAttributesW(phContext, ulAttribute, pBuffer);
|
||||
SECURITY_STATUS status = sspi_init();
|
||||
if (status != SEC_E_OK)
|
||||
return status;
|
||||
status = IFCALLRESULT(SEC_E_UNSUPPORTED_FUNCTION, g_SspiW->QueryContextAttributesW, phContext,
|
||||
ulAttribute, pBuffer);
|
||||
WLog_Print(g_Log, WLOG_DEBUG, "QueryContextAttributesW: %s (0x%08" PRIX32 ")",
|
||||
GetSecurityStatusString(status), WINPR_CXX_COMPAT_CAST(UINT32, status));
|
||||
return status;
|
||||
@@ -946,17 +845,11 @@ SECURITY_STATUS SEC_ENTRY sspi_QueryContextAttributesW(PCtxtHandle phContext, UL
|
||||
SECURITY_STATUS SEC_ENTRY sspi_QueryContextAttributesA(PCtxtHandle phContext, ULONG ulAttribute,
|
||||
void* pBuffer)
|
||||
{
|
||||
SECURITY_STATUS status = 0;
|
||||
InitOnceExecuteOnce(&g_Initialized, InitializeSspiModuleInt, nullptr, nullptr);
|
||||
|
||||
if (!(g_SspiA && g_SspiA->QueryContextAttributesA))
|
||||
{
|
||||
WLog_Print(g_Log, WLOG_WARN, "Security module does not provide an implementation");
|
||||
|
||||
return SEC_E_UNSUPPORTED_FUNCTION;
|
||||
}
|
||||
|
||||
status = g_SspiA->QueryContextAttributesA(phContext, ulAttribute, pBuffer);
|
||||
SECURITY_STATUS status = sspi_init();
|
||||
if (status != SEC_E_OK)
|
||||
return status;
|
||||
status = IFCALLRESULT(SEC_E_UNSUPPORTED_FUNCTION, g_SspiA->QueryContextAttributesA, phContext,
|
||||
ulAttribute, pBuffer);
|
||||
WLog_Print(g_Log, WLOG_DEBUG, "QueryContextAttributesA: %s (0x%08" PRIX32 ")",
|
||||
GetSecurityStatusString(status), WINPR_CXX_COMPAT_CAST(UINT32, status));
|
||||
return status;
|
||||
@@ -964,17 +857,11 @@ SECURITY_STATUS SEC_ENTRY sspi_QueryContextAttributesA(PCtxtHandle phContext, UL
|
||||
|
||||
SECURITY_STATUS SEC_ENTRY sspi_QuerySecurityContextToken(PCtxtHandle phContext, HANDLE* phToken)
|
||||
{
|
||||
SECURITY_STATUS status = 0;
|
||||
InitOnceExecuteOnce(&g_Initialized, InitializeSspiModuleInt, nullptr, nullptr);
|
||||
|
||||
if (!(g_SspiW && g_SspiW->QuerySecurityContextToken))
|
||||
{
|
||||
WLog_Print(g_Log, WLOG_WARN, "Security module does not provide an implementation");
|
||||
|
||||
return SEC_E_UNSUPPORTED_FUNCTION;
|
||||
}
|
||||
|
||||
status = g_SspiW->QuerySecurityContextToken(phContext, phToken);
|
||||
SECURITY_STATUS status = sspi_init();
|
||||
if (status != SEC_E_OK)
|
||||
return status;
|
||||
status = IFCALLRESULT(SEC_E_UNSUPPORTED_FUNCTION, g_SspiW->QuerySecurityContextToken, phContext,
|
||||
phToken);
|
||||
WLog_Print(g_Log, WLOG_DEBUG, "QuerySecurityContextToken: %s (0x%08" PRIX32 ")",
|
||||
GetSecurityStatusString(status), WINPR_CXX_COMPAT_CAST(UINT32, status));
|
||||
return status;
|
||||
@@ -983,17 +870,11 @@ SECURITY_STATUS SEC_ENTRY sspi_QuerySecurityContextToken(PCtxtHandle phContext,
|
||||
SECURITY_STATUS SEC_ENTRY sspi_SetContextAttributesW(PCtxtHandle phContext, ULONG ulAttribute,
|
||||
void* pBuffer, ULONG cbBuffer)
|
||||
{
|
||||
SECURITY_STATUS status = 0;
|
||||
InitOnceExecuteOnce(&g_Initialized, InitializeSspiModuleInt, nullptr, nullptr);
|
||||
|
||||
if (!(g_SspiW && g_SspiW->SetContextAttributesW))
|
||||
{
|
||||
WLog_Print(g_Log, WLOG_WARN, "Security module does not provide an implementation");
|
||||
|
||||
return SEC_E_UNSUPPORTED_FUNCTION;
|
||||
}
|
||||
|
||||
status = g_SspiW->SetContextAttributesW(phContext, ulAttribute, pBuffer, cbBuffer);
|
||||
SECURITY_STATUS status = sspi_init();
|
||||
if (status != SEC_E_OK)
|
||||
return status;
|
||||
status = IFCALLRESULT(SEC_E_UNSUPPORTED_FUNCTION, g_SspiW->SetContextAttributesW, phContext,
|
||||
ulAttribute, pBuffer, cbBuffer);
|
||||
WLog_Print(g_Log, WLOG_DEBUG, "SetContextAttributesW: %s (0x%08" PRIX32 ")",
|
||||
GetSecurityStatusString(status), WINPR_CXX_COMPAT_CAST(UINT32, status));
|
||||
return status;
|
||||
@@ -1002,17 +883,11 @@ SECURITY_STATUS SEC_ENTRY sspi_SetContextAttributesW(PCtxtHandle phContext, ULON
|
||||
SECURITY_STATUS SEC_ENTRY sspi_SetContextAttributesA(PCtxtHandle phContext, ULONG ulAttribute,
|
||||
void* pBuffer, ULONG cbBuffer)
|
||||
{
|
||||
SECURITY_STATUS status = 0;
|
||||
InitOnceExecuteOnce(&g_Initialized, InitializeSspiModuleInt, nullptr, nullptr);
|
||||
|
||||
if (!(g_SspiA && g_SspiA->SetContextAttributesA))
|
||||
{
|
||||
WLog_Print(g_Log, WLOG_WARN, "Security module does not provide an implementation");
|
||||
|
||||
return SEC_E_UNSUPPORTED_FUNCTION;
|
||||
}
|
||||
|
||||
status = g_SspiA->SetContextAttributesA(phContext, ulAttribute, pBuffer, cbBuffer);
|
||||
SECURITY_STATUS status = sspi_init();
|
||||
if (status != SEC_E_OK)
|
||||
return status;
|
||||
status = IFCALLRESULT(SEC_E_UNSUPPORTED_FUNCTION, g_SspiA->SetContextAttributesA, phContext,
|
||||
ulAttribute, pBuffer, cbBuffer);
|
||||
WLog_Print(g_Log, WLOG_DEBUG, "SetContextAttributesA: %s (0x%08" PRIX32 ")",
|
||||
GetSecurityStatusString(status), WINPR_CXX_COMPAT_CAST(UINT32, status));
|
||||
return status;
|
||||
@@ -1020,17 +895,10 @@ SECURITY_STATUS SEC_ENTRY sspi_SetContextAttributesA(PCtxtHandle phContext, ULON
|
||||
|
||||
SECURITY_STATUS SEC_ENTRY sspi_RevertSecurityContext(PCtxtHandle phContext)
|
||||
{
|
||||
SECURITY_STATUS status = 0;
|
||||
InitOnceExecuteOnce(&g_Initialized, InitializeSspiModuleInt, nullptr, nullptr);
|
||||
|
||||
if (!(g_SspiW && g_SspiW->RevertSecurityContext))
|
||||
{
|
||||
WLog_Print(g_Log, WLOG_WARN, "Security module does not provide an implementation");
|
||||
|
||||
return SEC_E_UNSUPPORTED_FUNCTION;
|
||||
}
|
||||
|
||||
status = g_SspiW->RevertSecurityContext(phContext);
|
||||
SECURITY_STATUS status = sspi_init();
|
||||
if (status != SEC_E_OK)
|
||||
return status;
|
||||
status = IFCALLRESULT(SEC_E_UNSUPPORTED_FUNCTION, g_SspiW->RevertSecurityContext, phContext);
|
||||
WLog_Print(g_Log, WLOG_DEBUG, "RevertSecurityContext: %s (0x%08" PRIX32 ")",
|
||||
GetSecurityStatusString(status), WINPR_CXX_COMPAT_CAST(UINT32, status));
|
||||
return status;
|
||||
@@ -1041,17 +909,11 @@ SECURITY_STATUS SEC_ENTRY sspi_RevertSecurityContext(PCtxtHandle phContext)
|
||||
SECURITY_STATUS SEC_ENTRY sspi_DecryptMessage(PCtxtHandle phContext, PSecBufferDesc pMessage,
|
||||
ULONG MessageSeqNo, PULONG pfQOP)
|
||||
{
|
||||
SECURITY_STATUS status = 0;
|
||||
InitOnceExecuteOnce(&g_Initialized, InitializeSspiModuleInt, nullptr, nullptr);
|
||||
|
||||
if (!(g_SspiW && g_SspiW->DecryptMessage))
|
||||
{
|
||||
WLog_Print(g_Log, WLOG_WARN, "Security module does not provide an implementation");
|
||||
|
||||
return SEC_E_UNSUPPORTED_FUNCTION;
|
||||
}
|
||||
|
||||
status = g_SspiW->DecryptMessage(phContext, pMessage, MessageSeqNo, pfQOP);
|
||||
SECURITY_STATUS status = sspi_init();
|
||||
if (status != SEC_E_OK)
|
||||
return status;
|
||||
status = IFCALLRESULT(SEC_E_UNSUPPORTED_FUNCTION, g_SspiW->DecryptMessage, phContext, pMessage,
|
||||
MessageSeqNo, pfQOP);
|
||||
WLog_Print(g_Log, WLOG_DEBUG, "DecryptMessage: %s (0x%08" PRIX32 ")",
|
||||
GetSecurityStatusString(status), WINPR_CXX_COMPAT_CAST(UINT32, status));
|
||||
return status;
|
||||
@@ -1060,17 +922,11 @@ SECURITY_STATUS SEC_ENTRY sspi_DecryptMessage(PCtxtHandle phContext, PSecBufferD
|
||||
SECURITY_STATUS SEC_ENTRY sspi_EncryptMessage(PCtxtHandle phContext, ULONG fQOP,
|
||||
PSecBufferDesc pMessage, ULONG MessageSeqNo)
|
||||
{
|
||||
SECURITY_STATUS status = 0;
|
||||
InitOnceExecuteOnce(&g_Initialized, InitializeSspiModuleInt, nullptr, nullptr);
|
||||
|
||||
if (!(g_SspiW && g_SspiW->EncryptMessage))
|
||||
{
|
||||
WLog_Print(g_Log, WLOG_WARN, "Security module does not provide an implementation");
|
||||
|
||||
return SEC_E_UNSUPPORTED_FUNCTION;
|
||||
}
|
||||
|
||||
status = g_SspiW->EncryptMessage(phContext, fQOP, pMessage, MessageSeqNo);
|
||||
SECURITY_STATUS status = sspi_init();
|
||||
if (status != SEC_E_OK)
|
||||
return status;
|
||||
status = IFCALLRESULT(SEC_E_UNSUPPORTED_FUNCTION, g_SspiW->EncryptMessage, phContext, fQOP,
|
||||
pMessage, MessageSeqNo);
|
||||
WLog_Print(g_Log, WLOG_DEBUG, "EncryptMessage: %s (0x%08" PRIX32 ")",
|
||||
GetSecurityStatusString(status), WINPR_CXX_COMPAT_CAST(UINT32, status));
|
||||
return status;
|
||||
@@ -1079,17 +935,11 @@ SECURITY_STATUS SEC_ENTRY sspi_EncryptMessage(PCtxtHandle phContext, ULONG fQOP,
|
||||
SECURITY_STATUS SEC_ENTRY sspi_MakeSignature(PCtxtHandle phContext, ULONG fQOP,
|
||||
PSecBufferDesc pMessage, ULONG MessageSeqNo)
|
||||
{
|
||||
SECURITY_STATUS status = 0;
|
||||
InitOnceExecuteOnce(&g_Initialized, InitializeSspiModuleInt, nullptr, nullptr);
|
||||
|
||||
if (!(g_SspiW && g_SspiW->MakeSignature))
|
||||
{
|
||||
WLog_Print(g_Log, WLOG_WARN, "Security module does not provide an implementation");
|
||||
|
||||
return SEC_E_UNSUPPORTED_FUNCTION;
|
||||
}
|
||||
|
||||
status = g_SspiW->MakeSignature(phContext, fQOP, pMessage, MessageSeqNo);
|
||||
SECURITY_STATUS status = sspi_init();
|
||||
if (status != SEC_E_OK)
|
||||
return status;
|
||||
status = IFCALLRESULT(SEC_E_UNSUPPORTED_FUNCTION, g_SspiW->MakeSignature, phContext, fQOP,
|
||||
pMessage, MessageSeqNo);
|
||||
WLog_Print(g_Log, WLOG_DEBUG, "MakeSignature: %s (0x%08" PRIX32 ")",
|
||||
GetSecurityStatusString(status), WINPR_CXX_COMPAT_CAST(UINT32, status));
|
||||
return status;
|
||||
@@ -1098,17 +948,11 @@ SECURITY_STATUS SEC_ENTRY sspi_MakeSignature(PCtxtHandle phContext, ULONG fQOP,
|
||||
SECURITY_STATUS SEC_ENTRY sspi_VerifySignature(PCtxtHandle phContext, PSecBufferDesc pMessage,
|
||||
ULONG MessageSeqNo, PULONG pfQOP)
|
||||
{
|
||||
SECURITY_STATUS status = 0;
|
||||
InitOnceExecuteOnce(&g_Initialized, InitializeSspiModuleInt, nullptr, nullptr);
|
||||
|
||||
if (!(g_SspiW && g_SspiW->VerifySignature))
|
||||
{
|
||||
WLog_Print(g_Log, WLOG_WARN, "Security module does not provide an implementation");
|
||||
|
||||
return SEC_E_UNSUPPORTED_FUNCTION;
|
||||
}
|
||||
|
||||
status = g_SspiW->VerifySignature(phContext, pMessage, MessageSeqNo, pfQOP);
|
||||
SECURITY_STATUS status = sspi_init();
|
||||
if (status != SEC_E_OK)
|
||||
return status;
|
||||
status = IFCALLRESULT(SEC_E_UNSUPPORTED_FUNCTION, g_SspiW->VerifySignature, phContext, pMessage,
|
||||
MessageSeqNo, pfQOP);
|
||||
WLog_Print(g_Log, WLOG_DEBUG, "VerifySignature: %s (0x%08" PRIX32 ")",
|
||||
GetSecurityStatusString(status), WINPR_CXX_COMPAT_CAST(UINT32, status));
|
||||
return status;
|
||||
|
||||
@@ -991,7 +991,7 @@ void sspi_GlobalInit(void)
|
||||
{
|
||||
static INIT_ONCE once = INIT_ONCE_STATIC_INIT;
|
||||
DWORD flags = 0;
|
||||
InitOnceExecuteOnce(&once, sspi_init, &flags, nullptr);
|
||||
(void)InitOnceExecuteOnce(&once, sspi_init, &flags, nullptr);
|
||||
}
|
||||
|
||||
void sspi_GlobalFinish(void)
|
||||
|
||||
@@ -94,7 +94,8 @@ BOOL WINAPI winpr_InitializeSynchronizationBarrier(LPSYNCHRONIZATION_BARRIER lpB
|
||||
HANDLE hEvent1 = nullptr;
|
||||
|
||||
#ifdef _WIN32
|
||||
InitOnceExecuteOnce(&g_InitOnce, InitOnce_Barrier, nullptr, nullptr);
|
||||
if (!InitOnceExecuteOnce(&g_InitOnce, InitOnce_Barrier, nullptr, nullptr))
|
||||
return FALSE;
|
||||
|
||||
if (g_NativeBarrier)
|
||||
return pfnInitializeSynchronizationBarrier(lpBarrier, lTotalThreads, lSpinCount);
|
||||
|
||||
@@ -260,7 +260,9 @@ static int InitializeWaitableTimer(WINPR_TIMER* timer)
|
||||
return -1;
|
||||
#elif defined(TIMER_IMPL_POSIX)
|
||||
struct sigevent sigev = WINPR_C_ARRAY_INIT;
|
||||
InitOnceExecuteOnce(&TimerSignalHandler_InitOnce, InstallTimerSignalHandler, nullptr, nullptr);
|
||||
if (!InitOnceExecuteOnce(&TimerSignalHandler_InitOnce, InstallTimerSignalHandler, nullptr,
|
||||
nullptr))
|
||||
return -1;
|
||||
sigev.sigev_notify = SIGEV_SIGNAL;
|
||||
sigev.sigev_signo = SIGALRM;
|
||||
sigev.sigev_value.sival_ptr = (void*)timer;
|
||||
|
||||
@@ -717,7 +717,8 @@ HANDLE CreateThread(LPSECURITY_ATTRIBUTES lpThreadAttributes, size_t dwStackSize
|
||||
WINPR_HANDLE_SET_TYPE_AND_MODE(thread, HANDLE_TYPE_THREAD, WINPR_FD_READ);
|
||||
handle = (HANDLE)thread;
|
||||
|
||||
InitOnceExecuteOnce(&threads_InitOnce, initializeThreads, nullptr, nullptr);
|
||||
if (!InitOnceExecuteOnce(&threads_InitOnce, initializeThreads, nullptr, nullptr))
|
||||
goto fail;
|
||||
|
||||
if (!(dwCreationFlags & CREATE_SUSPENDED))
|
||||
{
|
||||
@@ -888,7 +889,8 @@ WINPR_THREAD* winpr_GetCurrentThread(VOID)
|
||||
{
|
||||
WINPR_THREAD* ret = nullptr;
|
||||
|
||||
InitOnceExecuteOnce(&threads_InitOnce, initializeThreads, nullptr, nullptr);
|
||||
if (!InitOnceExecuteOnce(&threads_InitOnce, initializeThreads, nullptr, nullptr))
|
||||
return nullptr;
|
||||
if (mainThreadId == pthread_self())
|
||||
return (HANDLE)&mainThread;
|
||||
|
||||
|
||||
@@ -244,7 +244,8 @@ size_t TimeZoneIanaAbbrevGet(const char* abbrev, const char** list, size_t lists
|
||||
{
|
||||
static INIT_ONCE init_guard = INIT_ONCE_STATIC_INIT;
|
||||
|
||||
InitOnceExecuteOnce(&init_guard, TimeZoneIanaAbbrevInitialize, nullptr, nullptr);
|
||||
if (!InitOnceExecuteOnce(&init_guard, TimeZoneIanaAbbrevInitialize, nullptr, nullptr))
|
||||
return 0;
|
||||
|
||||
size_t rc = 0;
|
||||
for (size_t x = 0; x < TimeZoneIanaAbbrevMapSize; x++)
|
||||
|
||||
@@ -248,7 +248,8 @@ const TimeZoneNameMapEntry* TimeZoneGetAt(size_t index)
|
||||
{
|
||||
static INIT_ONCE init_guard = INIT_ONCE_STATIC_INIT;
|
||||
|
||||
InitOnceExecuteOnce(&init_guard, load_timezones, &tz_context, nullptr);
|
||||
if (!InitOnceExecuteOnce(&init_guard, load_timezones, &tz_context, nullptr))
|
||||
return nullptr;
|
||||
if (index >= tz_context.count)
|
||||
return nullptr;
|
||||
return &tz_context.entries[index];
|
||||
|
||||
@@ -67,8 +67,7 @@ static BOOL CALLBACK init_app_details(WINPR_ATTR_UNUSED PINIT_ONCE once,
|
||||
WINPR_ATTR_NODISCARD
|
||||
static BOOL initializeApplicationDetails(void)
|
||||
{
|
||||
InitOnceExecuteOnce(&s_winpr_app_details_once, init_app_details, nullptr, nullptr);
|
||||
return TRUE;
|
||||
return InitOnceExecuteOnce(&s_winpr_app_details_once, init_app_details, nullptr, nullptr);
|
||||
}
|
||||
|
||||
BOOL winpr_setApplicationDetails(const char* vendor, const char* product, SSIZE_T version)
|
||||
|
||||
@@ -142,22 +142,25 @@ static BOOL WtsApi32_InitializeWtsApi(void)
|
||||
static BOOL CALLBACK InitializeWtsApiStubs(PINIT_ONCE once, PVOID param, PVOID* context);
|
||||
static INIT_ONCE wtsapiInitOnce = INIT_ONCE_STATIC_INIT;
|
||||
|
||||
#define WTSAPI_STUB_CALL_VOID(_name, ...) \
|
||||
InitOnceExecuteOnce(&wtsapiInitOnce, InitializeWtsApiStubs, nullptr, nullptr); \
|
||||
if (!g_WtsApi || !g_WtsApi->p##_name) \
|
||||
return; \
|
||||
#define WTSAPI_STUB_CALL_VOID(_name, ...) \
|
||||
if (!InitOnceExecuteOnce(&wtsapiInitOnce, InitializeWtsApiStubs, nullptr, nullptr)) \
|
||||
return; \
|
||||
if (!g_WtsApi || !g_WtsApi->p##_name) \
|
||||
return; \
|
||||
g_WtsApi->p##_name(__VA_ARGS__)
|
||||
|
||||
#define WTSAPI_STUB_CALL_BOOL(_name, ...) \
|
||||
InitOnceExecuteOnce(&wtsapiInitOnce, InitializeWtsApiStubs, nullptr, nullptr); \
|
||||
if (!g_WtsApi || !g_WtsApi->p##_name) \
|
||||
return FALSE; \
|
||||
#define WTSAPI_STUB_CALL_BOOL(_name, ...) \
|
||||
if (!InitOnceExecuteOnce(&wtsapiInitOnce, InitializeWtsApiStubs, nullptr, nullptr)) \
|
||||
return FALSE; \
|
||||
if (!g_WtsApi || !g_WtsApi->p##_name) \
|
||||
return FALSE; \
|
||||
return g_WtsApi->p##_name(__VA_ARGS__)
|
||||
|
||||
#define WTSAPI_STUB_CALL_HANDLE(_name, ...) \
|
||||
InitOnceExecuteOnce(&wtsapiInitOnce, InitializeWtsApiStubs, nullptr, nullptr); \
|
||||
if (!g_WtsApi || !g_WtsApi->p##_name) \
|
||||
return nullptr; \
|
||||
#define WTSAPI_STUB_CALL_HANDLE(_name, ...) \
|
||||
if (!InitOnceExecuteOnce(&wtsapiInitOnce, InitializeWtsApiStubs, nullptr, nullptr)) \
|
||||
return nullptr; \
|
||||
if (!g_WtsApi || !g_WtsApi->p##_name) \
|
||||
return nullptr; \
|
||||
return g_WtsApi->p##_name(__VA_ARGS__)
|
||||
|
||||
BOOL WINAPI WTSStartRemoteControlSessionW(LPWSTR pTargetServerName, ULONG TargetLogonId,
|
||||
@@ -566,10 +569,11 @@ BOOL CDECL WTSLogoffUser(HANDLE hServer)
|
||||
|
||||
DWORD WINAPI WTSGetActiveConsoleSessionId(void)
|
||||
{
|
||||
InitOnceExecuteOnce(&wtsapiInitOnce, InitializeWtsApiStubs, nullptr, nullptr);
|
||||
if (!InitOnceExecuteOnce(&wtsapiInitOnce, InitializeWtsApiStubs, nullptr, nullptr))
|
||||
return UINT32_MAX;
|
||||
|
||||
if (!g_WtsApi || !g_WtsApi->pGetActiveConsoleSessionId)
|
||||
return 0xFFFFFFFF;
|
||||
return UINT32_MAX;
|
||||
|
||||
return g_WtsApi->pGetActiveConsoleSessionId();
|
||||
}
|
||||
@@ -689,7 +693,8 @@ BOOL WTSRegisterWtsApiFunctionTable(const WtsApiFunctionTable* table)
|
||||
void* pv;
|
||||
} cnv;
|
||||
cnv.cpv = table;
|
||||
InitOnceExecuteOnce(&wtsapiInitOnce, InitializeWtsApiStubs, cnv.pv, nullptr);
|
||||
if (!InitOnceExecuteOnce(&wtsapiInitOnce, InitializeWtsApiStubs, cnv.pv, nullptr))
|
||||
return FALSE;
|
||||
return g_WtsApi != nullptr;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user