Merge pull request #3620 from mfleisz/wtsapi_fix

wtsapi: Fix issue with setting custom API table
This commit is contained in:
Bernhard Miklautz 2016-11-24 11:58:01 +01:00 committed by GitHub
commit 3550d0cb43
1 changed files with 12 additions and 1 deletions

View File

@ -695,7 +695,12 @@ const CHAR* WTSSessionStateToString(WTS_CONNECTSTATE_CLASS state)
BOOL WTSRegisterWtsApiFunctionTable(PWtsApiFunctionTable table)
{
g_WtsApi = table;
/* Use InitOnceExecuteOnce here as well - otherwise a table set with this
function is overriden on the first use of a WTS* API call (due to
wtsapiInitOnce not being set). */
InitOnceExecuteOnce(&wtsapiInitOnce, InitializeWtsApiStubs, (PVOID)table, NULL);
if (!g_WtsApi)
return FALSE;
return TRUE;
}
@ -787,6 +792,12 @@ static void InitializeWtsApiStubs_FreeRDS()
static BOOL CALLBACK InitializeWtsApiStubs(PINIT_ONCE once, PVOID param, PVOID *context)
{
if (param)
{
g_WtsApi = (PWtsApiFunctionTable)param;
return TRUE;
}
InitializeWtsApiStubs_Env();
#ifdef _WIN32