3 #include <winpr/error.h>
4 #include <winpr/wtsapi.h>
5 #include <winpr/environment.h>
7 int TestWtsApiSessionNotification(
int argc,
char* argv[])
17 if (!GetEnvironmentVariableA(
"WTSAPI_LIBRARY", NULL, 0))
19 printf(
"%s: No RDS environment detected, skipping test\n", __func__);
24 hWnd = CreateWindowA(
"STATIC",
"TestWtsApiSessionNotification", 0, 0, 0, 0, 0, HWND_MESSAGE,
28 printf(
"%s: error creating message-only window: %" PRIu32
"\n", __func__, GetLastError());
33 dwFlags = NOTIFY_FOR_ALL_SESSIONS;
35 bSuccess = WTSRegisterSessionNotification(hWnd, dwFlags);
39 printf(
"%s: WTSRegisterSessionNotification failed: %" PRIu32
"\n", __func__,
44 bSuccess = WTSUnRegisterSessionNotification(hWnd);
56 printf(
"%s: WTSUnRegisterSessionNotification failed: %" PRIu32
"\n", __func__,