3 * Copyright (C) 2003 ReactOS Team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 * COPYRIGHT: See COPYING in the top level directory
21 * PROJECT: ReactOS system libraries
22 * PURPOSE: System setup
23 * FILE: dll/win32/syssetup/install.c
24 * PROGRAMER: Eric Kohl
27 /* INCLUDES *****************************************************************/
35 CMP_WaitNoPendingInstallEvents(DWORD dwTimeout
);
37 /* GLOBALS ******************************************************************/
39 HINF hSysSetupInf
= INVALID_HANDLE_VALUE
;
41 /* FUNCTIONS ****************************************************************/
44 FatalError(char *pszFmt
,...)
50 vsprintf(szBuffer
, pszFmt
, ap
);
53 LogItem(SYSSETUP_SEVERITY_FATAL_ERROR
, L
"Failed");
55 strcat(szBuffer
, "\nRebooting now!");
75 WCHAR wszBuf
[MAX_PATH
];
78 HRESULT hr
= CoCreateInstance(&CLSID_ShellLink
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IShellLink
, (LPVOID
*)&psl
);
82 hr
= psl
->lpVtbl
->SetPath(psl
, pszCmd
);
86 hr
= psl
->lpVtbl
->SetArguments(psl
, pszArg
);
91 hr
= psl
->lpVtbl
->SetWorkingDirectory(psl
, pszDir
);
96 hr
= psl
->lpVtbl
->SetIconLocation(psl
, pszIconPath
, iIconNr
);
101 hr
= psl
->lpVtbl
->SetDescription(psl
, pszComment
);
104 hr
= psl
->lpVtbl
->QueryInterface(psl
, &IID_IPersistFile
, (LPVOID
*)&ppf
);
109 hr
= ppf
->lpVtbl
->Save(ppf
, pszLinkPath
, TRUE
);
111 MultiByteToWideChar(CP_ACP
, 0, pszLinkPath
, -1, wszBuf
, MAX_PATH
);
113 hr
= ppf
->lpVtbl
->Save(ppf
, wszBuf
, TRUE
);
114 #endif /* _UNICODE */
116 ppf
->lpVtbl
->Release(ppf
);
119 psl
->lpVtbl
->Release(psl
);
133 BOOL bCheckExistence
,
136 TCHAR szPath
[MAX_PATH
];
137 TCHAR szExeName
[MAX_PATH
];
141 TCHAR szWorkingDirBuf
[MAX_PATH
];
142 LPTSTR pszWorkingDir
= NULL
;
146 if (ExpandEnvironmentStrings(pszCommand
,
148 sizeof(szPath
) / sizeof(szPath
[0])) == 0)
150 _tcscpy(szPath
, pszCommand
);
155 if ((_taccess(szPath
, 0 )) == -1)
156 /* Expected error, don't return FALSE */
160 dwLen
= GetFullPathName(szPath
,
161 sizeof(szWorkingDirBuf
) / sizeof(szWorkingDirBuf
[0]),
164 if (dwLen
!= 0 && dwLen
<= sizeof(szWorkingDirBuf
) / sizeof(szWorkingDirBuf
[0]))
166 /* Since those should only be called with (.exe) files,
167 lpFilePart has not to be NULL */
168 ASSERT(lpFilePart
!= NULL
);
170 /* Save the file name */
171 _tcscpy(szExeName
, lpFilePart
);
173 /* We're only interested in the path. Cut the file name off.
174 Also remove the trailing backslash unless the working directory
175 is only going to be a drive, ie. C:\ */
176 *(lpFilePart
--) = _T('\0');
177 if (!(lpFilePart
- szWorkingDirBuf
== 2 && szWorkingDirBuf
[1] == _T(':') &&
178 szWorkingDirBuf
[2] == _T('\\')))
180 *lpFilePart
= _T('\0');
183 pszWorkingDir
= szWorkingDirBuf
;
187 if (!SHGetSpecialFolderPath(0, szPath
, csidl
, TRUE
))
192 Ptr
= PathAddBackslash(Ptr
);
193 _tcscpy(Ptr
, pszFolder
);
196 Ptr
= PathAddBackslash(Ptr
);
198 if (!LoadString(hDllInstance
, nIdName
, szName
, sizeof(szName
)/sizeof(szName
[0])))
200 _tcscpy(Ptr
, szName
);
202 if (!LoadString(hDllInstance
, nIdTitle
, szTitle
, sizeof(szTitle
)/sizeof(szTitle
[0])))
205 // FIXME: we should pass 'command' straight in here, but shell32 doesn't expand it
206 return SUCCEEDED(CreateShellLink(szPath
, szExeName
, _T(""), pszWorkingDir
, szExeName
, iIconNr
, szTitle
));
210 CreateShortcutFolder(int csidl
, UINT nID
, LPTSTR pszName
, int cchNameLen
)
212 TCHAR szPath
[MAX_PATH
];
215 if (!SHGetSpecialFolderPath(0, szPath
, csidl
, TRUE
))
218 if (!LoadString(hDllInstance
, nID
, pszName
, cchNameLen
))
221 p
= PathAddBackslash(szPath
);
224 return CreateDirectory(szPath
, NULL
) || GetLastError()==ERROR_ALREADY_EXISTS
;
232 WCHAR szTempDir
[MAX_PATH
];
233 WCHAR szBuffer
[MAX_PATH
];
237 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE
,
238 L
"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment",
241 &hKey
) != ERROR_SUCCESS
)
243 FatalError("Error: %lu\n", GetLastError());
248 dwLength
= MAX_PATH
* sizeof(WCHAR
);
249 if (RegQueryValueExW(hKey
,
254 &dwLength
) != ERROR_SUCCESS
)
256 FatalError("Error: %lu\n", GetLastError());
261 if (!ExpandEnvironmentStringsW(szBuffer
,
265 FatalError("Error: %lu\n", GetLastError());
269 /* Create profiles directory */
270 if (!CreateDirectoryW(szTempDir
, NULL
))
272 if (GetLastError() != ERROR_ALREADY_EXISTS
)
274 FatalError("Error: %lu\n", GetLastError());
284 InstallSysSetupInfDevices(VOID
)
286 INFCONTEXT InfContext
;
287 WCHAR szLineBuffer
[256];
290 if (!SetupFindFirstLineW(hSysSetupInf
,
291 L
"DeviceInfsToInstall",
300 if (!SetupGetStringFieldW(&InfContext
,
303 sizeof(szLineBuffer
)/sizeof(szLineBuffer
[0]),
309 if (!SetupDiInstallClassW(NULL
, szLineBuffer
, DI_QUIETINSTALL
, NULL
))
314 while (SetupFindNextLine(&InfContext
, &InfContext
));
320 InstallSysSetupInfComponents(VOID
)
322 INFCONTEXT InfContext
;
323 WCHAR szNameBuffer
[256];
324 WCHAR szSectionBuffer
[256];
325 HINF hComponentInf
= INVALID_HANDLE_VALUE
;
327 if (!SetupFindFirstLineW(hSysSetupInf
,
332 DPRINT("No Inf.Always section found\n");
338 if (!SetupGetStringFieldW(&InfContext
,
339 1, // Get the component name
341 sizeof(szNameBuffer
)/sizeof(szNameBuffer
[0]),
344 FatalError("Error while trying to get component name \n");
348 if (!SetupGetStringFieldW(&InfContext
,
349 2, // Get the component install section
351 sizeof(szSectionBuffer
)/sizeof(szSectionBuffer
[0]),
354 FatalError("Error while trying to get component install section \n");
358 DPRINT("Trying to execute install section '%S' from '%S' \n", szSectionBuffer
, szNameBuffer
);
360 hComponentInf
= SetupOpenInfFileW(szNameBuffer
,
365 if (hComponentInf
== INVALID_HANDLE_VALUE
)
367 FatalError("SetupOpenInfFileW() failed to open '%S' (Error: %lu)\n", szNameBuffer
, GetLastError());
371 if (!SetupInstallFromInfSectionW(NULL
,
378 SetupDefaultQueueCallbackW
,
383 FatalError("Error while trying to install : %S (Error: %lu)\n", szNameBuffer
, GetLastError());
384 SetupCloseInfFile(hComponentInf
);
388 SetupCloseInfFile(hComponentInf
);
390 while (SetupFindNextLine(&InfContext
, &InfContext
));
397 EnableUserModePnpManager(VOID
)
399 SC_HANDLE hSCManager
= NULL
;
400 SC_HANDLE hService
= NULL
;
403 hSCManager
= OpenSCManagerW(NULL
, NULL
, SC_MANAGER_ENUMERATE_SERVICE
);
404 if (hSCManager
== NULL
)
406 DPRINT1("Unable to open the service control manager.\n");
407 DPRINT1("Last Error %d\n", GetLastError());
411 hService
= OpenServiceW(hSCManager
,
413 SERVICE_CHANGE_CONFIG
| SERVICE_START
);
414 if (hService
== NULL
)
416 DPRINT1("Unable to open PlugPlay service\n");
420 bRet
= ChangeServiceConfigW(hService
,
425 NULL
, NULL
, NULL
, NULL
);
428 DPRINT1("Unable to change the service configuration\n");
432 bRet
= StartServiceW(hService
, 0, NULL
);
433 if (!bRet
&& (GetLastError() != ERROR_SERVICE_ALREADY_RUNNING
))
435 DPRINT1("Unable to start service\n");
442 if (hSCManager
!= NULL
)
443 CloseServiceHandle(hSCManager
);
444 if (hService
!= NULL
)
445 CloseServiceHandle(hService
);
449 static INT_PTR CALLBACK
450 StatusMessageWindowProc(
456 UNREFERENCED_PARAMETER(wParam
);
464 if (!LoadStringW(hDllInstance
, IDS_STATUS_INSTALL_DEV
, szMsg
, sizeof(szMsg
)/sizeof(szMsg
[0])))
466 SetDlgItemTextW(hwndDlg
, IDC_STATUSLABEL
, szMsg
);
474 ShowStatusMessageThread(
475 IN LPVOID lpParameter
)
477 HWND
*phWnd
= (HWND
*)lpParameter
;
481 hWnd
= CreateDialogParam(
483 MAKEINTRESOURCE(IDD_STATUSWINDOW_DLG
),
485 StatusMessageWindowProc
,
491 ShowWindow(hWnd
, SW_SHOW
);
493 /* Message loop for the Status window */
494 while (GetMessage(&Msg
, NULL
, 0, 0))
496 TranslateMessage(&Msg
);
497 DispatchMessage(&Msg
);
515 return ERROR_INVALID_PARAMETER
;
518 rc
= RegQueryValueExW(hKey
, pszKey
, NULL
, &dwType
, NULL
, &cbData
);
519 if (rc
!= ERROR_SUCCESS
)
521 if (dwType
!= REG_SZ
)
522 return ERROR_FILE_NOT_FOUND
;
523 pwszValue
= HeapAlloc(GetProcessHeap(), 0, cbData
+ sizeof(WCHAR
));
525 return ERROR_NOT_ENOUGH_MEMORY
;
526 rc
= RegQueryValueExW(hKey
, pszKey
, NULL
, NULL
, (LPBYTE
)pwszValue
, &cbData
);
527 if (rc
!= ERROR_SUCCESS
)
529 HeapFree(GetProcessHeap(), 0, pwszValue
);
532 /* NULL-terminate the string */
533 pwszValue
[cbData
/ sizeof(WCHAR
)] = '\0';
536 return ERROR_SUCCESS
;
542 HKEY hControlKey
= NULL
;
543 LPWSTR pwszSystemStartOptions
= NULL
;
544 LPWSTR pwszCurrentOption
, pwszNextOption
; /* Pointers into SystemStartOptions */
545 BOOL bConsoleBoot
= FALSE
;
550 L
"SYSTEM\\CurrentControlSet\\Control",
554 if (rc
!= ERROR_SUCCESS
)
557 rc
= ReadRegSzKey(hControlKey
, L
"SystemStartOptions", &pwszSystemStartOptions
);
558 if (rc
!= ERROR_SUCCESS
)
561 /* Check for CONSOLE switch in SystemStartOptions */
562 pwszCurrentOption
= pwszSystemStartOptions
;
563 while (pwszCurrentOption
)
565 pwszNextOption
= wcschr(pwszCurrentOption
, L
' ');
567 *pwszNextOption
= L
'\0';
568 if (wcsicmp(pwszCurrentOption
, L
"CONSOLE") == 0)
570 DPRINT("Found %S. Switching to console boot\n", pwszCurrentOption
);
574 pwszCurrentOption
= pwszNextOption
? pwszNextOption
+ 1 : NULL
;
578 if (hControlKey
!= NULL
)
579 RegCloseKey(hControlKey
);
580 if (pwszSystemStartOptions
)
581 HeapFree(GetProcessHeap(), 0, pwszSystemStartOptions
);
590 hSysSetupInf
= SetupOpenInfFileW(
595 if (hSysSetupInf
== INVALID_HANDLE_VALUE
)
597 FatalError("SetupOpenInfFileW() failed to open 'syssetup.inf' (Error: %lu)\n", GetLastError());
601 if (!InstallSysSetupInfDevices())
603 FatalError("InstallSysSetupInfDevices() failed!\n");
607 if(!InstallSysSetupInfComponents())
609 FatalError("InstallSysSetupInfComponents() failed!\n");
613 if (!IsConsoleBoot())
617 hThread
= CreateThread(
620 ShowStatusMessageThread
,
626 CloseHandle(hThread
);
629 if (!EnableUserModePnpManager())
631 FatalError("EnableUserModePnpManager() failed!\n");
635 if (CMP_WaitNoPendingInstallEvents(INFINITE
) != WAIT_OBJECT_0
)
637 FatalError("CMP_WaitNoPendingInstallEvents() failed!\n");
647 SetupCloseInfFile(hSysSetupInf
);
652 InstallLiveCD(IN HINSTANCE hInstance
)
654 STARTUPINFOW StartupInfo
;
655 PROCESS_INFORMATION ProcessInformation
;
658 if (!CommonInstall())
661 /* Register components */
664 if (!SetupInstallFromInfSectionW(NULL
,
665 hSysSetupInf
, L
"RegistrationPhase2",
667 0, NULL
, 0, NULL
, NULL
, NULL
, NULL
))
669 DPRINT1("SetupInstallFromInfSectionW failed!\n");
672 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
674 DPRINT1("Catching exception\n");
678 SetupCloseInfFile(hSysSetupInf
);
681 ZeroMemory(&StartupInfo
, sizeof(StartupInfo
));
682 StartupInfo
.cb
= sizeof(StartupInfo
);
683 bRes
= CreateProcessW(
693 &ProcessInformation
);
697 CloseHandle(ProcessInformation
.hThread
);
698 CloseHandle(ProcessInformation
.hProcess
);
705 L
"Failed to load LiveCD! You can shutdown your computer, or press ENTER to reboot.",
713 CreateShortcuts(VOID
)
719 /* Create desktop shortcuts */
720 CreateShortcut(CSIDL_DESKTOP
, NULL
, IDS_SHORT_CMD
, _T("%SystemRoot%\\system32\\cmd.exe"), IDS_CMT_CMD
, TRUE
, 0);
722 /* Create program startmenu shortcuts */
723 CreateShortcut(CSIDL_PROGRAMS
, NULL
, IDS_SHORT_EXPLORER
, _T("%SystemRoot%\\explorer.exe"), IDS_CMT_EXPLORER
, TRUE
, 1);
724 CreateShortcut(CSIDL_PROGRAMS
, NULL
, IDS_SHORT_DOWNLOADER
, _T("%SystemRoot%\\system32\\rapps.exe"), IDS_CMT_DOWNLOADER
, TRUE
, 0);
726 /* Create administrative tools startmenu shortcuts */
727 CreateShortcut(CSIDL_COMMON_ADMINTOOLS
, NULL
, IDS_SHORT_SERVICE
, _T("%SystemRoot%\\system32\\servman.exe"), IDS_CMT_SERVMAN
, TRUE
, 0);
728 CreateShortcut(CSIDL_COMMON_ADMINTOOLS
, NULL
, IDS_SHORT_DEVICE
, _T("%SystemRoot%\\system32\\devmgmt.exe"), IDS_CMT_DEVMGMT
, TRUE
, 0);
729 CreateShortcut(CSIDL_COMMON_ADMINTOOLS
, NULL
, IDS_SHORT_EVENTVIEW
, _T("%SystemRoot%\\system32\\eventvwr.exe"), IDS_CMT_EVENTVIEW
, TRUE
, 0);
730 CreateShortcut(CSIDL_COMMON_ADMINTOOLS
, NULL
, IDS_SHORT_MSCONFIG
, _T("%SystemRoot%\\system32\\msconfig.exe"), IDS_CMT_MSCONFIG
, TRUE
, 0);
732 /* Create and fill Accessories subfolder */
733 if (CreateShortcutFolder(CSIDL_PROGRAMS
, IDS_ACCESSORIES
, szFolder
, sizeof(szFolder
)/sizeof(szFolder
[0])))
735 CreateShortcut(CSIDL_PROGRAMS
, szFolder
, IDS_SHORT_CALC
, _T("%SystemRoot%\\system32\\calc.exe"), IDS_CMT_CALC
, TRUE
, 0);
736 CreateShortcut(CSIDL_PROGRAMS
, szFolder
, IDS_SHORT_CMD
, _T("%SystemRoot%\\system32\\cmd.exe"), IDS_CMT_CMD
, TRUE
, 0);
737 CreateShortcut(CSIDL_PROGRAMS
, szFolder
, IDS_SHORT_NOTEPAD
, _T("%SystemRoot%\\system32\\notepad.exe"), IDS_CMT_NOTEPAD
, TRUE
, 0);
738 CreateShortcut(CSIDL_PROGRAMS
, szFolder
, IDS_SHORT_RDESKTOP
, _T("%SystemRoot%\\system32\\mstsc.exe"), IDS_CMT_RDESKTOP
, TRUE
, 0);
739 CreateShortcut(CSIDL_PROGRAMS
, szFolder
, IDS_SHORT_SNAP
, _T("%SystemRoot%\\system32\\screenshot.exe"), IDS_CMT_SCREENSHOT
, TRUE
, 0);
740 CreateShortcut(CSIDL_PROGRAMS
, szFolder
, IDS_SHORT_WORDPAD
, _T("%SystemRoot%\\system32\\wordpad.exe"), IDS_CMT_WORDPAD
, TRUE
, 0);
741 CreateShortcut(CSIDL_PROGRAMS
, szFolder
, IDS_SHORT_PAINT
, _T("%SystemRoot%\\system32\\mspaint.exe"), IDS_CMT_PAINT
, TRUE
, 0);
744 /* Create System Tools subfolder and fill if the exe is available */
745 if (CreateShortcutFolder(CSIDL_PROGRAMS
, IDS_SYS_TOOLS
, szFolder
, sizeof(szFolder
)/sizeof(szFolder
[0])))
747 CreateShortcut(CSIDL_PROGRAMS
, szFolder
, IDS_SHORT_CHARMAP
, _T("%SystemRoot%\\system32\\charmap.exe"), IDS_CMT_CHARMAP
, TRUE
, 0);
748 CreateShortcut(CSIDL_PROGRAMS
, szFolder
, IDS_SHORT_KBSWITCH
, _T("%SystemRoot%\\system32\\kbswitch.exe"), IDS_CMT_KBSWITCH
, TRUE
, 0);
749 CreateShortcut(CSIDL_PROGRAMS
, szFolder
, IDS_SHORT_REGEDIT
, _T("%SystemRoot%\\regedit.exe"), IDS_CMT_REGEDIT
, TRUE
, 0);
750 CreateShortcut(CSIDL_PROGRAMS
, szFolder
, IDS_SHORT_DXDIAG
, _T("%SystemRoot%\\system32\\dxdiag.exe"), IDS_CMT_DXDIAG
, TRUE
, 0);
753 /* Create Accessibility subfolder and fill if the exe is available */
754 if (CreateShortcutFolder(CSIDL_PROGRAMS
, IDS_SYS_ACCESSIBILITY
, szFolder
, sizeof(szFolder
)/sizeof(szFolder
[0])))
756 CreateShortcut(CSIDL_PROGRAMS
, szFolder
, IDS_SHORT_MAGNIFY
, _T("%SystemRoot%\\system32\\magnify.exe"), IDS_CMT_MAGNIFY
, TRUE
, 0);
759 /* Create Entertainment subfolder and fill if the exe is available */
760 if (CreateShortcutFolder(CSIDL_PROGRAMS
, IDS_SYS_ENTERTAINMENT
, szFolder
, sizeof(szFolder
)/sizeof(szFolder
[0])))
762 CreateShortcut(CSIDL_PROGRAMS
, szFolder
, IDS_SHORT_MPLAY32
, _T("%SystemRoot%\\system32\\mplay32.exe"), IDS_CMT_MPLAY32
, TRUE
, 0);
763 CreateShortcut(CSIDL_PROGRAMS
, szFolder
, IDS_SHORT_SNDVOL32
, _T("%SystemRoot%\\system32\\sndvol32.exe"), IDS_CMT_SNDVOL32
, TRUE
, 0);
764 CreateShortcut(CSIDL_PROGRAMS
, szFolder
, IDS_SHORT_SNDREC32
, _T("%SystemRoot%\\system32\\sndrec32.exe"), IDS_CMT_SNDREC32
, TRUE
, 0);
767 /* Create Games subfolder and fill if the exe is available */
768 if (CreateShortcutFolder(CSIDL_PROGRAMS
, IDS_GAMES
, szFolder
, sizeof(szFolder
)/sizeof(szFolder
[0])))
770 CreateShortcut(CSIDL_PROGRAMS
, szFolder
, IDS_SHORT_SOLITAIRE
, _T("%SystemRoot%\\system32\\sol.exe"), IDS_CMT_SOLITAIRE
, TRUE
, 0);
771 CreateShortcut(CSIDL_PROGRAMS
, szFolder
, IDS_SHORT_WINEMINE
, _T("%SystemRoot%\\system32\\winmine.exe"), IDS_CMT_WINEMINE
, TRUE
, 0);
772 CreateShortcut(CSIDL_PROGRAMS
, szFolder
, IDS_SHORT_SPIDER
, _T("%SystemRoot%\\system32\\spider.exe"), IDS_CMT_SPIDER
, TRUE
, 0);
781 SetSetupType(DWORD dwSetupType
)
786 dwError
= RegOpenKeyExW(
792 if (dwError
!= ERROR_SUCCESS
)
795 dwError
= RegSetValueExW(
800 (LPBYTE
)&dwSetupType
,
803 if (dwError
!= ERROR_SUCCESS
)
810 InstallReactOS(HINSTANCE hInstance
)
812 TCHAR szBuffer
[MAX_PATH
];
814 TOKEN_PRIVILEGES privs
;
817 InitializeSetupActionLog(FALSE
);
818 LogItem(SYSSETUP_SEVERITY_INFORMATION
, L
"Installing ReactOS");
820 if (!InitializeProfiles())
822 FatalError("InitializeProfiles() failed");
826 CreateTempDir(L
"TEMP");
827 CreateTempDir(L
"TMP");
829 if (GetWindowsDirectory(szBuffer
, sizeof(szBuffer
) / sizeof(TCHAR
)))
831 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE
,
832 L
"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion",
835 &hKey
) == ERROR_SUCCESS
)
842 (wcslen(szBuffer
) + 1) * sizeof(WCHAR
));
849 (wcslen(szBuffer
) + 1) * sizeof(WCHAR
));
854 PathAddBackslash(szBuffer
);
855 _tcscat(szBuffer
, _T("system"));
856 CreateDirectory(szBuffer
, NULL
);
859 if (!CommonInstall())
866 if (!CreateShortcuts())
868 FatalError("CreateShortcuts() failed");
872 /* ROS HACK, as long as NtUnloadKey is not implemented */
874 NTSTATUS Status
= NtUnloadKey(NULL
);
875 if (Status
== STATUS_NOT_IMPLEMENTED
)
877 /* Create the Administrator profile */
878 PROFILEINFOW ProfileInfo
;
882 ret
= LogonUserW(L
"Administrator", L
"", L
"", LOGON32_LOGON_NETWORK
, LOGON32_PROVIDER_DEFAULT
, &hToken
);
885 FatalError("LogonUserW() failed!");
888 ZeroMemory(&ProfileInfo
, sizeof(PROFILEINFOW
));
889 ProfileInfo
.dwSize
= sizeof(PROFILEINFOW
);
890 ProfileInfo
.lpUserName
= L
"Administrator";
891 ProfileInfo
.dwFlags
= PI_NOUI
;
892 LoadUserProfileW(hToken
, &ProfileInfo
);
897 DPRINT1("ROS HACK not needed anymore. Please remove it\n");
900 /* END OF ROS HACK */
902 SetupCloseInfFile(hSysSetupInf
);
905 LogItem(SYSSETUP_SEVERITY_INFORMATION
, L
"Installing ReactOS done");
906 TerminateSetupActionLog();
908 /* Get shutdown privilege */
909 if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES
, &token
))
911 FatalError("OpenProcessToken() failed!");
914 if (!LookupPrivilegeValue(
917 &privs
.Privileges
[0].Luid
))
919 FatalError("LookupPrivilegeValue() failed!");
922 privs
.PrivilegeCount
= 1;
923 privs
.Privileges
[0].Attributes
= SE_PRIVILEGE_ENABLED
;
924 if (AdjustTokenPrivileges(
929 (PTOKEN_PRIVILEGES
)NULL
,
932 FatalError("AdjustTokenPrivileges() failed!");
936 ExitWindowsEx(EWX_REBOOT
, 0);
947 IN LPCWSTR lpszFontSize
)
949 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
957 SetupChangeLocaleEx(HWND hWnd
,
959 LPCWSTR lpSrcRootPath
,
964 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
972 SetupChangeLocale(HWND hWnd
, LCID Lcid
)
974 return SetupChangeLocaleEx(hWnd
, Lcid
, NULL
, 0, 0, 0);