ReactOS  0.4.15-dev-2947-g59e1b78
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)
 
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 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

◆ CommonInstall()

static BOOL CommonInstall ( VOID  )
static

Definition at line 799 of file install.c.

800 {
801  HANDLE hThread = NULL;
802  BOOL bResult = FALSE;
803 
804  hSysSetupInf = SetupOpenInfFileW(L"syssetup.inf",
805  NULL,
807  NULL);
809  {
810  FatalError("SetupOpenInfFileW() failed to open 'syssetup.inf' (Error: %lu)\n", GetLastError());
811  return FALSE;
812  }
813 
815  {
816  FatalError("InstallSysSetupInfDevices() failed!\n");
817  goto Exit;
818  }
819 
821  {
822  FatalError("InstallSysSetupInfComponents() failed!\n");
823  goto Exit;
824  }
825 
826  if (!IsConsoleBoot())
827  {
829  0,
831  NULL,
832  0,
833  NULL);
834  }
835 
837  {
838  FatalError("EnableUserModePnpManager() failed!\n");
839  goto Exit;
840  }
841 
843  {
844  FatalError("CMP_WaitNoPendingInstallEvents() failed!\n");
845  goto Exit;
846  }
847 
848  bResult = TRUE;
849 
850 Exit:
851 
852  if (bResult == FALSE)
853  {
855  }
856 
857  if (hThread != NULL)
858  {
862  }
863 
864  return bResult;
865 }
#define CloseHandle
Definition: compat.h:598
#define INF_STYLE_WIN4
Definition: infsupp.h:41
static BOOL InstallSysSetupInfComponents(VOID)
Definition: install.c:354
#define TRUE
Definition: types.h:120
#define WM_QUIT
Definition: winuser.h:1605
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
DWORD WINAPI GetThreadId(IN HANDLE Thread)
Definition: thread.c:912
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
#define FALSE
Definition: types.h:117
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:136
#define WAIT_OBJECT_0
Definition: winbase.h:403
static DWORD WINAPI ShowStatusMessageThread(IN LPVOID lpParameter)
Definition: install.c:688
static void Exit(void)
Definition: sock.c:1331
#define PostThreadMessage
Definition: winuser.h:5808
static BOOL InstallSysSetupInfDevices(VOID)
Definition: install.c:318
DWORD WINAPI CMP_WaitNoPendingInstallEvents(_In_ DWORD dwTimeout)
Definition: cfgmgr.c:797
static const WCHAR L[]
Definition: oid.c:1250
static BOOL IsConsoleBoot(VOID)
Definition: install.c:754
HINF hSysSetupInf
Definition: install.c:37
#define NULL
Definition: types.h:112
HANDLE hThread
Definition: wizard.c:28
#define INFINITE
Definition: serial.h:102
static VOID FatalError(char *pszFmt,...)
Definition: install.c:53
static BOOL EnableUserModePnpManager(VOID)
Definition: install.c:485

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 hr
Definition: shlfolder.c:183
#define TRUE
Definition: types.h:120
#define IID_IShellLink
Definition: shlguid.h:131
if SUCCEEDED(hr)
LONG HRESULT
Definition: typedefs.h:79
_In_ LPCSTR pszDir
Definition: shellapi.h:582
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
#define NULL
Definition: types.h:112
const GUID IID_IPersistFile

Referenced by CreateShortcut().

◆ CreateShortcut()

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

Definition at line 118 of file install.c.

125 {
126  DWORD dwLen;
127  LPWSTR Ptr;
130  WCHAR szWorkingDirBuf[MAX_PATH];
131 
132  /* If no working directory is provided, try to compute a default one */
133  if (pszWorkingDir == NULL || pszWorkingDir[0] == L'\0')
134  {
135  if (ExpandEnvironmentStringsW(pszCommand, szPath, ARRAYSIZE(szPath)) == 0)
136  wcscpy(szPath, pszCommand);
137 
138  dwLen = GetFullPathNameW(szPath,
139  ARRAYSIZE(szWorkingDirBuf),
140  szWorkingDirBuf,
141  &lpFilePart);
142  if (dwLen != 0 && dwLen <= ARRAYSIZE(szWorkingDirBuf))
143  {
144  /* Since those should only be called with (.exe) files,
145  lpFilePart has not to be NULL */
146  ASSERT(lpFilePart != NULL);
147 
148  /* We're only interested in the path. Cut the file name off.
149  Also remove the trailing backslash unless the working directory
150  is only going to be a drive, i.e. C:\ */
151  *(lpFilePart--) = L'\0';
152  if (!(lpFilePart - szWorkingDirBuf == 2 &&
153  szWorkingDirBuf[1] == L':' && szWorkingDirBuf[2] == L'\\'))
154  {
155  *lpFilePart = L'\0';
156  }
157  pszWorkingDir = szWorkingDirBuf;
158  }
159  }
160 
161  /* If we failed to compute a working directory, just do not use one */
162  if (pszWorkingDir && pszWorkingDir[0] == L'\0')
163  pszWorkingDir = NULL;
164 
165  /* Build the shortcut file name */
166  wcscpy(szPath, pszFolder);
168  wcscpy(Ptr, pszName);
169 
170  /* Create the shortcut */
172  pszCommand,
173  L"",
174  pszWorkingDir,
175  /* Special value to indicate no icon */
176  (iIconNr != -1 ? pszCommand : NULL),
177  iIconNr,
178  pszDescription));
179 }
_In_ LPCSTR _In_opt_ LPCSTR _In_ DWORD _Out_opt_ LPSTR * lpFilePart
Definition: winbase.h:3054
_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
if SUCCEEDED(hr)
#define PathAddBackslash
Definition: shlwapi.h:783
#define ASSERT(a)
Definition: mode.c:44
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
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
LPCWSTR szPath
Definition: env.c:37
#define NULL
Definition: types.h:112
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:72
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by CreateShortcutsFromSection().

◆ CreateShortcuts()

static BOOL CreateShortcuts ( HINF  hinf,
LPCWSTR  szSection 
)
static

Definition at line 225 of file install.c.

226 {
229  WCHAR szFolder[MAX_PATH];
230  WCHAR szFolderSection[MAX_PATH];
231  INT csidl;
232 
234 
235  if (!SetupFindFirstLine(hinf, szSection, NULL, &Context))
236  return FALSE;
237 
238  do
239  {
240  if (SetupGetFieldCount(&Context) < 2)
241  continue;
242 
243  if (!SetupGetStringFieldW(&Context, 0, szFolderSection, ARRAYSIZE(szFolderSection), NULL))
244  continue;
245 
246  if (!SetupGetIntField(&Context, 1, &csidl))
247  continue;
248 
249  if (!SetupGetStringFieldW(&Context, 2, szFolder, ARRAYSIZE(szFolder), NULL))
250  continue;
251 
253  continue;
254 
255  CreateShortcutsFromSection(hinf, szFolderSection, szPath);
256 
257  } while (SetupFindNextLine(&Context, &Context));
258 
259  CoUninitialize();
260 
261  return TRUE;
262 }
#define SetupFindFirstLine
Definition: setupapi.h:2619
#define TRUE
Definition: types.h:120
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
int32_t INT
Definition: typedefs.h:58
#define FALSE
Definition: types.h:117
static BOOL CreateShortcutsFromSection(HINF hinf, LPWSTR pszSection, LPCWSTR pszFolder)
Definition: install.c:182
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
ULONG WINAPI SetupGetFieldCount(IN PINFCONTEXT Context)
Definition: infsupp.c:91
LPCWSTR szPath
Definition: env.c:37
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
#define NULL
Definition: types.h:112
#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:1964
struct tagContext Context
Definition: acpixf.h:1034
BOOL WINAPI SetupGetIntField(IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT INT *IntegerValue)
Definition: infsupp.c:146
HRESULT WINAPI SHGetFolderPathAndSubDirW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPCWSTR pszSubPath, LPWSTR pszPath)
Definition: shellpath.c:2512
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 182 of file install.c.

