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)
32 #include <ndk/sefuncs.h>
34 HINSTANCE hDllInstance
;
36 extern GINA_UI GinaGraphicalUI
;
37 extern GINA_UI GinaTextUI
;
38 static PGINA_UI pGinaUI
;
39 static SID_IDENTIFIER_AUTHORITY SystemAuthority
= {SECURITY_NT_AUTHORITY
};
47 IN DWORD dwWinlogonVersion
,
48 OUT PDWORD pdwDllVersion
)
50 TRACE("WlxNegotiate(%lx, %p)\n", dwWinlogonVersion
, pdwDllVersion
);
52 if(!pdwDllVersion
|| (dwWinlogonVersion
< WLX_VERSION_1_3
))
55 *pdwDllVersion
= WLX_VERSION_1_3
;
72 return ERROR_INVALID_PARAMETER
;
75 rc
= RegQueryValueExW(hKey
, pszKey
, NULL
, &dwType
, NULL
, &cbData
);
76 if (rc
!= ERROR_SUCCESS
)
79 return ERROR_FILE_NOT_FOUND
;
80 Value
= HeapAlloc(GetProcessHeap(), 0, cbData
+ sizeof(WCHAR
));
82 return ERROR_NOT_ENOUGH_MEMORY
;
83 rc
= RegQueryValueExW(hKey
, pszKey
, NULL
, NULL
, (LPBYTE
)Value
, &cbData
);
84 if (rc
!= ERROR_SUCCESS
)
86 HeapFree(GetProcessHeap(), 0, Value
);
89 /* NULL-terminate the string */
90 Value
[cbData
/ sizeof(WCHAR
)] = '\0';
108 return ERROR_INVALID_PARAMETER
;
110 cbData
= sizeof(DWORD
);
111 rc
= RegQueryValueExW(hKey
, pszKey
, NULL
, &dwType
, (LPBYTE
)&dwValue
, &cbData
);
112 if (rc
== ERROR_SUCCESS
&& dwType
== REG_DWORD
)
115 return ERROR_SUCCESS
;
121 HKEY ControlKey
= NULL
;
122 LPWSTR SystemStartOptions
= NULL
;
123 LPWSTR CurrentOption
, NextOption
; /* Pointers into SystemStartOptions */
124 BOOL ConsoleBoot
= FALSE
;
129 L
"SYSTEM\\CurrentControlSet\\Control",
134 rc
= ReadRegSzKey(ControlKey
, L
"SystemStartOptions", &SystemStartOptions
);
135 if (rc
!= ERROR_SUCCESS
)
138 /* Check for CONSOLE switch in SystemStartOptions */
139 CurrentOption
= SystemStartOptions
;
140 while (CurrentOption
)
142 NextOption
= wcschr(CurrentOption
, L
' ');
145 if (wcsicmp(CurrentOption
, L
"CONSOLE") == 0)
147 TRACE("Found %S. Switching to console boot\n", CurrentOption
);
151 CurrentOption
= NextOption
? NextOption
+ 1 : NULL
;
156 pGinaUI
= &GinaTextUI
;
158 pGinaUI
= &GinaGraphicalUI
;
160 if (ControlKey
!= NULL
)
161 RegCloseKey(ControlKey
);
162 HeapFree(GetProcessHeap(), 0, SystemStartOptions
);
168 GetRegistrySettings(PGINA_CONTEXT pgContext
)
171 LPWSTR lpAutoAdminLogon
= NULL
;
172 LPWSTR lpDontDisplayLastUserName
= NULL
;
173 LPWSTR lpShutdownWithoutLogon
= NULL
;
174 DWORD dwDisableCAD
= 0;
178 rc
= RegOpenKeyExW(HKEY_LOCAL_MACHINE
,
179 L
"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon",
183 if (rc
!= ERROR_SUCCESS
)
185 WARN("RegOpenKeyExW() failed with error %lu\n", rc
);
189 rc
= ReadRegSzKey(hKey
,
192 if (rc
== ERROR_SUCCESS
)
194 if (wcscmp(lpAutoAdminLogon
, L
"1") == 0)
195 pgContext
->bAutoAdminLogon
= TRUE
;
198 TRACE("bAutoAdminLogon: %s\n", pgContext
->bAutoAdminLogon
? "TRUE" : "FALSE");
200 rc
= ReadRegDwordKey(hKey
,
203 if (rc
== ERROR_SUCCESS
)
205 if (dwDisableCAD
!= 0)
206 pgContext
->bDisableCAD
= TRUE
;
209 TRACE("bDisableCAD: %s\n", pgContext
->bDisableCAD
? "TRUE" : "FALSE");
211 pgContext
->bShutdownWithoutLogon
= TRUE
;
212 rc
= ReadRegSzKey(hKey
,
213 L
"ShutdownWithoutLogon",
214 &lpShutdownWithoutLogon
);
215 if (rc
== ERROR_SUCCESS
)
217 if (wcscmp(lpShutdownWithoutLogon
, L
"0") == 0)
218 pgContext
->bShutdownWithoutLogon
= FALSE
;
221 rc
= ReadRegSzKey(hKey
,
222 L
"DontDisplayLastUserName",
223 &lpDontDisplayLastUserName
);
224 if (rc
== ERROR_SUCCESS
)
226 if (wcscmp(lpDontDisplayLastUserName
, L
"1") == 0)
227 pgContext
->bDontDisplayLastUserName
= TRUE
;
230 dwSize
= 256 * sizeof(WCHAR
);
231 rc
= RegQueryValueExW(hKey
,
235 (LPBYTE
)&pgContext
->UserName
,
238 dwSize
= 256 * sizeof(WCHAR
);
239 rc
= RegQueryValueExW(hKey
,
243 (LPBYTE
)&pgContext
->Domain
,
246 if (lpShutdownWithoutLogon
!= NULL
)
247 HeapFree(GetProcessHeap(), 0, lpShutdownWithoutLogon
);
249 if (lpDontDisplayLastUserName
!= NULL
)
250 HeapFree(GetProcessHeap(), 0, lpDontDisplayLastUserName
);
252 if (lpAutoAdminLogon
!= NULL
)
253 HeapFree(GetProcessHeap(), 0, lpAutoAdminLogon
);
270 PVOID pWinlogonFunctions
,
273 PGINA_CONTEXT pgContext
;
275 UNREFERENCED_PARAMETER(pvReserved
);
277 pgContext
= (PGINA_CONTEXT
)LocalAlloc(LMEM_FIXED
| LMEM_ZEROINIT
, sizeof(GINA_CONTEXT
));
280 WARN("LocalAlloc() failed\n");
284 if (!GetRegistrySettings(pgContext
))
286 WARN("GetRegistrySettings() failed\n");
287 LocalFree(pgContext
);
291 /* Return the context to winlogon */
292 *pWlxContext
= (PVOID
)pgContext
;
293 pgContext
->hDllInstance
= hDllInstance
;
295 /* Save pointer to dispatch table */
296 pgContext
->pWlxFuncs
= (PWLX_DISPATCH_VERSION_1_3
)pWinlogonFunctions
;
298 /* Save the winlogon handle used to call the dispatch functions */
299 pgContext
->hWlx
= hWlx
;
301 /* Save window station */
302 pgContext
->station
= lpWinsta
;
304 /* Clear status window handle */
305 pgContext
->hStatusWindow
= 0;
307 /* Notify winlogon that we will use the default SAS */
308 pgContext
->pWlxFuncs
->WlxUseCtrlAltDel(hWlx
);
310 /* Locates the authentification package */
311 //LsaRegisterLogonProcess(...);
313 /* Check autologon settings the first time */
314 pgContext
->AutoLogonState
= AUTOLOGON_CHECK_REGISTRY
;
317 return pGinaUI
->Initialize(pgContext
);
325 WlxScreenSaverNotify(
332 DWORD bufferSize
= sizeof(szBuffer
);
333 DWORD varType
= REG_SZ
;
336 TRACE("(%p %p)\n", pWlxContext
, pSecure
);
342 * HKLM\Software\Policies\Microsoft\Windows\Control Panel\Desktop : ScreenSaverIsSecure
344 * HKCU\Control Panel\Desktop : ScreenSaverIsSecure
347 rc
= RegOpenKeyExW(HKEY_CURRENT_USER
,
348 L
"Control Panel\\Desktop",
352 TRACE("RegOpenKeyExW: %ld\n", rc
);
353 if (rc
== ERROR_SUCCESS
)
355 rc
= RegQueryValueExW(hKey
,
356 L
"ScreenSaverIsSecure",
362 TRACE("RegQueryValueExW: %ld\n", rc
);
364 if (rc
== ERROR_SUCCESS
)
366 TRACE("szBuffer: \"%S\"\n", szBuffer
);
367 *pSecure
= _wtoi(szBuffer
);
373 TRACE("*pSecure: %ld\n", *pSecure
);
387 PWSTR pszDesktopName
,
391 PGINA_CONTEXT pgContext
= (PGINA_CONTEXT
)pWlxContext
;
392 STARTUPINFOW StartupInfo
;
393 PROCESS_INFORMATION ProcessInformation
;
394 WCHAR CurrentDirectory
[MAX_PATH
];
399 len
= GetWindowsDirectoryW(CurrentDirectory
, MAX_PATH
);
400 if (len
== 0 || len
> MAX_PATH
)
402 ERR("GetWindowsDirectoryW() failed\n");
406 ret
= DuplicateTokenEx(pgContext
->UserToken
, MAXIMUM_ALLOWED
, NULL
, SecurityImpersonation
, TokenPrimary
, &hAppToken
);
409 ERR("DuplicateTokenEx() failed with error %lu\n", GetLastError());
413 ZeroMemory(&StartupInfo
, sizeof(StartupInfo
));
414 ZeroMemory(&ProcessInformation
, sizeof(ProcessInformation
));
415 StartupInfo
.cb
= sizeof(StartupInfo
);
416 StartupInfo
.lpTitle
= pszCmdLine
;
417 StartupInfo
.dwFlags
= STARTF_USESHOWWINDOW
;
418 StartupInfo
.wShowWindow
= SW_SHOW
;
419 StartupInfo
.lpDesktop
= pszDesktopName
;
421 len
= GetWindowsDirectoryW(CurrentDirectory
, MAX_PATH
);
422 if (len
== 0 || len
> MAX_PATH
)
424 ERR("GetWindowsDirectoryW() failed\n");
427 ret
= CreateProcessAsUserW(
434 CREATE_UNICODE_ENVIRONMENT
,
438 &ProcessInformation
);
439 CloseHandle(ProcessInformation
.hProcess
);
440 CloseHandle(ProcessInformation
.hThread
);
441 CloseHandle(hAppToken
);
443 ERR("CreateProcessAsUserW() failed with error %lu\n", GetLastError());
451 WlxActivateUserShell(
453 PWSTR pszDesktopName
,
454 PWSTR pszMprLogonScript
,
458 DWORD BufSize
, ValueType
;
459 WCHAR pszUserInitApp
[MAX_PATH
+ 1];
460 WCHAR pszExpUserInitApp
[MAX_PATH
];
464 TRACE("WlxActivateUserShell()\n");
466 UNREFERENCED_PARAMETER(pszMprLogonScript
);
468 /* Get the path of userinit */
471 L
"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon",
475 if (rc
!= ERROR_SUCCESS
)
477 WARN("RegOpenKeyExW() failed with error %lu\n", rc
);
481 /* Query userinit application */
482 BufSize
= sizeof(pszUserInitApp
) - sizeof(UNICODE_NULL
);
483 rc
= RegQueryValueExW(
488 (LPBYTE
)pszUserInitApp
,
491 if (rc
!= ERROR_SUCCESS
|| (ValueType
!= REG_SZ
&& ValueType
!= REG_EXPAND_SZ
))
493 WARN("RegQueryValueExW() failed with error %lu\n", rc
);
496 pszUserInitApp
[MAX_PATH
] = UNICODE_NULL
;
498 len
= ExpandEnvironmentStringsW(pszUserInitApp
, pszExpUserInitApp
, MAX_PATH
);
501 WARN("ExpandEnvironmentStringsW() failed. Required size %lu\n", len
);
505 /* Start userinit app */
506 return WlxStartApplication(pWlxContext
, pszDesktopName
, pEnvironment
, pszExpUserInitApp
);
518 PGINA_CONTEXT pgContext
= (PGINA_CONTEXT
)pWlxContext
;
519 INT SasAction
= WLX_SAS_ACTION_NONE
;
521 TRACE("WlxLoggedOnSAS(0x%lx)\n", dwSasType
);
523 UNREFERENCED_PARAMETER(pReserved
);
527 case WLX_SAS_TYPE_CTRL_ALT_DEL
:
528 case WLX_SAS_TYPE_TIMEOUT
:
530 SasAction
= pGinaUI
->LoggedOnSAS(pgContext
, dwSasType
);
533 case WLX_SAS_TYPE_SC_INSERT
:
535 FIXME("WlxLoggedOnSAS: SasType WLX_SAS_TYPE_SC_INSERT not supported!\n");
538 case WLX_SAS_TYPE_SC_REMOVE
:
540 FIXME("WlxLoggedOnSAS: SasType WLX_SAS_TYPE_SC_REMOVE not supported!\n");
545 WARN("WlxLoggedOnSAS: Unknown SasType: 0x%x\n", dwSasType
);
557 WlxDisplayStatusMessage(
558 IN PVOID pWlxContext
,
564 PGINA_CONTEXT pgContext
= (PGINA_CONTEXT
)pWlxContext
;
566 TRACE("WlxDisplayStatusMessage(\"%S\")\n", pMessage
);
568 return pGinaUI
->DisplayStatusMessage(pgContext
, hDesktop
, dwOptions
, pTitle
, pMessage
);
575 WlxRemoveStatusMessage(
576 IN PVOID pWlxContext
)
578 PGINA_CONTEXT pgContext
= (PGINA_CONTEXT
)pWlxContext
;
580 TRACE("WlxRemoveStatusMessage()\n");
582 return pGinaUI
->RemoveStatusMessage(pgContext
);
586 DuplicationString(PWSTR Str
)
591 if (Str
== NULL
) return NULL
;
593 cb
= (wcslen(Str
) + 1) * sizeof(WCHAR
);
594 if ((NewStr
= LocalAlloc(LMEM_FIXED
, cb
)))
595 memcpy(NewStr
, Str
, cb
);
602 IN PGINA_CONTEXT pgContext
,
607 HANDLE hToken
= NULL
;
608 PTOKEN_GROUPS Groups
= NULL
;
609 BOOL bIsAdmin
= FALSE
;
614 TRACE("(%S %S %S)\n", UserName
, Domain
, Password
);
616 if (!ConnectToLsa(pgContext
))
619 if (!MyLogonUser(pgContext
->LsaHandle
,
620 pgContext
->AuthenticationPackage
,
624 &pgContext
->UserToken
))
626 WARN("LogonUserW() failed\n");
630 Status
= NtQueryInformationToken(hToken
,
635 if ((Status
!= STATUS_SUCCESS
) && (Status
!= STATUS_BUFFER_TOO_SMALL
))
637 TRACE("NtQueryInformationToken() failed (Status 0x%08lx)\n", Status
);
641 Groups
= HeapAlloc(GetProcessHeap(), 0, Size
);
644 TRACE("HeapAlloc() failed\n");
648 Status
= NtQueryInformationToken(hToken
,
653 if (!NT_SUCCESS(Status
))
655 TRACE("NtQueryInformationToken() failed (Status 0x%08lx)\n", Status
);
659 for (i
= 0; i
< Groups
->GroupCount
; i
++)
661 if (RtlEqualSid(Groups
->Groups
[i
].Sid
, AdminSid
))
663 TRACE("Member of Admins group\n");
671 HeapFree(GetProcessHeap(), 0, Groups
);
682 IN OUT PGINA_CONTEXT pgContext
,
687 LPWSTR ProfilePath
= NULL
;
688 LPWSTR lpEnvironment
= NULL
;
689 TOKEN_STATISTICS Stats
;
690 PWLX_PROFILE_V2_0 pProfile
= NULL
;
691 DWORD cbStats
, cbSize
;
695 if (!ConnectToLsa(pgContext
))
698 if (!MyLogonUser(pgContext
->LsaHandle
,
699 pgContext
->AuthenticationPackage
,
703 &pgContext
->UserToken
))
705 WARN("LogonUserW() failed\n");
709 /* Store the logon time in the context */
710 GetLocalTime(&pgContext
->LogonTime
);
712 /* Store user and domain in the context */
713 wcscpy(pgContext
->UserName
, UserName
);
714 if (Domain
== NULL
|| wcslen(Domain
) == 0)
717 GetComputerNameW(pgContext
->Domain
, &dwLength
);
721 wcscpy(pgContext
->Domain
, Domain
);
724 /* Get profile path */
726 bResult
= GetProfilesDirectoryW(NULL
, &cbSize
);
727 if (!bResult
&& GetLastError() == ERROR_INSUFFICIENT_BUFFER
)
729 ProfilePath
= HeapAlloc(GetProcessHeap(), 0, cbSize
* sizeof(WCHAR
));
732 WARN("HeapAlloc() failed\n");
735 bResult
= GetProfilesDirectoryW(ProfilePath
, &cbSize
);
739 WARN("GetUserProfileDirectoryW() failed\n");
743 /* Allocate memory for profile */
744 pProfile
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(WLX_PROFILE_V2_0
));
747 WARN("HeapAlloc() failed\n");
750 pProfile
->dwType
= WLX_PROFILE_TYPE_V2_0
;
751 pProfile
->pszProfile
= ProfilePath
;
753 lpEnvironment
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
,
754 (wcslen(pgContext
->Domain
)+ 14 + 1) * sizeof(WCHAR
));
757 WARN("HeapAlloc() failed\n");
761 wsprintfW(lpEnvironment
, L
"LOGONSERVER=\\\\%s", pgContext
->Domain
);
763 pProfile
->pszEnvironment
= lpEnvironment
;
765 if (!GetTokenInformation(pgContext
->UserToken
,
768 sizeof(TOKEN_STATISTICS
),
771 WARN("Couldn't get Authentication id from user token!\n");
775 *pgContext
->pAuthenticationId
= Stats
.AuthenticationId
;
776 pgContext
->pMprNotifyInfo
->pszUserName
= DuplicationString(UserName
);
777 pgContext
->pMprNotifyInfo
->pszDomain
= DuplicationString(Domain
);
778 pgContext
->pMprNotifyInfo
->pszPassword
= DuplicationString(Password
);
779 pgContext
->pMprNotifyInfo
->pszOldPassword
= NULL
;
780 *pgContext
->pdwOptions
= 0;
781 *pgContext
->pProfile
= pProfile
;
787 HeapFree(GetProcessHeap(), 0, pProfile
->pszEnvironment
);
789 HeapFree(GetProcessHeap(), 0, pProfile
);
790 HeapFree(GetProcessHeap(), 0, ProfilePath
);
797 IN PGINA_CONTEXT pgContext
)
799 HKEY WinLogonKey
= NULL
;
800 LPWSTR AutoLogon
= NULL
;
801 LPWSTR AutoCount
= NULL
;
802 LPWSTR IgnoreShiftOverride
= NULL
;
803 LPWSTR UserName
= NULL
;
804 LPWSTR Domain
= NULL
;
805 LPWSTR Password
= NULL
;
809 TRACE("DoAutoLogon(): AutoLogonState = %lu\n",
810 pgContext
->AutoLogonState
);
812 if (pgContext
->AutoLogonState
== AUTOLOGON_DISABLED
)
817 L
"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\WinLogon",
821 if (rc
!= ERROR_SUCCESS
)
824 if (pgContext
->AutoLogonState
== AUTOLOGON_CHECK_REGISTRY
)
826 /* Set it by default to disabled, we might reenable it again later */
827 pgContext
->AutoLogonState
= AUTOLOGON_DISABLED
;
829 rc
= ReadRegSzKey(WinLogonKey
, L
"AutoAdminLogon", &AutoLogon
);
830 if (rc
!= ERROR_SUCCESS
)
832 if (wcscmp(AutoLogon
, L
"1") != 0)
835 rc
= ReadRegSzKey(WinLogonKey
, L
"AutoLogonCount", &AutoCount
);
836 if (rc
== ERROR_SUCCESS
&& wcscmp(AutoCount
, L
"0") == 0)
838 else if (rc
!= ERROR_FILE_NOT_FOUND
)
841 rc
= ReadRegSzKey(WinLogonKey
, L
"IgnoreShiftOverride", &UserName
);
842 if (rc
== ERROR_SUCCESS
)
844 if (wcscmp(AutoLogon
, L
"1") != 0 && GetKeyState(VK_SHIFT
) < 0)
847 else if (GetKeyState(VK_SHIFT
) < 0)
849 /* User pressed SHIFT */
853 pgContext
->AutoLogonState
= AUTOLOGON_ONCE
;
856 else /* pgContext->AutoLogonState == AUTOLOGON_ONCE */
858 pgContext
->AutoLogonState
= AUTOLOGON_DISABLED
;
860 rc
= ReadRegSzKey(WinLogonKey
, L
"DefaultUserName", &UserName
);
861 if (rc
!= ERROR_SUCCESS
)
863 rc
= ReadRegSzKey(WinLogonKey
, L
"DefaultDomain", &Domain
);
864 if (rc
!= ERROR_SUCCESS
&& rc
!= ERROR_FILE_NOT_FOUND
)
866 rc
= ReadRegSzKey(WinLogonKey
, L
"DefaultPassword", &Password
);
867 if (rc
!= ERROR_SUCCESS
)
870 result
= DoLoginTasks(pgContext
, UserName
, Domain
, Password
);
874 pgContext
->Password
= HeapAlloc(GetProcessHeap(),
876 (wcslen(Password
) + 1) * sizeof(WCHAR
));
877 if (pgContext
->Password
!= NULL
)
878 wcscpy(pgContext
->Password
, Password
);
880 NotifyBootConfigStatus(TRUE
);
885 if (WinLogonKey
!= NULL
)
886 RegCloseKey(WinLogonKey
);
887 HeapFree(GetProcessHeap(), 0, AutoLogon
);
888 HeapFree(GetProcessHeap(), 0, AutoCount
);
889 HeapFree(GetProcessHeap(), 0, IgnoreShiftOverride
);
890 HeapFree(GetProcessHeap(), 0, UserName
);
891 HeapFree(GetProcessHeap(), 0, Domain
);
892 HeapFree(GetProcessHeap(), 0, Password
);
893 TRACE("DoAutoLogon(): AutoLogonState = %lu, returning %d\n",
894 pgContext
->AutoLogonState
, result
);
903 IN PVOID pWlxContext
)
905 PGINA_CONTEXT pgContext
= (PGINA_CONTEXT
)pWlxContext
;
907 TRACE("WlxDisplaySASNotice(%p)\n", pWlxContext
);
909 if (GetSystemMetrics(SM_REMOTESESSION
))
911 /* User is remotely logged on. Don't display a notice */
912 pgContext
->pWlxFuncs
->WlxSasNotify(pgContext
->hWlx
, WLX_SAS_TYPE_CTRL_ALT_DEL
);
916 if (pgContext
->bAutoAdminLogon
== TRUE
)
918 /* Don't display the window, we want to do an automatic logon */
919 pgContext
->AutoLogonState
= AUTOLOGON_ONCE
;
920 pgContext
->pWlxFuncs
->WlxSasNotify(pgContext
->hWlx
, WLX_SAS_TYPE_CTRL_ALT_DEL
);
924 pgContext
->AutoLogonState
= AUTOLOGON_DISABLED
;
926 if (pgContext
->bDisableCAD
== TRUE
)
928 pgContext
->pWlxFuncs
->WlxSasNotify(pgContext
->hWlx
, WLX_SAS_TYPE_CTRL_ALT_DEL
);
932 pGinaUI
->DisplaySASNotice(pgContext
);
934 TRACE("WlxDisplaySASNotice() done\n");
942 IN PVOID pWlxContext
,
944 OUT PLUID pAuthenticationId
,
945 IN OUT PSID pLogonSid
,
946 OUT PDWORD pdwOptions
,
948 OUT PWLX_MPR_NOTIFY_INFO pMprNotifyInfo
,
951 PGINA_CONTEXT pgContext
= (PGINA_CONTEXT
)pWlxContext
;
954 TRACE("WlxLoggedOutSAS()\n");
956 UNREFERENCED_PARAMETER(dwSasType
);
957 UNREFERENCED_PARAMETER(pLogonSid
);
959 pgContext
->pAuthenticationId
= pAuthenticationId
;
960 pgContext
->pdwOptions
= pdwOptions
;
961 pgContext
->pMprNotifyInfo
= pMprNotifyInfo
;
962 pgContext
->pProfile
= pProfile
;
964 if (0 == GetSystemMetrics(SM_REMOTESESSION
) &&
965 DoAutoLogon(pgContext
))
967 /* User is local and registry contains information
968 * to log on him automatically */
969 *phToken
= pgContext
->UserToken
;
970 return WLX_SAS_ACTION_LOGON
;
973 res
= pGinaUI
->LoggedOutSAS(pgContext
);
974 *phToken
= pgContext
->UserToken
;
986 PGINA_CONTEXT pgContext
= (PGINA_CONTEXT
)pWlxContext
;
988 TRACE("WlxWkstaLockedSAS()\n");
990 UNREFERENCED_PARAMETER(dwSasType
);
992 return pGinaUI
->LockedSAS(pgContext
);
1001 WlxDisplayLockedNotice(PVOID pWlxContext
)
1003 PGINA_CONTEXT pgContext
= (PGINA_CONTEXT
)pWlxContext
;
1005 TRACE("WlxDisplayLockedNotice()\n");
1007 if (pgContext
->bDisableCAD
== TRUE
)
1009 pgContext
->pWlxFuncs
->WlxSasNotify(pgContext
->hWlx
, WLX_SAS_TYPE_CTRL_ALT_DEL
);
1013 pGinaUI
->DisplayLockedNotice(pgContext
);
1024 TRACE("WlxIsLogoffOk()\n");
1025 UNREFERENCED_PARAMETER(pWlxContext
);
1031 IN HINSTANCE hinstDLL
,
1033 IN LPVOID lpvReserved
)
1035 UNREFERENCED_PARAMETER(lpvReserved
);
1037 if (dwReason
== DLL_PROCESS_ATTACH
)
1039 hDllInstance
= hinstDLL
;
1041 RtlAllocateAndInitializeSid(&SystemAuthority
,
1043 SECURITY_BUILTIN_DOMAIN_RID
,
1044 DOMAIN_ALIAS_RID_ADMINS
,
1054 else if (dwReason
== DLL_PROCESS_DETACH
)
1056 if (AdminSid
!= NULL
)
1057 RtlFreeSid(AdminSid
);