ReactOS 0.4.15-dev-5666-gc548b97
install.c File Reference
#include "precomp.h"
#include <io.h>
#include <wincon.h>
#include <winnls.h>
#include <winsvc.h>
#include <userenv.h>
#include <shlobj.h>
#include <shlwapi.h>
#include <shobjidl.h>
#include <rpcproxy.h>
#include <ndk/cmfuncs.h>
#include <debug.h>
Include dependency graph for install.c:

Go to the source code of this file.

Classes

struct  _DLG_DATA
 

Macros

#define COBJMACROS
 
#define NDEBUG
 

Typedefs

typedef struct _DLG_DATA DLG_DATA
 
typedef struct _DLG_DATAPDLG_DATA
 

Functions

DWORD WINAPI SetupStartService (LPCWSTR lpServiceName, BOOL bWait)
 
static VOID FatalError (char *pszFmt,...)
 
static HRESULT CreateShellLink (LPCWSTR pszLinkPath, LPCWSTR pszCmd, LPCWSTR pszArg, LPCWSTR pszDir, LPCWSTR pszIconPath, INT iIconNr, LPCWSTR pszComment)
 
static BOOL CreateShortcut (LPCWSTR pszFolder, LPCWSTR pszName, LPCWSTR pszCommand, LPCWSTR pszDescription, INT iIconNr, LPCWSTR pszWorkingDir, LPCWSTR pszArgs)
 
static BOOL CreateShortcutsFromSection (HINF hinf, LPWSTR pszSection, LPCWSTR pszFolder)
 
static BOOL CreateShortcuts (HINF hinf, LPCWSTR szSection)
 
static VOID CreateTempDir (IN LPCWSTR VarName)
 
static BOOL InstallSysSetupInfDevices (VOID)
 
static BOOL InstallSysSetupInfComponents (VOID)
 
BOOL RegisterTypeLibraries (HINF hinf, LPCWSTR szSection)
 
static BOOL EnableUserModePnpManager (VOID)
 
static VOID AdjustStatusMessageWindow (HWND hwndDlg, PDLG_DATA pDlgData)
 
static INT_PTR CALLBACK StatusMessageWindowProc (IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
static DWORD WINAPI ShowStatusMessageThread (IN LPVOID lpParameter)
 
static LONG ReadRegSzKey (IN HKEY hKey, IN LPCWSTR pszKey, OUT LPWSTR *pValue)
 
static BOOL IsConsoleBoot (VOID)
 
static BOOL CommonInstall (VOID)
 
static DWORD InstallLiveCD (VOID)
 
static BOOL SetSetupType (DWORD dwSetupType)
 
static DWORD CALLBACK HotkeyThread (LPVOID Parameter)
 
static BOOL InitializeProgramFilesDir (VOID)
 
static VOID InitializeDefaultUserLocale (VOID)
 
static DWORD SaveDefaultUserHive (VOID)
 
static DWORD InstallReactOS (VOID)
 
INT WINAPI InstallWindowsNt (INT argc, WCHAR **argv)
 
DWORD WINAPI SetupChangeFontSize (IN HANDLE hWnd, IN LPCWSTR lpszFontSize)
 
DWORD WINAPI SetupChangeLocaleEx (HWND hWnd, LCID Lcid, LPCWSTR lpSrcRootPath, char Unknown, DWORD dwUnused1, DWORD dwUnused2)
 
DWORD WINAPI SetupChangeLocale (HWND hWnd, LCID Lcid)
 

Variables

HINF hSysSetupInf = INVALID_HANDLE_VALUE
 
ADMIN_INFO AdminInfo
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 13 of file install.c.

◆ NDEBUG

#define NDEBUG

Definition at line 26 of file install.c.

Typedef Documentation

◆ DLG_DATA

◆ PDLG_DATA

Function Documentation

◆ AdjustStatusMessageWindow()

static VOID AdjustStatusMessageWindow ( HWND  hwndDlg,
PDLG_DATA  pDlgData 
)
static

Definition at line 574 of file install.c.

575{
576 INT xOld, yOld, cxOld, cyOld;
577 INT xNew, yNew, cxNew, cyNew;
578 INT cxLabel, cyLabel, dyLabel;
579 RECT rc, rcBar, rcLabel, rcWnd;
580 BITMAP bmLogo, bmBar;
581 DWORD style, exstyle;
582 HWND hwndLogo = GetDlgItem(hwndDlg, IDC_ROSLOGO);
583 HWND hwndBar = GetDlgItem(hwndDlg, IDC_BAR);
584 HWND hwndLabel = GetDlgItem(hwndDlg, IDC_STATUSLABEL);
585
586 /* This adjustment is for CJK only */
588 {
589 case LANG_CHINESE:
590 case LANG_JAPANESE:
591 case LANG_KOREAN:
592 break;
593
594 default:
595 return;
596 }
597
598 if (!GetObjectW(pDlgData->hLogoBitmap, sizeof(BITMAP), &bmLogo) ||
599 !GetObjectW(pDlgData->hBarBitmap, sizeof(BITMAP), &bmBar))
600 {
601 return;
602 }
603
604 GetWindowRect(hwndBar, &rcBar);
605 MapWindowPoints(NULL, hwndDlg, (LPPOINT)&rcBar, 2);
606 dyLabel = bmLogo.bmHeight - rcBar.top;
607
608 GetWindowRect(hwndLabel, &rcLabel);
609 MapWindowPoints(NULL, hwndDlg, (LPPOINT)&rcLabel, 2);
610 cxLabel = rcLabel.right - rcLabel.left;
611 cyLabel = rcLabel.bottom - rcLabel.top;
612
613 MoveWindow(hwndLogo, 0, 0, bmLogo.bmWidth, bmLogo.bmHeight, TRUE);
614 MoveWindow(hwndBar, 0, bmLogo.bmHeight, bmLogo.bmWidth, bmBar.bmHeight, TRUE);
615 MoveWindow(hwndLabel, rcLabel.left, rcLabel.top + dyLabel, cxLabel, cyLabel, TRUE);
616
617 GetWindowRect(hwndDlg, &rcWnd);
618 xOld = rcWnd.left;
619 yOld = rcWnd.top;
620 cxOld = rcWnd.right - rcWnd.left;
621 cyOld = rcWnd.bottom - rcWnd.top;
622
623 GetClientRect(hwndDlg, &rc);
624 SetRect(&rc, 0, 0, bmLogo.bmWidth, rc.bottom - rc.top); /* new client size */
625
627 exstyle = (DWORD)GetWindowLongPtrW(hwndDlg, GWL_EXSTYLE);
628 AdjustWindowRectEx(&rc, style, FALSE, exstyle);
629
630 cxNew = rc.right - rc.left;
631 cyNew = (rc.bottom - rc.top) + dyLabel;
632 xNew = xOld - (cxNew - cxOld) / 2;
633 yNew = yOld - (cyNew - cyOld) / 2;
634 MoveWindow(hwndDlg, xNew, yNew, cxNew, cyNew, TRUE);
635}
Arabic default style
Definition: afstyles.h:94
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define IDC_ROSLOGO
Definition: resource.h:69
#define IDC_BAR
Definition: resource.h:70
#define IDC_STATUSLABEL
Definition: resource.h:89
static INT cxOld
Definition: eventvwr.c:4315
static INT cyOld
Definition: eventvwr.c:4315
unsigned long DWORD
Definition: ntddk_ex.h:95
LANGID WINAPI GetUserDefaultLangID(void)
Definition: lang.c:738
#define DWORD
Definition: nt_native.h:44
#define LANG_CHINESE
Definition: nls.h:42
#define LANG_JAPANESE
Definition: nls.h:76
#define PRIMARYLANGID(l)
Definition: nls.h:16
#define LANG_KOREAN
Definition: nls.h:84
Definition: bl.h:1331
HBITMAP hLogoBitmap
Definition: gui.c:37
HBITMAP hBarBitmap
Definition: gui.c:38
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
int32_t INT
Definition: typedefs.h:58
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
#define GetWindowLongPtrW
Definition: winuser.h:4819
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI AdjustWindowRectEx(_Inout_ LPRECT, _In_ DWORD, _In_ BOOL, _In_ DWORD)
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define GWL_STYLE
Definition: winuser.h:846
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
#define GWL_EXSTYLE
Definition: winuser.h:845

Referenced by StatusMessageWindowProc().

◆ CommonInstall()

static BOOL CommonInstall ( VOID  )
static

Definition at line 869 of file install.c.

870{
872 BOOL bResult = FALSE;
873
874 hSysSetupInf = SetupOpenInfFileW(L"syssetup.inf",
875 NULL,
877 NULL);
879 {
880 FatalError("SetupOpenInfFileW() failed to open 'syssetup.inf' (Error: %lu)\n", GetLastError());
881 return FALSE;
882 }
883
885 {
886 FatalError("InstallSysSetupInfDevices() failed!\n");
887 goto Exit;
888 }
889
891 {
892 FatalError("InstallSysSetupInfComponents() failed!\n");
893 goto Exit;
894 }
895
896 if (!IsConsoleBoot())
897 {
899 0,
901 NULL,
902 0,
903 NULL);
904 }
905
907 {
908 FatalError("EnableUserModePnpManager() failed!\n");
909 goto Exit;
910 }
911
913 {
914 FatalError("CMP_WaitNoPendingInstallEvents() failed!\n");
915 goto Exit;
916 }
917
918 bResult = TRUE;
919
920Exit:
921
922 if (bResult == FALSE)
923 {
925 }
926
927 if (hThread != NULL)
928 {
932 }
933
934 return bResult;
935}
static BOOL IsConsoleBoot(VOID)
Definition: install.c:479
DWORD WINAPI CMP_WaitNoPendingInstallEvents(_In_ DWORD dwTimeout)
Definition: cfgmgr.c:802
#define CloseHandle
Definition: compat.h:739
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
DWORD WINAPI GetThreadId(IN HANDLE Thread)
Definition: thread.c:913
HINF WINAPI SetupOpenInfFileW(PCWSTR name, PCWSTR class, DWORD style, UINT *error)
Definition: parser.c:1229
static BOOL EnableUserModePnpManager(VOID)
Definition: install.c:490
static BOOL InstallSysSetupInfComponents(VOID)
Definition: install.c:359
static BOOL InstallSysSetupInfDevices(VOID)
Definition: install.c:323
static DWORD WINAPI ShowStatusMessageThread(IN LPVOID lpParameter)
Definition: install.c:758
HINF hSysSetupInf
Definition: install.c:37
static VOID FatalError(char *pszFmt,...)
Definition: install.c:53
#define INFINITE
Definition: serial.h:102
unsigned int BOOL
Definition: ntddk_ex.h:94
#define INF_STYLE_WIN4
Definition: infsupp.h:41
HANDLE hThread
Definition: wizard.c:28
#define L(x)
Definition: ntvdm.h:50
static void Exit(void)
Definition: sock.c:1330
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
VOID WINAPI SetupCloseInfFile(IN HINF InfHandle)
Definition: infsupp.c:43
DWORD WINAPI GetLastError(void)
Definition: except.c:1040
#define WAIT_OBJECT_0
Definition: winbase.h:406
#define WM_QUIT
Definition: winuser.h:1613
#define PostThreadMessage
Definition: winuser.h:5823