183 {
185  DWORD dwFieldCount;
186  INT iIconNr;
187  WCHAR szCommand[MAX_PATH];
190  WCHAR szDirectory[MAX_PATH];
191 
192  if (!SetupFindFirstLine(hinf, pszSection, NULL, &Context))
193  return FALSE;
194 
195  do
196  {
197  dwFieldCount = SetupGetFieldCount(&Context);
198  if (dwFieldCount < 3)
199  continue;
200 
201  if (!SetupGetStringFieldW(&Context, 1, szCommand, ARRAYSIZE(szCommand), NULL))
202  continue;
203 
205  continue;
206 
208  continue;
209 
210  if (dwFieldCount < 4 || !SetupGetIntField(&Context, 4, &iIconNr))
211  iIconNr = -1; /* Special value to indicate no icon */
212 
213  if (dwFieldCount < 5 || !SetupGetStringFieldW(&Context, 5, szDirectory, ARRAYSIZE(szDirectory), NULL))
214  szDirectory[0] = L'\0';
215 
216  wcscat(szName, L".lnk");
217 
218  CreateShortcut(pszFolder, szName, szCommand, szDescription, iIconNr, szDirectory);
219 
220  } while (SetupFindNextLine(&Context, &Context));
221 
222  return TRUE;
223 }
#define SetupFindFirstLine
Definition: setupapi.h:2619
#define TRUE
Definition: types.h:120
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
int32_t INT
Definition: typedefs.h:58
#define FALSE
Definition: types.h:117
static BOOL CreateShortcut(LPCWSTR pszFolder, LPCWSTR pszName, LPCWSTR pszCommand, LPCWSTR pszDescription, INT iIconNr, LPCWSTR pszWorkingDir)
Definition: install.c:118
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
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)
#define NULL
Definition: types.h:112
BOOL WINAPI SetupFindNextLine(IN PINFCONTEXT ContextIn, OUT PINFCONTEXT ContextOut)
Definition: infsupp.c:80
static const WCHAR szName[]
Definition: msipriv.h:1194
struct tagContext Context
Definition: acpixf.h:1034
BOOL WINAPI SetupGetIntField(IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT INT *IntegerValue)
Definition: infsupp.c:146
static const WCHAR szDescription[]
Definition: provider.c:55
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 265 of file install.c.

267 {
268  WCHAR szTempDir[MAX_PATH];
269  WCHAR szBuffer[MAX_PATH];
270  DWORD dwLength;
271  HKEY hKey;
272 
274  L"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment",
275  0,
277  &hKey) != ERROR_SUCCESS)
278  {
279  FatalError("Error: %lu\n", GetLastError());
280  return;
281  }
282 
283  /* Get temp dir */
284  dwLength = sizeof(szBuffer);
286  VarName,
287  NULL,
288  NULL,
289  (LPBYTE)szBuffer,
290  &dwLength) != ERROR_SUCCESS)
291  {
292  FatalError("Error: %lu\n", GetLastError());
293  goto cleanup;
294  }
295 
296  /* Expand it */
297  if (!ExpandEnvironmentStringsW(szBuffer, szTempDir, ARRAYSIZE(szTempDir)))
298  {
299  FatalError("Error: %lu\n", GetLastError());
300  goto cleanup;
301  }
302 
303  /* Create profiles directory */
304  if (!CreateDirectoryW(szTempDir, NULL))
305  {
307  {
308  FatalError("Error: %lu\n", GetLastError());
309  goto cleanup;
310  }
311  }
312 
313 cleanup:
314  RegCloseKey(hKey);
315 }
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:1040
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:53
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
__wchar_t WCHAR
Definition: xmlstorage.h:180
static DWORD DWORD * dwLength
Definition: fusion.c:85
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
FxAutoRegKey hKey
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define NULL
Definition: types.h:112
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:3366
char * cleanup(char *str)
Definition: wpickclick.c:99
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
static VOID FatalError(char *pszFmt,...)
Definition: install.c:53
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by InstallReactOS().

◆ EnableUserModePnpManager()

static BOOL EnableUserModePnpManager ( VOID  )
static

Definition at line 485 of file install.c.

486 {
487  SC_HANDLE hSCManager = NULL;
488  SC_HANDLE hService = NULL;
490  BOOL bRet = FALSE;
491  DWORD BytesNeeded, WaitTime;
492 
494  if (hSCManager == NULL)
495  {
496  DPRINT1("Unable to open the service control manager.\n");
497  DPRINT1("Last Error %d\n", GetLastError());
498  goto cleanup;
499  }
500 
501  hService = OpenServiceW(hSCManager,
502  L"PlugPlay",
504  if (hService == NULL)
505  {
506  DPRINT1("Unable to open PlugPlay service\n");
507  goto cleanup;
508  }
509 
510  bRet = ChangeServiceConfigW(hService,
514  NULL, NULL, NULL,
515  NULL, NULL, NULL, NULL);
516  if (!bRet)
517  {
518  DPRINT1("Unable to change the service configuration\n");
519  goto cleanup;
520  }
521 
522  bRet = StartServiceW(hService, 0, NULL);
523  if (!bRet && (GetLastError() != ERROR_SERVICE_ALREADY_RUNNING))
524  {
525  DPRINT1("Unable to start service\n");
526  goto cleanup;
527  }
528 
529  while (TRUE)
530  {
531  bRet = QueryServiceStatusEx(hService,
534  sizeof(ServiceStatus),
535  &BytesNeeded);
536  if (!bRet)
537  {
538  DPRINT1("QueryServiceStatusEx() failed for PlugPlay service (error 0x%x)\n", GetLastError());
539  goto cleanup;
540  }
541 
543  break;
544 
545  WaitTime = ServiceStatus.dwWaitHint / 10;
546  if (WaitTime < 1000) WaitTime = 1000;
547  else if (WaitTime > 10000) WaitTime = 10000;
548  Sleep(WaitTime);
549  };
550 
552  {
553  bRet = FALSE;
554  DPRINT1("Failed to start PlugPlay service\n");
555  goto cleanup;
556  }
557 
558  bRet = TRUE;
559 
560 cleanup:
561  if (hService != NULL)
562  CloseServiceHandle(hService);
563  if (hSCManager != NULL)
565  return bRet;
566 }
#define SC_MANAGER_ENUMERATE_SERVICE
Definition: winsvc.h:16
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
DWORD dwCurrentState
Definition: winsvc.h:100
#define TRUE
Definition: types.h:120
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
#define SERVICE_START_PENDING
Definition: winsvc.h:22
BOOL WINAPI QueryServiceStatusEx(SC_HANDLE hService, SC_STATUS_TYPE InfoLevel, LPBYTE lpBuffer, DWORD cbBufSize, LPDWORD pcbBytesNeeded)
Definition: scm.c:2835
#define SERVICE_NO_CHANGE
Definition: winsvc.h:20
unsigned char * LPBYTE
Definition: typedefs.h:53
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define SERVICE_RUNNING
Definition: winsvc.h:24
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
SC_HANDLE WINAPI OpenServiceW(SC_HANDLE hSCManager, LPCWSTR lpServiceName, DWORD dwDesiredAccess)
Definition: scm.c:2108
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
Definition: scm.c:580
#define SERVICE_QUERY_STATUS
Definition: winsvc.h:55
BOOL WINAPI StartServiceW(SC_HANDLE hService, DWORD dwNumServiceArgs, LPCWSTR *lpServiceArgVectors)
Definition: scm.c:2928
DWORD dwWaitHint
Definition: winsvc.h:105
#define SERVICE_CHANGE_CONFIG
Definition: winsvc.h:54
static SERVICE_STATUS ServiceStatus
Definition: browser.c:22
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
SC_HANDLE WINAPI OpenSCManagerW(LPCWSTR lpMachineName, LPCWSTR lpDatabaseName, DWORD dwDesiredAccess)
Definition: scm.c:2016
SC_HANDLE hSCManager
Definition: sc.c:12
#define SERVICE_START
Definition: winsvc.h:57
#define NULL
Definition: types.h:112
#define DPRINT1
Definition: precomp.h:8
#define SERVICE_AUTO_START
Definition: cmtypes.h:977
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 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
int WINAPI MessageBoxA(_In_opt_ HWND, _In_opt_ LPCSTR, _In_opt_ LPCSTR, _In_ UINT)
#define va_end(ap)
Definition: acmsvcex.h:90
char * va_list
Definition: acmsvcex.h:78
va_start(ap, x)
static const WCHAR L[]
Definition: oid.c:1250
int __cdecl vsprintf(char *_Dest, const char *_Format, va_list _Args)
Definition: sprintf.c:733
#define NULL
Definition: types.h:112
#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:98

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

◆ HotkeyThread()

static DWORD CALLBACK HotkeyThread ( LPVOID  Parameter)
static

Definition at line 974 of file install.c.

975 {
976  ATOM hotkey;
977  MSG msg;
978 
979  DPRINT("HotkeyThread start\n");
980 
981  hotkey = GlobalAddAtomW(L"Setup Shift+F10 Hotkey");
982 
983  if (!RegisterHotKey(NULL, hotkey, MOD_SHIFT, VK_F10))
984  DPRINT1("RegisterHotKey failed with %lu\n", GetLastError());
985 
986  while (GetMessage(&msg, NULL, 0, 0))
987  {
988  if (msg.hwnd == NULL && msg.message == WM_HOTKEY && msg.wParam == hotkey)
989  {
990  STARTUPINFOW si = { sizeof(si) };
992 
993  if (CreateProcessW(L"cmd.exe",
994  NULL,
995  NULL,
996  NULL,
997  FALSE,
999  NULL,
1000  NULL,
1001  &si,
1002  &pi))
1003  {
1004  CloseHandle(pi.hProcess);
1005  CloseHandle(pi.hThread);
1006  }
1007  else
1008  {
1009  DPRINT1("Failed to launch command prompt: %lu\n", GetLastError());
1010  }
1011  }
1012  }
1013 
1014  UnregisterHotKey(NULL, hotkey);
1015  GlobalDeleteAtom(hotkey);
1016 
1017  DPRINT("HotkeyThread terminate\n");
1018  return 0;
1019 }
ATOM WINAPI GlobalDeleteAtom(ATOM nAtom)
Definition: atom.c:454
#define CloseHandle
Definition: compat.h:598
WORD ATOM
Definition: dimm.idl:113
#define WM_HOTKEY
Definition: winuser.h:1861
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
BOOL WINAPI UnregisterHotKey(_In_opt_ HWND, _In_ int)
#define VK_F10
Definition: winuser.h:2239
#define FALSE
Definition: types.h:117
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:4594
#define CREATE_NEW_CONSOLE
Definition: winbase.h:180
static refpint_t pi[]
Definition: server.c:96
static const WCHAR L[]
Definition: oid.c:1250
#define MOD_SHIFT
Definition: imm.h:316
#define NULL
Definition: types.h:112
#define GetMessage
Definition: winuser.h:5765
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)
#define DPRINT
Definition: sndvol32.h:71

