ReactOS  0.4.15-dev-5126-g3bb451b
install.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS system libraries
4  * PURPOSE: System setup
5  * FILE: dll/win32/syssetup/install.c
6  * PROGRAMER: Eric Kohl
7  */
8 
9 /* INCLUDES *****************************************************************/
10 
11 #include "precomp.h"
12 
13 #define COBJMACROS
14 
15 #include <io.h>
16 #include <wincon.h>
17 #include <winnls.h>
18 #include <winsvc.h>
19 #include <userenv.h>
20 #include <shlobj.h>
21 #include <shlwapi.h>
22 #include <shobjidl.h>
23 #include <rpcproxy.h>
24 #include <ndk/cmfuncs.h>
25 
26 #define NDEBUG
27 #include <debug.h>
28 
29 //DWORD WINAPI
30 //CMP_WaitNoPendingInstallEvents(DWORD dwTimeout);
31 
33 SetupStartService(LPCWSTR lpServiceName, BOOL bWait);
34 
35 /* GLOBALS ******************************************************************/
36 
39 
40 typedef struct _DLG_DATA
41 {
49 
50 /* FUNCTIONS ****************************************************************/
51 
52 static VOID
53 FatalError(char *pszFmt,...)
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 }
70 
71 static HRESULT
73  LPCWSTR pszLinkPath,
74  LPCWSTR pszCmd,
75  LPCWSTR pszArg,
77  LPCWSTR pszIconPath,
78  INT iIconNr,
79  LPCWSTR pszComment)
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 }
115 
116 
117 static BOOL
119  LPCWSTR pszFolder,
120  LPCWSTR pszName,
121  LPCWSTR pszCommand,
122  LPCWSTR pszDescription,
123  INT iIconNr,
124  LPCWSTR pszWorkingDir)
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 }
180 
181 
182 static BOOL CreateShortcutsFromSection(HINF hinf, LPWSTR pszSection, LPCWSTR pszFolder)
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 }
224 
225 static BOOL CreateShortcuts(HINF hinf, LPCWSTR szSection)
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 }
263 
264 static VOID
266  IN LPCWSTR VarName)
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 }
316 
317 static BOOL
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 }
352 
353 static BOOL
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 }
429 
430 
431 
432 BOOL
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 }
483 
484 static BOOL
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 }
567 
568 static VOID
570 {
571  INT xOld, yOld, cxOld, cyOld;
572  INT xNew, yNew, cxNew, cyNew;
573  INT cxLabel, cyLabel, dyLabel;
574  RECT rc, rcBar, rcLabel, rcWnd;
575  BITMAP bmLogo, bmBar;
576  DWORD style, exstyle;
577  HWND hwndLogo = GetDlgItem(hwndDlg, IDC_ROSLOGO);
578  HWND hwndBar = GetDlgItem(hwndDlg, IDC_BAR);
579  HWND hwndLabel = GetDlgItem(hwndDlg, IDC_STATUSLABEL);
580 
581  /* This adjustment is for CJK only */
583  {
584  case LANG_CHINESE:
585  case LANG_JAPANESE:
586  case LANG_KOREAN:
587  break;
588 
589  default:
590  return;
591  }
592 
593  if (!GetObjectW(pDlgData->hLogoBitmap, sizeof(BITMAP), &bmLogo) ||
594  !GetObjectW(pDlgData->hBarBitmap, sizeof(BITMAP), &bmBar))
595  {
596  return;
597  }
598 
599  GetWindowRect(hwndBar, &rcBar);
600  MapWindowPoints(NULL, hwndDlg, (LPPOINT)&rcBar, 2);
601  dyLabel = bmLogo.bmHeight - rcBar.top;
602 
603  GetWindowRect(hwndLabel, &rcLabel);
604  MapWindowPoints(NULL, hwndDlg, (LPPOINT)&rcLabel, 2);
605  cxLabel = rcLabel.right - rcLabel.left;
606  cyLabel = rcLabel.bottom - rcLabel.top;
607 
608  MoveWindow(hwndLogo, 0, 0, bmLogo.bmWidth, bmLogo.bmHeight, TRUE);
609  MoveWindow(hwndBar, 0, bmLogo.bmHeight, bmLogo.bmWidth, bmBar.bmHeight, TRUE);
610  MoveWindow(hwndLabel, rcLabel.left, rcLabel.top + dyLabel, cxLabel, cyLabel, TRUE);
611 
612  GetWindowRect(hwndDlg, &rcWnd);
613  xOld = rcWnd.left;
614  yOld = rcWnd.top;
615  cxOld = rcWnd.right - rcWnd.left;
616  cyOld = rcWnd.bottom - rcWnd.top;
617 
618  GetClientRect(hwndDlg, &rc);
619  SetRect(&rc, 0, 0, bmLogo.bmWidth, rc.bottom - rc.top); /* new client size */
620 
621  style = (DWORD)GetWindowLongPtrW(hwndDlg, GWL_STYLE);
622  exstyle = (DWORD)GetWindowLongPtrW(hwndDlg, GWL_EXSTYLE);
623  AdjustWindowRectEx(&rc, style, FALSE, exstyle);
624 
625  cxNew = rc.right - rc.left;
626  cyNew = (rc.bottom - rc.top) + dyLabel;
627  xNew = xOld - (cxNew - cxOld) / 2;
628  yNew = yOld - (cyNew - cyOld) / 2;
629  MoveWindow(hwndDlg, xNew, yNew, cxNew, cyNew, TRUE);
630 }
631 
632 static INT_PTR CALLBACK
634  IN HWND hwndDlg,
635  IN UINT uMsg,
636  IN WPARAM wParam,
637  IN LPARAM lParam)
638 {
639  PDLG_DATA pDlgData;
641 
642  pDlgData = (PDLG_DATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
643 
644  /* pDlgData is required for each case except WM_INITDIALOG */
645  if (uMsg != WM_INITDIALOG && pDlgData == NULL) return FALSE;
646 
647  switch (uMsg)
648  {
649  case WM_INITDIALOG:
650  {
651  BITMAP bm;
652  WCHAR szMsg[256];
653 
654  /* Allocate pDlgData */
655  pDlgData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pDlgData));
656  if (pDlgData)
657  {
658  /* Set pDlgData to GWLP_USERDATA, so we can get it for new messages */
659  SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)pDlgData);
660 
661  /* Load bitmaps */
662  pDlgData->hLogoBitmap = LoadImageW(hDllInstance,
664  0, 0, LR_DEFAULTCOLOR);
665 
666  pDlgData->hBarBitmap = LoadImageW(hDllInstance, MAKEINTRESOURCEW(IDB_LINE),
668  GetObject(pDlgData->hBarBitmap, sizeof(bm), &bm);
669  pDlgData->BarWidth = bm.bmWidth;
670  pDlgData->BarHeight = bm.bmHeight;
671 
672  if (pDlgData->hLogoBitmap && pDlgData->hBarBitmap)
673  {
674  if (SetTimer(hwndDlg, IDT_BAR, 20, NULL) == 0)
675  {
676  DPRINT1("SetTimer(IDT_BAR) failed: %lu\n", GetLastError());
677  }
678 
679  /* Get the animation bar control */
680  pDlgData->hWndBarCtrl = GetDlgItem(hwndDlg, IDC_BAR);
681  }
682  }
683 
684  /* Get and set status text */
686  return FALSE;
687  SetDlgItemTextW(hwndDlg, IDC_STATUSLABEL, szMsg);
688 
689  AdjustStatusMessageWindow(hwndDlg, pDlgData);
690  return TRUE;
691  }
692 
693  case WM_TIMER:
694  {
695  if (pDlgData->hBarBitmap)
696  {
697  /*
698  * Default rotation bar image width is 413 (same as logo)
699  * We can divide 413 by 7 without remainder
700  */
701  pDlgData->BarCounter = (pDlgData->BarCounter + 7) % pDlgData->BarWidth;
702  InvalidateRect(pDlgData->hWndBarCtrl, NULL, FALSE);
703  UpdateWindow(pDlgData->hWndBarCtrl);
704  }
705  return TRUE;
706  }
707 
708  case WM_DRAWITEM:
709  {
711 
712  if (lpDis->CtlID != IDC_BAR)
713  {
714  return FALSE;
715  }
716 
717  if (pDlgData->hBarBitmap)
718  {
719  HDC hdcMem;
720  HGDIOBJ hOld;
721  DWORD off = pDlgData->BarCounter;
722  DWORD iw = pDlgData->BarWidth;
723  DWORD ih = pDlgData->BarHeight;
724 
725  hdcMem = CreateCompatibleDC(lpDis->hDC);
726  hOld = SelectObject(hdcMem, pDlgData->hBarBitmap);
727  BitBlt(lpDis->hDC, off, 0, iw - off, ih, hdcMem, 0, 0, SRCCOPY);
728  BitBlt(lpDis->hDC, 0, 0, off, ih, hdcMem, iw - off, 0, SRCCOPY);
729  SelectObject(hdcMem, hOld);
730  DeleteDC(hdcMem);
731  return TRUE;
732  }
733  return FALSE;
734  }
735 
736  case WM_DESTROY:
737  {
738  if (pDlgData->hBarBitmap)
739  {
740  KillTimer(hwndDlg, IDT_BAR);
741  }
742 
743  DeleteObject(pDlgData->hLogoBitmap);
744  DeleteObject(pDlgData->hBarBitmap);
745  HeapFree(GetProcessHeap(), 0, pDlgData);
746  return TRUE;
747  }
748  }
749  return FALSE;
750 }
751 
752 static DWORD WINAPI
754  IN LPVOID lpParameter)
755 {
756  HWND hWnd;
757  MSG Msg;
758  UNREFERENCED_PARAMETER(lpParameter);
759 
764  (LPARAM)NULL);
765  if (!hWnd)
766  return 0;
767 
769 
770  /* Message loop for the Status window */
771  while (GetMessage(&Msg, NULL, 0, 0))
772  {
775  }
776 
777  EndDialog(hWnd, 0);
778 
779  return 0;
780 }
781 
782 static LONG
784  IN HKEY hKey,
785  IN LPCWSTR pszKey,
786  OUT LPWSTR* pValue)
787 {
788  LONG rc;
789  DWORD dwType;
790  DWORD cbData = 0;
791  LPWSTR pwszValue;
792 
793  if (!pValue)
795 
796  *pValue = NULL;
797  rc = RegQueryValueExW(hKey, pszKey, NULL, &dwType, NULL, &cbData);
798  if (rc != ERROR_SUCCESS)
799  return rc;
800  if (dwType != REG_SZ)
801  return ERROR_FILE_NOT_FOUND;
802  pwszValue = HeapAlloc(GetProcessHeap(), 0, cbData + sizeof(WCHAR));
803  if (!pwszValue)
805  rc = RegQueryValueExW(hKey, pszKey, NULL, NULL, (LPBYTE)pwszValue, &cbData);
806  if (rc != ERROR_SUCCESS)
807  {
808  HeapFree(GetProcessHeap(), 0, pwszValue);
809  return rc;
810  }
811  /* NULL-terminate the string */
812  pwszValue[cbData / sizeof(WCHAR)] = '\0';
813 
814  *pValue = pwszValue;
815  return ERROR_SUCCESS;
816 }
817 
818 static BOOL
820 {
821  HKEY hControlKey = NULL;
822  LPWSTR pwszSystemStartOptions = NULL;
823  LPWSTR pwszCurrentOption, pwszNextOption; /* Pointers into SystemStartOptions */
824  BOOL bConsoleBoot = FALSE;
825  LONG rc;
826 
828  L"SYSTEM\\CurrentControlSet\\Control",
829  0,
831  &hControlKey);
832  if (rc != ERROR_SUCCESS)
833  goto cleanup;
834 
835  rc = ReadRegSzKey(hControlKey, L"SystemStartOptions", &pwszSystemStartOptions);
836  if (rc != ERROR_SUCCESS)
837  goto cleanup;
838 
839  /* Check for CONSOLE switch in SystemStartOptions */
840  pwszCurrentOption = pwszSystemStartOptions;
841  while (pwszCurrentOption)
842  {
843  pwszNextOption = wcschr(pwszCurrentOption, L' ');
844  if (pwszNextOption)
845  *pwszNextOption = L'\0';
846  if (wcsicmp(pwszCurrentOption, L"CONSOLE") == 0)
847  {
848  DPRINT("Found %S. Switching to console boot\n", pwszCurrentOption);
849  bConsoleBoot = TRUE;
850  goto cleanup;
851  }
852  pwszCurrentOption = pwszNextOption ? pwszNextOption + 1 : NULL;
853  }
854 
855 cleanup:
856  if (hControlKey != NULL)
857  RegCloseKey(hControlKey);
858  if (pwszSystemStartOptions)
859  HeapFree(GetProcessHeap(), 0, pwszSystemStartOptions);
860  return bConsoleBoot;
861 }
862 
863 static BOOL
865 {
866  HANDLE hThread = NULL;
867  BOOL bResult = FALSE;
868 
869  hSysSetupInf = SetupOpenInfFileW(L"syssetup.inf",
870  NULL,
872  NULL);
874  {
875  FatalError("SetupOpenInfFileW() failed to open 'syssetup.inf' (Error: %lu)\n", GetLastError());
876  return FALSE;
877  }
878 
880  {
881  FatalError("InstallSysSetupInfDevices() failed!\n");
882  goto Exit;
883  }
884 
886  {
887  FatalError("InstallSysSetupInfComponents() failed!\n");
888  goto Exit;
889  }
890 
891  if (!IsConsoleBoot())
892  {
894  0,
896  NULL,
897  0,
898  NULL);
899  }
900 
902  {
903  FatalError("EnableUserModePnpManager() failed!\n");
904  goto Exit;
905  }
906 
908  {
909  FatalError("CMP_WaitNoPendingInstallEvents() failed!\n");
910  goto Exit;
911  }
912 
913  bResult = TRUE;
914 
915 Exit:
916 
917  if (bResult == FALSE)
918  {
920  }
921 
922  if (hThread != NULL)
923  {
927  }
928 
929  return bResult;
930 }
931 
932 static
933 DWORD
935 {
936  STARTUPINFOW StartupInfo;
937  PROCESS_INFORMATION ProcessInformation;
938  BOOL bRes;
939 
940  if (!CommonInstall())
941  goto error;
942 
943  /* Install the TCP/IP protocol driver */
944  bRes = InstallNetworkComponent(L"MS_TCPIP");
945  if (!bRes && GetLastError() != ERROR_FILE_NOT_FOUND)
946  {
947  DPRINT("InstallNetworkComponent() failed with error 0x%lx\n", GetLastError());
948  }
949  else
950  {
951  /* Start the TCP/IP protocol driver */
952  SetupStartService(L"Tcpip", FALSE);
953  SetupStartService(L"Dhcp", FALSE);
954  SetupStartService(L"Dnscache", FALSE);
955  }
956 
957  /* Register components */
958  _SEH2_TRY
959  {
961  hSysSetupInf, L"RegistrationPhase2",
962  SPINST_ALL,
963  0, NULL, 0, NULL, NULL, NULL, NULL))
964  {
965  DPRINT1("SetupInstallFromInfSectionW failed!\n");
966  }
967 
968  RegisterTypeLibraries(hSysSetupInf, L"TypeLibraries");
969  }
971  {
972  DPRINT1("Catching exception\n");
973  }
974  _SEH2_END;
975 
977 
978  /* Run the shell */
979  ZeroMemory(&StartupInfo, sizeof(StartupInfo));
980  StartupInfo.cb = sizeof(StartupInfo);
981  bRes = CreateProcessW(L"userinit.exe",
982  NULL,
983  NULL,
984  NULL,
985  FALSE,
986  0,
987  NULL,
988  NULL,
989  &StartupInfo,
990  &ProcessInformation);
991  if (!bRes)
992  goto error;
993 
994  CloseHandle(ProcessInformation.hThread);
995  CloseHandle(ProcessInformation.hProcess);
996 
997  return 0;
998 
999 error:
1000  MessageBoxW(
1001  NULL,
1002  L"Failed to load LiveCD! You can shutdown your computer, or press ENTER to reboot.",
1003  L"ReactOS LiveCD",
1004  MB_OK);
1005  return 0;
1006 }
1007 
1008 
1009 static BOOL
1010 SetSetupType(DWORD dwSetupType)
1011 {
1012  DWORD dwError;
1013  HKEY hKey;
1014 
1015  dwError = RegOpenKeyExW(
1017  L"SYSTEM\\Setup",
1018  0,
1019  KEY_SET_VALUE,
1020  &hKey);
1021  if (dwError != ERROR_SUCCESS)
1022  return FALSE;
1023 
1024  dwError = RegSetValueExW(
1025  hKey,
1026  L"SetupType",
1027  0,
1028  REG_DWORD,
1029  (LPBYTE)&dwSetupType,
1030  sizeof(DWORD));
1031  RegCloseKey(hKey);
1032  if (dwError != ERROR_SUCCESS)
1033  return FALSE;
1034 
1035  return TRUE;
1036 }
1037 
1038 static DWORD CALLBACK
1040 {
1041  ATOM hotkey;
1042  MSG msg;
1043 
1044  DPRINT("HotkeyThread start\n");
1045 
1046  hotkey = GlobalAddAtomW(L"Setup Shift+F10 Hotkey");
1047 
1048  if (!RegisterHotKey(NULL, hotkey, MOD_SHIFT, VK_F10))
1049  DPRINT1("RegisterHotKey failed with %lu\n", GetLastError());
1050 
1051  while (GetMessage(&msg, NULL, 0, 0))
1052  {
1053  if (msg.hwnd == NULL && msg.message == WM_HOTKEY && msg.wParam == hotkey)
1054  {
1055  STARTUPINFOW si = { sizeof(si) };
1057 
1058  if (CreateProcessW(L"cmd.exe",
1059  NULL,
1060  NULL,
1061  NULL,
1062  FALSE,
1064  NULL,
1065  NULL,
1066  &si,
1067  &pi))
1068  {
1069  CloseHandle(pi.hProcess);
1070  CloseHandle(pi.hThread);
1071  }
1072  else
1073  {
1074  DPRINT1("Failed to launch command prompt: %lu\n", GetLastError());
1075  }
1076  }
1077  }
1078 
1079  UnregisterHotKey(NULL, hotkey);
1080  GlobalDeleteAtom(hotkey);
1081 
1082  DPRINT("HotkeyThread terminate\n");
1083  return 0;
1084 }
1085 
1086 
1087 static
1088 BOOL
1090 {
1091  LONG Error;
1092  HKEY hKey;
1093  DWORD dwLength;
1094  WCHAR szProgramFilesDirPath[MAX_PATH];
1095  WCHAR szCommonFilesDirPath[MAX_PATH];
1096  WCHAR szBuffer[MAX_PATH];
1097 
1098  /* Load 'Program Files' location */
1101  szBuffer,
1102  ARRAYSIZE(szBuffer)))
1103  {
1104  DPRINT1("Error: %lu\n", GetLastError());
1105  return FALSE;
1106  }
1107 
1110  szCommonFilesDirPath,
1111  ARRAYSIZE(szCommonFilesDirPath)))
1112  {
1113  DPRINT1("Warning: %lu\n", GetLastError());
1114  }
1115 
1116  /* Expand it */
1117  if (!ExpandEnvironmentStringsW(szBuffer,
1118  szProgramFilesDirPath,
1119  ARRAYSIZE(szProgramFilesDirPath)))
1120  {
1121  DPRINT1("Error: %lu\n", GetLastError());
1122  return FALSE;
1123  }
1124 
1125  wcscpy(szBuffer, szProgramFilesDirPath);
1126  wcscat(szBuffer, L"\\");
1127  wcscat(szBuffer, szCommonFilesDirPath);
1128 
1129  if (!ExpandEnvironmentStringsW(szBuffer,
1130  szCommonFilesDirPath,
1131  ARRAYSIZE(szCommonFilesDirPath)))
1132  {
1133  DPRINT1("Warning: %lu\n", GetLastError());
1134  }
1135 
1136  /* Store it */
1138  L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion",
1139  0,
1140  KEY_SET_VALUE,
1141  &hKey);
1142  if (Error != ERROR_SUCCESS)
1143  {
1144  DPRINT1("Error: %lu\n", Error);
1145  return FALSE;
1146  }
1147 
1148  dwLength = (wcslen(szProgramFilesDirPath) + 1) * sizeof(WCHAR);
1150  L"ProgramFilesDir",
1151  0,
1152  REG_SZ,
1153  (LPBYTE)szProgramFilesDirPath,
1154  dwLength);
1155  if (Error != ERROR_SUCCESS)
1156  {
1157  DPRINT1("Error: %lu\n", Error);
1158  RegCloseKey(hKey);
1159  return FALSE;
1160  }
1161 
1162  dwLength = (wcslen(szCommonFilesDirPath) + 1) * sizeof(WCHAR);
1164  L"CommonFilesDir",
1165  0,
1166  REG_SZ,
1167  (LPBYTE)szCommonFilesDirPath,
1168  dwLength);
1169  if (Error != ERROR_SUCCESS)
1170  {
1171  DPRINT1("Warning: %lu\n", Error);
1172  }
1173 
1174  RegCloseKey(hKey);
1175 
1176  /* Create directory */
1177  // FIXME: Security!
1178  if (!CreateDirectoryW(szProgramFilesDirPath, NULL))
1179  {
1181  {
1182  DPRINT1("Error: %lu\n", GetLastError());
1183  return FALSE;
1184  }
1185  }
1186 
1187  /* Create directory */
1188  // FIXME: Security!
1189  if (!CreateDirectoryW(szCommonFilesDirPath, NULL))
1190  {
1192  {
1193  DPRINT1("Warning: %lu\n", GetLastError());
1194  // return FALSE;
1195  }
1196  }
1197 
1198  return TRUE;
1199 }
1200 
1201 
1202 static
1203 VOID
1205 {
1206  WCHAR szBuffer[80];
1207  PWSTR ptr;
1208  HKEY hLocaleKey;
1209  DWORD ret;
1210  DWORD dwSize;
1211  LCID lcid;
1212  INT i;
1213 
1214  struct {LCTYPE LCType; PWSTR pValue;} LocaleData[] = {
1215  /* Number */
1216  {LOCALE_SDECIMAL, L"sDecimal"},
1217  {LOCALE_STHOUSAND, L"sThousand"},
1218  {LOCALE_SNEGATIVESIGN, L"sNegativeSign"},
1219  {LOCALE_SPOSITIVESIGN, L"sPositiveSign"},
1220  {LOCALE_SGROUPING, L"sGrouping"},
1221  {LOCALE_SLIST, L"sList"},
1222  {LOCALE_SNATIVEDIGITS, L"sNativeDigits"},
1223  {LOCALE_INEGNUMBER, L"iNegNumber"},
1224  {LOCALE_IDIGITS, L"iDigits"},
1225  {LOCALE_ILZERO, L"iLZero"},
1226  {LOCALE_IMEASURE, L"iMeasure"},
1227  {LOCALE_IDIGITSUBSTITUTION, L"NumShape"},
1228 
1229  /* Currency */
1230  {LOCALE_SCURRENCY, L"sCurrency"},
1231  {LOCALE_SMONDECIMALSEP, L"sMonDecimalSep"},
1232  {LOCALE_SMONTHOUSANDSEP, L"sMonThousandSep"},
1233  {LOCALE_SMONGROUPING, L"sMonGrouping"},
1234  {LOCALE_ICURRENCY, L"iCurrency"},
1235  {LOCALE_INEGCURR, L"iNegCurr"},
1236  {LOCALE_ICURRDIGITS, L"iCurrDigits"},
1237 
1238  /* Time */
1239  {LOCALE_STIMEFORMAT, L"sTimeFormat"},
1240  {LOCALE_STIME, L"sTime"},
1241  {LOCALE_S1159, L"s1159"},
1242  {LOCALE_S2359, L"s2359"},
1243  {LOCALE_ITIME, L"iTime"},
1244  {LOCALE_ITIMEMARKPOSN, L"iTimePrefix"},
1245  {LOCALE_ITLZERO, L"iTLZero"},
1246 
1247  /* Date */
1248  {LOCALE_SLONGDATE, L"sLongDate"},
1249  {LOCALE_SSHORTDATE, L"sShortDate"},
1250  {LOCALE_SDATE, L"sDate"},
1251  {LOCALE_IFIRSTDAYOFWEEK, L"iFirstDayOfWeek"},
1252  {LOCALE_IFIRSTWEEKOFYEAR, L"iFirstWeekOfYear"},
1253  {LOCALE_IDATE, L"iDate"},
1254  {LOCALE_ICALENDARTYPE, L"iCalendarType"},
1255 
1256  /* Misc */
1257  {LOCALE_SCOUNTRY, L"sCountry"},
1258  {LOCALE_SABBREVLANGNAME, L"sLanguage"},
1259  {LOCALE_ICOUNTRY, L"iCountry"},
1260  {0, NULL}};
1261 
1263  L".DEFAULT\\Control Panel\\International",
1264  0,
1265  KEY_READ | KEY_WRITE,
1266  &hLocaleKey);
1267  if (ret != ERROR_SUCCESS)
1268  {
1269  return;
1270  }
1271 
1272  dwSize = 9 * sizeof(WCHAR);
1273  ret = RegQueryValueExW(hLocaleKey,
1274  L"Locale",
1275  NULL,
1276  NULL,
1277  (PBYTE)szBuffer,
1278  &dwSize);
1279  if (ret != ERROR_SUCCESS)
1280  goto done;
1281 
1282  lcid = (LCID)wcstoul(szBuffer, &ptr, 16);
1283  if (lcid == 0)
1284  goto done;
1285 
1286  i = 0;
1287  while (LocaleData[i].pValue != NULL)
1288  {
1289  if (GetLocaleInfoW(lcid,
1290  LocaleData[i].LCType | LOCALE_NOUSEROVERRIDE,
1291  szBuffer,
1292  ARRAYSIZE(szBuffer)))
1293  {
1294  RegSetValueExW(hLocaleKey,
1295  LocaleData[i].pValue,
1296  0,
1297  REG_SZ,
1298  (PBYTE)szBuffer,
1299  (wcslen(szBuffer) + 1) * sizeof(WCHAR));
1300  }
1301 
1302  i++;
1303  }
1304 
1305 done:
1306  RegCloseKey(hLocaleKey);
1307 }
1308 
1309 
1310 static
1311 DWORD
1313 {
1314  WCHAR szDefaultUserHive[MAX_PATH];
1315  HKEY hUserKey = NULL;
1316  DWORD cchSize;
1317  DWORD dwError;
1318 
1319  DPRINT("SaveDefaultUserHive()\n");
1320 
1321  cchSize = ARRAYSIZE(szDefaultUserHive);
1322  GetDefaultUserProfileDirectoryW(szDefaultUserHive, &cchSize);
1323 
1324  wcscat(szDefaultUserHive, L"\\ntuser.dat");
1325 
1326  dwError = RegOpenKeyExW(HKEY_USERS,
1327  L".DEFAULT",
1328  0,
1329  KEY_READ,
1330  &hUserKey);
1331  if (dwError != ERROR_SUCCESS)
1332  {
1333  DPRINT1("RegOpenKeyExW() failed (Error %lu)\n", dwError);
1334  return dwError;
1335  }
1336 
1337  pSetupEnablePrivilege(L"SeBackupPrivilege", TRUE);
1338 
1339  /* Save the Default hive */
1340  dwError = RegSaveKeyExW(hUserKey,
1341  szDefaultUserHive,
1342  NULL,
1344  if (dwError == ERROR_ALREADY_EXISTS)
1345  {
1346  WCHAR szBackupHive[MAX_PATH];
1347 
1348  /* Build the backup hive file name by replacing the extension */
1349  wcscpy(szBackupHive, szDefaultUserHive);
1350  wcscpy(&szBackupHive[wcslen(szBackupHive) - 4], L".bak");
1351 
1352  /* Back up the existing default user hive by renaming it, replacing any possible existing old backup */
1353  if (!MoveFileExW(szDefaultUserHive,
1354  szBackupHive,
1356  {
1357  dwError = GetLastError();
1358  DPRINT1("Failed to create a default-user hive backup '%S', MoveFileExW failed (Error %lu)\n",
1359  szBackupHive, dwError);
1360  }
1361  else
1362  {
1363  /* The backup has been done, retry saving the Default hive */
1364  dwError = RegSaveKeyExW(hUserKey,
1365  szDefaultUserHive,
1366  NULL,
1368  }
1369  }
1370  if (dwError != ERROR_SUCCESS)
1371  {
1372  DPRINT1("RegSaveKeyExW() failed (Error %lu)\n", dwError);
1373  }
1374 
1375  pSetupEnablePrivilege(L"SeBackupPrivilege", FALSE);
1376 
1377  RegCloseKey(hUserKey);
1378 
1379  return dwError;
1380 }
1381 
1382 
1383 static
1384 DWORD
1386 {
1387  WCHAR szBuffer[MAX_PATH];
1388  HANDLE token;
1389  TOKEN_PRIVILEGES privs;
1390  HKEY hKey;
1391  HINF hShortcutsInf;
1392  HANDLE hHotkeyThread;
1393  BOOL ret;
1394 
1396  LogItem(NULL, L"Installing ReactOS");
1397 
1398  CreateTempDir(L"TEMP");
1399  CreateTempDir(L"TMP");
1400 
1402  {
1403  FatalError("InitializeProgramFilesDir() failed");
1404  return 0;
1405  }
1406 
1407  if (!InitializeProfiles())
1408  {
1409  FatalError("InitializeProfiles() failed");
1410  return 0;
1411  }
1412 
1414 
1415  if (GetWindowsDirectoryW(szBuffer, ARRAYSIZE(szBuffer)))
1416  {
1418  L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion",
1419  0,
1420  KEY_WRITE,
1421  &hKey) == ERROR_SUCCESS)
1422  {
1424  L"PathName",
1425  0,
1426  REG_SZ,
1427  (LPBYTE)szBuffer,
1428  (wcslen(szBuffer) + 1) * sizeof(WCHAR));
1429 
1431  L"SystemRoot",
1432  0,
1433  REG_SZ,
1434  (LPBYTE)szBuffer,
1435  (wcslen(szBuffer) + 1) * sizeof(WCHAR));
1436 
1437  RegCloseKey(hKey);
1438  }
1439 
1440  PathAddBackslash(szBuffer);
1441  wcscat(szBuffer, L"system");
1442  CreateDirectory(szBuffer, NULL);
1443  }
1444 
1446  {
1447  FatalError("SaveDefaultUserHive() failed");
1448  return 0;
1449  }
1450 
1451  if (!CopySystemProfile(0))
1452  {
1453  FatalError("CopySystemProfile() failed");
1454  return 0;
1455  }
1456 
1457  hHotkeyThread = CreateThread(NULL, 0, HotkeyThread, NULL, 0, NULL);
1458 
1459  if (!CommonInstall())
1460  return 0;
1461 
1462  /* Install the TCP/IP protocol driver */
1463  ret = InstallNetworkComponent(L"MS_TCPIP");
1464  if (!ret && GetLastError() != ERROR_FILE_NOT_FOUND)
1465  {
1466  DPRINT("InstallNetworkComponent() failed with error 0x%lx\n", GetLastError());
1467  }
1468  else
1469  {
1470  /* Start the TCP/IP protocol driver */
1471  SetupStartService(L"Tcpip", FALSE);
1472  SetupStartService(L"Dhcp", FALSE);
1473  SetupStartService(L"Dnscache", FALSE);
1474  }
1475 
1476  InstallWizard();
1477 
1478  InstallSecurity();
1479 
1481 
1482  hShortcutsInf = SetupOpenInfFileW(L"shortcuts.inf",
1483  NULL,
1485  NULL);
1486  if (hShortcutsInf == INVALID_HANDLE_VALUE)
1487  {
1488  FatalError("Failed to open shortcuts.inf");
1489  return 0;
1490  }
1491 
1492  if (!CreateShortcuts(hShortcutsInf, L"ShortcutFolders"))
1493  {
1494  FatalError("CreateShortcuts() failed");
1495  return 0;
1496  }
1497 
1498  SetupCloseInfFile(hShortcutsInf);
1499 
1500  hShortcutsInf = SetupOpenInfFileW(L"rosapps_shortcuts.inf",
1501  NULL,
1503  NULL);
1504  if (hShortcutsInf != INVALID_HANDLE_VALUE)
1505  {
1506  if (!CreateShortcuts(hShortcutsInf, L"ShortcutFolders"))
1507  {
1508  FatalError("CreateShortcuts(rosapps) failed");
1509  return 0;
1510  }
1511  SetupCloseInfFile(hShortcutsInf);
1512  }
1513 
1515  SetSetupType(0);
1516 
1517  if (hHotkeyThread)
1518  {
1519  PostThreadMessage(GetThreadId(hHotkeyThread), WM_QUIT, 0, 0);
1520  CloseHandle(hHotkeyThread);
1521  }
1522 
1523  LogItem(NULL, L"Installing ReactOS done");
1525 
1526  if (AdminInfo.Name != NULL)
1527  RtlFreeHeap(RtlGetProcessHeap(), 0, AdminInfo.Name);
1528 
1529  if (AdminInfo.Domain != NULL)
1530  RtlFreeHeap(RtlGetProcessHeap(), 0, AdminInfo.Domain);
1531 
1532  if (AdminInfo.Password != NULL)
1533  RtlFreeHeap(RtlGetProcessHeap(), 0, AdminInfo.Password);
1534 
1535  /* Get shutdown privilege */
1537  {
1538  FatalError("OpenProcessToken() failed!");
1539  return 0;
1540  }
1543  &privs.Privileges[0].Luid))
1544  {
1545  FatalError("LookupPrivilegeValue() failed!");
1546  return 0;
1547  }
1548  privs.PrivilegeCount = 1;
1551  FALSE,
1552  &privs,
1553  0,
1555  NULL) == 0)
1556  {
1557  FatalError("AdjustTokenPrivileges() failed!");
1558  return 0;
1559  }
1560 
1562  return 0;
1563 }
1564 
1565 
1566 /*
1567  * Standard Windows-compatible export, which dispatches
1568  * to either 'InstallReactOS' or 'InstallLiveCD'.
1569  */
1570 INT
1571 WINAPI
1573 {
1574  INT i;
1575  PWSTR p;
1576 
1577  for (i = 0; i < argc; ++i)
1578  {
1579  p = argv[i];
1580  if (*p == L'-')
1581  {
1582  p++;
1583 
1584  // NOTE: On Windows, "mini" means "minimal UI", and can be used
1585  // in addition to "newsetup"; these options are not exclusive.
1586  if (_wcsicmp(p, L"newsetup") == 0)
1587  return (INT)InstallReactOS();
1588  else if (_wcsicmp(p, L"mini") == 0)
1589  return (INT)InstallLiveCD();
1590 
1591  /* Add support for other switches */
1592  }
1593  }
1594 
1595  return 0;
1596 }
1597 
1598 
1599 /*
1600  * @unimplemented
1601  */
1602 DWORD WINAPI
1604  IN HANDLE hWnd,
1605  IN LPCWSTR lpszFontSize)
1606 {
1608  return FALSE;
1609 }
1610 
1611 /*
1612  * @unimplemented
1613  */
1614 DWORD WINAPI
1616  LCID Lcid,
1617  LPCWSTR lpSrcRootPath,
1618  char Unknown,
1619  DWORD dwUnused1,
1620  DWORD dwUnused2)
1621 {
1623  return FALSE;
1624 }
1625 
1626 /*
1627  * @implemented
1628  */
1629 DWORD WINAPI
1631 {
1632  return SetupChangeLocaleEx(hWnd, Lcid, NULL, 0, 0, 0);
1633 }
1634 
1635 
1636 DWORD
1637 WINAPI
1639  LPCWSTR lpServiceName,
1640  BOOL bWait)
1641 {
1642  SC_HANDLE hManager = NULL;
1643  SC_HANDLE hService = NULL;
1644  DWORD dwError = ERROR_SUCCESS;
1645 
1646  hManager = OpenSCManagerW(NULL,
1647  NULL,
1649  if (hManager == NULL)
1650  {
1651  dwError = GetLastError();
1652  goto done;
1653  }
1654 
1655  hService = OpenServiceW(hManager,
1656  lpServiceName,
1657  SERVICE_START);
1658  if (hService == NULL)
1659  {
1660  dwError = GetLastError();
1661  goto done;
1662  }
1663 
1664  if (!StartService(hService, 0, NULL))
1665  {
1666  dwError = GetLastError();
1667  goto done;
1668  }
1669 
1670 done:
1671  if (hService != NULL)
1672  CloseServiceHandle(hService);
1673 
1674  if (hManager != NULL)
1675  CloseServiceHandle(hManager);
1676 
1677  return dwError;
1678 }
#define HKEY_USERS
Definition: winreg.h:13
#define StartService
Definition: winsvc.h:585
static HANDLE DWORD
Definition: install.c:28
_SEH2_TRY
Definition: create.c:4226
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:90
#define LOCALE_SGROUPING
Definition: winnls.h:44
LONG WINAPI RegSaveKeyExW(HKEY hKey, LPCWSTR lpFile, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD Flags)
Definition: reg.c:4747
static BOOL SetSetupType(DWORD dwSetupType)
Definition: install.c:1010
BOOL WINAPI SetupFindFirstLineW(IN HINF InfHandle, IN PCWSTR Section, IN PCWSTR Key, IN OUT PINFCONTEXT Context)
Definition: infsupp.c:54
#define IDB_REACTOS
Definition: shresdef.h:30
ATOM WINAPI GlobalDeleteAtom(ATOM nAtom)
Definition: atom.c:454
static int argc
Definition: ServiceArgs.c:12
#define MAKEINTRESOURCE
Definition: winuser.h:591
BOOL WINAPI GetDefaultUserProfileDirectoryW(_Out_opt_ LPWSTR lpProfileDir, _Inout_ LPDWORD lpcchSize)
Definition: profile.c:1443
#define IN
Definition: typedefs.h:39
#define SC_MANAGER_ENUMERATE_SERVICE
Definition: winsvc.h:16
static const WCHAR szName[]
Definition: powrprof.c:45
#define DispatchMessage
Definition: winuser.h:5755
#define IDC_ROSLOGO
Definition: resource.h:69
_In_ LPCSTR _In_opt_ LPCSTR _In_ DWORD _Out_opt_ LPSTR * lpFilePart
Definition: winbase.h:3059
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define CloseHandle
Definition: compat.h:598
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
#define LOCALE_SMONGROUPING
Definition: winnls.h:53
static INT_PTR CALLBACK StatusMessageWindowProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: install.c:633
#define REG_STANDARD_FORMAT
Definition: cmtypes.h:97
static DWORD InstallReactOS(VOID)
Definition: install.c:1385
HBITMAP hBarBitmap
Definition: gui.c:38
#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
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
DWORD dwCurrentState
Definition: winsvc.h:100
_In_ CONST DEVPROPKEY _In_ LCID Lcid
Definition: iofuncs.h:2414
HRESULT hr
Definition: shlfolder.c:183
#define error(str)
Definition: mkdosfs.c:1605
#define KEY_SET_VALUE
Definition: nt_native.h:1017
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
HRESULT __wine_register_resources(HMODULE module) DECLSPEC_HIDDEN
Definition: register.c:98
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
static BOOL InstallSysSetupInfComponents(VOID)
Definition: install.c:354
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
static BOOL InitializeProgramFilesDir(VOID)
Definition: install.c:1089
#define MOVEFILE_REPLACE_EXISTING
Definition: filesup.h:28
#define SetupFindFirstLine
Definition: setupapi.h:2624
DWORD BarWidth
Definition: gui.c:43
WORD ATOM
Definition: dimm.idl:113
#define KEY_READ
Definition: nt_native.h:1023
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define WM_HOTKEY
Definition: winuser.h:1869
uint16_t * PWSTR
Definition: typedefs.h:56
INT WINAPI InstallWindowsNt(INT argc, WCHAR **argv)
Definition: install.c:1572
#define LOCALE_IDATE
Definition: winnls.h:63
PWCHAR pValue
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
struct @1591 Msg[]
BOOL RegisterTypeLibraries(HINF hinf, LPCWSTR szSection)
Definition: install.c:433
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
#define IDS_PROGRAMFILES
Definition: resource.h:154
static HDC
Definition: imagelist.c:92
#define CALLBACK
Definition: compat.h:35
static VOID AdjustStatusMessageWindow(HWND hwndDlg, PDLG_DATA pDlgData)
Definition: install.c:569
BOOL WINAPI UpdateWindow(_In_ HWND)
HWND hWnd
Definition: settings.c:17
#define WM_QUIT
Definition: winuser.h:1613
#define LOCALE_ICALENDARTYPE
Definition: winnls.h:73
LONG top
Definition: windef.h:307
#define LOCALE_ILZERO
Definition: winnls.h:46
$ULONG PrivilegeCount
Definition: setypes.h:1019
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
static DWORD SaveDefaultUserHive(VOID)
Definition: install.c:1312
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
BOOL WINAPI AdjustWindowRectEx(_Inout_ LPRECT, _In_ DWORD, _In_ BOOL, _In_ DWORD)
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
#define ZeroMemory
Definition: winbase.h:1667
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
Definition: path.c:1106
#define GWL_EXSTYLE
Definition: winuser.h:845
#define SERVICE_START_PENDING
Definition: winsvc.h:22
DWORD WINAPI GetThreadId(IN HANDLE Thread)
Definition: thread.c:913
static VOID InitializeDefaultUserLocale(VOID)
Definition: install.c:1204
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define IID_IShellLink
Definition: shlguid.h:131
DWORD LCID
Definition: nls.h:13
UINT_PTR WPARAM
Definition: windef.h:207
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
#define GetWindowLongPtrW
Definition: winuser.h:4819
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
LONG left
Definition: windef.h:306
BOOL WINAPI QueryServiceStatusEx(SC_HANDLE hService, SC_STATUS_TYPE InfoLevel, LPBYTE lpBuffer, DWORD cbBufSize, LPDWORD pcbBytesNeeded)
Definition: scm.c:2835
_SEH2_END
Definition: create.c:4400
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
_In_ PVOID Parameter
Definition: ldrtypes.h:241
int32_t INT_PTR
Definition: typedefs.h:64
#define EWX_REBOOT
Definition: winuser.h:633
HINF WINAPI SetupOpenInfFileW(PCWSTR name, PCWSTR class, DWORD style, UINT *error)
Definition: parser.c:1229
#define argv
Definition: mplay32.c:18
DWORD WINAPI SetupChangeLocaleEx(HWND hWnd, LCID Lcid, LPCWSTR lpSrcRootPath, char Unknown, DWORD dwUnused1, DWORD dwUnused2)
Definition: install.c:1615
#define LOCALE_IMEASURE
Definition: winnls.h:41
LONG right
Definition: windef.h:308
DWORD WINAPI SetupChangeLocale(HWND hWnd, LCID Lcid)
Definition: install.c:1630
#define LookupPrivilegeValue
Definition: winbase.h:3731
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
static DWORD CALLBACK HotkeyThread(LPVOID Parameter)
Definition: install.c:1039
int32_t INT
Definition: typedefs.h:58
HWND hWndBarCtrl
Definition: gui.c:39
LPWSTR Name
Definition: globals.h:23
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
VOID WINAPI SetupCloseInfFile(IN HINF InfHandle)
Definition: infsupp.c:43
BOOL WINAPI UnregisterHotKey(_In_opt_ HWND, _In_ int)
BOOL WINAPI SetupDiInstallClassW(HWND hwndParent, PCWSTR InfFileName, DWORD Flags, HSPFILEQ FileQueue)
Definition: devinst.c:3605
#define LOCALE_SCURRENCY
Definition: winnls.h:49
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2352
#define LOCALE_INEGNUMBER
Definition: winnls.h:47
#define SERVICE_NO_CHANGE
Definition: winsvc.h:20
#define VK_F10
Definition: winuser.h:2254
static BOOL CommonInstall(VOID)
Definition: install.c:864
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: lang.c:1102
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define SE_PRIVILEGE_ENABLED
Definition: setypes.h:63
DWORD LCTYPE
Definition: winnls.h:517
#define L(x)
Definition: ntvdm.h:50
#define LOCALE_STHOUSAND
Definition: winnls.h:43
#define LOCALE_NOUSEROVERRIDE
Definition: winnls.h:19
unsigned char * LPBYTE
Definition: typedefs.h:53
#define va_end(ap)
Definition: acmsvcex.h:90
#define LANG_JAPANESE
Definition: nls.h:76
#define FALSE
Definition: types.h:117
#define SP_COPY_NEWER
Definition: setupapi.h:478
unsigned int BOOL
Definition: ntddk_ex.h:94
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
long LONG
Definition: pedump.c:60
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
if SUCCEEDED(hr)
#define SERVICE_RUNNING
Definition: winsvc.h:24
#define LOCALE_SLONGDATE
Definition: winnls.h:61
VOID InstallWizard(VOID)
Definition: wizard.c:3017
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
static BOOL CreateShortcut(LPCWSTR pszFolder, LPCWSTR pszName, LPCWSTR pszCommand, LPCWSTR pszDescription, INT iIconNr, LPCWSTR pszWorkingDir)
Definition: install.c:118
static PVOID ptr
Definition: dispmode.c:27
#define PathAddBackslash
Definition: shlwapi.h:783
SC_HANDLE WINAPI OpenServiceW(SC_HANDLE hSCManager, LPCWSTR lpServiceName, DWORD dwDesiredAccess)
Definition: scm.c:2108
#define LOCALE_ITIMEMARKPOSN
Definition: winnls.h:66
#define GWLP_USERDATA
Definition: treelist.c:63
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
Definition: scm.c:580
#define LOCALE_INEGCURR
Definition: winnls.h:57
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
#define IDT_BAR
Definition: gui.c:32
#define LoadLibraryW(x)
Definition: compat.h:606
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:656
LONG_PTR LPARAM
Definition: windef.h:208
char * va_list
Definition: acmsvcex.h:78
#define LOCALE_SDECIMAL
Definition: winnls.h:42
BOOL WINAPI InitializeProfiles(VOID)
Definition: setup.c:335
#define SERVICE_QUERY_STATUS
Definition: winsvc.h:55
#define LOCALE_STIME
Definition: winnls.h:59
#define SW_SHOW
Definition: winuser.h:769
BOOL WINAPI pSetupEnablePrivilege(LPCWSTR lpPrivilegeName, BOOL bEnable)
Definition: misc.c:440
VOID SetAutoAdminLogon(VOID)
Definition: security.c:1748
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define IDS_STATUS_INSTALL_DEV
Definition: resource.h:151
static BOOL CreateShortcutsFromSection(HINF hinf, LPWSTR pszSection, LPCWSTR pszFolder)
Definition: install.c:182
#define WM_DESTROY
Definition: winuser.h:1599
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 BarCounter
Definition: gui.c:40
static HINSTANCE hDllInstance
Definition: clb.c:30
#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:4899
static INT cxOld
Definition: eventvwr.c:4291
DWORD WINAPI SetupStartService(LPCWSTR lpServiceName, BOOL bWait)
Definition: install.c:1638
BOOL WINAPI CopySystemProfile(_In_ ULONG Unused)
Definition: profile.c:565
#define LOCALE_SMONDECIMALSEP
Definition: winnls.h:51
#define IDC_BAR
Definition: resource.h:70
BOOL WINAPI StartServiceW(SC_HANDLE hService, DWORD dwNumServiceArgs, LPCWSTR *lpServiceArgVectors)
Definition: scm.c:2928
#define WAIT_OBJECT_0
Definition: winbase.h:403
#define CREATE_NEW_CONSOLE
Definition: winbase.h:180
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
DWORD cb
Definition: winbase.h:849
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4120
#define ASSERT(a)
Definition: mode.c:44
#define LOCALE_SMONTHOUSANDSEP
Definition: winnls.h:52
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define LOCALE_SDATE
Definition: winnls.h:58
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MOD_SHIFT
Definition: imm.h:321
static DWORD DWORD * dwLength
Definition: fusion.c:85
static DWORD WINAPI ShowStatusMessageThread(IN LPVOID lpParameter)
Definition: install.c:753
static refpint_t pi[]
Definition: server.c:96
LONG HRESULT
Definition: typedefs.h:79
DWORD dwWaitHint
Definition: winsvc.h:105
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
static void Exit(void)
Definition: sock.c:1331
#define LOCALE_SABBREVLANGNAME
Definition: winnls.h:28
#define WM_TIMER
Definition: winuser.h:1732
#define LOCALE_SPOSITIVESIGN
Definition: winnls.h:117
#define SERVICE_CHANGE_CONFIG
Definition: winsvc.h:54
static SERVICE_STATUS ServiceStatus
Definition: browser.c:22
_In_ LPCSTR pszDir
Definition: shellapi.h:582
#define PostThreadMessage
Definition: winuser.h:5823
#define MAX_PATH
Definition: compat.h:34
#define WINAPI
Definition: msvc.h:6
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
VOID WINAPI TerminateSetupActionLog(VOID)
Definition: logfile.c:82
unsigned long DWORD
Definition: ntddk_ex.h:95
static BOOL InstallSysSetupInfDevices(VOID)
Definition: install.c:318
va_start(ap, x)
BOOL Error
Definition: chkdsk.c:66
#define SetLastError(x)
Definition: compat.h:611
DWORD BarHeight
Definition: gui.c:44
#define DI_QUIETINSTALL
Definition: setupapi.h:68
static BOOL CreateShortcuts(HINF hinf, LPCWSTR szSection)
Definition: install.c:225
#define GetObject
Definition: wingdi.h:4468
#define LOCALE_S1159
Definition: winnls.h:71
#define LOCALE_ITLZERO
Definition: winnls.h:68
#define wcsicmp
Definition: compat.h:15
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
DWORD WINAPI CMP_WaitNoPendingInstallEvents(_In_ DWORD dwTimeout)
Definition: cfgmgr.c:802
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
int ret
ULONG WINAPI SetupGetFieldCount(IN PINFCONTEXT Context)
Definition: infsupp.c:91
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define LOCALE_SNEGATIVESIGN
Definition: winnls.h:118
SC_HANDLE WINAPI OpenSCManagerW(LPCWSTR lpMachineName, LPCWSTR lpDatabaseName, DWORD dwDesiredAccess)
Definition: scm.c:2016
UINT WINAPI SetupDefaultQueueCallbackW(PVOID context, UINT notification, UINT_PTR param1, UINT_PTR param2)
Definition: queue.c:1777
#define LOCALE_SSHORTDATE
Definition: winnls.h:60
#define LOCALE_ICOUNTRY
Definition: winnls.h:30
#define GetCurrentProcess()
Definition: compat.h:618
#define SPINST_ALL
Definition: setupapi.h:601
#define LOCALE_IDIGITS
Definition: winnls.h:45
Definition: gui.c:34
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
SC_HANDLE hSCManager
Definition: sc.c:12
#define LOCALE_IFIRSTDAYOFWEEK
Definition: winnls.h:75
BOOL WINAPI ExitWindowsEx(_In_ UINT, _In_ DWORD)
#define IDS_COMMONFILES
Definition: resource.h:155
#define SERVICE_START
Definition: winsvc.h:57
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
static PEXPLICIT_ACCESSW *static HMODULE hmod
Definition: security.c:141
static BOOL IsConsoleBoot(VOID)
Definition: install.c:819
#define LOCALE_IFIRSTWEEKOFYEAR
Definition: winnls.h:76
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
struct _DLG_DATA DLG_DATA
HINF hSysSetupInf
Definition: install.c:37
#define GWL_STYLE
Definition: winuser.h:846
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
ADMIN_INFO AdminInfo
Definition: install.c:38
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
#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
BOOL WINAPI DeleteDC(_In_ HDC)
FxAutoRegKey hKey
LPCWSTR szPath
Definition: env.c:37
DWORD WINAPI SetupChangeFontSize(IN HANDLE hWnd, IN LPCWSTR lpszFontSize)
Definition: install.c:1603
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define LOCALE_ITIME
Definition: winnls.h:65
Definition: bl.h:1330
int __cdecl vsprintf(char *_Dest, const char *_Format, va_list _Args)
Definition: sprintf.c:733
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
_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 IDD_STATUSWINDOW_DLG
Definition: resource.h:88
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:296
#define IDC_STATUSLABEL
Definition: resource.h:89
#define MB_OK
Definition: winuser.h:784
#define CSIDL_FLAG_CREATE
#define IMAGE_BITMAP
Definition: winuser.h:211
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
#define GetMessage
Definition: winuser.h:5780
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define SC_MANAGER_ALL_ACCESS
Definition: winsvc.h:13
HANDLE hThread
Definition: wizard.c:28
ATOM WINAPI GlobalAddAtomW(LPCWSTR lpString)
Definition: atom.c:444
BOOL WINAPI SetupFindNextLine(IN PINFCONTEXT ContextIn, OUT PINFCONTEXT ContextOut)
Definition: infsupp.c:80
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY]
Definition: setypes.h:1020
#define DPRINT1
Definition: precomp.h:8
LPWSTR Domain
Definition: globals.h:24
#define SERVICE_AUTO_START
Definition: cmtypes.h:977
#define WM_DRAWITEM
Definition: winuser.h:1635
#define LOCALE_SLIST
Definition: winnls.h:40
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
#define msg(x)
Definition: auth_time.c:54
const GUID IID_IPersistFile
VOID InstallSecurity(VOID)
Definition: security.c:1569
struct _DLG_DATA * PDLG_DATA
HRESULT WINAPI SHGetFolderPathW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath)
Definition: shellpath.c:2348
struct tagContext Context
Definition: acpixf.h:1034
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32
BOOL WINAPI SetupGetIntField(IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT INT *IntegerValue)
Definition: infsupp.c:146
#define OUT
Definition: typedefs.h:40
GLuint res
Definition: glext.h:9613
#define LANG_CHINESE
Definition: nls.h:42
#define LOCALE_SCOUNTRY
Definition: winnls.h:31
#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:3356
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
LONG bottom
Definition: windef.h:309
BOOL WINAPI MoveFileExW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName OPTIONAL, IN DWORD dwFlags)
Definition: move.c:1060
#define LOCALE_SNATIVEDIGITS
Definition: winnls.h:48
BOOL InstallNetworkComponent(_In_ PWSTR pszComponentId)
Definition: netinstall.c:467
char * cleanup(char *str)
Definition: wpickclick.c:99
static LONG ReadRegSzKey(IN HKEY hKey, IN LPCWSTR pszKey, OUT LPWSTR *pValue)
Definition: install.c:783
#define LANG_KOREAN
Definition: nls.h:84
LANGID WINAPI GetUserDefaultLangID(void)
Definition: lang.c:738
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
#define SetWindowLongPtrW
Definition: winuser.h:5336
static HBITMAP
Definition: button.c:44
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:40
BOOL WINAPI RegisterHotKey(_In_opt_ HWND, _In_ int, _In_ UINT, _In_ UINT)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define CSIDL_SYSTEM
Definition: shlobj.h:2048
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
BOOL WINAPI InitializeSetupActionLog(BOOL bDeleteOldLogFile)
Definition: logfile.c:42
GLfloat GLfloat p
Definition: glext.h:8902
#define DPRINT
Definition: sndvol32.h:71
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
static DWORD InstallLiveCD(VOID)
Definition: install.c:934
HRESULT WINAPI SHGetFolderPathAndSubDirW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPCWSTR pszSubPath, LPWSTR pszPath)
Definition: shellpath.c:2413
#define INFINITE
Definition: serial.h:102
#define ERROR_SERVICE_ALREADY_RUNNING
Definition: winerror.h:607
#define LR_DEFAULTCOLOR
Definition: winuser.h:1081
Arabic default style
Definition: afstyles.h:93
static VOID FatalError(char *pszFmt,...)
Definition: install.c:53
#define REG_DWORD
Definition: sdbapi.c:596
#define TOKEN_ADJUST_PRIVILEGES
Definition: setypes.h:926
#define LOCALE_S2359
Definition: winnls.h:72
#define LOCALE_STIMEFORMAT
Definition: winnls.h:62
BYTE * PBYTE
Definition: pedump.c:66
#define WM_INITDIALOG
Definition: winuser.h:1729
LPARAM lParam
Definition: combotst.c:139
#define HeapFree(x, y, z)
Definition: compat.h:594
static BOOL EnableUserModePnpManager(VOID)
Definition: install.c:485
#define RegCloseKey(hKey)
Definition: registry.h:47
#define SRCCOPY
Definition: wingdi.h:333
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
HBITMAP hLogoBitmap
Definition: gui.c:37
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
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
static const WCHAR szDescription[]
Definition: provider.c:55
int WINAPI MessageBoxA(_In_opt_ HWND hWnd, _In_opt_ LPCSTR lpText, _In_opt_ LPCSTR lpCaption, _In_ UINT uType)
static INT cyOld
Definition: eventvwr.c:4291
#define PRIMARYLANGID(l)
Definition: nls.h:16
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define LogItem(lpTag, lpMessageText...)
Definition: syssetup.h:98
#define REG_SZ
Definition: layer.c:22
#define CreateDialogParam
Definition: winuser.h:5742
BOOL WINAPI SetupGetStringFieldW(IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT PWSTR ReturnBuffer, IN ULONG ReturnBufferSize, OUT PULONG RequiredSize)
Definition: infsupp.c:184