Referenced by InstallLiveCD(), and InstallReactOS().

◆ CreateShellLink()

static HRESULT CreateShellLink ( LPCWSTR  pszLinkPath,
LPCWSTR  pszCmd,
LPCWSTR  pszArg,
LPCWSTR  pszDir,
LPCWSTR  pszIconPath,
INT  iIconNr,
LPCWSTR  pszComment 
)
static

Definition at line 72 of file install.c.

80{
81 IShellLinkW *psl;
82 IPersistFile *ppf;
83
84 HRESULT hr = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, &IID_IShellLink, (LPVOID*)&psl);
85
86 if (SUCCEEDED(hr))
87 {
88 hr = IShellLinkW_SetPath(psl, pszCmd);
89
90 if (pszArg)
91 hr = IShellLinkW_SetArguments(psl, pszArg);
92
93 if (pszDir)
94 hr = IShellLinkW_SetWorkingDirectory(psl, pszDir);
95
96 if (pszIconPath)
97 hr = IShellLinkW_SetIconLocation(psl, pszIconPath, iIconNr);
98
99 if (pszComment)
100 hr = IShellLinkW_SetDescription(psl, pszComment);
101
102 hr = IShellLinkW_QueryInterface(psl, &IID_IPersistFile, (LPVOID*)&ppf);
103
104 if (SUCCEEDED(hr))
105 {
106 hr = IPersistFile_Save(ppf, pszLinkPath, TRUE);
107 IPersistFile_Release(ppf);
108 }
109
110 IShellLinkW_Release(psl);
111 }
112
113 return hr;
114}
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
#define SUCCEEDED(hr)
Definition: intsafe.h:50
const GUID IID_IPersistFile
_In_ LPCSTR pszDir
Definition: shellapi.h:581
HRESULT hr
Definition: shlfolder.c:183
#define IID_IShellLink
Definition: shlguid.h:131

Referenced by CreateShortcut().

◆ CreateShortcut()

static BOOL CreateShortcut ( LPCWSTR  pszFolder,
LPCWSTR  pszName,
LPCWSTR  pszCommand,
LPCWSTR  pszDescription,
INT  iIconNr,
LPCWSTR  pszWorkingDir,
LPCWSTR  pszArgs 
)
static

Definition at line 118 of file install.c.

126{
127 DWORD dwLen;
128 LPWSTR Ptr;
131 WCHAR szWorkingDirBuf[MAX_PATH];
132
133 /* If no working directory is provided, try to compute a default one */
134 if (pszWorkingDir == NULL || pszWorkingDir[0] == L'\0')
135 {
136 if (ExpandEnvironmentStringsW(pszCommand, szPath, ARRAYSIZE(szPath)) == 0)
137 wcscpy(szPath, pszCommand);
138
139 dwLen = GetFullPathNameW(szPath,
140 ARRAYSIZE(szWorkingDirBuf),
141 szWorkingDirBuf,
142 &lpFilePart);
143 if (dwLen != 0 && dwLen <= ARRAYSIZE(szWorkingDirBuf))
144 {
145 /* Since those should only be called with (.exe) files,
146 lpFilePart has not to be NULL */
148
149 /* We're only interested in the path. Cut the file name off.
150 Also remove the trailing backslash unless the working directory
151 is only going to be a drive, i.e. C:\ */
152 *(lpFilePart--) = L'\0';
153 if (!(lpFilePart - szWorkingDirBuf == 2 &&
154 szWorkingDirBuf[1] == L':' && szWorkingDirBuf[2] == L'\\'))
155 {
156 *lpFilePart = L'\0';
157 }
158 pszWorkingDir = szWorkingDirBuf;
159 }
160 }
161
162 /* If we failed to compute a working directory, just do not use one */
163 if (pszWorkingDir && pszWorkingDir[0] == L'\0')
164 pszWorkingDir = NULL;
165
166 /* Build the shortcut file name */
167 wcscpy(szPath, pszFolder);
169 wcscpy(Ptr, pszName);
170
171 /* Create the shortcut */
173 pszCommand,
174 pszArgs,
175 pszWorkingDir,
176 /* Special value to indicate no icon */
177 (iIconNr != -1 ? pszCommand : NULL),
178 iIconNr,
179 pszDescription));
180}
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define MAX_PATH
Definition: compat.h:34
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
Definition: path.c:1106
static HRESULT CreateShellLink(LPCWSTR pszLinkPath, LPCWSTR pszCmd, LPCWSTR pszArg, LPCWSTR pszDir, LPCWSTR pszIconPath, INT iIconNr, LPCWSTR pszComment)
Definition: install.c:72
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
#define ASSERT(a)
Definition: mode.c:44
LPCWSTR szPath
Definition: env.c:37
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define PathAddBackslash
Definition: shlwapi.h:783
_In_ LPCSTR _In_opt_ LPCSTR _In_ DWORD _Out_opt_ LPSTR * lpFilePart
Definition: winbase.h:3062
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by CreateShortcutsFromSection().

◆ CreateShortcuts()

static BOOL CreateShortcuts ( HINF  hinf,
LPCWSTR  szSection 
)
static

Definition at line 230 of file install.c.

231{
234 WCHAR szFolder[MAX_PATH];
235 WCHAR szFolderSection[MAX_PATH];
236 INT csidl;
237
239
240 if (!SetupFindFirstLine(hinf, szSection, NULL, &Context))
241 return FALSE;
242
243 do
244 {
245 if (SetupGetFieldCount(&Context) < 2)
246 continue;
247
248 if (!SetupGetStringFieldW(&Context, 0, szFolderSection, ARRAYSIZE(szFolderSection), NULL))
249 continue;
250
251 if (!SetupGetIntField(&Context, 1, &csidl))
252 continue;
253
254 if (!SetupGetStringFieldW(&Context, 2, szFolder, ARRAYSIZE(szFolder), NULL))
255 continue;
256
258 continue;
259
260 CreateShortcutsFromSection(hinf, szFolderSection, szPath);
261
262 } while (SetupFindNextLine(&Context, &Context));
263
265
266 return TRUE;
267}
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
HRESULT WINAPI SHGetFolderPathAndSubDirW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPCWSTR pszSubPath, LPWSTR pszPath)
Definition: shellpath.c:2623
static BOOL CreateShortcutsFromSection(HINF hinf, LPWSTR pszSection, LPCWSTR pszFolder)
Definition: install.c:183
#define FAILED(hr)
Definition: intsafe.h:51
#define SetupFindFirstLine
Definition: setupapi.h:2624
#define CSIDL_FLAG_CREATE
@ SHGFP_TYPE_DEFAULT
Definition: shlobj.h:2002
BOOL WINAPI SetupGetStringFieldW(IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT PWSTR ReturnBuffer, IN ULONG ReturnBufferSize, OUT PULONG RequiredSize)
Definition: infsupp.c:184
BOOL WINAPI SetupGetIntField(IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT INT *IntegerValue)
Definition: infsupp.c:146
ULONG WINAPI SetupGetFieldCount(IN PINFCONTEXT Context)
Definition: infsupp.c:91
BOOL WINAPI SetupFindNextLine(IN PINFCONTEXT ContextIn, OUT PINFCONTEXT ContextOut)
Definition: infsupp.c:80

Referenced by InstallReactOS().

◆ CreateShortcutsFromSection()

static BOOL CreateShortcutsFromSection ( HINF  hinf,
LPWSTR  pszSection,
LPCWSTR  pszFolder 
)
static

Definition at line 183 of file install.c.