Referenced by InstallReactOS().

◆ InitializeDefaultUserLocale()

static VOID InitializeDefaultUserLocale ( VOID  )
static

Definition at line 1139 of file install.c.

1140 {
1141  WCHAR szBuffer[80];
1142  PWSTR ptr;
1143  HKEY hLocaleKey;
1144  DWORD ret;
1145  DWORD dwSize;
1146  LCID lcid;
1147  INT i;
1148 
1149  struct {LCTYPE LCType; PWSTR pValue;} LocaleData[] = {
1150  /* Number */
1151  {LOCALE_SDECIMAL, L"sDecimal"},
1152  {LOCALE_STHOUSAND, L"sThousand"},
1153  {LOCALE_SNEGATIVESIGN, L"sNegativeSign"},
1154  {LOCALE_SPOSITIVESIGN, L"sPositiveSign"},
1155  {LOCALE_SGROUPING, L"sGrouping"},
1156  {LOCALE_SLIST, L"sList"},
1157  {LOCALE_SNATIVEDIGITS, L"sNativeDigits"},
1158  {LOCALE_INEGNUMBER, L"iNegNumber"},
1159  {LOCALE_IDIGITS, L"iDigits"},
1160  {LOCALE_ILZERO, L"iLZero"},
1161  {LOCALE_IMEASURE, L"iMeasure"},
1162  {LOCALE_IDIGITSUBSTITUTION, L"NumShape"},
1163 
1164  /* Currency */
1165  {LOCALE_SCURRENCY, L"sCurrency"},
1166  {LOCALE_SMONDECIMALSEP, L"sMonDecimalSep"},
1167  {LOCALE_SMONTHOUSANDSEP, L"sMonThousandSep"},
1168  {LOCALE_SMONGROUPING, L"sMonGrouping"},
1169  {LOCALE_ICURRENCY, L"iCurrency"},
1170  {LOCALE_INEGCURR, L"iNegCurr"},
1171  {LOCALE_ICURRDIGITS, L"iCurrDigits"},
1172 
1173  /* Time */
1174  {LOCALE_STIMEFORMAT, L"sTimeFormat"},
1175  {LOCALE_STIME, L"sTime"},
1176  {LOCALE_S1159, L"s1159"},
1177  {LOCALE_S2359, L"s2359"},
1178  {LOCALE_ITIME, L"iTime"},
1179  {LOCALE_ITIMEMARKPOSN, L"iTimePrefix"},
1180  {LOCALE_ITLZERO, L"iTLZero"},
1181 
1182  /* Date */
1183  {LOCALE_SLONGDATE, L"sLongDate"},
1184  {LOCALE_SSHORTDATE, L"sShortDate"},
1185  {LOCALE_SDATE, L"sDate"},
1186  {LOCALE_IFIRSTDAYOFWEEK, L"iFirstDayOfWeek"},
1187  {LOCALE_IFIRSTWEEKOFYEAR, L"iFirstWeekOfYear"},
1188  {LOCALE_IDATE, L"iDate"},
1189  {LOCALE_ICALENDARTYPE, L"iCalendarType"},
1190 
1191  /* Misc */
1192  {LOCALE_SCOUNTRY, L"sCountry"},
1193  {LOCALE_SABBREVLANGNAME, L"sLanguage"},
1194  {LOCALE_ICOUNTRY, L"iCountry"},
1195  {0, NULL}};
1196 
1198  L".DEFAULT\\Control Panel\\International",
1199  0,
1200  KEY_READ | KEY_WRITE,
1201  &hLocaleKey);
1202  if (ret != ERROR_SUCCESS)
1203  {
1204  return;
1205  }
1206 
1207  dwSize = 9 * sizeof(WCHAR);
1208  ret = RegQueryValueExW(hLocaleKey,
1209  L"Locale",
1210  NULL,
1211  NULL,
1212  (PBYTE)szBuffer,
1213  &dwSize);
1214  if (ret != ERROR_SUCCESS)
1215  goto done;
1216 
1217  lcid = (LCID)wcstoul(szBuffer, &ptr, 16);
1218  if (lcid == 0)
1219  goto done;
1220 
1221  i = 0;
1222  while (LocaleData[i].pValue != NULL)
1223  {
1224  if (GetLocaleInfoW(lcid,
1225  LocaleData[i].LCType | LOCALE_NOUSEROVERRIDE,
1226  szBuffer,
1227  ARRAYSIZE(szBuffer)))
1228  {
1229  RegSetValueExW(hLocaleKey,
1230  LocaleData[i].pValue,
1231  0,
1232  REG_SZ,
1233  (PBYTE)szBuffer,
1234  (wcslen(szBuffer) + 1) * sizeof(WCHAR));
1235  }
1236 
1237  i++;
1238  }
1239 
1240 done:
1241  RegCloseKey(hLocaleKey);
1242 }
#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:56
#define LOCALE_IDATE
Definition: winnls.h:63
PWCHAR pValue
#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:58
#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:517
#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
#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:4895
#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:4116
#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
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_ITIME
Definition: winnls.h:65
#define NULL
Definition: types.h:112
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#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:3366
#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
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define REG_SZ
Definition: layer.c:22

Referenced by InstallReactOS().

◆ InitializeProgramFilesDir()

static BOOL InitializeProgramFilesDir ( VOID  )
static

Definition at line 1024 of file install.c.

