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
;
316 pgContext
->nShutdownAction
= WLX_SAS_ACTION_SHUTDOWN_POWER_OFF
;
319 return pGinaUI
->Initialize(pgContext
);
327 WlxScreenSaverNotify(
334 DWORD bufferSize
= sizeof(szBuffer
);
335 DWORD varType
= REG_SZ
;
338 TRACE("(%p %p)\n", pWlxContext
, pSecure
);
344 * HKLM\Software\Policies\Microsoft\Windows\Control Panel\Desktop : ScreenSaverIsSecure
346 * HKCU\Control Panel\Desktop : ScreenSaverIsSecure
349 rc
= RegOpenKeyExW(HKEY_CURRENT_USER
,
350 L
"Control Panel\\Desktop",
354 TRACE("RegOpenKeyExW: %ld\n", rc
);
355 if (rc
== ERROR_SUCCESS
)
357 rc
= RegQueryValueExW(hKey
,
358 L
"ScreenSaverIsSecure",
364 TRACE("RegQueryValueExW: %ld\n", rc
);
366 if (rc
== ERROR_SUCCESS
)
368 TRACE("szBuffer: \"%S\"\n", szBuffer
);
369 *pSecure
= _wtoi(szBuffer
);
375 TRACE("*pSecure: %ld\n", *pSecure
);
389 PWSTR pszDesktopName
,
393 PGINA_CONTEXT pgContext
= (PGINA_CONTEXT
)pWlxContext
;
394 STARTUPINFOW StartupInfo
;
395 PROCESS_INFORMATION ProcessInformation
;
396 WCHAR CurrentDirectory
[MAX_PATH
];
401 len
= GetWindowsDirectoryW(CurrentDirectory
, MAX_PATH
);
402 if (len
== 0 || len
> MAX_PATH
)
404 ERR("GetWindowsDirectoryW() failed\n");
408 ret
= DuplicateTokenEx(pgContext
->UserToken
, MAXIMUM_ALLOWED
, NULL
, SecurityImpersonation
, TokenPrimary
, &hAppToken
);
411 ERR("DuplicateTokenEx() failed with error %lu\n", GetLastError());
415 ZeroMemory(&StartupInfo
, sizeof(StartupInfo
));
416 ZeroMemory(&ProcessInformation
, sizeof(ProcessInformation
));
417 StartupInfo
.cb
= sizeof(StartupInfo
);
418 StartupInfo
.lpTitle
= pszCmdLine
;
419 StartupInfo
.dwFlags
= STARTF_USESHOWWINDOW
;
420 StartupInfo
.wShowWindow
= SW_SHOW
;
421 StartupInfo
.lpDesktop
= pszDesktopName
;
423 len
= GetWindowsDirectoryW(CurrentDirectory
, MAX_PATH
);
424 if (len
== 0 || len
> MAX_PATH
)
426 ERR("GetWindowsDirectoryW() failed\n");
429 ret
= CreateProcessAsUserW(
436 CREATE_UNICODE_ENVIRONMENT
,
440 &ProcessInformation
);
441 CloseHandle(ProcessInformation
.hProcess
);
442 CloseHandle(ProcessInformation
.hThread
);
443 CloseHandle(hAppToken
);
445 ERR("CreateProcessAsUserW() failed with error %lu\n", GetLastError());
453 WlxActivateUserShell(
455 PWSTR pszDesktopName
,
456 PWSTR pszMprLogonScript
,
460 DWORD BufSize
, ValueType
;
461 WCHAR pszUserInitApp
[MAX_PATH
+ 1];
462 WCHAR pszExpUserInitApp
[MAX_PATH
];
466 TRACE("WlxActivateUserShell()\n");
468 UNREFERENCED_PARAMETER(pszMprLogonScript
);
470 /* Get the path of userinit */
473 L
"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon",
477 if (rc
!= ERROR_SUCCESS
)
479 WARN("RegOpenKeyExW() failed with error %lu\n", rc
);
483 /* Query userinit application */
484 BufSize
= sizeof(pszUserInitApp
) - sizeof(UNICODE_NULL
);
485 rc
= RegQueryValueExW(
490 (LPBYTE
)pszUserInitApp
,
493 if (rc
!= ERROR_SUCCESS
|| (ValueType
!= REG_SZ
&& ValueType
!= REG_EXPAND_SZ
))
495 WARN("RegQueryValueExW() failed with error %lu\n", rc
);
498 pszUserInitApp
[MAX_PATH
] = UNICODE_NULL
;
500 len
= ExpandEnvironmentStringsW(pszUserInitApp
, pszExpUserInitApp
, MAX_PATH
);
503 WARN("ExpandEnvironmentStringsW() failed. Required size %lu\n", len
);
507 /* Start userinit app */
508 return WlxStartApplication(pWlxContext
, pszDesktopName
, pEnvironment
, pszExpUserInitApp
);
520 PGINA_CONTEXT pgContext
= (PGINA_CONTEXT
)pWlxContext
;
521 INT SasAction
= WLX_SAS_ACTION_NONE
;
523 TRACE("WlxLoggedOnSAS(0x%lx)\n", dwSasType
);
525 UNREFERENCED_PARAMETER(pReserved
);
529 case WLX_SAS_TYPE_CTRL_ALT_DEL
:
530 case WLX_SAS_TYPE_TIMEOUT
:
532 SasAction
= pGinaUI
->LoggedOnSAS(pgContext
, dwSasType
);
535 case WLX_SAS_TYPE_SC_INSERT
:
537 FIXME("WlxLoggedOnSAS: SasType WLX_SAS_TYPE_SC_INSERT not supported!\n");
540 case WLX_SAS_TYPE_SC_REMOVE
:
542 FIXME("WlxLoggedOnSAS: SasType WLX_SAS_TYPE_SC_REMOVE not supported!\n");
547 WARN("WlxLoggedOnSAS: Unknown SasType: 0x%x\n", dwSasType
);
559 WlxDisplayStatusMessage(
560 IN PVOID pWlxContext
,
566 PGINA_CONTEXT pgContext
= (PGINA_CONTEXT
)pWlxContext
;
568 TRACE("WlxDisplayStatusMessage(\"%S\")\n", pMessage
);
570 return pGinaUI
->DisplayStatusMessage(pgContext
, hDesktop
, dwOptions
, pTitle
, pMessage
);
577 WlxRemoveStatusMessage(
578 IN PVOID pWlxContext
)
580 PGINA_CONTEXT pgContext
= (PGINA_CONTEXT
)pWlxContext
;
582 TRACE("WlxRemoveStatusMessage()\n");
584 return pGinaUI
->RemoveStatusMessage(pgContext
);
588 DuplicationString(PWSTR Str
)
593 if (Str
== NULL
) return NULL
;
595 cb
= (wcslen(Str
) + 1) * sizeof(WCHAR
);
596 if ((NewStr
= LocalAlloc(LMEM_FIXED
, cb
)))
597 memcpy(NewStr
, Str
, cb
);
604 IN PGINA_CONTEXT pgContext
,
609 HANDLE hToken
= NULL
;
610 PTOKEN_GROUPS Groups
= NULL
;
611 BOOL bIsAdmin
= FALSE
;
615 NTSTATUS SubStatus
= STATUS_SUCCESS
;
617 TRACE("(%S %S %S)\n", UserName
, Domain
, Password
);
619 Status
= ConnectToLsa(pgContext
);
620 if (!NT_SUCCESS(Status
))
622 WARN("ConnectToLsa() failed\n");
626 Status
= MyLogonUser(pgContext
->LsaHandle
,
627 pgContext
->AuthenticationPackage
,
631 &pgContext
->UserToken
,
633 if (!NT_SUCCESS(Status
))
635 WARN("MyLogonUser() failed\n");
639 Status
= NtQueryInformationToken(hToken
,
644 if ((Status
!= STATUS_SUCCESS
) && (Status
!= STATUS_BUFFER_TOO_SMALL
))
646 TRACE("NtQueryInformationToken() failed (Status 0x%08lx)\n", Status
);
650 Groups
= HeapAlloc(GetProcessHeap(), 0, Size
);
653 TRACE("HeapAlloc() failed\n");
657 Status
= NtQueryInformationToken(hToken
,
662 if (!NT_SUCCESS(Status
))
664 TRACE("NtQueryInformationToken() failed (Status 0x%08lx)\n", Status
);
668 for (i
= 0; i
< Groups
->GroupCount
; i
++)
670 if (RtlEqualSid(Groups
->Groups
[i
].Sid
, AdminSid
))
672 TRACE("Member of Admins group\n");
680 HeapFree(GetProcessHeap(), 0, Groups
);
691 IN OUT PGINA_CONTEXT pgContext
,
696 LPWSTR ProfilePath
= NULL
;
697 LPWSTR lpEnvironment
= NULL
;
698 TOKEN_STATISTICS Stats
;
699 PWLX_PROFILE_V2_0 pProfile
= NULL
;
700 DWORD cbStats
, cbSize
;
706 Status
= ConnectToLsa(pgContext
);
707 if (!NT_SUCCESS(Status
))
709 WARN("ConnectToLsa() failed\n");
713 Status
= MyLogonUser(pgContext
->LsaHandle
,
714 pgContext
->AuthenticationPackage
,
718 &pgContext
->UserToken
,
720 if (!NT_SUCCESS(Status
))
722 WARN("MyLogonUser() failed\n");
726 /* Store the logon time in the context */
727 GetLocalTime(&pgContext
->LogonTime
);
729 /* Store user and domain in the context */
730 wcscpy(pgContext
->UserName
, UserName
);
731 if (Domain
== NULL
|| wcslen(Domain
) == 0)
734 GetComputerNameW(pgContext
->Domain
, &dwLength
);
738 wcscpy(pgContext
->Domain
, Domain
);
741 /* Get profile path */
743 bResult
= GetProfilesDirectoryW(NULL
, &cbSize
);
744 if (!bResult
&& GetLastError() == ERROR_INSUFFICIENT_BUFFER
)
746 ProfilePath
= HeapAlloc(GetProcessHeap(), 0, cbSize
* sizeof(WCHAR
));
749 WARN("HeapAlloc() failed\n");
752 bResult
= GetProfilesDirectoryW(ProfilePath
, &cbSize
);
756 WARN("GetUserProfileDirectoryW() failed\n");
760 /* Allocate memory for profile */
761 pProfile
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(WLX_PROFILE_V2_0
));
764 WARN("HeapAlloc() failed\n");
767 pProfile
->dwType
= WLX_PROFILE_TYPE_V2_0
;
768 pProfile
->pszProfile
= ProfilePath
;
770 lpEnvironment
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
,
771 (wcslen(pgContext
->Domain
)+ 14 + 1) * sizeof(WCHAR
));
774 WARN("HeapAlloc() failed\n");
778 wsprintfW(lpEnvironment
, L
"LOGONSERVER=\\\\%s", pgContext
->Domain
);
780 pProfile
->pszEnvironment
= lpEnvironment
;
782 if (!GetTokenInformation(pgContext
->UserToken
,
785 sizeof(TOKEN_STATISTICS
),
788 WARN("Couldn't get Authentication id from user token!\n");
792 *pgContext
->pAuthenticationId
= Stats
.AuthenticationId
;
793 pgContext
->pMprNotifyInfo
->pszUserName
= DuplicationString(UserName
);
794 pgContext
->pMprNotifyInfo
->pszDomain
= DuplicationString(Domain
);
795 pgContext
->pMprNotifyInfo
->pszPassword
= DuplicationString(Password
);
796 pgContext
->pMprNotifyInfo
->pszOldPassword
= NULL
;
797 *pgContext
->pdwOptions
= 0;
798 *pgContext
->pProfile
= pProfile
;
804 HeapFree(GetProcessHeap(), 0, pProfile
->pszEnvironment
);
806 HeapFree(GetProcessHeap(), 0, pProfile
);
807 HeapFree(GetProcessHeap(), 0, ProfilePath
);
814 IN PGINA_CONTEXT pgContext
)
816 HKEY WinLogonKey
= NULL
;
817 LPWSTR AutoLogon
= NULL
;
818 LPWSTR AutoCount
= NULL
;
819 LPWSTR IgnoreShiftOverride
= NULL
;
820 LPWSTR UserName
= NULL
;
821 LPWSTR Domain
= NULL
;
822 LPWSTR Password
= NULL
;
826 TRACE("DoAutoLogon(): AutoLogonState = %lu\n",
827 pgContext
->AutoLogonState
);
829 if (pgContext
->AutoLogonState
== AUTOLOGON_DISABLED
)
834 L
"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\WinLogon",
838 if (rc
!= ERROR_SUCCESS
)
841 if (pgContext
->AutoLogonState
== AUTOLOGON_CHECK_REGISTRY
)
843 /* Set it by default to disabled, we might reenable it again later */
844 pgContext
->AutoLogonState
= AUTOLOGON_DISABLED
;
846 rc
= ReadRegSzKey(WinLogonKey
, L
"AutoAdminLogon", &AutoLogon
);
847 if (rc
!= ERROR_SUCCESS
)
849 if (wcscmp(AutoLogon
, L
"1") != 0)
852 rc
= ReadRegSzKey(WinLogonKey
, L
"AutoLogonCount", &AutoCount
);
853 if (rc
== ERROR_SUCCESS
&& wcscmp(AutoCount
, L
"0") == 0)
855 else if (rc
!= ERROR_FILE_NOT_FOUND
)
858 rc
= ReadRegSzKey(WinLogonKey
, L
"IgnoreShiftOverride", &UserName
);
859 if (rc
== ERROR_SUCCESS
)
861 if (wcscmp(AutoLogon
, L
"1") != 0 && GetKeyState(VK_SHIFT
) < 0)
864 else if (GetKeyState(VK_SHIFT
) < 0)
866 /* User pressed SHIFT */
870 pgContext
->AutoLogonState
= AUTOLOGON_ONCE
;
873 else /* pgContext->AutoLogonState == AUTOLOGON_ONCE */
875 pgContext
->AutoLogonState
= AUTOLOGON_DISABLED
;
877 rc
= ReadRegSzKey(WinLogonKey
, L
"DefaultUserName", &UserName
);
878 if (rc
!= ERROR_SUCCESS
)
880 rc
= ReadRegSzKey(WinLogonKey
, L
"DefaultDomain", &Domain
);
881 if (rc
!= ERROR_SUCCESS
&& rc
!= ERROR_FILE_NOT_FOUND
)
883 rc
= ReadRegSzKey(WinLogonKey
, L
"DefaultPassword", &Password
);
884 if (rc
!= ERROR_SUCCESS
)
887 result
= DoLoginTasks(pgContext
, UserName
, Domain
, Password
);
891 ZeroMemory(pgContext
->Password
, 256 * sizeof(WCHAR
));
892 wcscpy(pgContext
->Password
, Password
);
894 NotifyBootConfigStatus(TRUE
);
899 if (WinLogonKey
!= NULL
)
900 RegCloseKey(WinLogonKey
);
901 HeapFree(GetProcessHeap(), 0, AutoLogon
);
902 HeapFree(GetProcessHeap(), 0, AutoCount
);
903 HeapFree(GetProcessHeap(), 0, IgnoreShiftOverride
);
904 HeapFree(GetProcessHeap(), 0, UserName
);
905 HeapFree(GetProcessHeap(), 0, Domain
);
906 HeapFree(GetProcessHeap(), 0, Password
);
907 TRACE("DoAutoLogon(): AutoLogonState = %lu, returning %d\n",
908 pgContext
->AutoLogonState
, result
);
917 IN PVOID pWlxContext
)
919 PGINA_CONTEXT pgContext
= (PGINA_CONTEXT
)pWlxContext
;
921 TRACE("WlxDisplaySASNotice(%p)\n", pWlxContext
);
923 if (GetSystemMetrics(SM_REMOTESESSION
))
925 /* User is remotely logged on. Don't display a notice */
926 pgContext
->pWlxFuncs
->WlxSasNotify(pgContext
->hWlx
, WLX_SAS_TYPE_CTRL_ALT_DEL
);
930 if (pgContext
->bAutoAdminLogon
== TRUE
)
932 /* Don't display the window, we want to do an automatic logon */
933 pgContext
->AutoLogonState
= AUTOLOGON_ONCE
;
934 pgContext
->pWlxFuncs
->WlxSasNotify(pgContext
->hWlx
, WLX_SAS_TYPE_CTRL_ALT_DEL
);
938 pgContext
->AutoLogonState
= AUTOLOGON_DISABLED
;
940 if (pgContext
->bDisableCAD
== TRUE
)
942 pgContext
->pWlxFuncs
->WlxSasNotify(pgContext
->hWlx
, WLX_SAS_TYPE_CTRL_ALT_DEL
);
946 pGinaUI
->DisplaySASNotice(pgContext
);
948 TRACE("WlxDisplaySASNotice() done\n");
956 IN PVOID pWlxContext
,
958 OUT PLUID pAuthenticationId
,
959 IN OUT PSID pLogonSid
,
960 OUT PDWORD pdwOptions
,
962 OUT PWLX_MPR_NOTIFY_INFO pMprNotifyInfo
,
965 PGINA_CONTEXT pgContext
= (PGINA_CONTEXT
)pWlxContext
;
968 TRACE("WlxLoggedOutSAS()\n");
970 UNREFERENCED_PARAMETER(dwSasType
);
971 UNREFERENCED_PARAMETER(pLogonSid
);
973 pgContext
->pAuthenticationId
= pAuthenticationId
;
974 pgContext
->pdwOptions
= pdwOptions
;
975 pgContext
->pMprNotifyInfo
= pMprNotifyInfo
;
976 pgContext
->pProfile
= pProfile
;
978 if (0 == GetSystemMetrics(SM_REMOTESESSION
) &&
979 DoAutoLogon(pgContext
))
981 /* User is local and registry contains information
982 * to log on him automatically */
983 *phToken
= pgContext
->UserToken
;
984 return WLX_SAS_ACTION_LOGON
;
987 res
= pGinaUI
->LoggedOutSAS(pgContext
);
988 *phToken
= pgContext
->UserToken
;
1000 PGINA_CONTEXT pgContext
= (PGINA_CONTEXT
)pWlxContext
;
1002 TRACE("WlxWkstaLockedSAS()\n");
1004 UNREFERENCED_PARAMETER(dwSasType
);
1006 return pGinaUI
->LockedSAS(pgContext
);
1015 WlxDisplayLockedNotice(PVOID pWlxContext
)
1017 PGINA_CONTEXT pgContext
= (PGINA_CONTEXT
)pWlxContext
;
1019 TRACE("WlxDisplayLockedNotice()\n");
1021 if (pgContext
->bDisableCAD
== TRUE
)
1023 pgContext
->pWlxFuncs
->WlxSasNotify(pgContext
->hWlx
, WLX_SAS_TYPE_CTRL_ALT_DEL
);
1027 pGinaUI
->DisplayLockedNotice(pgContext
);
1038 TRACE("WlxIsLogoffOk()\n");
1039 UNREFERENCED_PARAMETER(pWlxContext
);
1045 IN HINSTANCE hinstDLL
,
1047 IN LPVOID lpvReserved
)
1049 UNREFERENCED_PARAMETER(lpvReserved
);
1051 if (dwReason
== DLL_PROCESS_ATTACH
)
1053 hDllInstance
= hinstDLL
;
1055 RtlAllocateAndInitializeSid(&SystemAuthority
,
1057 SECURITY_BUILTIN_DOMAIN_RID
,
1058 DOMAIN_ALIAS_RID_ADMINS
,
1068 else if (dwReason
== DLL_PROCESS_DETACH
)
1070 if (AdminSid
!= NULL
)
1071 RtlFreeSid(AdminSid
);