184{
186 DWORD dwFieldCount;
187 INT iIconNr;
188 WCHAR szCommand[MAX_PATH];
191 WCHAR szDirectory[MAX_PATH];
192 WCHAR szArgs[MAX_PATH];
193
194 if (!SetupFindFirstLine(hinf, pszSection, NULL, &Context))
195 return FALSE;
196
197 do
198 {
199 dwFieldCount = SetupGetFieldCount(&Context);
200 if (dwFieldCount < 3)
201 continue;
202
203 if (!SetupGetStringFieldW(&Context, 1, szCommand, ARRAYSIZE(szCommand), NULL))
204 continue;
205
207 continue;
208
210 continue;
211
212 if (dwFieldCount < 4 || !SetupGetIntField(&Context, 4, &iIconNr))
213 iIconNr = -1; /* Special value to indicate no icon */
214
215 if (dwFieldCount < 5 || !SetupGetStringFieldW(&Context, 5, szDirectory, ARRAYSIZE(szDirectory), NULL))
216 szDirectory[0] = L'\0';
217
218 if (dwFieldCount < 6 || !SetupGetStringFieldW(&Context, 6, szArgs, ARRAYSIZE(szArgs), NULL))
219 szArgs[0] = L'\0';
220
221 wcscat(szName, L".lnk");
222
223 CreateShortcut(pszFolder, szName, szCommand, szDescription, iIconNr, szDirectory, szArgs);
224
225 } while (SetupFindNextLine(&Context, &Context));
226
227 return TRUE;
228}
static const WCHAR szDescription[]
Definition: provider.c:55
static BOOL CreateShortcut(LPCWSTR pszFolder, LPCWSTR pszName, LPCWSTR pszCommand, LPCWSTR pszDescription, INT iIconNr, LPCWSTR pszWorkingDir, LPCWSTR pszArgs)
Definition: install.c:118
static const WCHAR szName[]
Definition: powrprof.c:45
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)

Referenced by CreateShortcuts().

◆ CreateTempDir()

static VOID CreateTempDir ( IN LPCWSTR  VarName)
static

Definition at line 270 of file install.c.

272{
273 WCHAR szTempDir[MAX_PATH];
274 WCHAR szBuffer[MAX_PATH];
276 HKEY hKey;
277
279 L"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment",
280 0,
282 &hKey) != ERROR_SUCCESS)
283 {
284 FatalError("Error: %lu\n", GetLastError());
285 return;
286 }
287
288 /* Get temp dir */
289 dwLength = sizeof(szBuffer);
291 VarName,
292 NULL,
293 NULL,
294 (LPBYTE)szBuffer,
296 {
297 FatalError("Error: %lu\n", GetLastError());
298 goto cleanup;
299 }
300
301 /* Expand it */
302 if (!ExpandEnvironmentStringsW(szBuffer, szTempDir, ARRAYSIZE(szTempDir)))
303 {
304 FatalError("Error: %lu\n", GetLastError());
305 goto cleanup;
306 }
307
308 /* Create profiles directory */
309 if (!CreateDirectoryW(szTempDir, NULL))
310 {
312 {
313 FatalError("Error: %lu\n", GetLastError());
314 goto cleanup;
315 }
316 }
317
318cleanup:
320}
#define RegCloseKey(hKey)
Definition: registry.h:47
#define ERROR_SUCCESS
Definition: deptool.c:10
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3356
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4121
static DWORD DWORD * dwLength
Definition: fusion.c:86
static void cleanup(void)
Definition: main.c:1335
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:90
FxAutoRegKey hKey
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
unsigned char * LPBYTE
Definition: typedefs.h:53
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by InstallReactOS().

◆ EnableUserModePnpManager()

static BOOL EnableUserModePnpManager ( VOID  )
static

Definition at line 490 of file install.c.

491{
492 SC_HANDLE hSCManager = NULL;
493 SC_HANDLE hService = NULL;
495 BOOL bRet = FALSE;
496 DWORD BytesNeeded, WaitTime;
497
499 if (hSCManager == NULL)
500 {
501 DPRINT1("Unable to open the service control manager.\n");
502 DPRINT1("Last Error %d\n", GetLastError());
503 goto cleanup;
504 }
505
506 hService = OpenServiceW(hSCManager,
507 L"PlugPlay",
509 if (hService == NULL)
510 {
511 DPRINT1("Unable to open PlugPlay service\n");
512 goto cleanup;
513 }
514
515 bRet = ChangeServiceConfigW(hService,
519 NULL, NULL, NULL,
520 NULL, NULL, NULL, NULL);
521 if (!bRet)
522 {
523 DPRINT1("Unable to change the service configuration\n");
524 goto cleanup;
525 }
526
527 bRet = StartServiceW(hService, 0, NULL);
529 {
530 DPRINT1("Unable to start service\n");
531 goto cleanup;
532 }
533
534 while (TRUE)
535 {
536 bRet = QueryServiceStatusEx(hService,
539 sizeof(ServiceStatus),
540 &BytesNeeded);
541 if (!bRet)
542 {
543 DPRINT1("QueryServiceStatusEx() failed for PlugPlay service (error 0x%x)\n", GetLastError());
544 goto cleanup;
545 }
546
548 break;
549
550 WaitTime = ServiceStatus.dwWaitHint / 10;
551 if (WaitTime < 1000) WaitTime = 1000;
552 else if (WaitTime > 10000) WaitTime = 10000;
553 Sleep(WaitTime);
554 };
555
557 {
558 bRet = FALSE;
559 DPRINT1("Failed to start PlugPlay service\n");
560 goto cleanup;
561 }
562
563 bRet = TRUE;
564
565cleanup:
566 if (hService != NULL)
567 CloseServiceHandle(hService);
568 if (hSCManager != NULL)
570 return bRet;
571}
#define DPRINT1
Definition: precomp.h:8
static SERVICE_STATUS ServiceStatus
Definition: browser.c:22
SC_HANDLE hSCManager
Definition: sc.c:12
SC_HANDLE WINAPI OpenSCManagerW(LPCWSTR lpMachineName, LPCWSTR lpDatabaseName, DWORD dwDesiredAccess)
Definition: scm.c:2016
BOOL WINAPI QueryServiceStatusEx(SC_HANDLE hService, SC_STATUS_TYPE InfoLevel, LPBYTE lpBuffer, DWORD cbBufSize, LPDWORD pcbBytesNeeded)
Definition: scm.c:2835
SC_HANDLE WINAPI OpenServiceW(SC_HANDLE hSCManager, LPCWSTR lpServiceName, DWORD dwDesiredAccess)
Definition: scm.c:2108
BOOL WINAPI ChangeServiceConfigW(SC_HANDLE hService, DWORD dwServiceType, DWORD dwStartType, DWORD dwErrorControl, LPCWSTR lpBinaryPathName, LPCWSTR lpLoadOrderGroup, LPDWORD lpdwTagId, LPCWSTR lpDependencies, LPCWSTR lpServiceStartName, LPCWSTR lpPassword, LPCWSTR lpDisplayName)
Definition: scm.c:482
BOOL WINAPI StartServiceW(SC_HANDLE hService, DWORD dwNumServiceArgs, LPCWSTR *lpServiceArgVectors)
Definition: scm.c:2928
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
Definition: scm.c:580
DWORD dwWaitHint
Definition: winsvc.h:105
DWORD dwCurrentState
Definition: winsvc.h:100
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
#define ERROR_SERVICE_ALREADY_RUNNING
Definition: winerror.h:607
#define SERVICE_START
Definition: winsvc.h:57
#define SERVICE_QUERY_STATUS
Definition: winsvc.h:55
@ SC_STATUS_PROCESS_INFO
Definition: winsvc.h:119
#define SC_MANAGER_ENUMERATE_SERVICE
Definition: winsvc.h:16
#define SERVICE_NO_CHANGE
Definition: winsvc.h:20
#define SERVICE_CHANGE_CONFIG
Definition: winsvc.h:54
#define SERVICE_START_PENDING
Definition: winsvc.h:22
#define SERVICE_RUNNING
Definition: winsvc.h:24
#define SERVICE_AUTO_START
Definition: cmtypes.h:977

Referenced by CommonInstall().

◆ FatalError()

static VOID FatalError ( char pszFmt,
  ... 
)
static

Definition at line 53 of file install.c.

54{
55 char szBuffer[512];
56 va_list ap;
57
58 va_start(ap, pszFmt);
59 vsprintf(szBuffer, pszFmt, ap);
60 va_end(ap);
61
62 LogItem(NULL, L"Failed");
63
64 strcat(szBuffer, "\nRebooting now!");
66 szBuffer,
67 "ReactOS Setup",
68 MB_OK);
69}
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
char * va_list
Definition: acmsvcex.h:78
#define va_end(ap)
Definition: acmsvcex.h:90
#define va_start(ap, A)
Definition: acmsvcex.h:91
int __cdecl vsprintf(char *_Dest, const char *_Format, va_list _Args)
Definition: sprintf.c:733
#define LogItem(lpTag, lpMessageText...)
Definition: syssetup.h:98
void int int ULONGLONG int va_list * ap
Definition: winesup.h:36
int WINAPI MessageBoxA(_In_opt_ HWND hWnd, _In_opt_ LPCSTR lpText, _In_opt_ LPCSTR lpCaption, _In_ UINT uType)
#define MB_OK
Definition: winuser.h:784

Referenced by CommonInstall(), CreateTempDir(), InstallReactOS(), InstallSysSetupInfComponents(), and RegisterTypeLibraries().

◆ HotkeyThread()

static DWORD CALLBACK HotkeyThread ( LPVOID  Parameter)
static

Definition at line 1044 of file install.c.