1025 {
1026  LONG Error;
1027  HKEY hKey;
1028  DWORD dwLength;
1029  WCHAR szProgramFilesDirPath[MAX_PATH];
1030  WCHAR szCommonFilesDirPath[MAX_PATH];
1031  WCHAR szBuffer[MAX_PATH];
1032 
1033  /* Load 'Program Files' location */
1036  szBuffer,
1037  ARRAYSIZE(szBuffer)))
1038  {
1039  DPRINT1("Error: %lu\n", GetLastError());
1040  return FALSE;
1041  }
1042 
1045  szCommonFilesDirPath,
1046  ARRAYSIZE(szCommonFilesDirPath)))
1047  {
1048  DPRINT1("Warning: %lu\n", GetLastError());
1049  }
1050 
1051  /* Expand it */
1052  if (!ExpandEnvironmentStringsW(szBuffer,
1053  szProgramFilesDirPath,
1054  ARRAYSIZE(szProgramFilesDirPath)))
1055  {
1056  DPRINT1("Error: %lu\n", GetLastError());
1057  return FALSE;
1058  }
1059 
1060  wcscpy(szBuffer, szProgramFilesDirPath);
1061  wcscat(szBuffer, L"\\");
1062  wcscat(szBuffer, szCommonFilesDirPath);
1063 
1064  if (!ExpandEnvironmentStringsW(szBuffer,
1065  szCommonFilesDirPath,
1066  ARRAYSIZE(szCommonFilesDirPath)))
1067  {
1068  DPRINT1("Warning: %lu\n", GetLastError());
1069  }
1070 
1071  /* Store it */
1073  L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion",
1074  0,
1075  KEY_SET_VALUE,
1076  &hKey);
1077  if (Error != ERROR_SUCCESS)
1078  {
1079  DPRINT1("Error: %lu\n", Error);
1080  return FALSE;
1081  }
1082 
1083  dwLength = (wcslen(szProgramFilesDirPath) + 1) * sizeof(WCHAR);
1085  L"ProgramFilesDir",
1086  0,
1087  REG_SZ,
1088  (LPBYTE)szProgramFilesDirPath,
1089  dwLength);
1090  if (Error != ERROR_SUCCESS)
1091  {
1092  DPRINT1("Error: %lu\n", Error);
1093  RegCloseKey(hKey);
1094  return FALSE;
1095  }
1096 
1097  dwLength = (wcslen(szCommonFilesDirPath) + 1) * sizeof(WCHAR);
1099  L"CommonFilesDir",
1100  0,
1101  REG_SZ,
1102  (LPBYTE)szCommonFilesDirPath,
1103  dwLength);
1104  if (Error != ERROR_SUCCESS)
1105  {
1106  DPRINT1("Warning: %lu\n", Error);
1107  }
1108 
1109  RegCloseKey(hKey);
1110 
1111  /* Create directory */
1112  // FIXME: Security!
1113  if (!CreateDirectoryW(szProgramFilesDirPath, NULL))
1114  {
1116  {
1117  DPRINT1("Error: %lu\n", GetLastError());
1118  return FALSE;
1119  }
1120  }
1121 
1122  /* Create directory */
1123  // FIXME: Security!
1124  if (!CreateDirectoryW(szCommonFilesDirPath, NULL))
1125  {
1127  {
1128  DPRINT1("Warning: %lu\n", GetLastError());
1129  // return FALSE;
1130  }
1131  }
1132 
1133  return TRUE;
1134 }
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:90
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_SET_VALUE
Definition: nt_native.h:1017
#define TRUE
Definition: types.h:120
#define IDS_PROGRAMFILES
Definition: resource.h:146
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
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:53
#define FALSE
Definition: types.h:117
long LONG
Definition: pedump.c:60
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:4895
__wchar_t WCHAR
Definition: xmlstorage.h:180
static DWORD DWORD * dwLength
Definition: fusion.c:85
#define MAX_PATH
Definition: compat.h:34
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:147
FxAutoRegKey hKey
_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 NULL
Definition: types.h:112
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define DPRINT1
Definition: precomp.h:8
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define REG_SZ
Definition: layer.c:22

Referenced by InstallReactOS().

◆ InstallLiveCD()

static DWORD InstallLiveCD ( VOID  )
static

Definition at line 869 of file install.c.

870 {
871  STARTUPINFOW StartupInfo;
872  PROCESS_INFORMATION ProcessInformation;
873  BOOL bRes;
874 
875  if (!CommonInstall())
876  goto error;
877 
878  /* Install the TCP/IP protocol driver */
879  bRes = InstallNetworkComponent(L"MS_TCPIP");
880  if (!bRes && GetLastError() != ERROR_FILE_NOT_FOUND)
881  {
882  DPRINT("InstallNetworkComponent() failed with error 0x%lx\n", GetLastError());
883  }
884  else
885  {
886  /* Start the TCP/IP protocol driver */
887  SetupStartService(L"Tcpip", FALSE);
888  SetupStartService(L"Dhcp", FALSE);
889  SetupStartService(L"Dnscache", FALSE);
890  }
891 
892  /* Register components */
893  _SEH2_TRY
894  {
896  hSysSetupInf, L"RegistrationPhase2",
897  SPINST_ALL,
898  0, NULL, 0, NULL, NULL, NULL, NULL))
899  {
900  DPRINT1("SetupInstallFromInfSectionW failed!\n");
901  }
902 
903  RegisterTypeLibraries(hSysSetupInf, L"TypeLibraries");
904  }
906  {
907  DPRINT1("Catching exception\n");
908  }
909  _SEH2_END;
910 
912 
913  /* Run the shell */
914  ZeroMemory(&StartupInfo, sizeof(StartupInfo));
915  StartupInfo.cb = sizeof(StartupInfo);
916  bRes = CreateProcessW(L"userinit.exe",
917  NULL,
918  NULL,
919  NULL,
920  FALSE,
921  0,
922  NULL,
923  NULL,
924  &StartupInfo,
925  &ProcessInformation);
926  if (!bRes)
927  goto error;
928 
929  CloseHandle(ProcessInformation.hThread);
930  CloseHandle(ProcessInformation.hProcess);
931 
932  return 0;
933 
934 error:
935  MessageBoxW(
936  NULL,
937  L"Failed to load LiveCD! You can shutdown your computer, or press ENTER to reboot.",
938  L"ReactOS LiveCD",
939  MB_OK);
940  return 0;
941 }
#define CloseHandle
Definition: compat.h:598
#define error(str)
Definition: mkdosfs.c:1605
BOOL RegisterTypeLibraries(HINF hinf, LPCWSTR szSection)
Definition: install.c:433
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
#define ZeroMemory
Definition: winbase.h:1664
VOID WINAPI SetupCloseInfFile(IN HINF InfHandle)
Definition: infsupp.c:43
_SEH2_TRY
Definition: create.c:4226
static BOOL CommonInstall(VOID)
Definition: install.c:799
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#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:4594
DWORD WINAPI SetupStartService(LPCWSTR lpServiceName, BOOL bWait)
Definition: install.c:1573
DWORD cb
Definition: winbase.h:846
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
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
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:4400
#define NULL
Definition: types.h:112
#define MB_OK
Definition: winuser.h:784
#define DPRINT1
Definition: precomp.h:8
BOOL InstallNetworkComponent(_In_ PWSTR pszComponentId)
Definition: netinstall.c:467
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:40
#define DPRINT
Definition: sndvol32.h:71

Referenced by InstallWindowsNt().

◆ InstallReactOS()

static DWORD InstallReactOS ( VOID  )
static

Definition at line 1320 of file install.c.

1321 {
1322  WCHAR szBuffer[MAX_PATH];
1323  HANDLE token;
1324  TOKEN_PRIVILEGES privs;
1325  HKEY hKey;
1326  HINF hShortcutsInf;
1327  HANDLE hHotkeyThread;
1328  BOOL ret;
1329 
1331  LogItem(NULL, L"Installing ReactOS");
1332 
1333  CreateTempDir(L"TEMP");
1334  CreateTempDir(L"TMP");
1335 
1337  {
1338  FatalError("InitializeProgramFilesDir() failed");
1339  return 0;
1340  }
1341 
1342  if (!InitializeProfiles())
1343  {
1344  FatalError("InitializeProfiles() failed");
1345  return 0;
1346  }
1347 
1349 
1350  if (GetWindowsDirectoryW(szBuffer, ARRAYSIZE(szBuffer)))
1351  {
1353  L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion",
1354  0,
1355  KEY_WRITE,
1356  &hKey) == ERROR_SUCCESS)
1357  {
1359  L"PathName",
1360  0,
1361  REG_SZ,
1362  (LPBYTE)szBuffer,
1363  (wcslen(szBuffer) + 1) * sizeof(WCHAR));
1364 
1366  L"SystemRoot",
1367  0,
1368  REG_SZ,
1369  (LPBYTE)szBuffer,
1370  (wcslen(szBuffer) + 1) * sizeof(WCHAR));
1371 
1372  RegCloseKey(hKey);
1373  }
1374 
1375  PathAddBackslash(szBuffer);
1376  wcscat(szBuffer, L"system");
1377  CreateDirectory(szBuffer, NULL);
1378  }
1379 
1381  {
1382  FatalError("SaveDefaultUserHive() failed");
1383  return 0;
1384  }
1385 
1386  if (!CopySystemProfile(0))
1387  {
1388  FatalError("CopySystemProfile() failed");
1389  return 0;
1390  }
1391 
1392  hHotkeyThread = CreateThread(NULL, 0, HotkeyThread, NULL, 0, NULL);
1393 
1394  if (!CommonInstall())
1395  return 0;
1396 
1397  /* Install the TCP/IP protocol driver */
1398  ret = InstallNetworkComponent(L"MS_TCPIP");
1399  if (!ret && GetLastError() != ERROR_FILE_NOT_FOUND)
1400  {
1401  DPRINT("InstallNetworkComponent() failed with error 0x%lx\n", GetLastError());
1402  }
1403  else
1404  {
1405  /* Start the TCP/IP protocol driver */
1406  SetupStartService(L"Tcpip", FALSE);
1407  SetupStartService(L"Dhcp", FALSE);
1408  SetupStartService(L"Dnscache", FALSE);
1409  }
1410 
1411  InstallWizard();
1412 
1413  InstallSecurity();
1414 
1416 
1417  hShortcutsInf = SetupOpenInfFileW(L"shortcuts.inf",
1418  NULL,
1420  NULL);
1421  if (hShortcutsInf == INVALID_HANDLE_VALUE)
1422  {
1423  FatalError("Failed to open shortcuts.inf");
1424  return 0;
1425  }
1426 
1427  if (!CreateShortcuts(hShortcutsInf, L"ShortcutFolders"))
1428  {
1429  FatalError("CreateShortcuts() failed");
1430  return 0;
1431  }
1432 
1433  SetupCloseInfFile(hShortcutsInf);
1434 
1435  hShortcutsInf = SetupOpenInfFileW(L"rosapps_shortcuts.inf",
1436  NULL,
1438  NULL);
1439  if (hShortcutsInf != INVALID_HANDLE_VALUE)
1440  {
1441  if (!CreateShortcuts(hShortcutsInf, L"ShortcutFolders"))
1442  {
1443  FatalError("CreateShortcuts(rosapps) failed");
1444  return 0;
1445  }
1446  SetupCloseInfFile(hShortcutsInf);
1447  }
1448 
1450  SetSetupType(0);
1451 
1452  if (hHotkeyThread)
1453  {
1454  PostThreadMessage(GetThreadId(hHotkeyThread), WM_QUIT, 0, 0);
1455  CloseHandle(hHotkeyThread);
1456  }
1457 
1458  LogItem(NULL, L"Installing ReactOS done");
1460 
1461  if (AdminInfo.Name != NULL)
1462  RtlFreeHeap(RtlGetProcessHeap(), 0, AdminInfo.Name);
1463 
1464  if (AdminInfo.Domain != NULL)
1465  RtlFreeHeap(RtlGetProcessHeap(), 0, AdminInfo.Domain);
1466 
1467  if (AdminInfo.Password != NULL)
1468  RtlFreeHeap(RtlGetProcessHeap(), 0, AdminInfo.Password);
1469 
1470  /* Get shutdown privilege */
1472  {
1473  FatalError("OpenProcessToken() failed!");
1474  return 0;
1475  }
1478  &privs.Privileges[0].Luid))
1479  {
1480  FatalError("LookupPrivilegeValue() failed!");
1481  return 0;
1482  }
1483  privs.PrivilegeCount = 1;
1486  FALSE,
1487  &privs,
1488  0,
1490  NULL) == 0)
1491  {
1492  FatalError("AdjustTokenPrivileges() failed!");
1493  return 0;
1494  }
1495 
1497  return 0;
1498 }
static BOOL SetSetupType(DWORD dwSetupType)
Definition: install.c:945
#define CloseHandle
Definition: compat.h:598
#define INF_STYLE_WIN4
Definition: infsupp.h:41
static VOID CreateTempDir(IN LPCWSTR VarName)
Definition: install.c:265
#define ERROR_SUCCESS
Definition: deptool.c:10
static BOOL InitializeProgramFilesDir(VOID)
Definition: install.c:1024
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
#define WM_QUIT
Definition: winuser.h:1605
$ULONG PrivilegeCount
Definition: setypes.h:973
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
static DWORD SaveDefaultUserHive(VOID)
Definition: install.c:1247
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
DWORD WINAPI GetThreadId(IN HANDLE Thread)
Definition: thread.c:912
static VOID InitializeDefaultUserLocale(VOID)
Definition: install.c:1139
#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:3726
static DWORD CALLBACK HotkeyThread(LPVOID Parameter)
Definition: install.c:974
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:799
#define SE_PRIVILEGE_ENABLED
Definition: setypes.h:63
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:53
#define FALSE
Definition: types.h:117
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:2728
#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:136
BOOL WINAPI InitializeProfiles(VOID)
Definition: setup.c:335
VOID SetAutoAdminLogon(VOID)
Definition: security.c:1726
#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:4895
DWORD WINAPI SetupStartService(LPCWSTR lpServiceName, BOOL bWait)
Definition: install.c:1573
BOOL WINAPI CopySystemProfile(_In_ ULONG Unused)
Definition: profile.c:565
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define PostThreadMessage
Definition: winuser.h:5808
#define MAX_PATH
Definition: compat.h:34
VOID WINAPI TerminateSetupActionLog(VOID)
Definition: logfile.c:82
static BOOL CreateShortcuts(HINF hinf, LPCWSTR szSection)
Definition: install.c:225
int ret
static const WCHAR L[]
Definition: oid.c:1250
#define GetCurrentProcess()
Definition: compat.h:618
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
FxAutoRegKey hKey
_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 NULL
Definition: types.h:112
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:296
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY]
Definition: setypes.h:974
LPWSTR Domain
Definition: globals.h:24
VOID InstallSecurity(VOID)
Definition: security.c:1547
#define SE_SHUTDOWN_NAME
Definition: winnt_old.h:384
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
BOOL InstallNetworkComponent(_In_ PWSTR pszComponentId)
Definition: netinstall.c:467
BOOL WINAPI InitializeSetupActionLog(BOOL bDeleteOldLogFile)
Definition: logfile.c:42
#define DPRINT
Definition: sndvol32.h:71
static VOID FatalError(char *pszFmt,...)
Definition: install.c:53
#define TOKEN_ADJUST_PRIVILEGES
Definition: setypes.h:880
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define LogItem(lpTag, lpMessageText...)
Definition: syssetup.h:98
#define REG_SZ
Definition: layer.c:22

Referenced by InstallWindowsNt(), and RunInstallReactOS().

◆ InstallSysSetupInfComponents()

static BOOL InstallSysSetupInfComponents ( VOID  )
static

Definition at line 354 of file install.c.

355 {
356  INFCONTEXT InfContext;
357  WCHAR szNameBuffer[256];
358  WCHAR szSectionBuffer[256];
359  HINF hComponentInf = INVALID_HANDLE_VALUE;
360 
362  L"Infs.Always",
363  NULL,
364  &InfContext))
365  {
366  DPRINT("No Inf.Always section found\n");
367  }
368  else
369  {
370  do
371  {
372  if (!SetupGetStringFieldW(&InfContext,
373  1, // Get the component name
374  szNameBuffer,
375  ARRAYSIZE(szNameBuffer),
376  NULL))
377  {
378  FatalError("Error while trying to get component name \n");
379  return FALSE;
380  }
381 
382  if (!SetupGetStringFieldW(&InfContext,
383  2, // Get the component install section
384  szSectionBuffer,
385  ARRAYSIZE(szSectionBuffer),
386  NULL))
387  {
388  FatalError("Error while trying to get component install section \n");
389  return FALSE;
390  }
391 
392  DPRINT("Trying to execute install section '%S' from '%S' \n", szSectionBuffer, szNameBuffer);
393 
394  hComponentInf = SetupOpenInfFileW(szNameBuffer,
395  NULL,
397  NULL);
398 
399  if (hComponentInf == INVALID_HANDLE_VALUE)
400  {
401  FatalError("SetupOpenInfFileW() failed to open '%S' (Error: %lu)\n", szNameBuffer, GetLastError());
402  return FALSE;
403  }
404 
406  hComponentInf,
407  szSectionBuffer,
408  SPINST_ALL,
409  NULL,
410  NULL,
413  NULL,
414  NULL,
415  NULL))
416  {
417  FatalError("Error while trying to install : %S (Error: %lu)\n", szNameBuffer, GetLastError());
418  SetupCloseInfFile(hComponentInf);
419  return FALSE;
420  }
421 
422  SetupCloseInfFile(hComponentInf);
423  }
424  while (SetupFindNextLine(&InfContext, &InfContext));
425  }
426 
427  return TRUE;
428 }
BOOL WINAPI SetupFindFirstLineW(IN HINF InfHandle, IN PCWSTR Section, IN PCWSTR Key, IN OUT PINFCONTEXT Context)
Definition: infsupp.c:54
#define INF_STYLE_WIN4
Definition: infsupp.h:41
#define TRUE
Definition: types.h:120
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
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 FALSE
Definition: types.h:117
#define SP_COPY_NEWER
Definition: setupapi.h:473
__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:1327
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
#define NULL
Definition: types.h:112
BOOL WINAPI SetupFindNextLine(IN PINFCONTEXT ContextIn, OUT PINFCONTEXT ContextOut)
Definition: infsupp.c:80
#define DPRINT
Definition: sndvol32.h:71
static VOID FatalError(char *pszFmt,...)
Definition: install.c:53
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 318 of file install.c.

319 {
320  INFCONTEXT InfContext;
321  WCHAR szLineBuffer[256];
322  DWORD dwLineLength;
323 
325  L"DeviceInfsToInstall",
326  NULL,
327  &InfContext))
328  {
329  return FALSE;
330  }
331 
332  do
333  {
334  if (!SetupGetStringFieldW(&InfContext,
335  0,
336  szLineBuffer,
337  ARRAYSIZE(szLineBuffer),
338  &dwLineLength))
339  {
340  return FALSE;
341  }
342 
343  if (!SetupDiInstallClassW(NULL, szLineBuffer, DI_QUIETINSTALL, NULL))
344  {
345  return FALSE;
346  }
347  }
348  while (SetupFindNextLine(&InfContext, &InfContext));
349 
350  return TRUE;
351 }
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:3601
#define FALSE
Definition: types.h:117
__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
#define NULL
Definition: types.h:112
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 1507 of file install.c.

1508 {
1509  INT i;
1510  PWSTR p;
1511 
1512  for (i = 0; i < argc; ++i)
1513  {
1514  p = argv[i];
1515  if (*p == L'-')
1516  {
1517  p++;
1518 
1519  // NOTE: On Windows, "mini" means "minimal UI", and can be used
1520  // in addition to "newsetup"; these options are not exclusive.
1521  if (_wcsicmp(p, L"newsetup") == 0)
1522  return (INT)InstallReactOS();
1523  else if (_wcsicmp(p, L"mini") == 0)
1524  return (INT)InstallLiveCD();
1525 
1526  /* Add support for other switches */
1527  }
1528  }
1529 
1530  return 0;
1531 }
static int argc
Definition: ServiceArgs.c:12
static DWORD InstallReactOS(VOID)
Definition: install.c:1320
uint16_t * PWSTR
Definition: typedefs.h:56
#define argv
Definition: mplay32.c:18
int32_t INT
Definition: typedefs.h:58
static const WCHAR L[]
Definition: oid.c:1250
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
GLfloat GLfloat p
Definition: glext.h:8902
static DWORD InstallLiveCD(VOID)
Definition: install.c:869
_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 754 of file install.c.

755 {
756  HKEY hControlKey = NULL;
757  LPWSTR pwszSystemStartOptions = NULL;
758  LPWSTR pwszCurrentOption, pwszNextOption; /* Pointers into SystemStartOptions */
759  BOOL bConsoleBoot = FALSE;
760  LONG rc;
761 
763  L"SYSTEM\\CurrentControlSet\\Control",
764  0,
766  &hControlKey);
767  if (rc != ERROR_SUCCESS)
768  goto cleanup;
769 
770  rc = ReadRegSzKey(hControlKey, L"SystemStartOptions", &pwszSystemStartOptions);
771  if (rc != ERROR_SUCCESS)
772  goto cleanup;
773 
774  /* Check for CONSOLE switch in SystemStartOptions */
775  pwszCurrentOption = pwszSystemStartOptions;
776  while (pwszCurrentOption)
777  {
778  pwszNextOption = wcschr(pwszCurrentOption, L' ');
779  if (pwszNextOption)
780  *pwszNextOption = L'\0';
781  if (wcsicmp(pwszCurrentOption, L"CONSOLE") == 0)
782  {
783  DPRINT("Found %S. Switching to console boot\n", pwszCurrentOption);
784  bConsoleBoot = TRUE;
785  goto cleanup;
786  }
787  pwszCurrentOption = pwszNextOption ? pwszNextOption + 1 : NULL;
788  }
789 
790 cleanup:
791  if (hControlKey != NULL)
792  RegCloseKey(hControlKey);
793  if (pwszSystemStartOptions)
794  HeapFree(GetProcessHeap(), 0, pwszSystemStartOptions);
795  return bConsoleBoot;
796 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define TRUE
Definition: types.h:120
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
#define GetProcessHeap()
Definition: compat.h:595
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
#define wcsicmp
Definition: compat.h:15
static const WCHAR L[]
Definition: oid.c:1250
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define NULL
Definition: types.h:112
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
char * cleanup(char *str)
Definition: wpickclick.c:99
static LONG ReadRegSzKey(IN HKEY hKey, IN LPCWSTR pszKey, OUT LPWSTR *pValue)
Definition: install.c:718
#define DPRINT
Definition: sndvol32.h:71
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:594
#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 718 of file install.c.

