ReactOS  0.4.13-dev-100-gc8611ae
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.

Macros

#define COBJMACROS
 
#define NDEBUG
 

Functions

DWORD WINAPI CMP_WaitNoPendingInstallEvents (DWORD dwTimeout)
 
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)
 
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 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 BOOL InstallInfSection (IN HWND hWnd, IN LPCWSTR InfFile, IN LPCWSTR InfSection OPTIONAL, IN LPCWSTR InfService OPTIONAL)
 
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.

Function Documentation

◆ CMP_WaitNoPendingInstallEvents()

DWORD WINAPI CMP_WaitNoPendingInstallEvents ( DWORD  dwTimeout)

Referenced by CommonInstall().

◆ CommonInstall()

static BOOL CommonInstall ( VOID  )
static

Definition at line 669 of file install.c.

670 {
671  HANDLE hThread = NULL;
672  BOOL bResult = FALSE;
673 
674  hSysSetupInf = SetupOpenInfFileW(L"syssetup.inf",
675  NULL,
677  NULL);
679  {
680  FatalError("SetupOpenInfFileW() failed to open 'syssetup.inf' (Error: %lu)\n", GetLastError());
681  return FALSE;
682  }
683 
685  {
686  FatalError("InstallSysSetupInfDevices() failed!\n");
687  goto Exit;
688  }
689 
691  {
692  FatalError("InstallSysSetupInfComponents() failed!\n");
693  goto Exit;
694  }
695 
696  if (!IsConsoleBoot())
697  {
699  0,
701  NULL,
702  0,
703  NULL);
704  }
705 
707  {
708  FatalError("EnableUserModePnpManager() failed!\n");
709  goto Exit;
710  }
711 
713  {
714  FatalError("CMP_WaitNoPendingInstallEvents() failed!\n");
715  goto Exit;
716  }
717 
718  bResult = TRUE;
719 
720 Exit:
721 
722  if (bResult == FALSE)
723  {
725  }
726 
727  if (hThread != NULL)
728  {
732  }
733 
734  return bResult;
735 }
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
#define INF_STYLE_WIN4
Definition: infsupp.h:41
static BOOL InstallSysSetupInfComponents(VOID)
Definition: install.c:344
#define WM_QUIT
Definition: winuser.h:1605
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
DWORD WINAPI GetThreadId(IN HANDLE Thread)
Definition: thread.c:875
HINF WINAPI SetupOpenInfFileW(PCWSTR name, PCWSTR class, DWORD style, UINT *error)
Definition: parser.c:1229
VOID WINAPI SetupCloseInfFile(IN HINF InfHandle)
Definition: infsupp.c:43
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
unsigned int BOOL
Definition: ntddk_ex.h:94
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:112
smooth NULL
Definition: ftsmooth.c:416
#define WAIT_OBJECT_0
Definition: winbase.h:387
static DWORD WINAPI ShowStatusMessageThread(IN LPVOID lpParameter)
Definition: install.c:552
static void Exit(void)
Definition: sock.c:1331
#define PostThreadMessage
Definition: winuser.h:5699
static BOOL InstallSysSetupInfDevices(VOID)
Definition: install.c:308
static const WCHAR L[]
Definition: oid.c:1250
static BOOL IsConsoleBoot(VOID)
Definition: install.c:624
HINF hSysSetupInf
Definition: install.c:37
DWORD WINAPI CMP_WaitNoPendingInstallEvents(DWORD dwTimeout)
HANDLE hThread
Definition: wizard.c:27
#define INFINITE
Definition: serial.h:102
static VOID FatalError(char *pszFmt,...)
Definition: install.c:43
static BOOL EnableUserModePnpManager(VOID)
Definition: install.c:475

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 62 of file install.c.

70 {
71  IShellLinkW *psl;
72  IPersistFile *ppf;
73 
74  HRESULT hr = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, &IID_IShellLink, (LPVOID*)&psl);
75 
76  if (SUCCEEDED(hr))
77  {
78  hr = IShellLinkW_SetPath(psl, pszCmd);
79 
80  if (pszArg)
81  hr = IShellLinkW_SetArguments(psl, pszArg);
82 
83  if (pszDir)
84  hr = IShellLinkW_SetWorkingDirectory(psl, pszDir);
85 
86  if (pszIconPath)
87  hr = IShellLinkW_SetIconLocation(psl, pszIconPath, iIconNr);
88 
89  if (pszComment)
90  hr = IShellLinkW_SetDescription(psl, pszComment);
91 
92  hr = IShellLinkW_QueryInterface(psl, &IID_IPersistFile, (LPVOID*)&ppf);
93 
94  if (SUCCEEDED(hr))
95  {
96  hr = IPersistFile_Save(ppf, pszLinkPath, TRUE);
97  IPersistFile_Release(ppf);
98  }
99 
100  IShellLinkW_Release(psl);
101  }
102 
103  return hr;
104 }
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
#define IID_IShellLink
Definition: shlguid.h:128
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
_In_ LPCSTR pszDir
Definition: shellapi.h:580
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3234
const GUID IID_IPersistFile
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by CreateShortcut().

◆ CreateShortcut()

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

Definition at line 108 of file install.c.

115 {
116  DWORD dwLen;
117  LPWSTR Ptr;
120  WCHAR szWorkingDirBuf[MAX_PATH];
121 
122  /* If no working directory is provided, try to compute a default one */
123  if (pszWorkingDir == NULL || pszWorkingDir[0] == L'\0')
124  {
125  if (ExpandEnvironmentStringsW(pszCommand, szPath, ARRAYSIZE(szPath)) == 0)
126  wcscpy(szPath, pszCommand);
127 
128  dwLen = GetFullPathNameW(szPath,
129  ARRAYSIZE(szWorkingDirBuf),
130  szWorkingDirBuf,
131  &lpFilePart);
132  if (dwLen != 0 && dwLen <= ARRAYSIZE(szWorkingDirBuf))
133  {
134  /* Since those should only be called with (.exe) files,
135  lpFilePart has not to be NULL */
136  ASSERT(lpFilePart != NULL);
137 
138  /* We're only interested in the path. Cut the file name off.
139  Also remove the trailing backslash unless the working directory
140  is only going to be a drive, i.e. C:\ */
141  *(lpFilePart--) = L'\0';
142  if (!(lpFilePart - szWorkingDirBuf == 2 &&
143  szWorkingDirBuf[1] == L':' && szWorkingDirBuf[2] == L'\\'))
144  {
145  *lpFilePart = L'\0';
146  }
147  pszWorkingDir = szWorkingDirBuf;
148  }
149  }
150 
151  /* If we failed to compute a working directory, just do not use one */
152  if (pszWorkingDir && pszWorkingDir[0] == L'\0')
153  pszWorkingDir = NULL;
154 
155  /* Build the shortcut file name */
156  wcscpy(szPath, pszFolder);
158  wcscpy(Ptr, pszName);
159 
160  /* Create the shortcut */
162  pszCommand,
163  L"",
164  pszWorkingDir,
165  /* Special value to indicate no icon */
166  (iIconNr != -1 ? pszCommand : NULL),
167  iIconNr,
168  pszDescription));
169 }
_In_ LPCSTR _In_opt_ LPCSTR _In_ DWORD _Out_opt_ LPSTR * lpFilePart
Definition: winbase.h:3015
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
Definition: path.c:1105
#define PathAddBackslash
Definition: shlwapi.h:783
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1250
LPCWSTR szPath
Definition: env.c:35
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
static HRESULT CreateShellLink(LPCWSTR pszLinkPath, LPCWSTR pszCmd, LPCWSTR pszArg, LPCWSTR pszDir, LPCWSTR pszIconPath, INT iIconNr, LPCWSTR pszComment)
Definition: install.c:62
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by CreateShortcutsFromSection().

◆ CreateShortcuts()

static BOOL CreateShortcuts ( HINF  hinf,
LPCWSTR  szSection 
)
static

Definition at line 215 of file install.c.

216 {
219  WCHAR szFolder[MAX_PATH];
220  WCHAR szFolderSection[MAX_PATH];
221  INT csidl;
222 
224 
225  if (!SetupFindFirstLine(hinf, szSection, NULL, &Context))
226  return FALSE;
227 
228  do
229  {
230  if (SetupGetFieldCount(&Context) < 2)
231  continue;
232 
233  if (!SetupGetStringFieldW(&Context, 0, szFolderSection, ARRAYSIZE(szFolderSection), NULL))
234  continue;
235 
236  if (!SetupGetIntField(&Context, 1, &csidl))
237  continue;
238 
239  if (!SetupGetStringFieldW(&Context, 2, szFolder, ARRAYSIZE(szFolder), NULL))
240  continue;
241 
243  continue;
244 
245  CreateShortcutsFromSection(hinf, szFolderSection, szPath);
246 
247  } while (SetupFindNextLine(&Context, &Context));
248 
249  CoUninitialize();
250 
251  return TRUE;
252 }
#define TRUE
Definition: types.h:120
#define SetupFindFirstLine
Definition: setupapi.h:2618
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
int32_t INT
Definition: typedefs.h:56
smooth NULL
Definition: ftsmooth.c:416
static BOOL CreateShortcutsFromSection(HINF hinf, LPWSTR pszSection, LPCWSTR pszFolder)
Definition: install.c:172
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
ULONG WINAPI SetupGetFieldCount(IN PINFCONTEXT Context)
Definition: infsupp.c:91
LPCWSTR szPath
Definition: env.c:35
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1991
#define CSIDL_FLAG_CREATE
BOOL WINAPI SetupFindNextLine(IN PINFCONTEXT ContextIn, OUT PINFCONTEXT ContextOut)
Definition: infsupp.c:80
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1897
BOOL WINAPI SetupGetIntField(IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT INT *IntegerValue)
Definition: infsupp.c:146
struct tagContext Context
Definition: acpixf.h:1012
HRESULT WINAPI SHGetFolderPathAndSubDirW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPCWSTR pszSubPath, LPWSTR pszPath)
Definition: shellpath.c:2150
BOOL WINAPI SetupGetStringFieldW(IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT PWSTR ReturnBuffer, IN ULONG ReturnBufferSize, OUT PULONG RequiredSize)
Definition: infsupp.c:184

