ReactOS 0.4.17-dev-243-g1369312
userinit.c
Go to the documentation of this file.
1/*
2 * ReactOS applications
3 * Copyright (C) 2001, 2002 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 * COPYRIGHT: See COPYING in the top level directory
21 * PROJECT: ReactOS Userinit Logon Application
22 * FILE: base/system/userinit/userinit.c
23 * PROGRAMMERS: Thomas Weidenmueller (w3seek@users.sourceforge.net)
24 * Hervé Poussineau (hpoussin@reactos.org)
25 */
26
27#include "userinit.h"
28#include <userenv.h>
29
30#define CMP_MAGIC 0x01234567
31
32/* GLOBALS ******************************************************************/
33
35
36/* FUNCTIONS ****************************************************************/
37
38LONG
40 IN HKEY hKey,
41 IN LPCWSTR pszKey,
43{
44 LONG rc;
45 DWORD dwType;
46 DWORD cbData = 0;
48
49 rc = RegQueryValueExW(hKey, pszKey, NULL, &dwType, NULL, &cbData);
50 if (rc != ERROR_SUCCESS)
51 {
52 WARN("RegQueryValueEx(%s) failed with error %lu\n", debugstr_w(pszKey), rc);
53 return rc;
54 }
55 if (dwType != REG_SZ)
56 {
57 WARN("Wrong registry data type (%u vs %u)\n", dwType, REG_SZ);
59 }
60 Value = (WCHAR*) HeapAlloc(GetProcessHeap(), 0, cbData + sizeof(WCHAR));
61 if (!Value)
62 {
63 WARN("No memory\n");
65 }
66 rc = RegQueryValueExW(hKey, pszKey, NULL, NULL, (LPBYTE)Value, &cbData);
67 if (rc != ERROR_SUCCESS)
68 {
69 WARN("RegQueryValueEx(%s) failed with error %lu\n", debugstr_w(pszKey), rc);
71 return rc;
72 }
73 /* NULL-terminate the string */
74 Value[cbData / sizeof(WCHAR)] = L'\0';
75
76 *pValue = Value;
77 return ERROR_SUCCESS;
78}
79
80static BOOL
82{
83 HKEY ControlKey = NULL;
84 LPWSTR SystemStartOptions = NULL;
85 LPWSTR CurrentOption, NextOption; /* Pointers into SystemStartOptions */
86 LONG rc;
87 BOOL ret = FALSE;
88
89 rc = RegOpenKeyEx(
92 0,
94 &ControlKey);
95 if (rc != ERROR_SUCCESS)
96 {
97 WARN("RegOpenKeyEx() failed with error %lu\n", rc);
98 goto cleanup;
99 }
100
101 rc = ReadRegSzKey(ControlKey, L"SystemStartOptions", &SystemStartOptions);
102 if (rc != ERROR_SUCCESS)
103 {
104 WARN("ReadRegSzKey() failed with error %lu\n", rc);
105 goto cleanup;
106 }
107
108 /* Check for CONSOLE switch in SystemStartOptions */
109 CurrentOption = SystemStartOptions;
110 while (CurrentOption)
111 {
112 NextOption = wcschr(CurrentOption, L' ');
113 if (NextOption)
114 *NextOption = L'\0';
115 if (_wcsicmp(CurrentOption, L"CONSOLE") == 0)
116 {
117 TRACE("Found 'CONSOLE' boot option\n");
118 ret = TRUE;
119 goto cleanup;
120 }
121 CurrentOption = NextOption ? NextOption + 1 : NULL;
122 }
123
124cleanup:
125 if (ControlKey != NULL)
126 RegCloseKey(ControlKey);
127 HeapFree(GetProcessHeap(), 0, SystemStartOptions);
128
129 TRACE("IsConsoleShell() returning %u\n", ret);
130 return ret;
131}
132
133static BOOL
135 OUT WCHAR *CommandLine, /* must be at least MAX_PATH long */
136 IN HKEY hRootKey)
137{
138 HKEY hKey;
139 DWORD Type, Size;
141 BOOL ConsoleShell = IsConsoleShell();
142 LONG rc;
143
144 rc = RegOpenKeyExW(hRootKey, L"Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon",
145 0, KEY_QUERY_VALUE, &hKey);
146 if (rc != ERROR_SUCCESS)
147 {
148 WARN("RegOpenKeyEx() failed with error %lu\n", rc);
149 return FALSE;
150 }
151
152 Size = sizeof(Shell);
154 ConsoleShell ? L"ConsoleShell" : L"Shell",
155 NULL,
156 &Type,
157 (LPBYTE)Shell,
158 &Size);
160
161 if (rc != ERROR_SUCCESS)
162 {
163 WARN("RegQueryValueEx() failed with error %lu\n", rc);
164 return FALSE;
165 }
166
167 if ((Type == REG_SZ) || (Type == REG_EXPAND_SZ))
168 {
169 TRACE("Found command line %s\n", debugstr_w(Shell));
170 wcscpy(CommandLine, Shell);
171 return TRUE;
172 }
173 else
174 {
175 WARN("Wrong type %lu (expected %u or %u)\n", Type, REG_SZ, REG_EXPAND_SZ);
176 return FALSE;
177 }
178}
179
180static BOOL
182 _In_ PCWSTR CommandLine,
183 _In_opt_ PVOID pEnvironment)
184{
187 WCHAR ExpandedCmdLine[MAX_PATH];
188
189 ExpandEnvironmentStringsW(CommandLine, ExpandedCmdLine, ARRAYSIZE(ExpandedCmdLine));
190
191 ZeroMemory(&si, sizeof(si));
192 si.cb = sizeof(si);
193 si.dwFlags = STARTF_USESHOWWINDOW;
194 si.wShowWindow = SW_SHOWNORMAL;
195 ZeroMemory(&pi, sizeof(pi));
196
197 if (!CreateProcessW(NULL,
198 ExpandedCmdLine,
199 NULL,
200 NULL,
201 FALSE,
203 pEnvironment,
204 NULL,
205 &si,
206 &pi))
207 {
208 WARN("CreateProcessW() failed with error %lu\n", GetLastError());
209 return FALSE;
210 }
211
214 return TRUE;
215}
216
217static BOOL
219 _In_opt_ PVOID pEnvironment)
220{
221 DWORD Type, Size;
222 DWORD Value = 0;
223 LONG rc;
224 HKEY hKey;
227
228 /* Safe Mode shell run */
230 L"SYSTEM\\CurrentControlSet\\Control\\SafeBoot\\Option",
231 0, KEY_QUERY_VALUE, &hKey);
232 if (rc == ERROR_SUCCESS)
233 {
234 Size = sizeof(Value);
235 rc = RegQueryValueExW(hKey, L"UseAlternateShell", NULL,
236 &Type, (LPBYTE)&Value, &Size);
238
239 if (rc == ERROR_SUCCESS)
240 {
241 if (Type == REG_DWORD)
242 {
243 if (Value)
244 {
245 /* Safe Mode Alternate Shell required */
247 L"SYSTEM\\CurrentControlSet\\Control\\SafeBoot",
248 0, KEY_READ, &hKey);
249 if (rc == ERROR_SUCCESS)
250 {
251 Size = sizeof(Shell);
252 rc = RegQueryValueExW(hKey, L"AlternateShell", NULL,
253 &Type, (LPBYTE)Shell, &Size);
255
256 if (rc == ERROR_SUCCESS)
257 {
258 if ((Type == REG_SZ) || (Type == REG_EXPAND_SZ))
259 {
260 TRACE("Key located - %s\n", debugstr_w(Shell));
261
262 /* Try to run alternate shell */
263 if (StartProcess(Shell, pEnvironment))
264 {
265 TRACE("Alternate shell started (Safe Mode)\n");
266 return TRUE;
267 }
268 }
269 else
270 {
271 WARN("Wrong type %lu (expected %u or %u)\n",
273 }
274 }
275 else
276 {
277 WARN("Alternate shell in Safe Mode required but not specified.\n");
278 }
279 }
280 }
281 }
282 else
283 {
284 WARN("Wrong type %lu (expected %u)\n", Type, REG_DWORD);
285 }
286 }
287 }
288
289 /* Try to run shell in user key */
290 if (GetShell(Shell, HKEY_CURRENT_USER) && StartProcess(Shell, pEnvironment))
291 {
292 TRACE("Started shell from HKEY_CURRENT_USER\n");
293 return TRUE;
294 }
295
296 /* Try to run shell in local machine key */
297 if (GetShell(Shell, HKEY_LOCAL_MACHINE) && StartProcess(Shell, pEnvironment))
298 {
299 TRACE("Started shell from HKEY_LOCAL_MACHINE\n");
300 return TRUE;
301 }
302
303 /* Try default shell */
304 if (IsConsoleShell())
305 {
309 StringCchCatW(Shell, ARRAYSIZE(Shell), L"cmd.exe");
310 }
311 else
312 {
316 StringCchCatW(Shell, ARRAYSIZE(Shell), L"explorer.exe");
317 }
318
319 if (StartProcess(Shell, pEnvironment))
320 return TRUE;
321
322 /* We failed, display an error message and quit */
323 ERR("Failed to start default shell '%s'\n", debugstr_w(Shell));
325 MessageBoxW(NULL, szMsg, NULL, MB_OK);
326 return FALSE;
327}
328
329const WCHAR g_RegColorNames[][32] = {
330 L"Scrollbar", /* 00 = COLOR_SCROLLBAR */
331 L"Background", /* 01 = COLOR_DESKTOP */
332 L"ActiveTitle", /* 02 = COLOR_ACTIVECAPTION */
333 L"InactiveTitle", /* 03 = COLOR_INACTIVECAPTION */
334 L"Menu", /* 04 = COLOR_MENU */
335 L"Window", /* 05 = COLOR_WINDOW */
336 L"WindowFrame", /* 06 = COLOR_WINDOWFRAME */
337 L"MenuText", /* 07 = COLOR_MENUTEXT */
338 L"WindowText", /* 08 = COLOR_WINDOWTEXT */
339 L"TitleText", /* 09 = COLOR_CAPTIONTEXT */
340 L"ActiveBorder", /* 10 = COLOR_ACTIVEBORDER */
341 L"InactiveBorder", /* 11 = COLOR_INACTIVEBORDER */
342 L"AppWorkSpace", /* 12 = COLOR_APPWORKSPACE */
343 L"Hilight", /* 13 = COLOR_HIGHLIGHT */
344 L"HilightText", /* 14 = COLOR_HIGHLIGHTTEXT */
345 L"ButtonFace", /* 15 = COLOR_BTNFACE */
346 L"ButtonShadow", /* 16 = COLOR_BTNSHADOW */
347 L"GrayText", /* 17 = COLOR_GRAYTEXT */
348 L"ButtonText", /* 18 = COLOR_BTNTEXT */
349 L"InactiveTitleText", /* 19 = COLOR_INACTIVECAPTIONTEXT */
350 L"ButtonHilight", /* 20 = COLOR_BTNHIGHLIGHT */
351 L"ButtonDkShadow", /* 21 = COLOR_3DDKSHADOW */
352 L"ButtonLight", /* 22 = COLOR_3DLIGHT */
353 L"InfoText", /* 23 = COLOR_INFOTEXT */
354 L"InfoWindow", /* 24 = COLOR_INFOBK */
355 L"ButtonAlternateFace", /* 25 = COLOR_ALTERNATEBTNFACE */
356 L"HotTrackingColor", /* 26 = COLOR_HOTLIGHT */
357 L"GradientActiveTitle", /* 27 = COLOR_GRADIENTACTIVECAPTION */
358 L"GradientInactiveTitle", /* 28 = COLOR_GRADIENTINACTIVECAPTION */
359 L"MenuHilight", /* 29 = COLOR_MENUHILIGHT */
360 L"MenuBar" /* 30 = COLOR_MENUBAR */
361};
362
363static COLORREF
365 IN LPWSTR lpszCol)
366{
367 BYTE rgb[3];
368
369 rgb[0] = (BYTE)wcstoul(lpszCol, &lpszCol, 10);
370 rgb[1] = (BYTE)wcstoul(lpszCol, &lpszCol, 10);
371 rgb[2] = (BYTE)wcstoul(lpszCol, &lpszCol, 10);
372 return RGB(rgb[0], rgb[1], rgb[2]);
373}
374
375static VOID
377{
378 HKEY hKey;
379 INT i;
380 WCHAR szColor[25];
381 DWORD Type, Size;
382 COLORREF crColor;
383 LONG rc;
384
386 0, KEY_QUERY_VALUE, &hKey);
387 if (rc != ERROR_SUCCESS)
388 {
389 WARN("RegOpenKeyEx() failed with error %lu\n", rc);
390 return;
391 }
392
393 for (i = 0; i < ARRAYSIZE(g_RegColorNames); i++)
394 {
395 Size = sizeof(szColor);
397 (LPBYTE)szColor, &Size);
398 if (rc == ERROR_SUCCESS && Type == REG_SZ)
399 {
400 crColor = StrToColorref(szColor);
401 SetSysColors(1, &i, &crColor);
402 }
403 else
404 {
405 WARN("RegQueryValueEx(%s) failed with error %lu\n",
407 }
408 }
409
411}
412
413static VOID
415{
416 HKEY hKey;
417 DWORD Type, Size;
418 WCHAR szWallpaper[MAX_PATH + 1];
419 LONG rc;
420
422 0, KEY_QUERY_VALUE, &hKey);
423 if (rc != ERROR_SUCCESS)
424 {
425 WARN("RegOpenKeyEx() failed with error %lu\n", rc);
426 return;
427 }
428
429 Size = sizeof(szWallpaper);
431 L"Wallpaper",
432 NULL,
433 &Type,
434 (LPBYTE)szWallpaper,
435 &Size);
437
438 if (rc == ERROR_SUCCESS && Type == REG_SZ)
439 {
440 ExpandEnvironmentStringsW(szWallpaper, szWallpaper, ARRAYSIZE(szWallpaper));
441 TRACE("Using wallpaper %s\n", debugstr_w(szWallpaper));
442
443 /* Load and change the wallpaper */
445 }
446 else
447 {
448 /* Remove the wallpaper */
449 TRACE("No wallpaper set in registry (error %lu)\n", rc);
451 }
452}
453
454static VOID
456{
460}
461
463
464static VOID
466{
469
470 hModule = LoadLibraryW(L"setupapi.dll");
471 if (!hModule)
472 {
473 WARN("LoadLibrary() failed with error %lu\n", GetLastError());
474 return;
475 }
476
480 else
481 WARN("GetProcAddress() failed\n");
482
484}
485
486/*
487 * Expands the path for the ReactOS Installer "reactos.exe".
488 * See also base/setup/welcome/welcome.c!ExpandInstallerPath()
489 */
490BOOL
492 IN LPCWSTR lpInstallerName,
493 OUT LPWSTR lpInstallerPath,
494 IN SIZE_T PathSize)
495{
496 SYSTEM_INFO SystemInfo;
497 SIZE_T cchInstallerNameLen;
498 PWSTR ptr;
499 DWORD dwAttribs;
500
501 cchInstallerNameLen = wcslen(lpInstallerName);
502 if (PathSize < cchInstallerNameLen)
503 {
504 /* The buffer is not large enough to contain the installer file name */
505 *lpInstallerPath = UNICODE_NULL;
506 return FALSE;
507 }
508
509 /*
510 * First, try to find the installer using the default drive, under
511 * the directory whose name corresponds to the currently-running
512 * CPU architecture.
513 */
514 GetSystemInfo(&SystemInfo);
515
516 *lpInstallerPath = UNICODE_NULL;
517 /* Alternatively one can use SharedUserData->NtSystemRoot */
518 GetSystemWindowsDirectoryW(lpInstallerPath, PathSize - cchInstallerNameLen - 1);
519 ptr = wcschr(lpInstallerPath, L'\\');
520 if (ptr)
521 *++ptr = UNICODE_NULL;
522 else
523 *lpInstallerPath = UNICODE_NULL;
524
525 /* Append the corresponding CPU architecture */
526 switch (SystemInfo.wProcessorArchitecture)
527 {
529 StringCchCatW(lpInstallerPath, PathSize, L"I386");
530 break;
531
533 StringCchCatW(lpInstallerPath, PathSize, L"MIPS");
534 break;
535
537 StringCchCatW(lpInstallerPath, PathSize, L"ALPHA");
538 break;
539
541 StringCchCatW(lpInstallerPath, PathSize, L"PPC");
542 break;
543
545 StringCchCatW(lpInstallerPath, PathSize, L"SHX");
546 break;
547
549 StringCchCatW(lpInstallerPath, PathSize, L"ARM");
550 break;
551
553 StringCchCatW(lpInstallerPath, PathSize, L"IA64");
554 break;
555
557 StringCchCatW(lpInstallerPath, PathSize, L"ALPHA64");
558 break;
559
561 StringCchCatW(lpInstallerPath, PathSize, L"AMD64");
562 break;
563
564 // case PROCESSOR_ARCHITECTURE_MSIL: /* .NET CPU-independent code */
566 default:
567 WARN("Unknown processor architecture %lu\n", SystemInfo.wProcessorArchitecture);
569 break;
570 }
571
573 StringCchCatW(lpInstallerPath, PathSize, L"\\");
574 StringCchCatW(lpInstallerPath, PathSize, lpInstallerName);
575
576 dwAttribs = GetFileAttributesW(lpInstallerPath);
577 if ((dwAttribs != INVALID_FILE_ATTRIBUTES) &&
578 !(dwAttribs & FILE_ATTRIBUTE_DIRECTORY))
579 {
580 /* We have found the installer */
581 return TRUE;
582 }
583
584 WARN("Couldn't find the installer '%s', trying alternative.\n", debugstr_w(lpInstallerPath));
585
586 /*
587 * We failed. Try to find the installer from either the current
588 * ReactOS installation directory, or from our current directory.
589 */
590 *lpInstallerPath = UNICODE_NULL;
591 /* Alternatively one can use SharedUserData->NtSystemRoot */
592 if (GetSystemWindowsDirectoryW(lpInstallerPath, PathSize - cchInstallerNameLen - 1))
593 StringCchCatW(lpInstallerPath, PathSize, L"\\");
594 StringCchCatW(lpInstallerPath, PathSize, lpInstallerName);
595
596 dwAttribs = GetFileAttributesW(lpInstallerPath);
597 if ((dwAttribs != INVALID_FILE_ATTRIBUTES) &&
598 !(dwAttribs & FILE_ATTRIBUTE_DIRECTORY))
599 {
600 /* We have found the installer */
601 return TRUE;
602 }
603
604 /* Installer not found */
605 ERR("Couldn't find the installer '%s'\n", debugstr_w(lpInstallerPath));
606 *lpInstallerPath = UNICODE_NULL;
607 return FALSE;
608}
609
610static BOOL
611StartInstaller(IN LPCWSTR lpInstallerName)
612{
613 WCHAR Installer[MAX_PATH];
615
616 if (ExpandInstallerPath(lpInstallerName, Installer, ARRAYSIZE(Installer)))
617 {
618 /* We have found the installer */
619 if (StartProcess(Installer, NULL))
620 return TRUE;
621 }
622
623 /* We failed, display an error message and quit */
624 ERR("Failed to start the installer '%s'\n", debugstr_w(Installer));
626 MessageBoxW(NULL, szMsg, NULL, MB_OK);
627 return FALSE;
628}
629
630/* Used to get the shutdown privilege */
631static BOOL
632EnablePrivilege(LPCWSTR lpszPrivilegeName, BOOL bEnablePrivilege)
633{
635 HANDLE hToken;
637
640 &hToken);
641 if (!Success) return Success;
642
644 lpszPrivilegeName,
645 &tp.Privileges[0].Luid);
646 if (!Success) goto Quit;
647
648 tp.PrivilegeCount = 1;
649 tp.Privileges[0].Attributes = (bEnablePrivilege ? SE_PRIVILEGE_ENABLED : 0);
650
651 Success = AdjustTokenPrivileges(hToken, FALSE, &tp, 0, NULL, NULL);
652
653Quit:
654 CloseHandle(hToken);
655 return Success;
656}
657
658
659int WINAPI
661 IN HINSTANCE hPrevInstance,
662 IN LPWSTR lpszCmdLine,
663 IN int nCmdShow)
664{
665 BOOL bIsLiveCD, Success = TRUE;
666 STATE State;
667
669
670 bIsLiveCD = IsLiveCD();
671
672Restart:
674
675 if (bIsLiveCD)
676 {
677 State.NextPage = LOCALEPAGE;
678 State.Run = SHELL;
679 }
680 else
681 {
682 State.NextPage = DONE;
683 State.Run = SHELL;
684 }
685
686 if (State.NextPage != DONE) // && bIsLiveCD
687 {
689 }
690
691 switch (State.Run)
692 {
693 case SHELL:
694 {
695 /* In LiveCD mode, create a suitable environment block for the
696 * shell; otherwise, use the current one (built by WinLogon) */
697 PVOID pEnvironment = NULL;
698 if (bIsLiveCD && /* In LiveCD mode we run under the LocalSystem account */
699 !CreateEnvironmentBlock(&pEnvironment, NULL, TRUE))
700 {
701 WARN("CreateEnvironmentBlock() failed, fall back to default (error %lu)\n",
702 GetLastError());
703 }
704 Success = StartShell(pEnvironment);
705 if (pEnvironment)
706 DestroyEnvironmentBlock(pEnvironment);
707 if (Success)
708 NotifyLogon();
709 break;
710 }
711
712 case INSTALLER:
713 Success = StartInstaller(L"reactos.exe");
714 break;
715
716 case REBOOT:
717 {
721 Success = TRUE;
722 break;
723 }
724
725 default:
726 Success = FALSE;
727 break;
728 }
729
730 /*
731 * In LiveCD mode, go back to the main menu if we failed
732 * to either start the shell or the installer.
733 */
734 if (bIsLiveCD && !Success)
735 goto Restart;
736
737 return 0;
738}
739
740/* EOF */
DWORD WINAPI UpdatePerUserSystemParameters(DWORD dw1, DWORD dw2)
Type
Definition: Type.h:7
#define RC_STRING_MAX_SIZE
Definition: resource.h:3
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
#define IDS_SHELL_FAIL
Definition: resource.h:28
#define IDS_INSTALLER_FAIL
Definition: resource.h:29
#define RegCloseKey(hKey)
Definition: registry.h:49
CONFIGRET WINAPI CMP_Report_LogOn(_In_ DWORD dwMagic, _In_ DWORD dwProcessId)
Definition: cfgmgr.c:739
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
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
BOOL WINAPI LookupPrivilegeValueW(LPCWSTR lpSystemName, LPCWSTR lpPrivilegeName, PLUID lpLuid)
Definition: misc.c:782
BOOL WINAPI AdjustTokenPrivileges(HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength)
Definition: security.c:374
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:294
HMODULE hModule
Definition: animate.c:44
#define CloseHandle
Definition: compat.h:739
#define wcschr
Definition: compat.h:17
#define GetProcessHeap()
Definition: compat.h:736
#define GetProcAddress(x, y)
Definition: compat.h:753
#define HeapAlloc
Definition: compat.h:733
#define FreeLibrary(x)
Definition: compat.h:748
#define GetCurrentProcess()
Definition: compat.h:759
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define LoadLibraryW(x)
Definition: compat.h:747
static void cleanup(void)
Definition: main.c:1335
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:492
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:636
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2232
UINT WINAPI GetSystemWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2316
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessW(LPCWSTR lpApplicationName, LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
Definition: proc.c:4441
VOID WINAPI GetSystemInfo(IN LPSYSTEM_INFO lpSystemInfo)
Definition: sysinfo.c:143
_ACRTIMP __msvcrt_ulong __cdecl wcstoul(const wchar_t *, wchar_t **, int)
Definition: wcs.c:2912
_ACRTIMP int __cdecl _wcsicmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:159
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2983
BOOL WINAPI DestroyEnvironmentBlock(IN LPVOID lpEnvironment)
Definition: environment.c:725
BOOL WINAPI CreateEnvironmentBlock(OUT LPVOID *lpEnvironment, IN HANDLE hToken, IN BOOL bInherit)
Definition: environment.c:503
#define RGB(r, g, b)
Definition: precomp.h:67
return ret
Definition: mutex.c:146
#define L(x)
Definition: resources.c:13
_In_ uint64_t _In_ uint64_t _In_ uint64_t _In_opt_ traverse_ptr * tp
Definition: btrfs.c:2996
HINSTANCE hInst
Definition: dxdiag.c:13
@ Success
Definition: eventcreate.c:712
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
PWCHAR pValue
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
#define debugstr_w
Definition: kernel32.h:32
#define REG_SZ
Definition: layer.c:22
BOOL IsLiveCD(VOID)
Definition: livecd.c:106
VOID RunLiveCD(PSTATE pState)
Definition: livecd.c:892
#define ZeroMemory
Definition: minwinbase.h:31
static char * NextOption(const char *const ostr)
Definition: getopt.c:31
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
static PVOID ptr
Definition: dispmode.c:27
static PROCESS_INFORMATION pi
Definition: debugger.c:2303
static SYSTEM_INFO si
Definition: virtual.c:39
#define PROCESSOR_ARCHITECTURE_IA64
Definition: ketypes.h:111
#define PROCESSOR_ARCHITECTURE_ALPHA64
Definition: ketypes.h:112
#define PROCESSOR_ARCHITECTURE_ALPHA
Definition: ketypes.h:107
#define PROCESSOR_ARCHITECTURE_ARM
Definition: ketypes.h:110
#define PROCESSOR_ARCHITECTURE_UNKNOWN
Definition: ketypes.h:115
#define PROCESSOR_ARCHITECTURE_SHX
Definition: ketypes.h:109
#define PROCESSOR_ARCHITECTURE_MIPS
Definition: ketypes.h:106
#define PROCESSOR_ARCHITECTURE_PPC
Definition: ketypes.h:108
#define PROCESSOR_ARCHITECTURE_AMD64
Definition: ketypes.h:114
#define PROCESSOR_ARCHITECTURE_INTEL
Definition: ketypes.h:105
#define _In_
Definition: no_sal2.h:158
#define _In_opt_
Definition: no_sal2.h:212
#define KEY_READ
Definition: nt_native.h:1026
#define KEY_QUERY_VALUE
Definition: nt_native.h:1019
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define DWORD
Definition: nt_native.h:44
#define REG_EXPAND_SZ
Definition: nt_native.h:1497
#define UNICODE_NULL
short WCHAR
Definition: pedump.c:58
long LONG
Definition: pedump.c:60
_In_opt_ _In_opt_ _In_ _In_ DWORD cbData
Definition: shlwapi.h:761
#define REGSTR_PATH_DESKTOP
Definition: regstr.h:659
#define REGSTR_PATH_CURRENT_CONTROL_SET
Definition: regstr.h:564
#define REGSTR_PATH_COLORS
Definition: regstr.h:662
#define DONE
Definition: rnr20lib.h:14
@ Restart
Definition: sacdrv.h:269
#define REG_DWORD
Definition: sdbapi.c:615
wcscpy
#define LoadStringW
Definition: utils.h:64
#define TRACE(s)
Definition: solgame.cpp:4
STRSAFEAPI StringCchCatW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:325
Definition: userinit.h:57
WORD wProcessorArchitecture
Definition: winbase.h:894
uint16_t * PWSTR
Definition: typedefs.h:56
const uint16_t * PCWSTR
Definition: typedefs.h:57
const uint16_t * LPCWSTR
Definition: typedefs.h:57
unsigned char * LPBYTE
Definition: typedefs.h:53
uint16_t * LPWSTR
Definition: typedefs.h:56
ULONG_PTR SIZE_T
Definition: typedefs.h:80
int32_t INT
Definition: typedefs.h:58
#define IN
Definition: typedefs.h:39
#define OUT
Definition: typedefs.h:40
static BOOL GetShell(OUT WCHAR *CommandLine, IN HKEY hRootKey)
Definition: userinit.c:134
static VOID SetUserSettings(VOID)
Definition: userinit.c:455
static BOOL EnablePrivilege(LPCWSTR lpszPrivilegeName, BOOL bEnablePrivilege)
Definition: userinit.c:632
DWORD(WINAPI * PCMP_REPORT_LOGON)(DWORD, DWORD)
Definition: userinit.c:462
static BOOL StartShell(_In_opt_ PVOID pEnvironment)
Definition: userinit.c:218
HINSTANCE hInstance
Definition: userinit.c:34
#define CMP_MAGIC
Definition: userinit.c:30
static VOID NotifyLogon(VOID)
Definition: userinit.c:465
const WCHAR g_RegColorNames[][32]
Definition: userinit.c:329
static VOID SetUserWallpaper(VOID)
Definition: userinit.c:414
static BOOL IsConsoleShell(VOID)
Definition: userinit.c:81
LONG ReadRegSzKey(IN HKEY hKey, IN LPCWSTR pszKey, OUT LPWSTR *pValue)
Definition: userinit.c:39
static VOID SetUserSysColors(VOID)
Definition: userinit.c:376
static BOOL StartInstaller(IN LPCWSTR lpInstallerName)
Definition: userinit.c:611
int WINAPI wWinMain(IN HINSTANCE hInst, IN HINSTANCE hPrevInstance, IN LPWSTR lpszCmdLine, IN int nCmdShow)
Definition: userinit.c:660
static COLORREF StrToColorref(IN LPWSTR lpszCol)
Definition: userinit.c:364
BOOL ExpandInstallerPath(IN LPCWSTR lpInstallerName, OUT LPWSTR lpInstallerPath, IN SIZE_T PathSize)
Definition: userinit.c:491
static BOOL StartProcess(_In_ PCWSTR CommandLine, _In_opt_ PVOID pEnvironment)
Definition: userinit.c:181
@ REBOOT
Definition: userinit.h:44
@ INSTALLER
Definition: userinit.h:43
@ SHELL
Definition: userinit.h:42
@ LOCALEPAGE
Definition: userinit.h:35
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
static int Shell(const char **args)
Definition: vfdcmd.c:1020
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413
#define NORMAL_PRIORITY_CLASS
Definition: winbase.h:185
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define STARTF_USESHOWWINDOW
Definition: winbase.h:468
#define CREATE_UNICODE_ENVIRONMENT
Definition: winbase.h:190
DWORD WINAPI GetCurrentProcessId(void)
Definition: proc.c:1155
#define GetModuleHandle
Definition: winbase.h:3576
_In_ ULONG _In_ ULONG rgb
Definition: winddi.h:3521
DWORD COLORREF
Definition: windef.h:100
#define WINAPI
Definition: msvc.h:6
#define SE_SHUTDOWN_NAME
Definition: winnt_old.h:427
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define RegOpenKeyEx
Definition: winreg.h:552
#define SW_SHOWNORMAL
Definition: winuser.h:781
#define SPI_SETDESKWALLPAPER
Definition: winuser.h:1380
BOOL WINAPI SetSysColors(_In_ int cElements, _In_reads_(cElements) CONST INT *lpaElements, _In_reads_(cElements) CONST COLORREF *lpaRgbValues)
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
#define SPIF_SENDCHANGE
Definition: winuser.h:1600
#define EWX_REBOOT
Definition: winuser.h:646
#define MB_OK
Definition: winuser.h:801
BOOL WINAPI SystemParametersInfoW(_In_ UINT uiAction, _In_ UINT uiParam, _Inout_opt_ PVOID pvParam, _In_ UINT fWinIni)
BOOL WINAPI ExitWindowsEx(_In_ UINT, _In_ DWORD)
#define TOKEN_ADJUST_PRIVILEGES
Definition: setypes.h:942
#define SE_PRIVILEGE_ENABLED
Definition: setypes.h:63
unsigned char BYTE
Definition: xxhash.c:193