722 {
723  LONG rc;
724  DWORD dwType;
725  DWORD cbData = 0;
726  LPWSTR pwszValue;
727 
728  if (!pValue)
730 
731  *pValue = NULL;
732  rc = RegQueryValueExW(hKey, pszKey, NULL, &dwType, NULL, &cbData);
733  if (rc != ERROR_SUCCESS)
734  return rc;
735  if (dwType != REG_SZ)
736  return ERROR_FILE_NOT_FOUND;
737  pwszValue = HeapAlloc(GetProcessHeap(), 0, cbData + sizeof(WCHAR));
738  if (!pwszValue)
740  rc = RegQueryValueExW(hKey, pszKey, NULL, NULL, (LPBYTE)pwszValue, &cbData);
741  if (rc != ERROR_SUCCESS)
742  {
743  HeapFree(GetProcessHeap(), 0, pwszValue);
744  return rc;
745  }
746  /* NULL-terminate the string */
747  pwszValue[cbData / sizeof(WCHAR)] = '\0';
748 
749  *pValue = pwszValue;
750  return ERROR_SUCCESS;
751 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define ERROR_SUCCESS
Definition: deptool.c:10
PWCHAR pValue
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
unsigned char * LPBYTE
Definition: typedefs.h:53
long LONG
Definition: pedump.c:60
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define GetProcessHeap()
Definition: compat.h:595
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:4116
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
#define NULL
Definition: types.h:112
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:594
#define REG_SZ
Definition: layer.c:22

Referenced by IsConsoleBoot().

◆ RegisterTypeLibraries()

BOOL RegisterTypeLibraries ( HINF  hinf,
LPCWSTR  szSection 
)

Definition at line 433 of file install.c.

434 {
435  INFCONTEXT InfContext;
436  BOOL res;
439  INT csidl;
440  LPWSTR p;
441  HMODULE hmod;
442  HRESULT hret;
443 
444  /* Begin iterating the entries in the inf section */
445  res = SetupFindFirstLine(hinf, szSection, NULL, &InfContext);
446  if (!res) return FALSE;
447 
448  do
449  {
450  /* Get the name of the current type library */
451  if (!SetupGetStringFieldW(&InfContext, 1, szName, ARRAYSIZE(szName), NULL))
452  {
453  FatalError("SetupGetStringFieldW failed\n");
454  continue;
455  }
456 
457  if (!SetupGetIntField(&InfContext, 2, &csidl))
458  csidl = CSIDL_SYSTEM;
459 
460  hret = SHGetFolderPathW(NULL, csidl, NULL, 0, szPath);
461  if (FAILED(hret))
462  {
463  FatalError("SHGetFolderPathW failed hret=0x%lx\n", hret);
464  continue;
465  }
466 
468  wcscpy(p, szName);
469 
471  if (hmod == NULL)
472  {
473  FatalError("LoadLibraryW failed\n");
474  continue;
475  }
476 
478 
479  } while (SetupFindNextLine(&InfContext, &InfContext));
480 
481  return TRUE;
482 }
HRESULT __wine_register_resources(HMODULE module) DECLSPEC_HIDDEN
Definition: register.c:98
#define SetupFindFirstLine
Definition: setupapi.h:2619
#define TRUE
Definition: types.h:120
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
int32_t INT
Definition: typedefs.h:58
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define PathAddBackslash
Definition: shlwapi.h:783
#define LoadLibraryW(x)
Definition: compat.h:606
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
#define MAX_PATH
Definition: compat.h:34
_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:37
#define NULL
Definition: types.h:112
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:2447
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:2048
GLfloat GLfloat p
Definition: glext.h:8902
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static VOID FatalError(char *pszFmt,...)
Definition: install.c:53
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 1247 of file install.c.

1248 {
1249  WCHAR szDefaultUserHive[MAX_PATH];
1250  HKEY hUserKey = NULL;
1251  DWORD cchSize;
1252  DWORD dwError;
1253 
1254  DPRINT("SaveDefaultUserHive()\n");
1255 
1256  cchSize = ARRAYSIZE(szDefaultUserHive);
1257  GetDefaultUserProfileDirectoryW(szDefaultUserHive, &cchSize);
1258 
1259  wcscat(szDefaultUserHive, L"\\ntuser.dat");
1260 
1261  dwError = RegOpenKeyExW(HKEY_USERS,
1262  L".DEFAULT",
1263  0,
1264  KEY_READ,
1265  &hUserKey);
1266  if (dwError != ERROR_SUCCESS)
1267  {
1268  DPRINT1("RegOpenKeyExW() failed (Error %lu)\n", dwError);
1269  return dwError;
1270  }
1271 
1272  pSetupEnablePrivilege(L"SeBackupPrivilege", TRUE);
1273 
1274  /* Save the Default hive */
1275  dwError = RegSaveKeyExW(hUserKey,
1276  szDefaultUserHive,
1277  NULL,
1279  if (dwError == ERROR_ALREADY_EXISTS)
1280  {
1281  WCHAR szBackupHive[MAX_PATH];
1282 
1283  /* Build the backup hive file name by replacing the extension */
1284  wcscpy(szBackupHive, szDefaultUserHive);
1285  wcscpy(&szBackupHive[wcslen(szBackupHive) - 4], L".bak");
1286 
1287  /* Back up the existing default user hive by renaming it, replacing any possible existing old backup */
1288  if (!MoveFileExW(szDefaultUserHive,
1289  szBackupHive,
1291  {
1292  dwError = GetLastError();
1293  DPRINT1("Failed to create a default-user hive backup '%S', MoveFileExW failed (Error %lu)\n",
1294  szBackupHive, dwError);
1295  }
1296  else
1297  {
1298  /* The backup has been done, retry saving the Default hive */
1299  dwError = RegSaveKeyExW(hUserKey,
1300  szDefaultUserHive,
1301  NULL,
1303  }
1304  }
1305  if (dwError != ERROR_SUCCESS)
1306  {
1307  DPRINT1("RegSaveKeyExW() failed (Error %lu)\n", dwError);
1308  }
1309 
1310  pSetupEnablePrivilege(L"SeBackupPrivilege", FALSE);
1311 
1312  RegCloseKey(hUserKey);
1313 
1314  return dwError;
1315 }
#define HKEY_USERS
Definition: winreg.h:13
LONG WINAPI RegSaveKeyExW(HKEY hKey, LPCWSTR lpFile, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD Flags)
Definition: reg.c:4743
BOOL WINAPI GetDefaultUserProfileDirectoryW(_Out_opt_ LPWSTR lpProfileDir, _Inout_ LPDWORD lpcchSize)
Definition: profile.c:1443
#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 TRUE
Definition: types.h:120
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define FALSE
Definition: types.h:117
BOOL WINAPI pSetupEnablePrivilege(LPCWSTR lpPrivilegeName, BOOL bEnable)
Definition: misc.c:440
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
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 NULL
Definition: types.h:112
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define DPRINT1
Definition: precomp.h:8
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
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
#define DPRINT
Definition: sndvol32.h:71

Referenced by InstallReactOS().

◆ SetSetupType()

static BOOL SetSetupType ( DWORD  dwSetupType)
static

Definition at line 945 of file install.c.

946 {
947  DWORD dwError;
948  HKEY hKey;
949 
950  dwError = RegOpenKeyExW(
952  L"SYSTEM\\Setup",
953  0,
955  &hKey);
956  if (dwError != ERROR_SUCCESS)
957  return FALSE;
958 
959  dwError = RegSetValueExW(
960  hKey,
961  L"SetupType",
962  0,
963  REG_DWORD,
964  (LPBYTE)&dwSetupType,
965  sizeof(DWORD));
966  RegCloseKey(hKey);
967  if (dwError != ERROR_SUCCESS)
968  return FALSE;
969 
970  return TRUE;
971 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_SET_VALUE
Definition: nt_native.h:1017
#define TRUE
Definition: types.h:120
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:53
#define FALSE
Definition: types.h:117
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:4895
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
FxAutoRegKey hKey
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
#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 1538 of file install.c.

1541 {
1543  return FALSE;
1544 }
#define FALSE
Definition: types.h:117
#define SetLastError(x)
Definition: compat.h:611
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102

◆ SetupChangeLocale()

DWORD WINAPI SetupChangeLocale ( HWND  hWnd,
LCID  Lcid 
)

Definition at line 1565 of file install.c.

1566 {
1567  return SetupChangeLocaleEx(hWnd, Lcid, NULL, 0, 0, 0);
1568 }
_In_ CONST DEVPROPKEY _In_ LCID Lcid
Definition: iofuncs.h:2414
HWND hWnd
Definition: settings.c:17
DWORD WINAPI SetupChangeLocaleEx(HWND hWnd, LCID Lcid, LPCWSTR lpSrcRootPath, char Unknown, DWORD dwUnused1, DWORD dwUnused2)
Definition: install.c:1550
#define NULL
Definition: types.h:112

◆ SetupChangeLocaleEx()

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

Definition at line 1550 of file install.c.

1556 {
1558  return FALSE;
1559 }
#define FALSE
Definition: types.h:117
#define SetLastError(x)
Definition: compat.h:611
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102

Referenced by SetupChangeLocale().

◆ SetupStartService()

DWORD WINAPI SetupStartService ( LPCWSTR  lpServiceName,
BOOL  bWait 
)

Definition at line 1573 of file install.c.

1576 {
1577  SC_HANDLE hManager = NULL;
1578  SC_HANDLE hService = NULL;
1579  DWORD dwError = ERROR_SUCCESS;
1580 
1581  hManager = OpenSCManagerW(NULL,
1582  NULL,
1584  if (hManager == NULL)
1585  {
1586  dwError = GetLastError();
1587  goto done;
1588  }
1589 
1590  hService = OpenServiceW(hManager,
1591  lpServiceName,
1592  SERVICE_START);
1593  if (hService == NULL)
1594  {
1595  dwError = GetLastError();
1596  goto done;
1597  }
1598 
1599  if (!StartService(hService, 0, NULL))
1600  {
1601  dwError = GetLastError();
1602  goto done;
1603  }
1604 
1605 done:
1606  if (hService != NULL)
1607  CloseServiceHandle(hService);
1608 
1609  if (hManager != NULL)
1610  CloseServiceHandle(hManager);
1611 
1612  return dwError;
1613 }
#define StartService
Definition: winsvc.h:585
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
SC_HANDLE WINAPI OpenServiceW(SC_HANDLE hSCManager, LPCWSTR lpServiceName, DWORD dwDesiredAccess)
Definition: scm.c:2108
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
Definition: scm.c:580
unsigned long DWORD
Definition: ntddk_ex.h:95
SC_HANDLE WINAPI OpenSCManagerW(LPCWSTR lpMachineName, LPCWSTR lpDatabaseName, DWORD dwDesiredAccess)
Definition: scm.c:2016
#define SERVICE_START
Definition: winsvc.h:57
#define NULL
Definition: types.h:112
#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 688 of file install.c.

690 {
691  HWND hWnd;
692  MSG Msg;
694 
699  (LPARAM)NULL);
700  if (!hWnd)
701  return 0;
702 
704 
705  /* Message loop for the Status window */
706  while (GetMessage(&Msg, NULL, 0, 0))
707  {
710  }
711 
712  EndDialog(hWnd, 0);
713 
714  return 0;
715 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define DispatchMessage
Definition: winuser.h:5740
BOOL WINAPI TranslateMessage(_In_ const MSG *)
static INT_PTR CALLBACK StatusMessageWindowProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: install.c:569
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
HWND hWnd
Definition: settings.c:17
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:656
LONG_PTR LPARAM
Definition: windef.h:208
#define SW_SHOW
Definition: winuser.h:769
static HINSTANCE hDllInstance
Definition: clb.c:30
LPVOID lpParameter
Definition: kernel32.h:241
struct @1617 Msg[]
#define IDD_STATUSWINDOW_DLG
Definition: resource.h:81
#define NULL
Definition: types.h:112
#define GetMessage
Definition: winuser.h:5765
#define CreateDialogParam
Definition: winuser.h:5727

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

574 {
575  PDLG_DATA pDlgData;
577 
578  pDlgData = (PDLG_DATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
579 
580  /* pDlgData is required for each case except WM_INITDIALOG */
581  if (uMsg != WM_INITDIALOG && pDlgData == NULL) return FALSE;
582 
583  switch (uMsg)
584  {
585  case WM_INITDIALOG:
586  {
587  BITMAP bm;
588  WCHAR szMsg[256];
589 
590  /* Allocate pDlgData */
591  pDlgData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pDlgData));
592  if (pDlgData)
593  {
594  /* Set pDlgData to GWLP_USERDATA, so we can get it for new messages */
595  SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)pDlgData);
596 
597  /* Load bitmaps */
598  pDlgData->hLogoBitmap = LoadImageW(hDllInstance,
600  0, 0, LR_DEFAULTCOLOR);
601 
604  GetObject(pDlgData->hBarBitmap, sizeof(bm), &bm);
605  pDlgData->BarWidth = bm.bmWidth;
606  pDlgData->BarHeight = bm.bmHeight;
607 
608  if (pDlgData->hLogoBitmap && pDlgData->hBarBitmap)
609  {
610  if (SetTimer(hwndDlg, IDT_BAR, 20, NULL) == 0)
611  {
612  DPRINT1("SetTimer(IDT_BAR) failed: %lu\n", GetLastError());
613  }
614 
615  /* Get the animation bar control */
616  pDlgData->hWndBarCtrl = GetDlgItem(hwndDlg, IDC_BAR);
617  }
618  }
619 
620  /* Get and set status text */
622  return FALSE;
623  SetDlgItemTextW(hwndDlg, IDC_STATUSLABEL, szMsg);
624 
625  return TRUE;
626  }
627 
628  case WM_TIMER:
629  {
630  if (pDlgData->hBarBitmap)
631  {
632  /*
633  * Default rotation bar image width is 413 (same as logo)
634  * We can divide 413 by 7 without remainder
635  */
636  pDlgData->BarCounter = (pDlgData->BarCounter + 7) % pDlgData->BarWidth;
637  InvalidateRect(pDlgData->hWndBarCtrl, NULL, FALSE);
638  UpdateWindow(pDlgData->hWndBarCtrl);
639  }
640  return TRUE;
641  }
642 
643  case WM_DRAWITEM:
644  {
646 
647  if (lpDis->CtlID != IDC_BAR)
648  {
649  return FALSE;
650  }
651 
652  if (pDlgData->hBarBitmap)
653  {
654  HDC hdcMem;
655  HGDIOBJ hOld;
656  DWORD off = pDlgData->BarCounter;
657  DWORD iw = pDlgData->BarWidth;
658  DWORD ih = pDlgData->BarHeight;
659 
660  hdcMem = CreateCompatibleDC(lpDis->hDC);
661  hOld = SelectObject(hdcMem, pDlgData->hBarBitmap);
662  BitBlt(lpDis->hDC, off, 0, iw - off, ih, hdcMem, 0, 0, SRCCOPY);
663  BitBlt(lpDis->hDC, 0, 0, off, ih, hdcMem, iw - off, 0, SRCCOPY);
664  SelectObject(hdcMem, hOld);
665  DeleteDC(hdcMem);
666  return TRUE;
667  }
668  return FALSE;
669  }
670 
671  case WM_DESTROY:
672  {
673  if (pDlgData->hBarBitmap)
674  {
675  KillTimer(hwndDlg, IDT_BAR);
676  }
677 
678  DeleteObject(pDlgData->hLogoBitmap);
679  DeleteObject(pDlgData->hBarBitmap);
680  HeapFree(GetProcessHeap(), 0, pDlgData);
681  return TRUE;
682  }
683  }
684  return FALSE;
685 }
#define IDB_REACTOS
Definition: shresdef.h:30
HBITMAP hBarBitmap
Definition: gui.c:38
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
DWORD BarWidth
Definition: gui.c:43
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
static HDC
Definition: imagelist.c:92
BOOL WINAPI UpdateWindow(_In_ HWND)
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1499
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define GetWindowLongPtrW
Definition: winuser.h:4804
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
HWND hWndBarCtrl
Definition: gui.c:39
WPARAM wParam
Definition: combotst.c:138
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define FALSE
Definition: types.h:117
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
#define GWLP_USERDATA
Definition: treelist.c:63
#define IDT_BAR
Definition: gui.c:32
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define IDS_STATUS_INSTALL_DEV
Definition: resource.h:143
#define WM_DESTROY
Definition: winuser.h:1591
DWORD BarCounter
Definition: gui.c:40
static HINSTANCE hDllInstance
Definition: clb.c:30
#define IDC_BAR
Definition: resource.h:70
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WM_TIMER
Definition: winuser.h:1724
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD BarHeight
Definition: gui.c:44
#define GetObject
Definition: wingdi.h:4467
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
Definition: gui.c:34
BOOL WINAPI DeleteDC(_In_ HDC)
Definition: bl.h:1331
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define NULL
Definition: types.h:112
#define IDC_STATUSLABEL
Definition: resource.h:82
#define IMAGE_BITMAP
Definition: winuser.h:211
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define DPRINT1
Definition: precomp.h:8
#define WM_DRAWITEM
Definition: winuser.h:1627
struct _DLG_DATA * PDLG_DATA
#define SetWindowLongPtrW
Definition: winuser.h:5321
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define LR_DEFAULTCOLOR
Definition: winuser.h:1077
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define HeapFree(x, y, z)
Definition: compat.h:594
#define SRCCOPY
Definition: wingdi.h:332
HBITMAP hLogoBitmap
Definition: gui.c:37
HDC hdcMem
Definition: welcome.c:104
#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

Referenced by ShowStatusMessageThread().

Variable Documentation

◆ AdminInfo

ADMIN_INFO AdminInfo

Definition at line 38 of file install.c.

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

◆ hSysSetupInf