Referenced by InstallReactOS().

◆ CreateShortcutsFromSection()

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

Definition at line 172 of file install.c.

173 {
175  DWORD dwFieldCount;
176  INT iIconNr;
177  WCHAR szCommand[MAX_PATH];
180  WCHAR szDirectory[MAX_PATH];
181 
182  if (!SetupFindFirstLine(hinf, pszSection, NULL, &Context))
183  return FALSE;
184 
185  do
186  {
187  dwFieldCount = SetupGetFieldCount(&Context);
188  if (dwFieldCount < 3)
189  continue;
190 
191  if (!SetupGetStringFieldW(&Context, 1, szCommand, ARRAYSIZE(szCommand), NULL))
192  continue;
193 
195  continue;
196 
198  continue;
199 
200  if (dwFieldCount < 4 || !SetupGetIntField(&Context, 4, &iIconNr))
201  iIconNr = -1; /* Special value to indicate no icon */
202 
203  if (dwFieldCount < 5 || !SetupGetStringFieldW(&Context, 5, szDirectory, ARRAYSIZE(szDirectory), NULL))
204  szDirectory[0] = L'\0';
205 
206  wcscat(szName, L".lnk");
207 
208  CreateShortcut(pszFolder, szName, szCommand, szDescription, iIconNr, szDirectory);
209 
210  } while (SetupFindNextLine(&Context, &Context));
211 
212  return TRUE;
213 }
#define TRUE
Definition: types.h:120
#define SetupFindFirstLine
Definition: setupapi.h:2618
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
int32_t INT
Definition: typedefs.h:56
static BOOL CreateShortcut(LPCWSTR pszFolder, LPCWSTR pszName, LPCWSTR pszCommand, LPCWSTR pszDescription, INT iIconNr, LPCWSTR pszWorkingDir)
Definition: install.c:108
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
ULONG WINAPI SetupGetFieldCount(IN PINFCONTEXT Context)
Definition: infsupp.c:91
static const WCHAR L[]
Definition: oid.c:1250
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
BOOL WINAPI SetupFindNextLine(IN PINFCONTEXT ContextIn, OUT PINFCONTEXT ContextOut)
Definition: infsupp.c:80
static const WCHAR szName[]
Definition: msipriv.h:1194
BOOL WINAPI SetupGetIntField(IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT INT *IntegerValue)
Definition: infsupp.c:146
struct tagContext Context
Definition: acpixf.h:1012
static const WCHAR szDescription[]
Definition: provider.c:52
BOOL WINAPI SetupGetStringFieldW(IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT PWSTR ReturnBuffer, IN ULONG ReturnBufferSize, OUT PULONG RequiredSize)
Definition: infsupp.c:184

Referenced by CreateShortcuts().

◆ CreateTempDir()

static VOID CreateTempDir ( IN LPCWSTR  VarName)
static

Definition at line 255 of file install.c.

257 {
258  WCHAR szTempDir[MAX_PATH];
259  WCHAR szBuffer[MAX_PATH];
260  DWORD dwLength;
261  HKEY hKey;
262 
264  L"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment",
265  0,
267  &hKey) != ERROR_SUCCESS)
268  {
269  FatalError("Error: %lu\n", GetLastError());
270  return;
271  }
272 
273  /* Get temp dir */
274  dwLength = sizeof(szBuffer);
275  if (RegQueryValueExW(hKey,
276  VarName,
277  NULL,
278  NULL,
279  (LPBYTE)szBuffer,
280  &dwLength) != ERROR_SUCCESS)
281  {
282  FatalError("Error: %lu\n", GetLastError());
283  goto cleanup;
284  }
285 
286  /* Expand it */
287  if (!ExpandEnvironmentStringsW(szBuffer, szTempDir, ARRAYSIZE(szTempDir)))
288  {
289  FatalError("Error: %lu\n", GetLastError());
290  goto cleanup;
291  }
292 
293  /* Create profiles directory */
294  if (!CreateDirectoryW(szTempDir, NULL))
295  {
297  {
298  FatalError("Error: %lu\n", GetLastError());
299  goto cleanup;
300  }
301  }
302 
303 cleanup:
304  RegCloseKey(hKey);
305 }
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:90
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
smooth NULL
Definition: ftsmooth.c:416
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4134
__wchar_t WCHAR
Definition: xmlstorage.h:180
static DWORD DWORD * dwLength
Definition: fusion.c:83
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
char * cleanup(char *str)
Definition: wpickclick.c:99
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
static VOID FatalError(char *pszFmt,...)
Definition: install.c:43
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by InstallReactOS().

◆ EnableUserModePnpManager()

static BOOL EnableUserModePnpManager ( VOID  )
static

Definition at line 475 of file install.c.

476 {
477  SC_HANDLE hSCManager = NULL;
478  SC_HANDLE hService = NULL;
479  BOOL bRet = FALSE;
480 
482  if (hSCManager == NULL)
483  {
484  DPRINT1("Unable to open the service control manager.\n");
485  DPRINT1("Last Error %d\n", GetLastError());
486  goto cleanup;
487  }
488 
489  hService = OpenServiceW(hSCManager,
490  L"PlugPlay",
492  if (hService == NULL)
493  {
494  DPRINT1("Unable to open PlugPlay service\n");
495  goto cleanup;
496  }
497 
498  bRet = ChangeServiceConfigW(hService,
502  NULL, NULL, NULL,
503  NULL, NULL, NULL, NULL);
504  if (!bRet)
505  {
506  DPRINT1("Unable to change the service configuration\n");
507  goto cleanup;
508  }
509 
510  bRet = StartServiceW(hService, 0, NULL);
511  if (!bRet && (GetLastError() != ERROR_SERVICE_ALREADY_RUNNING))
512  {
513  DPRINT1("Unable to start service\n");
514  goto cleanup;
515  }
516 
517  bRet = TRUE;
518 
519 cleanup:
520  if (hService != NULL)
521  CloseServiceHandle(hService);
522  if (hSCManager != NULL)
524  return bRet;
525 }
#define SC_MANAGER_ENUMERATE_SERVICE
Definition: winsvc.h:16
#define TRUE
Definition: types.h:120
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define SERVICE_NO_CHANGE
Definition: winsvc.h:20
unsigned int BOOL
Definition: ntddk_ex.h:94
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:480
SC_HANDLE WINAPI OpenServiceW(SC_HANDLE hSCManager, LPCWSTR lpServiceName, DWORD dwDesiredAccess)
Definition: scm.c:2103
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
Definition: scm.c:577
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI StartServiceW(SC_HANDLE hService, DWORD dwNumServiceArgs, LPCWSTR *lpServiceArgVectors)
Definition: scm.c:2923
#define SERVICE_CHANGE_CONFIG
Definition: winsvc.h:54
static const WCHAR L[]
Definition: oid.c:1250
SC_HANDLE WINAPI OpenSCManagerW(LPCWSTR lpMachineName, LPCWSTR lpDatabaseName, DWORD dwDesiredAccess)
Definition: scm.c:2011
SC_HANDLE hSCManager
Definition: sc.c:12
#define SERVICE_START
Definition: winsvc.h:57
#define DPRINT1
Definition: precomp.h:8
#define SERVICE_AUTO_START
Definition: cmtypes.h:975
char * cleanup(char *str)
Definition: wpickclick.c:99
#define ERROR_SERVICE_ALREADY_RUNNING
Definition: winerror.h:607

Referenced by CommonInstall().

◆ FatalError()

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

Definition at line 43 of file install.c.

44 {
45  char szBuffer[512];
46  va_list ap;
47 
48  va_start(ap, pszFmt);
49  vsprintf(szBuffer, pszFmt, ap);
50  va_end(ap);
51 
52  LogItem(NULL, L"Failed");
53 
54  strcat(szBuffer, "\nRebooting now!");
56  szBuffer,
57  "ReactOS Setup",
58  MB_OK);
59 }
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
int WINAPI MessageBoxA(_In_opt_ HWND, _In_opt_ LPCSTR, _In_opt_ LPCSTR, _In_ UINT)
#define va_end(ap)
Definition: acmsvcex.h:90
smooth NULL
Definition: ftsmooth.c:416
char * va_list
Definition: acmsvcex.h:78
static const WCHAR L[]
Definition: oid.c:1250
int __cdecl vsprintf(char *_Dest, const char *_Format, va_list _Args)
Definition: sprintf.c:733
#define va_start(ap, A)
Definition: acmsvcex.h:91
#define MB_OK
Definition: winuser.h:784
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32
#define LogItem(lpTag, lpMessageText...)
Definition: syssetup.h:110

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

