3 * Copyright (C) 2003-2004, 2006 ReactOS Team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 * PROJECT: ReactOS msgina.dll
21 * FILE: dll/win32/msgina/msgina.c
22 * PURPOSE: ReactOS Logon GINA DLL
23 * PROGRAMMER: Thomas Weidenmueller (w3seek@users.sourceforge.net)
24 * Hervé Poussineau (hpoussin@reactos.org)
29 HINSTANCE hDllInstance
;
31 extern GINA_UI GinaGraphicalUI
;
32 extern GINA_UI GinaTextUI
;
33 static PGINA_UI pGinaUI
;
34 static SID_IDENTIFIER_AUTHORITY SystemAuthority
= {SECURITY_NT_AUTHORITY
};
42 IN DWORD dwWinlogonVersion
,
43 OUT PDWORD pdwDllVersion
)
45 TRACE("WlxNegotiate(%lx, %p)\n", dwWinlogonVersion
, pdwDllVersion
);
47 if(!pdwDllVersion
|| (dwWinlogonVersion
< WLX_VERSION_1_3
))
50 *pdwDllVersion
= WLX_VERSION_1_3
;
67 return ERROR_INVALID_PARAMETER
;
70 rc
= RegQueryValueExW(hKey
, pszKey
, NULL
, &dwType
, NULL
, &cbData
);
71 if (rc
!= ERROR_SUCCESS
)
74 return ERROR_FILE_NOT_FOUND
;
75 Value
= HeapAlloc(GetProcessHeap(), 0, cbData
+ sizeof(WCHAR
));
77 return ERROR_NOT_ENOUGH_MEMORY
;
78 rc
= RegQueryValueExW(hKey
, pszKey
, NULL
, NULL
, (LPBYTE
)Value
, &cbData
);
79 if (rc
!= ERROR_SUCCESS
)
81 HeapFree(GetProcessHeap(), 0, Value
);
84 /* NULL-terminate the string */
85 Value
[cbData
/ sizeof(WCHAR
)] = '\0';
103 return ERROR_INVALID_PARAMETER
;
105 cbData
= sizeof(DWORD
);
106 rc
= RegQueryValueExW(hKey
, pszKey
, NULL
, &dwType
, (LPBYTE
)&dwValue
, &cbData
);
107 if (rc
== ERROR_SUCCESS
&& dwType
== REG_DWORD
)
110 return ERROR_SUCCESS
;
116 HKEY ControlKey
= NULL
;
117 LPWSTR SystemStartOptions
= NULL
;
118 LPWSTR CurrentOption
, NextOption
; /* Pointers into SystemStartOptions */
119 BOOL ConsoleBoot
= FALSE
;
124 L
"SYSTEM\\CurrentControlSet\\Control",
129 rc
= ReadRegSzKey(ControlKey
, L
"SystemStartOptions", &SystemStartOptions
);
130 if (rc
!= ERROR_SUCCESS
)
133 /* Check for CONSOLE switch in SystemStartOptions */
134 CurrentOption
= SystemStartOptions
;
135 while (CurrentOption
)
137 NextOption
= wcschr(CurrentOption
, L
' ');
140 if (wcsicmp(CurrentOption
, L
"CONSOLE") == 0)
142 TRACE("Found %S. Switching to console boot\n", CurrentOption
);
146 CurrentOption
= NextOption
? NextOption
+ 1 : NULL
;
151 pGinaUI
= &GinaTextUI
;
153 pGinaUI
= &GinaGraphicalUI
;
155 if (ControlKey
!= NULL
)
156 RegCloseKey(ControlKey
);
157 HeapFree(GetProcessHeap(), 0, SystemStartOptions
);
163 GetRegistrySettings(PGINA_CONTEXT pgContext
)
166 LPWSTR lpAutoAdminLogon
= NULL
;
167 LPWSTR lpDontDisplayLastUserName
= NULL
;
168 LPWSTR lpShutdownWithoutLogon
= NULL
;
169 DWORD dwDisableCAD
= 0;
173 rc
= RegOpenKeyExW(HKEY_LOCAL_MACHINE
,
174 L
"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon",
178 if (rc
!= ERROR_SUCCESS
)
180 WARN("RegOpenKeyExW() failed with error %lu\n", rc
);
184 rc
= ReadRegSzKey(hKey
,
187 if (rc
== ERROR_SUCCESS
)
189 if (wcscmp(lpAutoAdminLogon
, L
"1") == 0)
190 pgContext
->bAutoAdminLogon
= TRUE
;
193 TRACE("bAutoAdminLogon: %s\n", pgContext
->bAutoAdminLogon
? "TRUE" : "FALSE");
195 rc
= ReadRegDwordKey(hKey
,
198 if (rc
== ERROR_SUCCESS
)
200 if (dwDisableCAD
!= 0)
201 pgContext
->bDisableCAD
= TRUE
;
204 TRACE("bDisableCAD: %s\n", pgContext
->bDisableCAD
? "TRUE" : "FALSE");
206 pgContext
->bShutdownWithoutLogon
= TRUE
;
207 rc
= ReadRegSzKey(hKey
,
208 L
"ShutdownWithoutLogon",
209 &lpShutdownWithoutLogon
);
210 if (rc
== ERROR_SUCCESS
)
212 if (wcscmp(lpShutdownWithoutLogon
, L
"0") == 0)
213 pgContext
->bShutdownWithoutLogon
= FALSE
;
216 rc
= ReadRegSzKey(hKey
,
217 L
"DontDisplayLastUserName",
218 &lpDontDisplayLastUserName
);
219 if (rc
== ERROR_SUCCESS
)
221 if (wcscmp(lpDontDisplayLastUserName
, L
"1") == 0)
222 pgContext
->bDontDisplayLastUserName
= TRUE
;
225 dwSize
= 256 * sizeof(WCHAR
);
226 rc
= RegQueryValueExW(hKey
,
230 (LPBYTE
)&pgContext
->UserName
,
233 dwSize
= 256 * sizeof(WCHAR
);
234 rc
= RegQueryValueExW(hKey
,
235 L
"DefaultDomainName",
238 (LPBYTE
)&pgContext
->Domain
,
241 if (lpShutdownWithoutLogon
!= NULL
)
242 HeapFree(GetProcessHeap(), 0, lpShutdownWithoutLogon
);
244 if (lpDontDisplayLastUserName
!= NULL
)
245 HeapFree(GetProcessHeap(), 0, lpDontDisplayLastUserName
);
247 if (lpAutoAdminLogon
!= NULL
)
248 HeapFree(GetProcessHeap(), 0, lpAutoAdminLogon
);
265 PVOID pWinlogonFunctions
,
268 PGINA_CONTEXT pgContext
;
270 UNREFERENCED_PARAMETER(pvReserved
);
272 pgContext
= (PGINA_CONTEXT
)LocalAlloc(LMEM_FIXED
| LMEM_ZEROINIT
, sizeof(GINA_CONTEXT
));
275 WARN("LocalAlloc() failed\n");
279 if (!GetRegistrySettings(pgContext
))
281 WARN("GetRegistrySettings() failed\n");
282 LocalFree(pgContext
);
286 /* Return the context to winlogon */
287 *pWlxContext
= (PVOID
)pgContext
;
288 pgContext
->hDllInstance
= hDllInstance
;
290 /* Save pointer to dispatch table */
291 pgContext
->pWlxFuncs
= (PWLX_DISPATCH_VERSION_1_3
)pWinlogonFunctions
;
293 /* Save the winlogon handle used to call the dispatch functions */
294 pgContext
->hWlx
= hWlx
;
296 /* Save window station */
297 pgContext
->station
= lpWinsta
;
299 /* Clear status window handle */
300 pgContext
->hStatusWindow
= 0;
302 /* Notify winlogon that we will use the default SAS */
303 pgContext
->pWlxFuncs
->WlxUseCtrlAltDel(hWlx
);
305 /* Locates the authentification package */
306 //LsaRegisterLogonProcess(...);
308 /* Check autologon settings the first time */
309 pgContext
->AutoLogonState
= AUTOLOGON_CHECK_REGISTRY
;
312 return pGinaUI
->Initialize(pgContext
);
320 WlxScreenSaverNotify(
327 DWORD bufferSize
= sizeof(szBuffer
);
328 DWORD varType
= REG_SZ
;
331 TRACE("(%p %p)\n", pWlxContext
, pSecure
);
337 * HKLM\Software\Policies\Microsoft\Windows\Control Panel\Desktop : ScreenSaverIsSecure
339 * HKCU\Control Panel\Desktop : ScreenSaverIsSecure
342 rc
= RegOpenKeyExW(HKEY_CURRENT_USER
,
343 L
"Control Panel\\Desktop",
347 TRACE("RegOpenKeyExW: %ld\n", rc
);
348 if (rc
== ERROR_SUCCESS
)
350 rc
= RegQueryValueExW(hKey
,
351 L
"ScreenSaverIsSecure",
357 TRACE("RegQueryValueExW: %ld\n", rc
);
359 if (rc
== ERROR_SUCCESS
)
361 TRACE("szBuffer: \"%S\"\n", szBuffer
);
362 *pSecure
= _wtoi(szBuffer
);
368 TRACE("*pSecure: %ld\n", *pSecure
);
382 PWSTR pszDesktopName
,
386 PGINA_CONTEXT pgContext
= (PGINA_CONTEXT
)pWlxContext
;
387 STARTUPINFOW StartupInfo
;
388 PROCESS_INFORMATION ProcessInformation
;
389 WCHAR CurrentDirectory
[MAX_PATH
];
394 len
= GetWindowsDirectoryW(CurrentDirectory
, MAX_PATH
);
395 if (len
== 0 || len
> MAX_PATH
)
397 ERR("GetWindowsDirectoryW() failed\n");
401 ret
= DuplicateTokenEx(pgContext
->UserToken
, MAXIMUM_ALLOWED
, NULL
, SecurityImpersonation
, TokenPrimary
, &hAppToken
);
404 ERR("DuplicateTokenEx() failed with error %lu\n", GetLastError());
408 ZeroMemory(&StartupInfo
, sizeof(StartupInfo
));
409 ZeroMemory(&ProcessInformation
, sizeof(ProcessInformation
));
410 StartupInfo
.cb
= sizeof(StartupInfo
);
411 StartupInfo
.lpTitle
= pszCmdLine
;
412 StartupInfo
.dwFlags
= STARTF_USESHOWWINDOW
;
413 StartupInfo
.wShowWindow
= SW_SHOW
;
414 StartupInfo
.lpDesktop
= pszDesktopName
;
416 len
= GetWindowsDirectoryW(CurrentDirectory
, MAX_PATH
);
417 if (len
== 0 || len
> MAX_PATH
)
419 ERR("GetWindowsDirectoryW() failed\n");
422 ret
= CreateProcessAsUserW(
429 CREATE_UNICODE_ENVIRONMENT
,
433 &ProcessInformation
);
434 CloseHandle(ProcessInformation
.hProcess
);
435 CloseHandle(ProcessInformation
.hThread
);
436 CloseHandle(hAppToken
);
438 ERR("CreateProcessAsUserW() failed with error %lu\n", GetLastError());
446 WlxActivateUserShell(
448 PWSTR pszDesktopName
,
449 PWSTR pszMprLogonScript
,
453 DWORD BufSize
, ValueType
;
454 WCHAR pszUserInitApp
[MAX_PATH
+ 1];
455 WCHAR pszExpUserInitApp
[MAX_PATH
];
459 TRACE("WlxActivateUserShell()\n");
461 UNREFERENCED_PARAMETER(pszMprLogonScript
);
463 /* Get the path of userinit */
466 L
"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon",
470 if (rc
!= ERROR_SUCCESS
)
472 WARN("RegOpenKeyExW() failed with error %lu\n", rc
);
476 /* Query userinit application */
477 BufSize
= sizeof(pszUserInitApp
) - sizeof(UNICODE_NULL
);
478 rc
= RegQueryValueExW(
483 (LPBYTE
)pszUserInitApp
,
486 if (rc
!= ERROR_SUCCESS
|| (ValueType
!= REG_SZ
&& ValueType
!= REG_EXPAND_SZ
))
488 WARN("RegQueryValueExW() failed with error %lu\n", rc
);
491 pszUserInitApp
[MAX_PATH
] = UNICODE_NULL
;
493 len
= ExpandEnvironmentStringsW(pszUserInitApp
, pszExpUserInitApp
, MAX_PATH
);
496 WARN("ExpandEnvironmentStringsW() failed. Required size %lu\n", len
);
500 /* Start userinit app */
501 return WlxStartApplication(pWlxContext
, pszDesktopName
, pEnvironment
, pszExpUserInitApp
);
513 PGINA_CONTEXT pgContext
= (PGINA_CONTEXT
)pWlxContext
;
514 INT SasAction
= WLX_SAS_ACTION_NONE
;
516 TRACE("WlxLoggedOnSAS(0x%lx)\n", dwSasType
);
518 UNREFERENCED_PARAMETER(pReserved
);
522 case WLX_SAS_TYPE_CTRL_ALT_DEL
:
523 case WLX_SAS_TYPE_TIMEOUT
:
525 SasAction
= pGinaUI
->LoggedOnSAS(pgContext
, dwSasType
);
528 case WLX_SAS_TYPE_SC_INSERT
:
530 FIXME("WlxLoggedOnSAS: SasType WLX_SAS_TYPE_SC_INSERT not supported!\n");
533 case WLX_SAS_TYPE_SC_REMOVE
:
535 FIXME("WlxLoggedOnSAS: SasType WLX_SAS_TYPE_SC_REMOVE not supported!\n");
540 WARN("WlxLoggedOnSAS: Unknown SasType: 0x%x\n", dwSasType
);
552 WlxDisplayStatusMessage(
553 IN PVOID pWlxContext
,
559 PGINA_CONTEXT pgContext
= (PGINA_CONTEXT
)pWlxContext
;
561 TRACE("WlxDisplayStatusMessage(\"%S\")\n", pMessage
);
563 return pGinaUI
->DisplayStatusMessage(pgContext
, hDesktop
, dwOptions
, pTitle
, pMessage
);
570 WlxRemoveStatusMessage(
571 IN PVOID pWlxContext
)
573 PGINA_CONTEXT pgContext
= (PGINA_CONTEXT
)pWlxContext
;
575 TRACE("WlxRemoveStatusMessage()\n");
577 return pGinaUI
->RemoveStatusMessage(pgContext
);
581 DuplicationString(PWSTR Str
)
586 if (Str
== NULL
) return NULL
;
588 cb
= (wcslen(Str
) + 1) * sizeof(WCHAR
);
589 if ((NewStr
= LocalAlloc(LMEM_FIXED
, cb
)))
590 memcpy(NewStr
, Str
, cb
);
597 IN PGINA_CONTEXT pgContext
,
602 HANDLE hToken
= NULL
;
603 PTOKEN_GROUPS Groups
= NULL
;
604 BOOL bIsAdmin
= FALSE
;
609 TRACE("(%S %S %S)\n", UserName
, Domain
, Password
);
611 if (!ConnectToLsa(pgContext
))
614 if (!MyLogonUser(pgContext
->LsaHandle
,
615 pgContext
->AuthenticationPackage
,
619 &pgContext
->UserToken
))
621 WARN("LogonUserW() failed\n");
625 Status
= NtQueryInformationToken(hToken
,
630 if ((Status
!= STATUS_SUCCESS
) && (Status
!= STATUS_BUFFER_TOO_SMALL
))
632 TRACE("NtQueryInformationToken() failed (Status 0x%08lx)\n", Status
);
636 Groups
= HeapAlloc(GetProcessHeap(), 0, Size
);
639 TRACE("HeapAlloc() failed\n");
643 Status
= NtQueryInformationToken(hToken
,
648 if (!NT_SUCCESS(Status
))
650 TRACE("NtQueryInformationToken() failed (Status 0x%08lx)\n", Status
);
654 for (i
= 0; i
< Groups
->GroupCount
; i
++)
656 if (RtlEqualSid(Groups
->Groups
[i
].Sid
, AdminSid
))
658 TRACE("Member of Admins group\n");
666 HeapFree(GetProcessHeap(), 0, Groups
);
677 IN OUT PGINA_CONTEXT pgContext
,
682 LPWSTR ProfilePath
= NULL
;
683 LPWSTR lpEnvironment
= NULL
;
684 TOKEN_STATISTICS Stats
;
685 PWLX_PROFILE_V2_0 pProfile
= NULL
;
686 DWORD cbStats
, cbSize
;
690 if (!ConnectToLsa(pgContext
))
693 if (!MyLogonUser(pgContext
->LsaHandle
,
694 pgContext
->AuthenticationPackage
,
698 &pgContext
->UserToken
))
700 WARN("LogonUserW() failed\n");
704 /* Store the logon time in the context */
705 GetLocalTime(&pgContext
->LogonTime
);
707 /* Store user and domain in the context */
708 wcscpy(pgContext
->UserName
, UserName
);
709 if (Domain
== NULL
|| wcslen(Domain
) == 0)
712 GetComputerNameW(pgContext
->Domain
, &dwLength
);
716 wcscpy(pgContext
->Domain
, Domain
);
719 /* Get profile path */
721 bResult
= GetProfilesDirectoryW(NULL
, &cbSize
);
722 if (!bResult
&& GetLastError() == ERROR_INSUFFICIENT_BUFFER
)
724 ProfilePath
= HeapAlloc(GetProcessHeap(), 0, cbSize
* sizeof(WCHAR
));
727 WARN("HeapAlloc() failed\n");
730 bResult
= GetProfilesDirectoryW(ProfilePath
, &cbSize
);
734 WARN("GetUserProfileDirectoryW() failed\n");
738 /* Allocate memory for profile */
739 pProfile
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(WLX_PROFILE_V2_0
));
742 WARN("HeapAlloc() failed\n");
745 pProfile
->dwType
= WLX_PROFILE_TYPE_V2_0
;
746 pProfile
->pszProfile
= ProfilePath
;
748 lpEnvironment
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
,
749 (wcslen(pgContext
->Domain
)+ 14 + 1) * sizeof(WCHAR
));
752 WARN("HeapAlloc() failed\n");
756 wsprintfW(lpEnvironment
, L
"LOGONSERVER=\\\\%s", pgContext
->Domain
);
758 pProfile
->pszEnvironment
= lpEnvironment
;
760 if (!GetTokenInformation(pgContext
->UserToken
,
763 sizeof(TOKEN_STATISTICS
),
766 WARN("Couldn't get Authentication id from user token!\n");
770 *pgContext
->pAuthenticationId
= Stats
.AuthenticationId
;
771 pgContext
->pMprNotifyInfo
->pszUserName
= DuplicationString(UserName
);
772 pgContext
->pMprNotifyInfo
->pszDomain
= DuplicationString(Domain
);
773 pgContext
->pMprNotifyInfo
->pszPassword
= DuplicationString(Password
);
774 pgContext
->pMprNotifyInfo
->pszOldPassword
= NULL
;
775 *pgContext
->pdwOptions
= 0;
776 *pgContext
->pProfile
= pProfile
;
782 HeapFree(GetProcessHeap(), 0, pProfile
->pszEnvironment
);
784 HeapFree(GetProcessHeap(), 0, pProfile
);
785 HeapFree(GetProcessHeap(), 0, ProfilePath
);
792 IN PGINA_CONTEXT pgContext
)
794 HKEY WinLogonKey
= NULL
;
795 LPWSTR AutoLogon
= NULL
;
796 LPWSTR AutoCount
= NULL
;
797 LPWSTR IgnoreShiftOverride
= NULL
;
798 LPWSTR UserName
= NULL
;
799 LPWSTR DomainName
= NULL
;
800 LPWSTR Password
= NULL
;
804 TRACE("DoAutoLogon(): AutoLogonState = %lu\n",
805 pgContext
->AutoLogonState
);
807 if (pgContext
->AutoLogonState
== AUTOLOGON_DISABLED
)
812 L
"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\WinLogon",
816 if (rc
!= ERROR_SUCCESS
)
819 if (pgContext
->AutoLogonState
== AUTOLOGON_CHECK_REGISTRY
)
821 /* Set it by default to disabled, we might reenable it again later */
822 pgContext
->AutoLogonState
= AUTOLOGON_DISABLED
;
824 rc
= ReadRegSzKey(WinLogonKey
, L
"AutoAdminLogon", &AutoLogon
);
825 if (rc
!= ERROR_SUCCESS
)
827 if (wcscmp(AutoLogon
, L
"1") != 0)
830 rc
= ReadRegSzKey(WinLogonKey
, L
"AutoLogonCount", &AutoCount
);
831 if (rc
== ERROR_SUCCESS
&& wcscmp(AutoCount
, L
"0") == 0)
833 else if (rc
!= ERROR_FILE_NOT_FOUND
)
836 rc
= ReadRegSzKey(WinLogonKey
, L
"IgnoreShiftOverride", &UserName
);
837 if (rc
== ERROR_SUCCESS
)
839 if (wcscmp(AutoLogon
, L
"1") != 0 && GetKeyState(VK_SHIFT
) < 0)
842 else if (GetKeyState(VK_SHIFT
) < 0)
844 /* User pressed SHIFT */
848 pgContext
->AutoLogonState
= AUTOLOGON_ONCE
;
851 else /* pgContext->AutoLogonState == AUTOLOGON_ONCE */
853 pgContext
->AutoLogonState
= AUTOLOGON_DISABLED
;
855 rc
= ReadRegSzKey(WinLogonKey
, L
"DefaultUserName", &UserName
);
856 if (rc
!= ERROR_SUCCESS
)
858 rc
= ReadRegSzKey(WinLogonKey
, L
"DefaultDomainName", &DomainName
);
859 if (rc
!= ERROR_SUCCESS
&& rc
!= ERROR_FILE_NOT_FOUND
)
861 rc
= ReadRegSzKey(WinLogonKey
, L
"DefaultPassword", &Password
);
862 if (rc
!= ERROR_SUCCESS
)
865 result
= DoLoginTasks(pgContext
, UserName
, DomainName
, Password
);
869 pgContext
->Password
= HeapAlloc(GetProcessHeap(),
871 (wcslen(Password
) + 1) * sizeof(WCHAR
));
872 if (pgContext
->Password
!= NULL
)
873 wcscpy(pgContext
->Password
, Password
);
875 NotifyBootConfigStatus(TRUE
);
880 if (WinLogonKey
!= NULL
)
881 RegCloseKey(WinLogonKey
);
882 HeapFree(GetProcessHeap(), 0, AutoLogon
);
883 HeapFree(GetProcessHeap(), 0, AutoCount
);
884 HeapFree(GetProcessHeap(), 0, IgnoreShiftOverride
);
885 HeapFree(GetProcessHeap(), 0, UserName
);
886 HeapFree(GetProcessHeap(), 0, DomainName
);
887 HeapFree(GetProcessHeap(), 0, Password
);
888 TRACE("DoAutoLogon(): AutoLogonState = %lu, returning %d\n",
889 pgContext
->AutoLogonState
, result
);
898 IN PVOID pWlxContext
)
900 PGINA_CONTEXT pgContext
= (PGINA_CONTEXT
)pWlxContext
;
902 TRACE("WlxDisplaySASNotice(%p)\n", pWlxContext
);
904 if (GetSystemMetrics(SM_REMOTESESSION
))
906 /* User is remotely logged on. Don't display a notice */
907 pgContext
->pWlxFuncs
->WlxSasNotify(pgContext
->hWlx
, WLX_SAS_TYPE_CTRL_ALT_DEL
);
911 if (pgContext
->bAutoAdminLogon
== TRUE
)
913 /* Don't display the window, we want to do an automatic logon */
914 pgContext
->AutoLogonState
= AUTOLOGON_ONCE
;
915 pgContext
->pWlxFuncs
->WlxSasNotify(pgContext
->hWlx
, WLX_SAS_TYPE_CTRL_ALT_DEL
);
919 pgContext
->AutoLogonState
= AUTOLOGON_DISABLED
;
921 if (pgContext
->bDisableCAD
== TRUE
)
923 pgContext
->pWlxFuncs
->WlxSasNotify(pgContext
->hWlx
, WLX_SAS_TYPE_CTRL_ALT_DEL
);
927 pGinaUI
->DisplaySASNotice(pgContext
);
929 TRACE("WlxDisplaySASNotice() done\n");
937 IN PVOID pWlxContext
,
939 OUT PLUID pAuthenticationId
,
940 IN OUT PSID pLogonSid
,
941 OUT PDWORD pdwOptions
,
943 OUT PWLX_MPR_NOTIFY_INFO pMprNotifyInfo
,
946 PGINA_CONTEXT pgContext
= (PGINA_CONTEXT
)pWlxContext
;
949 TRACE("WlxLoggedOutSAS()\n");
951 UNREFERENCED_PARAMETER(dwSasType
);
952 UNREFERENCED_PARAMETER(pLogonSid
);
954 pgContext
->pAuthenticationId
= pAuthenticationId
;
955 pgContext
->pdwOptions
= pdwOptions
;
956 pgContext
->pMprNotifyInfo
= pMprNotifyInfo
;
957 pgContext
->pProfile
= pProfile
;
959 if (0 == GetSystemMetrics(SM_REMOTESESSION
) &&
960 DoAutoLogon(pgContext
))
962 /* User is local and registry contains information
963 * to log on him automatically */
964 *phToken
= pgContext
->UserToken
;
965 return WLX_SAS_ACTION_LOGON
;
968 res
= pGinaUI
->LoggedOutSAS(pgContext
);
969 *phToken
= pgContext
->UserToken
;
981 PGINA_CONTEXT pgContext
= (PGINA_CONTEXT
)pWlxContext
;
983 TRACE("WlxWkstaLockedSAS()\n");
985 UNREFERENCED_PARAMETER(dwSasType
);
987 return pGinaUI
->LockedSAS(pgContext
);
996 WlxDisplayLockedNotice(PVOID pWlxContext
)
998 PGINA_CONTEXT pgContext
= (PGINA_CONTEXT
)pWlxContext
;
1000 TRACE("WlxDisplayLockedNotice()\n");
1002 if (pgContext
->bDisableCAD
== TRUE
)
1004 pgContext
->pWlxFuncs
->WlxSasNotify(pgContext
->hWlx
, WLX_SAS_TYPE_CTRL_ALT_DEL
);
1008 pGinaUI
->DisplayLockedNotice(pgContext
);
1019 TRACE("WlxIsLogoffOk()\n");
1020 UNREFERENCED_PARAMETER(pWlxContext
);
1026 IN HINSTANCE hinstDLL
,
1028 IN LPVOID lpvReserved
)
1030 UNREFERENCED_PARAMETER(lpvReserved
);
1032 if (dwReason
== DLL_PROCESS_ATTACH
)
1034 hDllInstance
= hinstDLL
;
1036 RtlAllocateAndInitializeSid(&SystemAuthority
,
1038 SECURITY_BUILTIN_DOMAIN_RID
,
1039 DOMAIN_ALIAS_RID_ADMINS
,
1049 else if (dwReason
== DLL_PROCESS_DETACH
)
1051 if (AdminSid
!= NULL
)
1052 RtlFreeSid(AdminSid
);