ReactOS 0.4.17-dev-573-g8315b8c
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 * Whindmar Saksit <whindsaks@proton.me>
8 */
9
10/* INCLUDES *****************************************************************/
11
12#include "precomp.h"
13
14#define COBJMACROS
15
16#include <io.h>
17#include <wincon.h>
18#include <winnls.h>
19#include <winsvc.h>
20#include <userenv.h>
21#include <shlobj.h>
22#include <shlwapi.h>
23#include <shobjidl.h>
24#include <rpcproxy.h>
25#include <ndk/cmfuncs.h>
26
27#define NDEBUG
28#include <debug.h>
29
30//DWORD WINAPI
31//CMP_WaitNoPendingInstallEvents(DWORD dwTimeout);
32
34SetupStartService(LPCWSTR lpServiceName, BOOL bWait);
35
36/* GLOBALS ******************************************************************/
37
40
41typedef struct _DLG_DATA
42{
50
51/* FUNCTIONS ****************************************************************/
52
53static VOID
54FatalError(char *pszFmt,...)
55{
56 char szBuffer[512];
57 va_list ap;
58
59 va_start(ap, pszFmt);
60 vsprintf(szBuffer, pszFmt, ap);
61 va_end(ap);
62
63 LogItem(NULL, L"Failed");
64
65 strcat(szBuffer, "\nRebooting now!");
67 szBuffer,
68 "ReactOS Setup",
69 MB_OK);
70}
71
72static HRESULT
74 LPCWSTR pszLinkPath,
75 LPCWSTR pszCmd,
76 LPCWSTR pszArg,
78 LPCWSTR pszIconPath,
79 INT iIconNr,
80 LPCWSTR pszComment)
81{
82 IShellLinkW *psl;
83 IPersistFile *ppf;
84
85 HRESULT hr = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, &IID_IShellLink, (LPVOID*)&psl);
86
87 if (SUCCEEDED(hr))
88 {
89 hr = IShellLinkW_SetPath(psl, pszCmd);
90
91 if (pszArg)
92 hr = IShellLinkW_SetArguments(psl, pszArg);
93
94 if (pszDir)
95 hr = IShellLinkW_SetWorkingDirectory(psl, pszDir);
96
97 if (pszIconPath)
98 hr = IShellLinkW_SetIconLocation(psl, pszIconPath, iIconNr);
99
100 if (pszComment)
101 hr = IShellLinkW_SetDescription(psl, pszComment);
102
103 hr = IShellLinkW_QueryInterface(psl, &IID_IPersistFile, (LPVOID*)&ppf);
104
105 if (SUCCEEDED(hr))
106 {
107 hr = IPersistFile_Save(ppf, pszLinkPath, TRUE);
108 IPersistFile_Release(ppf);
109 }
110
111 IShellLinkW_Release(psl);
112 }
113
114 return hr;
115}
116
117
118static BOOL
120 LPCWSTR pszFolder,
121 LPCWSTR pszName,
122 LPCWSTR pszCommand,
123 LPCWSTR pszDescription,
124 INT iIconNr,
125 LPCWSTR pszWorkingDir,
126 LPCWSTR pszArgs)
127{
128 DWORD dwLen;
129 LPWSTR Ptr;
132 WCHAR szWorkingDirBuf[MAX_PATH];
133
134 /* If no working directory is provided, try to compute a default one */
135 if (pszWorkingDir == NULL || pszWorkingDir[0] == L'\0')
136 {
137 if (ExpandEnvironmentStringsW(pszCommand, szPath, ARRAYSIZE(szPath)) == 0)
138 wcscpy(szPath, pszCommand);
139
140 dwLen = GetFullPathNameW(szPath,
141 ARRAYSIZE(szWorkingDirBuf),
142 szWorkingDirBuf,
143 &lpFilePart);
144 if (dwLen != 0 && dwLen <= ARRAYSIZE(szWorkingDirBuf))
145 {
146 /* Since those should only be called with (.exe) files,
147 lpFilePart has not to be NULL */
149
150 /* We're only interested in the path. Cut the file name off.
151 Also remove the trailing backslash unless the working directory
152 is only going to be a drive, i.e. C:\ */
153 *(lpFilePart--) = L'\0';
154 if (!(lpFilePart - szWorkingDirBuf == 2 &&
155 szWorkingDirBuf[1] == L':' && szWorkingDirBuf[2] == L'\\'))
156 {
157 *lpFilePart = L'\0';
158 }
159 pszWorkingDir = szWorkingDirBuf;
160 }
161 }
162
163 /* If we failed to compute a working directory, just do not use one */
164 if (pszWorkingDir && pszWorkingDir[0] == L'\0')
165 pszWorkingDir = NULL;
166
167 /* Build the shortcut file name */
168 wcscpy(szPath, pszFolder);
170 wcscpy(Ptr, pszName);
171
172 /* Create the shortcut */
174 pszCommand,
175 pszArgs,
176 pszWorkingDir,
177 /* Special value to indicate no icon */
178 (iIconNr != -1 ? pszCommand : NULL),
179 iIconNr,
180 pszDescription));
181}
182
183
184static BOOL
186 _In_ PITEMSDATA pItemsData,
188 _In_ HINF hinf,
189 _In_ LPWSTR pszSection,
190 _In_ LPCWSTR pszFolder)
191{
193 DWORD dwFieldCount;
194 INT iIconNr;
195 WCHAR szCommand[MAX_PATH];
198 WCHAR szDirectory[MAX_PATH];
199 WCHAR szArgs[MAX_PATH];
200
201 if (!SetupFindFirstLine(hinf, pszSection, NULL, &Context))
202 return FALSE;
203
204 do
205 {
206 pNotify->Progress++;
207
208 SendMessage(pItemsData->hwndDlg, PM_STEP_START, 0, (LPARAM)pNotify);
209
210 dwFieldCount = SetupGetFieldCount(&Context);
211 if (dwFieldCount < 3)
212 continue;
213
214 if (!SetupGetStringFieldW(&Context, 1, szCommand, ARRAYSIZE(szCommand), NULL))
215 continue;
216
218 continue;
219
221 continue;
222
223 if (dwFieldCount < 4 || !SetupGetIntField(&Context, 4, &iIconNr))
224 iIconNr = -1; /* Special value to indicate no icon */
225
226 if (dwFieldCount < 5 || !SetupGetStringFieldW(&Context, 5, szDirectory, ARRAYSIZE(szDirectory), NULL))
227 szDirectory[0] = L'\0';
228
229 if (dwFieldCount < 6 || !SetupGetStringFieldW(&Context, 6, szArgs, ARRAYSIZE(szArgs), NULL))
230 szArgs[0] = L'\0';
231
232 wcscat(szName, L".lnk");
233
234 CreateShortcut(pszFolder, szName, szCommand, szDescription, iIconNr, szDirectory, szArgs);
235
236 SendMessage(pItemsData->hwndDlg, PM_STEP_END, 0, (LPARAM)pNotify);
237
238 } while (SetupFindNextLine(&Context, &Context));
239
240 return TRUE;
241}
242
243static BOOL
245 _In_ PITEMSDATA pItemsData,
247 _In_ HINF hinf,
248 _In_ LPCWSTR szSection)
249{
252 WCHAR szFolder[MAX_PATH];
253 WCHAR szFolderSection[MAX_PATH];
254 INT csidl;
255
257
258 if (!SetupFindFirstLine(hinf, szSection, NULL, &Context))
259 return FALSE;
260
261 do
262 {
263 if (SetupGetFieldCount(&Context) < 2)
264 continue;
265
266 if (!SetupGetStringFieldW(&Context, 0, szFolderSection, ARRAYSIZE(szFolderSection), NULL))
267 continue;
268
269 if (!SetupGetIntField(&Context, 1, &csidl))
270 continue;
271
272 if (!SetupGetStringFieldW(&Context, 2, szFolder, ARRAYSIZE(szFolder), NULL))
273 continue;
274
276 continue;
277
278 CreateShortcutsFromSection(pItemsData, pNotify, hinf, szFolderSection, szPath);
279
280 } while (SetupFindNextLine(&Context, &Context));
281
283
284 return TRUE;
285}
286
287static LONG
289 _In_ HINF hinf,
290 _In_ LPCWSTR szSection)
291{
293 WCHAR szFolderSection[MAX_PATH];
294 LONG Steps = 0;
295
296 if (!SetupFindFirstLine(hinf, szSection, NULL, &Context))
297 return FALSE;
298
299 do
300 {
301 if (SetupGetFieldCount(&Context) < 2)
302 continue;
303
304 if (!SetupGetStringFieldW(&Context, 0, szFolderSection, ARRAYSIZE(szFolderSection), NULL))
305 continue;
306
307 Steps += SetupGetLineCountW(hinf, szFolderSection);
308 } while (SetupFindNextLine(&Context, &Context));
309
310 return Steps;
311}
312
313VOID
315 _In_ PITEMSDATA pItemsData)
316{
317 HINF hShortcutsInf1 = INVALID_HANDLE_VALUE;
318 HINF hShortcutsInf2 = INVALID_HANDLE_VALUE;
319 LONG Steps = 0;
320 DWORD LastError = 0;
322
323 ZeroMemory(&Notify, sizeof(Notify));
324
325 hShortcutsInf1 = SetupOpenInfFileW(L"shortcuts.inf",
326 NULL,
328 NULL);
329 if (hShortcutsInf1 == INVALID_HANDLE_VALUE)
330 {
331 DPRINT1("Failed to open shortcuts.inf");
332 return;
333 }
334
335 hShortcutsInf2 = SetupOpenInfFileW(L"rosapps_shortcuts.inf",
336 NULL,
338 NULL);
339
340 Steps = CountShortcuts(hShortcutsInf1, L"ShortcutFolders");
341 if (hShortcutsInf2 != INVALID_HANDLE_VALUE)
342 Steps += CountShortcuts(hShortcutsInf2, L"ShortcutFolders");
343
344 SendMessage(pItemsData->hwndDlg, PM_ITEM_START, 1, (LPARAM)Steps);
345
346 if (!CreateShortcuts(pItemsData, &Notify, hShortcutsInf1, L"ShortcutFolders"))
347 {
348 DPRINT1("CreateShortcuts() failed");
349 goto done;
350 }
351
352 if (hShortcutsInf2 != INVALID_HANDLE_VALUE)
353 {
354 if (!CreateShortcuts(pItemsData, &Notify, hShortcutsInf2, L"ShortcutFolders"))
355 {
356 DPRINT1("CreateShortcuts(rosapps) failed");
357 goto done;
358 }
359 }
360
361done:
362 if (hShortcutsInf2 != INVALID_HANDLE_VALUE)
363 SetupCloseInfFile(hShortcutsInf2);
364
365 if (hShortcutsInf1 != INVALID_HANDLE_VALUE)
366 SetupCloseInfFile(hShortcutsInf1);
367
368 SendMessage(pItemsData->hwndDlg, PM_ITEM_END, 1, LastError);
369}
370
371static VOID
373 IN LPCWSTR VarName)
374{
375 WCHAR szTempDir[MAX_PATH];
376 WCHAR szBuffer[MAX_PATH];
378 HKEY hKey;
379
381 L"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment",
382 0,
384 &hKey) != ERROR_SUCCESS)
385 {
386 FatalError("Error: %lu\n", GetLastError());
387 return;
388 }
389
390 /* Get temp dir */
391 dwLength = sizeof(szBuffer);
393 VarName,
394 NULL,
395 NULL,
396 (LPBYTE)szBuffer,
398 {
399 FatalError("Error: %lu\n", GetLastError());
400 goto cleanup;
401 }
402
403 /* Expand it */
404 if (!ExpandEnvironmentStringsW(szBuffer, szTempDir, ARRAYSIZE(szTempDir)))
405 {
406 FatalError("Error: %lu\n", GetLastError());
407 goto cleanup;
408 }
409
410 /* Create profiles directory */
411 if (!CreateDirectoryW(szTempDir, NULL))
412 {
414 {
415 FatalError("Error: %lu\n", GetLastError());
416 goto cleanup;
417 }
418 }
419
420cleanup:
422}
423
424static BOOL
426{
427 INFCONTEXT InfContext;
428 WCHAR szLineBuffer[256];
429 DWORD dwLineLength;
430
432 L"DeviceInfsToInstall",
433 NULL,
434 &InfContext))
435 {
436 return FALSE;
437 }
438
439 do
440 {
441 if (!SetupGetStringFieldW(&InfContext,
442 0,
443 szLineBuffer,
444 ARRAYSIZE(szLineBuffer),
445 &dwLineLength))
446 {
447 return FALSE;
448 }
449
450 if (!SetupDiInstallClassW(NULL, szLineBuffer, DI_QUIETINSTALL, NULL))
451 {
452 return FALSE;
453 }
454 }
455 while (SetupFindNextLine(&InfContext, &InfContext));
456
457 return TRUE;
458}
459
460static BOOL
462{
463 INFCONTEXT InfContext;
464 WCHAR szNameBuffer[256];
465 WCHAR szSectionBuffer[256];
466 HINF hComponentInf = INVALID_HANDLE_VALUE;
467
469 L"Infs.Always",
470 NULL,
471 &InfContext))
472 {
473 DPRINT("No Inf.Always section found\n");
474 }
475 else
476 {
477 do
478 {
479 if (!SetupGetStringFieldW(&InfContext,
480 1, // Get the component name
481 szNameBuffer,
482 ARRAYSIZE(szNameBuffer),
483 NULL))
484 {
485 FatalError("Error while trying to get component name\n");
486 return FALSE;
487 }
488
489 if (!SetupGetStringFieldW(&InfContext,
490 2, // Get the component install section
491 szSectionBuffer,
492 ARRAYSIZE(szSectionBuffer),
493 NULL))
494 {
495 FatalError("Error while trying to get component install section\n");
496 return FALSE;
497 }
498
499 DPRINT("Trying to execute install section '%S' from '%S'\n", szSectionBuffer, szNameBuffer);
500
501 hComponentInf = SetupOpenInfFileW(szNameBuffer,
502 NULL,
504 NULL);
505
506 if (hComponentInf == INVALID_HANDLE_VALUE)
507 {
508 FatalError("SetupOpenInfFileW() failed to open '%S' (Error: %lu)\n", szNameBuffer, GetLastError());
509 return FALSE;
510 }
511
513 hComponentInf,
514 szSectionBuffer,
516 NULL,
517 NULL,
520 NULL,
521 NULL,
522 NULL))
523 {
524 FatalError("Error while trying to install : %S (Error: %lu)\n", szNameBuffer, GetLastError());
525 SetupCloseInfFile(hComponentInf);
526 return FALSE;
527 }
528
529 SetupCloseInfFile(hComponentInf);
530 }
531 while (SetupFindNextLine(&InfContext, &InfContext));
532 }
533
534 return TRUE;
535}
536
537
538
539BOOL
541 _In_ PITEMSDATA pItemsData,
543 _In_ HINF hinf,
544 _In_ LPCWSTR szSection)
545{
546 INFCONTEXT InfContext;
547 BOOL res;
550 INT csidl;
551 LPWSTR p;
553 HRESULT hret;
554
555 /* Begin iterating the entries in the inf section */
556 res = SetupFindFirstLine(hinf, szSection, NULL, &InfContext);
557 if (!res) return FALSE;
558
559 do
560 {
561 /* Get the name of the current type library */
562 if (!SetupGetStringFieldW(&InfContext, 1, szName, ARRAYSIZE(szName), NULL))
563 {
564 FatalError("SetupGetStringFieldW failed\n");
565 continue;
566 }
567
568 if (!SetupGetIntField(&InfContext, 2, &csidl))
569 csidl = CSIDL_SYSTEM;
570
571 hret = SHGetFolderPathW(NULL, csidl, NULL, 0, szPath);
572 if (FAILED(hret))
573 {
574 FatalError("SHGetFolderPathW failed hret=0x%lx\n", hret);
575 continue;
576 }
577
579 wcscpy(p, szName);
580
581 if (pItemsData && pNotify)
582 {
583 pNotify->Progress++;
584 pNotify->CurrentItem = szName;
585
586 DPRINT("RegisterTypeLibraries: Start step %ld\n", pNotify->Progress);
587 SendMessage(pItemsData->hwndDlg, PM_STEP_START, 0, (LPARAM)pNotify);
588 }
589
591 if (hmod == NULL)
592 {
593 FatalError("LoadLibraryW failed\n");
594 continue;
595 }
596
598
599 if (pItemsData && pNotify)
600 {
601 DPRINT("RegisterTypeLibraries: End step %ld\n", pNotify->Progress);
602 SendMessage(pItemsData->hwndDlg, PM_STEP_END, 0, (LPARAM)pNotify);
603 }
604
605 } while (SetupFindNextLine(&InfContext, &InfContext));
606
607 return TRUE;
608}
609
610static BOOL
612{
613 SC_HANDLE hSCManager = NULL;
614 SC_HANDLE hService = NULL;
616 BOOL bRet = FALSE;
617 DWORD BytesNeeded, WaitTime;
618
620 if (hSCManager == NULL)
621 {
622 DPRINT1("Unable to open the service control manager.\n");
623 DPRINT1("Last Error %d\n", GetLastError());
624 goto cleanup;
625 }
626
627 hService = OpenServiceW(hSCManager,
628 L"PlugPlay",
630 if (hService == NULL)
631 {
632 DPRINT1("Unable to open PlugPlay service\n");
633 goto cleanup;
634 }
635
636 bRet = ChangeServiceConfigW(hService,
640 NULL, NULL, NULL,
641 NULL, NULL, NULL, NULL);
642 if (!bRet)
643 {
644 DPRINT1("Unable to change the service configuration\n");
645 goto cleanup;
646 }
647
648 bRet = StartServiceW(hService, 0, NULL);
650 {
651 DPRINT1("Unable to start service\n");
652 goto cleanup;
653 }
654
655 while (TRUE)
656 {
657 bRet = QueryServiceStatusEx(hService,
660 sizeof(ServiceStatus),
661 &BytesNeeded);
662 if (!bRet)
663 {
664 DPRINT1("QueryServiceStatusEx() failed for PlugPlay service (error 0x%x)\n", GetLastError());
665 goto cleanup;
666 }
667
669 break;
670
671 WaitTime = ServiceStatus.dwWaitHint / 10;
672 if (WaitTime < 1000) WaitTime = 1000;
673 else if (WaitTime > 10000) WaitTime = 10000;
674 Sleep(WaitTime);
675 };
676
678 {
679 bRet = FALSE;
680 DPRINT1("Failed to start PlugPlay service\n");
681 goto cleanup;
682 }
683
684 bRet = TRUE;
685
686cleanup:
687 if (hService != NULL)
688 CloseServiceHandle(hService);
689 if (hSCManager != NULL)
691 return bRet;
692}
693
694static VOID
696{
697 INT xOld, yOld, cxOld, cyOld;
698 INT xNew, yNew, cxNew, cyNew;
699 INT cxLabel, cyLabel, dyLabel;
700 RECT rc, rcBar, rcLabel, rcWnd;
701 BITMAP bmLogo, bmBar;
702 DWORD style, exstyle;
703 HWND hwndLogo = GetDlgItem(hwndDlg, IDC_ROSLOGO);
704 HWND hwndBar = GetDlgItem(hwndDlg, IDC_BAR);
705 HWND hwndLabel = GetDlgItem(hwndDlg, IDC_STATUSLABEL);
706
707 /* This adjustment is for CJK only */
709 {
710 case LANG_CHINESE:
711 case LANG_JAPANESE:
712 case LANG_KOREAN:
713 break;
714
715 default:
716 return;
717 }
718
719 if (!GetObjectW(pDlgData->hLogoBitmap, sizeof(BITMAP), &bmLogo) ||
720 !GetObjectW(pDlgData->hBarBitmap, sizeof(BITMAP), &bmBar))
721 {
722 return;
723 }
724
725 GetWindowRect(hwndBar, &rcBar);
726 MapWindowPoints(NULL, hwndDlg, (LPPOINT)&rcBar, 2);
727 dyLabel = bmLogo.bmHeight - rcBar.top;
728
729 GetWindowRect(hwndLabel, &rcLabel);
730 MapWindowPoints(NULL, hwndDlg, (LPPOINT)&rcLabel, 2);
731 cxLabel = rcLabel.right - rcLabel.left;
732 cyLabel = rcLabel.bottom - rcLabel.top;
733
734 MoveWindow(hwndLogo, 0, 0, bmLogo.bmWidth, bmLogo.bmHeight, TRUE);
735 MoveWindow(hwndBar, 0, bmLogo.bmHeight, bmLogo.bmWidth, bmBar.bmHeight, TRUE);
736 MoveWindow(hwndLabel, rcLabel.left, rcLabel.top + dyLabel, cxLabel, cyLabel, TRUE);
737
738 GetWindowRect(hwndDlg, &rcWnd);
739 xOld = rcWnd.left;
740 yOld = rcWnd.top;
741 cxOld = rcWnd.right - rcWnd.left;
742 cyOld = rcWnd.bottom - rcWnd.top;
743
744 GetClientRect(hwndDlg, &rc);
745 SetRect(&rc, 0, 0, bmLogo.bmWidth, rc.bottom - rc.top); /* new client size */
746
748 exstyle = (DWORD)GetWindowLongPtrW(hwndDlg, GWL_EXSTYLE);
749 AdjustWindowRectEx(&rc, style, FALSE, exstyle);
750
751 cxNew = rc.right - rc.left;
752 cyNew = (rc.bottom - rc.top) + dyLabel;
753 xNew = xOld - (cxNew - cxOld) / 2;
754 yNew = yOld - (cyNew - cyOld) / 2;
755 MoveWindow(hwndDlg, xNew, yNew, cxNew, cyNew, TRUE);
756}
757
758static INT_PTR CALLBACK
760 IN HWND hwndDlg,
761 IN UINT uMsg,
764{
765 PDLG_DATA pDlgData;
767
768 pDlgData = (PDLG_DATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
769
770 /* pDlgData is required for each case except WM_INITDIALOG */
771 if (uMsg != WM_INITDIALOG && pDlgData == NULL) return FALSE;
772
773 switch (uMsg)
774 {
775 case WM_INITDIALOG:
776 {
777 BITMAP bm;
778 WCHAR szMsg[256];
779
780 /* Allocate pDlgData */
781 pDlgData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pDlgData));
782 if (pDlgData)
783 {
784 /* Set pDlgData to GWLP_USERDATA, so we can get it for new messages */
785 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)pDlgData);
786
787 /* Load bitmaps */
788 pDlgData->hLogoBitmap = LoadImageW(hDllInstance,
790 0, 0, LR_DEFAULTCOLOR);
791
792 pDlgData->hBarBitmap = LoadImageW(hDllInstance, MAKEINTRESOURCEW(IDB_LINE),
794 GetObject(pDlgData->hBarBitmap, sizeof(bm), &bm);
795 pDlgData->BarWidth = bm.bmWidth;
796 pDlgData->BarHeight = bm.bmHeight;
797
798 if (pDlgData->hLogoBitmap && pDlgData->hBarBitmap)
799 {
800 if (SetTimer(hwndDlg, IDT_BAR, 20, NULL) == 0)
801 {
802 DPRINT1("SetTimer(IDT_BAR) failed: %lu\n", GetLastError());
803 }
804
805 /* Get the animation bar control */
806 pDlgData->hWndBarCtrl = GetDlgItem(hwndDlg, IDC_BAR);
807 }
808 }
809
810 /* Get and set status text */
812 return FALSE;
813 SetDlgItemTextW(hwndDlg, IDC_STATUSLABEL, szMsg);
814
815 AdjustStatusMessageWindow(hwndDlg, pDlgData);
816 return TRUE;
817 }
818
819 case WM_TIMER:
820 {
821 if (pDlgData->hBarBitmap)
822 {
823 /*
824 * Default rotation bar image width is 413 (same as logo)
825 * We can divide 413 by 7 without remainder
826 */
827 pDlgData->BarCounter = (pDlgData->BarCounter + 7) % pDlgData->BarWidth;
829 UpdateWindow(pDlgData->hWndBarCtrl);
830 }
831 return TRUE;
832 }
833
834 case WM_DRAWITEM:
835 {
837
838 if (lpDis->CtlID != IDC_BAR)
839 {
840 return FALSE;
841 }
842
843 if (pDlgData->hBarBitmap)
844 {
845 HDC hdcMem;
846 HGDIOBJ hOld;
847 DWORD off = pDlgData->BarCounter;
848 DWORD iw = pDlgData->BarWidth;
849 DWORD ih = pDlgData->BarHeight;
850
851 hdcMem = CreateCompatibleDC(lpDis->hDC);
852 hOld = SelectObject(hdcMem, pDlgData->hBarBitmap);
853 BitBlt(lpDis->hDC, off, 0, iw - off, ih, hdcMem, 0, 0, SRCCOPY);
854 BitBlt(lpDis->hDC, 0, 0, off, ih, hdcMem, iw - off, 0, SRCCOPY);
855 SelectObject(hdcMem, hOld);
857 return TRUE;
858 }
859 return FALSE;
860 }
861
862 case WM_DESTROY:
863 {
864 if (pDlgData->hBarBitmap)
865 {
866 KillTimer(hwndDlg, IDT_BAR);
867 }
868
869 DeleteObject(pDlgData->hLogoBitmap);
870 DeleteObject(pDlgData->hBarBitmap);
871 HeapFree(GetProcessHeap(), 0, pDlgData);
872 return TRUE;
873 }
874 }
875 return FALSE;
876}
877
878static DWORD WINAPI
880 IN LPVOID lpParameter)
881{
882 HWND hWnd;
883 MSG Msg;
884 UNREFERENCED_PARAMETER(lpParameter);
885
890 (LPARAM)NULL);
891 if (!hWnd)
892 return 0;
893
895
896 /* Message loop for the Status window */
897 while (GetMessage(&Msg, NULL, 0, 0))
898 {
901 }
902
903 EndDialog(hWnd, 0);
904
905 return 0;
906}
907
908static LONG
910 IN HKEY hKey,
911 IN LPCWSTR pszKey,
913{
914 LONG rc;
915 DWORD dwType;
916 DWORD cbData = 0;
917 LPWSTR pwszValue;
918
919 if (!pValue)
921
922 *pValue = NULL;
923 rc = RegQueryValueExW(hKey, pszKey, NULL, &dwType, NULL, &cbData);
924 if (rc != ERROR_SUCCESS)
925 return rc;
926 if (dwType != REG_SZ)
928 pwszValue = HeapAlloc(GetProcessHeap(), 0, cbData + sizeof(WCHAR));
929 if (!pwszValue)
931 rc = RegQueryValueExW(hKey, pszKey, NULL, NULL, (LPBYTE)pwszValue, &cbData);
932 if (rc != ERROR_SUCCESS)
933 {
934 HeapFree(GetProcessHeap(), 0, pwszValue);
935 return rc;
936 }
937 /* NULL-terminate the string */
938 pwszValue[cbData / sizeof(WCHAR)] = '\0';
939
940 *pValue = pwszValue;
941 return ERROR_SUCCESS;
942}
943
944static BOOL
946{
947 HKEY hControlKey = NULL;
948 LPWSTR pwszSystemStartOptions = NULL;
949 LPWSTR pwszCurrentOption, pwszNextOption; /* Pointers into SystemStartOptions */
950 BOOL bConsoleBoot = FALSE;
951 LONG rc;
952
954 L"SYSTEM\\CurrentControlSet\\Control",
955 0,
957 &hControlKey);
958 if (rc != ERROR_SUCCESS)
959 goto cleanup;
960
961 rc = ReadRegSzKey(hControlKey, L"SystemStartOptions", &pwszSystemStartOptions);
962 if (rc != ERROR_SUCCESS)
963 goto cleanup;
964
965 /* Check for CONSOLE switch in SystemStartOptions */
966 pwszCurrentOption = pwszSystemStartOptions;
967 while (pwszCurrentOption)
968 {
969 pwszNextOption = wcschr(pwszCurrentOption, L' ');
970 if (pwszNextOption)
971 *pwszNextOption = L'\0';
972 if (_wcsicmp(pwszCurrentOption, L"CONSOLE") == 0)
973 {
974 DPRINT("Found %S. Switching to console boot\n", pwszCurrentOption);
975 bConsoleBoot = TRUE;
976 goto cleanup;
977 }
978 pwszCurrentOption = pwszNextOption ? pwszNextOption + 1 : NULL;
979 }
980
981cleanup:
982 if (hControlKey != NULL)
983 RegCloseKey(hControlKey);
984 if (pwszSystemStartOptions)
985 HeapFree(GetProcessHeap(), 0, pwszSystemStartOptions);
986 return bConsoleBoot;
987}
988
989static VOID
991 _In_ PCWSTR pszInf)
992{
993 WCHAR szInfApp[MAX_PATH], szInfArg[MAX_PATH * 3];
994 WCHAR szCmd[_countof(szInfApp) + _countof(szInfArg)];
995 UINT cch;
996
997 if (!GetPrivateProfileStringW(L"GuiUnattended", L"DetachedProgram", L"", szInfApp, _countof(szInfApp), pszInf) || !*szInfApp)
998 return;
999 cch = ExpandEnvironmentStrings(szInfApp, szCmd, _countof(szCmd) - 1);
1000 if (GetPrivateProfileStringW(L"GuiUnattended", L"Arguments", L"", szInfArg, _countof(szInfArg), pszInf) && cch)
1001 {
1002 szCmd[cch - 1] = L' ';
1003 szCmd[cch] = UNICODE_NULL;
1004 ExpandEnvironmentStrings(szInfArg, szCmd + cch, _countof(szCmd) - cch);
1005 }
1006 RunCommandAndWait(szCmd);
1007}
1008
1009extern VOID
1012 _In_opt_ PCWSTR ThemeFile);
1013
1022static VOID
1024 _In_ BOOL IsInstall)
1025{
1027 WCHAR szValue[MAX_PATH];
1028 BOOL bDefaultThemesOff;
1029
1030 if (IsInstall)
1031 {
1032 /* See also wizard.c!ProcessSetupInf()
1033 * Retrieve the path of the setup INF */
1035 }
1036 else
1037 {
1038 /* See also userinit/livecd.c!RunLiveCD() */
1040 wcscat(szPath, L"\\unattend.inf");
1041 }
1042
1043 /*
1044 * Apply initial default theming
1045 */
1046
1047 /* Check whether to use the classic theme (TRUE) instead of the default theme */
1048 bDefaultThemesOff = FALSE;
1049 if (GetPrivateProfileStringW(L"Shell", L"DefaultThemesOff", L"no", szValue, _countof(szValue), szPath) && *szValue)
1050 bDefaultThemesOff = (_wcsicmp(szValue, L"yes") == 0);
1051
1052 if (!bDefaultThemesOff)
1053 {
1054 /* Retrieve the complete path to a .theme (or for ReactOS, a .msstyles) file */
1055 if (!GetPrivateProfileStringW(L"Shell", L"CustomDefaultThemeFile", NULL, szValue, _countof(szValue), szPath) || !*szValue)
1056 bDefaultThemesOff = TRUE; // None specified, fall back to the classic theme.
1057 }
1058
1059 /* Enable the chosen theme, or use the classic theme */
1060 EnableVisualTheme(NULL, bDefaultThemesOff ? NULL : szValue);
1061
1062 if (IsInstall)
1064}
1065
1066static BOOL
1068{
1070 BOOL bResult = FALSE;
1071
1072 hSysSetupInf = SetupOpenInfFileW(L"syssetup.inf",
1073 NULL,
1075 NULL);
1077 {
1078 FatalError("SetupOpenInfFileW() failed to open 'syssetup.inf' (Error: %lu)\n", GetLastError());
1079 return FALSE;
1080 }
1081
1083 {
1084 FatalError("InstallSysSetupInfDevices() failed!\n");
1085 goto Exit;
1086 }
1087
1089 {
1090 FatalError("InstallSysSetupInfComponents() failed!\n");
1091 goto Exit;
1092 }
1093
1094 if (!IsConsoleBoot())
1095 {
1097 0,
1099 NULL,
1100 0,
1101 NULL);
1102 }
1103
1105 {
1106 FatalError("EnableUserModePnpManager() failed!\n");
1107 goto Exit;
1108 }
1109
1111 {
1112 FatalError("CMP_WaitNoPendingInstallEvents() failed!\n");
1113 goto Exit;
1114 }
1115
1116 bResult = TRUE;
1117
1118Exit:
1119 if (bResult == FALSE)
1120 {
1122 }
1123
1124 if (hThread != NULL)
1125 {
1129 }
1130
1131 return bResult;
1132}
1133
1134static
1135DWORD
1137{
1138 STARTUPINFOW StartupInfo;
1139 PROCESS_INFORMATION ProcessInformation;
1140 BOOL bRes;
1141
1143 if (!CommonInstall())
1144 goto error;
1145
1146 /* Install the TCP/IP protocol driver */
1147 bRes = InstallNetworkComponent(L"MS_TCPIP");
1148 if (!bRes && GetLastError() != ERROR_FILE_NOT_FOUND)
1149 {
1150 DPRINT("InstallNetworkComponent() failed with error 0x%lx\n", GetLastError());
1151 }
1152 else
1153 {
1154 /* Start the TCP/IP protocol driver */
1155 SetupStartService(L"Tcpip", FALSE);
1156 SetupStartService(L"Dhcp", FALSE);
1157 SetupStartService(L"Dnscache", FALSE);
1158 }
1159
1160 /* Register components */
1161 _SEH2_TRY
1162 {
1164 hSysSetupInf, L"RegistrationPhase2",
1165 SPINST_ALL,
1166 0, NULL, 0, NULL, NULL, NULL, NULL))
1167 {
1168 DPRINT1("SetupInstallFromInfSectionW failed!\n");
1169 }
1170
1171 RegisterTypeLibraries(NULL, NULL, hSysSetupInf, L"TypeLibraries");
1172 }
1174 {
1175 DPRINT1("Catching exception\n");
1176 }
1177 _SEH2_END;
1178
1180
1181 /* Run the shell */
1182 ZeroMemory(&StartupInfo, sizeof(StartupInfo));
1183 StartupInfo.cb = sizeof(StartupInfo);
1184 bRes = CreateProcessW(L"userinit.exe",
1185 NULL,
1186 NULL,
1187 NULL,
1188 FALSE,
1189 0,
1190 NULL,
1191 NULL,
1192 &StartupInfo,
1193 &ProcessInformation);
1194 if (!bRes)
1195 goto error;
1196
1197 CloseHandle(ProcessInformation.hThread);
1198 CloseHandle(ProcessInformation.hProcess);
1199
1200 return 0;
1201
1202error:
1204 NULL,
1205 L"Failed to load LiveCD! You can shutdown your computer, or press ENTER to reboot.",
1206 L"ReactOS LiveCD",
1207 MB_OK);
1208 return 0;
1209}
1210
1211
1212static BOOL
1214{
1215 DWORD dwError;
1216 HKEY hKey;
1217
1218 dwError = RegOpenKeyExW(
1220 L"SYSTEM\\Setup",
1221 0,
1223 &hKey);
1224 if (dwError != ERROR_SUCCESS)
1225 return FALSE;
1226
1227 dwError = RegSetValueExW(
1228 hKey,
1229 L"SetupType",
1230 0,
1231 REG_DWORD,
1232 (LPBYTE)&dwSetupType,
1233 sizeof(DWORD));
1235 if (dwError != ERROR_SUCCESS)
1236 return FALSE;
1237
1238 return TRUE;
1239}
1240
1241static DWORD CALLBACK
1243{
1244 ATOM hotkey;
1245 MSG msg;
1246
1247 DPRINT("HotkeyThread start\n");
1248
1249 hotkey = GlobalAddAtomW(L"Setup Shift+F10 Hotkey");
1250 if (!RegisterHotKey(NULL, hotkey, MOD_SHIFT, VK_F10))
1251 DPRINT1("RegisterHotKey failed with %lu\n", GetLastError());
1252
1253 while (GetMessageW(&msg, NULL, 0, 0))
1254 {
1255 if (msg.hwnd == NULL && msg.message == WM_HOTKEY && msg.wParam == hotkey)
1256 {
1257 WCHAR CmdLine[] = L"cmd.exe"; // CreateProcess can modify this buffer.
1258 STARTUPINFOW si = { sizeof(si) };
1260
1261 if (CreateProcessW(NULL,
1262 CmdLine,
1263 NULL,
1264 NULL,
1265 FALSE,
1267 NULL,
1268 NULL,
1269 &si,
1270 &pi))
1271 {
1274 }
1275 else
1276 {
1277 DPRINT1("Failed to launch command prompt: %lu\n", GetLastError());
1278 }
1279 }
1280 }
1281
1282 UnregisterHotKey(NULL, hotkey);
1283 GlobalDeleteAtom(hotkey);
1284
1285 DPRINT("HotkeyThread terminate\n");
1286 return 0;
1287}
1288
1289
1290static
1291BOOL
1293{
1294 LONG Error;
1295 HKEY hKey;
1297 WCHAR szProgramFilesDirPath[MAX_PATH];
1298 WCHAR szCommonFilesDirPath[MAX_PATH];
1299 WCHAR szBuffer[MAX_PATH];
1300
1301 /* Load 'Program Files' location */
1304 szBuffer,
1305 ARRAYSIZE(szBuffer)))
1306 {
1307 DPRINT1("Error: %lu\n", GetLastError());
1308 return FALSE;
1309 }
1310
1313 szCommonFilesDirPath,
1314 ARRAYSIZE(szCommonFilesDirPath)))
1315 {
1316 DPRINT1("Warning: %lu\n", GetLastError());
1317 }
1318
1319 /* Expand it */
1320 if (!ExpandEnvironmentStringsW(szBuffer,
1321 szProgramFilesDirPath,
1322 ARRAYSIZE(szProgramFilesDirPath)))
1323 {
1324 DPRINT1("Error: %lu\n", GetLastError());
1325 return FALSE;
1326 }
1327
1328 wcscpy(szBuffer, szProgramFilesDirPath);
1329 wcscat(szBuffer, L"\\");
1330 wcscat(szBuffer, szCommonFilesDirPath);
1331
1332 if (!ExpandEnvironmentStringsW(szBuffer,
1333 szCommonFilesDirPath,
1334 ARRAYSIZE(szCommonFilesDirPath)))
1335 {
1336 DPRINT1("Warning: %lu\n", GetLastError());
1337 }
1338
1339 /* Store it */
1341 L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion",
1342 0,
1344 &hKey);
1345 if (Error != ERROR_SUCCESS)
1346 {
1347 DPRINT1("Error: %lu\n", Error);
1348 return FALSE;
1349 }
1350
1351 dwLength = (wcslen(szProgramFilesDirPath) + 1) * sizeof(WCHAR);
1353 L"ProgramFilesDir",
1354 0,
1355 REG_SZ,
1356 (LPBYTE)szProgramFilesDirPath,
1357 dwLength);
1358 if (Error != ERROR_SUCCESS)
1359 {
1360 DPRINT1("Error: %lu\n", Error);
1362 return FALSE;
1363 }
1364
1365 dwLength = (wcslen(szCommonFilesDirPath) + 1) * sizeof(WCHAR);
1367 L"CommonFilesDir",
1368 0,
1369 REG_SZ,
1370 (LPBYTE)szCommonFilesDirPath,
1371 dwLength);
1372 if (Error != ERROR_SUCCESS)
1373 {
1374 DPRINT1("Warning: %lu\n", Error);
1375 }
1376
1378
1379 /* Create directory */
1380 // FIXME: Security!
1381 if (!CreateDirectoryW(szProgramFilesDirPath, NULL))
1382 {
1384 {
1385 DPRINT1("Error: %lu\n", GetLastError());
1386 return FALSE;
1387 }
1388 }
1389
1390 /* Create directory */
1391 // FIXME: Security!
1392 if (!CreateDirectoryW(szCommonFilesDirPath, NULL))
1393 {
1395 {
1396 DPRINT1("Warning: %lu\n", GetLastError());
1397 // return FALSE;
1398 }
1399 }
1400
1401 return TRUE;
1402}
1403
1404
1405static
1406VOID
1408{
1409 WCHAR szBuffer[80];
1410 PWSTR ptr;
1411 HKEY hLocaleKey;
1412 DWORD ret;
1413 DWORD dwSize;
1414 LCID lcid;
1415 INT i;
1416
1417 struct {LCTYPE LCType; PWSTR pValue;} LocaleData[] = {
1418 /* Number */
1419 {LOCALE_SDECIMAL, L"sDecimal"},
1420 {LOCALE_STHOUSAND, L"sThousand"},
1421 {LOCALE_SNEGATIVESIGN, L"sNegativeSign"},
1422 {LOCALE_SPOSITIVESIGN, L"sPositiveSign"},
1423 {LOCALE_SGROUPING, L"sGrouping"},
1424 {LOCALE_SLIST, L"sList"},
1425 {LOCALE_SNATIVEDIGITS, L"sNativeDigits"},
1426 {LOCALE_INEGNUMBER, L"iNegNumber"},
1427 {LOCALE_IDIGITS, L"iDigits"},
1428 {LOCALE_ILZERO, L"iLZero"},
1429 {LOCALE_IMEASURE, L"iMeasure"},
1430 {LOCALE_IDIGITSUBSTITUTION, L"NumShape"},
1431
1432 /* Currency */
1433 {LOCALE_SCURRENCY, L"sCurrency"},
1434 {LOCALE_SMONDECIMALSEP, L"sMonDecimalSep"},
1435 {LOCALE_SMONTHOUSANDSEP, L"sMonThousandSep"},
1436 {LOCALE_SMONGROUPING, L"sMonGrouping"},
1437 {LOCALE_ICURRENCY, L"iCurrency"},
1438 {LOCALE_INEGCURR, L"iNegCurr"},
1439 {LOCALE_ICURRDIGITS, L"iCurrDigits"},
1440
1441 /* Time */
1442 {LOCALE_STIMEFORMAT, L"sTimeFormat"},
1443 {LOCALE_STIME, L"sTime"},
1444 {LOCALE_S1159, L"s1159"},
1445 {LOCALE_S2359, L"s2359"},
1446 {LOCALE_ITIME, L"iTime"},
1447 {LOCALE_ITIMEMARKPOSN, L"iTimePrefix"},
1448 {LOCALE_ITLZERO, L"iTLZero"},
1449
1450 /* Date */
1451 {LOCALE_SLONGDATE, L"sLongDate"},
1452 {LOCALE_SSHORTDATE, L"sShortDate"},
1453 {LOCALE_SDATE, L"sDate"},
1454 {LOCALE_IFIRSTDAYOFWEEK, L"iFirstDayOfWeek"},
1455 {LOCALE_IFIRSTWEEKOFYEAR, L"iFirstWeekOfYear"},
1456 {LOCALE_IDATE, L"iDate"},
1457 {LOCALE_ICALENDARTYPE, L"iCalendarType"},
1458
1459 /* Misc */
1460 {LOCALE_SCOUNTRY, L"sCountry"},
1461 {LOCALE_SABBREVLANGNAME, L"sLanguage"},
1462 {LOCALE_ICOUNTRY, L"iCountry"},
1463 {0, NULL}};
1464
1466 L".DEFAULT\\Control Panel\\International",
1467 0,
1469 &hLocaleKey);
1470 if (ret != ERROR_SUCCESS)
1471 {
1472 return;
1473 }
1474
1475 dwSize = 9 * sizeof(WCHAR);
1476 ret = RegQueryValueExW(hLocaleKey,
1477 L"Locale",
1478 NULL,
1479 NULL,
1480 (PBYTE)szBuffer,
1481 &dwSize);
1482 if (ret != ERROR_SUCCESS)
1483 goto done;
1484
1485 lcid = (LCID)wcstoul(szBuffer, &ptr, 16);
1486 if (lcid == 0)
1487 goto done;
1488
1489 i = 0;
1490 while (LocaleData[i].pValue != NULL)
1491 {
1492 if (GetLocaleInfoW(lcid,
1493 LocaleData[i].LCType | LOCALE_NOUSEROVERRIDE,
1494 szBuffer,
1495 ARRAYSIZE(szBuffer)))
1496 {
1497 RegSetValueExW(hLocaleKey,
1498 LocaleData[i].pValue,
1499 0,
1500 REG_SZ,
1501 (PBYTE)szBuffer,
1502 (wcslen(szBuffer) + 1) * sizeof(WCHAR));
1503 }
1504
1505 i++;
1506 }
1507
1508done:
1509 RegCloseKey(hLocaleKey);
1510}
1511
1512
1513static
1514DWORD
1516{
1517 WCHAR szDefaultUserHive[MAX_PATH];
1518 HKEY hUserKey = NULL;
1519 DWORD cchSize;
1520 DWORD dwError;
1521
1522 DPRINT("SaveDefaultUserHive()\n");
1523
1524 cchSize = ARRAYSIZE(szDefaultUserHive);
1525 GetDefaultUserProfileDirectoryW(szDefaultUserHive, &cchSize);
1526
1527 wcscat(szDefaultUserHive, L"\\ntuser.dat");
1528
1529 dwError = RegOpenKeyExW(HKEY_USERS,
1530 L".DEFAULT",
1531 0,
1532 KEY_READ,
1533 &hUserKey);
1534 if (dwError != ERROR_SUCCESS)
1535 {
1536 DPRINT1("RegOpenKeyExW() failed (Error %lu)\n", dwError);
1537 return dwError;
1538 }
1539
1540 pSetupEnablePrivilege(L"SeBackupPrivilege", TRUE);
1541
1542 /* Save the Default hive */
1543 dwError = RegSaveKeyExW(hUserKey,
1544 szDefaultUserHive,
1545 NULL,
1547 if (dwError == ERROR_ALREADY_EXISTS)
1548 {
1549 WCHAR szBackupHive[MAX_PATH];
1550
1551 /* Build the backup hive file name by replacing the extension */
1552 wcscpy(szBackupHive, szDefaultUserHive);
1553 wcscpy(&szBackupHive[wcslen(szBackupHive) - 4], L".bak");
1554
1555 /* Back up the existing default user hive by renaming it, replacing any possible existing old backup */
1556 if (!MoveFileExW(szDefaultUserHive,
1557 szBackupHive,
1559 {
1560 dwError = GetLastError();
1561 DPRINT1("Failed to create a default-user hive backup '%S', MoveFileExW failed (Error %lu)\n",
1562 szBackupHive, dwError);
1563 }
1564 else
1565 {
1566 /* The backup has been done, retry saving the Default hive */
1567 dwError = RegSaveKeyExW(hUserKey,
1568 szDefaultUserHive,
1569 NULL,
1571 }
1572 }
1573 if (dwError != ERROR_SUCCESS)
1574 {
1575 DPRINT1("RegSaveKeyExW() failed (Error %lu)\n", dwError);
1576 }
1577
1578 pSetupEnablePrivilege(L"SeBackupPrivilege", FALSE);
1579
1580 RegCloseKey(hUserKey);
1581
1582 return dwError;
1583}
1584
1585
1586static
1587DWORD
1589{
1590 WCHAR szBuffer[MAX_PATH];
1591 HANDLE token;
1592 TOKEN_PRIVILEGES privs;
1593 HKEY hKey;
1594 HANDLE hHotkeyThread;
1595 BOOL ret;
1596
1598 LogItem(NULL, L"Installing ReactOS");
1599
1600 CreateTempDir(L"TEMP");
1601 CreateTempDir(L"TMP");
1602
1604 {
1605 FatalError("InitializeProgramFilesDir() failed");
1606 return 0;
1607 }
1608
1609 if (!InitializeProfiles())
1610 {
1611 FatalError("InitializeProfiles() failed");
1612 return 0;
1613 }
1614
1616
1617 if (GetWindowsDirectoryW(szBuffer, ARRAYSIZE(szBuffer)))
1618 {
1620 L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion",
1621 0,
1622 KEY_WRITE,
1623 &hKey) == ERROR_SUCCESS)
1624 {
1626 L"PathName",
1627 0,
1628 REG_SZ,
1629 (LPBYTE)szBuffer,
1630 (wcslen(szBuffer) + 1) * sizeof(WCHAR));
1631
1633 L"SystemRoot",
1634 0,
1635 REG_SZ,
1636 (LPBYTE)szBuffer,
1637 (wcslen(szBuffer) + 1) * sizeof(WCHAR));
1638
1640 }
1641
1642 PathAddBackslash(szBuffer);
1643 wcscat(szBuffer, L"system");
1644 CreateDirectory(szBuffer, NULL);
1645 }
1646
1648 {
1649 FatalError("SaveDefaultUserHive() failed");
1650 return 0;
1651 }
1652
1653 if (!CopySystemProfile(0))
1654 {
1655 FatalError("CopySystemProfile() failed");
1656 return 0;
1657 }
1658
1659 hHotkeyThread = CreateThread(NULL, 0, HotkeyThread, NULL, 0, NULL);
1660
1662 if (!CommonInstall())
1663 return 0;
1664
1665 /* Install the TCP/IP protocol driver */
1666 ret = InstallNetworkComponent(L"MS_TCPIP");
1668 {
1669 DPRINT("InstallNetworkComponent() failed with error 0x%lx\n", GetLastError());
1670 }
1671 else
1672 {
1673 /* Start the TCP/IP protocol driver */
1674 SetupStartService(L"Tcpip", FALSE);
1675 SetupStartService(L"Dhcp", FALSE);
1676 SetupStartService(L"Dnscache", FALSE);
1677 }
1678
1679 InstallWizard();
1680
1682
1684 SetSetupType(0);
1685
1686 if (hHotkeyThread)
1687 {
1688 PostThreadMessage(GetThreadId(hHotkeyThread), WM_QUIT, 0, 0);
1689 CloseHandle(hHotkeyThread);
1690 }
1691
1692 LogItem(NULL, L"Installing ReactOS done");
1694
1695 if (AdminInfo.Name != NULL)
1696 RtlFreeHeap(RtlGetProcessHeap(), 0, AdminInfo.Name);
1697
1698 if (AdminInfo.Domain != NULL)
1699 RtlFreeHeap(RtlGetProcessHeap(), 0, AdminInfo.Domain);
1700
1701 if (AdminInfo.Password != NULL)
1702 RtlFreeHeap(RtlGetProcessHeap(), 0, AdminInfo.Password);
1703
1704 /* Get shutdown privilege */
1706 {
1707 FatalError("OpenProcessToken() failed!");
1708 return 0;
1709 }
1712 &privs.Privileges[0].Luid))
1713 {
1714 FatalError("LookupPrivilegeValue() failed!");
1715 return 0;
1716 }
1717 privs.PrivilegeCount = 1;
1720 FALSE,
1721 &privs,
1722 0,
1724 NULL) == 0)
1725 {
1726 FatalError("AdjustTokenPrivileges() failed!");
1727 return 0;
1728 }
1729
1731 return 0;
1732}
1733
1734
1735/*
1736 * Standard Windows-compatible export, which dispatches
1737 * to either 'InstallReactOS' or 'InstallLiveCD'.
1738 */
1739INT
1740WINAPI
1742{
1743 INT i;
1744 PWSTR p;
1745
1746 for (i = 0; i < argc; ++i)
1747 {
1748 p = argv[i];
1749 if (*p == L'-')
1750 {
1751 p++;
1752
1753 // NOTE: On Windows, "mini" means "minimal UI", and can be used
1754 // in addition to "newsetup"; these options are not exclusive.
1755 if (_wcsicmp(p, L"newsetup") == 0)
1756 return (INT)InstallReactOS();
1757 else if (_wcsicmp(p, L"mini") == 0)
1758 return (INT)InstallLiveCD();
1759
1760 /* Add support for other switches */
1761 }
1762 }
1763
1764 return 0;
1765}
1766
1767
1768/*
1769 * @unimplemented
1770 */
1773 IN HANDLE hWnd,
1774 IN LPCWSTR lpszFontSize)
1775{
1777 return FALSE;
1778}
1779
1780/*
1781 * @unimplemented
1782 */
1785 LCID Lcid,
1786 LPCWSTR lpSrcRootPath,
1787 char Unknown,
1788 DWORD dwUnused1,
1789 DWORD dwUnused2)
1790{
1792 return FALSE;
1793}
1794
1795/*
1796 * @implemented
1797 */
1800{
1801 return SetupChangeLocaleEx(hWnd, Lcid, NULL, 0, 0, 0);
1802}
1803
1804
1805DWORD
1806WINAPI
1808 LPCWSTR lpServiceName,
1809 BOOL bWait)
1810{
1811 SC_HANDLE hManager = NULL;
1812 SC_HANDLE hService = NULL;
1813 DWORD dwError = ERROR_SUCCESS;
1814
1815 hManager = OpenSCManagerW(NULL,
1816 NULL,
1818 if (hManager == NULL)
1819 {
1820 dwError = GetLastError();
1821 goto done;
1822 }
1823
1824 hService = OpenServiceW(hManager,
1825 lpServiceName,
1827 if (hService == NULL)
1828 {
1829 dwError = GetLastError();
1830 goto done;
1831 }
1832
1833 if (!StartService(hService, 0, NULL))
1834 {
1835 dwError = GetLastError();
1836 goto done;
1837 }
1838
1839done:
1840 if (hService != NULL)
1841 CloseServiceHandle(hService);
1842
1843 if (hManager != NULL)
1844 CloseServiceHandle(hManager);
1845
1846 return dwError;
1847}
Arabic default style
Definition: afstyles.h:94
#define msg(x)
Definition: auth_time.c:54
HWND hWnd
Definition: settings.c:17
#define DPRINT1
Definition: precomp.h:8
HRESULT __wine_register_resources(HMODULE module)
Definition: register.c:112
static SERVICE_STATUS ServiceStatus
Definition: browser.c:23
static LONG ReadRegSzKey(IN HKEY hKey, IN LPCWSTR pszKey, OUT LPWSTR *pValue)
Definition: install.c:253
static BOOL IsConsoleBoot(VOID)
Definition: install.c:471
BOOL Error
Definition: chkdsk.c:66
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:634
#define RegCloseKey(hKey)
Definition: registry.h:49
DWORD WINAPI CMP_WaitNoPendingInstallEvents(_In_ DWORD dwTimeout)
Definition: cfgmgr.c:831
static HINSTANCE hDllInstance
Definition: clb.c:9
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
struct @1791 Msg[]
static HWND hwndParent
Definition: cryptui.c:299
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
HRESULT hr
Definition: delayimp.cpp:582
#define ERROR_SUCCESS
Definition: deptool.c:10
WORD ATOM
Definition: dimm.idl:113
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
BOOL WINAPI SHIM_OBJ_NAME() Notify(DWORD fdwReason, PVOID ptr)
static const WCHAR szDescription[]
Definition: provider.c:55
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
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:4882
LONG WINAPI RegSaveKeyExW(HKEY hKey, LPCWSTR lpFile, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD Flags)
Definition: reg.c:4730
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
BOOL WINAPI AdjustTokenPrivileges(HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength)
Definition: security.c:374
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:294
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: combase.c:2842
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, IUnknown *outer, DWORD cls_context, REFIID riid, void **obj)
Definition: combase.c:1685
#define CloseHandle
Definition: compat.h:739
#define wcschr
Definition: compat.h:17
#define GetProcessHeap()
Definition: compat.h:736
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define SetLastError(x)
Definition: compat.h:752
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define HeapAlloc
Definition: compat.h:733
#define GetCurrentProcess()
Definition: compat.h:759
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define CALLBACK
Definition: compat.h:35
#define LoadLibraryW(x)
Definition: compat.h:747
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
static DWORD DWORD * dwLength
Definition: fusion.c:86
static void cleanup(void)
Definition: main.c:1335
ATOM WINAPI GlobalDeleteAtom(ATOM nAtom)
Definition: atom.c:444
ATOM WINAPI GlobalAddAtomW(LPCWSTR lpString)
Definition: atom.c:434
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:492
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:58
BOOL WINAPI MoveFileExW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName OPTIONAL, IN DWORD dwFlags)
Definition: move.c:1074
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
Definition: path.c:1106
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2271
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:4441
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
DWORD WINAPI GetThreadId(IN HANDLE Thread)
Definition: thread.c:913
INT WINAPI GetPrivateProfileStringW(LPCWSTR section, LPCWSTR entry, LPCWSTR def_val, LPWSTR buffer, UINT len, LPCWSTR filename)
Definition: profile.c:1142
LANGID WINAPI GetUserDefaultLangID(void)
Definition: locale.c:1182
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: locale.c:1675
LCID lcid
Definition: locale.c:5660
MonoAssembly int argc
Definition: metahost.c:107
#define IDT_BAR
Definition: gui.c:32
#define IDC_ROSLOGO
Definition: resource.h:69
#define IDC_BAR
Definition: resource.h:70
_ACRTIMP __msvcrt_ulong __cdecl wcstoul(const wchar_t *, wchar_t **, int)
Definition: wcs.c:2917
_ACRTIMP int __cdecl _wcsicmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:164
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2988
#define va_end(v)
Definition: stdarg.h:28
#define va_start(v, l)
Definition: stdarg.h:26
_ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl vsprintf(char *, const char *, va_list) __WINE_CRT_PRINTF_ATTR(2
char * va_list
Definition: vadefs.h:50
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:531
BOOL WINAPI SetupDiInstallClassW(HWND hwndParent, PCWSTR InfFileName, DWORD Flags, HSPFILEQ FileQueue)
Definition: devinst.c:3651
static const WCHAR CmdLine[]
Definition: install.c:48
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:1330
BOOL WINAPI pSetupEnablePrivilege(LPCWSTR lpPrivilegeName, BOOL bEnable)
Definition: misc.c:440
HINF WINAPI SetupOpenInfFileW(PCWSTR name, PCWSTR class, DWORD style, UINT *error)
Definition: parser.c:1229
LONG WINAPI SetupGetLineCountW(HINF hinf, PCWSTR section)
Definition: parser.c:1501
UINT WINAPI SetupDefaultQueueCallbackW(PVOID context, UINT notification, UINT_PTR param1, UINT_PTR param2)
Definition: queue.c:1729
HRESULT WINAPI SHGetFolderPathW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath)
Definition: shellpath.c:2717
HRESULT WINAPI SHGetFolderPathAndSubDirW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPCWSTR pszSubPath, LPWSTR pszPath)
Definition: shellpath.c:2782
VOID SetAutoAdminLogon(VOID)
Definition: security.c:1831
#define PM_STEP_START
Definition: globals.h:62
VOID GetSetupInfPath(PWSTR szPath, UINT cchMax)
Definition: wizard.c:57
#define PM_ITEM_START
Definition: globals.h:52
#define PM_ITEM_END
Definition: globals.h:57
#define PM_STEP_END
Definition: globals.h:63
VOID InstallWizard(VOID)
Definition: wizard.c:3473
static BOOL CreateShortcut(LPCWSTR pszFolder, LPCWSTR pszName, LPCWSTR pszCommand, LPCWSTR pszDescription, INT iIconNr, LPCWSTR pszWorkingDir, LPCWSTR pszArgs)
Definition: install.c:119
static BOOL EnableUserModePnpManager(VOID)
Definition: install.c:611
DWORD WINAPI SetupChangeLocale(HWND hWnd, LCID Lcid)
Definition: install.c:1799
static BOOL CreateShortcuts(_In_ PITEMSDATA pItemsData, _In_ PREGISTRATIONNOTIFY pNotify, _In_ HINF hinf, _In_ LPCWSTR szSection)
Definition: install.c:244
static VOID InitializeDefaultUserLocale(VOID)
Definition: install.c:1407
static DWORD SaveDefaultUserHive(VOID)
Definition: install.c:1515
struct _DLG_DATA * PDLG_DATA
static BOOL InstallSysSetupInfComponents(VOID)
Definition: install.c:461
static BOOL CommonInstall(VOID)
Definition: install.c:1067
VOID EnableVisualTheme(_In_opt_ HWND hwndParent, _In_opt_ PCWSTR ThemeFile)
Definition: wizard.c:1460
static INT_PTR CALLBACK StatusMessageWindowProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: install.c:759
static VOID PreprocessUnattend(_In_ BOOL IsInstall)
Pre-process unattended file to apply early settings.
Definition: install.c:1023
static BOOL InstallSysSetupInfDevices(VOID)
Definition: install.c:425
ADMIN_INFO AdminInfo
Definition: install.c:39
static VOID ProcessDetachedProgram(_In_ PCWSTR pszInf)
Definition: install.c:990
DWORD WINAPI SetupStartService(LPCWSTR lpServiceName, BOOL bWait)
Definition: install.c:1807
INT WINAPI InstallWindowsNt(INT argc, WCHAR **argv)
Definition: install.c:1741
static HRESULT CreateShellLink(LPCWSTR pszLinkPath, LPCWSTR pszCmd, LPCWSTR pszArg, LPCWSTR pszDir, LPCWSTR pszIconPath, INT iIconNr, LPCWSTR pszComment)
Definition: install.c:73
static VOID CreateTempDir(IN LPCWSTR VarName)
Definition: install.c:372
static VOID AdjustStatusMessageWindow(HWND hwndDlg, PDLG_DATA pDlgData)
Definition: install.c:695
static DWORD WINAPI ShowStatusMessageThread(IN LPVOID lpParameter)
Definition: install.c:879
HINF hSysSetupInf
Definition: install.c:38
static BOOL SetSetupType(DWORD dwSetupType)
Definition: install.c:1213
BOOL RegisterTypeLibraries(_In_ PITEMSDATA pItemsData, _In_ PREGISTRATIONNOTIFY pNotify, _In_ HINF hinf, _In_ LPCWSTR szSection)
Definition: install.c:540
static BOOL InitializeProgramFilesDir(VOID)
Definition: install.c:1292
DWORD WINAPI SetupChangeFontSize(IN HANDLE hWnd, IN LPCWSTR lpszFontSize)
Definition: install.c:1772
static DWORD CALLBACK HotkeyThread(LPVOID Parameter)
Definition: install.c:1242
static VOID FatalError(char *pszFmt,...)
Definition: install.c:54
static DWORD InstallLiveCD(VOID)
Definition: install.c:1136
VOID InstallStartMenuItems(_In_ PITEMSDATA pItemsData)
Definition: install.c:314
struct _DLG_DATA DLG_DATA
static DWORD InstallReactOS(VOID)
Definition: install.c:1588
static LONG CountShortcuts(_In_ HINF hinf, _In_ LPCWSTR szSection)
Definition: install.c:288
static BOOL CreateShortcutsFromSection(_In_ PITEMSDATA pItemsData, _In_ PREGISTRATIONNOTIFY pNotify, _In_ HINF hinf, _In_ LPWSTR pszSection, _In_ LPCWSTR pszFolder)
Definition: install.c:185
DWORD WINAPI SetupChangeLocaleEx(HWND hWnd, LCID Lcid, LPCWSTR lpSrcRootPath, char Unknown, DWORD dwUnused1, DWORD dwUnused2)
Definition: install.c:1784
#define IDS_PROGRAMFILES
Definition: resource.h:164
#define IDD_STATUSWINDOW_DLG
Definition: resource.h:98
#define IDS_STATUS_INSTALL_DEV
Definition: resource.h:161
#define IDS_COMMONFILES
Definition: resource.h:165
#define IDB_LINE
Definition: resource.h:28
#define IDC_STATUSLABEL
Definition: resource.h:99
BOOL WINAPI CopySystemProfile(_In_ ULONG Unused)
Definition: profile.c:565
BOOL WINAPI GetDefaultUserProfileDirectoryW(_Out_opt_ LPWSTR lpProfileDir, _Inout_ LPDWORD lpcchSize)
Definition: profile.c:1443
BOOL WINAPI InitializeProfiles(VOID)
Definition: setup.c:335
static VOID BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Height *Stride) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Stride)
Definition: common.c:42
return ret
Definition: mutex.c:146
#define L(x)
Definition: resources.c:13
#define INFINITE
Definition: serial.h:102
static INT cxOld
Definition: eventvwr.c:4341
static INT cyOld
Definition: eventvwr.c:4341
#define MOVEFILE_REPLACE_EXISTING
Definition: filesup.h:28
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
FxAutoRegKey hKey
PWCHAR pValue
pKey DeleteObject()
GLuint res
Definition: glext.h:9613
GLfloat GLfloat p
Definition: glext.h:8902
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
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
unsigned int UINT
Definition: sysinfo.c:13
@ Unknown
Definition: i8042prt.h:114
#define MOD_SHIFT
Definition: imm.h:186
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
#define INF_STYLE_WIN4
Definition: infsupp.h:43
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define REG_SZ
Definition: layer.c:22
BOOL WINAPI InitializeSetupActionLog(BOOL bDeleteOldLogFile)
Definition: logfile.c:42
VOID WINAPI TerminateSetupActionLog(VOID)
Definition: logfile.c:82
#define ZeroMemory
Definition: minwinbase.h:31
LONG_PTR LPARAM
Definition: minwindef.h:175
UINT_PTR WPARAM
Definition: minwindef.h:174
#define error(str)
Definition: mkdosfs.c:1605
#define ASSERT(a)
Definition: mode.c:44
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
LPCWSTR szPath
Definition: env.c:37
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
static PVOID ptr
Definition: dispmode.c:27
static NTSTATUS *static PWSTR CURDIR *static HMODULE hmod
Definition: security.c:104
static HBITMAP
Definition: button.c:44
static HDC
Definition: imagelist.c:88
static PROCESS_INFORMATION pi
Definition: debugger.c:2303
static SYSTEM_INFO si
Definition: virtual.c:39
#define argv
Definition: mplay32.c:18
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
HANDLE hThread
Definition: wizard.c:28
#define _In_
Definition: no_sal2.h:158
#define _In_opt_
Definition: no_sal2.h:212
#define KEY_READ
Definition: nt_native.h:1026
#define KEY_QUERY_VALUE
Definition: nt_native.h:1019
#define KEY_WRITE
Definition: nt_native.h:1034
#define DWORD
Definition: nt_native.h:44
#define KEY_SET_VALUE
Definition: nt_native.h:1020
#define UNICODE_NULL
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329
#define MAKEINTRESOURCE(i)
Definition: ntverrsrc.c:25
const GUID IID_IPersistFile
#define PathAddBackslash
Definition: pathcch.h:300
BYTE * PBYTE
Definition: pedump.c:66
short WCHAR
Definition: pedump.c:58
long LONG
Definition: pedump.c:60
static const WCHAR szName[]
Definition: powrprof.c:45
_In_opt_ _In_opt_ _In_ _In_ DWORD cbData
Definition: shlwapi.h:761
#define SERVICE_START
Definition: winsvc.h:63
#define SERVICE_QUERY_STATUS
Definition: winsvc.h:61
@ SC_STATUS_PROCESS_INFO
Definition: winsvc.h:125
#define SC_MANAGER_ENUMERATE_SERVICE
Definition: winsvc.h:16
#define SERVICE_NO_CHANGE
Definition: winsvc.h:20
#define SERVICE_CHANGE_CONFIG
Definition: winsvc.h:60
#define StartService
Definition: winsvc.h:591
#define SERVICE_START_PENDING
Definition: winsvc.h:22
#define SERVICE_RUNNING
Definition: winsvc.h:24
#define SC_MANAGER_ALL_ACCESS
Definition: winsvc.h:13
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:104
#define _SEH2_END
Definition: pseh2_64.h:194
#define _SEH2_TRY
Definition: pseh2_64.h:93
SC_HANDLE hSCManager
Definition: sc.c:12
SC_HANDLE WINAPI OpenSCManagerW(LPCWSTR lpMachineName, LPCWSTR lpDatabaseName, DWORD dwDesiredAccess)
Definition: scm.c:2107
BOOL WINAPI QueryServiceStatusEx(SC_HANDLE hService, SC_STATUS_TYPE InfoLevel, LPBYTE lpBuffer, DWORD cbBufSize, LPDWORD pcbBytesNeeded)
Definition: scm.c:2926
SC_HANDLE WINAPI OpenServiceW(SC_HANDLE hSCManager, LPCWSTR lpServiceName, DWORD dwDesiredAccess)
Definition: scm.c:2199
BOOL WINAPI ChangeServiceConfigW(SC_HANDLE hService, DWORD dwServiceType, DWORD dwStartType, DWORD dwErrorControl, LPCWSTR lpBinaryPathName, LPCWSTR lpLoadOrderGroup, LPDWORD lpdwTagId, LPCWSTR lpDependencies, LPCWSTR lpServiceStartName, LPCWSTR lpPassword, LPCWSTR lpDisplayName)
Definition: scm.c:482
BOOL WINAPI StartServiceW(SC_HANDLE hService, DWORD dwNumServiceArgs, LPCWSTR *lpServiceArgVectors)
Definition: scm.c:3019
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
Definition: scm.c:580
#define REG_DWORD
Definition: sdbapi.c:615
#define LANG_CHINESE
Definition: nls.h:42
DWORD LCID
Definition: nls.h:13
#define LANG_JAPANESE
Definition: nls.h:76
#define PRIMARYLANGID(l)
Definition: nls.h:16
#define LANG_KOREAN
Definition: nls.h:84
wcscat
wcscpy
strcat
Definition: string.h:92
#define LoadStringW
Definition: utils.h:64
static HRESULT InstallNetworkComponent(LPWSTR pszComponentName, const GUID *pClassGuid)
Definition: setup.cpp:54
#define DI_QUIETINSTALL
Definition: setupapi.h:70
#define SetupFindFirstLine
Definition: setupapi.h:2645
#define SPINST_ALL
Definition: setupapi.h:604
#define SP_COPY_NEWER
Definition: setupapi.h:481
_In_ UINT _In_ UINT cch
Definition: shellapi.h:432
_In_ LPCSTR pszDir
Definition: shellapi.h:609
#define IID_IShellLink
Definition: shlguid.h:131
@ SHGFP_TYPE_DEFAULT
Definition: shlobj.h:2168
#define CSIDL_FLAG_CREATE
Definition: shlobj.h:2253
#define CSIDL_SYSTEM
Definition: shlobj.h:2227
#define IDB_REACTOS
Definition: shresdef.h:30
#define DPRINT
Definition: sndvol32.h:73
#define _countof(array)
Definition: sndvol32.h:70
static void Exit(void)
Definition: sock.c:1330
_In_ PVOID Context
Definition: storport.h:2269
LPWSTR Password
Definition: globals.h:25
LPWSTR Name
Definition: globals.h:23
LPWSTR Domain
Definition: globals.h:24
Definition: gui.c:37
HBITMAP hLogoBitmap
Definition: gui.c:39
HBITMAP hBarBitmap
Definition: gui.c:40
DWORD BarHeight
Definition: gui.c:46
DWORD BarWidth
Definition: gui.c:45
HWND hWndBarCtrl
Definition: gui.c:41
DWORD BarCounter
Definition: gui.c:42
DWORD dwWaitHint
Definition: winsvc.h:111
DWORD dwCurrentState
Definition: winsvc.h:106
$ULONG PrivilegeCount
Definition: setypes.h:1035
LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY]
Definition: setypes.h:1036
LONG bmHeight
Definition: wingdi.h:1869
LONG bmWidth
Definition: wingdi.h:1868
LONG right
Definition: windef.h:108
LONG bottom
Definition: windef.h:109
LONG top
Definition: windef.h:107
LONG left
Definition: windef.h:106
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:726
#define LogItem(lpTag, lpMessageText...)
Definition: syssetup.h:102
#define GWLP_USERDATA
Definition: treelist.c:63
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
uint16_t * PWSTR
Definition: typedefs.h:56
int32_t INT_PTR
Definition: typedefs.h:64
const uint16_t * PCWSTR
Definition: typedefs.h:57
const uint16_t * LPCWSTR
Definition: typedefs.h:57
unsigned char * LPBYTE
Definition: typedefs.h:53
uint16_t * LPWSTR
Definition: typedefs.h:56
int32_t INT
Definition: typedefs.h:58
#define IN
Definition: typedefs.h:39
#define OUT
Definition: typedefs.h:40
BOOL WINAPI SetupGetStringFieldW(IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT PWSTR ReturnBuffer, IN ULONG ReturnBufferSize, OUT PULONG RequiredSize)
Definition: infsupp.c:186
BOOL WINAPI SetupFindFirstLineW(IN HINF InfHandle, IN PCWSTR Section, IN PCWSTR Key, IN OUT PINFCONTEXT Context)
Definition: infsupp.c:56
BOOL WINAPI SetupGetIntField(IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT INT *IntegerValue)
Definition: infsupp.c:148
ULONG WINAPI SetupGetFieldCount(IN PINFCONTEXT Context)
Definition: infsupp.c:93
BOOL WINAPI SetupFindNextLine(IN PINFCONTEXT ContextIn, OUT PINFCONTEXT ContextOut)
Definition: infsupp.c:82
VOID WINAPI SetupCloseInfFile(IN HINF InfHandle)
Definition: infsupp.c:45
HDC hdcMem
Definition: welcome.c:104
HRESULT RunCommandAndWait(_In_ PWCHAR Command)
Definition: addons.c:37
#define LookupPrivilegeValue
Definition: winbase.h:3591
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define ExpandEnvironmentStrings
Definition: winbase.h:3495
#define CreateDirectory
Definition: winbase.h:3467
_In_ LPCSTR _In_opt_ LPCSTR _In_ DWORD _Out_opt_ LPSTR * lpFilePart
Definition: winbase.h:2804
#define WAIT_OBJECT_0
Definition: winbase.h:383
#define CREATE_NEW_CONSOLE
Definition: winbase.h:185
#define WINAPI
Definition: msvc.h:6
#define ERROR_SERVICE_ALREADY_RUNNING
Definition: winerror.h:931
void int int ULONGLONG int va_list * ap
Definition: winesup.h:36
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define SRCCOPY
Definition: wingdi.h:333
#define GetObject
Definition: wingdi.h:4914
BOOL WINAPI DeleteDC(_In_ HDC)
#define LOCALE_ICURRDIGITS
Definition: winnls.h:64
#define LOCALE_SCOUNTRY
Definition: winnls.h:40
#define LOCALE_SDATE
Definition: winnls.h:68
#define LOCALE_SGROUPING
Definition: winnls.h:54
#define LOCALE_ICOUNTRY
Definition: winnls.h:39
#define LOCALE_SDECIMAL
Definition: winnls.h:52
#define LOCALE_IDATE
Definition: winnls.h:73
#define LOCALE_IFIRSTWEEKOFYEAR
Definition: winnls.h:86
#define LOCALE_IMEASURE
Definition: winnls.h:51
#define LOCALE_SLONGDATE
Definition: winnls.h:71
#define LOCALE_S1159
Definition: winnls.h:81
#define LOCALE_SSHORTDATE
Definition: winnls.h:70
#define LOCALE_SPOSITIVESIGN
Definition: winnls.h:127
#define LOCALE_SMONDECIMALSEP
Definition: winnls.h:61
#define LOCALE_ITIME
Definition: winnls.h:75
#define LOCALE_ICURRENCY
Definition: winnls.h:66
#define LOCALE_ITLZERO
Definition: winnls.h:78
#define LOCALE_SMONTHOUSANDSEP
Definition: winnls.h:62
#define LOCALE_NOUSEROVERRIDE
Definition: winnls.h:19
#define LOCALE_IDIGITS
Definition: winnls.h:55
#define LOCALE_STHOUSAND
Definition: winnls.h:53
#define LOCALE_STIMEFORMAT
Definition: winnls.h:72
#define LOCALE_IFIRSTDAYOFWEEK
Definition: winnls.h:85
#define LOCALE_STIME
Definition: winnls.h:69
#define LOCALE_SABBREVLANGNAME
Definition: winnls.h:37
#define LOCALE_INEGNUMBER
Definition: winnls.h:57
#define LOCALE_SNEGATIVESIGN
Definition: winnls.h:128
DWORD LCTYPE
Definition: winnls.h:592
#define LOCALE_S2359
Definition: winnls.h:82
#define LOCALE_SNATIVEDIGITS
Definition: winnls.h:58
#define LOCALE_SLIST
Definition: winnls.h:50
#define LOCALE_ILZERO
Definition: winnls.h:56
#define LOCALE_ICALENDARTYPE
Definition: winnls.h:83
#define LOCALE_SMONGROUPING
Definition: winnls.h:63
#define LOCALE_SCURRENCY
Definition: winnls.h:59
#define LOCALE_INEGCURR
Definition: winnls.h:67
#define LOCALE_ITIMEMARKPOSN
Definition: winnls.h:76
#define SE_SHUTDOWN_NAME
Definition: winnt_old.h:427
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define HKEY_USERS
Definition: winreg.h:13
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
#define IMAGE_BITMAP
Definition: winuser.h:211
#define GetWindowLongPtrW
Definition: winuser.h:4983
#define WM_QUIT
Definition: winuser.h:1651
BOOL WINAPI TranslateMessage(_In_ const MSG *)
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define VK_F10
Definition: winuser.h:2300
BOOL WINAPI GetMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI UnregisterHotKey(_In_opt_ HWND, _In_ int)
int WINAPI MessageBoxA(_In_opt_ HWND hWnd, _In_opt_ LPCSTR lpText, _In_opt_ LPCSTR lpCaption, _In_ UINT uType)
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE hInst, _In_ LPCWSTR name, _In_ UINT type, _In_ int cx, _In_ int cy, _In_ UINT fuLoad)
Definition: cursoricon.c:2572
#define CreateDialogParam
Definition: winuser.h:5918
BOOL WINAPI AdjustWindowRectEx(_Inout_ LPRECT, _In_ DWORD, _In_ BOOL, _In_ DWORD)
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define WM_INITDIALOG
Definition: winuser.h:1767
#define PostThreadMessage
Definition: winuser.h:5999
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define WM_DRAWITEM
Definition: winuser.h:1673
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:628
#define GetMessage
Definition: winuser.h:5956
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define EWX_REBOOT
Definition: winuser.h:646
BOOL WINAPI RegisterHotKey(_In_opt_ HWND, _In_ int, _In_ UINT, _In_ UINT)
#define WM_TIMER
Definition: winuser.h:1770
BOOL WINAPI UpdateWindow(_In_ HWND)
#define SendMessage
Definition: winuser.h:6009
#define MB_OK
Definition: winuser.h:801
BOOL WINAPI ExitWindowsEx(_In_ UINT, _In_ DWORD)
#define WM_HOTKEY
Definition: winuser.h:1907
#define LR_DEFAULTCOLOR
Definition: winuser.h:1098
#define SW_SHOW
Definition: winuser.h:786
#define WM_DESTROY
Definition: winuser.h:1637
#define DispatchMessage
Definition: winuser.h:5931
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define SetWindowLongPtrW
Definition: winuser.h:5512
#define GWL_STYLE
Definition: winuser.h:863
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
#define GWL_EXSTYLE
Definition: winuser.h:862
#define SERVICE_AUTO_START
Definition: cmtypes.h:977
#define REG_STANDARD_FORMAT
Definition: cmtypes.h:97
_In_ CONST DEVPROPKEY _In_ LCID Lcid
Definition: iofuncs.h:2415
_Inout_opt_ PVOID Parameter
Definition: rtltypes.h:336
#define TOKEN_ADJUST_PRIVILEGES
Definition: setypes.h:942
#define SE_PRIVILEGE_ENABLED
Definition: setypes.h:63