◆ HotkeyThread()

static DWORD CALLBACK HotkeyThread ( LPVOID  Parameter)
static

Definition at line 910 of file install.c.

911 {
912  ATOM hotkey;
913  MSG msg;
914 
915  DPRINT("HotkeyThread start\n");
916 
917  hotkey = GlobalAddAtomW(L"Setup Shift+F10 Hotkey");
918 
919  if (!RegisterHotKey(NULL, hotkey, MOD_SHIFT, VK_F10))
920  DPRINT1("RegisterHotKey failed with %lu\n", GetLastError());
921 
922  while (GetMessage(&msg, NULL, 0, 0))
923  {
924  if (msg.hwnd == NULL && msg.message == WM_HOTKEY && msg.wParam == hotkey)
925  {
926  STARTUPINFOW si = { sizeof(si) };
928 
929  if (CreateProcessW(L"cmd.exe",
930  NULL,
931  NULL,
932  NULL,
933  FALSE,
935  NULL,
936  NULL,
937  &si,
938  &pi))
939  {
940  CloseHandle(pi.hProcess);
941  CloseHandle(pi.hThread);
942  }
943  else
944  {
945  DPRINT1("Failed to launch command prompt: %lu\n", GetLastError());
946  }
947  }
948  }
949 
950  UnregisterHotKey(NULL, hotkey);
951  GlobalDeleteAtom(hotkey);
952 
953  DPRINT("HotkeyThread terminate\n");
954  return 0;
955 }
ATOM WINAPI GlobalDeleteAtom(ATOM nAtom)
Definition: atom.c:454
#define CloseHandle
Definition: compat.h:398
WORD ATOM
Definition: dimm.idl:113
#define WM_HOTKEY
Definition: winuser.h:1840
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI UnregisterHotKey(_In_opt_ HWND, _In_ int)
#define VK_F10
Definition: winuser.h:2218
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
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:4623
#define CREATE_NEW_CONSOLE
Definition: winbase.h:180
static DWORD pi
Definition: protocol.c:150
static const WCHAR L[]
Definition: oid.c:1250
#define MOD_SHIFT
Definition: imm.h:313
#define GetMessage
Definition: winuser.h:5656
ATOM WINAPI GlobalAddAtomW(LPCWSTR lpString)
Definition: atom.c:444
#define DPRINT1
Definition: precomp.h:8
#define msg(x)
Definition: auth_time.c:54
BOOL WINAPI RegisterHotKey(_In_opt_ HWND, _In_ int, _In_ UINT, _In_ UINT)

Referenced by InstallReactOS().

◆ InitializeDefaultUserLocale()

static VOID InitializeDefaultUserLocale ( VOID  )
static

Definition at line 1075 of file install.c.

1076 {
1077  WCHAR szBuffer[80];
1078  PWSTR ptr;
1079  HKEY hLocaleKey;
1080  DWORD ret;
1081  DWORD dwSize;
1082  LCID lcid;
1083  INT i;
1084 
1085  struct {LCTYPE LCType; PWSTR pValue;} LocaleData[] = {
1086  /* Number */
1087  {LOCALE_SDECIMAL, L"sDecimal"},
1088  {LOCALE_STHOUSAND, L"sThousand"},
1089  {LOCALE_SNEGATIVESIGN, L"sNegativeSign"},
1090  {LOCALE_SPOSITIVESIGN, L"sPositiveSign"},
1091  {LOCALE_SGROUPING, L"sGrouping"},
1092  {LOCALE_SLIST, L"sList"},
1093  {LOCALE_SNATIVEDIGITS, L"sNativeDigits"},
1094  {LOCALE_INEGNUMBER, L"iNegNumber"},
1095  {LOCALE_IDIGITS, L"iDigits"},
1096  {LOCALE_ILZERO, L"iLZero"},
1097  {LOCALE_IMEASURE, L"iMeasure"},
1098  {LOCALE_IDIGITSUBSTITUTION, L"NumShape"},
1099 
1100  /* Currency */
1101  {LOCALE_SCURRENCY, L"sCurrency"},
1102  {LOCALE_SMONDECIMALSEP, L"sMonDecimalSep"},
1103  {LOCALE_SMONTHOUSANDSEP, L"sMonThousandSep"},
1104  {LOCALE_SMONGROUPING, L"sMonGrouping"},
1105  {LOCALE_ICURRENCY, L"iCurrency"},
1106  {LOCALE_INEGCURR, L"iNegCurr"},
1107  {LOCALE_ICURRDIGITS, L"iCurrDigits"},
1108 
1109  /* Time */
1110  {LOCALE_STIMEFORMAT, L"sTimeFormat"},
1111  {LOCALE_STIME, L"sTime"},
1112  {LOCALE_S1159, L"s1159"},
1113  {LOCALE_S2359, L"s2359"},
1114  {LOCALE_ITIME, L"iTime"},
1115  {LOCALE_ITIMEMARKPOSN, L"iTimePrefix"},
1116  {LOCALE_ITLZERO, L"iTLZero"},
1117 
1118  /* Date */
1119  {LOCALE_SLONGDATE, L"sLongDate"},
1120  {LOCALE_SSHORTDATE, L"sShortDate"},
1121  {LOCALE_SDATE, L"sDate"},
1122  {LOCALE_IFIRSTDAYOFWEEK, L"iFirstDayOfWeek"},
1123  {LOCALE_IFIRSTWEEKOFYEAR, L"iFirstWeekOfYear"},
1124  {LOCALE_IDATE, L"iDate"},
1125  {LOCALE_ICALENDARTYPE, L"iCalendarType"},
1126 
1127  /* Misc */
1128  {LOCALE_SCOUNTRY, L"sCountry"},
1129  {LOCALE_SABBREVLANGNAME, L"sLanguage"},
1130  {LOCALE_ICOUNTRY, L"iCountry"},
1131  {0, NULL}};
1132 
1134  L".DEFAULT\\Control Panel\\International",
1135  0,
1136  KEY_READ | KEY_WRITE,
1137  &hLocaleKey);
1138  if (ret != ERROR_SUCCESS)
1139  {
1140  return;
1141  }
1142 
1143  dwSize = 9 * sizeof(WCHAR);
1144  ret = RegQueryValueExW(hLocaleKey,
1145  L"Locale",
1146  NULL,
1147  NULL,
1148  (PBYTE)szBuffer,
1149  &dwSize);
1150  if (ret != ERROR_SUCCESS)
1151  goto done;
1152 
1153  lcid = (LCID)wcstoul(szBuffer, &ptr, 16);
1154  if (lcid == 0)
1155  goto done;
1156 
1157  i = 0;
1158  while (LocaleData[i].pValue != NULL)
1159  {
1160  if (GetLocaleInfoW(lcid,
1161  LocaleData[i].LCType | LOCALE_NOUSEROVERRIDE,
1162  szBuffer,
1163  ARRAYSIZE(szBuffer)))
1164  {
1165  RegSetValueExW(hLocaleKey,
1166  LocaleData[i].pValue,
1167  0,
1168  REG_SZ,
1169  (PBYTE)szBuffer,
1170  (wcslen(szBuffer) + 1) * sizeof(WCHAR));
1171  }
1172 
1173  i++;
1174  }
1175 
1176 done:
1177  RegCloseKey(hLocaleKey);
1178 }
#define HKEY_USERS
Definition: winreg.h:13
#define LOCALE_SGROUPING
Definition: winnls.h:44
#define LOCALE_SMONGROUPING
Definition: winnls.h:53
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
uint16_t * PWSTR
Definition: typedefs.h:54
#define LOCALE_IDATE
Definition: winnls.h:63
#define LOCALE_ICALENDARTYPE
Definition: winnls.h:73
#define LOCALE_ILZERO
Definition: winnls.h:46
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
DWORD LCID
Definition: nls.h:13
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define LOCALE_IMEASURE
Definition: winnls.h:41
int32_t INT
Definition: typedefs.h:56
#define LOCALE_SCURRENCY
Definition: winnls.h:49
#define LOCALE_INEGNUMBER
Definition: winnls.h:47
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: lang.c:1098
DWORD LCTYPE
Definition: winnls.h:514
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 LOCALE_STHOUSAND
Definition: winnls.h:43
#define LOCALE_NOUSEROVERRIDE
Definition: winnls.h:19
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define LOCALE_SLONGDATE
Definition: winnls.h:61
static PVOID ptr
Definition: dispmode.c:27
#define LOCALE_ITIMEMARKPOSN
Definition: winnls.h:66
#define LOCALE_INEGCURR
Definition: winnls.h:57
smooth NULL
Definition: ftsmooth.c:416
#define LOCALE_SDECIMAL
Definition: winnls.h:42
#define LOCALE_STIME
Definition: winnls.h:59
#define KEY_WRITE
Definition: nt_native.h:1031
#define LOCALE_ICURRENCY
Definition: winnls.h:56
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:4917
#define LOCALE_SMONDECIMALSEP
Definition: winnls.h:51
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4134
#define LOCALE_SMONTHOUSANDSEP
Definition: winnls.h:52
#define LOCALE_SDATE
Definition: winnls.h:58
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define LOCALE_SABBREVLANGNAME
Definition: winnls.h:28
#define LOCALE_SPOSITIVESIGN
Definition: winnls.h:117
unsigned long DWORD
Definition: ntddk_ex.h:95
#define LOCALE_S1159
Definition: winnls.h:71
#define LOCALE_ITLZERO
Definition: winnls.h:68
int ret
static const WCHAR L[]
Definition: oid.c:1250
#define LOCALE_SNEGATIVESIGN
Definition: winnls.h:118
#define LOCALE_SSHORTDATE
Definition: winnls.h:60
#define LOCALE_ICOUNTRY
Definition: winnls.h:30
#define LOCALE_IDIGITS
Definition: winnls.h:45
#define LOCALE_IFIRSTDAYOFWEEK
Definition: winnls.h:75
#define LOCALE_IFIRSTWEEKOFYEAR
Definition: winnls.h:76
#define LOCALE_ICURRDIGITS
Definition: winnls.h:54
#define LOCALE_ITIME
Definition: winnls.h:65
#define LOCALE_SLIST
Definition: winnls.h:40
#define LOCALE_SCOUNTRY
Definition: winnls.h:31
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
#define LOCALE_SNATIVEDIGITS
Definition: winnls.h:48
#define LOCALE_S2359
Definition: winnls.h:72
#define LOCALE_STIMEFORMAT
Definition: winnls.h:62
BYTE * PBYTE
Definition: pedump.c:66
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define REG_SZ
Definition: layer.c:22