1045{
1046 ATOM hotkey;
1047 MSG msg;
1048
1049 DPRINT("HotkeyThread start\n");
1050
1051 hotkey = GlobalAddAtomW(L"Setup Shift+F10 Hotkey");
1052
1053 if (!RegisterHotKey(NULL, hotkey, MOD_SHIFT, VK_F10))
1054 DPRINT1("RegisterHotKey failed with %lu\n", GetLastError());
1055
1056 while (GetMessage(&msg, NULL, 0, 0))
1057 {
1058 if (msg.hwnd == NULL && msg.message == WM_HOTKEY && msg.wParam == hotkey)
1059 {
1060 STARTUPINFOW si = { sizeof(si) };
1062
1063 if (CreateProcessW(L"cmd.exe",
1064 NULL,
1065 NULL,
1066 NULL,
1067 FALSE,
1069 NULL,
1070 NULL,
1071 &si,
1072 &pi))
1073 {
1074 CloseHandle(pi.hProcess);
1075 CloseHandle(pi.hThread);
1076 }
1077 else
1078 {
1079 DPRINT1("Failed to launch command prompt: %lu\n", GetLastError());
1080 }
1081 }
1082 }
1083
1084 UnregisterHotKey(NULL, hotkey);
1085 GlobalDeleteAtom(hotkey);
1086
1087 DPRINT("HotkeyThread terminate\n");
1088 return 0;
1089}
#define msg(x)
Definition: auth_time.c:54
WORD ATOM
Definition: dimm.idl:113
ATOM WINAPI GlobalDeleteAtom(ATOM nAtom)
Definition: atom.c:454
ATOM WINAPI GlobalAddAtomW(LPCWSTR lpString)
Definition: atom.c:444
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:4593
#define MOD_SHIFT
Definition: imm.h:321
static refpint_t pi[]
Definition: server.c:96
#define DPRINT
Definition: sndvol32.h:71
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
#define CREATE_NEW_CONSOLE
Definition: winbase.h:180
#define VK_F10
Definition: winuser.h:2254
BOOL WINAPI UnregisterHotKey(_In_opt_ HWND, _In_ int)
#define GetMessage
Definition: winuser.h:5780
BOOL WINAPI RegisterHotKey(_In_opt_ HWND, _In_ int, _In_ UINT, _In_ UINT)
#define WM_HOTKEY
Definition: winuser.h:1869

Referenced by InstallReactOS().

◆ InitializeDefaultUserLocale()

static VOID InitializeDefaultUserLocale ( VOID  )
static

Definition at line 1209 of file install.c.

1210{
1211 WCHAR szBuffer[80];
1212 PWSTR ptr;
1213 HKEY hLocaleKey;
1214 DWORD ret;
1215 DWORD dwSize;
1216 LCID lcid;
1217 INT i;
1218
1219 struct {LCTYPE LCType; PWSTR pValue;} LocaleData[] = {
1220 /* Number */
1221 {LOCALE_SDECIMAL, L"sDecimal"},
1222 {LOCALE_STHOUSAND, L"sThousand"},
1223 {LOCALE_SNEGATIVESIGN, L"sNegativeSign"},
1224 {LOCALE_SPOSITIVESIGN, L"sPositiveSign"},
1225 {LOCALE_SGROUPING, L"sGrouping"},
1226 {LOCALE_SLIST, L"sList"},
1227 {LOCALE_SNATIVEDIGITS, L"sNativeDigits"},
1228 {LOCALE_INEGNUMBER, L"iNegNumber"},
1229 {LOCALE_IDIGITS, L"iDigits"},
1230 {LOCALE_ILZERO, L"iLZero"},
1231 {LOCALE_IMEASURE, L"iMeasure"},
1232 {LOCALE_IDIGITSUBSTITUTION, L"NumShape"},
1233
1234 /* Currency */
1235 {LOCALE_SCURRENCY, L"sCurrency"},
1236 {LOCALE_SMONDECIMALSEP, L"sMonDecimalSep"},
1237 {LOCALE_SMONTHOUSANDSEP, L"sMonThousandSep"},
1238 {LOCALE_SMONGROUPING, L"sMonGrouping"},
1239 {LOCALE_ICURRENCY, L"iCurrency"},
1240 {LOCALE_INEGCURR, L"iNegCurr"},
1241 {LOCALE_ICURRDIGITS, L"iCurrDigits"},
1242
1243 /* Time */
1244 {LOCALE_STIMEFORMAT, L"sTimeFormat"},
1245 {LOCALE_STIME, L"sTime"},
1246 {LOCALE_S1159, L"s1159"},
1247 {LOCALE_S2359, L"s2359"},
1248 {LOCALE_ITIME, L"iTime"},
1249 {LOCALE_ITIMEMARKPOSN, L"iTimePrefix"},
1250 {LOCALE_ITLZERO, L"iTLZero"},
1251
1252 /* Date */
1253 {LOCALE_SLONGDATE, L"sLongDate"},
1254 {LOCALE_SSHORTDATE, L"sShortDate"},
1255 {LOCALE_SDATE, L"sDate"},
1256 {LOCALE_IFIRSTDAYOFWEEK, L"iFirstDayOfWeek"},
1257 {LOCALE_IFIRSTWEEKOFYEAR, L"iFirstWeekOfYear"},
1258 {LOCALE_IDATE, L"iDate"},
1259 {LOCALE_ICALENDARTYPE, L"iCalendarType"},
1260
1261 /* Misc */
1262 {LOCALE_SCOUNTRY, L"sCountry"},
1263 {LOCALE_SABBREVLANGNAME, L"sLanguage"},
1264 {LOCALE_ICOUNTRY, L"iCountry"},
1265 {0, NULL}};
1266
1268 L".DEFAULT\\Control Panel\\International",
1269 0,
1271 &hLocaleKey);
1272 if (ret != ERROR_SUCCESS)
1273 {
1274 return;
1275 }
1276
1277 dwSize = 9 * sizeof(WCHAR);
1278 ret = RegQueryValueExW(hLocaleKey,
1279 L"Locale",
1280 NULL,
1281 NULL,
1282 (PBYTE)szBuffer,
1283 &dwSize);
1284 if (ret != ERROR_SUCCESS)
1285 goto done;
1286
1287 lcid = (LCID)wcstoul(szBuffer, &ptr, 16);
1288 if (lcid == 0)
1289 goto done;
1290
1291 i = 0;
1292 while (LocaleData[i].pValue != NULL)
1293 {
1294 if (GetLocaleInfoW(lcid,
1295 LocaleData[i].LCType | LOCALE_NOUSEROVERRIDE,
1296 szBuffer,
1297 ARRAYSIZE(szBuffer)))
1298 {
1299 RegSetValueExW(hLocaleKey,
1300 LocaleData[i].pValue,
1301 0,
1302 REG_SZ,
1303 (PBYTE)szBuffer,
1304 (wcslen(szBuffer) + 1) * sizeof(WCHAR));
1305 }
1306
1307 i++;
1308 }
1309
1310done:
1311 RegCloseKey(hLocaleKey);
1312}
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4900
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
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: lang.c:1102
#define REG_SZ
Definition: layer.c:22
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
static PVOID ptr
Definition: dispmode.c:27
#define KEY_READ
Definition: nt_native.h:1023
#define KEY_WRITE
Definition: nt_native.h:1031
BYTE * PBYTE
Definition: pedump.c:66
DWORD LCID
Definition: nls.h:13
uint16_t * PWSTR
Definition: typedefs.h:56
int ret
#define LOCALE_ICURRDIGITS
Definition: winnls.h:54
#define LOCALE_SCOUNTRY
Definition: winnls.h:31
#define LOCALE_SDATE
Definition: winnls.h:58
#define LOCALE_SGROUPING
Definition: winnls.h:44
#define LOCALE_ICOUNTRY
Definition: winnls.h:30
#define LOCALE_SDECIMAL
Definition: winnls.h:42
#define LOCALE_IDATE
Definition: winnls.h:63
#define LOCALE_IFIRSTWEEKOFYEAR
Definition: winnls.h:76
#define LOCALE_IMEASURE
Definition: winnls.h:41
#define LOCALE_SLONGDATE
Definition: winnls.h:61
#define LOCALE_S1159
Definition: winnls.h:71
#define LOCALE_SSHORTDATE
Definition: winnls.h:60
#define LOCALE_SPOSITIVESIGN
Definition: winnls.h:117
#define LOCALE_SMONDECIMALSEP
Definition: winnls.h:51
#define LOCALE_ITIME
Definition: winnls.h:65
#define LOCALE_ICURRENCY
Definition: winnls.h:56
#define LOCALE_ITLZERO
Definition: winnls.h:68
#define LOCALE_SMONTHOUSANDSEP
Definition: winnls.h:52
#define LOCALE_NOUSEROVERRIDE
Definition: winnls.h:19
#define LOCALE_IDIGITS
Definition: winnls.h:45
#define LOCALE_STHOUSAND
Definition: winnls.h:43
#define LOCALE_STIMEFORMAT
Definition: winnls.h:62
#define LOCALE_IFIRSTDAYOFWEEK
Definition: winnls.h:75
#define LOCALE_STIME
Definition: winnls.h:59
#define LOCALE_SABBREVLANGNAME
Definition: winnls.h:28
#define LOCALE_INEGNUMBER
Definition: winnls.h:47
#define LOCALE_SNEGATIVESIGN
Definition: winnls.h:118
DWORD LCTYPE
Definition: winnls.h:517
#define LOCALE_S2359
Definition: winnls.h:72
#define LOCALE_SNATIVEDIGITS
Definition: winnls.h:48
#define LOCALE_SLIST
Definition: winnls.h:40
#define LOCALE_ILZERO
Definition: winnls.h:46
#define LOCALE_ICALENDARTYPE
Definition: winnls.h:73
#define LOCALE_SMONGROUPING
Definition: winnls.h:53
#define LOCALE_SCURRENCY
Definition: winnls.h:49
#define LOCALE_INEGCURR
Definition: winnls.h:57
#define LOCALE_ITIMEMARKPOSN
Definition: winnls.h:66
#define HKEY_USERS
Definition: winreg.h:13

Referenced by InstallReactOS().

◆ InitializeProgramFilesDir()

static BOOL InitializeProgramFilesDir ( VOID  )
static

