Callers expect valid status codes even from stubs. Keeping track of window registrations is required to do that.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47433 Signed-off-by: Patrick Hibbs hibbsncc1701@yahoo.com --- v2: Fix return status based on tests. --- dlls/wtsapi32/wtsapi32.c | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-)
diff --git a/dlls/wtsapi32/wtsapi32.c b/dlls/wtsapi32/wtsapi32.c index 3d944943b4..8ece1d2b37 100644 --- a/dlls/wtsapi32/wtsapi32.c +++ b/dlls/wtsapi32/wtsapi32.c @@ -316,8 +316,44 @@ BOOL WINAPI WTSRegisterSessionNotification(HWND hWnd, DWORD dwFlags) */ BOOL WINAPI WTSRegisterSessionNotificationEx(HANDLE hServer, HWND hWnd, DWORD dwFlags) { - FIXME("Stub %p %p 0x%08x\n", hServer, hWnd, dwFlags); - return FALSE; + BOOL ret = TRUE; + BOOL found = FALSE; + WTSAPI32InternalRegMNGTStr *mgntStr; + + FIXME("Simi-Stub %p %p 0x%08x\n", hServer, hWnd, dwFlags); + + /* Keep track of the registration attempts. + */ + LIST_FOR_EACH_ENTRY(mgntStr, &RegisteredWindowsToNotifiy, WTSAPI32InternalRegMNGTStr, entry) + { + /* MSDN says that if the window is already registered, + * the dwFlags value is ignored. + */ + if ((mgntStr != NULL) && (mgntStr->hServer == hServer) && (mgntStr->hWnd == hWnd)) + { + found = TRUE; + } + } + + /* Only create the registration if needed. */ + if (!found) + { + mgntStr = NULL; + mgntStr = HeapAlloc(GetProcessHeap(),0, sizeof(WTSAPI32InternalRegMNGTStr)); + if (mgntStr != NULL) + { + mgntStr->hServer = hServer; + mgntStr->hWnd = hWnd; + mgntStr->dwFlags = dwFlags; + list_add_head( &RegisteredWindowsToNotifiy, &mgntStr->entry ); + } + else + { + ret = FALSE; + } + } + + return ret; }