Referenced by InstallReactOS().

◆ InitializeProgramFilesDir()

static BOOL InitializeProgramFilesDir ( VOID  )
static

Definition at line 960 of file install.c.

961 {
962  LONG Error;
963  HKEY hKey;
964  DWORD dwLength;
965  WCHAR szProgramFilesDirPath[MAX_PATH];
966  WCHAR szCommonFilesDirPath[MAX_PATH];
967  WCHAR szBuffer[MAX_PATH];
968 
969  /* Load 'Program Files' location */
972  szBuffer,
973  ARRAYSIZE(szBuffer)))
974  {
975  DPRINT1("Error: %lu\n", GetLastError());
976  return FALSE;
977  }
978 
981  szCommonFilesDirPath,
982  ARRAYSIZE(szCommonFilesDirPath)))
983  {
984  DPRINT1("Warning: %lu\n", GetLastError());
985  }
986 
987  /* Expand it */
988  if (!ExpandEnvironmentStringsW(szBuffer,
989  szProgramFilesDirPath,
990  ARRAYSIZE(szProgramFilesDirPath)))
991  {
992  DPRINT1("Error: %lu\n", GetLastError());
993  return FALSE;
994  }
995 
996  wcscpy(szBuffer, szProgramFilesDirPath);
997  wcscat(szBuffer, L"\\");
998  wcscat(szBuffer, szCommonFilesDirPath);
999 
1000  if (!ExpandEnvironmentStringsW(szBuffer,
1001  szCommonFilesDirPath,
1002  ARRAYSIZE(szCommonFilesDirPath)))
1003  {
1004  DPRINT1("Warning: %lu\n", GetLastError());
1005  }
1006 
1007  /* Store it */
1009  L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion",
1010  0,
1011  KEY_SET_VALUE,
1012  &hKey);
1013  if (Error != ERROR_SUCCESS)
1014  {
1015  DPRINT1("Error: %lu\n", Error);
1016  return FALSE;
1017  }
1018 
1019  dwLength = (wcslen(szProgramFilesDirPath) + 1) * sizeof(WCHAR);
1020  Error = RegSetValueExW(hKey,
1021  L"ProgramFilesDir",
1022  0,
1023  REG_SZ,
1024  (LPBYTE)szProgramFilesDirPath,
1025  dwLength);
1026  if (Error != ERROR_SUCCESS)
1027  {
1028  DPRINT1("Error: %lu\n", Error);
1029  RegCloseKey(hKey);
1030  return FALSE;
1031  }
1032 
1033  dwLength = (wcslen(szCommonFilesDirPath) + 1) * sizeof(WCHAR);
1034  Error = RegSetValueExW(hKey,
1035  L"CommonFilesDir",
1036  0,
1037  REG_SZ,
1038  (LPBYTE)szCommonFilesDirPath,
1039  dwLength);
1040  if (Error != ERROR_SUCCESS)
1041  {
1042  DPRINT1("Warning: %lu\n", Error);
1043  }
1044 
1045  RegCloseKey(hKey);
1046 
1047  /* Create directory */
1048  // FIXME: Security!
1049  if (!CreateDirectoryW(szProgramFilesDirPath, NULL))
1050  {
1052  {
1053  DPRINT1("Error: %lu\n", GetLastError());
1054  return FALSE;
1055  }
1056  }
1057 
1058  /* Create directory */
1059  // FIXME: Security!
1060  if (!CreateDirectoryW(szCommonFilesDirPath, NULL))
1061  {
1063  {
1064  DPRINT1("Warning: %lu\n", GetLastError());
1065  // return FALSE;
1066  }
1067  }
1068 
1069  return TRUE;
1070 }
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:90
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_SET_VALUE
Definition: nt_native.h:1017
#define IDS_PROGRAMFILES
Definition: resource.h:137
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
static HINSTANCE hDllInstance
Definition: clb.c:30
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:4917
__wchar_t WCHAR
Definition: xmlstorage.h:180
static DWORD DWORD * dwLength
Definition: fusion.c:83
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL Error
Definition: chkdsk.c:66
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1250
#define IDS_COMMONFILES
Definition: resource.h:138
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
#define DPRINT1
Definition: precomp.h:8
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define REG_SZ
Definition: layer.c:22

Referenced by InstallReactOS().

◆ InstallInfSection()

static BOOL InstallInfSection ( IN HWND  hWnd,
IN LPCWSTR  InfFile,
IN LPCWSTR InfSection  OPTIONAL,
IN LPCWSTR InfService  OPTIONAL 
)
static

Definition at line 743 of file install.c.

748 {
750  HINF hInf = INVALID_HANDLE_VALUE;
752  PVOID Context = NULL;
753  BOOL ret = FALSE;
754 
755  /* Get Windows directory */
756  BufferSize = ARRAYSIZE(Buffer) - 5 - wcslen(InfFile);
758  {
759  /* Function failed */
761  goto cleanup;
762  }
763  /* We have enough space to add some information in the buffer */
764  if (Buffer[wcslen(Buffer) - 1] != '\\')
765  wcscat(Buffer, L"\\");
766  wcscat(Buffer, L"Inf\\");
767  wcscat(Buffer, InfFile);
768 
769  /* Install specified section */
771  if (hInf == INVALID_HANDLE_VALUE)
772  goto cleanup;
773 
775  if (Context == NULL)
776  goto cleanup;
777 
778  ret = TRUE;
779  if (ret && InfSection)
780  {
782  hWnd, hInf,
783  InfSection, SPINST_ALL,
786  NULL, NULL);
787  }
788  if (ret && InfService)
789  {
790  ret = SetupInstallServicesFromInfSectionW(hInf, InfService, 0);
791  }
792 
793 cleanup:
794  if (Context)
796  if (hInf != INVALID_HANDLE_VALUE)
797  SetupCloseInfFile(hInf);
798  return ret;
799 }
#define TRUE
Definition: types.h:120
#define INF_STYLE_WIN4
Definition: infsupp.h:41
HWND hWnd
Definition: settings.c:17
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
HINF WINAPI SetupOpenInfFileW(PCWSTR name, PCWSTR class, DWORD style, UINT *error)
Definition: parser.c:1229
VOID WINAPI SetupCloseInfFile(IN HINF InfHandle)
Definition: infsupp.c:43
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2351
#define SP_COPY_NEWER
Definition: setupapi.h:473
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
#define BufferSize
Definition: classpnp.h:419
#define SetLastError(x)
Definition: compat.h:409
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:1323
int ret
static const WCHAR L[]
Definition: oid.c:1250
UINT WINAPI SetupDefaultQueueCallbackW(PVOID context, UINT notification, UINT_PTR param1, UINT_PTR param2)
Definition: queue.c:1777
void WINAPI SetupTermDefaultQueueCallback(PVOID context)
Definition: queue.c:1704
#define SPINST_ALL
Definition: setupapi.h:596
BOOL WINAPI SetupInstallServicesFromInfSectionW(HINF Inf, PCWSTR SectionName, DWORD Flags)
Definition: install.c:1608
PVOID WINAPI SetupInitDefaultQueueCallback(HWND owner)
Definition: queue.c:1677
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
unsigned int UINT
Definition: ndis.h:50
char * cleanup(char *str)
Definition: wpickclick.c:99
#define ERROR_GEN_FAILURE
Definition: winerror.h:134
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)

