ReactOS  0.4.13-dev-73-gcfe54aa
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 
36 extern GINA_UI GinaTextUI;
39 static PSID AdminSid;
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 
59 LONG
61  IN HKEY hKey,
62  IN LPCWSTR pszValue,
63  OUT LPWSTR* pValue)
64 {
65  LONG rc;
66  DWORD dwType;
67  DWORD cbData = 0;
68  LPWSTR Value;
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)
78  return ERROR_FILE_NOT_FOUND;
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 
95 static LONG
97  IN HKEY hKey,
98  IN LPCWSTR pszValue,
99  OUT LPDWORD pValue)
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 
117 static 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 
153 cleanup:
154  if (ConsoleBoot)
155  pGinaUI = &GinaTextUI;
156  else
158 
159  if (ControlKey != NULL)
160  RegCloseKey(ControlKey);
161  HeapFree(GetProcessHeap(), 0, SystemStartOptions);
162 }
163 
164 
165 static
166 BOOL
168 {
169  HKEY hKey = NULL;
170  LPWSTR lpAutoAdminLogon = NULL;
171  LPWSTR lpDontDisplayLastUserName = NULL;
172  LPWSTR lpShutdownWithoutLogon = NULL;
173  LPWSTR lpIgnoreShiftOverride = NULL;
174  DWORD dwDisableCAD = 0;
175  DWORD dwSize;
176  LONG rc;
177 
179  L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon",
180  0,
182  &hKey);
183  if (rc != ERROR_SUCCESS)
184  {
185  WARN("RegOpenKeyExW() failed with error %lu\n", rc);
186  return FALSE;
187  }
188 
189  rc = ReadRegSzValue(hKey,
190  L"AutoAdminLogon",
191  &lpAutoAdminLogon);
192  if (rc == ERROR_SUCCESS)
193  {
194  if (wcscmp(lpAutoAdminLogon, L"1") == 0)
195  pgContext->bAutoAdminLogon = TRUE;
196  }
197 
198  TRACE("bAutoAdminLogon: %s\n", pgContext->bAutoAdminLogon ? "TRUE" : "FALSE");
199 
200  rc = ReadRegDwordValue(hKey,
201  L"DisableCAD",
202  &dwDisableCAD);
203  if (rc == ERROR_SUCCESS)
204  {
205  if (dwDisableCAD != 0)
206  pgContext->bDisableCAD = TRUE;
207  }
208 
209  TRACE("bDisableCAD: %s\n", pgContext->bDisableCAD ? "TRUE" : "FALSE");
210 
211  pgContext->bShutdownWithoutLogon = TRUE;
212  rc = ReadRegSzValue(hKey,
213  L"ShutdownWithoutLogon",
214  &lpShutdownWithoutLogon);
215  if (rc == ERROR_SUCCESS)
216  {
217  if (wcscmp(lpShutdownWithoutLogon, L"0") == 0)
218  pgContext->bShutdownWithoutLogon = FALSE;
219  }
220 
221  rc = ReadRegSzValue(hKey,
222  L"DontDisplayLastUserName",
223  &lpDontDisplayLastUserName);
224  if (rc == ERROR_SUCCESS)
225  {
226  if (wcscmp(lpDontDisplayLastUserName, L"1") == 0)
227  pgContext->bDontDisplayLastUserName = TRUE;
228  }
229 
230  rc = ReadRegSzValue(hKey,
231  L"IgnoreShiftOverride",
232  &lpIgnoreShiftOverride);
233  if (rc == ERROR_SUCCESS)
234  {
235  if (wcscmp(lpIgnoreShiftOverride, L"1") == 0)
236  pgContext->bIgnoreShiftOverride = TRUE;
237  }
238 
239  dwSize = sizeof(pgContext->UserName);
240  rc = RegQueryValueExW(hKey,
241  L"DefaultUserName",
242  NULL,
243  NULL,
244  (LPBYTE)&pgContext->UserName,
245  &dwSize);
246 
247  dwSize = sizeof(pgContext->DomainName);
248  rc = RegQueryValueExW(hKey,
249  L"DefaultDomainName",
250  NULL,
251  NULL,
252  (LPBYTE)&pgContext->DomainName,
253  &dwSize);
254 
255  dwSize = sizeof(pgContext->Password);
256  rc = RegQueryValueExW(hKey,
257  L"DefaultPassword",
258  NULL,
259  NULL,
260  (LPBYTE)&pgContext->Password,
261  &dwSize);
262 
263  if (lpIgnoreShiftOverride != NULL)
264  HeapFree(GetProcessHeap(), 0, lpIgnoreShiftOverride);
265 
266  if (lpShutdownWithoutLogon != NULL)
267  HeapFree(GetProcessHeap(), 0, lpShutdownWithoutLogon);
268 
269  if (lpDontDisplayLastUserName != NULL)
270  HeapFree(GetProcessHeap(), 0, lpDontDisplayLastUserName);
271 
272  if (lpAutoAdminLogon != NULL)
273  HeapFree(GetProcessHeap(), 0, lpAutoAdminLogon);
274 
275  if (hKey != NULL)
276  RegCloseKey(hKey);
277 
278  return TRUE;
279 }
280 
283 
284 static void
286 {
287  HMODULE hDll = LoadLibraryW(L"shsvcs.dll");
288  pThemeWait themeWait;
289  pThemeWatch themeWatch;
290 
291  if(!hDll)
292  return;
293 
294  themeWait = (pThemeWait) GetProcAddress(hDll, (LPCSTR)2);
295  themeWatch = (pThemeWatch) GetProcAddress(hDll, (LPCSTR)1);
296 
297  if(themeWait && themeWatch)
298  {
299  themeWait(5000);
300  themeWatch();
301  }
302 }
303 
304 /*
305  * @implemented
306  */
307 BOOL WINAPI
309  LPWSTR lpWinsta,
310  HANDLE hWlx,
312  PVOID pWinlogonFunctions,
313  PVOID *pWlxContext)
314 {
315  PGINA_CONTEXT pgContext;
316 
318 
320 
322  if(!pgContext)
323  {
324  WARN("LocalAlloc() failed\n");
325  return FALSE;
326  }
327 
328  if (!GetRegistrySettings(pgContext))
329  {
330  WARN("GetRegistrySettings() failed\n");
331  LocalFree(pgContext);
332  return FALSE;
333  }
334 
335  /* Return the context to winlogon */
336  *pWlxContext = (PVOID)pgContext;
337  pgContext->hDllInstance = hDllInstance;
338 
339  /* Save pointer to dispatch table */
340  pgContext->pWlxFuncs = (PWLX_DISPATCH_VERSION_1_3)pWinlogonFunctions;
341 
342  /* Save the winlogon handle used to call the dispatch functions */
343  pgContext->hWlx = hWlx;
344 
345  /* Save window station */
346  pgContext->station = lpWinsta;
347 
348  /* Clear status window handle */
349  pgContext->hStatusWindow = NULL;
350 
351  /* Notify winlogon that we will use the default SAS */
352  pgContext->pWlxFuncs->WlxUseCtrlAltDel(hWlx);
353 
354  /* Locates the authentication package */
355  //LsaRegisterLogonProcess(...);
356 
358 
359  ChooseGinaUI();
360  return pGinaUI->Initialize(pgContext);
361 }
362 
363 /*
364  * @implemented
365  */
366 BOOL
367 WINAPI
369  PVOID pWlxContext,
370  BOOL *pSecure)
371 {
372 #if 0
373  PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext;
374  WCHAR szBuffer[2];
375  HKEY hKeyCurrentUser, hKey;
376  DWORD bufferSize = sizeof(szBuffer);
377  DWORD varType = REG_SZ;
378  LONG rc;
379 
380  TRACE("(%p %p)\n", pWlxContext, pSecure);
381 
382  *pSecure = TRUE;
383 
384  /*
385  * Policy setting:
386  * HKLM\Software\Policies\Microsoft\Windows\Control Panel\Desktop : ScreenSaverIsSecure
387  * User setting:
388  * HKCU\Control Panel\Desktop : ScreenSaverIsSecure
389  */
390 
391  if (!ImpersonateLoggedOnUser(pgContext->UserToken))
392  {
393  ERR("WL: ImpersonateLoggedOnUser() failed with error %lu\n", GetLastError());
394  *pSecure = FALSE;
395  return TRUE;
396  }
397 
398  /* Open the current user HKCU key */
399  rc = RegOpenCurrentUser(MAXIMUM_ALLOWED, &hKeyCurrentUser);
400  TRACE("RegOpenCurrentUser: %ld\n", rc);
401  if (rc == ERROR_SUCCESS)
402  {
403  /* Open the subkey */
404  rc = RegOpenKeyExW(hKeyCurrentUser,
405  L"Control Panel\\Desktop",
406  0,
408  &hKey);
409  TRACE("RegOpenKeyExW: %ld\n", rc);
410  RegCloseKey(hKeyCurrentUser);
411  }
412 
413  /* Read the value */
414  if (rc == ERROR_SUCCESS)
415  {
416  rc = RegQueryValueExW(hKey,
417  L"ScreenSaverIsSecure",
418  NULL,
419  &varType,
420  (LPBYTE)szBuffer,
421  &bufferSize);
422 
423  TRACE("RegQueryValueExW: %ld\n", rc);
424 
425  if (rc == ERROR_SUCCESS)
426  {
427  TRACE("szBuffer: \"%S\"\n", szBuffer);
428  *pSecure = _wtoi(szBuffer);
429  }
430 
431  RegCloseKey(hKey);
432  }
433 
434  /* Revert the impersonation */
435  RevertToSelf();
436 
437  TRACE("*pSecure: %ld\n", *pSecure);
438 #endif
439 
440  *pSecure = FALSE;
441 
442  return TRUE;
443 }
444 
445 /*
446  * @implemented
447  */
448 BOOL WINAPI
450  PVOID pWlxContext,
451  PWSTR pszDesktopName,
452  PVOID pEnvironment,
453  PWSTR pszCmdLine)
454 {
455  PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext;
456  STARTUPINFOW StartupInfo;
457  PROCESS_INFORMATION ProcessInformation;
459  HANDLE hAppToken;
460  UINT len;
461  BOOL ret;
462 
464  if (len == 0 || len > MAX_PATH)
465  {
466  ERR("GetWindowsDirectoryW() failed\n");
467  return FALSE;
468  }
469 
471  if (!ret)
472  {
473  ERR("DuplicateTokenEx() failed with error %lu\n", GetLastError());
474  return FALSE;
475  }
476 
477  ZeroMemory(&StartupInfo, sizeof(StartupInfo));
478  ZeroMemory(&ProcessInformation, sizeof(ProcessInformation));
479  StartupInfo.cb = sizeof(StartupInfo);
480  StartupInfo.lpTitle = pszCmdLine;
481  StartupInfo.dwFlags = STARTF_USESHOWWINDOW;
482  StartupInfo.wShowWindow = SW_SHOW;
483  StartupInfo.lpDesktop = pszDesktopName;
484 
486  if (len == 0 || len > MAX_PATH)
487  {
488  ERR("GetWindowsDirectoryW() failed\n");
489  return FALSE;
490  }
492  hAppToken,
493  pszCmdLine,
494  NULL,
495  NULL,
496  NULL,
497  FALSE,
499  pEnvironment,
501  &StartupInfo,
502  &ProcessInformation);
503  CloseHandle(ProcessInformation.hProcess);
504  CloseHandle(ProcessInformation.hThread);
505  CloseHandle(hAppToken);
506  if (!ret)
507  ERR("CreateProcessAsUserW() failed with error %lu\n", GetLastError());
508  return ret;
509 }
510 
511 /*
512  * @implemented
513  */
514 BOOL WINAPI
516  PVOID pWlxContext,
517  PWSTR pszDesktopName,
518  PWSTR pszMprLogonScript,
519  PVOID pEnvironment)
520 {
521  HKEY hKey;
523  WCHAR pszUserInitApp[MAX_PATH + 1];
524  WCHAR pszExpUserInitApp[MAX_PATH];
525  DWORD len;
526  LONG rc;
527 
528  TRACE("WlxActivateUserShell()\n");
529 
530  UNREFERENCED_PARAMETER(pszMprLogonScript);
531 
532  /* Get the path of userinit */
533  rc = RegOpenKeyExW(
535  L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon",
536  0,
538  &hKey);
539  if (rc != ERROR_SUCCESS)
540  {
541  WARN("RegOpenKeyExW() failed with error %lu\n", rc);
542  return FALSE;
543  }
544 
545  /* Query userinit application */
546  BufSize = sizeof(pszUserInitApp) - sizeof(UNICODE_NULL);
547  rc = RegQueryValueExW(
548  hKey,
549  L"Userinit",
550  NULL,
551  &ValueType,
552  (LPBYTE)pszUserInitApp,
553  &BufSize);
554  RegCloseKey(hKey);
555  if (rc != ERROR_SUCCESS || (ValueType != REG_SZ && ValueType != REG_EXPAND_SZ))
556  {
557  WARN("RegQueryValueExW() failed with error %lu\n", rc);
558  return FALSE;
559  }
560  pszUserInitApp[MAX_PATH] = UNICODE_NULL;
561 
562  len = ExpandEnvironmentStringsW(pszUserInitApp, pszExpUserInitApp, MAX_PATH);
563  if (len > MAX_PATH)
564  {
565  WARN("ExpandEnvironmentStringsW() failed. Required size %lu\n", len);
566  return FALSE;
567  }
568 
569  /* Start userinit app */
570  return WlxStartApplication(pWlxContext, pszDesktopName, pEnvironment, pszExpUserInitApp);
571 }
572 
573 /*
574  * @implemented
575  */
576 int WINAPI
578  PVOID pWlxContext,
579  DWORD dwSasType,
580  PVOID pReserved)
581 {
582  PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext;
583  INT SasAction = WLX_SAS_ACTION_NONE;
584 
585  TRACE("WlxLoggedOnSAS(0x%lx)\n", dwSasType);
586 
587  UNREFERENCED_PARAMETER(pReserved);
588 
589  switch (dwSasType)
590  {
593  {
594  SasAction = pGinaUI->LoggedOnSAS(pgContext, dwSasType);
595  break;
596  }
598  {
599  FIXME("WlxLoggedOnSAS: SasType WLX_SAS_TYPE_SC_INSERT not supported!\n");
600  break;
601  }
603  {
604  FIXME("WlxLoggedOnSAS: SasType WLX_SAS_TYPE_SC_REMOVE not supported!\n");
605  break;
606  }
607  default:
608  {
609  WARN("WlxLoggedOnSAS: Unknown SasType: 0x%x\n", dwSasType);
610  break;
611  }
612  }
613 
614  return SasAction;
615 }
616 
617 /*
618  * @implemented
619  */
620 BOOL WINAPI
622  IN PVOID pWlxContext,
623  IN HDESK hDesktop,
625  IN PWSTR pTitle,
626  IN PWSTR pMessage)
627 {
628  PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext;
629 
630  TRACE("WlxDisplayStatusMessage(\"%S\")\n", pMessage);
631 
632  return pGinaUI->DisplayStatusMessage(pgContext, hDesktop, dwOptions, pTitle, pMessage);
633 }
634 
635 /*
636  * @implemented
637  */
638 BOOL WINAPI
640  IN PVOID pWlxContext)
641 {
642  PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext;
643 
644  TRACE("WlxRemoveStatusMessage()\n");
645 
646  return pGinaUI->RemoveStatusMessage(pgContext);
647 }
648 
649 static PWSTR
651 {
652  DWORD cb;
653  PWSTR NewStr;
654 
655  if (Str == NULL) return NULL;
656 
657  cb = (wcslen(Str) + 1) * sizeof(WCHAR);
658  if ((NewStr = LocalAlloc(LMEM_FIXED, cb)))
659  memcpy(NewStr, Str, cb);
660  return NewStr;
661 }
662 
663 
664 BOOL
666  IN PGINA_CONTEXT pgContext,
667  IN PWSTR UserName,
668  IN PWSTR Domain,
669  IN PWSTR Password)
670 {
671  HANDLE hToken = NULL;
673  BOOL bIsAdmin = FALSE;
674  ULONG Size;
675  ULONG i;
678 
679  TRACE("(%S %S %S)\n", UserName, Domain, Password);
680 
681  Status = ConnectToLsa(pgContext);
682  if (!NT_SUCCESS(Status))
683  {
684  WARN("ConnectToLsa() failed\n");
685  return FALSE;
686  }
687 
688  Status = MyLogonUser(pgContext->LsaHandle,
689  pgContext->AuthenticationPackage,
690  UserName,
691  Domain,
692  Password,
693  &pgContext->UserToken,
694  &SubStatus);
695  if (!NT_SUCCESS(Status))
696  {
697  WARN("MyLogonUser() failed\n");
698  return FALSE;
699  }
700 
702  TokenGroups,
703  NULL,
704  0,
705  &Size);
707  {
708  TRACE("NtQueryInformationToken() failed (Status 0x%08lx)\n", Status);
709  goto done;
710  }
711 
713  if (Groups == NULL)
714  {
715  TRACE("HeapAlloc() failed\n");
716  goto done;
717  }
718 
720  TokenGroups,
721  Groups,
722  Size,
723  &Size);
724  if (!NT_SUCCESS(Status))
725  {
726  TRACE("NtQueryInformationToken() failed (Status 0x%08lx)\n", Status);
727  goto done;
728  }
729 
730  for (i = 0; i < Groups->GroupCount; i++)
731  {
732  if (RtlEqualSid(Groups->Groups[i].Sid, AdminSid))
733  {
734  TRACE("Member of Admins group\n");
735  bIsAdmin = TRUE;
736  break;
737  }
738  }
739 
740 done:
741  if (Groups != NULL)
743 
744  if (hToken != NULL)
745  CloseHandle(hToken);
746 
747  return bIsAdmin;
748 }
749 
750 
751 NTSTATUS
753  IN OUT PGINA_CONTEXT pgContext,
754  IN PWSTR UserName,
755  IN PWSTR Domain,
756  IN PWSTR Password,
758 {
760 
761  Status = ConnectToLsa(pgContext);
762  if (!NT_SUCCESS(Status))
763  {
764  WARN("ConnectToLsa() failed (Status 0x%08lx)\n", Status);
765  return Status;
766  }
767 
768  Status = MyLogonUser(pgContext->LsaHandle,
769  pgContext->AuthenticationPackage,
770  UserName,
771  Domain,
772  Password,
773  &pgContext->UserToken,
774  SubStatus);
775  if (!NT_SUCCESS(Status))
776  {
777  WARN("MyLogonUser() failed (Status 0x%08lx)\n", Status);
778  }
779 
780  return Status;
781 }
782 
783 
784 BOOL
786  IN OUT PGINA_CONTEXT pgContext,
787  IN PWSTR UserName,
788  IN PWSTR Domain,
789  IN PWSTR Password)
790 {
791  LPWSTR ProfilePath = NULL;
792  LPWSTR lpEnvironment = NULL;
793  TOKEN_STATISTICS Stats;
794  PWLX_PROFILE_V2_0 pProfile = NULL;
795  DWORD cbStats, cbSize;
796  DWORD dwLength;
797  BOOL bResult;
798 
799  /* Store the logon time in the context */
800  GetLocalTime(&pgContext->LogonTime);
801 
802  /* Store user and domain in the context */
803  wcscpy(pgContext->UserName, UserName);
804  if (Domain == NULL || wcslen(Domain) == 0)
805  {
806  dwLength = _countof(pgContext->DomainName);
807  GetComputerNameW(pgContext->DomainName, &dwLength);
808  }
809  else
810  {
811  wcscpy(pgContext->DomainName, Domain);
812  }
813 
814  /* Get profile path */
815  cbSize = 0;
816  bResult = GetProfilesDirectoryW(NULL, &cbSize);
817  if (!bResult && GetLastError() == ERROR_INSUFFICIENT_BUFFER)
818  {
819  ProfilePath = HeapAlloc(GetProcessHeap(), 0, cbSize * sizeof(WCHAR));
820  if (!ProfilePath)
821  {
822  WARN("HeapAlloc() failed\n");
823  goto cleanup;
824  }
825  bResult = GetProfilesDirectoryW(ProfilePath, &cbSize);
826  }
827  if (!bResult)
828  {
829  WARN("GetUserProfileDirectoryW() failed\n");
830  goto cleanup;
831  }
832 
833  /* Allocate memory for profile */
835  if (!pProfile)
836  {
837  WARN("HeapAlloc() failed\n");
838  goto cleanup;
839  }
840  pProfile->dwType = WLX_PROFILE_TYPE_V2_0;
841  pProfile->pszProfile = ProfilePath;
842 
843  cbSize = sizeof(L"LOGONSERVER=\\\\") +
844  wcslen(pgContext->DomainName) * sizeof(WCHAR) +
845  sizeof(UNICODE_NULL);
846  lpEnvironment = HeapAlloc(GetProcessHeap(), 0, cbSize);
847  if (!lpEnvironment)
848  {
849  WARN("HeapAlloc() failed\n");
850  goto cleanup;
851  }
852 
853  StringCbPrintfW(lpEnvironment, cbSize, L"LOGONSERVER=\\\\%ls", pgContext->DomainName);
854  ASSERT(wcslen(lpEnvironment) == cbSize / sizeof(WCHAR) - 2);
855  lpEnvironment[cbSize / sizeof(WCHAR) - 1] = UNICODE_NULL;
856 
857  pProfile->pszEnvironment = lpEnvironment;
858 
859  if (!GetTokenInformation(pgContext->UserToken,
861  &Stats,
862  sizeof(Stats),
863  &cbStats))
864  {
865  WARN("Couldn't get Authentication id from user token!\n");
866  goto cleanup;
867  }
868 
869  *pgContext->pAuthenticationId = Stats.AuthenticationId;
870  pgContext->pMprNotifyInfo->pszUserName = DuplicationString(UserName);
871  pgContext->pMprNotifyInfo->pszDomain = DuplicationString(Domain);
872  pgContext->pMprNotifyInfo->pszPassword = DuplicationString(Password);
873  pgContext->pMprNotifyInfo->pszOldPassword = NULL;
874  *pgContext->pdwOptions = 0;
875  *pgContext->pProfile = pProfile;
876  return TRUE;
877 
878 cleanup:
879  if (pProfile)
880  {
881  HeapFree(GetProcessHeap(), 0, pProfile->pszEnvironment);
882  }
883  HeapFree(GetProcessHeap(), 0, pProfile);
884  HeapFree(GetProcessHeap(), 0, ProfilePath);
885  return FALSE;
886 }
887 
888 
889 /*
890  * @implemented
891  */
892 VOID WINAPI
894  IN PVOID pWlxContext)
895 {
896  PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext;
897 
898  TRACE("WlxDisplaySASNotice(%p)\n", pWlxContext);
899 
901  {
902  /* User is remotely logged on. Don't display a notice */
903  pgContext->pWlxFuncs->WlxSasNotify(pgContext->hWlx, WLX_SAS_TYPE_CTRL_ALT_DEL);
904  return;
905  }
906 
907  if (pgContext->bAutoAdminLogon)
908  {
909  if (pgContext->bIgnoreShiftOverride ||
910  (GetKeyState(VK_SHIFT) >= 0))
911  {
912  /* Don't display the window, we want to do an automatic logon */
913  pgContext->pWlxFuncs->WlxSasNotify(pgContext->hWlx, WLX_SAS_TYPE_CTRL_ALT_DEL);
914  return;
915  }
916 
917  pgContext->bAutoAdminLogon = FALSE;
918  }
919 
920  if (pgContext->bDisableCAD)
921  {
922  pgContext->pWlxFuncs->WlxSasNotify(pgContext->hWlx, WLX_SAS_TYPE_CTRL_ALT_DEL);
923  return;
924  }
925 
926  pGinaUI->DisplaySASNotice(pgContext);
927 
928  TRACE("WlxDisplaySASNotice() done\n");
929 }
930 
931 /*
932  * @implemented
933  */
934 INT WINAPI
936  IN PVOID pWlxContext,
937  IN DWORD dwSasType,
938  OUT PLUID pAuthenticationId,
939  IN OUT PSID pLogonSid,
940  OUT PDWORD pdwOptions,
942  OUT PWLX_MPR_NOTIFY_INFO pMprNotifyInfo,
943  OUT PVOID *pProfile)
944 {
945  PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext;
946  INT res;
947 
948  TRACE("WlxLoggedOutSAS()\n");
949 
950  UNREFERENCED_PARAMETER(dwSasType);
951  UNREFERENCED_PARAMETER(pLogonSid);
952 
953  pgContext->pAuthenticationId = pAuthenticationId;
954  pgContext->pdwOptions = pdwOptions;
955  pgContext->pMprNotifyInfo = pMprNotifyInfo;
956  pgContext->pProfile = pProfile;
957 
958 
959  res = pGinaUI->LoggedOutSAS(pgContext);
960  *phToken = pgContext->UserToken;
961  return res;
962 }
963 
964 /*
965  * @implemented
966  */
967 int WINAPI
969  PVOID pWlxContext,
970  DWORD dwSasType)
971 {
972  PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext;
973 
974  TRACE("WlxWkstaLockedSAS()\n");
975 
976  UNREFERENCED_PARAMETER(dwSasType);
977 
978  return pGinaUI->LockedSAS(pgContext);
979 }
980 
981 
982 /*
983  * @implemented
984  */
985 VOID
986 WINAPI
988 {
989  PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext;
990 
991  TRACE("WlxDisplayLockedNotice()\n");
992 
993  if (pgContext->bDisableCAD)
994  {
995  pgContext->pWlxFuncs->WlxSasNotify(pgContext->hWlx, WLX_SAS_TYPE_CTRL_ALT_DEL);
996  return;
997  }
998 
999  pGinaUI->DisplayLockedNotice(pgContext);
1000 }
1001 
1002 
1003 /*
1004  * @implemented
1005  */
1006 BOOL WINAPI
1008  PVOID pWlxContext)
1009 {
1010  TRACE("WlxIsLogoffOk()\n");
1011  UNREFERENCED_PARAMETER(pWlxContext);
1012  return TRUE;
1013 }
1014 
1015 
1016 /*
1017  * @implemented
1018  */
1019 VOID WINAPI
1021  PVOID pWlxContext)
1022 {
1023  PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext;
1024 
1025  TRACE("WlxLogoff(%p)\n", pWlxContext);
1026 
1027  /* Delete the password */
1028  ZeroMemory(pgContext->Password, sizeof(pgContext->Password));
1029 
1030  /* Close the user token */
1031  CloseHandle(pgContext->UserToken);
1032  pgContext->UserToken = NULL;
1033 }
1034 
1035 
1036 /*
1037  * @implemented
1038  */
1039 VOID WINAPI
1041  PVOID pWlxContext,
1042  DWORD ShutdownType)
1043 {
1044  PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext;
1045  NTSTATUS Status;
1046 
1047  TRACE("WlxShutdown(%p %lx)\n", pWlxContext, ShutdownType);
1048 
1049  /* Close the LSA handle */
1050  pgContext->AuthenticationPackage = 0;
1052  if (!NT_SUCCESS(Status))
1053  {
1054  ERR("LsaDeregisterLogonProcess failed (Status 0x%08lx)\n", Status);
1055  }
1056 }
1057 
1058 
1059 BOOL WINAPI
1061  IN HINSTANCE hinstDLL,
1062  IN DWORD dwReason,
1064 {
1066 
1068  {
1069  hDllInstance = hinstDLL;
1070 
1072  2,
1081  &AdminSid);
1082 
1083  }
1084  else if (dwReason == DLL_PROCESS_DETACH)
1085  {
1086  if (AdminSid != NULL)
1088  }
1089 
1090  return TRUE;
1091 }
LUID AuthenticationId
Definition: setypes.h:1033
WCHAR DomainName[256]
Definition: msgina.h:51
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2327
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
* PNTSTATUS
Definition: strlen.c:14
#define MAXIMUM_ALLOWED
Definition: nt_native.h:83
DWORD dwOptions
Definition: solitaire.cpp:23
#define IN
Definition: typedefs.h:38
PFGINA_INITIALIZE Initialize
Definition: msgina.h:74
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
#define WLX_SAS_TYPE_SC_INSERT
Definition: winwlx.h:40
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
PFGINA_DISPLAYLOCKEDNOTICE DisplayLockedNotice
Definition: msgina.h:81
#define ERROR_SUCCESS
Definition: deptool.c:10
VOID WINAPI WlxDisplayLockedNotice(PVOID pWlxContext)
Definition: msgina.c:987
NTSTATUS MyLogonUser(HANDLE LsaHandle, ULONG AuthenticationPackage, LPWSTR lpszUsername, LPWSTR lpszDomain, LPWSTR lpszPassword, PHANDLE phToken, PNTSTATUS SubStatus)
Definition: lsa.c:53
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
GINA_UI GinaGraphicalUI
Definition: gui.c:1557
#define CREATE_UNICODE_ENVIRONMENT
Definition: winbase.h:186
PWLX_USE_CTRL_ALT_DEL WlxUseCtrlAltDel
Definition: winwlx.h:557
WCHAR CurrentDirectory[1024]
Definition: chkdsk.c:74
static PSID AdminSid
Definition: msgina.c:39
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
BOOL WINAPI RevertToSelf(VOID)
Definition: security.c:1487
uint16_t * PWSTR
Definition: typedefs.h:54
BOOL bDontDisplayLastUserName
Definition: msgina.h:43
static BOOL GetRegistrySettings(PGINA_CONTEXT pgContext)
Definition: msgina.c:167
#define _countof(array)
Definition: fontsub.cpp:30
NTSTATUS ConnectToLsa(PGINA_CONTEXT pgContext)
Definition: lsa.c:11
NTSYSAPI PVOID NTAPI RtlFreeSid(_In_ _Post_invalid_ PSID Sid)
_Check_return_ _CRTIMP int __cdecl _wtoi(_In_z_ const wchar_t *_Str)
_In_ PCWSTR _In_z_ PCWSTR _In_ ULONG ValueType
Definition: rtlfuncs.h:4000
#define WARN(fmt,...)
Definition: debug.h:111
LONG NTSTATUS
Definition: precomp.h:26
BOOL bIgnoreShiftOverride
Definition: msgina.h:45
PWLX_DISPATCH_VERSION_1_3 pWlxFuncs
Definition: msgina.h:36
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
BOOL DoAdminUnlock(IN PGINA_CONTEXT pgContext, IN PWSTR UserName, IN PWSTR Domain, IN PWSTR Password)
Definition: msgina.c:665
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ZeroMemory
Definition: winbase.h:1635
int WINAPI WlxLoggedOnSAS(PVOID pWlxContext, DWORD dwSasType, PVOID pReserved)
Definition: msgina.c:577
#define WLX_SAS_TYPE_SC_REMOVE
Definition: winwlx.h:41
#define WLX_SAS_TYPE_TIMEOUT
Definition: winwlx.h:35
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
PWLX_MPR_NOTIFY_INFO pMprNotifyInfo
Definition: msgina.h:57
BOOL WINAPI GetComputerNameW(LPWSTR lpBuffer, LPDWORD lpnSize)
Definition: compname.c:440
TOpcodeData Groups[17][8]
LONG ReadRegSzValue(IN HKEY hKey, IN LPCWSTR pszValue, OUT LPWSTR *pValue)
Definition: msgina.c:60
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 BOOL
Definition: nt_native.h:43
HANDLE hDllInstance
Definition: msgina.h:37
#define DWORD
Definition: nt_native.h:44
int32_t INT
Definition: typedefs.h:56
static void InitThemeSupport(VOID)
Definition: msgina.c:285
static IN DWORD IN LPVOID lpvReserved
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:64
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2351
struct GINA_CONTEXT * PGINA_CONTEXT
BOOL WINAPI WlxIsLogoffOk(PVOID pWlxContext)
Definition: msgina.c:1007
BOOL(WINAPI * pThemeWatch)(void)
Definition: msgina.c:282
ULONG nShutdownAction
Definition: msgina.h:47
DWORD dwReason
Definition: misc.cpp:154
PFGINA_LOCKEDSAS LockedSAS
Definition: msgina.h:80
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
static LONG ReadRegDwordValue(IN HKEY hKey, IN LPCWSTR pszValue, OUT LPDWORD pValue)
Definition: msgina.c:96
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
#define UNICODE_NULL
_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
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
PFGINA_LOGGEDONSAS LoggedOnSAS
Definition: msgina.h:78
#define FIXME(fmt,...)
Definition: debug.h:110
LPWSTR lpDesktop
Definition: winbase.h:819
#define VK_SHIFT
Definition: winuser.h:2156
#define LoadLibraryW(x)
Definition: compat.h:404
smooth NULL
Definition: ftsmooth.c:416
STRSAFEAPI StringCbPrintfW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:557
VOID WINAPI WlxLogoff(PVOID pWlxContext)
Definition: msgina.c:1020
LPWSTR lpTitle
Definition: winbase.h:820
_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)
Definition: token.c:1839
NTSTATUS DoLoginTasks(IN OUT PGINA_CONTEXT pgContext, IN PWSTR UserName, IN PWSTR Domain, IN PWSTR Password, OUT PNTSTATUS SubStatus)
Definition: msgina.c:752
HANDLE LsaHandle
Definition: msgina.h:39
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:276
BOOL WINAPI ImpersonateLoggedOnUser(HANDLE hToken)
Definition: misc.c:152
WCHAR UserName[256]
Definition: msgina.h:50
#define BufSize
Definition: FsRtlTunnel.c:28
const char * LPCSTR
Definition: xmlstorage.h:183
void * PVOID
Definition: retypes.h:9
#define STARTF_USESHOWWINDOW
Definition: winbase.h:472
#define SW_SHOW
Definition: winuser.h:769
BOOL WINAPI GetProfilesDirectoryW(_Out_ LPWSTR lpProfilesDir, _Inout_ LPDWORD lpcchSize)
Definition: profile.c:1493
static PGINA_UI pGinaUI
Definition: msgina.c:37
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define SECURITY_NT_AUTHORITY
Definition: setypes.h:526
PFGINA_DISPLAYSTATUSMESSAGE DisplayStatusMessage
Definition: msgina.h:75
#define DLL_PROCESS_DETACH
Definition: compat.h:119
HWND hStatusWindow
Definition: msgina.h:38
SHORT WINAPI GetKeyState(_In_ int)
#define LMEM_FIXED
Definition: winbase.h:349
BOOL WINAPI WlxStartApplication(PVOID pWlxContext, PWSTR pszDesktopName, PVOID pEnvironment, PWSTR pszCmdLine)
Definition: msgina.c:449
#define TRACE(s)
Definition: solgame.cpp:4
PFGINA_DISPLAYSASNOTICE DisplaySASNotice
Definition: msgina.h:77
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
DWORD cb
Definition: winbase.h:817
#define SECURITY_BUILTIN_DOMAIN_RID
Definition: setypes.h:553
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4134
#define LMEM_ZEROINIT
Definition: winbase.h:356
__wchar_t WCHAR
Definition: xmlstorage.h:180
static DWORD DWORD * dwLength
Definition: fusion.c:83
BOOL bShutdownWithoutLogon
Definition: msgina.h:44
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static LPCSTR DWORD void * pvReserved
Definition: str.c:196
DWORD(WINAPI * pThemeWait)(DWORD dwTimeout)
Definition: msgina.c:281
#define MAX_PATH
Definition: compat.h:26
#define WINAPI
Definition: msvc.h:8
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:935
int WINAPI GetSystemMetrics(_In_ int)
_In_opt_ LPSTR _In_opt_ LPSTR _In_ DWORD _In_ DWORD _Out_opt_ PHANDLE phToken
Definition: winbase.h:2651
unsigned long DWORD
Definition: ntddk_ex.h:95
PFGINA_REMOVESTATUSMESSAGE RemoveStatusMessage
Definition: msgina.h:76
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:3394
static DWORD cb
Definition: integrity.c:41
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
BOOL WINAPI WlxScreenSaverNotify(PVOID pWlxContext, BOOL *pSecure)
Definition: msgina.c:368
#define SECURITY_NULL_RID
Definition: setypes.h:512
PWSTR pszProfile
Definition: winwlx.h:149
ULONG AuthenticationPackage
Definition: msgina.h:40
int ret
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
NTSTATUS NTAPI LsaDeregisterLogonProcess(HANDLE)
static const WCHAR L[]
Definition: oid.c:1250
#define WLX_SAS_ACTION_SHUTDOWN_POWER_OFF
Definition: winwlx.h:62
#define WLX_SAS_TYPE_CTRL_ALT_DEL
Definition: winwlx.h:36
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:414
WORD wShowWindow
Definition: winbase.h:829
VOID WINAPI WlxDisplaySASNotice(IN PVOID pWlxContext)
Definition: msgina.c:893
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
static PWSTR DuplicationString(PWSTR Str)
Definition: msgina.c:650
struct _WLX_DISPATCH_VERSION_1_3 * PWLX_DISPATCH_VERSION_1_3
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
#define wcsicmp
Definition: string.h:1152
BOOL WINAPI WlxNegotiate(IN DWORD dwWinlogonVersion, OUT PDWORD pdwDllVersion)
Definition: msgina.c:45
PVOID * pProfile
Definition: msgina.h:58
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:278
Status
Definition: gdiplustypes.h:24
LPWSTR station
Definition: msgina.h:35
int WINAPI WlxWkstaLockedSAS(PVOID pWlxContext, DWORD dwSasType)
Definition: msgina.c:968
BOOL WINAPI DllMain(IN HINSTANCE hinstDLL, IN DWORD dwReason, IN LPVOID lpvReserved)
Definition: msgina.c:1060
#define ERR(fmt,...)
Definition: debug.h:109
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD dwTimeout
Definition: wincrypt.h:6081
HANDLE hWlx
Definition: msgina.h:34
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
BOOL bAutoAdminLogon
Definition: msgina.h:42
VOID WINAPI WlxShutdown(PVOID pWlxContext, DWORD ShutdownType)
Definition: msgina.c:1040
PFGINA_LOGGEDOUTSAS LoggedOutSAS
Definition: msgina.h:79
PWLX_SAS_NOTIFY WlxSasNotify
Definition: winwlx.h:559
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define WLX_SAS_ACTION_NONE
Definition: winwlx.h:54
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
HANDLE UserToken
Definition: msgina.h:54
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
PLUID pAuthenticationId
Definition: msgina.h:55
PDWORD pdwOptions
Definition: msgina.h:56
BOOL WINAPI WlxInitialize(LPWSTR lpWinsta, HANDLE hWlx, PVOID pvReserved, PVOID pWinlogonFunctions, PVOID *pWlxContext)
Definition: msgina.c:308
unsigned int UINT
Definition: ndis.h:50
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
BOOL WINAPI WlxDisplayStatusMessage(IN PVOID pWlxContext, IN HDESK hDesktop, IN DWORD dwOptions, IN PWSTR pTitle, IN PWSTR pMessage)
Definition: msgina.c:621
DWORD * PDWORD
Definition: pedump.c:68
BOOL WINAPI WlxRemoveStatusMessage(IN PVOID pWlxContext)
Definition: msgina.c:639
GINA_UI GinaTextUI
Definition: tui.c:276
LONG WINAPI RegOpenCurrentUser(IN REGSAM samDesired, OUT PHKEY phkResult)
Definition: reg.c:3247
#define OUT
Definition: typedefs.h:39
GLuint res
Definition: glext.h:9613
uint32_t * LPDWORD
Definition: typedefs.h:57
unsigned int ULONG
Definition: retypes.h:1
BOOL WINAPI GetTokenInformation(HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength)
Definition: security.c:413
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
HINSTANCE hDllInstance
Definition: msgina.c:33
char * cleanup(char *str)
Definition: wpickclick.c:99
#define GetProcAddress(x, y)
Definition: compat.h:410
DWORD dwFlags
Definition: winbase.h:828
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373
static VOID ChooseGinaUI(VOID)
Definition: msgina.c:118
#define SM_REMOTESESSION
Definition: winuser.h:1048
WCHAR * LPWSTR
Definition: xmlstorage.h:184
WCHAR Password[256]
Definition: msgina.h:52
BOOL bDisableCAD
Definition: msgina.h:41
return STATUS_SUCCESS
Definition: btrfs.c:2725
#define REG_DWORD
Definition: sdbapi.c:596
#define DOMAIN_ALIAS_RID_ADMINS
Definition: setypes.h:624
#define WLX_PROFILE_TYPE_V2_0
Definition: winwlx.h:51
PWSTR pszEnvironment
Definition: winwlx.h:153
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define HeapFree(x, y, z)
Definition: compat.h:394
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define WLX_VERSION_1_3
Definition: winwlx.h:31
NTSYSAPI BOOLEAN NTAPI RtlEqualSid(_In_ PSID Sid1, _In_ PSID Sid2)
static char * NextOption(const char *const ostr)
Definition: getopt.c:31
BOOL CreateProfile(IN OUT PGINA_CONTEXT pgContext, IN PWSTR UserName, IN PWSTR Domain, IN PWSTR Password)
Definition: msgina.c:785
BOOL WINAPI WlxActivateUserShell(PVOID pWlxContext, PWSTR pszDesktopName, PWSTR pszMprLogonScript, PVOID pEnvironment)
Definition: msgina.c:515
static SID_IDENTIFIER_AUTHORITY SystemAuthority
Definition: msgina.c:38
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define REG_SZ
Definition: layer.c:22