mirror of
https://github.com/reactos/reactos.git
synced 2025-07-29 07:41:48 +00:00
[WINLOGON]
Formatting. No code changes. svn path=/trunk/; revision=58406
This commit is contained in:
parent
95e9b1a4a7
commit
65ad79656d
4 changed files with 744 additions and 724 deletions
|
@ -15,348 +15,362 @@ WINE_DEFAULT_DEBUG_CHANNEL(winlogon);
|
||||||
/* FUNCTIONS ****************************************************************/
|
/* FUNCTIONS ****************************************************************/
|
||||||
|
|
||||||
#ifndef USE_GETLASTINPUTINFO
|
#ifndef USE_GETLASTINPUTINFO
|
||||||
static LRESULT CALLBACK
|
static
|
||||||
KeyboardActivityProc(
|
LRESULT
|
||||||
IN INT nCode,
|
CALLBACK
|
||||||
IN WPARAM wParam,
|
KeyboardActivityProc(IN INT nCode,
|
||||||
IN LPARAM lParam)
|
IN WPARAM wParam,
|
||||||
|
IN LPARAM lParam)
|
||||||
{
|
{
|
||||||
InterlockedExchange((LONG*)&WLSession->LastActivity, ((PKBDLLHOOKSTRUCT)lParam)->time);
|
InterlockedExchange((LONG*)&WLSession->LastActivity, ((PKBDLLHOOKSTRUCT)lParam)->time);
|
||||||
return CallNextHookEx(NULL, nCode, wParam, lParam);
|
return CallNextHookEx(NULL, nCode, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
static LRESULT CALLBACK
|
|
||||||
MouseActivityProc(
|
static
|
||||||
IN INT nCode,
|
LRESULT
|
||||||
IN WPARAM wParam,
|
CALLBACK
|
||||||
IN LPARAM lParam)
|
MouseActivityProc(IN INT nCode,
|
||||||
|
IN WPARAM wParam,
|
||||||
|
IN LPARAM lParam)
|
||||||
{
|
{
|
||||||
InterlockedExchange((LONG*)&WLSession->LastActivity, ((PMSLLHOOKSTRUCT)lParam)->time);
|
InterlockedExchange((LONG*)&WLSession->LastActivity, ((PMSLLHOOKSTRUCT)lParam)->time);
|
||||||
return CallNextHookEx(NULL, nCode, wParam, lParam);
|
return CallNextHookEx(NULL, nCode, wParam, lParam);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static VOID
|
|
||||||
LoadScreenSaverParameters(
|
|
||||||
OUT LPDWORD Timeout)
|
|
||||||
{
|
|
||||||
BOOL Enabled;
|
|
||||||
|
|
||||||
if (!SystemParametersInfoW(SPI_GETSCREENSAVETIMEOUT, 0, Timeout, 0))
|
static
|
||||||
{
|
VOID
|
||||||
WARN("WL: Unable to get screen saver timeout (error %lu). Disabling it\n", GetLastError());
|
LoadScreenSaverParameters(OUT LPDWORD Timeout)
|
||||||
*Timeout = INFINITE;
|
{
|
||||||
}
|
BOOL Enabled;
|
||||||
else if (!SystemParametersInfoW(SPI_GETSCREENSAVEACTIVE, 0, &Enabled, 0))
|
|
||||||
{
|
if (!SystemParametersInfoW(SPI_GETSCREENSAVETIMEOUT, 0, Timeout, 0))
|
||||||
WARN("WL: Unable to check if screen saver is enabled (error %lu). Disabling it\n", GetLastError());
|
{
|
||||||
*Timeout = INFINITE;
|
WARN("WL: Unable to get screen saver timeout (error %lu). Disabling it\n", GetLastError());
|
||||||
}
|
*Timeout = INFINITE;
|
||||||
else if (!Enabled)
|
}
|
||||||
{
|
else if (!SystemParametersInfoW(SPI_GETSCREENSAVEACTIVE, 0, &Enabled, 0))
|
||||||
TRACE("WL: Screen saver is disabled\n");
|
{
|
||||||
*Timeout = INFINITE;
|
WARN("WL: Unable to check if screen saver is enabled (error %lu). Disabling it\n", GetLastError());
|
||||||
}
|
*Timeout = INFINITE;
|
||||||
else
|
}
|
||||||
{
|
else if (!Enabled)
|
||||||
TRACE("WL: Screen saver timeout: %lu seconds\n", *Timeout);
|
{
|
||||||
*Timeout *= 1000;
|
TRACE("WL: Screen saver is disabled\n");
|
||||||
}
|
*Timeout = INFINITE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TRACE("WL: Screen saver timeout: %lu seconds\n", *Timeout);
|
||||||
|
*Timeout *= 1000;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static DWORD WINAPI
|
|
||||||
ScreenSaverThreadMain(
|
static
|
||||||
IN LPVOID lpParameter)
|
DWORD
|
||||||
|
WINAPI
|
||||||
|
ScreenSaverThreadMain(IN LPVOID lpParameter)
|
||||||
{
|
{
|
||||||
PWLSESSION Session = (PWLSESSION)lpParameter;
|
PWLSESSION Session = (PWLSESSION)lpParameter;
|
||||||
HANDLE HandleArray[3];
|
HANDLE HandleArray[3];
|
||||||
#ifdef USE_GETLASTINPUTINFO
|
#ifdef USE_GETLASTINPUTINFO
|
||||||
LASTINPUTINFO lastInputInfo;
|
LASTINPUTINFO lastInputInfo;
|
||||||
#else
|
#else
|
||||||
DWORD LastActivity;
|
DWORD LastActivity;
|
||||||
#endif
|
#endif
|
||||||
DWORD TimeToWait;
|
DWORD TimeToWait;
|
||||||
DWORD Timeout; /* Timeout before screen saver starts, in milliseconds */
|
DWORD Timeout; /* Timeout before screen saver starts, in milliseconds */
|
||||||
DWORD ret;
|
DWORD ret;
|
||||||
|
|
||||||
if (!ImpersonateLoggedOnUser(Session->UserToken))
|
if (!ImpersonateLoggedOnUser(Session->UserToken))
|
||||||
{
|
{
|
||||||
ERR("ImpersonateLoggedOnUser() failed with error %lu\n", GetLastError());
|
ERR("ImpersonateLoggedOnUser() failed with error %lu\n", GetLastError());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Session->hUserActivity = CreateEventW(NULL, FALSE, FALSE, NULL);
|
Session->hUserActivity = CreateEventW(NULL, FALSE, FALSE, NULL);
|
||||||
if (!Session->hUserActivity)
|
if (!Session->hUserActivity)
|
||||||
{
|
{
|
||||||
ERR("WL: Unable to create event (error %lu)\n", GetLastError());
|
ERR("WL: Unable to create event (error %lu)\n", GetLastError());
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
Session->hEndOfScreenSaver = CreateEventW(NULL, FALSE, FALSE, NULL);
|
Session->hEndOfScreenSaver = CreateEventW(NULL, FALSE, FALSE, NULL);
|
||||||
if (!Session->hEndOfScreenSaver)
|
if (!Session->hEndOfScreenSaver)
|
||||||
{
|
{
|
||||||
ERR("WL: Unable to create event (error %lu)\n", GetLastError());
|
ERR("WL: Unable to create event (error %lu)\n", GetLastError());
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
HandleArray[0] = Session->hEndOfScreenSaverThread;
|
HandleArray[0] = Session->hEndOfScreenSaverThread;
|
||||||
HandleArray[1] = Session->hScreenSaverParametersChanged;
|
HandleArray[1] = Session->hScreenSaverParametersChanged;
|
||||||
HandleArray[2] = Session->hEndOfScreenSaver;
|
HandleArray[2] = Session->hEndOfScreenSaver;
|
||||||
|
|
||||||
LoadScreenSaverParameters(&Timeout);
|
LoadScreenSaverParameters(&Timeout);
|
||||||
|
|
||||||
#ifndef USE_GETLASTINPUTINFO
|
#ifndef USE_GETLASTINPUTINFO
|
||||||
InterlockedExchange((LONG*)&Session->LastActivity, GetTickCount());
|
InterlockedExchange((LONG*)&Session->LastActivity, GetTickCount());
|
||||||
#else
|
#else
|
||||||
lastInputInfo.cbSize = sizeof(LASTINPUTINFO);
|
lastInputInfo.cbSize = sizeof(LASTINPUTINFO);
|
||||||
#endif
|
#endif
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
/* See the time of last activity and calculate a timeout */
|
/* See the time of last activity and calculate a timeout */
|
||||||
#ifndef USE_GETLASTINPUTINFO
|
#ifndef USE_GETLASTINPUTINFO
|
||||||
LastActivity = InterlockedCompareExchange((LONG*)&Session->LastActivity, 0, 0);
|
LastActivity = InterlockedCompareExchange((LONG*)&Session->LastActivity, 0, 0);
|
||||||
TimeToWait = Timeout - (GetTickCount() - LastActivity);
|
TimeToWait = Timeout - (GetTickCount() - LastActivity);
|
||||||
#else
|
#else
|
||||||
if (GetLastInputInfo(&lastInputInfo))
|
if (GetLastInputInfo(&lastInputInfo))
|
||||||
TimeToWait = Timeout - (GetTickCount() - lastInputInfo.dwTime);
|
TimeToWait = Timeout - (GetTickCount() - lastInputInfo.dwTime);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WARN("GetLastInputInfo() failed with error %lu\n", GetLastError());
|
WARN("GetLastInputInfo() failed with error %lu\n", GetLastError());
|
||||||
TimeToWait = 10; /* Try again in 10 ms */
|
TimeToWait = 10; /* Try again in 10 ms */
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (TimeToWait > Timeout)
|
|
||||||
{
|
|
||||||
/* GetTickCount() got back to 0 */
|
|
||||||
TimeToWait = Timeout;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Wait for the timeout, or the end of this thread */
|
if (TimeToWait > Timeout)
|
||||||
ret = WaitForMultipleObjects(2, HandleArray, FALSE, TimeToWait);
|
{
|
||||||
if (ret == WAIT_OBJECT_0)
|
/* GetTickCount() got back to 0 */
|
||||||
break;
|
TimeToWait = Timeout;
|
||||||
else if (ret == WAIT_OBJECT_0 + 1)
|
}
|
||||||
LoadScreenSaverParameters(&Timeout);
|
|
||||||
|
|
||||||
/* Check if we didn't had recent activity */
|
/* Wait for the timeout, or the end of this thread */
|
||||||
|
ret = WaitForMultipleObjects(2, HandleArray, FALSE, TimeToWait);
|
||||||
|
if (ret == WAIT_OBJECT_0)
|
||||||
|
break;
|
||||||
|
else if (ret == WAIT_OBJECT_0 + 1)
|
||||||
|
LoadScreenSaverParameters(&Timeout);
|
||||||
|
|
||||||
|
/* Check if we didn't had recent activity */
|
||||||
#ifndef USE_GETLASTINPUTINFO
|
#ifndef USE_GETLASTINPUTINFO
|
||||||
LastActivity = InterlockedCompareExchange((LONG*)&Session->LastActivity, 0, 0);
|
LastActivity = InterlockedCompareExchange((LONG*)&Session->LastActivity, 0, 0);
|
||||||
if (LastActivity + Timeout > GetTickCount())
|
if (LastActivity + Timeout > GetTickCount())
|
||||||
continue;
|
continue;
|
||||||
#else
|
#else
|
||||||
if (!GetLastInputInfo(&lastInputInfo))
|
if (!GetLastInputInfo(&lastInputInfo))
|
||||||
{
|
{
|
||||||
WARN("GetLastInputInfo() failed with error %lu\n", GetLastError());
|
WARN("GetLastInputInfo() failed with error %lu\n", GetLastError());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (lastInputInfo.dwTime + Timeout > GetTickCount())
|
|
||||||
continue;
|
if (lastInputInfo.dwTime + Timeout > GetTickCount())
|
||||||
|
continue;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Run screen saver */
|
/* Run screen saver */
|
||||||
PostMessageW(Session->SASWindow, WLX_WM_SAS, WLX_SAS_TYPE_SCRNSVR_TIMEOUT, 0);
|
PostMessageW(Session->SASWindow, WLX_WM_SAS, WLX_SAS_TYPE_SCRNSVR_TIMEOUT, 0);
|
||||||
|
|
||||||
/* Wait for the end of this thread or of the screen saver */
|
/* Wait for the end of this thread or of the screen saver */
|
||||||
ret = WaitForMultipleObjects(3, HandleArray, FALSE, INFINITE);
|
ret = WaitForMultipleObjects(3, HandleArray, FALSE, INFINITE);
|
||||||
if (ret == WAIT_OBJECT_0)
|
if (ret == WAIT_OBJECT_0)
|
||||||
break;
|
break;
|
||||||
else if (ret == WAIT_OBJECT_0 + 1)
|
else if (ret == WAIT_OBJECT_0 + 1)
|
||||||
LoadScreenSaverParameters(&Timeout);
|
LoadScreenSaverParameters(&Timeout);
|
||||||
else if (ret == WAIT_OBJECT_0 + 2)
|
else if (ret == WAIT_OBJECT_0 + 2)
|
||||||
SystemParametersInfoW(SPI_SETSCREENSAVERRUNNING, FALSE, NULL, 0);
|
SystemParametersInfoW(SPI_SETSCREENSAVERRUNNING, FALSE, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
RevertToSelf();
|
RevertToSelf();
|
||||||
if (Session->hUserActivity)
|
if (Session->hUserActivity)
|
||||||
CloseHandle(Session->hUserActivity);
|
CloseHandle(Session->hUserActivity);
|
||||||
if (Session->hEndOfScreenSaver)
|
|
||||||
CloseHandle(Session->hEndOfScreenSaver);
|
if (Session->hEndOfScreenSaver)
|
||||||
|
CloseHandle(Session->hEndOfScreenSaver);
|
||||||
|
|
||||||
#ifndef USE_GETLASTINPUTINFO
|
#ifndef USE_GETLASTINPUTINFO
|
||||||
if (Session->KeyboardHook)
|
if (Session->KeyboardHook)
|
||||||
UnhookWindowsHookEx(Session->KeyboardHook);
|
UnhookWindowsHookEx(Session->KeyboardHook);
|
||||||
if (Session->MouseHook)
|
|
||||||
UnhookWindowsHookEx(Session->MouseHook);
|
if (Session->MouseHook)
|
||||||
|
UnhookWindowsHookEx(Session->MouseHook);
|
||||||
#endif
|
#endif
|
||||||
CloseHandle(Session->hEndOfScreenSaverThread);
|
|
||||||
CloseHandle(Session->hScreenSaverParametersChanged);
|
CloseHandle(Session->hEndOfScreenSaverThread);
|
||||||
return 0;
|
CloseHandle(Session->hScreenSaverParametersChanged);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
InitializeScreenSaver(
|
InitializeScreenSaver(IN OUT PWLSESSION Session)
|
||||||
IN OUT PWLSESSION Session)
|
|
||||||
{
|
{
|
||||||
HANDLE ScreenSaverThread;
|
HANDLE ScreenSaverThread;
|
||||||
|
|
||||||
#ifndef USE_GETLASTINPUTINFO
|
#ifndef USE_GETLASTINPUTINFO
|
||||||
/* Register hooks to detect keyboard and mouse activity */
|
/* Register hooks to detect keyboard and mouse activity */
|
||||||
Session->KeyboardHook = SetWindowsHookEx(WH_KEYBOARD_LL, KeyboardActivityProc, hAppInstance, 0);
|
Session->KeyboardHook = SetWindowsHookEx(WH_KEYBOARD_LL, KeyboardActivityProc, hAppInstance, 0);
|
||||||
if (!Session->KeyboardHook)
|
if (!Session->KeyboardHook)
|
||||||
{
|
{
|
||||||
ERR("WL: Unable to register keyboard hook\n");
|
ERR("WL: Unable to register keyboard hook\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
Session->MouseHook = SetWindowsHookEx(WH_MOUSE_LL, MouseActivityProc, hAppInstance, 0);
|
|
||||||
if (!Session->MouseHook)
|
Session->MouseHook = SetWindowsHookEx(WH_MOUSE_LL, MouseActivityProc, hAppInstance, 0);
|
||||||
{
|
if (!Session->MouseHook)
|
||||||
ERR("WL: Unable to register mouse hook\n");
|
{
|
||||||
return FALSE;
|
ERR("WL: Unable to register mouse hook\n");
|
||||||
}
|
return FALSE;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Session->hScreenSaverParametersChanged = CreateEventW(NULL, FALSE, FALSE, NULL);
|
Session->hScreenSaverParametersChanged = CreateEventW(NULL, FALSE, FALSE, NULL);
|
||||||
if (!Session->hScreenSaverParametersChanged)
|
if (!Session->hScreenSaverParametersChanged)
|
||||||
{
|
{
|
||||||
WARN("WL: Unable to create screen saver event (error %lu)\n", GetLastError());
|
WARN("WL: Unable to create screen saver event (error %lu)\n", GetLastError());
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
Session->hEndOfScreenSaverThread = CreateEventW(NULL, FALSE, FALSE, NULL);
|
|
||||||
if (!Session->hEndOfScreenSaverThread)
|
|
||||||
{
|
|
||||||
WARN("WL: Unable to create screen saver event (error %lu)\n", GetLastError());
|
|
||||||
CloseHandle(Session->hScreenSaverParametersChanged);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
ScreenSaverThread = CreateThread(
|
Session->hEndOfScreenSaverThread = CreateEventW(NULL, FALSE, FALSE, NULL);
|
||||||
NULL,
|
if (!Session->hEndOfScreenSaverThread)
|
||||||
0,
|
{
|
||||||
ScreenSaverThreadMain,
|
WARN("WL: Unable to create screen saver event (error %lu)\n", GetLastError());
|
||||||
Session,
|
CloseHandle(Session->hScreenSaverParametersChanged);
|
||||||
0,
|
return TRUE;
|
||||||
NULL);
|
}
|
||||||
if (ScreenSaverThread)
|
|
||||||
CloseHandle(ScreenSaverThread);
|
|
||||||
else
|
|
||||||
ERR("WL: Unable to start screen saver thread\n");
|
|
||||||
|
|
||||||
return TRUE;
|
ScreenSaverThread = CreateThread(NULL,
|
||||||
|
0,
|
||||||
|
ScreenSaverThreadMain,
|
||||||
|
Session,
|
||||||
|
0,
|
||||||
|
NULL);
|
||||||
|
if (ScreenSaverThread)
|
||||||
|
CloseHandle(ScreenSaverThread);
|
||||||
|
else
|
||||||
|
ERR("WL: Unable to start screen saver thread\n");
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
StartScreenSaver(
|
StartScreenSaver(IN PWLSESSION Session)
|
||||||
IN PWLSESSION Session)
|
|
||||||
{
|
{
|
||||||
HKEY hKey = NULL, hCurrentUser = NULL;
|
HKEY hKey = NULL, hCurrentUser = NULL;
|
||||||
WCHAR szApplicationName[MAX_PATH];
|
WCHAR szApplicationName[MAX_PATH];
|
||||||
WCHAR szCommandLine[MAX_PATH + 3];
|
WCHAR szCommandLine[MAX_PATH + 3];
|
||||||
DWORD bufferSize = sizeof(szApplicationName) - sizeof(WCHAR);
|
DWORD bufferSize = sizeof(szApplicationName) - sizeof(WCHAR);
|
||||||
DWORD dwType;
|
DWORD dwType;
|
||||||
STARTUPINFOW StartupInfo;
|
STARTUPINFOW StartupInfo;
|
||||||
PROCESS_INFORMATION ProcessInformation;
|
PROCESS_INFORMATION ProcessInformation;
|
||||||
HANDLE HandleArray[2];
|
HANDLE HandleArray[2];
|
||||||
LONG rc;
|
LONG rc;
|
||||||
DWORD Status;
|
DWORD Status;
|
||||||
BOOL ret = FALSE;
|
BOOL ret = FALSE;
|
||||||
|
|
||||||
if (!ImpersonateLoggedOnUser(Session->UserToken))
|
if (!ImpersonateLoggedOnUser(Session->UserToken))
|
||||||
{
|
{
|
||||||
ERR("WL: ImpersonateLoggedOnUser() failed with error %lu\n", GetLastError());
|
ERR("WL: ImpersonateLoggedOnUser() failed with error %lu\n", GetLastError());
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = RegOpenCurrentUser(
|
rc = RegOpenCurrentUser(KEY_READ,
|
||||||
KEY_READ,
|
&hCurrentUser);
|
||||||
&hCurrentUser);
|
if (rc != ERROR_SUCCESS)
|
||||||
if (rc != ERROR_SUCCESS)
|
{
|
||||||
{
|
ERR("WL: RegOpenCurrentUser Error!\n");
|
||||||
ERR("WL: RegOpenCurrentUser Error!\n");
|
goto cleanup;
|
||||||
goto cleanup;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
rc = RegOpenKeyExW(
|
rc = RegOpenKeyExW(hCurrentUser,
|
||||||
hCurrentUser,
|
L"Control Panel\\Desktop",
|
||||||
L"Control Panel\\Desktop",
|
0,
|
||||||
0,
|
KEY_QUERY_VALUE,
|
||||||
KEY_QUERY_VALUE,
|
&hKey);
|
||||||
&hKey);
|
if (rc != ERROR_SUCCESS)
|
||||||
if (rc != ERROR_SUCCESS)
|
{
|
||||||
{
|
ERR("WL: RegOpenKeyEx Error!\n");
|
||||||
ERR("WL: RegOpenKeyEx Error!\n");
|
goto cleanup;
|
||||||
goto cleanup;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
rc = RegQueryValueExW(
|
rc = RegQueryValueExW(hKey,
|
||||||
hKey,
|
L"SCRNSAVE.EXE",
|
||||||
L"SCRNSAVE.EXE",
|
0,
|
||||||
0,
|
&dwType,
|
||||||
&dwType,
|
(LPBYTE)szApplicationName,
|
||||||
(LPBYTE)szApplicationName,
|
&bufferSize);
|
||||||
&bufferSize);
|
if (rc != ERROR_SUCCESS || dwType != REG_SZ)
|
||||||
if (rc != ERROR_SUCCESS || dwType != REG_SZ)
|
{
|
||||||
{
|
ERR("WL: RegQueryValueEx Error!\n");
|
||||||
ERR("WL: RegQueryValueEx Error!\n");
|
goto cleanup;
|
||||||
goto cleanup;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (bufferSize == 0)
|
if (bufferSize == 0)
|
||||||
{
|
{
|
||||||
ERR("WL: Buffer size is NULL!\n");
|
ERR("WL: Buffer size is NULL!\n");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
szApplicationName[bufferSize / sizeof(WCHAR)] = 0; /* Terminate the string */
|
szApplicationName[bufferSize / sizeof(WCHAR)] = 0; /* Terminate the string */
|
||||||
|
|
||||||
if (wcslen(szApplicationName) == 0)
|
if (wcslen(szApplicationName) == 0)
|
||||||
{
|
{
|
||||||
ERR("WL: Application Name length is zero!\n");
|
ERR("WL: Application Name length is zero!\n");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
wsprintfW(szCommandLine, L"%s /s", szApplicationName);
|
wsprintfW(szCommandLine, L"%s /s", szApplicationName);
|
||||||
TRACE("WL: Executing %S\n", szCommandLine);
|
TRACE("WL: Executing %S\n", szCommandLine);
|
||||||
|
|
||||||
ZeroMemory(&StartupInfo, sizeof(STARTUPINFOW));
|
ZeroMemory(&StartupInfo, sizeof(STARTUPINFOW));
|
||||||
ZeroMemory(&ProcessInformation, sizeof(PROCESS_INFORMATION));
|
ZeroMemory(&ProcessInformation, sizeof(PROCESS_INFORMATION));
|
||||||
StartupInfo.cb = sizeof(STARTUPINFOW);
|
StartupInfo.cb = sizeof(STARTUPINFOW);
|
||||||
StartupInfo.dwFlags = STARTF_SCRNSAVER;
|
StartupInfo.dwFlags = STARTF_SCRNSAVER;
|
||||||
/* FIXME: run the screen saver on the screen saver desktop */
|
|
||||||
ret = CreateProcessW(
|
|
||||||
szApplicationName,
|
|
||||||
szCommandLine,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
FALSE,
|
|
||||||
0,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
&StartupInfo,
|
|
||||||
&ProcessInformation);
|
|
||||||
if (!ret)
|
|
||||||
{
|
|
||||||
ERR("WL: Unable to start %S, error %lu\n", szApplicationName, GetLastError());
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
CloseHandle(ProcessInformation.hThread);
|
|
||||||
|
|
||||||
SystemParametersInfoW(SPI_SETSCREENSAVERRUNNING, TRUE, NULL, 0);
|
/* FIXME: run the screen saver on the screen saver desktop */
|
||||||
|
ret = CreateProcessW(szApplicationName,
|
||||||
|
szCommandLine,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
FALSE,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
&StartupInfo,
|
||||||
|
&ProcessInformation);
|
||||||
|
if (!ret)
|
||||||
|
{
|
||||||
|
ERR("WL: Unable to start %S, error %lu\n", szApplicationName, GetLastError());
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
/* Wait the end of the process or some other activity */
|
CloseHandle(ProcessInformation.hThread);
|
||||||
ResetEvent(Session->hUserActivity);
|
|
||||||
HandleArray[0] = ProcessInformation.hProcess;
|
|
||||||
HandleArray[1] = Session->hUserActivity;
|
|
||||||
Status = WaitForMultipleObjects(2, HandleArray, FALSE, INFINITE);
|
|
||||||
if (Status == WAIT_OBJECT_0 + 1)
|
|
||||||
{
|
|
||||||
/* Kill the screen saver */
|
|
||||||
TerminateProcess(ProcessInformation.hProcess, 0);
|
|
||||||
}
|
|
||||||
SetEvent(Session->hEndOfScreenSaver);
|
|
||||||
|
|
||||||
CloseHandle(ProcessInformation.hProcess);
|
SystemParametersInfoW(SPI_SETSCREENSAVERRUNNING, TRUE, NULL, 0);
|
||||||
|
|
||||||
|
/* Wait the end of the process or some other activity */
|
||||||
|
ResetEvent(Session->hUserActivity);
|
||||||
|
HandleArray[0] = ProcessInformation.hProcess;
|
||||||
|
HandleArray[1] = Session->hUserActivity;
|
||||||
|
Status = WaitForMultipleObjects(2, HandleArray, FALSE, INFINITE);
|
||||||
|
if (Status == WAIT_OBJECT_0 + 1)
|
||||||
|
{
|
||||||
|
/* Kill the screen saver */
|
||||||
|
TerminateProcess(ProcessInformation.hProcess, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
SetEvent(Session->hEndOfScreenSaver);
|
||||||
|
|
||||||
|
CloseHandle(ProcessInformation.hProcess);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
RevertToSelf();
|
RevertToSelf();
|
||||||
if (hKey)
|
if (hKey)
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
if (hCurrentUser)
|
|
||||||
RegCloseKey(hCurrentUser);
|
if (hCurrentUser)
|
||||||
if (!ret)
|
RegCloseKey(hCurrentUser);
|
||||||
{
|
|
||||||
PostMessageW(Session->SASWindow, WLX_WM_SAS, WLX_SAS_TYPE_SCRNSVR_ACTIVITY, 0);
|
if (!ret)
|
||||||
|
{
|
||||||
|
PostMessageW(Session->SASWindow, WLX_WM_SAS, WLX_SAS_TYPE_SCRNSVR_ACTIVITY, 0);
|
||||||
#ifndef USE_GETLASTINPUTINFO
|
#ifndef USE_GETLASTINPUTINFO
|
||||||
InterlockedExchange((LONG*)&Session->LastActivity, GetTickCount());
|
InterlockedExchange((LONG*)&Session->LastActivity, GetTickCount());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,142 +17,147 @@ WINE_DEFAULT_DEBUG_CHANNEL(winlogon);
|
||||||
DWORD
|
DWORD
|
||||||
GetSetupType(VOID)
|
GetSetupType(VOID)
|
||||||
{
|
{
|
||||||
DWORD dwError;
|
DWORD dwError;
|
||||||
HKEY hKey;
|
HKEY hKey;
|
||||||
DWORD dwType;
|
DWORD dwType;
|
||||||
DWORD dwSize;
|
DWORD dwSize;
|
||||||
DWORD dwSetupType;
|
DWORD dwSetupType;
|
||||||
|
|
||||||
TRACE("GetSetupType()\n");
|
TRACE("GetSetupType()\n");
|
||||||
|
|
||||||
/* Open key */
|
/* Open key */
|
||||||
dwError = RegOpenKeyExW(
|
dwError = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
||||||
HKEY_LOCAL_MACHINE,
|
L"SYSTEM\\Setup",
|
||||||
L"SYSTEM\\Setup",
|
0,
|
||||||
0,
|
KEY_QUERY_VALUE,
|
||||||
KEY_QUERY_VALUE,
|
&hKey);
|
||||||
&hKey);
|
if (dwError != ERROR_SUCCESS)
|
||||||
if (dwError != ERROR_SUCCESS)
|
return 0;
|
||||||
return 0;
|
|
||||||
|
|
||||||
/* Read key */
|
/* Read key */
|
||||||
dwSize = sizeof(DWORD);
|
dwSize = sizeof(DWORD);
|
||||||
dwError = RegQueryValueExW(
|
dwError = RegQueryValueExW(hKey,
|
||||||
hKey,
|
L"SetupType",
|
||||||
L"SetupType",
|
NULL,
|
||||||
NULL,
|
&dwType,
|
||||||
&dwType,
|
(LPBYTE)&dwSetupType,
|
||||||
(LPBYTE)&dwSetupType,
|
&dwSize);
|
||||||
&dwSize);
|
|
||||||
|
|
||||||
/* Close key, and check if returned values are correct */
|
/* Close key, and check if returned values are correct */
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
if (dwError != ERROR_SUCCESS || dwType != REG_DWORD || dwSize != sizeof(DWORD))
|
if (dwError != ERROR_SUCCESS || dwType != REG_DWORD || dwSize != sizeof(DWORD))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
TRACE("GetSetupType() returns %lu\n", dwSetupType);
|
TRACE("GetSetupType() returns %lu\n", dwSetupType);
|
||||||
return dwSetupType;
|
return dwSetupType;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DWORD WINAPI
|
|
||||||
RunSetupThreadProc(
|
static
|
||||||
IN LPVOID lpParameter)
|
DWORD
|
||||||
|
WINAPI
|
||||||
|
RunSetupThreadProc(IN LPVOID lpParameter)
|
||||||
{
|
{
|
||||||
PROCESS_INFORMATION ProcessInformation;
|
PROCESS_INFORMATION ProcessInformation;
|
||||||
STARTUPINFOW StartupInfo;
|
STARTUPINFOW StartupInfo;
|
||||||
WCHAR Shell[MAX_PATH];
|
WCHAR Shell[MAX_PATH];
|
||||||
WCHAR CommandLine[MAX_PATH];
|
WCHAR CommandLine[MAX_PATH];
|
||||||
BOOL Result;
|
BOOL Result;
|
||||||
DWORD dwError;
|
DWORD dwError;
|
||||||
HKEY hKey;
|
HKEY hKey;
|
||||||
DWORD dwType;
|
DWORD dwType;
|
||||||
DWORD dwSize;
|
DWORD dwSize;
|
||||||
DWORD dwExitCode;
|
DWORD dwExitCode;
|
||||||
|
|
||||||
TRACE("RunSetup() called\n");
|
TRACE("RunSetup() called\n");
|
||||||
|
|
||||||
/* Open key */
|
/* Open key */
|
||||||
dwError = RegOpenKeyExW(
|
dwError = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
||||||
HKEY_LOCAL_MACHINE,
|
L"SYSTEM\\Setup",
|
||||||
L"SYSTEM\\Setup",
|
0,
|
||||||
0,
|
KEY_QUERY_VALUE,
|
||||||
KEY_QUERY_VALUE,
|
&hKey);
|
||||||
&hKey);
|
if (dwError != ERROR_SUCCESS)
|
||||||
if (dwError != ERROR_SUCCESS)
|
return FALSE;
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
/* Read key */
|
/* Read key */
|
||||||
dwSize = (sizeof(Shell) / sizeof(Shell[0])) - 1;
|
dwSize = (sizeof(Shell) / sizeof(Shell[0])) - 1;
|
||||||
dwError = RegQueryValueExW(
|
dwError = RegQueryValueExW(hKey,
|
||||||
hKey,
|
L"CmdLine",
|
||||||
L"CmdLine",
|
NULL,
|
||||||
NULL,
|
&dwType,
|
||||||
&dwType,
|
(LPBYTE)Shell,
|
||||||
(LPBYTE)Shell,
|
&dwSize);
|
||||||
&dwSize);
|
RegCloseKey(hKey);
|
||||||
RegCloseKey(hKey);
|
if (dwError != ERROR_SUCCESS)
|
||||||
if (dwError != ERROR_SUCCESS)
|
return FALSE;
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
/* Finish string */
|
/* Finish string */
|
||||||
Shell[dwSize / sizeof(WCHAR)] = UNICODE_NULL;
|
Shell[dwSize / sizeof(WCHAR)] = UNICODE_NULL;
|
||||||
|
|
||||||
/* Expand string (if applicable) */
|
/* Expand string (if applicable) */
|
||||||
if (dwType == REG_EXPAND_SZ)
|
if (dwType == REG_EXPAND_SZ)
|
||||||
ExpandEnvironmentStringsW(Shell, CommandLine, MAX_PATH);
|
ExpandEnvironmentStringsW(Shell, CommandLine, MAX_PATH);
|
||||||
else if (dwType == REG_SZ)
|
else if (dwType == REG_SZ)
|
||||||
wcscpy(CommandLine, Shell);
|
wcscpy(CommandLine, Shell);
|
||||||
else
|
else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
TRACE("Should run '%s' now\n", debugstr_w(CommandLine));
|
TRACE("Should run '%s' now\n", debugstr_w(CommandLine));
|
||||||
|
|
||||||
/* Start process */
|
/* Start process */
|
||||||
StartupInfo.cb = sizeof(StartupInfo);
|
StartupInfo.cb = sizeof(StartupInfo);
|
||||||
StartupInfo.lpReserved = NULL;
|
StartupInfo.lpReserved = NULL;
|
||||||
StartupInfo.lpDesktop = NULL;
|
StartupInfo.lpDesktop = NULL;
|
||||||
StartupInfo.lpTitle = NULL;
|
StartupInfo.lpTitle = NULL;
|
||||||
StartupInfo.dwFlags = 0;
|
StartupInfo.dwFlags = 0;
|
||||||
StartupInfo.cbReserved2 = 0;
|
StartupInfo.cbReserved2 = 0;
|
||||||
StartupInfo.lpReserved2 = 0;
|
StartupInfo.lpReserved2 = 0;
|
||||||
Result = CreateProcessW(
|
|
||||||
NULL,
|
|
||||||
CommandLine,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
FALSE,
|
|
||||||
DETACHED_PROCESS,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
&StartupInfo,
|
|
||||||
&ProcessInformation);
|
|
||||||
if (!Result)
|
|
||||||
{
|
|
||||||
TRACE("Failed to run setup process\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Wait for process termination */
|
Result = CreateProcessW(NULL,
|
||||||
WaitForSingleObject(ProcessInformation.hProcess, INFINITE);
|
CommandLine,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
FALSE,
|
||||||
|
DETACHED_PROCESS,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
&StartupInfo,
|
||||||
|
&ProcessInformation);
|
||||||
|
if (!Result)
|
||||||
|
{
|
||||||
|
TRACE("Failed to run setup process\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
GetExitCodeProcess(ProcessInformation.hProcess, &dwExitCode);
|
/* Wait for process termination */
|
||||||
|
WaitForSingleObject(ProcessInformation.hProcess, INFINITE);
|
||||||
|
|
||||||
/* Close handles */
|
GetExitCodeProcess(ProcessInformation.hProcess, &dwExitCode);
|
||||||
CloseHandle(ProcessInformation.hThread);
|
|
||||||
CloseHandle(ProcessInformation.hProcess);
|
|
||||||
|
|
||||||
TRACE ("RunSetup() done\n");
|
/* Close handles */
|
||||||
|
CloseHandle(ProcessInformation.hThread);
|
||||||
|
CloseHandle(ProcessInformation.hProcess);
|
||||||
|
|
||||||
return TRUE;
|
TRACE ("RunSetup() done\n");
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
RunSetup(VOID)
|
RunSetup(VOID)
|
||||||
{
|
{
|
||||||
HANDLE hThread;
|
HANDLE hThread;
|
||||||
|
|
||||||
hThread = CreateThread(NULL, 0, RunSetupThreadProc, NULL, 0, NULL);
|
hThread = CreateThread(NULL,
|
||||||
return hThread != NULL;
|
0,
|
||||||
|
RunSetupThreadProc,
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
return hThread != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -21,96 +21,97 @@ PWLSESSION WLSession = NULL;
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
static BOOL
|
static
|
||||||
|
BOOL
|
||||||
StartServicesManager(VOID)
|
StartServicesManager(VOID)
|
||||||
{
|
{
|
||||||
STARTUPINFOW StartupInfo;
|
STARTUPINFOW StartupInfo;
|
||||||
PROCESS_INFORMATION ProcessInformation;
|
PROCESS_INFORMATION ProcessInformation;
|
||||||
LPCWSTR ServiceString = L"services.exe";
|
LPCWSTR ServiceString = L"services.exe";
|
||||||
BOOL res;
|
BOOL res;
|
||||||
|
|
||||||
/* Start the service control manager (services.exe) */
|
/* Start the service control manager (services.exe) */
|
||||||
ZeroMemory(&StartupInfo, sizeof(STARTUPINFOW));
|
ZeroMemory(&StartupInfo, sizeof(STARTUPINFOW));
|
||||||
StartupInfo.cb = sizeof(StartupInfo);
|
StartupInfo.cb = sizeof(StartupInfo);
|
||||||
StartupInfo.lpReserved = NULL;
|
StartupInfo.lpReserved = NULL;
|
||||||
StartupInfo.lpDesktop = NULL;
|
StartupInfo.lpDesktop = NULL;
|
||||||
StartupInfo.lpTitle = NULL;
|
StartupInfo.lpTitle = NULL;
|
||||||
StartupInfo.dwFlags = 0;
|
StartupInfo.dwFlags = 0;
|
||||||
StartupInfo.cbReserved2 = 0;
|
StartupInfo.cbReserved2 = 0;
|
||||||
StartupInfo.lpReserved2 = 0;
|
StartupInfo.lpReserved2 = 0;
|
||||||
|
|
||||||
TRACE("WL: Creating new process - %S\n", ServiceString);
|
TRACE("WL: Creating new process - %S\n", ServiceString);
|
||||||
|
|
||||||
res = CreateProcessW(
|
res = CreateProcessW(ServiceString,
|
||||||
ServiceString,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
FALSE,
|
||||||
FALSE,
|
DETACHED_PROCESS,
|
||||||
DETACHED_PROCESS,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
&StartupInfo,
|
||||||
&StartupInfo,
|
&ProcessInformation);
|
||||||
&ProcessInformation);
|
if (!res)
|
||||||
if (!res)
|
{
|
||||||
{
|
ERR("WL: Failed to execute services (error %lu)\n", GetLastError());
|
||||||
ERR("WL: Failed to execute services (error %lu)\n", GetLastError());
|
return FALSE;
|
||||||
return FALSE;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
TRACE("WL: Created new process - %S\n", ServiceString);
|
TRACE("WL: Created new process - %S\n", ServiceString);
|
||||||
|
|
||||||
CloseHandle(ProcessInformation.hThread);
|
CloseHandle(ProcessInformation.hThread);
|
||||||
CloseHandle(ProcessInformation.hProcess);
|
CloseHandle(ProcessInformation.hProcess);
|
||||||
|
|
||||||
TRACE("WL: StartServicesManager() done.\n");
|
TRACE("WL: StartServicesManager() done.\n");
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static BOOL
|
static
|
||||||
|
BOOL
|
||||||
StartLsass(VOID)
|
StartLsass(VOID)
|
||||||
{
|
{
|
||||||
STARTUPINFOW StartupInfo;
|
STARTUPINFOW StartupInfo;
|
||||||
PROCESS_INFORMATION ProcessInformation;
|
PROCESS_INFORMATION ProcessInformation;
|
||||||
LPCWSTR ServiceString = L"lsass.exe";
|
LPCWSTR ServiceString = L"lsass.exe";
|
||||||
BOOL res;
|
BOOL res;
|
||||||
|
|
||||||
/* Start the local security authority subsystem (lsass.exe) */
|
/* Start the local security authority subsystem (lsass.exe) */
|
||||||
ZeroMemory(&StartupInfo, sizeof(STARTUPINFOW));
|
ZeroMemory(&StartupInfo, sizeof(STARTUPINFOW));
|
||||||
StartupInfo.cb = sizeof(StartupInfo);
|
StartupInfo.cb = sizeof(StartupInfo);
|
||||||
StartupInfo.lpReserved = NULL;
|
StartupInfo.lpReserved = NULL;
|
||||||
StartupInfo.lpDesktop = NULL;
|
StartupInfo.lpDesktop = NULL;
|
||||||
StartupInfo.lpTitle = NULL;
|
StartupInfo.lpTitle = NULL;
|
||||||
StartupInfo.dwFlags = 0;
|
StartupInfo.dwFlags = 0;
|
||||||
StartupInfo.cbReserved2 = 0;
|
StartupInfo.cbReserved2 = 0;
|
||||||
StartupInfo.lpReserved2 = 0;
|
StartupInfo.lpReserved2 = 0;
|
||||||
|
|
||||||
TRACE("WL: Creating new process - %S\n", ServiceString);
|
TRACE("WL: Creating new process - %S\n", ServiceString);
|
||||||
|
|
||||||
res = CreateProcessW(
|
res = CreateProcessW(ServiceString,
|
||||||
ServiceString,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
FALSE,
|
||||||
FALSE,
|
DETACHED_PROCESS,
|
||||||
DETACHED_PROCESS,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
&StartupInfo,
|
||||||
&StartupInfo,
|
&ProcessInformation);
|
||||||
&ProcessInformation);
|
|
||||||
|
|
||||||
TRACE("WL: Created new process - %S\n", ServiceString);
|
TRACE("WL: Created new process - %S\n", ServiceString);
|
||||||
|
|
||||||
CloseHandle(ProcessInformation.hThread);
|
CloseHandle(ProcessInformation.hThread);
|
||||||
CloseHandle(ProcessInformation.hProcess);
|
CloseHandle(ProcessInformation.hProcess);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static VOID
|
static
|
||||||
|
VOID
|
||||||
WaitForLsass(VOID)
|
WaitForLsass(VOID)
|
||||||
{
|
{
|
||||||
HANDLE hEvent;
|
HANDLE hEvent;
|
||||||
|
@ -146,18 +147,19 @@ WaitForLsass(VOID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static BOOL
|
static
|
||||||
InitKeyboardLayouts()
|
BOOL
|
||||||
|
InitKeyboardLayouts(VOID)
|
||||||
{
|
{
|
||||||
WCHAR wszKeyName[12], wszKLID[10];
|
WCHAR wszKeyName[12], wszKLID[10];
|
||||||
DWORD dwSize = sizeof(wszKLID), dwType, i = 1;
|
DWORD dwSize = sizeof(wszKLID), dwType, i = 1;
|
||||||
HKEY hKey;
|
HKEY hKey;
|
||||||
UINT Flags;
|
UINT Flags;
|
||||||
BOOL bRet = FALSE;
|
BOOL bRet = FALSE;
|
||||||
|
|
||||||
/* Open registry key with preloaded layouts */
|
/* Open registry key with preloaded layouts */
|
||||||
if (RegOpenKeyExW(HKEY_CURRENT_USER, L"Keyboard Layout\\Preload", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
|
if (RegOpenKeyExW(HKEY_CURRENT_USER, L"Keyboard Layout\\Preload", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
while(TRUE)
|
while(TRUE)
|
||||||
{
|
{
|
||||||
/* Read values with integer names only */
|
/* Read values with integer names only */
|
||||||
|
@ -195,9 +197,9 @@ InitKeyboardLayouts()
|
||||||
|
|
||||||
/* Close the key now */
|
/* Close the key now */
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
WARN("RegOpenKeyExW(Keyboard Layout\\Preload) failed!\n");
|
WARN("RegOpenKeyExW(Keyboard Layout\\Preload) failed!\n");
|
||||||
|
|
||||||
if (!bRet)
|
if (!bRet)
|
||||||
{
|
{
|
||||||
|
@ -211,234 +213,242 @@ InitKeyboardLayouts()
|
||||||
|
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
DisplayStatusMessage(
|
DisplayStatusMessage(IN PWLSESSION Session,
|
||||||
IN PWLSESSION Session,
|
IN HDESK hDesktop,
|
||||||
IN HDESK hDesktop,
|
IN UINT ResourceId)
|
||||||
IN UINT ResourceId)
|
|
||||||
{
|
{
|
||||||
WCHAR StatusMsg[MAX_PATH];
|
WCHAR StatusMsg[MAX_PATH];
|
||||||
|
|
||||||
if (Session->Gina.Version < WLX_VERSION_1_3)
|
if (Session->Gina.Version < WLX_VERSION_1_3)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if (Session->SuppressStatus)
|
if (Session->SuppressStatus)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if (LoadStringW(hAppInstance, ResourceId, StatusMsg, MAX_PATH) == 0)
|
if (LoadStringW(hAppInstance, ResourceId, StatusMsg, MAX_PATH) == 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return Session->Gina.Functions.WlxDisplayStatusMessage(Session->Gina.Context, hDesktop, 0, NULL, StatusMsg);
|
return Session->Gina.Functions.WlxDisplayStatusMessage(Session->Gina.Context, hDesktop, 0, NULL, StatusMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
RemoveStatusMessage(
|
RemoveStatusMessage(IN PWLSESSION Session)
|
||||||
IN PWLSESSION Session)
|
|
||||||
{
|
{
|
||||||
if (Session->Gina.Version < WLX_VERSION_1_3)
|
if (Session->Gina.Version < WLX_VERSION_1_3)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
return Session->Gina.Functions.WlxRemoveStatusMessage(Session->Gina.Context);
|
return Session->Gina.Functions.WlxRemoveStatusMessage(Session->Gina.Context);
|
||||||
}
|
}
|
||||||
|
|
||||||
static INT_PTR CALLBACK
|
|
||||||
GinaLoadFailedWindowProc(
|
static
|
||||||
IN HWND hwndDlg,
|
INT_PTR
|
||||||
IN UINT uMsg,
|
CALLBACK
|
||||||
IN WPARAM wParam,
|
GinaLoadFailedWindowProc(IN HWND hwndDlg,
|
||||||
IN LPARAM lParam)
|
IN UINT uMsg,
|
||||||
|
IN WPARAM wParam,
|
||||||
|
IN LPARAM lParam)
|
||||||
{
|
{
|
||||||
switch (uMsg)
|
switch (uMsg)
|
||||||
{
|
{
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
{
|
{
|
||||||
switch (LOWORD(wParam))
|
switch (LOWORD(wParam))
|
||||||
{
|
{
|
||||||
case IDOK:
|
case IDOK:
|
||||||
EndDialog(hwndDlg, IDOK);
|
EndDialog(hwndDlg, IDOK);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case WM_INITDIALOG:
|
|
||||||
{
|
|
||||||
int len;
|
|
||||||
WCHAR templateText[MAX_PATH], text[MAX_PATH];
|
|
||||||
|
|
||||||
len = GetDlgItemTextW(hwndDlg, IDC_GINALOADFAILED, templateText, MAX_PATH);
|
case WM_INITDIALOG:
|
||||||
if (len)
|
{
|
||||||
{
|
int len;
|
||||||
wsprintfW(text, templateText, (LPWSTR)lParam);
|
WCHAR templateText[MAX_PATH], text[MAX_PATH];
|
||||||
SetDlgItemTextW(hwndDlg, IDC_GINALOADFAILED, text);
|
|
||||||
}
|
|
||||||
SetFocus(GetDlgItem(hwndDlg, IDOK));
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
case WM_CLOSE:
|
|
||||||
{
|
|
||||||
EndDialog(hwndDlg, IDCANCEL);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return FALSE;
|
len = GetDlgItemTextW(hwndDlg, IDC_GINALOADFAILED, templateText, MAX_PATH);
|
||||||
|
if (len)
|
||||||
|
{
|
||||||
|
wsprintfW(text, templateText, (LPWSTR)lParam);
|
||||||
|
SetDlgItemTextW(hwndDlg, IDC_GINALOADFAILED, text);
|
||||||
|
}
|
||||||
|
|
||||||
|
SetFocus(GetDlgItem(hwndDlg, IDOK));
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
case WM_CLOSE:
|
||||||
|
{
|
||||||
|
EndDialog(hwndDlg, IDCANCEL);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int WINAPI
|
|
||||||
WinMain(
|
int
|
||||||
IN HINSTANCE hInstance,
|
WINAPI
|
||||||
IN HINSTANCE hPrevInstance,
|
WinMain(IN HINSTANCE hInstance,
|
||||||
IN LPSTR lpCmdLine,
|
IN HINSTANCE hPrevInstance,
|
||||||
IN int nShowCmd)
|
IN LPSTR lpCmdLine,
|
||||||
|
IN int nShowCmd)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
LSA_STRING ProcessName, PackageName;
|
LSA_STRING ProcessName, PackageName;
|
||||||
HANDLE LsaHandle;
|
HANDLE LsaHandle;
|
||||||
LSA_OPERATIONAL_MODE Mode;
|
LSA_OPERATIONAL_MODE Mode;
|
||||||
BOOLEAN Old;
|
BOOLEAN Old;
|
||||||
ULONG AuthenticationPackage;
|
ULONG AuthenticationPackage;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
#endif
|
#endif
|
||||||
ULONG HardErrorResponse;
|
ULONG HardErrorResponse;
|
||||||
MSG Msg;
|
MSG Msg;
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER(hPrevInstance);
|
UNREFERENCED_PARAMETER(hPrevInstance);
|
||||||
UNREFERENCED_PARAMETER(lpCmdLine);
|
UNREFERENCED_PARAMETER(lpCmdLine);
|
||||||
UNREFERENCED_PARAMETER(nShowCmd);
|
UNREFERENCED_PARAMETER(nShowCmd);
|
||||||
|
|
||||||
hAppInstance = hInstance;
|
hAppInstance = hInstance;
|
||||||
|
|
||||||
if (!RegisterLogonProcess(GetCurrentProcessId(), TRUE))
|
if (!RegisterLogonProcess(GetCurrentProcessId(), TRUE))
|
||||||
{
|
{
|
||||||
ERR("WL: Could not register logon process\n");
|
ERR("WL: Could not register logon process\n");
|
||||||
NtShutdownSystem(ShutdownNoReboot);
|
NtShutdownSystem(ShutdownNoReboot);
|
||||||
ExitProcess(0);
|
ExitProcess(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
WLSession = (PWLSESSION)HeapAlloc(GetProcessHeap(), 0, sizeof(WLSESSION));
|
WLSession = (PWLSESSION)HeapAlloc(GetProcessHeap(), 0, sizeof(WLSESSION));
|
||||||
if (!WLSession)
|
if (!WLSession)
|
||||||
{
|
{
|
||||||
ERR("WL: Could not allocate memory for winlogon instance\n");
|
ERR("WL: Could not allocate memory for winlogon instance\n");
|
||||||
NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED, 0, 0, NULL, OptionOk, &HardErrorResponse);
|
NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED, 0, 0, NULL, OptionOk, &HardErrorResponse);
|
||||||
ExitProcess(1);
|
ExitProcess(1);
|
||||||
}
|
}
|
||||||
ZeroMemory(WLSession, sizeof(WLSESSION));
|
|
||||||
WLSession->DialogTimeout = 120; /* 2 minutes */
|
|
||||||
|
|
||||||
if (!CreateWindowStationAndDesktops(WLSession))
|
ZeroMemory(WLSession, sizeof(WLSESSION));
|
||||||
{
|
WLSession->DialogTimeout = 120; /* 2 minutes */
|
||||||
ERR("WL: Could not create window station and desktops\n");
|
|
||||||
NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED, 0, 0, NULL, OptionOk, &HardErrorResponse);
|
if (!CreateWindowStationAndDesktops(WLSession))
|
||||||
ExitProcess(1);
|
{
|
||||||
}
|
ERR("WL: Could not create window station and desktops\n");
|
||||||
LockWorkstation(WLSession);
|
NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED, 0, 0, NULL, OptionOk, &HardErrorResponse);
|
||||||
|
ExitProcess(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
LockWorkstation(WLSession);
|
||||||
|
|
||||||
/* Load default keyboard layouts */
|
/* Load default keyboard layouts */
|
||||||
if (!InitKeyboardLayouts())
|
if (!InitKeyboardLayouts())
|
||||||
{
|
{
|
||||||
ERR("WL: Could not preload keyboard layouts\n");
|
ERR("WL: Could not preload keyboard layouts\n");
|
||||||
NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED, 0, 0, NULL, OptionOk, &HardErrorResponse);
|
NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED, 0, 0, NULL, OptionOk, &HardErrorResponse);
|
||||||
ExitProcess(1);
|
ExitProcess(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!StartServicesManager())
|
if (!StartServicesManager())
|
||||||
{
|
{
|
||||||
ERR("WL: Could not start services.exe\n");
|
ERR("WL: Could not start services.exe\n");
|
||||||
NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED, 0, 0, NULL, OptionOk, &HardErrorResponse);
|
NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED, 0, 0, NULL, OptionOk, &HardErrorResponse);
|
||||||
ExitProcess(1);
|
ExitProcess(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!StartLsass())
|
if (!StartLsass())
|
||||||
{
|
{
|
||||||
ERR("WL: Failed to start lsass.exe service (error %lu)\n", GetLastError());
|
ERR("WL: Failed to start lsass.exe service (error %lu)\n", GetLastError());
|
||||||
NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED, 0, 0, 0, OptionOk, &HardErrorResponse);
|
NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED, 0, 0, 0, OptionOk, &HardErrorResponse);
|
||||||
ExitProcess(1);
|
ExitProcess(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Load and initialize gina */
|
/* Load and initialize gina */
|
||||||
if (!GinaInit(WLSession))
|
if (!GinaInit(WLSession))
|
||||||
{
|
{
|
||||||
ERR("WL: Failed to initialize Gina\n");
|
ERR("WL: Failed to initialize Gina\n");
|
||||||
DialogBoxParam(hAppInstance, MAKEINTRESOURCE(IDD_GINALOADFAILED), GetDesktopWindow(), GinaLoadFailedWindowProc, (LPARAM)L"");
|
DialogBoxParam(hAppInstance, MAKEINTRESOURCE(IDD_GINALOADFAILED), GetDesktopWindow(), GinaLoadFailedWindowProc, (LPARAM)L"");
|
||||||
HandleShutdown(WLSession, WLX_SAS_ACTION_SHUTDOWN_REBOOT);
|
HandleShutdown(WLSession, WLX_SAS_ACTION_SHUTDOWN_REBOOT);
|
||||||
ExitProcess(1);
|
ExitProcess(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
DisplayStatusMessage(WLSession, WLSession->WinlogonDesktop, IDS_REACTOSISSTARTINGUP);
|
DisplayStatusMessage(WLSession, WLSession->WinlogonDesktop, IDS_REACTOSISSTARTINGUP);
|
||||||
|
|
||||||
|
/* Wait for the LSA server */
|
||||||
/* Wait for the LSA server */
|
WaitForLsass();
|
||||||
WaitForLsass();
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* Connect to NetLogon service (lsass.exe) */
|
/* Connect to NetLogon service (lsass.exe) */
|
||||||
/* Real winlogon uses "Winlogon" */
|
/* Real winlogon uses "Winlogon" */
|
||||||
RtlInitUnicodeString((PUNICODE_STRING)&ProcessName, L"Winlogon");
|
RtlInitUnicodeString((PUNICODE_STRING)&ProcessName, L"Winlogon");
|
||||||
Status = LsaRegisterLogonProcess(&ProcessName, &LsaHandle, &Mode);
|
Status = LsaRegisterLogonProcess(&ProcessName, &LsaHandle, &Mode);
|
||||||
if (Status == STATUS_PORT_CONNECTION_REFUSED)
|
if (Status == STATUS_PORT_CONNECTION_REFUSED)
|
||||||
{
|
{
|
||||||
/* Add the 'SeTcbPrivilege' privilege and try again */
|
/* Add the 'SeTcbPrivilege' privilege and try again */
|
||||||
Status = RtlAdjustPrivilege(SE_TCB_PRIVILEGE, TRUE, TRUE, &Old);
|
Status = RtlAdjustPrivilege(SE_TCB_PRIVILEGE, TRUE, TRUE, &Old);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
ERR("RtlAdjustPrivilege() failed with error %lu\n", LsaNtStatusToWinError(Status));
|
ERR("RtlAdjustPrivilege() failed with error %lu\n", LsaNtStatusToWinError(Status));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
Status = LsaRegisterLogonProcess(&ProcessName, &LsaHandle, &Mode);
|
|
||||||
}
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
ERR("LsaRegisterLogonProcess() failed with error %lu\n", LsaNtStatusToWinError(Status));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
RtlInitUnicodeString((PUNICODE_STRING)&PackageName, MICROSOFT_KERBEROS_NAME_W);
|
Status = LsaRegisterLogonProcess(&ProcessName, &LsaHandle, &Mode);
|
||||||
Status = LsaLookupAuthenticationPackage(LsaHandle, &PackageName, &AuthenticationPackage);
|
}
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
if (!NT_SUCCESS(Status))
|
||||||
ERR("LsaLookupAuthenticationPackage() failed with error %lu\n", LsaNtStatusToWinError(Status));
|
{
|
||||||
LsaDeregisterLogonProcess(LsaHandle);
|
ERR("LsaRegisterLogonProcess() failed with error %lu\n", LsaNtStatusToWinError(Status));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RtlInitUnicodeString((PUNICODE_STRING)&PackageName, MICROSOFT_KERBEROS_NAME_W);
|
||||||
|
Status = LsaLookupAuthenticationPackage(LsaHandle, &PackageName, &AuthenticationPackage);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
ERR("LsaLookupAuthenticationPackage() failed with error %lu\n", LsaNtStatusToWinError(Status));
|
||||||
|
LsaDeregisterLogonProcess(LsaHandle);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Create a hidden window to get SAS notifications */
|
/* Create a hidden window to get SAS notifications */
|
||||||
if (!InitializeSAS(WLSession))
|
if (!InitializeSAS(WLSession))
|
||||||
{
|
{
|
||||||
ERR("WL: Failed to initialize SAS\n");
|
ERR("WL: Failed to initialize SAS\n");
|
||||||
ExitProcess(2);
|
ExitProcess(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
//DisplayStatusMessage(Session, Session->WinlogonDesktop, IDS_PREPARENETWORKCONNECTIONS);
|
//DisplayStatusMessage(Session, Session->WinlogonDesktop, IDS_PREPARENETWORKCONNECTIONS);
|
||||||
//DisplayStatusMessage(Session, Session->WinlogonDesktop, IDS_APPLYINGCOMPUTERSETTINGS);
|
//DisplayStatusMessage(Session, Session->WinlogonDesktop, IDS_APPLYINGCOMPUTERSETTINGS);
|
||||||
|
|
||||||
/* Display logged out screen */
|
/* Display logged out screen */
|
||||||
WLSession->LogonState = STATE_LOGGED_OFF;
|
WLSession->LogonState = STATE_LOGGED_OFF;
|
||||||
RemoveStatusMessage(WLSession);
|
RemoveStatusMessage(WLSession);
|
||||||
|
|
||||||
/* Check for pending setup */
|
/* Check for pending setup */
|
||||||
if (GetSetupType() != 0)
|
if (GetSetupType() != 0)
|
||||||
{
|
{
|
||||||
TRACE("WL: Setup mode detected\n");
|
TRACE("WL: Setup mode detected\n");
|
||||||
|
|
||||||
/* Run setup and reboot when done */
|
/* Run setup and reboot when done */
|
||||||
SwitchDesktop(WLSession->ApplicationDesktop);
|
SwitchDesktop(WLSession->ApplicationDesktop);
|
||||||
RunSetup();
|
RunSetup();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
PostMessageW(WLSession->SASWindow, WLX_WM_SAS, WLX_SAS_TYPE_TIMEOUT, 0);
|
PostMessageW(WLSession->SASWindow, WLX_WM_SAS, WLX_SAS_TYPE_TIMEOUT, 0);
|
||||||
|
|
||||||
/* Tell kernel that CurrentControlSet is good (needed
|
/* Tell kernel that CurrentControlSet is good (needed
|
||||||
* to support Last good known configuration boot) */
|
* to support Last good known configuration boot) */
|
||||||
NtInitializeRegistry(CM_BOOT_FLAG_ACCEPTED | 1);
|
NtInitializeRegistry(CM_BOOT_FLAG_ACCEPTED | 1);
|
||||||
|
|
||||||
/* Message loop for the SAS window */
|
/* Message loop for the SAS window */
|
||||||
while (GetMessageW(&Msg, WLSession->SASWindow, 0, 0))
|
while (GetMessageW(&Msg, WLSession->SASWindow, 0, 0))
|
||||||
{
|
{
|
||||||
TranslateMessage(&Msg);
|
TranslateMessage(&Msg);
|
||||||
DispatchMessageW(&Msg);
|
DispatchMessageW(&Msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We never go there */
|
/* We never go there */
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,44 +79,44 @@ typedef BOOL (WINAPI * PFWLXREMOVESTATUSMESSAGE) (PVOID);
|
||||||
|
|
||||||
typedef struct _GINAFUNCTIONS
|
typedef struct _GINAFUNCTIONS
|
||||||
{
|
{
|
||||||
/* Functions always available for a valid GINA */
|
/* Functions always available for a valid GINA */
|
||||||
PFWLXNEGOTIATE WlxNegotiate; /* optional */
|
PFWLXNEGOTIATE WlxNegotiate; /* optional */
|
||||||
PFWLXINITIALIZE WlxInitialize;
|
PFWLXINITIALIZE WlxInitialize;
|
||||||
|
|
||||||
/* Functions available if WlxVersion >= WLX_VERSION_1_0 (MS Windows 3.5.0) */
|
/* Functions available if WlxVersion >= WLX_VERSION_1_0 (MS Windows 3.5.0) */
|
||||||
PFWLXDISPLAYSASNOTICE WlxDisplaySASNotice;
|
PFWLXDISPLAYSASNOTICE WlxDisplaySASNotice;
|
||||||
PFWLXLOGGEDOUTSAS WlxLoggedOutSAS;
|
PFWLXLOGGEDOUTSAS WlxLoggedOutSAS;
|
||||||
PFWLXACTIVATEUSERSHELL WlxActivateUserShell;
|
PFWLXACTIVATEUSERSHELL WlxActivateUserShell;
|
||||||
PFWLXLOGGEDONSAS WlxLoggedOnSAS;
|
PFWLXLOGGEDONSAS WlxLoggedOnSAS;
|
||||||
PFWLXDISPLAYLOCKEDNOTICE WlxDisplayLockedNotice;
|
PFWLXDISPLAYLOCKEDNOTICE WlxDisplayLockedNotice;
|
||||||
PFWLXWKSTALOCKEDSAS WlxWkstaLockedSAS;
|
PFWLXWKSTALOCKEDSAS WlxWkstaLockedSAS;
|
||||||
PFWLXISLOCKOK WlxIsLockOk;
|
PFWLXISLOCKOK WlxIsLockOk;
|
||||||
PFWLXISLOGOFFOK WlxIsLogoffOk;
|
PFWLXISLOGOFFOK WlxIsLogoffOk;
|
||||||
PFWLXLOGOFF WlxLogoff;
|
PFWLXLOGOFF WlxLogoff;
|
||||||
PFWLXSHUTDOWN WlxShutdown;
|
PFWLXSHUTDOWN WlxShutdown;
|
||||||
|
|
||||||
/* Functions available if WlxVersion >= WLX_VERSION_1_1 (MS Windows 3.5.1) */
|
/* Functions available if WlxVersion >= WLX_VERSION_1_1 (MS Windows 3.5.1) */
|
||||||
PFWLXSCREENSAVERNOTIFY WlxScreenSaverNotify; /* optional */
|
PFWLXSCREENSAVERNOTIFY WlxScreenSaverNotify; /* optional */
|
||||||
PFWLXSTARTAPPLICATION WlxStartApplication; /* optional */
|
PFWLXSTARTAPPLICATION WlxStartApplication; /* optional */
|
||||||
|
|
||||||
/* Functions available if WlxVersion >= WLX_VERSION_1_2 (MS Windows NT 4.0) */
|
/* Functions available if WlxVersion >= WLX_VERSION_1_2 (MS Windows NT 4.0) */
|
||||||
|
|
||||||
/* Functions available if WlxVersion >= WLX_VERSION_1_3 (MS Windows 2000) */
|
/* Functions available if WlxVersion >= WLX_VERSION_1_3 (MS Windows 2000) */
|
||||||
PFWLXNETWORKPROVIDERLOAD WlxNetworkProviderLoad; /* not called ATM */
|
PFWLXNETWORKPROVIDERLOAD WlxNetworkProviderLoad; /* not called ATM */
|
||||||
PFWLXDISPLAYSTATUSMESSAGE WlxDisplayStatusMessage;
|
PFWLXDISPLAYSTATUSMESSAGE WlxDisplayStatusMessage;
|
||||||
PFWLXGETSTATUSMESSAGE WlxGetStatusMessage; /* doesn't need to be called */
|
PFWLXGETSTATUSMESSAGE WlxGetStatusMessage; /* doesn't need to be called */
|
||||||
PFWLXREMOVESTATUSMESSAGE WlxRemoveStatusMessage;
|
PFWLXREMOVESTATUSMESSAGE WlxRemoveStatusMessage;
|
||||||
|
|
||||||
/* Functions available if WlxVersion >= WLX_VERSION_1_4 (MS Windows XP) */
|
/* Functions available if WlxVersion >= WLX_VERSION_1_4 (MS Windows XP) */
|
||||||
} GINAFUNCTIONS, *PGINAFUNCTIONS;
|
} GINAFUNCTIONS, *PGINAFUNCTIONS;
|
||||||
|
|
||||||
typedef struct _GINAINSTANCE
|
typedef struct _GINAINSTANCE
|
||||||
{
|
{
|
||||||
HMODULE hDllInstance;
|
HMODULE hDllInstance;
|
||||||
GINAFUNCTIONS Functions;
|
GINAFUNCTIONS Functions;
|
||||||
PVOID Context;
|
PVOID Context;
|
||||||
DWORD Version;
|
DWORD Version;
|
||||||
BOOL UseCtrlAltDelete;
|
BOOL UseCtrlAltDelete;
|
||||||
} GINAINSTANCE, *PGINAINSTANCE;
|
} GINAINSTANCE, *PGINAINSTANCE;
|
||||||
|
|
||||||
|
|
||||||
|
@ -206,39 +206,39 @@ typedef enum _LOGON_STATE
|
||||||
|
|
||||||
typedef struct _WLSESSION
|
typedef struct _WLSESSION
|
||||||
{
|
{
|
||||||
GINAINSTANCE Gina;
|
GINAINSTANCE Gina;
|
||||||
DWORD SASAction;
|
DWORD SASAction;
|
||||||
BOOL SuppressStatus;
|
BOOL SuppressStatus;
|
||||||
BOOL TaskManHotkey;
|
BOOL TaskManHotkey;
|
||||||
HWND SASWindow;
|
HWND SASWindow;
|
||||||
HWINSTA InteractiveWindowStation;
|
HWINSTA InteractiveWindowStation;
|
||||||
LPWSTR InteractiveWindowStationName;
|
LPWSTR InteractiveWindowStationName;
|
||||||
HDESK ApplicationDesktop;
|
HDESK ApplicationDesktop;
|
||||||
HDESK WinlogonDesktop;
|
HDESK WinlogonDesktop;
|
||||||
HDESK ScreenSaverDesktop;
|
HDESK ScreenSaverDesktop;
|
||||||
LUID LogonId;
|
LUID LogonId;
|
||||||
HANDLE UserToken;
|
HANDLE UserToken;
|
||||||
HANDLE hProfileInfo;
|
HANDLE hProfileInfo;
|
||||||
LOGON_STATE LogonState;
|
LOGON_STATE LogonState;
|
||||||
DWORD DialogTimeout; /* Timeout for dialog boxes, in seconds */
|
DWORD DialogTimeout; /* Timeout for dialog boxes, in seconds */
|
||||||
|
|
||||||
/* Screen-saver informations */
|
/* Screen-saver informations */
|
||||||
#ifndef USE_GETLASTINPUTINFO
|
#ifndef USE_GETLASTINPUTINFO
|
||||||
HHOOK KeyboardHook;
|
HHOOK KeyboardHook;
|
||||||
HHOOK MouseHook;
|
HHOOK MouseHook;
|
||||||
#endif
|
#endif
|
||||||
HANDLE hEndOfScreenSaverThread;
|
HANDLE hEndOfScreenSaverThread;
|
||||||
HANDLE hScreenSaverParametersChanged;
|
HANDLE hScreenSaverParametersChanged;
|
||||||
HANDLE hUserActivity;
|
HANDLE hUserActivity;
|
||||||
HANDLE hEndOfScreenSaver;
|
HANDLE hEndOfScreenSaver;
|
||||||
#ifndef USE_GETLASTINPUTINFO
|
#ifndef USE_GETLASTINPUTINFO
|
||||||
DWORD LastActivity;
|
DWORD LastActivity;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Logon informations */
|
/* Logon informations */
|
||||||
DWORD Options;
|
DWORD Options;
|
||||||
WLX_MPR_NOTIFY_INFO MprNotifyInfo;
|
WLX_MPR_NOTIFY_INFO MprNotifyInfo;
|
||||||
WLX_PROFILE_V2_0 *Profile;
|
WLX_PROFILE_V2_0 *Profile;
|
||||||
} WLSESSION, *PWLSESSION;
|
} WLSESSION, *PWLSESSION;
|
||||||
|
|
||||||
extern HINSTANCE hAppInstance;
|
extern HINSTANCE hAppInstance;
|
||||||
|
@ -262,52 +262,43 @@ CreateUserEnvironment(IN PWLSESSION Session);
|
||||||
|
|
||||||
/* sas.c */
|
/* sas.c */
|
||||||
BOOL
|
BOOL
|
||||||
SetDefaultLanguage(
|
SetDefaultLanguage(IN BOOL UserProfile);
|
||||||
IN BOOL UserProfile);
|
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
InitializeSAS(
|
InitializeSAS(IN OUT PWLSESSION Session);
|
||||||
IN OUT PWLSESSION Session);
|
|
||||||
|
|
||||||
/* screensaver.c */
|
/* screensaver.c */
|
||||||
BOOL
|
BOOL
|
||||||
InitializeScreenSaver(
|
InitializeScreenSaver(IN OUT PWLSESSION Session);
|
||||||
IN OUT PWLSESSION Session);
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
StartScreenSaver(
|
StartScreenSaver(IN PWLSESSION Session);
|
||||||
IN PWLSESSION Session);
|
|
||||||
|
|
||||||
/* winlogon.c */
|
/* winlogon.c */
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
PlaySoundRoutine(
|
PlaySoundRoutine(IN LPCWSTR FileName,
|
||||||
IN LPCWSTR FileName,
|
IN UINT Logon,
|
||||||
IN UINT Logon,
|
IN UINT Flags);
|
||||||
IN UINT Flags);
|
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
DisplayStatusMessage(
|
DisplayStatusMessage(IN PWLSESSION Session,
|
||||||
IN PWLSESSION Session,
|
IN HDESK hDesktop,
|
||||||
IN HDESK hDesktop,
|
IN UINT ResourceId);
|
||||||
IN UINT ResourceId);
|
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
RemoveStatusMessage(
|
RemoveStatusMessage(IN PWLSESSION Session);
|
||||||
IN PWLSESSION Session);
|
|
||||||
|
|
||||||
/* wlx.c */
|
/* wlx.c */
|
||||||
BOOL
|
BOOL
|
||||||
GinaInit(
|
GinaInit(IN OUT PWLSESSION Session);
|
||||||
IN OUT PWLSESSION Session);
|
|
||||||
BOOL
|
BOOL
|
||||||
CreateWindowStationAndDesktops(
|
CreateWindowStationAndDesktops(IN OUT PWLSESSION Session);
|
||||||
IN OUT PWLSESSION Session);
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
HandleShutdown(
|
HandleShutdown(IN OUT PWLSESSION Session,
|
||||||
IN OUT PWLSESSION Session,
|
IN DWORD wlxAction);
|
||||||
IN DWORD wlxAction);
|
|
||||||
|
|
||||||
VOID WINAPI WlxUseCtrlAltDel(HANDLE hWlx);
|
VOID WINAPI WlxUseCtrlAltDel(HANDLE hWlx);
|
||||||
VOID WINAPI WlxSetContextPointer(HANDLE hWlx, PVOID pWlxContext);
|
VOID WINAPI WlxSetContextPointer(HANDLE hWlx, PVOID pWlxContext);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue