ReactOS 0.4.16-dev-1163-gec5b142
msgina.c
Go to the documentation of this file.
1/*
2 * ReactOS GINA
3 * Copyright (C) 2003-2004, 2006 ReactOS Team
4 *
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.
9 *
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.
14 *
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.
18 */
19/*
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)
25 */
26
27#include "msgina.h"
28
29#include <winsvc.h>
30#include <userenv.h>
31#include <ndk/sefuncs.h>
32
34
36extern GINA_UI GinaTextUI;
40
41/*
42 * @implemented
43 */
46 IN DWORD dwWinlogonVersion,
47 OUT PDWORD pdwDllVersion)
48{
49 TRACE("WlxNegotiate(%lx, %p)\n", dwWinlogonVersion, pdwDllVersion);
50
51 if(!pdwDllVersion || (dwWinlogonVersion < WLX_VERSION_1_3))
52 return FALSE;
53
54 *pdwDllVersion = WLX_VERSION_1_3;
55
56 return TRUE;
57}
58
59LONG
61 IN HKEY hKey,
62 IN LPCWSTR pszValue,
64{
65 LONG rc;
66 DWORD dwType;
67 DWORD cbData = 0;
69
70 if (!pValue)
72
73 *pValue = NULL;
74 rc = RegQueryValueExW(hKey, pszValue, NULL, &dwType, NULL, &cbData);
75 if (rc != ERROR_SUCCESS)
76 return rc;
77 if (dwType != REG_SZ)
79 Value = HeapAlloc(GetProcessHeap(), 0, cbData + sizeof(WCHAR));
80 if (!Value)
82 rc = RegQueryValueExW(hKey, pszValue, NULL, NULL, (LPBYTE)Value, &cbData);
83 if (rc != ERROR_SUCCESS)
84 {
86 return rc;
87 }
88 /* NULL-terminate the string */
89 Value[cbData / sizeof(WCHAR)] = '\0';
90
91 *pValue = Value;
92 return ERROR_SUCCESS;
93}
94
95static LONG
97 IN HKEY hKey,
98 IN LPCWSTR pszValue,
100{
101 LONG rc;
102 DWORD dwType;
103 DWORD cbData;
104 DWORD dwValue;
105
106 if (!pValue)
108
109 cbData = sizeof(DWORD);
110 rc = RegQueryValueExW(hKey, pszValue, NULL, &dwType, (LPBYTE)&dwValue, &cbData);
111 if (rc == ERROR_SUCCESS && dwType == REG_DWORD)
112 *pValue = dwValue;
113
114 return ERROR_SUCCESS;
115}
116
117static VOID
119{
120 HKEY ControlKey = NULL;
121 LPWSTR SystemStartOptions = NULL;
122 LPWSTR CurrentOption, NextOption; /* Pointers into SystemStartOptions */
123 BOOL ConsoleBoot = FALSE;
124 LONG rc;
125
126 rc = RegOpenKeyExW(
128 L"SYSTEM\\CurrentControlSet\\Control",
129 0,
131 &ControlKey);
132
133 rc = ReadRegSzValue(ControlKey, L"SystemStartOptions", &SystemStartOptions);
134 if (rc != ERROR_SUCCESS)
135 goto cleanup;
136
137 /* Check for CONSOLE switch in SystemStartOptions */
138 CurrentOption = SystemStartOptions;
139 while (CurrentOption)
140 {
141 NextOption = wcschr(CurrentOption, L' ');
142 if (NextOption)
143 *NextOption = L'\0';
144 if (_wcsicmp(CurrentOption, L"CONSOLE") == 0)
145 {
146 TRACE("Found %S. Switching to console boot\n", CurrentOption);
147 ConsoleBoot = TRUE;
148 goto cleanup;
149 }
150 CurrentOption = NextOption ? NextOption + 1 : NULL;
151 }
152
153cleanup:
154 if (ConsoleBoot)
156 else
158
159 if (ControlKey != NULL)
160 RegCloseKey(ControlKey);
161 HeapFree(GetProcessHeap(), 0, SystemStartOptions);
162}
163
164static BOOL
166 _In_ const LSA_UNICODE_STRING *pInput,
167 _Out_ PWSTR pszOutput,
169{
170 HRESULT hr;
171 hr = StringCbCopyNExW(pszOutput, cchMax * sizeof(WCHAR),
172 pInput->Buffer, pInput->Length,
173 NULL, NULL,
175 return (hr == S_OK);
176}
177
178/* Reference: https://learn.microsoft.com/en-us/windows/win32/secauthn/protecting-the-automatic-logon-password */
179static BOOL
181{
182 LSA_HANDLE hPolicy;
185
188 if (!NT_SUCCESS(Status))
189 return FALSE;
190
191 RtlInitUnicodeString(&Name, L"DefaultPassword");
192 Status = LsaRetrievePrivateData(hPolicy, &Name, &pPwd);
193 LsaClose(hPolicy);
194
195 if (Status == STATUS_SUCCESS)
196 {
197 if (!SafeGetUnicodeString(pPwd, pgContext->Password,
198 _countof(pgContext->Password)))
199 {
201 }
202 SecureZeroMemory(pPwd->Buffer, pPwd->Length);
203 LsaFreeMemory(pPwd);
204 }
205
206 return Status == STATUS_SUCCESS;
207}
208
209static
210BOOL
212{
213 HKEY hKey = NULL;
214 LPWSTR lpAutoAdminLogon = NULL;
215 LPWSTR lpDontDisplayLastUserName = NULL;
216 LPWSTR lpShutdownWithoutLogon = NULL;
217 LPWSTR lpIgnoreShiftOverride = NULL;
218 DWORD dwDisableCAD = 0;
220 LONG rc;
221
223 L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon",
224 0,
226 &hKey);
227 if (rc != ERROR_SUCCESS)
228 {
229 WARN("RegOpenKeyExW() failed with error %lu\n", rc);
230 return FALSE;
231 }
232
233 rc = ReadRegSzValue(hKey,
234 L"AutoAdminLogon",
235 &lpAutoAdminLogon);
236 if (rc == ERROR_SUCCESS)
237 {
238 if (wcscmp(lpAutoAdminLogon, L"1") == 0)
239 pgContext->bAutoAdminLogon = TRUE;
240 }
241
242 TRACE("bAutoAdminLogon: %s\n", pgContext->bAutoAdminLogon ? "TRUE" : "FALSE");
243
245 L"DisableCAD",
246 &dwDisableCAD);
247 if (rc == ERROR_SUCCESS)
248 {
249 if (dwDisableCAD != 0)
250 pgContext->bDisableCAD = TRUE;
251 }
252
253 TRACE("bDisableCAD: %s\n", pgContext->bDisableCAD ? "TRUE" : "FALSE");
254
255 pgContext->bShutdownWithoutLogon = TRUE;
256 rc = ReadRegSzValue(hKey,
257 L"ShutdownWithoutLogon",
258 &lpShutdownWithoutLogon);
259 if (rc == ERROR_SUCCESS)
260 {
261 if (wcscmp(lpShutdownWithoutLogon, L"0") == 0)
262 pgContext->bShutdownWithoutLogon = FALSE;
263 }
264
265 rc = ReadRegSzValue(hKey,
266 L"DontDisplayLastUserName",
267 &lpDontDisplayLastUserName);
268 if (rc == ERROR_SUCCESS)
269 {
270 if (wcscmp(lpDontDisplayLastUserName, L"1") == 0)
271 pgContext->bDontDisplayLastUserName = TRUE;
272 }
273
274 rc = ReadRegSzValue(hKey,
275 L"IgnoreShiftOverride",
276 &lpIgnoreShiftOverride);
277 if (rc == ERROR_SUCCESS)
278 {
279 if (wcscmp(lpIgnoreShiftOverride, L"1") == 0)
280 pgContext->bIgnoreShiftOverride = TRUE;
281 }
282
283 dwSize = sizeof(pgContext->UserName);
285 L"DefaultUserName",
286 NULL,
287 NULL,
288 (LPBYTE)&pgContext->UserName,
289 &dwSize);
290
291 dwSize = sizeof(pgContext->DomainName);
293 L"DefaultDomainName",
294 NULL,
295 NULL,
296 (LPBYTE)&pgContext->DomainName,
297 &dwSize);
298
299 dwSize = sizeof(pgContext->Password);
301 L"DefaultPassword",
302 NULL,
303 NULL,
304 (LPBYTE)&pgContext->Password,
305 &dwSize);
306 if (rc)
307 GetLsaDefaultPassword(pgContext);
308
309 if (lpIgnoreShiftOverride != NULL)
310 HeapFree(GetProcessHeap(), 0, lpIgnoreShiftOverride);
311
312 if (lpShutdownWithoutLogon != NULL)
313 HeapFree(GetProcessHeap(), 0, lpShutdownWithoutLogon);
314
315 if (lpDontDisplayLastUserName != NULL)
316 HeapFree(GetProcessHeap(), 0, lpDontDisplayLastUserName);
317
318 if (lpAutoAdminLogon != NULL)
319 HeapFree(GetProcessHeap(), 0, lpAutoAdminLogon);
320
321 if (hKey != NULL)
323
324 return TRUE;
325}
326
329
330static void
332{
333 HMODULE hDll = LoadLibraryW(L"shsvcs.dll");
334 pThemeWait themeWait;
335 pThemeWatch themeWatch;
336
337 if(!hDll)
338 return;
339
340 themeWait = (pThemeWait) GetProcAddress(hDll, (LPCSTR)2);
341 themeWatch = (pThemeWatch) GetProcAddress(hDll, (LPCSTR)1);
342
343 if(themeWait && themeWatch)
344 {
345 themeWait(5000);
346 themeWatch();
347 }
348}
349
350/*
351 * @implemented
352 */
355 LPWSTR lpWinsta,
356 HANDLE hWlx,
358 PVOID pWinlogonFunctions,
359 PVOID *pWlxContext)
360{
361 PGINA_CONTEXT pgContext;
362
364
366
368 if(!pgContext)
369 {
370 WARN("LocalAlloc() failed\n");
371 return FALSE;
372 }
373
374 if (!GetRegistrySettings(pgContext))
375 {
376 WARN("GetRegistrySettings() failed\n");
377 LocalFree(pgContext);
378 return FALSE;
379 }
380
381 /* Return the context to winlogon */
382 *pWlxContext = (PVOID)pgContext;
383 pgContext->hDllInstance = hDllInstance;
384
385 /* Save pointer to dispatch table */
386 pgContext->pWlxFuncs = (PWLX_DISPATCH_VERSION_1_3)pWinlogonFunctions;
387
388 /* Save the winlogon handle used to call the dispatch functions */
389 pgContext->hWlx = hWlx;
390
391 /* Save window station */
392 pgContext->station = lpWinsta;
393
394 /* Clear status window handle */
395 pgContext->hStatusWindow = NULL;
396
397 /* Notify winlogon that we will use the default SAS */
398 pgContext->pWlxFuncs->WlxUseCtrlAltDel(hWlx);
399
400 /* Locates the authentication package */
401 //LsaRegisterLogonProcess(...);
402
404
405 ChooseGinaUI();
406 return pGinaUI->Initialize(pgContext);
407}
408
409/*
410 * @implemented
411 */
412BOOL
413WINAPI
415 PVOID pWlxContext,
416 BOOL *pSecure)
417{
418#if 0
419 PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext;
420 WCHAR szBuffer[2];
421 HKEY hKeyCurrentUser, hKey;
422 DWORD bufferSize = sizeof(szBuffer);
423 DWORD varType = REG_SZ;
424 LONG rc;
425
426 TRACE("(%p %p)\n", pWlxContext, pSecure);
427
428 *pSecure = TRUE;
429
430 /*
431 * Policy setting:
432 * HKLM\Software\Policies\Microsoft\Windows\Control Panel\Desktop : ScreenSaverIsSecure
433 * User setting:
434 * HKCU\Control Panel\Desktop : ScreenSaverIsSecure
435 */
436
437 if (!ImpersonateLoggedOnUser(pgContext->UserToken))
438 {
439 ERR("WL: ImpersonateLoggedOnUser() failed with error %lu\n", GetLastError());
440 *pSecure = FALSE;
441 return TRUE;
442 }
443
444 /* Open the current user HKCU key */
445 rc = RegOpenCurrentUser(MAXIMUM_ALLOWED, &hKeyCurrentUser);
446 TRACE("RegOpenCurrentUser: %ld\n", rc);
447 if (rc == ERROR_SUCCESS)
448 {
449 /* Open the subkey */
450 rc = RegOpenKeyExW(hKeyCurrentUser,
451 L"Control Panel\\Desktop",
452 0,
454 &hKey);
455 TRACE("RegOpenKeyExW: %ld\n", rc);
456 RegCloseKey(hKeyCurrentUser);
457 }
458
459 /* Read the value */
460 if (rc == ERROR_SUCCESS)
461 {
463 L"ScreenSaverIsSecure",
464 NULL,
465 &varType,
466 (LPBYTE)szBuffer,
467 &bufferSize);
468
469 TRACE("RegQueryValueExW: %ld\n", rc);
470
471 if (rc == ERROR_SUCCESS)
472 {
473 TRACE("szBuffer: \"%S\"\n", szBuffer);
474 *pSecure = _wtoi(szBuffer);
475 }
476
478 }
479
480 /* Revert the impersonation */
481 RevertToSelf();
482
483 TRACE("*pSecure: %ld\n", *pSecure);
484#endif
485
486 *pSecure = FALSE;
487
488 return TRUE;
489}
490
491/*
492 * @implemented
493 */
496 PVOID pWlxContext,
497 PWSTR pszDesktopName,
498 PVOID pEnvironment,
499 PWSTR pszCmdLine)
500{
501 PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext;
502 STARTUPINFOW StartupInfo;
503 PROCESS_INFORMATION ProcessInformation;
505 HANDLE hAppToken;
506 UINT len;
507 BOOL ret;
508
510 if (len == 0 || len > MAX_PATH)
511 {
512 ERR("GetWindowsDirectoryW() failed\n");
513 return FALSE;
514 }
515
517 if (!ret)
518 {
519 ERR("DuplicateTokenEx() failed with error %lu\n", GetLastError());
520 return FALSE;
521 }
522
523 ZeroMemory(&StartupInfo, sizeof(StartupInfo));
524 ZeroMemory(&ProcessInformation, sizeof(ProcessInformation));
525 StartupInfo.cb = sizeof(StartupInfo);
526 StartupInfo.lpTitle = pszCmdLine;
527 StartupInfo.dwFlags = STARTF_USESHOWWINDOW;
528 StartupInfo.wShowWindow = SW_SHOW;
529 StartupInfo.lpDesktop = pszDesktopName;
530
532 if (len == 0 || len > MAX_PATH)
533 {
534 ERR("GetWindowsDirectoryW() failed\n");
535 return FALSE;
536 }
538 hAppToken,
539 pszCmdLine,
540 NULL,
541 NULL,
542 NULL,
543 FALSE,
545 pEnvironment,
547 &StartupInfo,
548 &ProcessInformation);
549 CloseHandle(ProcessInformation.hProcess);
550 CloseHandle(ProcessInformation.hThread);
551 CloseHandle(hAppToken);
552 if (!ret)
553 ERR("CreateProcessAsUserW() failed with error %lu\n", GetLastError());
554 return ret;
555}
556
557/*
558 * @implemented
559 */
562 PVOID pWlxContext,
563 PWSTR pszDesktopName,
564 PWSTR pszMprLogonScript,
565 PVOID pEnvironment)
566{
567 HKEY hKey;
569 WCHAR pszUserInitApp[MAX_PATH + 1];
570 WCHAR pszExpUserInitApp[MAX_PATH];
571 DWORD len;
572 LONG rc;
573
574 TRACE("WlxActivateUserShell()\n");
575
576 UNREFERENCED_PARAMETER(pszMprLogonScript);
577
578 /* Get the path of userinit */
579 rc = RegOpenKeyExW(
581 L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon",
582 0,
584 &hKey);
585 if (rc != ERROR_SUCCESS)
586 {
587 WARN("RegOpenKeyExW() failed with error %lu\n", rc);
588 return FALSE;
589 }
590
591 /* Query userinit application */
592 BufSize = sizeof(pszUserInitApp) - sizeof(UNICODE_NULL);
593 rc = RegQueryValueExW(
594 hKey,
595 L"Userinit",
596 NULL,
597 &ValueType,
598 (LPBYTE)pszUserInitApp,
599 &BufSize);
601 if (rc != ERROR_SUCCESS || (ValueType != REG_SZ && ValueType != REG_EXPAND_SZ))
602 {
603 WARN("RegQueryValueExW() failed with error %lu\n", rc);
604 return FALSE;
605 }
606 pszUserInitApp[MAX_PATH] = UNICODE_NULL;
607
608 len = ExpandEnvironmentStringsW(pszUserInitApp, pszExpUserInitApp, MAX_PATH);
609 if (len > MAX_PATH)
610 {
611 WARN("ExpandEnvironmentStringsW() failed. Required size %lu\n", len);
612 return FALSE;
613 }
614
615 /* Start userinit app */
616 return WlxStartApplication(pWlxContext, pszDesktopName, pEnvironment, pszExpUserInitApp);
617}
618
619/*
620 * @implemented
621 */
622int WINAPI
624 PVOID pWlxContext,
625 DWORD dwSasType,
626 PVOID pReserved)
627{
628 PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext;
629 INT SasAction = WLX_SAS_ACTION_NONE;
630
631 TRACE("WlxLoggedOnSAS(0x%lx)\n", dwSasType);
632
633 UNREFERENCED_PARAMETER(pReserved);
634
635 switch (dwSasType)
636 {
639 {
640 SasAction = pGinaUI->LoggedOnSAS(pgContext, dwSasType);
641 break;
642 }
644 {
645 FIXME("WlxLoggedOnSAS: SasType WLX_SAS_TYPE_SC_INSERT not supported!\n");
646 break;
647 }
649 {
650 FIXME("WlxLoggedOnSAS: SasType WLX_SAS_TYPE_SC_REMOVE not supported!\n");
651 break;
652 }
653 default:
654 {
655 WARN("WlxLoggedOnSAS: Unknown SasType: 0x%x\n", dwSasType);
656 break;
657 }
658 }
659
660 return SasAction;
661}
662
663/*
664 * @implemented
665 */
668 IN PVOID pWlxContext,
669 IN HDESK hDesktop,
671 IN PWSTR pTitle,
672 IN PWSTR pMessage)
673{
674 PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext;
675
676 TRACE("WlxDisplayStatusMessage(\"%S\")\n", pMessage);
677
678 return pGinaUI->DisplayStatusMessage(pgContext, hDesktop, dwOptions, pTitle, pMessage);
679}
680
681/*
682 * @implemented
683 */
686 IN PVOID pWlxContext)
687{
688 PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext;
689
690 TRACE("WlxRemoveStatusMessage()\n");
691
692 return pGinaUI->RemoveStatusMessage(pgContext);
693}
694
695static PWSTR
697{
698 DWORD cb;
699 PWSTR NewStr;
700
701 if (Str == NULL) return NULL;
702
703 cb = (wcslen(Str) + 1) * sizeof(WCHAR);
704 if ((NewStr = LocalAlloc(LMEM_FIXED, cb)))
705 memcpy(NewStr, Str, cb);
706 return NewStr;
707}
708
709
710BOOL
712 IN PGINA_CONTEXT pgContext,
713 IN PWSTR UserName,
714 IN PWSTR Domain,
716{
717 HANDLE hToken = NULL;
718 PTOKEN_GROUPS Groups = NULL;
719 BOOL bIsAdmin = FALSE;
720 ULONG Size;
721 ULONG i;
724
725 TRACE("(%S %S %S)\n", UserName, Domain, Password);
726
727 Status = ConnectToLsa(pgContext);
728 if (!NT_SUCCESS(Status))
729 {
730 WARN("ConnectToLsa() failed\n");
731 return FALSE;
732 }
733
734 Status = MyLogonUser(pgContext->LsaHandle,
735 pgContext->AuthenticationPackage,
736 UserName,
737 Domain,
738 Password,
739 &pgContext->UserToken,
740 &SubStatus);
741 if (!NT_SUCCESS(Status))
742 {
743 WARN("MyLogonUser() failed\n");
744 return FALSE;
745 }
746
749 NULL,
750 0,
751 &Size);
753 {
754 TRACE("NtQueryInformationToken() failed (Status 0x%08lx)\n", Status);
755 goto done;
756 }
757
758 Groups = HeapAlloc(GetProcessHeap(), 0, Size);
759 if (Groups == NULL)
760 {
761 TRACE("HeapAlloc() failed\n");
762 goto done;
763 }
764
767 Groups,
768 Size,
769 &Size);
770 if (!NT_SUCCESS(Status))
771 {
772 TRACE("NtQueryInformationToken() failed (Status 0x%08lx)\n", Status);
773 goto done;
774 }
775
776 for (i = 0; i < Groups->GroupCount; i++)
777 {
778 if (RtlEqualSid(Groups->Groups[i].Sid, AdminSid))
779 {
780 TRACE("Member of Admins group\n");
781 bIsAdmin = TRUE;
782 break;
783 }
784 }
785
786done:
787 if (Groups != NULL)
788 HeapFree(GetProcessHeap(), 0, Groups);
789
790 if (hToken != NULL)
791 CloseHandle(hToken);
792
793 return bIsAdmin;
794}
795
796
799 IN OUT PGINA_CONTEXT pgContext,
800 IN PWSTR UserName,
801 IN PWSTR Domain,
804{
806
807 Status = ConnectToLsa(pgContext);
808 if (!NT_SUCCESS(Status))
809 {
810 WARN("ConnectToLsa() failed (Status 0x%08lx)\n", Status);
811 return Status;
812 }
813
814 Status = MyLogonUser(pgContext->LsaHandle,
815 pgContext->AuthenticationPackage,
816 UserName,
817 Domain,
818 Password,
819 &pgContext->UserToken,
820 SubStatus);
821 if (!NT_SUCCESS(Status))
822 {
823 WARN("MyLogonUser() failed (Status 0x%08lx)\n", Status);
824 }
825
826 return Status;
827}
828
829
830BOOL
832 IN OUT PGINA_CONTEXT pgContext,
833 IN PWSTR UserName,
834 IN PWSTR Domain,
836{
837 LPWSTR ProfilePath = NULL;
838 LPWSTR lpEnvironment = NULL;
839 TOKEN_STATISTICS Stats;
840 PWLX_PROFILE_V2_0 pProfile = NULL;
841 DWORD cbStats, cbSize;
843 BOOL bResult;
844
845 /* Store the logon time in the context */
846 GetLocalTime(&pgContext->LogonTime);
847
848 /* Store user and domain in the context */
849 wcscpy(pgContext->UserName, UserName);
850 if (Domain == NULL || wcslen(Domain) == 0)
851 {
852 dwLength = _countof(pgContext->DomainName);
853 GetComputerNameW(pgContext->DomainName, &dwLength);
854 }
855 else
856 {
857 wcscpy(pgContext->DomainName, Domain);
858 }
859
860 /* Get profile path */
861 cbSize = 0;
862 bResult = GetProfilesDirectoryW(NULL, &cbSize);
863 if (!bResult && GetLastError() == ERROR_INSUFFICIENT_BUFFER)
864 {
865 ProfilePath = HeapAlloc(GetProcessHeap(), 0, cbSize * sizeof(WCHAR));
866 if (!ProfilePath)
867 {
868 WARN("HeapAlloc() failed\n");
869 goto cleanup;
870 }
871 bResult = GetProfilesDirectoryW(ProfilePath, &cbSize);
872 }
873 if (!bResult)
874 {
875 WARN("GetUserProfileDirectoryW() failed\n");
876 goto cleanup;
877 }
878
879 /* Allocate memory for profile */
881 if (!pProfile)
882 {
883 WARN("HeapAlloc() failed\n");
884 goto cleanup;
885 }
886 pProfile->dwType = WLX_PROFILE_TYPE_V2_0;
887 pProfile->pszProfile = ProfilePath;
888
889 cbSize = sizeof(L"LOGONSERVER=\\\\") +
890 wcslen(pgContext->DomainName) * sizeof(WCHAR) +
891 sizeof(UNICODE_NULL);
892 lpEnvironment = HeapAlloc(GetProcessHeap(), 0, cbSize);
893 if (!lpEnvironment)
894 {
895 WARN("HeapAlloc() failed\n");
896 goto cleanup;
897 }
898
899 StringCbPrintfW(lpEnvironment, cbSize, L"LOGONSERVER=\\\\%ls", pgContext->DomainName);
900 ASSERT(wcslen(lpEnvironment) == cbSize / sizeof(WCHAR) - 2);
901 lpEnvironment[cbSize / sizeof(WCHAR) - 1] = UNICODE_NULL;
902
903 pProfile->pszEnvironment = lpEnvironment;
904
905 if (!GetTokenInformation(pgContext->UserToken,
907 &Stats,
908 sizeof(Stats),
909 &cbStats))
910 {
911 WARN("Couldn't get Authentication id from user token!\n");
912 goto cleanup;
913 }
914
915 *pgContext->pAuthenticationId = Stats.AuthenticationId;
916 pgContext->pMprNotifyInfo->pszUserName = DuplicationString(UserName);
917 pgContext->pMprNotifyInfo->pszDomain = DuplicationString(Domain);
918 pgContext->pMprNotifyInfo->pszPassword = DuplicationString(Password);
919 pgContext->pMprNotifyInfo->pszOldPassword = NULL;
920 *pgContext->pdwOptions = 0;
921 *pgContext->pProfile = pProfile;
922 return TRUE;
923
924cleanup:
925 if (pProfile)
926 {
927 HeapFree(GetProcessHeap(), 0, pProfile->pszEnvironment);
928 }
929 HeapFree(GetProcessHeap(), 0, pProfile);
930 HeapFree(GetProcessHeap(), 0, ProfilePath);
931 return FALSE;
932}
933
934
935/*
936 * @implemented
937 */
940 IN PVOID pWlxContext)
941{
942 PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext;
943
944 TRACE("WlxDisplaySASNotice(%p)\n", pWlxContext);
945
947 {
948 /* User is remotely logged on. Don't display a notice */
949 pgContext->pWlxFuncs->WlxSasNotify(pgContext->hWlx, WLX_SAS_TYPE_CTRL_ALT_DEL);
950 return;
951 }
952
953 if (pgContext->bAutoAdminLogon)
954 {
955 if (pgContext->bIgnoreShiftOverride ||
956 (GetKeyState(VK_SHIFT) >= 0))
957 {
958 /* Don't display the window, we want to do an automatic logon */
959 pgContext->pWlxFuncs->WlxSasNotify(pgContext->hWlx, WLX_SAS_TYPE_CTRL_ALT_DEL);
960 return;
961 }
962
963 pgContext->bAutoAdminLogon = FALSE;
964 }
965
966 if (pgContext->bDisableCAD)
967 {
968 pgContext->pWlxFuncs->WlxSasNotify(pgContext->hWlx, WLX_SAS_TYPE_CTRL_ALT_DEL);
969 return;
970 }
971
972 pGinaUI->DisplaySASNotice(pgContext);
973
974 TRACE("WlxDisplaySASNotice() done\n");
975}
976
977/*
978 * @implemented
979 */
982 IN PVOID pWlxContext,
983 IN DWORD dwSasType,
984 OUT PLUID pAuthenticationId,
985 IN OUT PSID pLogonSid,
986 OUT PDWORD pdwOptions,
988 OUT PWLX_MPR_NOTIFY_INFO pMprNotifyInfo,
989 OUT PVOID *pProfile)
990{
991 PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext;
992 INT res;
993
994 TRACE("WlxLoggedOutSAS()\n");
995
996 UNREFERENCED_PARAMETER(dwSasType);
997 UNREFERENCED_PARAMETER(pLogonSid);
998
999 pgContext->pAuthenticationId = pAuthenticationId;
1000 pgContext->pdwOptions = pdwOptions;
1001 pgContext->pMprNotifyInfo = pMprNotifyInfo;
1002 pgContext->pProfile = pProfile;
1003
1004
1005 res = pGinaUI->LoggedOutSAS(pgContext);
1006 *phToken = pgContext->UserToken;
1007 return res;
1008}
1009
1010/*
1011 * @implemented
1012 */
1013int WINAPI
1015 PVOID pWlxContext,
1016 DWORD dwSasType)
1017{
1018 PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext;
1019
1020 TRACE("WlxWkstaLockedSAS()\n");
1021
1022 UNREFERENCED_PARAMETER(dwSasType);
1023
1024 return pGinaUI->LockedSAS(pgContext);
1025}
1026
1027
1028/*
1029 * @implemented
1030 */
1031VOID
1032WINAPI
1034{
1035 PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext;
1036
1037 TRACE("WlxDisplayLockedNotice()\n");
1038
1039 if (pgContext->bDisableCAD)
1040 {
1041 pgContext->pWlxFuncs->WlxSasNotify(pgContext->hWlx, WLX_SAS_TYPE_CTRL_ALT_DEL);
1042 return;
1043 }
1044
1045 pGinaUI->DisplayLockedNotice(pgContext);
1046}
1047
1048
1049/*
1050 * @implemented
1051 */
1054 PVOID pWlxContext)
1055{
1056 TRACE("WlxIsLogoffOk()\n");
1057 UNREFERENCED_PARAMETER(pWlxContext);
1058 return TRUE;
1059}
1060
1061
1062/*
1063 * @implemented
1064 */
1067 PVOID pWlxContext)
1068{
1069 PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext;
1070
1071 TRACE("WlxLogoff(%p)\n", pWlxContext);
1072
1073 /* Delete the password */
1074 ZeroMemory(pgContext->Password, sizeof(pgContext->Password));
1075
1076 /* Close the user token */
1077 CloseHandle(pgContext->UserToken);
1078 pgContext->UserToken = NULL;
1079}
1080
1081
1082/*
1083 * @implemented
1084 */
1087 PVOID pWlxContext,
1088 DWORD ShutdownType)
1089{
1090 PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext;
1092
1093 TRACE("WlxShutdown(%p %lx)\n", pWlxContext, ShutdownType);
1094
1095 /* Close the LSA handle */
1096 pgContext->AuthenticationPackage = 0;
1098 if (!NT_SUCCESS(Status))
1099 {
1100 ERR("LsaDeregisterLogonProcess failed (Status 0x%08lx)\n", Status);
1101 }
1102}
1103
1104
1107 IN HINSTANCE hinstDLL,
1110{
1112
1114 {
1115 hDllInstance = hinstDLL;
1116
1118 2,
1127 &AdminSid);
1128
1129 }
1130 else if (dwReason == DLL_PROCESS_DETACH)
1131 {
1132 if (AdminSid != NULL)
1134 }
1135
1136 return TRUE;
1137}
#define BufSize
Definition: FsRtlTunnel.c:28
UINT cchMax
LONG NTSTATUS
Definition: precomp.h:26
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
DWORD dwReason
Definition: misc.cpp:135
WCHAR CurrentDirectory[1024]
Definition: chkdsk.c:74
#define RegCloseKey(hKey)
Definition: registry.h:49
BOOL WINAPI GetComputerNameW(LPWSTR lpBuffer, LPDWORD lpnSize)
Definition: compname.c:446
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
wcscpy
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define ERROR_SUCCESS
Definition: deptool.c:10
LPWSTR Name
Definition: desk.c:124
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessAsUserW(_In_opt_ HANDLE hToken, _In_opt_ LPCWSTR lpApplicationName, _Inout_opt_ LPWSTR lpCommandLine, _In_opt_ LPSECURITY_ATTRIBUTES lpProcessAttributes, _In_opt_ LPSECURITY_ATTRIBUTES lpThreadAttributes, _In_ BOOL bInheritHandles, _In_ DWORD dwCreationFlags, _In_opt_ LPVOID lpEnvironment, _In_opt_ LPCWSTR lpCurrentDirectory, _In_ LPSTARTUPINFOW lpStartupInfo, _Out_ LPPROCESS_INFORMATION lpProcessInformation)
Definition: logon.c:993
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LONG WINAPI RegOpenCurrentUser(IN REGSAM samDesired, OUT PHKEY phkResult)
Definition: reg.c:3209
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
NTSTATUS WINAPI LsaOpenPolicy(IN PLSA_UNICODE_STRING SystemName OPTIONAL, IN PLSA_OBJECT_ATTRIBUTES ObjectAttributes, IN ACCESS_MASK DesiredAccess, OUT PLSA_HANDLE PolicyHandle)
Definition: lsa.c:1183
NTSTATUS WINAPI LsaFreeMemory(IN PVOID Buffer)
Definition: lsa.c:701
NTSTATUS WINAPI LsaRetrievePrivateData(IN LSA_HANDLE PolicyHandle, IN PLSA_UNICODE_STRING KeyName, OUT PLSA_UNICODE_STRING *PrivateData)
Definition: lsa.c:1814
NTSTATUS WINAPI LsaClose(IN LSA_HANDLE ObjectHandle)
Definition: lsa.c:194
BOOL WINAPI ImpersonateLoggedOnUser(HANDLE hToken)
Definition: misc.c:152
BOOL WINAPI GetTokenInformation(HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength)
Definition: security.c:411
BOOL WINAPI DuplicateTokenEx(IN HANDLE ExistingTokenHandle, IN DWORD dwDesiredAccess, IN LPSECURITY_ATTRIBUTES lpTokenAttributes OPTIONAL, IN SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, IN TOKEN_TYPE TokenType, OUT PHANDLE DuplicateTokenHandle)
Definition: security.c:3859
#define CloseHandle
Definition: compat.h:739
#define wcschr
Definition: compat.h:17
#define GetProcessHeap()
Definition: compat.h:736
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define DLL_PROCESS_DETACH
Definition: compat.h:130
#define GetProcAddress(x, y)
Definition: compat.h:753
#define HeapAlloc
Definition: compat.h:733
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define LoadLibraryW(x)
Definition: compat.h:747
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
static DWORD DWORD * dwLength
Definition: fusion.c:86
static void cleanup(void)
Definition: main.c:1335
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2352
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:286
NTSTATUS MyLogonUser(HANDLE LsaHandle, ULONG AuthenticationPackage, LPWSTR lpszUsername, LPWSTR lpszDomain, LPWSTR lpszPassword, PHANDLE phToken, PNTSTATUS SubStatus)
Definition: lsa.c:55
NTSTATUS ConnectToLsa(PGINA_CONTEXT pgContext)
Definition: lsa.c:11
BOOL WINAPI GetProfilesDirectoryW(_Out_ LPWSTR lpProfilesDir, _Inout_ LPDWORD lpcchSize)
Definition: profile.c:1576
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
PWCHAR pValue
size_t bufferSize
Status
Definition: gdiplustypes.h:25
GLuint res
Definition: glext.h:9613
GLenum GLsizei len
Definition: glext.h:6722
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1390
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
_Check_return_ _CRTIMP int __cdecl _wtoi(_In_z_ const wchar_t *_Str)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define S_OK
Definition: intsafe.h:52
#define REG_SZ
Definition: layer.c:22
static IN DWORD IN LPVOID lpvReserved
@ SecurityImpersonation
Definition: lsa.idl:57
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ASSERT(a)
Definition: mode.c:44
static char * NextOption(const char *const ostr)
Definition: getopt.c:31
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
@ TokenPrimary
Definition: imports.h:273
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
* PNTSTATUS
Definition: strlen.c:14
static LPCSTR DWORD void * pvReserved
Definition: str.c:196
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33
BOOL WINAPI WlxNegotiate(IN DWORD dwWinlogonVersion, OUT PDWORD pdwDllVersion)
Definition: msgina.c:45
static SID_IDENTIFIER_AUTHORITY SystemAuthority
Definition: msgina.c:38
static PWSTR DuplicationString(PWSTR Str)
Definition: msgina.c:696
VOID WINAPI WlxDisplaySASNotice(IN PVOID pWlxContext)
Definition: msgina.c:939
BOOL WINAPI WlxIsLogoffOk(PVOID pWlxContext)
Definition: msgina.c:1053
BOOL WINAPI WlxInitialize(LPWSTR lpWinsta, HANDLE hWlx, PVOID pvReserved, PVOID pWinlogonFunctions, PVOID *pWlxContext)
Definition: msgina.c:354
static BOOL GetLsaDefaultPassword(_Inout_ PGINA_CONTEXT pgContext)
Definition: msgina.c:180
static BOOL GetRegistrySettings(PGINA_CONTEXT pgContext)
Definition: msgina.c:211
static VOID ChooseGinaUI(VOID)
Definition: msgina.c:118
LONG ReadRegSzValue(IN HKEY hKey, IN LPCWSTR pszValue, OUT LPWSTR *pValue)
Definition: msgina.c:60
BOOL WINAPI WlxActivateUserShell(PVOID pWlxContext, PWSTR pszDesktopName, PWSTR pszMprLogonScript, PVOID pEnvironment)
Definition: msgina.c:561
int WINAPI WlxLoggedOnSAS(PVOID pWlxContext, DWORD dwSasType, PVOID pReserved)
Definition: msgina.c:623
DWORD(WINAPI * pThemeWait)(DWORD dwTimeout)
Definition: msgina.c:327
BOOL CreateProfile(IN OUT PGINA_CONTEXT pgContext, IN PWSTR UserName, IN PWSTR Domain, IN PWSTR Password)
Definition: msgina.c:831
BOOL WINAPI DllMain(IN HINSTANCE hinstDLL, IN DWORD dwReason, IN LPVOID lpvReserved)
Definition: msgina.c:1106
VOID WINAPI WlxDisplayLockedNotice(PVOID pWlxContext)
Definition: msgina.c:1033
INT WINAPI WlxLoggedOutSAS(IN PVOID pWlxContext, IN DWORD dwSasType, OUT PLUID pAuthenticationId, IN OUT PSID pLogonSid, OUT PDWORD pdwOptions, OUT PHANDLE phToken, OUT PWLX_MPR_NOTIFY_INFO pMprNotifyInfo, OUT PVOID *pProfile)
Definition: msgina.c:981
static BOOL SafeGetUnicodeString(_In_ const LSA_UNICODE_STRING *pInput, _Out_ PWSTR pszOutput, _In_ SIZE_T cchMax)
Definition: msgina.c:165
GINA_UI GinaTextUI
Definition: tui.c:276
static void InitThemeSupport(VOID)
Definition: msgina.c:331
BOOL WINAPI WlxScreenSaverNotify(PVOID pWlxContext, BOOL *pSecure)
Definition: msgina.c:414
GINA_UI GinaGraphicalUI
Definition: gui.c:1720
VOID WINAPI WlxLogoff(PVOID pWlxContext)
Definition: msgina.c:1066
BOOL(WINAPI * pThemeWatch)(void)
Definition: msgina.c:328
VOID WINAPI WlxShutdown(PVOID pWlxContext, DWORD ShutdownType)
Definition: msgina.c:1086
BOOL WINAPI WlxRemoveStatusMessage(IN PVOID pWlxContext)
Definition: msgina.c:685
static LONG ReadRegDwordValue(IN HKEY hKey, IN LPCWSTR pszValue, OUT LPDWORD pValue)
Definition: msgina.c:96
BOOL DoAdminUnlock(IN PGINA_CONTEXT pgContext, IN PWSTR UserName, IN PWSTR Domain, IN PWSTR Password)
Definition: msgina.c:711
static PGINA_UI pGinaUI
Definition: msgina.c:37
static PSID AdminSid
Definition: msgina.c:39
NTSTATUS DoLoginTasks(IN OUT PGINA_CONTEXT pgContext, IN PWSTR UserName, IN PWSTR Domain, IN PWSTR Password, OUT PNTSTATUS SubStatus)
Definition: msgina.c:798
int WINAPI WlxWkstaLockedSAS(PVOID pWlxContext, DWORD dwSasType)
Definition: msgina.c:1014
BOOL WINAPI WlxStartApplication(PVOID pWlxContext, PWSTR pszDesktopName, PVOID pEnvironment, PWSTR pszCmdLine)
Definition: msgina.c:495
HINSTANCE hDllInstance
Definition: msgina.c:33
BOOL WINAPI WlxDisplayStatusMessage(IN PVOID pWlxContext, IN HDESK hDesktop, IN DWORD dwOptions, IN PWSTR pTitle, IN PWSTR pMessage)
Definition: msgina.c:667
struct GINA_CONTEXT * PGINA_CONTEXT
unsigned int UINT
Definition: ndis.h:50
NTSYSAPI PVOID NTAPI RtlFreeSid(_In_ _Post_invalid_ PSID Sid)
NTSYSAPI BOOLEAN NTAPI RtlEqualSid(_In_ PSID Sid1, _In_ PSID Sid2)
#define _Inout_
Definition: no_sal2.h:162
#define _Out_
Definition: no_sal2.h:160
#define _In_
Definition: no_sal2.h:158
#define BOOL
Definition: nt_native.h:43
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define DWORD
Definition: nt_native.h:44
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
#define MAXIMUM_ALLOWED
Definition: nt_native.h:83
#define UNICODE_NULL
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329
_IRQL_requires_same_ _In_ PLSA_STRING _In_ SECURITY_LOGON_TYPE _In_ ULONG _In_ ULONG _In_opt_ PTOKEN_GROUPS _In_ PTOKEN_SOURCE _Out_ PVOID _Out_ PULONG _Inout_ PLUID _Out_ PHANDLE _Out_ PQUOTA_LIMITS _Out_ PNTSTATUS SubStatus
NTSYSAPI NTSTATUS NTAPI RtlAllocateAndInitializeSid(IN PSID_IDENTIFIER_AUTHORITY IdentifierAuthority, IN UCHAR SubAuthorityCount, IN ULONG SubAuthority0, IN ULONG SubAuthority1, IN ULONG SubAuthority2, IN ULONG SubAuthority3, IN ULONG SubAuthority4, IN ULONG SubAuthority5, IN ULONG SubAuthority6, IN ULONG SubAuthority7, OUT PSID *Sid)
Definition: sid.c:290
#define POLICY_GET_PRIVATE_INFORMATION
Definition: ntsecapi.h:63
NTSTATUS NTAPI LsaDeregisterLogonProcess(HANDLE)
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:455
#define STRSAFE_NULL_ON_FAILURE
Definition: ntstrsafe.h:34
#define STRSAFE_NO_TRUNCATION
Definition: ntstrsafe.h:35
#define L(x)
Definition: ntvdm.h:50
DWORD * PDWORD
Definition: pedump.c:68
long LONG
Definition: pedump.c:60
#define REG_DWORD
Definition: sdbapi.c:596
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
HRESULT hr
Definition: shlfolder.c:183
#define _countof(array)
Definition: sndvol32.h:70
#define TRACE(s)
Definition: solgame.cpp:4
DWORD dwOptions
Definition: solitaire.cpp:25
STRSAFEAPI StringCbPrintfW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:557
STRSAFEAPI StringCbCopyNExW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc, size_t cbToCopy, STRSAFE_LPWSTR *ppszDestEnd, size_t *pcbRemaining, STRSAFE_DWORD dwFlags)
Definition: strsafe.h:299
BOOL bAutoAdminLogon
Definition: msgina.h:42
HANDLE LsaHandle
Definition: msgina.h:39
LPWSTR station
Definition: msgina.h:35
PLUID pAuthenticationId
Definition: msgina.h:55
WCHAR DomainName[256]
Definition: msgina.h:51
BOOL bIgnoreShiftOverride
Definition: msgina.h:45
BOOL bDontDisplayLastUserName
Definition: msgina.h:43
BOOL bShutdownWithoutLogon
Definition: msgina.h:44
HANDLE UserToken
Definition: msgina.h:54
BOOL bDisableCAD
Definition: msgina.h:41
HWND hStatusWindow
Definition: msgina.h:38
WCHAR UserName[256]
Definition: msgina.h:50
ULONG AuthenticationPackage
Definition: msgina.h:40
ULONG nShutdownAction
Definition: msgina.h:47
PVOID * pProfile
Definition: msgina.h:58
HANDLE hWlx
Definition: msgina.h:34
PWLX_MPR_NOTIFY_INFO pMprNotifyInfo
Definition: msgina.h:57
HANDLE hDllInstance
Definition: msgina.h:37
PWLX_DISPATCH_VERSION_1_3 pWlxFuncs
Definition: msgina.h:36
WCHAR Password[256]
Definition: msgina.h:52
PDWORD pdwOptions
Definition: msgina.h:56
PFGINA_LOGGEDOUTSAS LoggedOutSAS
Definition: msgina.h:79
PFGINA_LOCKEDSAS LockedSAS
Definition: msgina.h:80
PFGINA_DISPLAYLOCKEDNOTICE DisplayLockedNotice
Definition: msgina.h:81
PFGINA_DISPLAYSASNOTICE DisplaySASNotice
Definition: msgina.h:77
PFGINA_LOGGEDONSAS LoggedOnSAS
Definition: msgina.h:78
PFGINA_REMOVESTATUSMESSAGE RemoveStatusMessage
Definition: msgina.h:76
PFGINA_DISPLAYSTATUSMESSAGE DisplayStatusMessage
Definition: msgina.h:75
PFGINA_INITIALIZE Initialize
Definition: msgina.h:74
LPWSTR lpDesktop
Definition: winbase.h:880
DWORD cb
Definition: winbase.h:878
DWORD dwFlags
Definition: winbase.h:889
LPWSTR lpTitle
Definition: winbase.h:881
WORD wShowWindow
Definition: winbase.h:890
SID_AND_ATTRIBUTES Groups[ANYSIZE_ARRAY]
Definition: setypes.h:1018
$ULONG GroupCount
Definition: setypes.h:1014
LUID AuthenticationId
Definition: setypes.h:1087
PWLX_SAS_NOTIFY WlxSasNotify
Definition: winwlx.h:559
PWLX_USE_CTRL_ALT_DEL WlxUseCtrlAltDel
Definition: winwlx.h:557
PWSTR pszEnvironment
Definition: winwlx.h:153
PWSTR pszProfile
Definition: winwlx.h:149
@ Password
Definition: telnetd.h:65
_Must_inspect_result_ __kernel_entry NTSTATUS NTAPI NtQueryInformationToken(_In_ HANDLE TokenHandle, _In_ TOKEN_INFORMATION_CLASS TokenInformationClass, _Out_writes_bytes_to_opt_(TokenInformationLength, *ReturnLength) PVOID TokenInformation, _In_ ULONG TokenInformationLength, _Out_ PULONG ReturnLength)
Queries a specific type of information in regard of an access token based upon the information class....
Definition: tokencls.c:473
uint16_t * PWSTR
Definition: typedefs.h:56
unsigned char * LPBYTE
Definition: typedefs.h:53
void * PVOID
Definition: typedefs.h:50
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint32_t * LPDWORD
Definition: typedefs.h:59
int32_t INT
Definition: typedefs.h:58
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
int ret
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _In_ ULONG _Out_opt_ PULONG _Out_opt_ PULONG ValueType
Definition: wdfregistry.h:282
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413
#define ZeroMemory
Definition: winbase.h:1744
#define LMEM_ZEROINIT
Definition: winbase.h:402
#define SecureZeroMemory
Definition: winbase.h:1745
_In_opt_ LPSTR _In_opt_ LPSTR _In_ DWORD _In_ DWORD _Out_opt_ PHANDLE phToken
Definition: winbase.h:2747
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define STARTF_USESHOWWINDOW
Definition: winbase.h:518
#define CREATE_UNICODE_ENVIRONMENT
Definition: winbase.h:190
#define LMEM_FIXED
Definition: winbase.h:395
BOOL WINAPI RevertToSelf(void)
Definition: security.c:1608
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD dwTimeout
Definition: wincrypt.h:6081
#define WINAPI
Definition: msvc.h:6
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define VK_SHIFT
Definition: winuser.h:2213
#define SW_SHOW
Definition: winuser.h:786
#define SM_REMOTESESSION
Definition: winuser.h:1069
int WINAPI GetSystemMetrics(_In_ int)
SHORT WINAPI GetKeyState(_In_ int)
#define WLX_SAS_TYPE_TIMEOUT
Definition: winwlx.h:35
#define WLX_SAS_ACTION_NONE
Definition: winwlx.h:54
#define WLX_SAS_TYPE_CTRL_ALT_DEL
Definition: winwlx.h:36
#define WLX_PROFILE_TYPE_V2_0
Definition: winwlx.h:51
struct _WLX_DISPATCH_VERSION_1_3 * PWLX_DISPATCH_VERSION_1_3
#define WLX_SAS_ACTION_SHUTDOWN_POWER_OFF
Definition: winwlx.h:62
#define WLX_VERSION_1_3
Definition: winwlx.h:31
#define WLX_SAS_TYPE_SC_INSERT
Definition: winwlx.h:40
#define WLX_SAS_TYPE_SC_REMOVE
Definition: winwlx.h:41
#define SECURITY_BUILTIN_DOMAIN_RID
Definition: setypes.h:581
#define SECURITY_NULL_RID
Definition: setypes.h:540
#define SECURITY_NT_AUTHORITY
Definition: setypes.h:554
@ TokenStatistics
Definition: setypes.h:975
@ TokenGroups
Definition: setypes.h:967
#define DOMAIN_ALIAS_RID_ADMINS
Definition: setypes.h:652
const char * LPCSTR
Definition: xmlstorage.h:183
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185