Definition at line 1094 of file install.c.

1095{
1096 LONG Error;
1097 HKEY hKey;
1099 WCHAR szProgramFilesDirPath[MAX_PATH];
1100 WCHAR szCommonFilesDirPath[MAX_PATH];
1101 WCHAR szBuffer[MAX_PATH];
1102
1103 /* Load 'Program Files' location */
1106 szBuffer,
1107 ARRAYSIZE(szBuffer)))
1108 {
1109 DPRINT1("Error: %lu\n", GetLastError());
1110 return FALSE;
1111 }
1112
1115 szCommonFilesDirPath,
1116 ARRAYSIZE(szCommonFilesDirPath)))
1117 {
1118 DPRINT1("Warning: %lu\n", GetLastError());
1119 }
1120
1121 /* Expand it */
1122 if (!ExpandEnvironmentStringsW(szBuffer,
1123 szProgramFilesDirPath,
1124 ARRAYSIZE(szProgramFilesDirPath)))
1125 {
1126 DPRINT1("Error: %lu\n", GetLastError());
1127 return FALSE;
1128 }
1129
1130 wcscpy(szBuffer, szProgramFilesDirPath);
1131 wcscat(szBuffer, L"\\");
1132 wcscat(szBuffer, szCommonFilesDirPath);
1133
1134 if (!ExpandEnvironmentStringsW(szBuffer,
1135 szCommonFilesDirPath,
1136 ARRAYSIZE(szCommonFilesDirPath)))
1137 {
1138 DPRINT1("Warning: %lu\n", GetLastError());
1139 }
1140
1141 /* Store it */
1143 L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion",
1144 0,
1146 &hKey);
1147 if (Error != ERROR_SUCCESS)
1148 {
1149 DPRINT1("Error: %lu\n", Error);
1150 return FALSE;
1151 }
1152
1153 dwLength = (wcslen(szProgramFilesDirPath) + 1) * sizeof(WCHAR);
1155 L"ProgramFilesDir",
1156 0,
1157 REG_SZ,
1158 (LPBYTE)szProgramFilesDirPath,
1159 dwLength);
1160 if (Error != ERROR_SUCCESS)
1161 {
1162 DPRINT1("Error: %lu\n", Error);
1164 return FALSE;
1165 }
1166
1167 dwLength = (wcslen(szCommonFilesDirPath) + 1) * sizeof(WCHAR);
1169 L"CommonFilesDir",
1170 0,
1171 REG_SZ,
1172 (LPBYTE)szCommonFilesDirPath,
1173 dwLength);
1174 if (Error != ERROR_SUCCESS)
1175 {
1176 DPRINT1("Warning: %lu\n", Error);
1177 }
1178
1180
1181 /* Create directory */
1182 // FIXME: Security!
1183 if (!CreateDirectoryW(szProgramFilesDirPath, NULL))
1184 {
1186 {
1187 DPRINT1("Error: %lu\n", GetLastError());
1188 return FALSE;
1189 }
1190 }
1191
1192 /* Create directory */
1193 // FIXME: Security!
1194 if (!CreateDirectoryW(szCommonFilesDirPath, NULL))
1195 {
1197 {
1198 DPRINT1("Warning: %lu\n", GetLastError());
1199 // return FALSE;
1200 }
1201 }
1202
1203 return TRUE;
1204}
BOOL Error
Definition: chkdsk.c:66
static HINSTANCE hDllInstance
Definition: clb.c:30
#define IDS_PROGRAMFILES
Definition: resource.h:154
#define IDS_COMMONFILES
Definition: resource.h:155
#define KEY_SET_VALUE
Definition: nt_native.h:1017
long LONG
Definition: pedump.c:60
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)

Referenced by InstallReactOS().

◆ InstallLiveCD()

static DWORD InstallLiveCD ( VOID  )
static

Definition at line 939 of file install.c.

940{
941 STARTUPINFOW StartupInfo;
942 PROCESS_INFORMATION ProcessInformation;
943 BOOL bRes;
944
945 if (!CommonInstall())
946 goto error;
947
948 /* Install the TCP/IP protocol driver */
949 bRes = InstallNetworkComponent(L"MS_TCPIP");
950 if (!bRes && GetLastError() != ERROR_FILE_NOT_FOUND)
951 {
952 DPRINT("InstallNetworkComponent() failed with error 0x%lx\n", GetLastError());
953 }
954 else
955 {
956 /* Start the TCP/IP protocol driver */
957 SetupStartService(L"Tcpip", FALSE);
958 SetupStartService(L"Dhcp", FALSE);
959 SetupStartService(L"Dnscache", FALSE);
960 }
961
962 /* Register components */
964 {
966 hSysSetupInf, L"RegistrationPhase2",
968 0, NULL, 0, NULL, NULL, NULL, NULL))
969 {
970 DPRINT1("SetupInstallFromInfSectionW failed!\n");
971 }
972
973 RegisterTypeLibraries(hSysSetupInf, L"TypeLibraries");
974 }
976 {
977 DPRINT1("Catching exception\n");
978 }
979 _SEH2_END;
980
982
983 /* Run the shell */
984 ZeroMemory(&StartupInfo, sizeof(StartupInfo));
985 StartupInfo.cb = sizeof(StartupInfo);
986 bRes = CreateProcessW(L"userinit.exe",
987 NULL,
988 NULL,
989 NULL,
990 FALSE,
991 0,
992 NULL,
993 NULL,
994 &StartupInfo,
995 &ProcessInformation);
996 if (!bRes)
997 goto error;
998
999 CloseHandle(ProcessInformation.hThread);
1000 CloseHandle(ProcessInformation.hProcess);
1001
1002 return 0;
1003
1004error:
1006 NULL,
1007 L"Failed to load LiveCD! You can shutdown your computer, or press ENTER to reboot.",
1008 L"ReactOS LiveCD",
1009 MB_OK);
1010 return 0;
1011}
BOOL WINAPI SetupInstallFromInfSectionW(HWND owner, HINF hinf, PCWSTR section, UINT flags, HKEY key_root, PCWSTR src_root, UINT copy_flags, PSP_FILE_CALLBACK_W callback, PVOID context, HDEVINFO devinfo, PSP_DEVINFO_DATA devinfo_data)
Definition: install.c:1327
BOOL InstallNetworkComponent(_In_ PWSTR pszComponentId)
Definition: netinstall.c:467
static BOOL CommonInstall(VOID)
Definition: install.c:869
DWORD WINAPI SetupStartService(LPCWSTR lpServiceName, BOOL bWait)
Definition: install.c:1643
BOOL RegisterTypeLibraries(HINF hinf, LPCWSTR szSection)
Definition: install.c:438
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define error(str)
Definition: mkdosfs.c:1605
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:34
#define SPINST_ALL
Definition: setupapi.h:601
DWORD cb
Definition: winbase.h:852
#define ZeroMemory
Definition: winbase.h:1670
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)

Referenced by InstallWindowsNt().

◆ InstallReactOS()

static DWORD InstallReactOS ( VOID  )
static

Definition at line 1390 of file install.c.

1391{
1392 WCHAR szBuffer[MAX_PATH];
1393 HANDLE token;
1394 TOKEN_PRIVILEGES privs;
1395 HKEY hKey;
1396 HINF hShortcutsInf;
1397 HANDLE hHotkeyThread;
1398 BOOL ret;
1399
1401 LogItem(NULL, L"Installing ReactOS");
1402
1403 CreateTempDir(L"TEMP");
1404 CreateTempDir(L"TMP");
1405
1407 {
1408 FatalError("InitializeProgramFilesDir() failed");
1409 return 0;
1410 }
1411
1412 if (!InitializeProfiles())
1413 {
1414 FatalError("InitializeProfiles() failed");
1415 return 0;
1416 }
1417
1419
1420 if (GetWindowsDirectoryW(szBuffer, ARRAYSIZE(szBuffer)))
1421 {
1423 L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion",
1424 0,
1425 KEY_WRITE,
1426 &hKey) == ERROR_SUCCESS)
1427 {
1429 L"PathName",
1430 0,
1431 REG_SZ,
1432 (LPBYTE)szBuffer,
1433 (wcslen(szBuffer) + 1) * sizeof(WCHAR));
1434
1436 L"SystemRoot",
1437 0,
1438 REG_SZ,
1439 (LPBYTE)szBuffer,
1440 (wcslen(szBuffer) + 1) * sizeof(WCHAR));
1441
1443 }
1444
1445 PathAddBackslash(szBuffer);
1446 wcscat(szBuffer, L"system");
1447 CreateDirectory(szBuffer, NULL);
1448 }
1449
1451 {
1452 FatalError("SaveDefaultUserHive() failed");
1453 return 0;
1454 }
1455
1456 if (!CopySystemProfile(0))
1457 {
1458 FatalError("CopySystemProfile() failed");
1459 return 0;
1460 }
1461
1462 hHotkeyThread = CreateThread(NULL, 0, HotkeyThread, NULL, 0, NULL);
1463
1464 if (!CommonInstall())
1465 return 0;
1466
1467 /* Install the TCP/IP protocol driver */
1468 ret = InstallNetworkComponent(L"MS_TCPIP");
1470 {
1471 DPRINT("InstallNetworkComponent() failed with error 0x%lx\n", GetLastError());
1472 }
1473 else
1474 {
1475 /* Start the TCP/IP protocol driver */
1476 SetupStartService(L"Tcpip", FALSE);
1477 SetupStartService(L"Dhcp", FALSE);
1478 SetupStartService(L"Dnscache", FALSE);
1479 }
1480
1481 InstallWizard();
1482
1484
1486
1487 hShortcutsInf = SetupOpenInfFileW(L"shortcuts.inf",
1488 NULL,
1490 NULL);
1491 if (hShortcutsInf == INVALID_HANDLE_VALUE)
1492 {
1493 FatalError("Failed to open shortcuts.inf");
1494 return 0;
1495 }
1496
1497 if (!CreateShortcuts(hShortcutsInf, L"ShortcutFolders"))
1498 {
1499 FatalError("CreateShortcuts() failed");
1500 return 0;
1501 }
1502
1503 SetupCloseInfFile(hShortcutsInf);
1504
1505 hShortcutsInf = SetupOpenInfFileW(L"rosapps_shortcuts.inf",
1506 NULL,
1508 NULL);
1509 if (hShortcutsInf != INVALID_HANDLE_VALUE)
1510 {
1511 if (!CreateShortcuts(hShortcutsInf, L"ShortcutFolders"))
1512 {
1513 FatalError("CreateShortcuts(rosapps) failed");
1514 return 0;
1515 }
1516 SetupCloseInfFile(hShortcutsInf);
1517 }
1518
1520 SetSetupType(0);
1521
1522 if (hHotkeyThread)
1523 {
1524 PostThreadMessage(GetThreadId(hHotkeyThread), WM_QUIT, 0, 0);
1525 CloseHandle(hHotkeyThread);
1526 }
1527
1528 LogItem(NULL, L"Installing ReactOS done");
1530
1531 if (AdminInfo.Name != NULL)
1532 RtlFreeHeap(RtlGetProcessHeap(), 0, AdminInfo.Name);
1533
1534 if (AdminInfo.Domain != NULL)
1535 RtlFreeHeap(RtlGetProcessHeap(), 0, AdminInfo.Domain);
1536
1537 if (AdminInfo.Password != NULL)
1538 RtlFreeHeap(RtlGetProcessHeap(), 0, AdminInfo.Password);
1539
1540 /* Get shutdown privilege */
1542 {
1543 FatalError("OpenProcessToken() failed!");
1544 return 0;
1545 }
1548 &privs.Privileges[0].Luid))
1549 {
1550 FatalError("LookupPrivilegeValue() failed!");
1551 return 0;
1552 }
1553 privs.PrivilegeCount = 1;
1556 FALSE,
1557 &privs,
1558 0,
1560 NULL) == 0)
1561 {
1562 FatalError("AdjustTokenPrivileges() failed!");
1563 return 0;
1564 }
1565
1567 return 0;
1568}
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
BOOL WINAPI AdjustTokenPrivileges(HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength)
Definition: security.c:376
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:296
#define GetCurrentProcess()
Definition: compat.h:759
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2352
VOID SetAutoAdminLogon(VOID)
Definition: security.c:1748
VOID InstallSecurity(VOID)
Definition: security.c:1569
VOID InstallWizard(VOID)
Definition: wizard.c:3137
static VOID InitializeDefaultUserLocale(VOID)
Definition: install.c:1209
static DWORD SaveDefaultUserHive(VOID)
Definition: install.c:1317
static BOOL CreateShortcuts(HINF hinf, LPCWSTR szSection)
Definition: install.c:230
ADMIN_INFO AdminInfo
Definition: install.c:38
static VOID CreateTempDir(IN LPCWSTR VarName)
Definition: install.c:270
static BOOL SetSetupType(DWORD dwSetupType)
Definition: install.c:1015
static BOOL InitializeProgramFilesDir(VOID)
Definition: install.c:1094
static DWORD CALLBACK HotkeyThread(LPVOID Parameter)
Definition: install.c:1044
BOOL WINAPI CopySystemProfile(_In_ ULONG Unused)
Definition: profile.c:565
BOOL WINAPI InitializeProfiles(VOID)
Definition: setup.c:335
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 token
Definition: glfuncs.h:210
BOOL WINAPI InitializeSetupActionLog(BOOL bDeleteOldLogFile)
Definition: logfile.c:42
VOID WINAPI TerminateSetupActionLog(VOID)
Definition: logfile.c:82
LPWSTR Password
Definition: globals.h:25
LPWSTR Name
Definition: globals.h:23
LPWSTR Domain
Definition: globals.h:24
$ULONG PrivilegeCount
Definition: setypes.h:1019
LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY]
Definition: setypes.h:1020
#define LookupPrivilegeValue
Definition: winbase.h:3741
#define CreateDirectory
Definition: winbase.h:3617
#define SE_SHUTDOWN_NAME
Definition: winnt_old.h:384
#define EWX_REBOOT
Definition: winuser.h:633
BOOL WINAPI ExitWindowsEx(_In_ UINT, _In_ DWORD)
#define TOKEN_ADJUST_PRIVILEGES
Definition: setypes.h:926
#define SE_PRIVILEGE_ENABLED
Definition: setypes.h:63

Referenced by InstallWindowsNt(), and RunInstallReactOS().

◆ InstallSysSetupInfComponents()

static BOOL InstallSysSetupInfComponents ( VOID  )
static

Definition at line 359 of file install.c.

360{
361 INFCONTEXT InfContext;
362 WCHAR szNameBuffer[256];
363 WCHAR szSectionBuffer[256];
364 HINF hComponentInf = INVALID_HANDLE_VALUE;
365
367 L"Infs.Always",
368 NULL,
369 &InfContext))
370 {
371 DPRINT("No Inf.Always section found\n");
372 }
373 else
374 {
375 do
376 {
377 if (!SetupGetStringFieldW(&InfContext,
378 1, // Get the component name
379 szNameBuffer,
380 ARRAYSIZE(szNameBuffer),
381 NULL))
382 {
383 FatalError("Error while trying to get component name\n");
384 return FALSE;
385 }
386
387 if (!SetupGetStringFieldW(&InfContext,
388 2, // Get the component install section
389 szSectionBuffer,
390 ARRAYSIZE(szSectionBuffer),
391 NULL))
392 {
393 FatalError("Error while trying to get component install section\n");
394 return FALSE;
395 }
396
397 DPRINT("Trying to execute install section '%S' from '%S'\n", szSectionBuffer, szNameBuffer);
398
399 hComponentInf = SetupOpenInfFileW(szNameBuffer,
400 NULL,
402 NULL);
403
404 if (hComponentInf == INVALID_HANDLE_VALUE)
405 {
406 FatalError("SetupOpenInfFileW() failed to open '%S' (Error: %lu)\n", szNameBuffer, GetLastError());
407 return FALSE;
408 }
409
411 hComponentInf,
412 szSectionBuffer,
414 NULL,
415 NULL,
418 NULL,
419 NULL,
420 NULL))
421 {
422 FatalError("Error while trying to install : %S (Error: %lu)\n", szNameBuffer, GetLastError());
423 SetupCloseInfFile(hComponentInf);
424 return FALSE;
425 }
426
427 SetupCloseInfFile(hComponentInf);
428 }
429 while (SetupFindNextLine(&InfContext, &InfContext));
430 }
431
432 return TRUE;
433}
UINT WINAPI SetupDefaultQueueCallbackW(PVOID context, UINT notification, UINT_PTR param1, UINT_PTR param2)
Definition: queue.c:1777
#define SP_COPY_NEWER
Definition: setupapi.h:478
BOOL WINAPI SetupFindFirstLineW(IN HINF InfHandle, IN PCWSTR Section, IN PCWSTR Key, IN OUT PINFCONTEXT Context)
Definition: infsupp.c:54

Referenced by CommonInstall().

◆ InstallSysSetupInfDevices()

static BOOL InstallSysSetupInfDevices ( VOID  )
static

Definition at line 323 of file install.c.

324{
325 INFCONTEXT InfContext;
326 WCHAR szLineBuffer[256];
327 DWORD dwLineLength;
328
330 L"DeviceInfsToInstall",
331 NULL,
332 &InfContext))
333 {
334 return FALSE;
335 }
336
337 do
338 {
339 if (!SetupGetStringFieldW(&InfContext,
340 0,
341 szLineBuffer,
342 ARRAYSIZE(szLineBuffer),
343 &dwLineLength))
344 {
345 return FALSE;
346 }
347
348 if (!SetupDiInstallClassW(NULL, szLineBuffer, DI_QUIETINSTALL, NULL))
349 {
350 return FALSE;
351 }
352 }
353 while (SetupFindNextLine(&InfContext, &InfContext));
354
355 return TRUE;
356}
BOOL WINAPI SetupDiInstallClassW(HWND hwndParent, PCWSTR InfFileName, DWORD Flags, HSPFILEQ FileQueue)
Definition: devinst.c:3605
#define DI_QUIETINSTALL
Definition: setupapi.h:68

Referenced by CommonInstall().

◆ InstallWindowsNt()

INT WINAPI InstallWindowsNt ( INT  argc,
WCHAR **  argv 
)

Definition at line 1577 of file install.c.

1578{
1579 INT i;
1580 PWSTR p;
1581
1582 for (i = 0; i < argc; ++i)
1583 {
1584 p = argv[i];
1585 if (*p == L'-')
1586 {
1587 p++;
1588
1589 // NOTE: On Windows, "mini" means "minimal UI", and can be used
1590 // in addition to "newsetup"; these options are not exclusive.
1591 if (_wcsicmp(p, L"newsetup") == 0)
1592 return (INT)InstallReactOS();
1593 else if (_wcsicmp(p, L"mini") == 0)
1594 return (INT)InstallLiveCD();
1595
1596 /* Add support for other switches */
1597 }
1598 }
1599
1600 return 0;
1601}
static int argc
Definition: ServiceArgs.c:12
static DWORD InstallLiveCD(VOID)
Definition: install.c:939
static DWORD InstallReactOS(VOID)
Definition: install.c:1390
GLfloat GLfloat p
Definition: glext.h:8902
#define argv
Definition: mplay32.c:18
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)

◆ IsConsoleBoot()

static BOOL IsConsoleBoot ( VOID  )
static

Definition at line 824 of file install.c.

825{
826 HKEY hControlKey = NULL;
827 LPWSTR pwszSystemStartOptions = NULL;
828 LPWSTR pwszCurrentOption, pwszNextOption; /* Pointers into SystemStartOptions */
829 BOOL bConsoleBoot = FALSE;
830 LONG rc;
831
833 L"SYSTEM\\CurrentControlSet\\Control",
834 0,
836 &hControlKey);
837 if (rc != ERROR_SUCCESS)
838 goto cleanup;
839
840 rc = ReadRegSzKey(hControlKey, L"SystemStartOptions", &pwszSystemStartOptions);
841 if (rc != ERROR_SUCCESS)
842 goto cleanup;
843
844 /* Check for CONSOLE switch in SystemStartOptions */
845 pwszCurrentOption = pwszSystemStartOptions;
846 while (pwszCurrentOption)
847 {
848 pwszNextOption = wcschr(pwszCurrentOption, L' ');
849 if (pwszNextOption)
850 *pwszNextOption = L'\0';
851 if (wcsicmp(pwszCurrentOption, L"CONSOLE") == 0)
852 {
853 DPRINT("Found %S. Switching to console boot\n", pwszCurrentOption);
854 bConsoleBoot = TRUE;
855 goto cleanup;
856 }
857 pwszCurrentOption = pwszNextOption ? pwszNextOption + 1 : NULL;
858 }
859
860cleanup:
861 if (hControlKey != NULL)
862 RegCloseKey(hControlKey);
863 if (pwszSystemStartOptions)
864 HeapFree(GetProcessHeap(), 0, pwszSystemStartOptions);
865 return bConsoleBoot;
866}
static LONG ReadRegSzKey(IN HKEY hKey, IN LPCWSTR pszKey, OUT LPWSTR *pValue)
Definition: install.c:253
#define wcschr
Definition: compat.h:17
#define GetProcessHeap()
Definition: compat.h:736
#define HeapFree(x, y, z)
Definition: compat.h:735
#define wcsicmp
Definition: compat.h:15

◆ ReadRegSzKey()

static LONG ReadRegSzKey ( IN HKEY  hKey,
IN LPCWSTR  pszKey,
OUT LPWSTR pValue 
)
static

Definition at line 788 of file install.c.

792{
793 LONG rc;
794 DWORD dwType;
795 DWORD cbData = 0;
796 LPWSTR pwszValue;
797
798 if (!pValue)
800
801 *pValue = NULL;
802 rc = RegQueryValueExW(hKey, pszKey, NULL, &dwType, NULL, &cbData);
803 if (rc != ERROR_SUCCESS)
804 return rc;
805 if (dwType != REG_SZ)
807 pwszValue = HeapAlloc(GetProcessHeap(), 0, cbData + sizeof(WCHAR));
808 if (!pwszValue)
810 rc = RegQueryValueExW(hKey, pszKey, NULL, NULL, (LPBYTE)pwszValue, &cbData);
811 if (rc != ERROR_SUCCESS)
812 {
813 HeapFree(GetProcessHeap(), 0, pwszValue);
814 return rc;
815 }
816 /* NULL-terminate the string */
817 pwszValue[cbData / sizeof(WCHAR)] = '\0';
818
819 *pValue = pwszValue;
820 return ERROR_SUCCESS;
821}
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define HeapAlloc
Definition: compat.h:733

◆ RegisterTypeLibraries()

BOOL RegisterTypeLibraries ( HINF  hinf,
LPCWSTR  szSection 
)

Definition at line 438 of file install.c.

439{
440 INFCONTEXT InfContext;
441 BOOL res;
444 INT csidl;
445 LPWSTR p;
447 HRESULT hret;
448
449 /* Begin iterating the entries in the inf section */
450 res = SetupFindFirstLine(hinf, szSection, NULL, &InfContext);
451 if (!res) return FALSE;
452
453 do
454 {
455 /* Get the name of the current type library */
456 if (!SetupGetStringFieldW(&InfContext, 1, szName, ARRAYSIZE(szName), NULL))
457 {
458 FatalError("SetupGetStringFieldW failed\n");
459 continue;
460 }
461
462 if (!SetupGetIntField(&InfContext, 2, &csidl))
463 csidl = CSIDL_SYSTEM;
464
465 hret = SHGetFolderPathW(NULL, csidl, NULL, 0, szPath);
466 if (FAILED(hret))
467 {
468 FatalError("SHGetFolderPathW failed hret=0x%lx\n", hret);
469 continue;
470 }
471
473 wcscpy(p, szName);
474
476 if (hmod == NULL)
477 {
478 FatalError("LoadLibraryW failed\n");
479 continue;
480 }
481
483
484 } while (SetupFindNextLine(&InfContext, &InfContext));
485
486 return TRUE;
487}
#define LoadLibraryW(x)
Definition: compat.h:747
HRESULT WINAPI SHGetFolderPathW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath)
Definition: shellpath.c:2558
GLuint res
Definition: glext.h:9613
static PEXPLICIT_ACCESSW *static HMODULE hmod
Definition: security.c:143
HRESULT __wine_register_resources(HMODULE module) DECLSPEC_HIDDEN
Definition: register.c:98
#define CSIDL_SYSTEM
Definition: shlobj.h:2061

Referenced by InstallLiveCD(), and ItemCompletionThread().

◆ SaveDefaultUserHive()

static DWORD SaveDefaultUserHive ( VOID  )
static

Definition at line 1317 of file install.c.