Referenced by InstallLiveCD(), and InstallReactOS().

◆ InstallLiveCD()

static DWORD InstallLiveCD ( VOID  )
static

Definition at line 803 of file install.c.

804 {
805  STARTUPINFOW StartupInfo;
806  PROCESS_INFORMATION ProcessInformation;
807  BOOL bRes;
808 
809  /* Hack: Install TCP/IP protocol driver */
810  bRes = InstallInfSection(NULL,
811  L"nettcpip.inf",
812  L"MS_TCPIP.PrimaryInstall",
813  L"MS_TCPIP.PrimaryInstall.Services");
814  if (!bRes && GetLastError() != ERROR_FILE_NOT_FOUND)
815  {
816  DPRINT("InstallInfSection() failed with error 0x%lx\n", GetLastError());
817  }
818  else
819  {
820  /* Start the TCP/IP protocol driver */
821  SetupStartService(L"Tcpip", FALSE);
822  SetupStartService(L"Dhcp", FALSE);
823  }
824 
825  if (!CommonInstall())
826  goto error;
827 
828  /* Register components */
829  _SEH2_TRY
830  {
832  hSysSetupInf, L"RegistrationPhase2",
833  SPINST_ALL,
834  0, NULL, 0, NULL, NULL, NULL, NULL))
835  {
836  DPRINT1("SetupInstallFromInfSectionW failed!\n");
837  }
838 
839  RegisterTypeLibraries(hSysSetupInf, L"TypeLibraries");
840  }
842  {
843  DPRINT1("Catching exception\n");
844  }
845  _SEH2_END;
846 
848 
849  /* Run the shell */
850  ZeroMemory(&StartupInfo, sizeof(StartupInfo));
851  StartupInfo.cb = sizeof(StartupInfo);
852  bRes = CreateProcessW(L"userinit.exe",
853  NULL,
854  NULL,
855  NULL,
856  FALSE,
857  0,
858  NULL,
859  NULL,
860  &StartupInfo,
861  &ProcessInformation);
862  if (!bRes)
863  goto error;
864 
865  CloseHandle(ProcessInformation.hThread);
866  CloseHandle(ProcessInformation.hProcess);
867 
868  return 0;
869 
870 error:
871  MessageBoxW(
872  NULL,
873  L"Failed to load LiveCD! You can shutdown your computer, or press ENTER to reboot.",
874  L"ReactOS LiveCD",
875  MB_OK);
876  return 0;
877 }
#define CloseHandle
Definition: compat.h:398
#define error(str)
Definition: mkdosfs.c:1605
BOOL RegisterTypeLibraries(HINF hinf, LPCWSTR szSection)
Definition: install.c:423
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ZeroMemory
Definition: winbase.h:1635
VOID WINAPI SetupCloseInfFile(IN HINF InfHandle)
Definition: infsupp.c:43
_SEH2_TRY
Definition: create.c:4250
static BOOL CommonInstall(VOID)
Definition: install.c:669
unsigned int BOOL
Definition: ntddk_ex.h:94
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
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:4623
DWORD WINAPI SetupStartService(LPCWSTR lpServiceName, BOOL bWait)
Definition: install.c:1512
DWORD cb
Definition: winbase.h:817
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
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:1323
static const WCHAR L[]
Definition: oid.c:1250
#define SPINST_ALL
Definition: setupapi.h:596
HINF hSysSetupInf
Definition: install.c:37
_SEH2_END
Definition: create.c:4424
#define MB_OK
Definition: winuser.h:784
#define DPRINT1
Definition: precomp.h:8
static BOOL InstallInfSection(IN HWND hWnd, IN LPCWSTR InfFile, IN LPCWSTR InfSection OPTIONAL, IN LPCWSTR InfService OPTIONAL)
Definition: install.c:743
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6

Referenced by InstallWindowsNt().

◆ InstallReactOS()

static DWORD InstallReactOS ( VOID  )
static

Definition at line 1256 of file install.c.

1257 {
1258  WCHAR szBuffer[MAX_PATH];
1259  HANDLE token;
1260  TOKEN_PRIVILEGES privs;
1261  HKEY hKey;
1262  HINF hShortcutsInf;
1263  HANDLE hHotkeyThread;
1264  BOOL ret;
1265 
1267  LogItem(NULL, L"Installing ReactOS");
1268 
1269  CreateTempDir(L"TEMP");
1270  CreateTempDir(L"TMP");
1271 
1273  {
1274  FatalError("InitializeProgramFilesDir() failed");
1275  return 0;
1276  }
1277 
1278  if (!InitializeProfiles())
1279  {
1280  FatalError("InitializeProfiles() failed");
1281  return 0;
1282  }
1283 
1285 
1286  if (GetWindowsDirectoryW(szBuffer, ARRAYSIZE(szBuffer)))
1287  {
1289  L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion",
1290  0,
1291  KEY_WRITE,
1292  &hKey) == ERROR_SUCCESS)
1293  {
1294  RegSetValueExW(hKey,
1295  L"PathName",
1296  0,
1297  REG_SZ,
1298  (LPBYTE)szBuffer,
1299  (wcslen(szBuffer) + 1) * sizeof(WCHAR));
1300 
1301  RegSetValueExW(hKey,
1302  L"SystemRoot",
1303  0,
1304  REG_SZ,
1305  (LPBYTE)szBuffer,
1306  (wcslen(szBuffer) + 1) * sizeof(WCHAR));
1307 
1308  RegCloseKey(hKey);
1309  }
1310 
1311  PathAddBackslash(szBuffer);
1312  wcscat(szBuffer, L"system");
1313  CreateDirectory(szBuffer, NULL);
1314  }
1315 
1317  {
1318  FatalError("SaveDefaultUserHive() failed");
1319  return 0;
1320  }
1321 
1322  if (!CopySystemProfile(0))
1323  {
1324  FatalError("CopySystemProfile() failed");
1325  return 0;
1326  }
1327 
1328  hHotkeyThread = CreateThread(NULL, 0, HotkeyThread, NULL, 0, NULL);
1329 
1330  /* Hack: Install TCP/IP protocol driver */
1332  L"nettcpip.inf",
1333  L"MS_TCPIP.PrimaryInstall",
1334  L"MS_TCPIP.PrimaryInstall.Services");
1335  if (!ret && GetLastError() != ERROR_FILE_NOT_FOUND)
1336  {
1337  DPRINT("InstallInfSection() failed with error 0x%lx\n", GetLastError());
1338  }
1339  else
1340  {
1341  /* Start the TCP/IP protocol driver */
1342  SetupStartService(L"Tcpip", FALSE);
1343  SetupStartService(L"Dhcp", FALSE);
1344  }
1345 
1346 
1347  if (!CommonInstall())
1348  return 0;
1349 
1350  InstallWizard();
1351 
1352  InstallSecurity();
1353 
1355 
1356  hShortcutsInf = SetupOpenInfFileW(L"shortcuts.inf",
1357  NULL,
1359  NULL);
1360  if (hShortcutsInf == INVALID_HANDLE_VALUE)
1361  {
1362  FatalError("Failed to open shortcuts.inf");
1363  return 0;
1364  }
1365 
1366  if (!CreateShortcuts(hShortcutsInf, L"ShortcutFolders"))
1367  {
1368  FatalError("CreateShortcuts() failed");
1369  return 0;
1370  }
1371 
1372  SetupCloseInfFile(hShortcutsInf);
1373 
1374  hShortcutsInf = SetupOpenInfFileW(L"rosapps_shortcuts.inf",
1375  NULL,
1377  NULL);
1378  if (hShortcutsInf != INVALID_HANDLE_VALUE)
1379  {
1380  if (!CreateShortcuts(hShortcutsInf, L"ShortcutFolders"))
1381  {
1382  FatalError("CreateShortcuts(rosapps) failed");
1383  return 0;
1384  }
1385  SetupCloseInfFile(hShortcutsInf);
1386  }
1387 
1389  SetSetupType(0);
1390 
1391  if (hHotkeyThread)
1392  {
1393  PostThreadMessage(GetThreadId(hHotkeyThread), WM_QUIT, 0, 0);
1394  CloseHandle(hHotkeyThread);
1395  }
1396 
1397  LogItem(NULL, L"Installing ReactOS done");
1399 
1400  if (AdminInfo.Name != NULL)
1401  RtlFreeHeap(RtlGetProcessHeap(), 0, AdminInfo.Name);
1402 
1403  if (AdminInfo.Domain != NULL)
1404  RtlFreeHeap(RtlGetProcessHeap(), 0, AdminInfo.Domain);
1405 
1406  if (AdminInfo.Password != NULL)
1407  RtlFreeHeap(RtlGetProcessHeap(), 0, AdminInfo.Password);
1408 
1409  /* Get shutdown privilege */
1411  {
1412  FatalError("OpenProcessToken() failed!");
1413  return 0;
1414  }
1417  &privs.Privileges[0].Luid))
1418  {
1419  FatalError("LookupPrivilegeValue() failed!");
1420  return 0;
1421  }
1422  privs.PrivilegeCount = 1;
1425  FALSE,
1426  &privs,
1427  0,
1429  NULL) == 0)
1430  {
1431  FatalError("AdjustTokenPrivileges() failed!");
1432  return 0;
1433  }
1434 
1436  return 0;
1437 }
static BOOL SetSetupType(DWORD dwSetupType)
Definition: install.c:881
#define CloseHandle
Definition: compat.h:398
#define INF_STYLE_WIN4
Definition: infsupp.h:41
static VOID CreateTempDir(IN LPCWSTR VarName)
Definition: install.c:255
#define ERROR_SUCCESS
Definition: deptool.c:10
static BOOL InitializeProgramFilesDir(VOID)
Definition: install.c:960
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:603
#define WM_QUIT
Definition: winuser.h:1605
$ULONG PrivilegeCount
Definition: setypes.h:969
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
static DWORD SaveDefaultUserHive(VOID)
Definition: install.c:1183
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
DWORD WINAPI GetThreadId(IN HANDLE Thread)
Definition: thread.c:875
static VOID InitializeDefaultUserLocale(VOID)
Definition: install.c:1075
#define EWX_REBOOT
Definition: winuser.h:633
HINF WINAPI SetupOpenInfFileW(PCWSTR name, PCWSTR class, DWORD style, UINT *error)
Definition: parser.c:1229
#define LookupPrivilegeValue
Definition: winbase.h:3684
static DWORD CALLBACK HotkeyThread(LPVOID Parameter)
Definition: install.c:910
LPWSTR Name
Definition: globals.h:23
VOID WINAPI SetupCloseInfFile(IN HINF InfHandle)
Definition: infsupp.c:43
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2351
static BOOL CommonInstall(VOID)
Definition: install.c:669
#define SE_PRIVILEGE_ENABLED
Definition: setypes.h:63
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
unsigned int BOOL
Definition: ntddk_ex.h:94
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
VOID InstallWizard(VOID)
Definition: wizard.c:2632
#define PathAddBackslash
Definition: shlwapi.h:783
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:112
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
BOOL WINAPI InitializeProfiles(VOID)
Definition: setup.c:335
VOID SetAutoAdminLogon(VOID)
Definition: security.c:759
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define KEY_WRITE
Definition: nt_native.h:1031
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:4917
DWORD WINAPI SetupStartService(LPCWSTR lpServiceName, BOOL bWait)
Definition: install.c:1512
BOOL WINAPI CopySystemProfile(_In_ ULONG Unused)
Definition: profile.c:565
__wchar_t WCHAR
Definition: xmlstorage.h:180
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1168
#define PostThreadMessage
Definition: winuser.h:5699
#define MAX_PATH
Definition: compat.h:26
VOID WINAPI TerminateSetupActionLog(VOID)
Definition: logfile.c:82
static BOOL CreateShortcuts(HINF hinf, LPCWSTR szSection)
Definition: install.c:215
int ret
static const WCHAR L[]
Definition: oid.c:1250
BOOL WINAPI ExitWindowsEx(_In_ UINT, _In_ DWORD)
LPWSTR Password
Definition: globals.h:25
BOOL WINAPI AdjustTokenPrivileges(HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength)
Definition: security.c:376
HINF hSysSetupInf
Definition: install.c:37
ADMIN_INFO AdminInfo
Definition: install.c:38
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:296
LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY]
Definition: setypes.h:970
LPWSTR Domain
Definition: globals.h:24
VOID InstallSecurity(VOID)
Definition: security.c:590
static BOOL InstallInfSection(IN HWND hWnd, IN LPCWSTR InfFile, IN LPCWSTR InfSection OPTIONAL, IN LPCWSTR InfService OPTIONAL)
Definition: install.c:743
#define SE_SHUTDOWN_NAME
Definition: winnt_old.h:383
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
BOOL WINAPI InitializeSetupActionLog(BOOL bDeleteOldLogFile)
Definition: logfile.c:42
static VOID FatalError(char *pszFmt,...)
Definition: install.c:43
#define TOKEN_ADJUST_PRIVILEGES
Definition: setypes.h:876
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define LogItem(lpTag, lpMessageText...)
Definition: syssetup.h:110
#define REG_SZ
Definition: layer.c:22

