ReactOS 0.4.17-dev-966-gf06eace
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#include <reactos/rosbrand.h>
27
28#define NDEBUG
29#include <debug.h>
30
31//DWORD WINAPI
32//CMP_WaitNoPendingInstallEvents(DWORD dwTimeout);
33
35SetupStartService(LPCWSTR lpServiceName, BOOL bWait);
36
37/* GLOBALS ******************************************************************/
38
41
42typedef struct _DLG_DATA
43{
51
52/* FUNCTIONS ****************************************************************/
53
54static VOID
55FatalError(char *pszFmt,...)
56{
57 char szBuffer[512];
58 va_list ap;
59
60 va_start(ap, pszFmt);
61 vsprintf(szBuffer, pszFmt, ap);
62 va_end(ap);
63
64 LogItem(NULL, L"Failed");
65
66 strcat(szBuffer, "\nRebooting now!");
68 szBuffer,
69 "ReactOS Setup",
70 MB_OK);
71}
72
73static HRESULT
75 LPCWSTR pszLinkPath,
76 LPCWSTR pszCmd,
77 LPCWSTR pszArg,
79 LPCWSTR pszIconPath,
80 INT iIconNr,
81 LPCWSTR pszComment)
82{
83 IShellLinkW *psl;
84 IPersistFile *ppf;
85
86 HRESULT hr = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, &IID_IShellLink, (LPVOID*)&psl);
87
88 if (SUCCEEDED(hr))
89 {
90 hr = IShellLinkW_SetPath(psl, pszCmd);
91
92 if (pszArg)
93 hr = IShellLinkW_SetArguments(psl, pszArg);
94
95 if (pszDir)
96 hr = IShellLinkW_SetWorkingDirectory(psl, pszDir);
97
98 if (pszIconPath)
99 hr = IShellLinkW_SetIconLocation(psl, pszIconPath, iIconNr);
100
101 if (pszComment)
102 hr = IShellLinkW_SetDescription(psl, pszComment);
103
104 hr = IShellLinkW_QueryInterface(psl, &IID_IPersistFile, (LPVOID*)&ppf);
105
106 if (SUCCEEDED(hr))
107 {
108 hr = IPersistFile_Save(ppf, pszLinkPath, TRUE);
109 IPersistFile_Release(ppf);
110 }
111
112 IShellLinkW_Release(psl);
113 }
114
115 return hr;
116}
117
118
119static BOOL
121 LPCWSTR pszFolder,
122 LPCWSTR pszName,
123 LPCWSTR pszCommand,
124 LPCWSTR pszDescription,
125 INT iIconNr,
126 LPCWSTR pszWorkingDir,
127 LPCWSTR pszArgs)
128{
129 DWORD dwLen;
130 LPWSTR Ptr;
133 WCHAR szWorkingDirBuf[MAX_PATH];
134
135 /* If no working directory is provided, try to compute a default one */
136 if (pszWorkingDir == NULL || pszWorkingDir[0] == L'\0')
137 {
138 if (ExpandEnvironmentStringsW(pszCommand, szPath, ARRAYSIZE(szPath)) == 0)
139 wcscpy(szPath, pszCommand);
140
141 dwLen = GetFullPathNameW(szPath,
142 ARRAYSIZE(szWorkingDirBuf),
143 szWorkingDirBuf,
144 &lpFilePart);
145 if (dwLen != 0 && dwLen <= ARRAYSIZE(szWorkingDirBuf))
146 {
147 /* Since those should only be called with (.exe) files,
148 lpFilePart has not to be NULL */
150
151 /* We're only interested in the path. Cut the file name off.
152 Also remove the trailing backslash unless the working directory
153 is only going to be a drive, i.e. C:\ */
154 *(lpFilePart--) = L'\0';
155 if (!(lpFilePart - szWorkingDirBuf == 2 &&
156 szWorkingDirBuf[1] == L':' && szWorkingDirBuf[2] == L'\\'))
157 {
158 *lpFilePart = L'\0';
159 }
160 pszWorkingDir = szWorkingDirBuf;
161 }
162 }
163
164 /* If we failed to compute a working directory, just do not use one */
165 if (pszWorkingDir && pszWorkingDir[0] == L'\0')
166 pszWorkingDir = NULL;
167
168 /* Build the shortcut file name */
169 wcscpy(szPath, pszFolder);
171 wcscpy(Ptr, pszName);
172
173 /* Create the shortcut */
175 pszCommand,
176 pszArgs,
177 pszWorkingDir,
178 /* Special value to indicate no icon */
179 (iIconNr != -1 ? pszCommand : NULL),
180 iIconNr,
181 pszDescription));
182}
183
184
185static BOOL
187 _In_ PITEMSDATA pItemsData,
189 _In_ HINF hinf,
190 _In_ LPWSTR pszSection,
191 _In_ LPCWSTR pszFolder)
192{
194 DWORD dwFieldCount;
195 INT iIconNr;
196 WCHAR szCommand[MAX_PATH];
199 WCHAR szDirectory[MAX_PATH];
200 WCHAR szArgs[MAX_PATH];
201
202 if (!SetupFindFirstLine(hinf, pszSection, NULL, &Context))
203 return FALSE;
204
205 do
206 {
207 pNotify->Progress++;
208
209 SendMessage(pItemsData->hwndDlg, PM_STEP_START, 0, (LPARAM)pNotify);
210
211 dwFieldCount = SetupGetFieldCount(&Context);
212 if (dwFieldCount < 3)
213 continue;
214
215 if (!SetupGetStringFieldW(&Context, 1, szCommand, ARRAYSIZE(szCommand), NULL))
216 continue;
217
219 continue;
220
222 continue;
223
224 if (dwFieldCount < 4 || !SetupGetIntField(&Context, 4, &iIconNr))
225 iIconNr = -1; /* Special value to indicate no icon */
226
227 if (dwFieldCount < 5 || !SetupGetStringFieldW(&Context, 5, szDirectory, ARRAYSIZE(szDirectory), NULL))
228 szDirectory[0] = L'\0';
229
230 if (dwFieldCount < 6 || !SetupGetStringFieldW(&Context, 6, szArgs, ARRAYSIZE(szArgs), NULL))
231 szArgs[0] = L'\0';
232
233 wcscat(szName, L".lnk");
234
235 CreateShortcut(pszFolder, szName, szCommand, szDescription, iIconNr, szDirectory, szArgs);
236
237 SendMessage(pItemsData->hwndDlg, PM_STEP_END, 0, (LPARAM)pNotify);
238
239 } while (SetupFindNextLine(&Context, &Context));
240
241 return TRUE;
242}
243
244static BOOL
246 _In_ PITEMSDATA pItemsData,
248 _In_ HINF hinf,
249 _In_ LPCWSTR szSection)
250{
253 WCHAR szFolder[MAX_PATH];
254 WCHAR szFolderSection[MAX_PATH];
255 INT csidl;
256
258
259 if (!SetupFindFirstLine(hinf, szSection, NULL, &Context))
260 return FALSE;
261
262 do
263 {
264 if (SetupGetFieldCount(&Context) < 2)
265 continue;
266
267 if (!SetupGetStringFieldW(&Context, 0, szFolderSection, ARRAYSIZE(szFolderSection), NULL))
268 continue;
269
270 if (!SetupGetIntField(&Context, 1, &csidl))
271 continue;
272
273 if (!SetupGetStringFieldW(&Context, 2, szFolder, ARRAYSIZE(szFolder), NULL))
274 continue;
275
277 continue;
278
279 CreateShortcutsFromSection(pItemsData, pNotify, hinf, szFolderSection, szPath);
280
281 } while (SetupFindNextLine(&Context, &Context));
282
284
285 return TRUE;
286}
287
288static LONG
290 _In_ HINF hinf,
291 _In_ LPCWSTR szSection)
292{
294 WCHAR szFolderSection[MAX_PATH];
295 LONG Steps = 0;
296
297 if (!SetupFindFirstLine(hinf, szSection, NULL, &Context))
298 return FALSE;
299
300 do
301 {
302 if (SetupGetFieldCount(&Context) < 2)
303 continue;
304
305 if (!SetupGetStringFieldW(&Context, 0, szFolderSection, ARRAYSIZE(szFolderSection), NULL))
306 continue;
307
308 Steps += SetupGetLineCountW(hinf, szFolderSection);
309 } while (SetupFindNextLine(&Context, &Context));
310
311 return Steps;
312}
313
314VOID
316 _In_ PITEMSDATA pItemsData)
317{
318 HINF hShortcutsInf1 = INVALID_HANDLE_VALUE;
319 HINF hShortcutsInf2 = INVALID_HANDLE_VALUE;
320 LONG Steps = 0;
321 DWORD LastError = 0;
323
324 ZeroMemory(&Notify, sizeof(Notify));
325
326 hShortcutsInf1 = SetupOpenInfFileW(L"shortcuts.inf",
327 NULL,
329 NULL);
330 if (hShortcutsInf1 == INVALID_HANDLE_VALUE)
331 {
332 DPRINT1("Failed to open shortcuts.inf");
333 return;
334 }
335
336 hShortcutsInf2 = SetupOpenInfFileW(L"rosapps_shortcuts.inf",
337 NULL,
339 NULL);
340
341 Steps = CountShortcuts(hShortcutsInf1, L"ShortcutFolders");
342 if (hShortcutsInf2 != INVALID_HANDLE_VALUE)
343 Steps += CountShortcuts(hShortcutsInf2, L"ShortcutFolders");
344
345 SendMessage(pItemsData->hwndDlg, PM_ITEM_START, 1, (LPARAM)Steps);
346
347 if (!CreateShortcuts(pItemsData, &Notify, hShortcutsInf1, L"ShortcutFolders"))
348 {
349 DPRINT1("CreateShortcuts() failed");
350 goto done;
351 }
352
353 if (hShortcutsInf2 != INVALID_HANDLE_VALUE)
354 {
355 if (!CreateShortcuts(pItemsData, &Notify, hShortcutsInf2, L"ShortcutFolders"))
356 {
357 DPRINT1("CreateShortcuts(rosapps) failed");
358 goto done;
359 }
360 }
361
362done:
363 if (hShortcutsInf2 != INVALID_HANDLE_VALUE)
364 SetupCloseInfFile(hShortcutsInf2);
365
366 if (hShortcutsInf1 != INVALID_HANDLE_VALUE)
367 SetupCloseInfFile(hShortcutsInf1);
368
369 SendMessage(pItemsData->hwndDlg, PM_ITEM_END, 1, LastError);
370}
371
372static VOID
374 IN LPCWSTR VarName)
375{
376 WCHAR szTempDir[MAX_PATH];
377 WCHAR szBuffer[MAX_PATH];
379 HKEY hKey;
380
382 L"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment",
383 0,
385 &hKey) != ERROR_SUCCESS)
386 {
387 FatalError("Error: %lu\n", GetLastError());
388 return;
389 }
390
391 /* Get temp dir */
392 dwLength = sizeof(szBuffer);
394 VarName,
395 NULL,
396 NULL,
397 (LPBYTE)szBuffer,
399 {
400 FatalError("Error: %lu\n", GetLastError());
401 goto cleanup;
402 }
403
404 /* Expand it */
405 if (!ExpandEnvironmentStringsW(szBuffer, szTempDir, ARRAYSIZE(szTempDir)))
406 {
407 FatalError("Error: %lu\n", GetLastError());
408 goto cleanup;
409 }
410
411 /* Create profiles directory */
412 if (!CreateDirectoryW(szTempDir, NULL))
413 {
415 {
416 FatalError("Error: %lu\n", GetLastError());
417 goto cleanup;
418 }
419 }
420
421cleanup:
423}
424
425static BOOL
427{
428 INFCONTEXT InfContext;
429 WCHAR szLineBuffer[256];
430 DWORD dwLineLength;
431
433 L"DeviceInfsToInstall",
434 NULL,
435 &InfContext))
436 {
437 return FALSE;
438 }
439
440 do
441 {
442 if (!SetupGetStringFieldW(&InfContext,
443 0,
444 szLineBuffer,
445 ARRAYSIZE(szLineBuffer),
446 &dwLineLength))
447 {
448 return FALSE;
449 }
450
451 if (!SetupDiInstallClassW(NULL, szLineBuffer, DI_QUIETINSTALL, NULL))
452 {
453 return FALSE;
454 }
455 }
456 while (SetupFindNextLine(&InfContext, &InfContext));
457
458 return TRUE;
459}
460
461static BOOL
463{
464 INFCONTEXT InfContext;
465 WCHAR szNameBuffer[256];
466 WCHAR szSectionBuffer[256];
467 HINF hComponentInf = INVALID_HANDLE_VALUE;
468
470 L"Infs.Always",
471 NULL,
472 &InfContext))
473 {
474 DPRINT("No Inf.Always section found\n");
475 }
476 else
477 {
478 do
479 {
480 if (!SetupGetStringFieldW(&InfContext,
481 1, // Get the component name
482 szNameBuffer,
483 ARRAYSIZE(szNameBuffer),
484 NULL))
485 {
486 FatalError("Error while trying to get component name\n");
487 return FALSE;
488 }
489
490 if (!SetupGetStringFieldW(&InfContext,
491 2, // Get the component install section
492 szSectionBuffer,
493 ARRAYSIZE(szSectionBuffer),
494 NULL))
495 {
496 FatalError("Error while trying to get component install section\n");
497 return FALSE;
498 }
499
500 DPRINT("Trying to execute install section '%S' from '%S'\n", szSectionBuffer, szNameBuffer);
501
502 hComponentInf = SetupOpenInfFileW(szNameBuffer,
503 NULL,
505 NULL);
506
507 if (hComponentInf == INVALID_HANDLE_VALUE)
508 {
509 FatalError("SetupOpenInfFileW() failed to open '%S' (Error: %lu)\n", szNameBuffer, GetLastError());
510 return FALSE;
511 }
512
514 hComponentInf,
515 szSectionBuffer,
517 NULL,
518 NULL,
521 NULL,
522 NULL,
523 NULL))
524 {
525 FatalError("Error while trying to install : %S (Error: %lu)\n", szNameBuffer, GetLastError());
526 SetupCloseInfFile(hComponentInf);
527 return FALSE;
528 }
529
530 SetupCloseInfFile(hComponentInf);
531 }
532 while (SetupFindNextLine(&InfContext, &InfContext));
533 }
534
535 return TRUE;
536}
537
538
539
540BOOL
542 _In_ PITEMSDATA pItemsData,
544 _In_ HINF hinf,
545 _In_ LPCWSTR szSection)
546{
547 INFCONTEXT InfContext;
548 BOOL res;
551 INT csidl;
552 LPWSTR p;
554 HRESULT hret;
555
556 /* Begin iterating the entries in the inf section */
557 res = SetupFindFirstLine(hinf, szSection, NULL, &InfContext);
558 if (!res) return FALSE;
559
560 do
561 {
562 /* Get the name of the current type library */
563 if (!SetupGetStringFieldW(&InfContext, 1, szName, ARRAYSIZE(szName), NULL))
564 {
565 FatalError("SetupGetStringFieldW failed\n");
566 continue;
567 }
568
569 if (!SetupGetIntField(&InfContext, 2, &csidl))
570 csidl = CSIDL_SYSTEM;
571
572 hret = SHGetFolderPathW(NULL, csidl, NULL, 0, szPath);
573 if (FAILED(hret))
574 {
575 FatalError("SHGetFolderPathW failed hret=0x%lx\n", hret);
576 continue;
577 }
578
580 wcscpy(p, szName);
581
582 if (pItemsData && pNotify)
583 {
584 pNotify->Progress++;
585 pNotify->CurrentItem = szName;
586
587 DPRINT("RegisterTypeLibraries: Start step %ld\n", pNotify->Progress);
588 SendMessage(pItemsData->hwndDlg, PM_STEP_START, 0, (LPARAM)pNotify);
589 }
590
592 if (hmod == NULL)
593 {
594 FatalError("LoadLibraryW failed\n");
595 continue;
596 }
597
599
600 if (pItemsData && pNotify)
601 {
602 DPRINT("RegisterTypeLibraries: End step %ld\n", pNotify->Progress);
603 SendMessage(pItemsData->hwndDlg, PM_STEP_END, 0, (LPARAM)pNotify);
604 }
605
606 } while (SetupFindNextLine(&InfContext, &InfContext));
607
608 return TRUE;
609}
610
611static BOOL
613{
614 SC_HANDLE hSCManager = NULL;
615 SC_HANDLE hService = NULL;
617 BOOL bRet = FALSE;
618 DWORD BytesNeeded, WaitTime;
619
621 if (hSCManager == NULL)
622 {
623 DPRINT1("Unable to open the service control manager.\n");
624 DPRINT1("Last Error %d\n", GetLastError());
625 goto cleanup;
626 }
627
628 hService = OpenServiceW(hSCManager,
629 L"PlugPlay",
631 if (hService == NULL)
632 {
633 DPRINT1("Unable to open PlugPlay service\n");
634 goto cleanup;
635 }
636
637 bRet = ChangeServiceConfigW(hService,
641 NULL, NULL, NULL,
642 NULL, NULL, NULL, NULL);
643 if (!bRet)
644 {
645 DPRINT1("Unable to change the service configuration\n");
646 goto cleanup;
647 }
648
649 bRet = StartServiceW(hService, 0, NULL);
651 {
652 DPRINT1("Unable to start service\n");
653 goto cleanup;
654 }
655
656 while (TRUE)
657 {
658 bRet = QueryServiceStatusEx(hService,
661 sizeof(ServiceStatus),
662 &BytesNeeded);
663 if (!bRet)
664 {
665 DPRINT1("QueryServiceStatusEx() failed for PlugPlay service (error 0x%x)\n", GetLastError());
666 goto cleanup;
667 }
668
670 break;
671
672 WaitTime = ServiceStatus.dwWaitHint / 10;
673 if (WaitTime < 1000) WaitTime = 1000;
674 else if (WaitTime > 10000) WaitTime = 10000;
675 Sleep(WaitTime);
676 };
677
679 {
680 bRet = FALSE;
681 DPRINT1("Failed to start PlugPlay service\n");
682 goto cleanup;
683 }
684
685 bRet = TRUE;
686
687cleanup:
688 if (hService != NULL)
689 CloseServiceHandle(hService);
690 if (hSCManager != NULL)
692 return bRet;
693}
694
695static VOID
697{
698 INT xOld, yOld, cxOld, cyOld;
699 INT xNew, yNew, cxNew, cyNew;
700 INT cxLabel, cyLabel, dyLabel;
701 RECT rc, rcBar, rcLabel, rcWnd;
702 BITMAP bmLogo, bmBar;
703 DWORD style, exstyle;
704 HWND hwndLogo = GetDlgItem(hwndDlg, IDC_ROSLOGO);
705 HWND hwndBar = GetDlgItem(hwndDlg, IDC_BAR);
706 HWND hwndLabel = GetDlgItem(hwndDlg, IDC_STATUSLABEL);
707
708 /* This adjustment is for CJK only */
710 {
711 case LANG_CHINESE:
712 case LANG_JAPANESE:
713 case LANG_KOREAN:
714 break;
715
716 default:
717 return;
718 }
719
720 if (!GetObjectW(pDlgData->hLogoBitmap, sizeof(BITMAP), &bmLogo) ||
721 !GetObjectW(pDlgData->hBarBitmap, sizeof(BITMAP), &bmBar))
722 {
723 return;
724 }
725
726 GetWindowRect(hwndBar, &rcBar);
727 MapWindowPoints(NULL, hwndDlg, (LPPOINT)&rcBar, 2);
728 dyLabel = bmLogo.bmHeight - rcBar.top;
729
730 GetWindowRect(hwndLabel, &rcLabel);
731 MapWindowPoints(NULL, hwndDlg, (LPPOINT)&rcLabel, 2);
732 cxLabel = rcLabel.right - rcLabel.left;
733 cyLabel = rcLabel.bottom - rcLabel.top;
734
735 MoveWindow(hwndLogo, 0, 0, bmLogo.bmWidth, bmLogo.bmHeight, TRUE);
736 MoveWindow(hwndBar, 0, bmLogo.bmHeight, bmLogo.bmWidth, bmBar.bmHeight, TRUE);
737 MoveWindow(hwndLabel, rcLabel.left, rcLabel.top + dyLabel, cxLabel, cyLabel, TRUE);
738
739 GetWindowRect(hwndDlg, &rcWnd);
740 xOld = rcWnd.left;
741 yOld = rcWnd.top;
742 cxOld = rcWnd.right - rcWnd.left;
743 cyOld = rcWnd.bottom - rcWnd.top;
744
745 GetClientRect(hwndDlg, &rc);
746 SetRect(&rc, 0, 0, bmLogo.bmWidth, rc.bottom - rc.top); /* new client size */
747
749 exstyle = (DWORD)GetWindowLongPtrW(hwndDlg, GWL_EXSTYLE);
750 AdjustWindowRectEx(&rc, style, FALSE, exstyle);
751
752 cxNew = rc.right - rc.left;
753 cyNew = (rc.bottom - rc.top) + dyLabel;
754 xNew = xOld - (cxNew - cxOld) / 2;
755 yNew = yOld - (cyNew - cyOld) / 2;
756 MoveWindow(hwndDlg, xNew, yNew, cxNew, cyNew, TRUE);
757}
758
759static INT_PTR CALLBACK
761 IN HWND hwndDlg,
762 IN UINT uMsg,
765{
766 PDLG_DATA pDlgData;
768
769 pDlgData = (PDLG_DATA)GetWindowLongPtrW(hwndDlg, DWLP_USER);
770
771 /* pDlgData is required for each case except WM_INITDIALOG */
772 if (uMsg != WM_INITDIALOG && pDlgData == NULL) return FALSE;
773
774 switch (uMsg)
775 {
776 case WM_INITDIALOG:
777 {
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 DWLP_USER, so we can get it for new messages */
785 SetWindowLongPtrW(hwndDlg, DWLP_USER, (LONG_PTR)pDlgData);
786
787 /* Load bitmaps */
788 HMODULE hBrand = LoadLibraryExW(L"rosbrand.dll", NULL, LOAD_LIBRARY_AS_DATAFILE);
789 if (hBrand)
790 {
791 pDlgData->hLogoBitmap = LoadImageW(hBrand,
794 pDlgData->hBarBitmap = LoadImageW(hBrand,
797 }
798
799 if (pDlgData->hLogoBitmap && pDlgData->hBarBitmap)
800 {
801 BITMAP bm;
802 GetObject(pDlgData->hBarBitmap, sizeof(bm), &bm);
803 pDlgData->BarWidth = bm.bmWidth;
804 pDlgData->BarHeight = bm.bmHeight;
805
806 if (SetTimer(hwndDlg, IDT_BAR, 20, NULL) == 0)
807 DPRINT1("SetTimer(IDT_BAR) failed: %lu\n", GetLastError());
808
809 /* Get the animation bar control */
810 pDlgData->hWndBarCtrl = GetDlgItem(hwndDlg, IDC_BAR);
811 }
812 }
813
814 /* Get and set status text */
816 return FALSE;
817 SetDlgItemTextW(hwndDlg, IDC_STATUSLABEL, szMsg);
818
819 AdjustStatusMessageWindow(hwndDlg, pDlgData);
820 return TRUE;
821 }
822
823 case WM_TIMER:
824 {
825 if (pDlgData->hBarBitmap)
826 {
827 /*
828 * Default rotation bar image width is 413 (same as logo)
829 * We can divide 413 by 7 without remainder
830 */
831 pDlgData->BarCounter = (pDlgData->BarCounter + 7) % pDlgData->BarWidth;
833 UpdateWindow(pDlgData->hWndBarCtrl);
834 }
835 return TRUE;
836 }
837
838 case WM_DRAWITEM:
839 {
841
842 if ((lpDis->CtlID == IDC_BAR) && pDlgData->hBarBitmap)
843 {
844 HDC hdcMem;
845 HGDIOBJ hOld;
846 DWORD off = pDlgData->BarCounter;
847 DWORD iw = pDlgData->BarWidth;
848 DWORD ih = pDlgData->BarHeight;
849
850 hdcMem = CreateCompatibleDC(lpDis->hDC);
851 hOld = SelectObject(hdcMem, pDlgData->hBarBitmap);
852 BitBlt(lpDis->hDC, off, 0, iw - off, ih, hdcMem, 0, 0, SRCCOPY);
853 BitBlt(lpDis->hDC, 0, 0, off, ih, hdcMem, iw - off, 0, SRCCOPY);
854 SelectObject(hdcMem, hOld);
856 return TRUE;
857 }
858
859 if ((lpDis->CtlID == IDC_ROSLOGO) && pDlgData->hLogoBitmap)
860 {
862 HGDIOBJ hOld = SelectObject(hdcMem, pDlgData->hLogoBitmap);
863 BITMAP bm;
864
865 GetObject(pDlgData->hLogoBitmap, sizeof(bm), &bm);
866 BitBlt(lpDis->hDC, 0, 0, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCCOPY);
867 SelectObject(hdcMem, hOld);
869 return TRUE;
870 }
871
872 return FALSE;
873 }
874
875 case WM_DESTROY:
876 {
877 if (pDlgData->hBarBitmap)
878 {
879 KillTimer(hwndDlg, IDT_BAR);
880 }
881
882 DeleteObject(pDlgData->hLogoBitmap);
883 DeleteObject(pDlgData->hBarBitmap);
884 HeapFree(GetProcessHeap(), 0, pDlgData);
885 return TRUE;
886 }
887 }
888 return FALSE;
889}
890
891static DWORD WINAPI
893 IN LPVOID lpParameter)
894{
895 HWND hWnd;
896 MSG Msg;
897 UNREFERENCED_PARAMETER(lpParameter);
898
903 (LPARAM)NULL);
904 if (!hWnd)
905 return 0;
906
908
909 /* Message loop for the Status window */
910 while (GetMessage(&Msg, NULL, 0, 0))
911 {
914 }
915
916 EndDialog(hWnd, 0);
917
918 return 0;
919}
920
921static LONG
923 IN HKEY hKey,
924 IN LPCWSTR pszKey,
926{
927 LONG rc;
928 DWORD dwType;
929 DWORD cbData = 0;
930 LPWSTR pwszValue;
931
932 if (!pValue)
934
935 *pValue = NULL;
936 rc = RegQueryValueExW(hKey, pszKey, NULL, &dwType, NULL, &cbData);
937 if (rc != ERROR_SUCCESS)
938 return rc;
939 if (dwType != REG_SZ)
941 pwszValue = HeapAlloc(GetProcessHeap(), 0, cbData + sizeof(WCHAR));
942 if (!pwszValue)
944 rc = RegQueryValueExW(hKey, pszKey, NULL, NULL, (LPBYTE)pwszValue, &cbData);
945 if (rc != ERROR_SUCCESS)
946 {
947 HeapFree(GetProcessHeap(), 0, pwszValue);
948 return rc;
949 }
950 /* NULL-terminate the string */
951 pwszValue[cbData / sizeof(WCHAR)] = '\0';
952
953 *pValue = pwszValue;
954 return ERROR_SUCCESS;
955}
956
957static BOOL
959{
960 HKEY hControlKey = NULL;
961 LPWSTR pwszSystemStartOptions = NULL;
962 LPWSTR pwszCurrentOption, pwszNextOption; /* Pointers into SystemStartOptions */
963 BOOL bConsoleBoot = FALSE;
964 LONG rc;
965
967 L"SYSTEM\\CurrentControlSet\\Control",
968 0,
970 &hControlKey);
971 if (rc != ERROR_SUCCESS)
972 goto cleanup;
973
974 rc = ReadRegSzKey(hControlKey, L"SystemStartOptions", &pwszSystemStartOptions);
975 if (rc != ERROR_SUCCESS)
976 goto cleanup;
977
978 /* Check for CONSOLE switch in SystemStartOptions */
979 pwszCurrentOption = pwszSystemStartOptions;
980 while (pwszCurrentOption)
981 {
982 pwszNextOption = wcschr(pwszCurrentOption, L' ');
983 if (pwszNextOption)
984 *pwszNextOption = L'\0';
985 if (_wcsicmp(pwszCurrentOption, L"CONSOLE") == 0)
986 {
987 DPRINT("Found %S. Switching to console boot\n", pwszCurrentOption);
988 bConsoleBoot = TRUE;
989 goto cleanup;
990 }
991 pwszCurrentOption = pwszNextOption ? pwszNextOption + 1 : NULL;
992 }
993
994cleanup:
995 if (hControlKey != NULL)
996 RegCloseKey(hControlKey);
997 if (pwszSystemStartOptions)
998 HeapFree(GetProcessHeap(), 0, pwszSystemStartOptions);
999 return bConsoleBoot;
1000}
1001
1002static VOID
1004 _In_ PCWSTR pszInf)
1005{
1006 WCHAR szInfApp[MAX_PATH], szInfArg[MAX_PATH * 3];
1007 WCHAR szCmd[_countof(szInfApp) + _countof(szInfArg)];
1008 UINT cch;
1009
1010 if (!GetPrivateProfileStringW(L"GuiUnattended", L"DetachedProgram", L"", szInfApp, _countof(szInfApp), pszInf) || !*szInfApp)
1011 return;
1012 cch = ExpandEnvironmentStrings(szInfApp, szCmd, _countof(szCmd) - 1);
1013 if (GetPrivateProfileStringW(L"GuiUnattended", L"Arguments", L"", szInfArg, _countof(szInfArg), pszInf) && cch)
1014 {
1015 szCmd[cch - 1] = L' ';
1016 szCmd[cch] = UNICODE_NULL;
1017 ExpandEnvironmentStrings(szInfArg, szCmd + cch, _countof(szCmd) - cch);
1018 }
1019 RunCommandAndWait(szCmd);
1020}
1021
1022extern VOID
1025 _In_opt_ PCWSTR ThemeFile);
1026
1035static VOID
1037 _In_ BOOL IsInstall)
1038{
1040 WCHAR szValue[MAX_PATH];
1041 BOOL bDefaultThemesOff;
1042
1043 if (IsInstall)
1044 {
1045 /* See also wizard.c!ProcessSetupInf()
1046 * Retrieve the path of the setup INF */
1048 }
1049 else
1050 {
1051 /* See also userinit/livecd.c!RunLiveCD() */
1053 wcscat(szPath, L"\\unattend.inf");
1054 }
1055
1056 /*
1057 * Apply initial default theming
1058 */
1059
1060 /* Check whether to use the classic theme (TRUE) instead of the default theme */
1061 bDefaultThemesOff = FALSE;
1062 if (GetPrivateProfileStringW(L"Shell", L"DefaultThemesOff", L"no", szValue, _countof(szValue), szPath) && *szValue)
1063 bDefaultThemesOff = (_wcsicmp(szValue, L"yes") == 0);
1064
1065 if (!bDefaultThemesOff)
1066 {
1067 /* Retrieve the complete path to a .theme (or for ReactOS, a .msstyles) file */
1068 if (!GetPrivateProfileStringW(L"Shell", L"CustomDefaultThemeFile", NULL, szValue, _countof(szValue), szPath) || !*szValue)
1069 bDefaultThemesOff = TRUE; // None specified, fall back to the classic theme.
1070 }
1071
1072 /* Enable the chosen theme, or use the classic theme */
1073 EnableVisualTheme(NULL, bDefaultThemesOff ? NULL : szValue);
1074
1075 if (IsInstall)
1077}
1078
1079static BOOL
1081{
1083 DWORD dwThreadId = 0;
1084 BOOL bResult = FALSE;
1085
1086 hSysSetupInf = SetupOpenInfFileW(L"syssetup.inf",
1087 NULL,
1089 NULL);
1091 {
1092 FatalError("SetupOpenInfFileW() failed to open 'syssetup.inf' (Error: %lu)\n", GetLastError());
1093 return FALSE;
1094 }
1095
1097 {
1098 FatalError("InstallSysSetupInfDevices() failed!\n");
1099 goto Exit;
1100 }
1101
1103 {
1104 FatalError("InstallSysSetupInfComponents() failed!\n");
1105 goto Exit;
1106 }
1107
1108 if (!IsConsoleBoot())
1109 {
1111 0,
1113 NULL,
1114 0,
1115 &dwThreadId);
1116 }
1117
1119 {
1120 FatalError("EnableUserModePnpManager() failed!\n");
1121 goto Exit;
1122 }
1123
1125 {
1126 FatalError("CMP_WaitNoPendingInstallEvents() failed!\n");
1127 goto Exit;
1128 }
1129
1130 bResult = TRUE;
1131
1132Exit:
1133 if (bResult == FALSE)
1134 {
1136 }
1137
1138 if (hThread != NULL)
1139 {
1143 }
1144
1145 return bResult;
1146}
1147
1148static
1149DWORD
1151{
1152 STARTUPINFOW StartupInfo;
1153 PROCESS_INFORMATION ProcessInformation;
1154 BOOL bRes;
1155
1157 if (!CommonInstall())
1158 goto error;
1159
1160 /* Install the TCP/IP protocol driver */
1161 bRes = InstallNetworkComponent(L"MS_TCPIP");
1162 if (!bRes && GetLastError() != ERROR_FILE_NOT_FOUND)
1163 {
1164 DPRINT("InstallNetworkComponent() failed with error 0x%lx\n", GetLastError());
1165 }
1166 else
1167 {
1168 /* Start the TCP/IP protocol driver */
1169 SetupStartService(L"Tcpip", FALSE);
1170 SetupStartService(L"Dhcp", FALSE);
1171 SetupStartService(L"Dnscache", FALSE);
1172 }
1173
1174 /* Register components */
1175 _SEH2_TRY
1176 {
1178 hSysSetupInf, L"RegistrationPhase2",
1179 SPINST_ALL,
1180 0, NULL, 0, NULL, NULL, NULL, NULL))
1181 {
1182 DPRINT1("SetupInstallFromInfSectionW failed!\n");
1183 }
1184
1185 RegisterTypeLibraries(NULL, NULL, hSysSetupInf, L"TypeLibraries");
1186 }
1188 {
1189 DPRINT1("Catching exception\n");
1190 }
1191 _SEH2_END;
1192
1194
1195 /* Run the shell */
1196 ZeroMemory(&StartupInfo, sizeof(StartupInfo));
1197 StartupInfo.cb = sizeof(StartupInfo);
1198 bRes = CreateProcessW(L"userinit.exe",
1199 NULL,
1200 NULL,
1201 NULL,
1202 FALSE,
1203 0,
1204 NULL,
1205 NULL,
1206 &StartupInfo,
1207 &ProcessInformation);
1208 if (!bRes)
1209 goto error;
1210
1211 CloseHandle(ProcessInformation.hThread);
1212 CloseHandle(ProcessInformation.hProcess);
1213
1214 return 0;
1215
1216error:
1218 L"Failed to load LiveCD! You can shutdown your computer, or press ENTER to reboot.",
1219 L"ReactOS LiveCD",
1220 MB_OK);
1221 // HACK: This shouldn't be done here, but by the caller of InstallWindowsNt()
1222 /* Enable the shutdown privilege and reboot the machine */
1224 DPRINT1("pSetupEnablePrivilege(SE_SHUTDOWN_NAME) failed (Error %lu)\n", GetLastError());
1226 return 0;
1227}
1228
1229
1230static BOOL
1232{
1233 DWORD dwError;
1234 HKEY hKey;
1235
1236 dwError = RegOpenKeyExW(
1238 L"SYSTEM\\Setup",
1239 0,
1241 &hKey);
1242 if (dwError != ERROR_SUCCESS)
1243 return FALSE;
1244
1245 dwError = RegSetValueExW(
1246 hKey,
1247 L"SetupType",
1248 0,
1249 REG_DWORD,
1250 (LPBYTE)&dwSetupType,
1251 sizeof(DWORD));
1253 if (dwError != ERROR_SUCCESS)
1254 return FALSE;
1255
1256 return TRUE;
1257}
1258
1259static DWORD CALLBACK
1261{
1262 ATOM hotkey;
1263 MSG msg;
1264
1265 DPRINT("HotkeyThread start\n");
1266
1267 hotkey = GlobalAddAtomW(L"Setup Shift+F10 Hotkey");
1268 if (!RegisterHotKey(NULL, hotkey, MOD_SHIFT, VK_F10))
1269 DPRINT1("RegisterHotKey failed with %lu\n", GetLastError());
1270
1271 while (GetMessageW(&msg, NULL, 0, 0))
1272 {
1273 if (msg.hwnd == NULL && msg.message == WM_HOTKEY && msg.wParam == hotkey)
1274 {
1275 WCHAR CmdLine[] = L"cmd.exe"; // CreateProcess can modify this buffer.
1276 STARTUPINFOW si = { sizeof(si) };
1278
1279 if (CreateProcessW(NULL,
1280 CmdLine,
1281 NULL,
1282 NULL,
1283 FALSE,
1285 NULL,
1286 NULL,
1287 &si,
1288 &pi))
1289 {
1292 }
1293 else
1294 {
1295 DPRINT1("Failed to launch command prompt: %lu\n", GetLastError());
1296 }
1297 }
1298 }
1299
1300 UnregisterHotKey(NULL, hotkey);
1301 GlobalDeleteAtom(hotkey);
1302
1303 DPRINT("HotkeyThread terminate\n");
1304 return 0;
1305}
1306
1307
1308static
1309BOOL
1311{
1312 LONG Error;
1313 HKEY hKey;
1315 WCHAR szProgramFilesDirPath[MAX_PATH];
1316 WCHAR szCommonFilesDirPath[MAX_PATH];
1317 WCHAR szBuffer[MAX_PATH];
1318
1319 /* Load 'Program Files' location */
1322 szBuffer,
1323 ARRAYSIZE(szBuffer)))
1324 {
1325 DPRINT1("Error: %lu\n", GetLastError());
1326 return FALSE;
1327 }
1328
1331 szCommonFilesDirPath,
1332 ARRAYSIZE(szCommonFilesDirPath)))
1333 {
1334 DPRINT1("Warning: %lu\n", GetLastError());
1335 }
1336
1337 /* Expand it */
1338 if (!ExpandEnvironmentStringsW(szBuffer,
1339 szProgramFilesDirPath,
1340 ARRAYSIZE(szProgramFilesDirPath)))
1341 {
1342 DPRINT1("Error: %lu\n", GetLastError());
1343 return FALSE;
1344 }
1345
1346 wcscpy(szBuffer, szProgramFilesDirPath);
1347 wcscat(szBuffer, L"\\");
1348 wcscat(szBuffer, szCommonFilesDirPath);
1349
1350 if (!ExpandEnvironmentStringsW(szBuffer,
1351 szCommonFilesDirPath,
1352 ARRAYSIZE(szCommonFilesDirPath)))
1353 {
1354 DPRINT1("Warning: %lu\n", GetLastError());
1355 }
1356
1357 /* Store it */
1359 L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion",
1360 0,
1362 &hKey);
1363 if (Error != ERROR_SUCCESS)
1364 {
1365 DPRINT1("Error: %lu\n", Error);
1366 return FALSE;
1367 }
1368
1369 dwLength = (wcslen(szProgramFilesDirPath) + 1) * sizeof(WCHAR);
1371 L"ProgramFilesDir",
1372 0,
1373 REG_SZ,
1374 (LPBYTE)szProgramFilesDirPath,
1375 dwLength);
1376 if (Error != ERROR_SUCCESS)
1377 {
1378 DPRINT1("Error: %lu\n", Error);
1380 return FALSE;
1381 }
1382
1383 dwLength = (wcslen(szCommonFilesDirPath) + 1) * sizeof(WCHAR);
1385 L"CommonFilesDir",
1386 0,
1387 REG_SZ,
1388 (LPBYTE)szCommonFilesDirPath,
1389 dwLength);
1390 if (Error != ERROR_SUCCESS)
1391 {
1392 DPRINT1("Warning: %lu\n", Error);
1393 }
1394
1396
1397 /* Create directory */
1398 // FIXME: Security!
1399 if (!CreateDirectoryW(szProgramFilesDirPath, NULL))
1400 {
1402 {
1403 DPRINT1("Error: %lu\n", GetLastError());
1404 return FALSE;
1405 }
1406 }
1407
1408 /* Create directory */
1409 // FIXME: Security!
1410 if (!CreateDirectoryW(szCommonFilesDirPath, NULL))
1411 {
1413 {
1414 DPRINT1("Warning: %lu\n", GetLastError());
1415 // return FALSE;
1416 }
1417 }
1418
1419 return TRUE;
1420}
1421
1422
1423static
1424VOID
1426{
1427 WCHAR szBuffer[80];
1428 PWSTR ptr;
1429 HKEY hLocaleKey;
1430 DWORD ret;
1431 DWORD dwSize;
1432 LCID lcid;
1433 INT i;
1434
1435 struct {LCTYPE LCType; PWSTR pValue;} LocaleData[] = {
1436 /* Number */
1437 {LOCALE_SDECIMAL, L"sDecimal"},
1438 {LOCALE_STHOUSAND, L"sThousand"},
1439 {LOCALE_SNEGATIVESIGN, L"sNegativeSign"},
1440 {LOCALE_SPOSITIVESIGN, L"sPositiveSign"},
1441 {LOCALE_SGROUPING, L"sGrouping"},
1442 {LOCALE_SLIST, L"sList"},
1443 {LOCALE_SNATIVEDIGITS, L"sNativeDigits"},
1444 {LOCALE_INEGNUMBER, L"iNegNumber"},
1445 {LOCALE_IDIGITS, L"iDigits"},
1446 {LOCALE_ILZERO, L"iLZero"},
1447 {LOCALE_IMEASURE, L"iMeasure"},
1448 {LOCALE_IDIGITSUBSTITUTION, L"NumShape"},
1449
1450 /* Currency */
1451 {LOCALE_SCURRENCY, L"sCurrency"},
1452 {LOCALE_SMONDECIMALSEP, L"sMonDecimalSep"},
1453 {LOCALE_SMONTHOUSANDSEP, L"sMonThousandSep"},
1454 {LOCALE_SMONGROUPING, L"sMonGrouping"},
1455 {LOCALE_ICURRENCY, L"iCurrency"},
1456 {LOCALE_INEGCURR, L"iNegCurr"},
1457 {LOCALE_ICURRDIGITS, L"iCurrDigits"},
1458
1459 /* Time */
1460 {LOCALE_STIMEFORMAT, L"sTimeFormat"},
1461 {LOCALE_STIME, L"sTime"},
1462 {LOCALE_S1159, L"s1159"},
1463 {LOCALE_S2359, L"s2359"},
1464 {LOCALE_ITIME, L"iTime"},
1465 {LOCALE_ITIMEMARKPOSN, L"iTimePrefix"},
1466 {LOCALE_ITLZERO, L"iTLZero"},
1467
1468 /* Date */
1469 {LOCALE_SLONGDATE, L"sLongDate"},
1470 {LOCALE_SSHORTDATE, L"sShortDate"},
1471 {LOCALE_SDATE, L"sDate"},
1472 {LOCALE_IFIRSTDAYOFWEEK, L"iFirstDayOfWeek"},
1473 {LOCALE_IFIRSTWEEKOFYEAR, L"iFirstWeekOfYear"},
1474 {LOCALE_IDATE, L"iDate"},
1475 {LOCALE_ICALENDARTYPE, L"iCalendarType"},
1476
1477 /* Misc */
1478 {LOCALE_SCOUNTRY, L"sCountry"},
1479 {LOCALE_SABBREVLANGNAME, L"sLanguage"},
1480 {LOCALE_ICOUNTRY, L"iCountry"},
1481 {0, NULL}};
1482
1484 L".DEFAULT\\Control Panel\\International",
1485 0,
1487 &hLocaleKey);
1488 if (ret != ERROR_SUCCESS)
1489 {
1490 return;
1491 }
1492
1493 dwSize = 9 * sizeof(WCHAR);
1494 ret = RegQueryValueExW(hLocaleKey,
1495 L"Locale",
1496 NULL,
1497 NULL,
1498 (PBYTE)szBuffer,
1499 &dwSize);
1500 if (ret != ERROR_SUCCESS)
1501 goto done;
1502
1503 lcid = (LCID)wcstoul(szBuffer, &ptr, 16);
1504 if (lcid == 0)
1505 goto done;
1506
1507 i = 0;
1508 while (LocaleData[i].pValue != NULL)
1509 {
1510 if (GetLocaleInfoW(lcid,
1511 LocaleData[i].LCType | LOCALE_NOUSEROVERRIDE,
1512 szBuffer,
1513 ARRAYSIZE(szBuffer)))
1514 {
1515 RegSetValueExW(hLocaleKey,
1516 LocaleData[i].pValue,
1517 0,
1518 REG_SZ,
1519 (PBYTE)szBuffer,
1520 (wcslen(szBuffer) + 1) * sizeof(WCHAR));
1521 }
1522
1523 i++;
1524 }
1525
1526done:
1527 RegCloseKey(hLocaleKey);
1528}
1529
1530
1531static
1532DWORD
1534{
1535 WCHAR szDefaultUserHive[MAX_PATH];
1536 HKEY hUserKey = NULL;
1537 DWORD cchSize;
1538 DWORD dwError;
1539
1540 DPRINT("SaveDefaultUserHive()\n");
1541
1542 cchSize = ARRAYSIZE(szDefaultUserHive);
1543 GetDefaultUserProfileDirectoryW(szDefaultUserHive, &cchSize);
1544
1545 wcscat(szDefaultUserHive, L"\\ntuser.dat");
1546
1547 dwError = RegOpenKeyExW(HKEY_USERS,
1548 L".DEFAULT",
1549 0,
1550 KEY_READ,
1551 &hUserKey);
1552 if (dwError != ERROR_SUCCESS)
1553 {
1554 DPRINT1("RegOpenKeyExW() failed (Error %lu)\n", dwError);
1555 return dwError;
1556 }
1557
1559 DPRINT1("pSetupEnablePrivilege(SE_BACKUP_NAME) failed (Error %lu)\n", GetLastError());
1560
1561 /* Save the Default hive */
1562 dwError = RegSaveKeyExW(hUserKey,
1563 szDefaultUserHive,
1564 NULL,
1566 if (dwError == ERROR_ALREADY_EXISTS)
1567 {
1568 WCHAR szBackupHive[MAX_PATH];
1569
1570 /* Build the backup hive file name by replacing the extension */
1571 wcscpy(szBackupHive, szDefaultUserHive);
1572 wcscpy(&szBackupHive[wcslen(szBackupHive) - 4], L".bak");
1573
1574 /* Back up the existing default user hive by renaming it, replacing any possible existing old backup */
1575 if (!MoveFileExW(szDefaultUserHive,
1576 szBackupHive,
1578 {
1579 dwError = GetLastError();
1580 DPRINT1("Failed to create a default-user hive backup '%S', MoveFileExW failed (Error %lu)\n",
1581 szBackupHive, dwError);
1582 }
1583 else
1584 {
1585 /* The backup has been done, retry saving the Default hive */
1586 dwError = RegSaveKeyExW(hUserKey,
1587 szDefaultUserHive,
1588 NULL,
1590 }
1591 }
1592 if (dwError != ERROR_SUCCESS)
1593 {
1594 DPRINT1("RegSaveKeyExW() failed (Error %lu)\n", dwError);
1595 }
1596
1598
1599 RegCloseKey(hUserKey);
1600
1601 return dwError;
1602}
1603
1604
1605static
1606DWORD
1608{
1609 BOOL ret;
1610 DWORD dwHotkeyThreadId = 0;
1611 WCHAR szBuffer[MAX_PATH];
1612
1614 LogItem(NULL, L"Installing ReactOS");
1615
1616 CreateTempDir(L"TEMP");
1617 CreateTempDir(L"TMP");
1618
1620 {
1621 FatalError("InitializeProgramFilesDir() failed");
1622 goto Quit;
1623 }
1624
1625 if (!InitializeProfiles())
1626 {
1627 FatalError("InitializeProfiles() failed");
1628 goto Quit;
1629 }
1630
1632
1633 if (GetWindowsDirectoryW(szBuffer, ARRAYSIZE(szBuffer)))
1634 {
1635 HKEY hKey;
1637 L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion",
1638 0,
1639 KEY_WRITE,
1640 &hKey) == ERROR_SUCCESS)
1641 {
1643 L"PathName",
1644 0,
1645 REG_SZ,
1646 (LPBYTE)szBuffer,
1647 (wcslen(szBuffer) + 1) * sizeof(WCHAR));
1648
1650 L"SystemRoot",
1651 0,
1652 REG_SZ,
1653 (LPBYTE)szBuffer,
1654 (wcslen(szBuffer) + 1) * sizeof(WCHAR));
1655
1657 }
1658
1659 PathAddBackslash(szBuffer);
1660 wcscat(szBuffer, L"system");
1661 CreateDirectory(szBuffer, NULL);
1662 }
1663
1665 {
1666 FatalError("SaveDefaultUserHive() failed");
1667 goto Quit;
1668 }
1669
1670 if (!CopySystemProfile(0))
1671 {
1672 FatalError("CopySystemProfile() failed");
1673 goto Quit;
1674 }
1675
1676 /* Start the hotkey thread */
1677 CloseHandle(CreateThread(NULL, 0, HotkeyThread, NULL, 0, &dwHotkeyThreadId));
1678
1680 if (!CommonInstall())
1681 goto Quit;
1682
1683 /* Install the TCP/IP protocol driver */
1684 ret = InstallNetworkComponent(L"MS_TCPIP");
1686 {
1687 DPRINT("InstallNetworkComponent() failed with error 0x%lx\n", GetLastError());
1688 }
1689 else
1690 {
1691 /* Start the TCP/IP protocol driver */
1692 SetupStartService(L"Tcpip", FALSE);
1693 SetupStartService(L"Dhcp", FALSE);
1694 SetupStartService(L"Dnscache", FALSE);
1695 }
1696
1697 InstallWizard();
1698
1700
1702 SetSetupType(0);
1703
1704 /* Stop the hotkey thread */
1705 if (dwHotkeyThreadId)
1706 PostThreadMessage(dwHotkeyThreadId, WM_QUIT, 0, 0);
1707
1708 LogItem(NULL, L"Installing ReactOS done");
1710
1711 if (AdminInfo.Name != NULL)
1712 RtlFreeHeap(RtlGetProcessHeap(), 0, AdminInfo.Name);
1713
1714 if (AdminInfo.Domain != NULL)
1715 RtlFreeHeap(RtlGetProcessHeap(), 0, AdminInfo.Domain);
1716
1717 if (AdminInfo.Password != NULL)
1718 RtlFreeHeap(RtlGetProcessHeap(), 0, AdminInfo.Password);
1719
1720Quit:
1721 // HACK: This shouldn't be done here, but by the caller of InstallWindowsNt()
1722 /* Enable the shutdown privilege and reboot the machine */
1724 DPRINT1("pSetupEnablePrivilege(SE_SHUTDOWN_NAME) failed (Error %lu)\n", GetLastError());
1726 return 0;
1727}
1728
1729
1730/*
1731 * Standard Windows-compatible export, which dispatches
1732 * to either 'InstallReactOS' or 'InstallLiveCD'.
1733 */
1734INT
1735WINAPI
1737{
1738 INT i;
1739 PWSTR p;
1740
1741 for (i = 0; i < argc; ++i)
1742 {
1743 p = argv[i];
1744 if (*p == L'-')
1745 {
1746 p++;
1747
1748 // NOTE: On Windows, "mini" means "minimal UI", and can be used
1749 // in addition to "newsetup"; these options are not exclusive.
1750 if (_wcsicmp(p, L"newsetup") == 0)
1751 return (INT)InstallReactOS();
1752 else if (_wcsicmp(p, L"mini") == 0)
1753 return (INT)InstallLiveCD();
1754
1755 /* Add support for other switches */
1756 }
1757 }
1758
1759 return 0;
1760}
1761
1762
1763/*
1764 * @unimplemented
1765 */
1768 IN HANDLE hWnd,
1769 IN LPCWSTR lpszFontSize)
1770{
1772 return FALSE;
1773}
1774
1775/*
1776 * @unimplemented
1777 */
1780 LCID Lcid,
1781 LPCWSTR lpSrcRootPath,
1782 char Unknown,
1783 DWORD dwUnused1,
1784 DWORD dwUnused2)
1785{
1787 return FALSE;
1788}
1789
1790/*
1791 * @implemented
1792 */
1795{
1796 return SetupChangeLocaleEx(hWnd, Lcid, NULL, 0, 0, 0);
1797}
1798
1799
1800DWORD
1801WINAPI
1803 LPCWSTR lpServiceName,
1804 BOOL bWait)
1805{
1806 SC_HANDLE hManager = NULL;
1807 SC_HANDLE hService = NULL;
1808 DWORD dwError = ERROR_SUCCESS;
1809
1810 hManager = OpenSCManagerW(NULL,
1811 NULL,
1813 if (hManager == NULL)
1814 {
1815 dwError = GetLastError();
1816 goto done;
1817 }
1818
1819 hService = OpenServiceW(hManager,
1820 lpServiceName,
1822 if (hService == NULL)
1823 {
1824 dwError = GetLastError();
1825 goto done;
1826 }
1827
1828 if (!StartService(hService, 0, NULL))
1829 {
1830 dwError = GetLastError();
1831 goto done;
1832 }
1833
1834done:
1835 if (hService != NULL)
1836 CloseServiceHandle(hService);
1837
1838 if (hManager != NULL)
1839 CloseServiceHandle(hManager);
1840
1841 return dwError;
1842}
#define SE_BACKUP_NAME
#define REG_SZ
Definition: layer.c:22
#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
#define ARRAYSIZE(a)
Definition: cat.c:25
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 @1887 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)
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
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 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
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
Definition: loader.c:288
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
Definition: path.c:1164
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2370
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:4491
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
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:33
#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:3894
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:3500
static BOOL CreateShortcut(LPCWSTR pszFolder, LPCWSTR pszName, LPCWSTR pszCommand, LPCWSTR pszDescription, INT iIconNr, LPCWSTR pszWorkingDir, LPCWSTR pszArgs)
Definition: install.c:120
static BOOL EnableUserModePnpManager(VOID)
Definition: install.c:612
DWORD WINAPI SetupChangeLocale(HWND hWnd, LCID Lcid)
Definition: install.c:1794
static BOOL CreateShortcuts(_In_ PITEMSDATA pItemsData, _In_ PREGISTRATIONNOTIFY pNotify, _In_ HINF hinf, _In_ LPCWSTR szSection)
Definition: install.c:245
static VOID InitializeDefaultUserLocale(VOID)
Definition: install.c:1425
static DWORD SaveDefaultUserHive(VOID)
Definition: install.c:1533
struct _DLG_DATA * PDLG_DATA
static BOOL InstallSysSetupInfComponents(VOID)
Definition: install.c:462
static BOOL CommonInstall(VOID)
Definition: install.c:1080
VOID EnableVisualTheme(_In_opt_ HWND hwndParent, _In_opt_ PCWSTR ThemeFile)
Definition: wizard.c:1474
static INT_PTR CALLBACK StatusMessageWindowProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: install.c:760
static VOID PreprocessUnattend(_In_ BOOL IsInstall)
Pre-process unattended file to apply early settings.
Definition: install.c:1036
static BOOL InstallSysSetupInfDevices(VOID)
Definition: install.c:426
ADMIN_INFO AdminInfo
Definition: install.c:40
static VOID ProcessDetachedProgram(_In_ PCWSTR pszInf)
Definition: install.c:1003
DWORD WINAPI SetupStartService(LPCWSTR lpServiceName, BOOL bWait)
Definition: install.c:1802
INT WINAPI InstallWindowsNt(INT argc, WCHAR **argv)
Definition: install.c:1736
static HRESULT CreateShellLink(LPCWSTR pszLinkPath, LPCWSTR pszCmd, LPCWSTR pszArg, LPCWSTR pszDir, LPCWSTR pszIconPath, INT iIconNr, LPCWSTR pszComment)
Definition: install.c:74
static VOID CreateTempDir(IN LPCWSTR VarName)
Definition: install.c:373
static VOID AdjustStatusMessageWindow(HWND hwndDlg, PDLG_DATA pDlgData)
Definition: install.c:696
static DWORD WINAPI ShowStatusMessageThread(IN LPVOID lpParameter)
Definition: install.c:892
HINF hSysSetupInf
Definition: install.c:39
static BOOL SetSetupType(DWORD dwSetupType)
Definition: install.c:1231
BOOL RegisterTypeLibraries(_In_ PITEMSDATA pItemsData, _In_ PREGISTRATIONNOTIFY pNotify, _In_ HINF hinf, _In_ LPCWSTR szSection)
Definition: install.c:541
static BOOL InitializeProgramFilesDir(VOID)
Definition: install.c:1310
DWORD WINAPI SetupChangeFontSize(IN HANDLE hWnd, IN LPCWSTR lpszFontSize)
Definition: install.c:1767
static DWORD CALLBACK HotkeyThread(LPVOID Parameter)
Definition: install.c:1260
static VOID FatalError(char *pszFmt,...)
Definition: install.c:55
static DWORD InstallLiveCD(VOID)
Definition: install.c:1150
VOID InstallStartMenuItems(_In_ PITEMSDATA pItemsData)
Definition: install.c:315
struct _DLG_DATA DLG_DATA
static DWORD InstallReactOS(VOID)
Definition: install.c:1607
static LONG CountShortcuts(_In_ HINF hinf, _In_ LPCWSTR szSection)
Definition: install.c:289
static BOOL CreateShortcutsFromSection(_In_ PITEMSDATA pItemsData, _In_ PREGISTRATIONNOTIFY pNotify, _In_ HINF hinf, _In_ LPWSTR pszSection, _In_ LPCWSTR pszFolder)
Definition: install.c:186
DWORD WINAPI SetupChangeLocaleEx(HWND hWnd, LCID Lcid, LPCWSTR lpSrcRootPath, char Unknown, DWORD dwUnused1, DWORD dwUnused2)
Definition: install.c:1779
#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 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:147
#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
DWORD dwThreadId
Definition: fdebug.c:31
#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
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
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
static const WCHAR szDescription[]
Definition: powrprof.c:46
_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
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
#define IMAGE_BITMAP
Definition: winuser.h:211
#define DWLP_USER
Definition: winuser.h:883
#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 _SEH2_EXCEPT(...)
Definition: pseh2_64.h:104
#define _SEH2_END
Definition: pseh2_64.h:194
#define _SEH2_TRY
Definition: pseh2_64.h:93
#define IDB_BRAND_BANNER
Definition: rosbrand.h:8
#define IDB_BRAND_BANNERLINE
Definition: rosbrand.h:9
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:2673
#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 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
Definition: dcommon.idl:28
long bottom
Definition: dcommon.idl:29
long right
Definition: dcommon.idl:29
long left
Definition: dcommon.idl:29
long top
Definition: dcommon.idl:29
LPWSTR Password
Definition: globals.h:25
LPWSTR Name
Definition: globals.h:23
LPWSTR Domain
Definition: globals.h:24
Definition: gui.c:38
HBITMAP hLogoBitmap
Definition: install.c:44
HBITMAP hBarBitmap
Definition: install.c:45
DWORD BarHeight
Definition: install.c:49
DWORD BarWidth
Definition: install.c:48
HWND hWndBarCtrl
Definition: gui.c:40
DWORD BarCounter
Definition: gui.c:41
DWORD dwWaitHint
Definition: winsvc.h:111
DWORD dwCurrentState
Definition: winsvc.h:106
Definition: style.c:91
LONG bmHeight
Definition: wingdi.h:1869
LONG bmWidth
Definition: wingdi.h:1868
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
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
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define ExpandEnvironmentStrings
Definition: winbase.h:3497
#define LOAD_LIBRARY_AS_DATAFILE
Definition: winbase.h:338
#define CreateDirectory
Definition: winbase.h:3469
_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
#define SERVICE_AUTO_START
Definition: cmtypes.h:978
#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