1318{
1319 WCHAR szDefaultUserHive[MAX_PATH];
1320 HKEY hUserKey = NULL;
1321 DWORD cchSize;
1322 DWORD dwError;
1323
1324 DPRINT("SaveDefaultUserHive()\n");
1325
1326 cchSize = ARRAYSIZE(szDefaultUserHive);
1327 GetDefaultUserProfileDirectoryW(szDefaultUserHive, &cchSize);
1328
1329 wcscat(szDefaultUserHive, L"\\ntuser.dat");
1330
1331 dwError = RegOpenKeyExW(HKEY_USERS,
1332 L".DEFAULT",
1333 0,
1334 KEY_READ,
1335 &hUserKey);
1336 if (dwError != ERROR_SUCCESS)
1337 {
1338 DPRINT1("RegOpenKeyExW() failed (Error %lu)\n", dwError);
1339 return dwError;
1340 }
1341
1342 pSetupEnablePrivilege(L"SeBackupPrivilege", TRUE);
1343
1344 /* Save the Default hive */
1345 dwError = RegSaveKeyExW(hUserKey,
1346 szDefaultUserHive,
1347 NULL,
1349 if (dwError == ERROR_ALREADY_EXISTS)
1350 {
1351 WCHAR szBackupHive[MAX_PATH];
1352
1353 /* Build the backup hive file name by replacing the extension */
1354 wcscpy(szBackupHive, szDefaultUserHive);
1355 wcscpy(&szBackupHive[wcslen(szBackupHive) - 4], L".bak");
1356
1357 /* Back up the existing default user hive by renaming it, replacing any possible existing old backup */
1358 if (!MoveFileExW(szDefaultUserHive,
1359 szBackupHive,
1361 {
1362 dwError = GetLastError();
1363 DPRINT1("Failed to create a default-user hive backup '%S', MoveFileExW failed (Error %lu)\n",
1364 szBackupHive, dwError);
1365 }
1366 else
1367 {
1368 /* The backup has been done, retry saving the Default hive */
1369 dwError = RegSaveKeyExW(hUserKey,
1370 szDefaultUserHive,
1371 NULL,
1373 }
1374 }
1375 if (dwError != ERROR_SUCCESS)
1376 {
1377 DPRINT1("RegSaveKeyExW() failed (Error %lu)\n", dwError);
1378 }
1379
1380 pSetupEnablePrivilege(L"SeBackupPrivilege", FALSE);
1381
1382 RegCloseKey(hUserKey);
1383
1384 return dwError;
1385}
LONG WINAPI RegSaveKeyExW(HKEY hKey, LPCWSTR lpFile, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD Flags)
Definition: reg.c:4748
BOOL WINAPI MoveFileExW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName OPTIONAL, IN DWORD dwFlags)
Definition: move.c:1120
BOOL WINAPI pSetupEnablePrivilege(LPCWSTR lpPrivilegeName, BOOL bEnable)
Definition: misc.c:440
BOOL WINAPI GetDefaultUserProfileDirectoryW(_Out_opt_ LPWSTR lpProfileDir, _Inout_ LPDWORD lpcchSize)
Definition: profile.c:1443
#define MOVEFILE_REPLACE_EXISTING
Definition: filesup.h:28
#define REG_STANDARD_FORMAT
Definition: cmtypes.h:97

Referenced by InstallReactOS().

◆ SetSetupType()

static BOOL SetSetupType ( DWORD  dwSetupType)
static

Definition at line 1015 of file install.c.

1016{
1017 DWORD dwError;
1018 HKEY hKey;
1019
1020 dwError = RegOpenKeyExW(
1022 L"SYSTEM\\Setup",
1023 0,
1025 &hKey);
1026 if (dwError != ERROR_SUCCESS)
1027 return FALSE;
1028
1029 dwError = RegSetValueExW(
1030 hKey,
1031 L"SetupType",
1032 0,
1033 REG_DWORD,
1034 (LPBYTE)&dwSetupType,
1035 sizeof(DWORD));
1037 if (dwError != ERROR_SUCCESS)
1038 return FALSE;
1039
1040 return TRUE;
1041}
#define REG_DWORD
Definition: sdbapi.c:596

Referenced by InstallReactOS().

◆ SetupChangeFontSize()

DWORD WINAPI SetupChangeFontSize ( IN HANDLE  hWnd,
IN LPCWSTR  lpszFontSize 
)

Definition at line 1608 of file install.c.

1611{
1613 return FALSE;
1614}
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
#define SetLastError(x)
Definition: compat.h:752

◆ SetupChangeLocale()

DWORD WINAPI SetupChangeLocale ( HWND  hWnd,
LCID  Lcid 
)

Definition at line 1635 of file install.c.

1636{
1637 return SetupChangeLocaleEx(hWnd, Lcid, NULL, 0, 0, 0);
1638}
HWND hWnd
Definition: settings.c:17
DWORD WINAPI SetupChangeLocaleEx(HWND hWnd, LCID Lcid, LPCWSTR lpSrcRootPath, char Unknown, DWORD dwUnused1, DWORD dwUnused2)
Definition: install.c:1620
_In_ CONST DEVPROPKEY _In_ LCID Lcid
Definition: iofuncs.h:2415

◆ SetupChangeLocaleEx()

DWORD WINAPI SetupChangeLocaleEx ( HWND  hWnd,
LCID  Lcid,
LPCWSTR  lpSrcRootPath,
char  Unknown,
DWORD  dwUnused1,
DWORD  dwUnused2 
)

Definition at line 1620 of file install.c.

1626{
1628 return FALSE;
1629}

Referenced by SetupChangeLocale().

◆ SetupStartService()

DWORD WINAPI SetupStartService ( LPCWSTR  lpServiceName,
BOOL  bWait 
)

Definition at line 1643 of file install.c.

1646{
1647 SC_HANDLE hManager = NULL;
1648 SC_HANDLE hService = NULL;
1649 DWORD dwError = ERROR_SUCCESS;
1650
1651 hManager = OpenSCManagerW(NULL,
1652 NULL,
1654 if (hManager == NULL)
1655 {
1656 dwError = GetLastError();
1657 goto done;
1658 }
1659
1660 hService = OpenServiceW(hManager,
1661 lpServiceName,
1663 if (hService == NULL)
1664 {
1665 dwError = GetLastError();
1666 goto done;
1667 }
1668
1669 if (!StartService(hService, 0, NULL))
1670 {
1671 dwError = GetLastError();
1672 goto done;
1673 }
1674
1675done:
1676 if (hService != NULL)
1677 CloseServiceHandle(hService);
1678
1679 if (hManager != NULL)
1680 CloseServiceHandle(hManager);
1681
1682 return dwError;
1683}
#define StartService
Definition: winsvc.h:585
#define SC_MANAGER_ALL_ACCESS
Definition: winsvc.h:13

Referenced by InstallLiveCD(), and InstallReactOS().

◆ ShowStatusMessageThread()

static DWORD WINAPI ShowStatusMessageThread ( IN LPVOID  lpParameter)
static

Definition at line 758 of file install.c.

760{
761 HWND hWnd;
762 MSG Msg;
763 UNREFERENCED_PARAMETER(lpParameter);
764
769 (LPARAM)NULL);
770 if (!hWnd)
771 return 0;
772
774
775 /* Message loop for the Status window */
776 while (GetMessage(&Msg, NULL, 0, 0))
777 {
780 }
781
782 EndDialog(hWnd, 0);
783
784 return 0;
785}
struct @1616 Msg[]
static INT_PTR CALLBACK StatusMessageWindowProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: install.c:638
#define IDD_STATUSWINDOW_DLG
Definition: resource.h:88
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
LONG_PTR LPARAM
Definition: windef.h:208
BOOL WINAPI TranslateMessage(_In_ const MSG *)
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define CreateDialogParam
Definition: winuser.h:5742
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:656
#define SW_SHOW
Definition: winuser.h:769
#define DispatchMessage
Definition: winuser.h:5755
#define MAKEINTRESOURCE
Definition: winuser.h:591
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)

Referenced by CommonInstall().

◆ StatusMessageWindowProc()

static INT_PTR CALLBACK StatusMessageWindowProc ( IN HWND  hwndDlg,
IN UINT  uMsg,
IN WPARAM  wParam,
IN LPARAM  lParam 
)
static

Definition at line 638 of file install.c.

643{
644 PDLG_DATA pDlgData;
646
647 pDlgData = (PDLG_DATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
648
649 /* pDlgData is required for each case except WM_INITDIALOG */
650 if (uMsg != WM_INITDIALOG && pDlgData == NULL) return FALSE;
651
652 switch (uMsg)
653 {
654 case WM_INITDIALOG:
655 {
656 BITMAP bm;
657 WCHAR szMsg[256];
658
659 /* Allocate pDlgData */
660 pDlgData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pDlgData));
661 if (pDlgData)
662 {
663 /* Set pDlgData to GWLP_USERDATA, so we can get it for new messages */
664 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)pDlgData);
665
666 /* Load bitmaps */
669 0, 0, LR_DEFAULTCOLOR);
670
673 GetObject(pDlgData->hBarBitmap, sizeof(bm), &bm);
674 pDlgData->BarWidth = bm.bmWidth;
675 pDlgData->BarHeight = bm.bmHeight;
676
677 if (pDlgData->hLogoBitmap && pDlgData->hBarBitmap)
678 {
679 if (SetTimer(hwndDlg, IDT_BAR, 20, NULL) == 0)
680 {
681 DPRINT1("SetTimer(IDT_BAR) failed: %lu\n", GetLastError());
682 }
683
684 /* Get the animation bar control */
685 pDlgData->hWndBarCtrl = GetDlgItem(hwndDlg, IDC_BAR);
686 }
687 }
688
689 /* Get and set status text */
691 return FALSE;
692 SetDlgItemTextW(hwndDlg, IDC_STATUSLABEL, szMsg);
693
694 AdjustStatusMessageWindow(hwndDlg, pDlgData);
695 return TRUE;
696 }
697
698 case WM_TIMER:
699 {
700 if (pDlgData->hBarBitmap)
701 {
702 /*
703 * Default rotation bar image width is 413 (same as logo)
704 * We can divide 413 by 7 without remainder
705 */
706 pDlgData->BarCounter = (pDlgData->BarCounter + 7) % pDlgData->BarWidth;
708 UpdateWindow(pDlgData->hWndBarCtrl);
709 }
710 return TRUE;
711 }
712
713 case WM_DRAWITEM:
714 {
716
717 if (lpDis->CtlID != IDC_BAR)
718 {
719 return FALSE;
720 }
721
722 if (pDlgData->hBarBitmap)
723 {
724 HDC hdcMem;
725 HGDIOBJ hOld;
726 DWORD off = pDlgData->BarCounter;
727 DWORD iw = pDlgData->BarWidth;
728 DWORD ih = pDlgData->BarHeight;
729
730 hdcMem = CreateCompatibleDC(lpDis->hDC);
731 hOld = SelectObject(hdcMem, pDlgData->hBarBitmap);
732 BitBlt(lpDis->hDC, off, 0, iw - off, ih, hdcMem, 0, 0, SRCCOPY);
733 BitBlt(lpDis->hDC, 0, 0, off, ih, hdcMem, iw - off, 0, SRCCOPY);
734 SelectObject(hdcMem, hOld);
736 return TRUE;
737 }
738 return FALSE;
739 }
740
741 case WM_DESTROY:
742 {
743 if (pDlgData->hBarBitmap)
744 {
745 KillTimer(hwndDlg, IDT_BAR);
746 }
747
748 DeleteObject(pDlgData->hLogoBitmap);
749 DeleteObject(pDlgData->hBarBitmap);
750 HeapFree(GetProcessHeap(), 0, pDlgData);
751 return TRUE;
752 }
753 }
754 return FALSE;
755}
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define IDT_BAR
Definition: gui.c:32
struct _DLG_DATA * PDLG_DATA
static VOID AdjustStatusMessageWindow(HWND hwndDlg, PDLG_DATA pDlgData)
Definition: install.c:574
#define IDS_STATUS_INSTALL_DEV
Definition: resource.h:151
#define IDB_LINE
Definition: resource.h:28
static VOID NTAPI BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Delta *Height) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Delta)
Definition: common.c:49
pKey DeleteObject()
static HDC
Definition: imagelist.c:92
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define IDB_REACTOS
Definition: shresdef.h:30
Definition: gui.c:35
DWORD BarHeight
Definition: gui.c:44
DWORD BarWidth
Definition: gui.c:43
HWND hWndBarCtrl
Definition: gui.c:39
DWORD BarCounter
Definition: gui.c:40
#define GWLP_USERDATA
Definition: treelist.c:63
HDC hdcMem
Definition: welcome.c:104
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define SRCCOPY
Definition: wingdi.h:333
#define GetObject
Definition: wingdi.h:4468
BOOL WINAPI DeleteDC(_In_ HDC)
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
#define IMAGE_BITMAP
Definition: winuser.h:211
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define WM_INITDIALOG
Definition: winuser.h:1729
#define WM_DRAWITEM
Definition: winuser.h:1635
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define WM_TIMER
Definition: winuser.h:1732
BOOL WINAPI UpdateWindow(_In_ HWND)
#define LR_DEFAULTCOLOR
Definition: winuser.h:1081
#define WM_DESTROY
Definition: winuser.h:1599
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define SetWindowLongPtrW
Definition: winuser.h:5336

Referenced by ShowStatusMessageThread().

Variable Documentation

◆ AdminInfo

ADMIN_INFO AdminInfo

Definition at line 38 of file install.c.

Referenced by InstallReactOS(), SetAdministratorPassword(), and SetAutoAdminLogon().

◆ hSysSetupInf