Referenced by InstallWindowsNt(), and RunInstallReactOS().

◆ InstallSysSetupInfComponents()

static BOOL InstallSysSetupInfComponents ( VOID  )
static

Definition at line 344 of file install.c.

345 {
346  INFCONTEXT InfContext;
347  WCHAR szNameBuffer[256];
348  WCHAR szSectionBuffer[256];
349  HINF hComponentInf = INVALID_HANDLE_VALUE;
350 
352  L"Infs.Always",
353  NULL,
354  &InfContext))
355  {
356  DPRINT("No Inf.Always section found\n");
357  }
358  else
359  {
360  do
361  {
362  if (!SetupGetStringFieldW(&InfContext,
363  1, // Get the component name
364  szNameBuffer,
365  ARRAYSIZE(szNameBuffer),
366  NULL))
367  {
368  FatalError("Error while trying to get component name \n");
369  return FALSE;
370  }
371 
372  if (!SetupGetStringFieldW(&InfContext,
373  2, // Get the component install section
374  szSectionBuffer,
375  ARRAYSIZE(szSectionBuffer),
376  NULL))
377  {
378  FatalError("Error while trying to get component install section \n");
379  return FALSE;
380  }
381 
382  DPRINT("Trying to execute install section '%S' from '%S' \n", szSectionBuffer, szNameBuffer);
383 
384  hComponentInf = SetupOpenInfFileW(szNameBuffer,
385  NULL,
387  NULL);
388 
389  if (hComponentInf == INVALID_HANDLE_VALUE)
390  {
391  FatalError("SetupOpenInfFileW() failed to open '%S' (Error: %lu)\n", szNameBuffer, GetLastError());
392  return FALSE;
393  }
394 
396  hComponentInf,
397  szSectionBuffer,
398  SPINST_ALL,
399  NULL,
400  NULL,
403  NULL,
404  NULL,
405  NULL))
406  {
407  FatalError("Error while trying to install : %S (Error: %lu)\n", szNameBuffer, GetLastError());
408  SetupCloseInfFile(hComponentInf);
409  return FALSE;
410  }
411 
412  SetupCloseInfFile(hComponentInf);
413  }
414  while (SetupFindNextLine(&InfContext, &InfContext));
415  }
416 
417  return TRUE;
418 }
BOOL WINAPI SetupFindFirstLineW(IN HINF InfHandle, IN PCWSTR Section, IN PCWSTR Key, IN OUT PINFCONTEXT Context)
Definition: infsupp.c:54
#define TRUE
Definition: types.h:120
#define INF_STYLE_WIN4
Definition: infsupp.h:41
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
HINF WINAPI SetupOpenInfFileW(PCWSTR name, PCWSTR class, DWORD style, UINT *error)
Definition: parser.c:1229
VOID WINAPI SetupCloseInfFile(IN HINF InfHandle)
Definition: infsupp.c:43
#define SP_COPY_NEWER
Definition: setupapi.h:473
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
__wchar_t WCHAR
Definition: xmlstorage.h:180
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:1323
static const WCHAR L[]
Definition: oid.c:1250
UINT WINAPI SetupDefaultQueueCallbackW(PVOID context, UINT notification, UINT_PTR param1, UINT_PTR param2)
Definition: queue.c:1777
#define SPINST_ALL
Definition: setupapi.h:596
HINF hSysSetupInf
Definition: install.c:37
BOOL WINAPI SetupFindNextLine(IN PINFCONTEXT ContextIn, OUT PINFCONTEXT ContextOut)
Definition: infsupp.c:80
static VOID FatalError(char *pszFmt,...)
Definition: install.c:43
BOOL WINAPI SetupGetStringFieldW(IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT PWSTR ReturnBuffer, IN ULONG ReturnBufferSize, OUT PULONG RequiredSize)
Definition: infsupp.c:184

Referenced by CommonInstall().

◆ InstallSysSetupInfDevices()

static BOOL InstallSysSetupInfDevices ( VOID  )
static

Definition at line 308 of file install.c.

309 {
310  INFCONTEXT InfContext;
311  WCHAR szLineBuffer[256];
312  DWORD dwLineLength;
313 
315  L"DeviceInfsToInstall",
316  NULL,
317  &InfContext))
318  {
319  return FALSE;
320  }
321 
322  do
323  {
324  if (!SetupGetStringFieldW(&InfContext,
325  0,
326  szLineBuffer,
327  ARRAYSIZE(szLineBuffer),
328  &dwLineLength))
329  {
330  return FALSE;
331  }
332 
333  if (!SetupDiInstallClassW(NULL, szLineBuffer, DI_QUIETINSTALL, NULL))
334  {
335  return FALSE;
336  }
337  }
338  while (SetupFindNextLine(&InfContext, &InfContext));
339 
340  return TRUE;
341 }
BOOL WINAPI SetupFindFirstLineW(IN HINF InfHandle, IN PCWSTR Section, IN PCWSTR Key, IN OUT PINFCONTEXT Context)
Definition: infsupp.c:54
#define TRUE
Definition: types.h:120
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
BOOL WINAPI SetupDiInstallClassW(HWND hwndParent, PCWSTR InfFileName, DWORD Flags, HSPFILEQ FileQueue)
Definition: devinst.c:3610
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define DI_QUIETINSTALL
Definition: setupapi.h:68
static const WCHAR L[]
Definition: oid.c:1250
HINF hSysSetupInf
Definition: install.c:37
BOOL WINAPI SetupFindNextLine(IN PINFCONTEXT ContextIn, OUT PINFCONTEXT ContextOut)
Definition: infsupp.c:80
BOOL WINAPI SetupGetStringFieldW(IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT PWSTR ReturnBuffer, IN ULONG ReturnBufferSize, OUT PULONG RequiredSize)
Definition: infsupp.c:184

