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
);
601 HANDLE hToken
= NULL
;
602 PTOKEN_GROUPS Groups
= NULL
;
603 BOOL bIsAdmin
= FALSE
;
608 TRACE("(%S %S %S)\n", UserName
, Domain
, Password
);
610 if (!LogonUserW(UserName
,
613 LOGON32_LOGON_INTERACTIVE
,
614 LOGON32_PROVIDER_DEFAULT
,
617 WARN("LogonUserW() failed\n");
621 Status
= NtQueryInformationToken(hToken
,
626 if ((Status
!= STATUS_SUCCESS
) && (Status
!= STATUS_BUFFER_TOO_SMALL
))
628 TRACE("NtQueryInformationToken() failed (Status 0x%08lx)\n", Status
);
632 Groups
= HeapAlloc(GetProcessHeap(), 0, Size
);
635 TRACE("HeapAlloc() failed\n");
639 Status
= NtQueryInformationToken(hToken
,
644 if (!NT_SUCCESS(Status
))
646 TRACE("NtQueryInformationToken() failed (Status 0x%08lx)\n", Status
);
650 for (i
= 0; i
< Groups
->GroupCount
; i
++)
652 if (RtlEqualSid(Groups
->Groups
[i
].Sid
, AdminSid
))
654 TRACE("Member of Admins group\n");
662 HeapFree(GetProcessHeap(), 0, Groups
);
673 IN OUT PGINA_CONTEXT pgContext
,
678 LPWSTR ProfilePath
= NULL
;
679 LPWSTR lpEnvironment
= NULL
;
680 TOKEN_STATISTICS Stats
;
681 PWLX_PROFILE_V2_0 pProfile
= NULL
;
682 DWORD cbStats
, cbSize
;
686 if (!LogonUserW(UserName
, Domain
, Password
,
687 LOGON32_LOGON_INTERACTIVE
,
688 LOGON32_PROVIDER_DEFAULT
,
689 &pgContext
->UserToken
))
691 WARN("LogonUserW() failed\n");
695 /* Store the logon time in the context */
696 GetLocalTime(&pgContext
->LogonTime
);
698 /* Store user and domain in the context */
699 wcscpy(pgContext
->UserName
, UserName
);
700 if (Domain
== NULL
|| wcslen(Domain
) == 0)
703 GetComputerNameW(pgContext
->Domain
, &dwLength
);
707 wcscpy(pgContext
->Domain
, Domain
);
710 /* Get profile path */
712 bResult
= GetProfilesDirectoryW(NULL
, &cbSize
);
713 if (!bResult
&& GetLastError() == ERROR_INSUFFICIENT_BUFFER
)
715 ProfilePath
= HeapAlloc(GetProcessHeap(), 0, cbSize
* sizeof(WCHAR
));
718 WARN("HeapAlloc() failed\n");
721 bResult
= GetProfilesDirectoryW(ProfilePath
, &cbSize
);
725 WARN("GetUserProfileDirectoryW() failed\n");
729 /* Allocate memory for profile */
730 pProfile
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(WLX_PROFILE_V2_0
));
733 WARN("HeapAlloc() failed\n");
736 pProfile
->dwType
= WLX_PROFILE_TYPE_V2_0
;
737 pProfile
->pszProfile
= ProfilePath
;
739 lpEnvironment
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
,
740 (wcslen(pgContext
->Domain
)+ 14 + 1) * sizeof(WCHAR
));
743 WARN("HeapAlloc() failed\n");
747 wsprintfW(lpEnvironment
, L
"LOGONSERVER=\\\\%s", pgContext
->Domain
);
749 pProfile
->pszEnvironment
= lpEnvironment
;
751 if (!GetTokenInformation(pgContext
->UserToken
,
754 sizeof(TOKEN_STATISTICS
),
757 WARN("Couldn't get Authentication id from user token!\n");
761 *pgContext
->pAuthenticationId
= Stats
.AuthenticationId
;
762 pgContext
->pMprNotifyInfo
->pszUserName
= DuplicationString(UserName
);
763 pgContext
->pMprNotifyInfo
->pszDomain
= DuplicationString(Domain
);
764 pgContext
->pMprNotifyInfo
->pszPassword
= DuplicationString(Password
);
765 pgContext
->pMprNotifyInfo
->pszOldPassword
= NULL
;
766 *pgContext
->pdwOptions
= 0;
767 *pgContext
->pProfile
= pProfile
;
773 HeapFree(GetProcessHeap(), 0, pProfile
->pszEnvironment
);
775 HeapFree(GetProcessHeap(), 0, pProfile
);
776 HeapFree(GetProcessHeap(), 0, ProfilePath
);
783 IN PGINA_CONTEXT pgContext
)
785 HKEY WinLogonKey
= NULL
;
786 LPWSTR AutoLogon
= NULL
;
787 LPWSTR AutoCount
= NULL
;
788 LPWSTR IgnoreShiftOverride
= NULL
;
789 LPWSTR UserName
= NULL
;
790 LPWSTR DomainName
= NULL
;
791 LPWSTR Password
= NULL
;
795 TRACE("DoAutoLogon(): AutoLogonState = %lu\n",
796 pgContext
->AutoLogonState
);
798 if (pgContext
->AutoLogonState
== AUTOLOGON_DISABLED
)
803 L
"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\WinLogon",
807 if (rc
!= ERROR_SUCCESS
)
810 if (pgContext
->AutoLogonState
== AUTOLOGON_CHECK_REGISTRY
)
812 /* Set it by default to disabled, we might reenable it again later */
813 pgContext
->AutoLogonState
= AUTOLOGON_DISABLED
;
815 rc
= ReadRegSzKey(WinLogonKey
, L
"AutoAdminLogon", &AutoLogon
);
816 if (rc
!= ERROR_SUCCESS
)
818 if (wcscmp(AutoLogon
, L
"1") != 0)
821 rc
= ReadRegSzKey(WinLogonKey
, L
"AutoLogonCount", &AutoCount
);
822 if (rc
== ERROR_SUCCESS
&& wcscmp(AutoCount
, L
"0") == 0)
824 else if (rc
!= ERROR_FILE_NOT_FOUND
)
827 rc
= ReadRegSzKey(WinLogonKey
, L
"IgnoreShiftOverride", &UserName
);
828 if (rc
== ERROR_SUCCESS
)
830 if (wcscmp(AutoLogon
, L
"1") != 0 && GetKeyState(VK_SHIFT
) < 0)
833 else if (GetKeyState(VK_SHIFT
) < 0)
835 /* User pressed SHIFT */
839 pgContext
->AutoLogonState
= AUTOLOGON_ONCE
;
842 else /* pgContext->AutoLogonState == AUTOLOGON_ONCE */
844 pgContext
->AutoLogonState
= AUTOLOGON_DISABLED
;
846 rc
= ReadRegSzKey(WinLogonKey
, L
"DefaultUserName", &UserName
);
847 if (rc
!= ERROR_SUCCESS
)
849 rc
= ReadRegSzKey(WinLogonKey
, L
"DefaultDomainName", &DomainName
);
850 if (rc
!= ERROR_SUCCESS
&& rc
!= ERROR_FILE_NOT_FOUND
)
852 rc
= ReadRegSzKey(WinLogonKey
, L
"DefaultPassword", &Password
);
853 if (rc
!= ERROR_SUCCESS
)
856 result
= DoLoginTasks(pgContext
, UserName
, DomainName
, Password
);
860 pgContext
->Password
= HeapAlloc(GetProcessHeap(),
862 (wcslen(Password
) + 1) * sizeof(WCHAR
));
863 if (pgContext
->Password
!= NULL
)
864 wcscpy(pgContext
->Password
, Password
);
866 NotifyBootConfigStatus(TRUE
);
871 if (WinLogonKey
!= NULL
)
872 RegCloseKey(WinLogonKey
);
873 HeapFree(GetProcessHeap(), 0, AutoLogon
);
874 HeapFree(GetProcessHeap(), 0, AutoCount
);
875 HeapFree(GetProcessHeap(), 0, IgnoreShiftOverride
);
876 HeapFree(GetProcessHeap(), 0, UserName
);
877 HeapFree(GetProcessHeap(), 0, DomainName
);
878 HeapFree(GetProcessHeap(), 0, Password
);
879 TRACE("DoAutoLogon(): AutoLogonState = %lu, returning %d\n",
880 pgContext
->AutoLogonState
, result
);
889 IN PVOID pWlxContext
)
891 PGINA_CONTEXT pgContext
= (PGINA_CONTEXT
)pWlxContext
;
893 TRACE("WlxDisplaySASNotice(%p)\n", pWlxContext
);
895 if (GetSystemMetrics(SM_REMOTESESSION
))
897 /* User is remotely logged on. Don't display a notice */
898 pgContext
->pWlxFuncs
->WlxSasNotify(pgContext
->hWlx
, WLX_SAS_TYPE_CTRL_ALT_DEL
);
902 if (pgContext
->bAutoAdminLogon
== TRUE
)
904 /* Don't display the window, we want to do an automatic logon */
905 pgContext
->AutoLogonState
= AUTOLOGON_ONCE
;
906 pgContext
->pWlxFuncs
->WlxSasNotify(pgContext
->hWlx
, WLX_SAS_TYPE_CTRL_ALT_DEL
);
910 pgContext
->AutoLogonState
= AUTOLOGON_DISABLED
;
912 if (pgContext
->bDisableCAD
== TRUE
)
914 pgContext
->pWlxFuncs
->WlxSasNotify(pgContext
->hWlx
, WLX_SAS_TYPE_CTRL_ALT_DEL
);
918 pGinaUI
->DisplaySASNotice(pgContext
);
920 TRACE("WlxDisplaySASNotice() done\n");
928 IN PVOID pWlxContext
,
930 OUT PLUID pAuthenticationId
,
931 IN OUT PSID pLogonSid
,
932 OUT PDWORD pdwOptions
,
934 OUT PWLX_MPR_NOTIFY_INFO pMprNotifyInfo
,
937 PGINA_CONTEXT pgContext
= (PGINA_CONTEXT
)pWlxContext
;
940 TRACE("WlxLoggedOutSAS()\n");
942 UNREFERENCED_PARAMETER(dwSasType
);
943 UNREFERENCED_PARAMETER(pLogonSid
);
945 pgContext
->pAuthenticationId
= pAuthenticationId
;
946 pgContext
->pdwOptions
= pdwOptions
;
947 pgContext
->pMprNotifyInfo
= pMprNotifyInfo
;
948 pgContext
->pProfile
= pProfile
;
950 if (0 == GetSystemMetrics(SM_REMOTESESSION
) &&
951 DoAutoLogon(pgContext
))
953 /* User is local and registry contains information
954 * to log on him automatically */
955 *phToken
= pgContext
->UserToken
;
956 return WLX_SAS_ACTION_LOGON
;
959 res
= pGinaUI
->LoggedOutSAS(pgContext
);
960 *phToken
= pgContext
->UserToken
;
972 PGINA_CONTEXT pgContext
= (PGINA_CONTEXT
)pWlxContext
;
974 TRACE("WlxWkstaLockedSAS()\n");
976 UNREFERENCED_PARAMETER(dwSasType
);
978 return pGinaUI
->LockedSAS(pgContext
);
987 WlxDisplayLockedNotice(PVOID pWlxContext
)
989 PGINA_CONTEXT pgContext
= (PGINA_CONTEXT
)pWlxContext
;
991 TRACE("WlxDisplayLockedNotice()\n");
993 if (pgContext
->bDisableCAD
== TRUE
)
995 pgContext
->pWlxFuncs
->WlxSasNotify(pgContext
->hWlx
, WLX_SAS_TYPE_CTRL_ALT_DEL
);
999 pGinaUI
->DisplayLockedNotice(pgContext
);
1010 TRACE("WlxIsLogoffOk()\n");
1011 UNREFERENCED_PARAMETER(pWlxContext
);
1017 IN HINSTANCE hinstDLL
,
1019 IN LPVOID lpvReserved
)
1021 UNREFERENCED_PARAMETER(lpvReserved
);
1023 if (dwReason
== DLL_PROCESS_ATTACH
)
1025 hDllInstance
= hinstDLL
;
1027 RtlAllocateAndInitializeSid(&SystemAuthority
,
1029 SECURITY_BUILTIN_DOMAIN_RID
,
1030 DOMAIN_ALIAS_RID_ADMINS
,
1040 else if (dwReason
== DLL_PROCESS_DETACH
)
1042 if (AdminSid
!= NULL
)
1043 RtlFreeSid(AdminSid
);