diff --git a/reactos/include/reactos/subsys/win/winmsg.h b/reactos/include/reactos/subsys/win/winmsg.h index eaa8fd3c3dc..60eddf73158 100644 --- a/reactos/include/reactos/subsys/win/winmsg.h +++ b/reactos/include/reactos/subsys/win/winmsg.h @@ -60,6 +60,11 @@ typedef struct _USER_END_TASK BOOL Success; } USER_END_TASK, *PUSER_END_TASK; +typedef struct _USER_LOGON +{ + BOOL IsLogon; +} USER_LOGON, *PUSER_LOGON; + typedef struct _USER_GET_THREAD_CONSOLE_DESKTOP { ULONG_PTR ThreadId; @@ -90,6 +95,7 @@ typedef struct _USER_API_MESSAGE { USER_EXIT_REACTOS ExitReactosRequest; USER_END_TASK EndTaskRequest; + USER_LOGON LogonRequest; USER_GET_THREAD_CONSOLE_DESKTOP GetThreadConsoleDesktopRequest; USER_REGISTER_SERVICES_PROCESS RegisterServicesProcessRequest; USER_REGISTER_LOGON_PROCESS RegisterLogonProcessRequest; diff --git a/reactos/win32ss/user/user32/include/user32p.h b/reactos/win32ss/user/user32/include/user32p.h index ada25656506..e27efcf3cea 100644 --- a/reactos/win32ss/user/user32/include/user32p.h +++ b/reactos/win32ss/user/user32/include/user32p.h @@ -113,6 +113,9 @@ UINT MenuDrawMenuBar(HDC hDC, LPRECT Rect, HWND hWnd, BOOL Draw); VOID MenuTrackMouseMenuBar(HWND hWnd, ULONG Ht, POINT Pt); VOID MenuTrackKbdMenuBar(HWND hWnd, UINT wParam, WCHAR wChar); +/* definitions for logon.c */ +VOID FASTCALL Logon(BOOL IsLogon); + /* misc definitions */ void mirror_rect( const RECT *window_rect, RECT *rect ); BOOL FASTCALL DefSetText(HWND hWnd, PCWSTR String, BOOL Ansi); diff --git a/reactos/win32ss/user/user32/misc/logon.c b/reactos/win32ss/user/user32/misc/logon.c index 13005aa63d2..57c6bdfe00a 100644 --- a/reactos/win32ss/user/user32/misc/logon.c +++ b/reactos/win32ss/user/user32/misc/logon.c @@ -73,6 +73,22 @@ RegisterLogonProcess(DWORD dwProcessId, return gfLogonProcess; } +/* + * Helper function used by SetWindowStationUser (see winsta.c) + */ +VOID FASTCALL +Logon(BOOL IsLogon) +{ + USER_API_MESSAGE ApiMessage; + PUSER_LOGON LogonRequest = &ApiMessage.Data.LogonRequest; + + LogonRequest->IsLogon = IsLogon; + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(USERSRV_SERVERDLL_INDEX, UserpLogon), + sizeof(*LogonRequest)); +} + /* * @implemented */ diff --git a/reactos/win32ss/user/user32/misc/winsta.c b/reactos/win32ss/user/user32/misc/winsta.c index b7690eca3d2..f416dd117f7 100644 --- a/reactos/win32ss/user/user32/misc/winsta.c +++ b/reactos/win32ss/user/user32/misc/winsta.c @@ -371,7 +371,7 @@ OpenWindowStationW(LPCWSTR lpszWinSta, /* - * @unimplemented + * @implemented */ BOOL WINAPI @@ -380,7 +380,21 @@ SetWindowStationUser(HWINSTA hWindowStation, PSID psid, DWORD size) { - return NtUserSetWindowStationUser(hWindowStation, pluid, psid, size); + BOOL Success; + + Success = NtUserSetWindowStationUser(hWindowStation, pluid, psid, size); + if (Success) + { + /* Signal log-on/off to WINSRV */ + + /* User is logging on if pluid != LuidNone, otherwise it is a log-off */ + LUID LuidNone = {0, 0}; + BOOL IsLogon = (pluid && !RtlEqualLuid(pluid, &LuidNone)); + + Logon(IsLogon); + } + + return Success; } /* EOF */