Referenced by CommonInstall().

◆ InstallWindowsNt()

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

Definition at line 1446 of file install.c.

1447 {
1448  INT i;
1449  PWSTR p;
1450 
1451  for (i = 0; i < argc; ++i)
1452  {
1453  p = argv[i];
1454  if (*p == L'-')
1455  {
1456  p++;
1457 
1458  // NOTE: On Windows, "mini" means "minimal UI", and can be used
1459  // in addition to "newsetup"; these options are not exclusive.
1460  if (_wcsicmp(p, L"newsetup") == 0)
1461  return (INT)InstallReactOS();
1462  else if (_wcsicmp(p, L"mini") == 0)
1463  return (INT)InstallLiveCD();
1464 
1465  /* Add support for other switches */
1466  }
1467  }
1468 
1469  return 0;
1470 }
static int argc
Definition: ServiceArgs.c:12
static DWORD InstallReactOS(VOID)
Definition: install.c:1256
uint16_t * PWSTR
Definition: typedefs.h:54
#define argv
Definition: mplay32.c:18
int32_t INT
Definition: typedefs.h:56
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static const WCHAR L[]
Definition: oid.c:1250
GLfloat GLfloat p
Definition: glext.h:8902
static DWORD InstallLiveCD(VOID)
Definition: install.c:803
_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 624 of file install.c.

625 {
626  HKEY hControlKey = NULL;
627  LPWSTR pwszSystemStartOptions = NULL;
628  LPWSTR pwszCurrentOption, pwszNextOption; /* Pointers into SystemStartOptions */
629  BOOL bConsoleBoot = FALSE;
630  LONG rc;
631 
633  L"SYSTEM\\CurrentControlSet\\Control",
634  0,
636  &hControlKey);
637  if (rc != ERROR_SUCCESS)
638  goto cleanup;
639 
640  rc = ReadRegSzKey(hControlKey, L"SystemStartOptions", &pwszSystemStartOptions);
641  if (rc != ERROR_SUCCESS)
642  goto cleanup;
643 
644  /* Check for CONSOLE switch in SystemStartOptions */
645  pwszCurrentOption = pwszSystemStartOptions;
646  while (pwszCurrentOption)
647  {
648  pwszNextOption = wcschr(pwszCurrentOption, L' ');
649  if (pwszNextOption)
650  *pwszNextOption = L'\0';
651  if (wcsicmp(pwszCurrentOption, L"CONSOLE") == 0)
652  {
653  DPRINT("Found %S. Switching to console boot\n", pwszCurrentOption);
654  bConsoleBoot = TRUE;
655  goto cleanup;
656  }
657  pwszCurrentOption = pwszNextOption ? pwszNextOption + 1 : NULL;
658  }
659 
660 cleanup:
661  if (hControlKey != NULL)
662  RegCloseKey(hControlKey);
663  if (pwszSystemStartOptions)
664  HeapFree(GetProcessHeap(), 0, pwszSystemStartOptions);
665  return bConsoleBoot;
666 }
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define GetProcessHeap()
Definition: compat.h:395
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
static const WCHAR L[]
Definition: oid.c:1250
#define wcsicmp
Definition: string.h:1152
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
char * cleanup(char *str)
Definition: wpickclick.c:99
static LONG ReadRegSzKey(IN HKEY hKey, IN LPCWSTR pszKey, OUT LPWSTR *pValue)
Definition: install.c:588
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:394
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by CommonInstall().

◆ ReadRegSzKey()

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

Definition at line 588 of file install.c.

592 {
593  LONG rc;
594  DWORD dwType;
595  DWORD cbData = 0;
596  LPWSTR pwszValue;
597 
598  if (!pValue)
600 
601  *pValue = NULL;
602  rc = RegQueryValueExW(hKey, pszKey, NULL, &dwType, NULL, &cbData);
603  if (rc != ERROR_SUCCESS)
604  return rc;
605  if (dwType != REG_SZ)
606  return ERROR_FILE_NOT_FOUND;
607  pwszValue = HeapAlloc(GetProcessHeap(), 0, cbData + sizeof(WCHAR));
608  if (!pwszValue)
610  rc = RegQueryValueExW(hKey, pszKey, NULL, NULL, (LPBYTE)pwszValue, &cbData);
611  if (rc != ERROR_SUCCESS)
612  {
613  HeapFree(GetProcessHeap(), 0, pwszValue);
614  return rc;
615  }
616  /* NULL-terminate the string */
617  pwszValue[cbData / sizeof(WCHAR)] = '\0';
618 
619  *pValue = pwszValue;
620  return ERROR_SUCCESS;
621 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
unsigned char * LPBYTE
Definition: typedefs.h:52
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4134
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:394
#define REG_SZ
Definition: layer.c:22

Referenced by IsConsoleBoot().

◆ RegisterTypeLibraries()

BOOL RegisterTypeLibraries ( HINF  hinf,
LPCWSTR  szSection 
)

Definition at line 423 of file install.c.

424 {
425  INFCONTEXT InfContext;
426  BOOL res;
429  INT csidl;
430  LPWSTR p;
431  HMODULE hmod;
432  HRESULT hret;
433 
434  /* Begin iterating the entries in the inf section */
435  res = SetupFindFirstLine(hinf, szSection, NULL, &InfContext);
436  if (!res) return FALSE;
437 
438  do
439  {
440  /* Get the name of the current type library */
441  if (!SetupGetStringFieldW(&InfContext, 1, szName, ARRAYSIZE(szName), NULL))
442  {
443  FatalError("SetupGetStringFieldW failed\n");
444  continue;
445  }
446 
447  if (!SetupGetIntField(&InfContext, 2, &csidl))
448  csidl = CSIDL_SYSTEM;
449 
450  hret = SHGetFolderPathW(NULL, csidl, NULL, 0, szPath);
451  if (FAILED(hret))
452  {
453  FatalError("SHGetFolderPathW failed hret=0x%lx\n", hret);
454  continue;
455  }
456 
458  wcscpy(p, szName);
459 
461  if (hmod == NULL)
462  {
463  FatalError("LoadLibraryW failed\n");
464  continue;
465  }
466 
468 
469  } while (SetupFindNextLine(&InfContext, &InfContext));
470 
471  return TRUE;
472 }
#define TRUE
Definition: types.h:120
HRESULT __wine_register_resources(HMODULE module) DECLSPEC_HIDDEN
Definition: register.c:98
#define SetupFindFirstLine
Definition: setupapi.h:2618
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
int32_t INT
Definition: typedefs.h:56
unsigned int BOOL
Definition: ntddk_ex.h:94
#define PathAddBackslash
Definition: shlwapi.h:783
#define LoadLibraryW(x)
Definition: compat.h:404
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define MAX_PATH
Definition: compat.h:26
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static PEXPLICIT_ACCESSW *static HMODULE hmod
Definition: security.c:141
LPCWSTR szPath
Definition: env.c:35
BOOL WINAPI SetupFindNextLine(IN PINFCONTEXT ContextIn, OUT PINFCONTEXT ContextOut)
Definition: infsupp.c:80
HRESULT WINAPI SHGetFolderPathW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath)
Definition: shellpath.c:2085
static const WCHAR szName[]
Definition: msipriv.h:1194
BOOL WINAPI SetupGetIntField(IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT INT *IntegerValue)
Definition: infsupp.c:146
GLuint res
Definition: glext.h:9613
#define CSIDL_SYSTEM
Definition: shlobj.h:2039
GLfloat GLfloat p
Definition: glext.h:8902
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static VOID FatalError(char *pszFmt,...)
Definition: install.c:43
BOOL WINAPI SetupGetStringFieldW(IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT PWSTR ReturnBuffer, IN ULONG ReturnBufferSize, OUT PULONG RequiredSize)
Definition: infsupp.c:184

Referenced by InstallLiveCD(), and RegistrationProc().

◆ SaveDefaultUserHive()

static DWORD SaveDefaultUserHive ( VOID  )
static

Definition at line 1183 of file install.c.

1184 {
1185  WCHAR szDefaultUserHive[MAX_PATH];
1186  HKEY hUserKey = NULL;
1187  DWORD cchSize;
1188  DWORD dwError;
1189 
1190  DPRINT("SaveDefaultUserHive()\n");
1191 
1192  cchSize = ARRAYSIZE(szDefaultUserHive);
1193  GetDefaultUserProfileDirectoryW(szDefaultUserHive, &cchSize);
1194 
1195  wcscat(szDefaultUserHive, L"\\ntuser.dat");
1196 
1197  dwError = RegOpenKeyExW(HKEY_USERS,
1198  L".DEFAULT",
1199  0,
1200  KEY_READ,
1201  &hUserKey);
1202  if (dwError != ERROR_SUCCESS)
1203  {
1204  DPRINT1("RegOpenKeyExW() failed (Error %lu)\n", dwError);
1205  return dwError;
1206  }
1207 
1208  pSetupEnablePrivilege(L"SeBackupPrivilege", TRUE);
1209 
1210  /* Save the Default hive */
1211  dwError = RegSaveKeyExW(hUserKey,
1212  szDefaultUserHive,
1213  NULL,
1215  if (dwError == ERROR_ALREADY_EXISTS)
1216  {
1217  WCHAR szBackupHive[MAX_PATH];
1218 
1219  /* Build the backup hive file name by replacing the extension */
1220  wcscpy(szBackupHive, szDefaultUserHive);
1221  wcscpy(&szBackupHive[wcslen(szBackupHive) - 4], L".bak");
1222 
1223  /* Back up the existing default user hive by renaming it, replacing any possible existing old backup */
1224  if (!MoveFileExW(szDefaultUserHive,
1225  szBackupHive,
1227  {
1228  dwError = GetLastError();
1229  DPRINT1("Failed to create a default-user hive backup '%S', MoveFileExW failed (Error %lu)\n",
1230  szBackupHive, dwError);
1231  }
1232  else
1233  {
1234  /* The backup has been done, retry saving the Default hive */
1235  dwError = RegSaveKeyExW(hUserKey,
1236  szDefaultUserHive,
1237  NULL,
1239  }
1240  }
1241  if (dwError != ERROR_SUCCESS)
1242  {
1243  DPRINT1("RegSaveKeyExW() failed (Error %lu)\n", dwError);
1244  }
1245 
1246  pSetupEnablePrivilege(L"SeBackupPrivilege", FALSE);
1247 
1248  RegCloseKey(hUserKey);
1249 
1250  return dwError;
1251 }
#define HKEY_USERS
Definition: winreg.h:13
LONG WINAPI RegSaveKeyExW(HKEY hKey, LPCWSTR lpFile, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD Flags)
Definition: reg.c:4762
BOOL WINAPI GetDefaultUserProfileDirectoryW(_Out_opt_ LPWSTR lpProfileDir, _Inout_ LPDWORD lpcchSize)
Definition: profile.c:1360
#define TRUE
Definition: types.h:120
#define REG_STANDARD_FORMAT
Definition: cmtypes.h:97
#define ERROR_SUCCESS
Definition: deptool.c:10
#define MOVEFILE_REPLACE_EXISTING
Definition: filesup.h:28
#define KEY_READ
Definition: nt_native.h:1023
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
BOOL WINAPI pSetupEnablePrivilege(LPCWSTR lpPrivilegeName, BOOL bEnable)
Definition: misc.c:440
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1250
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define DPRINT1
Definition: precomp.h:8
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
BOOL WINAPI MoveFileExW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName OPTIONAL, IN DWORD dwFlags)
Definition: move.c:1060
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)

Referenced by InstallReactOS().

◆ SetSetupType()

static BOOL SetSetupType ( DWORD  dwSetupType)
static

Definition at line 881 of file install.c.

882 {
883  DWORD dwError;
884  HKEY hKey;
885 
886  dwError = RegOpenKeyExW(
888  L"SYSTEM\\Setup",
889  0,
891  &hKey);
892  if (dwError != ERROR_SUCCESS)
893  return FALSE;
894 
895  dwError = RegSetValueExW(
896  hKey,
897  L"SetupType",
898  0,
899  REG_DWORD,
900  (LPBYTE)&dwSetupType,
901  sizeof(DWORD));
902  RegCloseKey(hKey);
903  if (dwError != ERROR_SUCCESS)
904  return FALSE;
905 
906  return TRUE;
907 }
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_SET_VALUE
Definition: nt_native.h:1017
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
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:4917
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
#define REG_DWORD
Definition: sdbapi.c:596
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by InstallReactOS().

◆ SetupChangeFontSize()

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

Definition at line 1477 of file install.c.

1480 {
1482  return FALSE;
1483 }
#define SetLastError(x)
Definition: compat.h:409
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92

◆ SetupChangeLocale()

DWORD WINAPI SetupChangeLocale ( HWND  hWnd,
LCID  Lcid 
)

Definition at line 1504 of file install.c.

1505 {
1506  return SetupChangeLocaleEx(hWnd, Lcid, NULL, 0, 0, 0);
1507 }
_In_ CONST DEVPROPKEY _In_ LCID Lcid
Definition: iofuncs.h:2408
HWND hWnd
Definition: settings.c:17
DWORD WINAPI SetupChangeLocaleEx(HWND hWnd, LCID Lcid, LPCWSTR lpSrcRootPath, char Unknown, DWORD dwUnused1, DWORD dwUnused2)
Definition: install.c:1489
smooth NULL
Definition: ftsmooth.c:416

◆ SetupChangeLocaleEx()

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

Definition at line 1489 of file install.c.

1495 {
1497  return FALSE;
1498 }
#define SetLastError(x)
Definition: compat.h:409
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92

Referenced by SetupChangeLocale().

◆ SetupStartService()

DWORD WINAPI SetupStartService ( LPCWSTR  lpServiceName,
BOOL  bWait 
)

Definition at line 1512 of file install.c.

1515 {
1516  SC_HANDLE hManager = NULL;
1517  SC_HANDLE hService = NULL;
1518  DWORD dwError = ERROR_SUCCESS;
1519 
1520  hManager = OpenSCManagerW(NULL,
1521  NULL,
1523  if (hManager == NULL)
1524  {
1525  dwError = GetLastError();
1526  goto done;
1527  }
1528 
1529  hService = OpenServiceW(hManager,
1530  lpServiceName,
1531  SERVICE_START);
1532  if (hService == NULL)
1533  {
1534  dwError = GetLastError();
1535  goto done;
1536  }
1537 
1538  if (!StartService(hService, 0, NULL))
1539  {
1540  dwError = GetLastError();
1541  goto done;
1542  }
1543 
1544 done:
1545  if (hService != NULL)
1546  CloseServiceHandle(hService);
1547 
1548  if (hManager != NULL)
1549  CloseServiceHandle(hManager);
1550 
1551  return dwError;
1552 }
#define StartService
Definition: winsvc.h:585
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
SC_HANDLE WINAPI OpenServiceW(SC_HANDLE hSCManager, LPCWSTR lpServiceName, DWORD dwDesiredAccess)
Definition: scm.c:2103
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
Definition: scm.c:577
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
SC_HANDLE WINAPI OpenSCManagerW(LPCWSTR lpMachineName, LPCWSTR lpDatabaseName, DWORD dwDesiredAccess)
Definition: scm.c:2011
#define SERVICE_START
Definition: winsvc.h:57
#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 552 of file install.c.

554 {
555  HWND hWnd, hItem;
556  MSG Msg;
558 
563  (LPARAM)NULL);
564  if (!hWnd)
565  return 0;
566 
568 
570  if (hItem)
571  {
573  }
574 
575  /* Message loop for the Status window */
576  while (GetMessage(&Msg, NULL, 0, 0))
577  {
580  }
581 
582  EndDialog(hWnd, 0);
583 
584  return 0;
585 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define DispatchMessage
Definition: winuser.h:5631
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define TRUE
Definition: types.h:120
static INT_PTR CALLBACK StatusMessageWindowProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: install.c:528
#define PBM_SETMARQUEE
Definition: commctrl.h:2171
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
#define IDC_STATUSPROGRESS
Definition: resource.h:81
HWND hWnd
Definition: settings.c:17
struct @1567 Msg[]
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
HTREEITEM hItem
Definition: treelist.h:37
smooth NULL
Definition: ftsmooth.c:416
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:622
LONG_PTR LPARAM
Definition: windef.h:208
#define SW_SHOW
Definition: winuser.h:769
#define PostMessage
Definition: winuser.h:5698
static HINSTANCE hDllInstance
Definition: clb.c:30
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
LPVOID lpParameter
Definition: kernel32.h:234
#define IDD_STATUSWINDOW_DLG
Definition: resource.h:79
#define GetMessage
Definition: winuser.h:5656
#define CreateDialogParam
Definition: winuser.h:5618

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 528 of file install.c.

533 {
535 
536  switch (uMsg)
537  {
538  case WM_INITDIALOG:
539  {
540  WCHAR szMsg[256];
541 
543  return FALSE;
544  SetDlgItemTextW(hwndDlg, IDC_STATUSLABEL, szMsg);
545  return TRUE;
546  }
547  }
548  return FALSE;
549 }
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
WPARAM wParam
Definition: combotst.c:138
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define IDS_STATUS_INSTALL_DEV
Definition: resource.h:134
static HINSTANCE hDllInstance
Definition: clb.c:30
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define IDC_STATUSLABEL
Definition: resource.h:80
#define WM_INITDIALOG
Definition: winuser.h:1715

Referenced by ShowStatusMessageThread().

Variable Documentation

◆ AdminInfo

ADMIN_INFO AdminInfo

Definition at line 38 of file install.c.

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

◆ hSysSetupInf