ReactOS 0.4.16-dev-981-g80eb313
install.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS system libraries
4 * PURPOSE: System setup
5 * FILE: dll/win32/syssetup/install.c
6 * PROGRAMER: Eric Kohl
7 */
8
9/* INCLUDES *****************************************************************/
10
11#include "precomp.h"
12
13#define COBJMACROS
14
15#include <io.h>
16#include <wincon.h>
17#include <winnls.h>
18#include <winsvc.h>
19#include <userenv.h>
20#include <shlobj.h>
21#include <shlwapi.h>
22#include <shobjidl.h>
23#include <rpcproxy.h>
24#include <ndk/cmfuncs.h>
25
26#define NDEBUG
27#include <debug.h>
28
29//DWORD WINAPI
30//CMP_WaitNoPendingInstallEvents(DWORD dwTimeout);
31
33SetupStartService(LPCWSTR lpServiceName, BOOL bWait);
34
35/* GLOBALS ******************************************************************/
36
39
40typedef struct _DLG_DATA
41{
49
50/* FUNCTIONS ****************************************************************/
51
52static VOID
53FatalError(char *pszFmt,...)
54{
55 char szBuffer[512];
56 va_list ap;
57
58 va_start(ap, pszFmt);
59 vsprintf(szBuffer, pszFmt, ap);
60 va_end(ap);
61
62 LogItem(NULL, L"Failed");
63
64 strcat(szBuffer, "\nRebooting now!");
66 szBuffer,
67 "ReactOS Setup",
68 MB_OK);
69}
70
71static HRESULT
73 LPCWSTR pszLinkPath,
74 LPCWSTR pszCmd,
75 LPCWSTR pszArg,
77 LPCWSTR pszIconPath,
78 INT iIconNr,
79 LPCWSTR pszComment)
80{
81 IShellLinkW *psl;
82 IPersistFile *ppf;
83
84 HRESULT hr = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, &IID_IShellLink, (LPVOID*)&psl);
85
86 if (SUCCEEDED(hr))
87 {
88 hr = IShellLinkW_SetPath(psl, pszCmd);
89
90 if (pszArg)
91 hr = IShellLinkW_SetArguments(psl, pszArg);
92
93 if (pszDir)
94 hr = IShellLinkW_SetWorkingDirectory(psl, pszDir);
95
96 if (pszIconPath)
97 hr = IShellLinkW_SetIconLocation(psl, pszIconPath, iIconNr);
98
99 if (pszComment)
100 hr = IShellLinkW_SetDescription(psl, pszComment);
101
102 hr = IShellLinkW_QueryInterface(psl, &IID_IPersistFile, (LPVOID*)&ppf);
103
104 if (SUCCEEDED(hr))
105 {
106 hr = IPersistFile_Save(ppf, pszLinkPath, TRUE);
107 IPersistFile_Release(ppf);
108 }
109
110 IShellLinkW_Release(psl);
111 }
112
113 return hr;
114}
115
116
117static BOOL
119 LPCWSTR pszFolder,
120 LPCWSTR pszName,
121 LPCWSTR pszCommand,
122 LPCWSTR pszDescription,
123 INT iIconNr,
124 LPCWSTR pszWorkingDir,
125 LPCWSTR pszArgs)
126{
127 DWORD dwLen;
128 LPWSTR Ptr;
131 WCHAR szWorkingDirBuf[MAX_PATH];
132
133 /* If no working directory is provided, try to compute a default one */
134 if (pszWorkingDir == NULL || pszWorkingDir[0] == L'\0')
135 {
136 if (ExpandEnvironmentStringsW(pszCommand, szPath, ARRAYSIZE(szPath)) == 0)
137 wcscpy(szPath, pszCommand);
138
139 dwLen = GetFullPathNameW(szPath,
140 ARRAYSIZE(szWorkingDirBuf),
141 szWorkingDirBuf,
142 &lpFilePart);
143 if (dwLen != 0 && dwLen <= ARRAYSIZE(szWorkingDirBuf))
144 {
145 /* Since those should only be called with (.exe) files,
146 lpFilePart has not to be NULL */
148
149 /* We're only interested in the path. Cut the file name off.
150 Also remove the trailing backslash unless the working directory
151 is only going to be a drive, i.e. C:\ */
152 *(lpFilePart--) = L'\0';
153 if (!(lpFilePart - szWorkingDirBuf == 2 &&
154 szWorkingDirBuf[1] == L':' && szWorkingDirBuf[2] == L'\\'))
155 {
156 *lpFilePart = L'\0';
157 }
158 pszWorkingDir = szWorkingDirBuf;
159 }
160 }
161
162 /* If we failed to compute a working directory, just do not use one */
163 if (pszWorkingDir && pszWorkingDir[0] == L'\0')
164 pszWorkingDir = NULL;
165
166 /* Build the shortcut file name */
167 wcscpy(szPath, pszFolder);
169 wcscpy(Ptr, pszName);
170
171 /* Create the shortcut */
173 pszCommand,
174 pszArgs,
175 pszWorkingDir,
176 /* Special value to indicate no icon */
177 (iIconNr != -1 ? pszCommand : NULL),
178 iIconNr,
179 pszDescription));
180}
181
182
183static BOOL
185 _In_ PITEMSDATA pItemsData,
187 _In_ HINF hinf,
188 _In_ LPWSTR pszSection,
189 _In_ LPCWSTR pszFolder)
190{
192 DWORD dwFieldCount;
193 INT iIconNr;
194 WCHAR szCommand[MAX_PATH];
197 WCHAR szDirectory[MAX_PATH];
198 WCHAR szArgs[MAX_PATH];
199
200 if (!SetupFindFirstLine(hinf, pszSection, NULL, &Context))
201 return FALSE;
202
203 do
204 {
205 pNotify->Progress++;
206
207 SendMessage(pItemsData->hwndDlg, PM_STEP_START, 0, (LPARAM)pNotify);
208
209 dwFieldCount = SetupGetFieldCount(&Context);
210 if (dwFieldCount < 3)
211 continue;
212
213 if (!SetupGetStringFieldW(&Context, 1, szCommand, ARRAYSIZE(szCommand), NULL))
214 continue;
215
217 continue;
218
220 continue;
221
222 if (dwFieldCount < 4 || !SetupGetIntField(&Context, 4, &iIconNr))
223 iIconNr = -1; /* Special value to indicate no icon */
224
225 if (dwFieldCount < 5 || !SetupGetStringFieldW(&Context, 5, szDirectory, ARRAYSIZE(szDirectory), NULL))
226 szDirectory[0] = L'\0';
227
228 if (dwFieldCount < 6 || !SetupGetStringFieldW(&Context, 6, szArgs, ARRAYSIZE(szArgs), NULL))
229 szArgs[0] = L'\0';
230
231 wcscat(szName, L".lnk");
232
233 CreateShortcut(pszFolder, szName, szCommand, szDescription, iIconNr, szDirectory, szArgs);
234
235 SendMessage(pItemsData->hwndDlg, PM_STEP_END, 0, (LPARAM)pNotify);
236
237 } while (SetupFindNextLine(&Context, &Context));
238
239 return TRUE;
240}
241
242static BOOL
244 _In_ PITEMSDATA pItemsData,
246 _In_ HINF hinf,
247 _In_ LPCWSTR szSection)
248{
251 WCHAR szFolder[MAX_PATH];
252 WCHAR szFolderSection[MAX_PATH];
253 INT csidl;
254
256
257 if (!SetupFindFirstLine(hinf, szSection, NULL, &Context))
258 return FALSE;
259
260 do
261 {
262 if (SetupGetFieldCount(&Context) < 2)
263 continue;
264
265 if (!SetupGetStringFieldW(&Context, 0, szFolderSection, ARRAYSIZE(szFolderSection), NULL))
266 continue;
267
268 if (!SetupGetIntField(&Context, 1, &csidl))
269 continue;
270
271 if (!SetupGetStringFieldW(&Context, 2, szFolder, ARRAYSIZE(szFolder), NULL))
272 continue;
273
275 continue;
276
277 CreateShortcutsFromSection(pItemsData, pNotify, hinf, szFolderSection, szPath);
278
279 } while (SetupFindNextLine(&Context, &Context));
280
282
283 return TRUE;
284}
285
286static LONG
288 _In_ HINF hinf,
289 _In_ LPCWSTR szSection)
290{
292 WCHAR szFolderSection[MAX_PATH];
293 LONG Steps = 0;
294
295 if (!SetupFindFirstLine(hinf, szSection, NULL, &Context))
296 return FALSE;
297
298 do
299 {
300 if (SetupGetFieldCount(&Context) < 2)
301 continue;
302
303 if (!SetupGetStringFieldW(&Context, 0, szFolderSection, ARRAYSIZE(szFolderSection), NULL))
304 continue;
305
306 Steps += SetupGetLineCountW(hinf, szFolderSection);
307 } while (SetupFindNextLine(&Context, &Context));
308
309 return Steps;
310}
311
312VOID
314 _In_ PITEMSDATA pItemsData)
315{
316 HINF hShortcutsInf1 = INVALID_HANDLE_VALUE;
317 HINF hShortcutsInf2 = INVALID_HANDLE_VALUE;
318 LONG Steps = 0;
319 DWORD LastError = 0;
321
322 ZeroMemory(&Notify, sizeof(Notify));
323
324 hShortcutsInf1 = SetupOpenInfFileW(L"shortcuts.inf",
325 NULL,
327 NULL);
328 if (hShortcutsInf1 == INVALID_HANDLE_VALUE)
329 {
330 DPRINT1("Failed to open shortcuts.inf");
331 return;
332 }
333
334 hShortcutsInf2 = SetupOpenInfFileW(L"rosapps_shortcuts.inf",
335 NULL,
337 NULL);
338
339 Steps = CountShortcuts(hShortcutsInf1, L"ShortcutFolders");
340 if (hShortcutsInf2 != INVALID_HANDLE_VALUE)
341 Steps += CountShortcuts(hShortcutsInf2, L"ShortcutFolders");
342
343 SendMessage(pItemsData->hwndDlg, PM_ITEM_START, 1, (LPARAM)Steps);
344
345 if (!CreateShortcuts(pItemsData, &Notify, hShortcutsInf1, L"ShortcutFolders"))
346 {
347 DPRINT1("CreateShortcuts() failed");
348 goto done;
349 }
350
351 if (hShortcutsInf2 != INVALID_HANDLE_VALUE)
352 {
353 if (!CreateShortcuts(pItemsData, &Notify, hShortcutsInf2, L"ShortcutFolders"))
354 {
355 DPRINT1("CreateShortcuts(rosapps) failed");
356 goto done;
357 }
358 }
359
360done:
361 if (hShortcutsInf2 != INVALID_HANDLE_VALUE)
362 SetupCloseInfFile(hShortcutsInf2);
363
364 if (hShortcutsInf1 != INVALID_HANDLE_VALUE)
365 SetupCloseInfFile(hShortcutsInf1);
366
367 SendMessage(pItemsData->hwndDlg, PM_ITEM_END, 1, LastError);
368}
369
370static VOID
372 IN LPCWSTR VarName)
373{
374 WCHAR szTempDir[MAX_PATH];
375 WCHAR szBuffer[MAX_PATH];
377 HKEY hKey;
378
380 L"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment",
381 0,
383 &hKey) != ERROR_SUCCESS)
384 {
385 FatalError("Error: %lu\n", GetLastError());
386 return;
387 }
388
389 /* Get temp dir */
390 dwLength = sizeof(szBuffer);
392 VarName,
393 NULL,
394 NULL,
395 (LPBYTE)szBuffer,
397 {
398 FatalError("Error: %lu\n", GetLastError());
399 goto cleanup;
400 }
401
402 /* Expand it */
403 if (!ExpandEnvironmentStringsW(szBuffer, szTempDir, ARRAYSIZE(szTempDir)))
404 {
405 FatalError("Error: %lu\n", GetLastError());
406 goto cleanup;
407 }
408
409 /* Create profiles directory */
410 if (!CreateDirectoryW(szTempDir, NULL))
411 {
413 {
414 FatalError("Error: %lu\n", GetLastError());
415 goto cleanup;
416 }
417 }
418
419cleanup:
421}
422
423static BOOL
425{
426 INFCONTEXT InfContext;
427 WCHAR szLineBuffer[256];
428 DWORD dwLineLength;
429
431 L"DeviceInfsToInstall",
432 NULL,
433 &InfContext))
434 {
435 return FALSE;
436 }
437
438 do
439 {
440 if (!SetupGetStringFieldW(&InfContext,
441 0,
442 szLineBuffer,
443 ARRAYSIZE(szLineBuffer),
444 &dwLineLength))
445 {
446 return FALSE;
447 }
448
449 if (!SetupDiInstallClassW(NULL, szLineBuffer, DI_QUIETINSTALL, NULL))
450 {
451 return FALSE;
452 }
453 }
454 while (SetupFindNextLine(&InfContext, &InfContext));
455
456 return TRUE;
457}
458
459static BOOL
461{
462 INFCONTEXT InfContext;
463 WCHAR szNameBuffer[256];
464 WCHAR szSectionBuffer[256];
465 HINF hComponentInf = INVALID_HANDLE_VALUE;
466
468 L"Infs.Always",
469 NULL,
470 &InfContext))
471 {
472 DPRINT("No Inf.Always section found\n");
473 }
474 else
475 {
476 do
477 {
478 if (!SetupGetStringFieldW(&InfContext,
479 1, // Get the component name
480 szNameBuffer,
481 ARRAYSIZE(szNameBuffer),
482 NULL))
483 {
484 FatalError("Error while trying to get component name\n");
485 return FALSE;
486 }
487
488 if (!SetupGetStringFieldW(&InfContext,
489 2, // Get the component install section
490 szSectionBuffer,
491 ARRAYSIZE(szSectionBuffer),
492 NULL))
493 {
494 FatalError("Error while trying to get component install section\n");
495 return FALSE;
496 }
497
498 DPRINT("Trying to execute install section '%S' from '%S'\n", szSectionBuffer, szNameBuffer);
499
500 hComponentInf = SetupOpenInfFileW(szNameBuffer,
501 NULL,
503 NULL);
504
505 if (hComponentInf == INVALID_HANDLE_VALUE)
506 {
507 FatalError("SetupOpenInfFileW() failed to open '%S' (Error: %lu)\n", szNameBuffer, GetLastError());
508 return FALSE;
509 }
510
512 hComponentInf,
513 szSectionBuffer,
515 NULL,
516 NULL,
519 NULL,
520 NULL,
521 NULL))
522 {
523 FatalError("Error while trying to install : %S (Error: %lu)\n", szNameBuffer, GetLastError());
524 SetupCloseInfFile(hComponentInf);
525 return FALSE;
526 }
527
528 SetupCloseInfFile(hComponentInf);
529 }
530 while (SetupFindNextLine(&InfContext, &InfContext));
531 }
532
533 return TRUE;
534}
535
536
537
538BOOL
540 _In_ PITEMSDATA pItemsData,
542 _In_ HINF hinf,
543 _In_ LPCWSTR szSection)
544{
545 INFCONTEXT InfContext;
546 BOOL res;
549 INT csidl;
550 LPWSTR p;
552 HRESULT hret;
553
554 /* Begin iterating the entries in the inf section */
555 res = SetupFindFirstLine(hinf, szSection, NULL, &InfContext);
556 if (!res) return FALSE;
557
558 do
559 {
560 /* Get the name of the current type library */
561 if (!SetupGetStringFieldW(&InfContext, 1, szName, ARRAYSIZE(szName), NULL))
562 {
563 FatalError("SetupGetStringFieldW failed\n");
564 continue;
565 }
566
567 if (!SetupGetIntField(&InfContext, 2, &csidl))
568 csidl = CSIDL_SYSTEM;
569
570 hret = SHGetFolderPathW(NULL, csidl, NULL, 0, szPath);
571 if (FAILED(hret))
572 {
573 FatalError("SHGetFolderPathW failed hret=0x%lx\n", hret);
574 continue;
575 }
576
578 wcscpy(p, szName);
579
580 if (pItemsData && pNotify)
581 {
582 pNotify->Progress++;
583 pNotify->CurrentItem = szName;
584
585 DPRINT("RegisterTypeLibraries: Start step %ld\n", pNotify->Progress);
586 SendMessage(pItemsData->hwndDlg, PM_STEP_START, 0, (LPARAM)pNotify);
587 }
588
590 if (hmod == NULL)
591 {
592 FatalError("LoadLibraryW failed\n");
593 continue;
594 }
595
597
598 if (pItemsData && pNotify)
599 {
600 DPRINT("RegisterTypeLibraries: End step %ld\n", pNotify->Progress);
601 SendMessage(pItemsData->hwndDlg, PM_STEP_END, 0, (LPARAM)pNotify);
602 }
603
604 } while (SetupFindNextLine(&InfContext, &InfContext));
605
606 return TRUE;
607}
608
609static BOOL
611{
612 SC_HANDLE hSCManager = NULL;
613 SC_HANDLE hService = NULL;
615 BOOL bRet = FALSE;
616 DWORD BytesNeeded, WaitTime;
617
619 if (hSCManager == NULL)
620 {
621 DPRINT1("Unable to open the service control manager.\n");
622 DPRINT1("Last Error %d\n", GetLastError());
623 goto cleanup;
624 }
625
626 hService = OpenServiceW(hSCManager,
627 L"PlugPlay",
629 if (hService == NULL)
630 {
631 DPRINT1("Unable to open PlugPlay service\n");
632 goto cleanup;
633 }
634
635 bRet = ChangeServiceConfigW(hService,
639 NULL, NULL, NULL,
640 NULL, NULL, NULL, NULL);
641 if (!bRet)
642 {
643 DPRINT1("Unable to change the service configuration\n");
644 goto cleanup;
645 }
646
647 bRet = StartServiceW(hService, 0, NULL);
649 {
650 DPRINT1("Unable to start service\n");
651 goto cleanup;
652 }
653
654 while (TRUE)
655 {
656 bRet = QueryServiceStatusEx(hService,
659 sizeof(ServiceStatus),
660 &BytesNeeded);
661 if (!bRet)
662 {
663 DPRINT1("QueryServiceStatusEx() failed for PlugPlay service (error 0x%x)\n", GetLastError());
664 goto cleanup;
665 }
666
668 break;
669
670 WaitTime = ServiceStatus.dwWaitHint / 10;
671 if (WaitTime < 1000) WaitTime = 1000;
672 else if (WaitTime > 10000) WaitTime = 10000;
673 Sleep(WaitTime);
674 };
675
677 {
678 bRet = FALSE;
679 DPRINT1("Failed to start PlugPlay service\n");
680 goto cleanup;
681 }
682
683 bRet = TRUE;
684
685cleanup:
686 if (hService != NULL)
687 CloseServiceHandle(hService);
688 if (hSCManager != NULL)
690 return bRet;
691}
692
693static VOID
695{
696 INT xOld, yOld, cxOld, cyOld;
697 INT xNew, yNew, cxNew, cyNew;
698 INT cxLabel, cyLabel, dyLabel;
699 RECT rc, rcBar, rcLabel, rcWnd;
700 BITMAP bmLogo, bmBar;
701 DWORD style, exstyle;
702 HWND hwndLogo = GetDlgItem(hwndDlg, IDC_ROSLOGO);
703 HWND hwndBar = GetDlgItem(hwndDlg, IDC_BAR);
704 HWND hwndLabel = GetDlgItem(hwndDlg, IDC_STATUSLABEL);
705
706 /* This adjustment is for CJK only */
708 {
709 case LANG_CHINESE:
710 case LANG_JAPANESE:
711 case LANG_KOREAN:
712 break;
713
714 default:
715 return;
716 }
717
718 if (!GetObjectW(pDlgData->hLogoBitmap, sizeof(BITMAP), &bmLogo) ||
719 !GetObjectW(pDlgData->hBarBitmap, sizeof(BITMAP), &bmBar))
720 {
721 return;
722 }
723
724 GetWindowRect(hwndBar, &rcBar);
725 MapWindowPoints(NULL, hwndDlg, (LPPOINT)&rcBar, 2);
726 dyLabel = bmLogo.bmHeight - rcBar.top;
727
728 GetWindowRect(hwndLabel, &rcLabel);
729 MapWindowPoints(NULL, hwndDlg, (LPPOINT)&rcLabel, 2);
730 cxLabel = rcLabel.right - rcLabel.left;
731 cyLabel = rcLabel.bottom - rcLabel.top;
732
733 MoveWindow(hwndLogo, 0, 0, bmLogo.bmWidth, bmLogo.bmHeight, TRUE);
734 MoveWindow(hwndBar, 0, bmLogo.bmHeight, bmLogo.bmWidth, bmBar.bmHeight, TRUE);
735 MoveWindow(hwndLabel, rcLabel.left, rcLabel.top + dyLabel, cxLabel, cyLabel, TRUE);
736
737 GetWindowRect(hwndDlg, &rcWnd);
738 xOld = rcWnd.left;
739 yOld = rcWnd.top;
740 cxOld = rcWnd.right - rcWnd.left;
741 cyOld = rcWnd.bottom - rcWnd.top;
742
743 GetClientRect(hwndDlg, &rc);
744 SetRect(&rc, 0, 0, bmLogo.bmWidth, rc.bottom - rc.top); /* new client size */
745
747 exstyle = (DWORD)GetWindowLongPtrW(hwndDlg, GWL_EXSTYLE);
748 AdjustWindowRectEx(&rc, style, FALSE, exstyle);
749
750 cxNew = rc.right - rc.left;
751 cyNew = (rc.bottom - rc.top) + dyLabel;
752 xNew = xOld - (cxNew - cxOld) / 2;
753 yNew = yOld - (cyNew - cyOld) / 2;
754 MoveWindow(hwndDlg, xNew, yNew, cxNew, cyNew, TRUE);
755}
756
757static INT_PTR CALLBACK
759 IN HWND hwndDlg,
760 IN UINT uMsg,
763{
764 PDLG_DATA pDlgData;
766
767 pDlgData = (PDLG_DATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
768
769 /* pDlgData is required for each case except WM_INITDIALOG */
770 if (uMsg != WM_INITDIALOG && pDlgData == NULL) return FALSE;
771
772 switch (uMsg)
773 {
774 case WM_INITDIALOG:
775 {
776 BITMAP bm;
777 WCHAR szMsg[256];
778
779 /* Allocate pDlgData */
780 pDlgData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pDlgData));
781 if (pDlgData)
782 {
783 /* Set pDlgData to GWLP_USERDATA, so we can get it for new messages */
784 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)pDlgData);
785
786 /* Load bitmaps */
787 pDlgData->hLogoBitmap = LoadImageW(hDllInstance,
789 0, 0, LR_DEFAULTCOLOR);
790
791 pDlgData->hBarBitmap = LoadImageW(hDllInstance, MAKEINTRESOURCEW(IDB_LINE),
793 GetObject(pDlgData->hBarBitmap, sizeof(bm), &bm);
794 pDlgData->BarWidth = bm.bmWidth;
795 pDlgData->BarHeight = bm.bmHeight;
796
797 if (pDlgData->hLogoBitmap && pDlgData->hBarBitmap)
798 {
799 if (SetTimer(hwndDlg, IDT_BAR, 20, NULL) == 0)
800 {
801 DPRINT1("SetTimer(IDT_BAR) failed: %lu\n", GetLastError());
802 }
803
804 /* Get the animation bar control */
805 pDlgData->hWndBarCtrl = GetDlgItem(hwndDlg, IDC_BAR);
806 }
807 }
808
809 /* Get and set status text */
811 return FALSE;
812 SetDlgItemTextW(hwndDlg, IDC_STATUSLABEL, szMsg);
813
814 AdjustStatusMessageWindow(hwndDlg, pDlgData);
815 return TRUE;
816 }
817
818 case WM_TIMER:
819 {
820 if (pDlgData->hBarBitmap)
821 {
822 /*
823 * Default rotation bar image width is 413 (same as logo)
824 * We can divide 413 by 7 without remainder
825 */
826 pDlgData->BarCounter = (pDlgData->BarCounter + 7) % pDlgData->BarWidth;
828 UpdateWindow(pDlgData->hWndBarCtrl);
829 }
830 return TRUE;
831 }
832
833 case WM_DRAWITEM:
834 {
836
837 if (lpDis->CtlID != IDC_BAR)
838 {
839 return FALSE;
840 }
841
842 if (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 return FALSE;
859 }
860
861 case WM_DESTROY:
862 {
863 if (pDlgData->hBarBitmap)
864 {
865 KillTimer(hwndDlg, IDT_BAR);
866 }
867
868 DeleteObject(pDlgData->hLogoBitmap);
869 DeleteObject(pDlgData->hBarBitmap);
870 HeapFree(GetProcessHeap(), 0, pDlgData);
871 return TRUE;
872 }
873 }
874 return FALSE;
875}
876
877static DWORD WINAPI
879 IN LPVOID lpParameter)
880{
881 HWND hWnd;
882 MSG Msg;
883 UNREFERENCED_PARAMETER(lpParameter);
884
889 (LPARAM)NULL);
890 if (!hWnd)
891 return 0;
892
894
895 /* Message loop for the Status window */
896 while (GetMessage(&Msg, NULL, 0, 0))
897 {
900 }
901
902 EndDialog(hWnd, 0);
903
904 return 0;
905}
906
907static LONG
909 IN HKEY hKey,
910 IN LPCWSTR pszKey,
912{
913 LONG rc;
914 DWORD dwType;
915 DWORD cbData = 0;
916 LPWSTR pwszValue;
917
918 if (!pValue)
920
921 *pValue = NULL;
922 rc = RegQueryValueExW(hKey, pszKey, NULL, &dwType, NULL, &cbData);
923 if (rc != ERROR_SUCCESS)
924 return rc;
925 if (dwType != REG_SZ)
927 pwszValue = HeapAlloc(GetProcessHeap(), 0, cbData + sizeof(WCHAR));
928 if (!pwszValue)
930 rc = RegQueryValueExW(hKey, pszKey, NULL, NULL, (LPBYTE)pwszValue, &cbData);
931 if (rc != ERROR_SUCCESS)
932 {
933 HeapFree(GetProcessHeap(), 0, pwszValue);
934 return rc;
935 }
936 /* NULL-terminate the string */
937 pwszValue[cbData / sizeof(WCHAR)] = '\0';
938
939 *pValue = pwszValue;
940 return ERROR_SUCCESS;
941}
942
943static BOOL
945{
946 HKEY hControlKey = NULL;
947 LPWSTR pwszSystemStartOptions = NULL;
948 LPWSTR pwszCurrentOption, pwszNextOption; /* Pointers into SystemStartOptions */
949 BOOL bConsoleBoot = FALSE;
950 LONG rc;
951
953 L"SYSTEM\\CurrentControlSet\\Control",
954 0,
956 &hControlKey);
957 if (rc != ERROR_SUCCESS)
958 goto cleanup;
959
960 rc = ReadRegSzKey(hControlKey, L"SystemStartOptions", &pwszSystemStartOptions);
961 if (rc != ERROR_SUCCESS)
962 goto cleanup;
963
964 /* Check for CONSOLE switch in SystemStartOptions */
965 pwszCurrentOption = pwszSystemStartOptions;
966 while (pwszCurrentOption)
967 {
968 pwszNextOption = wcschr(pwszCurrentOption, L' ');
969 if (pwszNextOption)
970 *pwszNextOption = L'\0';
971 if (_wcsicmp(pwszCurrentOption, L"CONSOLE") == 0)
972 {
973 DPRINT("Found %S. Switching to console boot\n", pwszCurrentOption);
974 bConsoleBoot = TRUE;
975 goto cleanup;
976 }
977 pwszCurrentOption = pwszNextOption ? pwszNextOption + 1 : NULL;
978 }
979
980cleanup:
981 if (hControlKey != NULL)
982 RegCloseKey(hControlKey);
983 if (pwszSystemStartOptions)
984 HeapFree(GetProcessHeap(), 0, pwszSystemStartOptions);
985 return bConsoleBoot;
986}
987
988extern VOID
991 _In_opt_ PCWSTR ThemeFile);
992
1001static VOID
1003 _In_ BOOL IsInstall)
1004{
1006 WCHAR szValue[MAX_PATH];
1007 BOOL bDefaultThemesOff;
1008
1009 if (IsInstall)
1010 {
1011 /* See also wizard.c!ProcessSetupInf()
1012 * Retrieve the path of the setup INF */
1014 wcscat(szPath, L"\\$winnt$.inf");
1015 }
1016 else
1017 {
1018 /* See also userinit/livecd.c!RunLiveCD() */
1020 wcscat(szPath, L"\\unattend.inf");
1021 }
1022
1023 /*
1024 * Apply initial default theming
1025 */
1026
1027 /* Check whether to use the classic theme (TRUE) instead of the default theme */
1028 bDefaultThemesOff = FALSE;
1029 if (GetPrivateProfileStringW(L"Shell", L"DefaultThemesOff", L"no", szValue, _countof(szValue), szPath) && *szValue)
1030 bDefaultThemesOff = (_wcsicmp(szValue, L"yes") == 0);
1031
1032 if (!bDefaultThemesOff)
1033 {
1034 /* Retrieve the complete path to a .theme (or for ReactOS, a .msstyles) file */
1035 if (!GetPrivateProfileStringW(L"Shell", L"CustomDefaultThemeFile", NULL, szValue, _countof(szValue), szPath) || !*szValue)
1036 bDefaultThemesOff = TRUE; // None specified, fall back to the classic theme.
1037 }
1038
1039 /* Enable the chosen theme, or use the classic theme */
1040 EnableVisualTheme(NULL, bDefaultThemesOff ? NULL : szValue);
1041}
1042
1043static BOOL
1045{
1047 BOOL bResult = FALSE;
1048
1049 hSysSetupInf = SetupOpenInfFileW(L"syssetup.inf",
1050 NULL,
1052 NULL);
1054 {
1055 FatalError("SetupOpenInfFileW() failed to open 'syssetup.inf' (Error: %lu)\n", GetLastError());
1056 return FALSE;
1057 }
1058
1060 {
1061 FatalError("InstallSysSetupInfDevices() failed!\n");
1062 goto Exit;
1063 }
1064
1066 {
1067 FatalError("InstallSysSetupInfComponents() failed!\n");
1068 goto Exit;
1069 }
1070
1071 if (!IsConsoleBoot())
1072 {
1074 0,
1076 NULL,
1077 0,
1078 NULL);
1079 }
1080
1082 {
1083 FatalError("EnableUserModePnpManager() failed!\n");
1084 goto Exit;
1085 }
1086
1088 {
1089 FatalError("CMP_WaitNoPendingInstallEvents() failed!\n");
1090 goto Exit;
1091 }
1092
1093 bResult = TRUE;
1094
1095Exit:
1096 if (bResult == FALSE)
1097 {
1099 }
1100
1101 if (hThread != NULL)
1102 {
1106 }
1107
1108 return bResult;
1109}
1110
1111static
1112DWORD
1114{
1115 STARTUPINFOW StartupInfo;
1116 PROCESS_INFORMATION ProcessInformation;
1117 BOOL bRes;
1118
1120 if (!CommonInstall())
1121 goto error;
1122
1123 /* Install the TCP/IP protocol driver */
1124 bRes = InstallNetworkComponent(L"MS_TCPIP");
1125 if (!bRes && GetLastError() != ERROR_FILE_NOT_FOUND)
1126 {
1127 DPRINT("InstallNetworkComponent() failed with error 0x%lx\n", GetLastError());
1128 }
1129 else
1130 {
1131 /* Start the TCP/IP protocol driver */
1132 SetupStartService(L"Tcpip", FALSE);
1133 SetupStartService(L"Dhcp", FALSE);
1134 SetupStartService(L"Dnscache", FALSE);
1135 }
1136
1137 /* Register components */
1138 _SEH2_TRY
1139 {
1141 hSysSetupInf, L"RegistrationPhase2",
1142 SPINST_ALL,
1143 0, NULL, 0, NULL, NULL, NULL, NULL))
1144 {
1145 DPRINT1("SetupInstallFromInfSectionW failed!\n");
1146 }
1147
1148 RegisterTypeLibraries(NULL, NULL, hSysSetupInf, L"TypeLibraries");
1149 }
1151 {
1152 DPRINT1("Catching exception\n");
1153 }
1154 _SEH2_END;
1155
1157
1158 /* Run the shell */
1159 ZeroMemory(&StartupInfo, sizeof(StartupInfo));
1160 StartupInfo.cb = sizeof(StartupInfo);
1161 bRes = CreateProcessW(L"userinit.exe",
1162 NULL,
1163 NULL,
1164 NULL,
1165 FALSE,
1166 0,
1167 NULL,
1168 NULL,
1169 &StartupInfo,
1170 &ProcessInformation);
1171 if (!bRes)
1172 goto error;
1173
1174 CloseHandle(ProcessInformation.hThread);
1175 CloseHandle(ProcessInformation.hProcess);
1176
1177 return 0;
1178
1179error:
1181 NULL,
1182 L"Failed to load LiveCD! You can shutdown your computer, or press ENTER to reboot.",
1183 L"ReactOS LiveCD",
1184 MB_OK);
1185 return 0;
1186}
1187
1188
1189static BOOL
1191{
1192 DWORD dwError;
1193 HKEY hKey;
1194
1195 dwError = RegOpenKeyExW(
1197 L"SYSTEM\\Setup",
1198 0,
1200 &hKey);
1201 if (dwError != ERROR_SUCCESS)
1202 return FALSE;
1203
1204 dwError = RegSetValueExW(
1205 hKey,
1206 L"SetupType",
1207 0,
1208 REG_DWORD,
1209 (LPBYTE)&dwSetupType,
1210 sizeof(DWORD));
1212 if (dwError != ERROR_SUCCESS)
1213 return FALSE;
1214
1215 return TRUE;
1216}
1217
1218static DWORD CALLBACK
1220{
1221 ATOM hotkey;
1222 MSG msg;
1223
1224 DPRINT("HotkeyThread start\n");
1225
1226 hotkey = GlobalAddAtomW(L"Setup Shift+F10 Hotkey");
1227 if (!RegisterHotKey(NULL, hotkey, MOD_SHIFT, VK_F10))
1228 DPRINT1("RegisterHotKey failed with %lu\n", GetLastError());
1229
1230 while (GetMessageW(&msg, NULL, 0, 0))
1231 {
1232 if (msg.hwnd == NULL && msg.message == WM_HOTKEY && msg.wParam == hotkey)
1233 {
1234 WCHAR CmdLine[] = L"cmd.exe"; // CreateProcess can modify this buffer.
1235 STARTUPINFOW si = { sizeof(si) };
1237
1238 if (CreateProcessW(NULL,
1239 CmdLine,
1240 NULL,
1241 NULL,
1242 FALSE,
1244 NULL,
1245 NULL,
1246 &si,
1247 &pi))
1248 {
1249 CloseHandle(pi.hProcess);
1250 CloseHandle(pi.hThread);
1251 }
1252 else
1253 {
1254 DPRINT1("Failed to launch command prompt: %lu\n", GetLastError());
1255 }
1256 }
1257 }
1258
1259 UnregisterHotKey(NULL, hotkey);
1260 GlobalDeleteAtom(hotkey);
1261
1262 DPRINT("HotkeyThread terminate\n");
1263 return 0;
1264}
1265
1266
1267static
1268BOOL
1270{
1271 LONG Error;
1272 HKEY hKey;
1274 WCHAR szProgramFilesDirPath[MAX_PATH];
1275 WCHAR szCommonFilesDirPath[MAX_PATH];
1276 WCHAR szBuffer[MAX_PATH];
1277
1278 /* Load 'Program Files' location */
1281 szBuffer,
1282 ARRAYSIZE(szBuffer)))
1283 {
1284 DPRINT1("Error: %lu\n", GetLastError());
1285 return FALSE;
1286 }
1287
1290 szCommonFilesDirPath,
1291 ARRAYSIZE(szCommonFilesDirPath)))
1292 {
1293 DPRINT1("Warning: %lu\n", GetLastError());
1294 }
1295
1296 /* Expand it */
1297 if (!ExpandEnvironmentStringsW(szBuffer,
1298 szProgramFilesDirPath,
1299 ARRAYSIZE(szProgramFilesDirPath)))
1300 {
1301 DPRINT1("Error: %lu\n", GetLastError());
1302 return FALSE;
1303 }
1304
1305 wcscpy(szBuffer, szProgramFilesDirPath);
1306 wcscat(szBuffer, L"\\");
1307 wcscat(szBuffer, szCommonFilesDirPath);
1308
1309 if (!ExpandEnvironmentStringsW(szBuffer,
1310 szCommonFilesDirPath,
1311 ARRAYSIZE(szCommonFilesDirPath)))
1312 {
1313 DPRINT1("Warning: %lu\n", GetLastError());
1314 }
1315
1316 /* Store it */
1318 L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion",
1319 0,
1321 &hKey);
1322 if (Error != ERROR_SUCCESS)
1323 {
1324 DPRINT1("Error: %lu\n", Error);
1325 return FALSE;
1326 }
1327
1328 dwLength = (wcslen(szProgramFilesDirPath) + 1) * sizeof(WCHAR);
1330 L"ProgramFilesDir",
1331 0,
1332 REG_SZ,
1333 (LPBYTE)szProgramFilesDirPath,
1334 dwLength);
1335 if (Error != ERROR_SUCCESS)
1336 {
1337 DPRINT1("Error: %lu\n", Error);
1339 return FALSE;
1340 }
1341
1342 dwLength = (wcslen(szCommonFilesDirPath) + 1) * sizeof(WCHAR);
1344 L"CommonFilesDir",
1345 0,
1346 REG_SZ,
1347 (LPBYTE)szCommonFilesDirPath,
1348 dwLength);
1349 if (Error != ERROR_SUCCESS)
1350 {
1351 DPRINT1("Warning: %lu\n", Error);
1352 }
1353
1355
1356 /* Create directory */
1357 // FIXME: Security!
1358 if (!CreateDirectoryW(szProgramFilesDirPath, NULL))
1359 {
1361 {
1362 DPRINT1("Error: %lu\n", GetLastError());
1363 return FALSE;
1364 }
1365 }
1366
1367 /* Create directory */
1368 // FIXME: Security!
1369 if (!CreateDirectoryW(szCommonFilesDirPath, NULL))
1370 {
1372 {
1373 DPRINT1("Warning: %lu\n", GetLastError());
1374 // return FALSE;
1375 }
1376 }
1377
1378 return TRUE;
1379}
1380
1381
1382static
1383VOID
1385{
1386 WCHAR szBuffer[80];
1387 PWSTR ptr;
1388 HKEY hLocaleKey;
1389 DWORD ret;
1390 DWORD dwSize;
1391 LCID lcid;
1392 INT i;
1393
1394 struct {LCTYPE LCType; PWSTR pValue;} LocaleData[] = {
1395 /* Number */
1396 {LOCALE_SDECIMAL, L"sDecimal"},
1397 {LOCALE_STHOUSAND, L"sThousand"},
1398 {LOCALE_SNEGATIVESIGN, L"sNegativeSign"},
1399 {LOCALE_SPOSITIVESIGN, L"sPositiveSign"},
1400 {LOCALE_SGROUPING, L"sGrouping"},
1401 {LOCALE_SLIST, L"sList"},
1402 {LOCALE_SNATIVEDIGITS, L"sNativeDigits"},
1403 {LOCALE_INEGNUMBER, L"iNegNumber"},
1404 {LOCALE_IDIGITS, L"iDigits"},
1405 {LOCALE_ILZERO, L"iLZero"},
1406 {LOCALE_IMEASURE, L"iMeasure"},
1407 {LOCALE_IDIGITSUBSTITUTION, L"NumShape"},
1408
1409 /* Currency */
1410 {LOCALE_SCURRENCY, L"sCurrency"},
1411 {LOCALE_SMONDECIMALSEP, L"sMonDecimalSep"},
1412 {LOCALE_SMONTHOUSANDSEP, L"sMonThousandSep"},
1413 {LOCALE_SMONGROUPING, L"sMonGrouping"},
1414 {LOCALE_ICURRENCY, L"iCurrency"},
1415 {LOCALE_INEGCURR, L"iNegCurr"},
1416 {LOCALE_ICURRDIGITS, L"iCurrDigits"},
1417
1418 /* Time */
1419 {LOCALE_STIMEFORMAT, L"sTimeFormat"},
1420 {LOCALE_STIME, L"sTime"},
1421 {LOCALE_S1159, L"s1159"},
1422 {LOCALE_S2359, L"s2359"},
1423 {LOCALE_ITIME, L"iTime"},
1424 {LOCALE_ITIMEMARKPOSN, L"iTimePrefix"},
1425 {LOCALE_ITLZERO, L"iTLZero"},
1426
1427 /* Date */
1428 {LOCALE_SLONGDATE, L"sLongDate"},
1429 {LOCALE_SSHORTDATE, L"sShortDate"},
1430 {LOCALE_SDATE, L"sDate"},
1431 {LOCALE_IFIRSTDAYOFWEEK, L"iFirstDayOfWeek"},
1432 {LOCALE_IFIRSTWEEKOFYEAR, L"iFirstWeekOfYear"},
1433 {LOCALE_IDATE, L"iDate"},
1434 {LOCALE_ICALENDARTYPE, L"iCalendarType"},
1435
1436 /* Misc */
1437 {LOCALE_SCOUNTRY, L"sCountry"},
1438 {LOCALE_SABBREVLANGNAME, L"sLanguage"},
1439 {LOCALE_ICOUNTRY, L"iCountry"},
1440 {0, NULL}};
1441
1443 L".DEFAULT\\Control Panel\\International",
1444 0,
1446 &hLocaleKey);
1447 if (ret != ERROR_SUCCESS)
1448 {
1449 return;
1450 }
1451
1452 dwSize = 9 * sizeof(WCHAR);
1453 ret = RegQueryValueExW(hLocaleKey,
1454 L"Locale",
1455 NULL,
1456 NULL,
1457 (PBYTE)szBuffer,
1458 &dwSize);
1459 if (ret != ERROR_SUCCESS)
1460 goto done;
1461
1462 lcid = (LCID)wcstoul(szBuffer, &ptr, 16);
1463 if (lcid == 0)
1464 goto done;
1465
1466 i = 0;
1467 while (LocaleData[i].pValue != NULL)
1468 {
1469 if (GetLocaleInfoW(lcid,
1470 LocaleData[i].LCType | LOCALE_NOUSEROVERRIDE,
1471 szBuffer,
1472 ARRAYSIZE(szBuffer)))
1473 {
1474 RegSetValueExW(hLocaleKey,
1475 LocaleData[i].pValue,
1476 0,
1477 REG_SZ,
1478 (PBYTE)szBuffer,
1479 (wcslen(szBuffer) + 1) * sizeof(WCHAR));
1480 }
1481
1482 i++;
1483 }
1484
1485done:
1486 RegCloseKey(hLocaleKey);
1487}
1488
1489
1490static
1491DWORD
1493{
1494 WCHAR szDefaultUserHive[MAX_PATH];
1495 HKEY hUserKey = NULL;
1496 DWORD cchSize;
1497 DWORD dwError;
1498
1499 DPRINT("SaveDefaultUserHive()\n");
1500
1501 cchSize = ARRAYSIZE(szDefaultUserHive);
1502 GetDefaultUserProfileDirectoryW(szDefaultUserHive, &cchSize);
1503
1504 wcscat(szDefaultUserHive, L"\\ntuser.dat");
1505
1506 dwError = RegOpenKeyExW(HKEY_USERS,
1507 L".DEFAULT",
1508 0,
1509 KEY_READ,
1510 &hUserKey);
1511 if (dwError != ERROR_SUCCESS)
1512 {
1513 DPRINT1("RegOpenKeyExW() failed (Error %lu)\n", dwError);
1514 return dwError;
1515 }
1516
1517 pSetupEnablePrivilege(L"SeBackupPrivilege", TRUE);
1518
1519 /* Save the Default hive */
1520 dwError = RegSaveKeyExW(hUserKey,
1521 szDefaultUserHive,
1522 NULL,
1524 if (dwError == ERROR_ALREADY_EXISTS)
1525 {
1526 WCHAR szBackupHive[MAX_PATH];
1527
1528 /* Build the backup hive file name by replacing the extension */
1529 wcscpy(szBackupHive, szDefaultUserHive);
1530 wcscpy(&szBackupHive[wcslen(szBackupHive) - 4], L".bak");
1531
1532 /* Back up the existing default user hive by renaming it, replacing any possible existing old backup */
1533 if (!MoveFileExW(szDefaultUserHive,
1534 szBackupHive,
1536 {
1537 dwError = GetLastError();
1538 DPRINT1("Failed to create a default-user hive backup '%S', MoveFileExW failed (Error %lu)\n",
1539 szBackupHive, dwError);
1540 }
1541 else
1542 {
1543 /* The backup has been done, retry saving the Default hive */
1544 dwError = RegSaveKeyExW(hUserKey,
1545 szDefaultUserHive,
1546 NULL,
1548 }
1549 }
1550 if (dwError != ERROR_SUCCESS)
1551 {
1552 DPRINT1("RegSaveKeyExW() failed (Error %lu)\n", dwError);
1553 }
1554
1555 pSetupEnablePrivilege(L"SeBackupPrivilege", FALSE);
1556
1557 RegCloseKey(hUserKey);
1558
1559 return dwError;
1560}
1561
1562
1563static
1564DWORD
1566{
1567 WCHAR szBuffer[MAX_PATH];
1568 HANDLE token;
1569 TOKEN_PRIVILEGES privs;
1570 HKEY hKey;
1571 HANDLE hHotkeyThread;
1572
1574 LogItem(NULL, L"Installing ReactOS");
1575
1576 CreateTempDir(L"TEMP");
1577 CreateTempDir(L"TMP");
1578
1580 {
1581 FatalError("InitializeProgramFilesDir() failed");
1582 return 0;
1583 }
1584
1585 if (!InitializeProfiles())
1586 {
1587 FatalError("InitializeProfiles() failed");
1588 return 0;
1589 }
1590
1592
1593 if (GetWindowsDirectoryW(szBuffer, ARRAYSIZE(szBuffer)))
1594 {
1596 L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion",
1597 0,
1598 KEY_WRITE,
1599 &hKey) == ERROR_SUCCESS)
1600 {
1602 L"PathName",
1603 0,
1604 REG_SZ,
1605 (LPBYTE)szBuffer,
1606 (wcslen(szBuffer) + 1) * sizeof(WCHAR));
1607
1609 L"SystemRoot",
1610 0,
1611 REG_SZ,
1612 (LPBYTE)szBuffer,
1613 (wcslen(szBuffer) + 1) * sizeof(WCHAR));
1614
1616 }
1617
1618 PathAddBackslash(szBuffer);
1619 wcscat(szBuffer, L"system");
1620 CreateDirectory(szBuffer, NULL);
1621 }
1622
1624 {
1625 FatalError("SaveDefaultUserHive() failed");
1626 return 0;
1627 }
1628
1629 if (!CopySystemProfile(0))
1630 {
1631 FatalError("CopySystemProfile() failed");
1632 return 0;
1633 }
1634
1635 hHotkeyThread = CreateThread(NULL, 0, HotkeyThread, NULL, 0, NULL);
1636
1638 if (!CommonInstall())
1639 return 0;
1640
1641 InstallWizard();
1642
1644
1646
1648 SetSetupType(0);
1649
1650 if (hHotkeyThread)
1651 {
1652 PostThreadMessage(GetThreadId(hHotkeyThread), WM_QUIT, 0, 0);
1653 CloseHandle(hHotkeyThread);
1654 }
1655
1656 LogItem(NULL, L"Installing ReactOS done");
1658
1659 if (AdminInfo.Name != NULL)
1660 RtlFreeHeap(RtlGetProcessHeap(), 0, AdminInfo.Name);
1661
1662 if (AdminInfo.Domain != NULL)
1663 RtlFreeHeap(RtlGetProcessHeap(), 0, AdminInfo.Domain);
1664
1665 if (AdminInfo.Password != NULL)
1666 RtlFreeHeap(RtlGetProcessHeap(), 0, AdminInfo.Password);
1667
1668 /* Get shutdown privilege */
1670 {
1671 FatalError("OpenProcessToken() failed!");
1672 return 0;
1673 }
1676 &privs.Privileges[0].Luid))
1677 {
1678 FatalError("LookupPrivilegeValue() failed!");
1679 return 0;
1680 }
1681 privs.PrivilegeCount = 1;
1684 FALSE,
1685 &privs,
1686 0,
1688 NULL) == 0)
1689 {
1690 FatalError("AdjustTokenPrivileges() failed!");
1691 return 0;
1692 }
1693
1695 return 0;
1696}
1697
1698
1699/*
1700 * Standard Windows-compatible export, which dispatches
1701 * to either 'InstallReactOS' or 'InstallLiveCD'.
1702 */
1703INT
1704WINAPI
1706{
1707 INT i;
1708 PWSTR p;
1709
1710 for (i = 0; i < argc; ++i)
1711 {
1712 p = argv[i];
1713 if (*p == L'-')
1714 {
1715 p++;
1716
1717 // NOTE: On Windows, "mini" means "minimal UI", and can be used
1718 // in addition to "newsetup"; these options are not exclusive.
1719 if (_wcsicmp(p, L"newsetup") == 0)
1720 return (INT)InstallReactOS();
1721 else if (_wcsicmp(p, L"mini") == 0)
1722 return (INT)InstallLiveCD();
1723
1724 /* Add support for other switches */
1725 }
1726 }
1727
1728 return 0;
1729}
1730
1731
1732/*
1733 * @unimplemented
1734 */
1737 IN HANDLE hWnd,
1738 IN LPCWSTR lpszFontSize)
1739{
1741 return FALSE;
1742}
1743
1744/*
1745 * @unimplemented
1746 */
1749 LCID Lcid,
1750 LPCWSTR lpSrcRootPath,
1751 char Unknown,
1752 DWORD dwUnused1,
1753 DWORD dwUnused2)
1754{
1756 return FALSE;
1757}
1758
1759/*
1760 * @implemented
1761 */
1764{
1765 return SetupChangeLocaleEx(hWnd, Lcid, NULL, 0, 0, 0);
1766}
1767
1768
1769DWORD
1770WINAPI
1772 LPCWSTR lpServiceName,
1773 BOOL bWait)
1774{
1775 SC_HANDLE hManager = NULL;
1776 SC_HANDLE hService = NULL;
1777 DWORD dwError = ERROR_SUCCESS;
1778
1779 hManager = OpenSCManagerW(NULL,
1780 NULL,
1782 if (hManager == NULL)
1783 {
1784 dwError = GetLastError();
1785 goto done;
1786 }
1787
1788 hService = OpenServiceW(hManager,
1789 lpServiceName,
1791 if (hService == NULL)
1792 {
1793 dwError = GetLastError();
1794 goto done;
1795 }
1796
1797 if (!StartService(hService, 0, NULL))
1798 {
1799 dwError = GetLastError();
1800 goto done;
1801 }
1802
1803done:
1804 if (hService != NULL)
1805 CloseServiceHandle(hService);
1806
1807 if (hManager != NULL)
1808 CloseServiceHandle(hManager);
1809
1810 return dwError;
1811}
static int argc
Definition: ServiceArgs.c:12
char * va_list
Definition: acmsvcex.h:78
#define va_end(ap)
Definition: acmsvcex.h:90
#define va_start(ap, A)
Definition: acmsvcex.h:91
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
static SERVICE_STATUS ServiceStatus
Definition: browser.c:22
static LONG ReadRegSzKey(IN HKEY hKey, IN LPCWSTR pszKey, OUT LPWSTR *pValue)
Definition: install.c:253
static BOOL IsConsoleBoot(VOID)
Definition: install.c:479
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:837
static HINSTANCE hDllInstance
Definition: clb.c:9
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
struct @1672 Msg[]
wcscat
wcscpy
static HWND hwndParent
Definition: cryptui.c:300
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#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
#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:454
ATOM WINAPI GlobalAddAtomW(LPCWSTR lpString)
Definition: atom.c:444
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:90
BOOL WINAPI MoveFileExW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName OPTIONAL, IN DWORD dwFlags)
Definition: move.c:1120
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2313
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:2352
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:4598
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:1177
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: locale.c:1666
#define IDT_BAR
Definition: gui.c:34
#define IDC_ROSLOGO
Definition: resource.h:69
#define IDC_BAR
Definition: resource.h:70
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
BOOL WINAPI SetupDiInstallClassW(HWND hwndParent, PCWSTR InfFileName, DWORD Flags, HSPFILEQ FileQueue)
Definition: devinst.c:3605
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:2740
HRESULT WINAPI SHGetFolderPathAndSubDirW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPCWSTR pszSubPath, LPWSTR pszPath)
Definition: shellpath.c:2805
VOID SetAutoAdminLogon(VOID)
Definition: security.c:1748
VOID InstallSecurity(VOID)
Definition: security.c:1569
#define PM_STEP_START
Definition: globals.h:62
#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:3244
static BOOL CreateShortcut(LPCWSTR pszFolder, LPCWSTR pszName, LPCWSTR pszCommand, LPCWSTR pszDescription, INT iIconNr, LPCWSTR pszWorkingDir, LPCWSTR pszArgs)
Definition: install.c:118
static BOOL EnableUserModePnpManager(VOID)
Definition: install.c:610
DWORD WINAPI SetupChangeLocale(HWND hWnd, LCID Lcid)
Definition: install.c:1763
static BOOL CreateShortcuts(_In_ PITEMSDATA pItemsData, _In_ PREGISTRATIONNOTIFY pNotify, _In_ HINF hinf, _In_ LPCWSTR szSection)
Definition: install.c:243
static VOID InitializeDefaultUserLocale(VOID)
Definition: install.c:1384
static DWORD SaveDefaultUserHive(VOID)
Definition: install.c:1492
struct _DLG_DATA * PDLG_DATA
static BOOL InstallSysSetupInfComponents(VOID)
Definition: install.c:460
static BOOL CommonInstall(VOID)
Definition: install.c:1044
VOID EnableVisualTheme(_In_opt_ HWND hwndParent, _In_opt_ PCWSTR ThemeFile)
Definition: wizard.c:1371
static INT_PTR CALLBACK StatusMessageWindowProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: install.c:758
static VOID PreprocessUnattend(_In_ BOOL IsInstall)
Pre-process unattended file to apply early settings.
Definition: install.c:1002
static BOOL InstallSysSetupInfDevices(VOID)
Definition: install.c:424
ADMIN_INFO AdminInfo
Definition: install.c:38
DWORD WINAPI SetupStartService(LPCWSTR lpServiceName, BOOL bWait)
Definition: install.c:1771
INT WINAPI InstallWindowsNt(INT argc, WCHAR **argv)
Definition: install.c:1705
static HRESULT CreateShellLink(LPCWSTR pszLinkPath, LPCWSTR pszCmd, LPCWSTR pszArg, LPCWSTR pszDir, LPCWSTR pszIconPath, INT iIconNr, LPCWSTR pszComment)
Definition: install.c:72
static VOID CreateTempDir(IN LPCWSTR VarName)
Definition: install.c:371
static VOID AdjustStatusMessageWindow(HWND hwndDlg, PDLG_DATA pDlgData)
Definition: install.c:694
static DWORD WINAPI ShowStatusMessageThread(IN LPVOID lpParameter)
Definition: install.c:878
HINF hSysSetupInf
Definition: install.c:37
static BOOL SetSetupType(DWORD dwSetupType)
Definition: install.c:1190
BOOL RegisterTypeLibraries(_In_ PITEMSDATA pItemsData, _In_ PREGISTRATIONNOTIFY pNotify, _In_ HINF hinf, _In_ LPCWSTR szSection)
Definition: install.c:539
static BOOL InitializeProgramFilesDir(VOID)
Definition: install.c:1269
DWORD WINAPI SetupChangeFontSize(IN HANDLE hWnd, IN LPCWSTR lpszFontSize)
Definition: install.c:1736
static DWORD CALLBACK HotkeyThread(LPVOID Parameter)
Definition: install.c:1219
static VOID FatalError(char *pszFmt,...)
Definition: install.c:53
static DWORD InstallLiveCD(VOID)
Definition: install.c:1113
VOID InstallStartMenuItems(_In_ PITEMSDATA pItemsData)
Definition: install.c:313
struct _DLG_DATA DLG_DATA
static DWORD InstallReactOS(VOID)
Definition: install.c:1565
static LONG CountShortcuts(_In_ HINF hinf, _In_ LPCWSTR szSection)
Definition: install.c:287
static BOOL CreateShortcutsFromSection(_In_ PITEMSDATA pItemsData, _In_ PREGISTRATIONNOTIFY pNotify, _In_ HINF hinf, _In_ LPWSTR pszSection, _In_ LPCWSTR pszFolder)
Definition: install.c:184
DWORD WINAPI SetupChangeLocaleEx(HWND hWnd, LCID Lcid, LPCWSTR lpSrcRootPath, char Unknown, DWORD dwUnused1, DWORD dwUnused2)
Definition: install.c:1748
#define IDS_PROGRAMFILES
Definition: resource.h:154
#define IDD_STATUSWINDOW_DLG
Definition: resource.h:88
#define IDS_STATUS_INSTALL_DEV
Definition: resource.h:151
#define IDS_COMMONFILES
Definition: resource.h:155
#define IDB_LINE
Definition: resource.h:28
#define IDC_STATUSLABEL
Definition: resource.h:89
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_(Delta *Height) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Delta)
Definition: common.c:57
#define INFINITE
Definition: serial.h:102
static INT cxOld
Definition: eventvwr.c:4277
static INT cyOld
Definition: eventvwr.c:4277
#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
@ Unknown
Definition: i8042prt.h:114
#define MOD_SHIFT
Definition: imm.h:186
int __cdecl vsprintf(char *_Dest, const char *_Format, va_list _Args)
Definition: sprintf.c:733
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#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 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 PEXPLICIT_ACCESSW *static HMODULE hmod
Definition: security.c:143
static HBITMAP
Definition: button.c:44
static HDC
Definition: imagelist.c:88
static refpint_t pi[]
Definition: server.c:96
#define argv
Definition: mplay32.c:18
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
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:1023
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define KEY_WRITE
Definition: nt_native.h:1031
#define DWORD
Definition: nt_native.h:44
#define KEY_SET_VALUE
Definition: nt_native.h:1017
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:325
#define L(x)
Definition: ntvdm.h:50
#define MAKEINTRESOURCE(i)
Definition: ntverrsrc.c:25
const GUID IID_IPersistFile
BYTE * PBYTE
Definition: pedump.c:66
long LONG
Definition: pedump.c:60
static const WCHAR szName[]
Definition: powrprof.c:45
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:82
#define _SEH2_END
Definition: pseh2_64.h:171
#define _SEH2_TRY
Definition: pseh2_64.h:71
HRESULT __wine_register_resources(HMODULE module) DECLSPEC_HIDDEN
Definition: register.c:98
SC_HANDLE hSCManager
Definition: sc.c:12
SC_HANDLE WINAPI OpenSCManagerW(LPCWSTR lpMachineName, LPCWSTR lpDatabaseName, DWORD dwDesiredAccess)
Definition: scm.c:2068
BOOL WINAPI QueryServiceStatusEx(SC_HANDLE hService, SC_STATUS_TYPE InfoLevel, LPBYTE lpBuffer, DWORD cbBufSize, LPDWORD pcbBytesNeeded)
Definition: scm.c:2887
SC_HANDLE WINAPI OpenServiceW(SC_HANDLE hSCManager, LPCWSTR lpServiceName, DWORD dwDesiredAccess)
Definition: scm.c:2160
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:2980
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
Definition: scm.c:580
#define REG_DWORD
Definition: sdbapi.c:596
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#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
strcat
Definition: string.h:92
static HRESULT InstallNetworkComponent(LPWSTR pszComponentName, const GUID *pClassGuid)
Definition: setup.cpp:54
#define DI_QUIETINSTALL
Definition: setupapi.h:68
#define SetupFindFirstLine
Definition: setupapi.h:2625
#define SPINST_ALL
Definition: setupapi.h:602
#define SP_COPY_NEWER
Definition: setupapi.h:479
_In_ LPCSTR pszDir
Definition: shellapi.h:585
#define CSIDL_FLAG_CREATE
HRESULT hr
Definition: shlfolder.c:183
#define IID_IShellLink
Definition: shlguid.h:131
@ SHGFP_TYPE_DEFAULT
Definition: shlobj.h:2158
#define CSIDL_SYSTEM
Definition: shlobj.h:2217
#define PathAddBackslash
Definition: shlwapi.h:818
#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
LPWSTR Password
Definition: globals.h:25
LPWSTR Name
Definition: globals.h:23
LPWSTR Domain
Definition: globals.h:24
Definition: bl.h:1331
Definition: gui.c:39
HBITMAP hLogoBitmap
Definition: gui.c:41
HBITMAP hBarBitmap
Definition: gui.c:42
DWORD BarHeight
Definition: gui.c:48
DWORD BarWidth
Definition: gui.c:47
HWND hWndBarCtrl
Definition: gui.c:43
DWORD BarCounter
Definition: gui.c:44
DWORD dwWaitHint
Definition: winsvc.h:105
DWORD dwCurrentState
Definition: winsvc.h:100
DWORD cb
Definition: winbase.h:877
$ULONG PrivilegeCount
Definition: setypes.h:1023
LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY]
Definition: setypes.h:1024
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
#define LogItem(lpTag, lpMessageText...)
Definition: syssetup.h:98
#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
unsigned char * LPBYTE
Definition: typedefs.h:53
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
int ret
HDC hdcMem
Definition: welcome.c:104
#define ZeroMemory
Definition: winbase.h:1743
#define LookupPrivilegeValue
Definition: winbase.h:3901
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define CreateDirectory
Definition: winbase.h:3777
_In_ LPCSTR _In_opt_ LPCSTR _In_ DWORD _Out_opt_ LPSTR * lpFilePart
Definition: winbase.h:3106
#define WAIT_OBJECT_0
Definition: winbase.h:432
#define CREATE_NEW_CONSOLE
Definition: winbase.h:183
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
#define WINAPI
Definition: msvc.h:6
#define ERROR_SERVICE_ALREADY_RUNNING
Definition: winerror.h:607
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:4468
BOOL WINAPI DeleteDC(_In_ HDC)
#define LOCALE_ICURRDIGITS
Definition: winnls.h:56
#define LOCALE_SCOUNTRY
Definition: winnls.h:32
#define LOCALE_SDATE
Definition: winnls.h:60
#define LOCALE_SGROUPING
Definition: winnls.h:46
#define LOCALE_ICOUNTRY
Definition: winnls.h:31
#define LOCALE_SDECIMAL
Definition: winnls.h:44
#define LOCALE_IDATE
Definition: winnls.h:65
#define LOCALE_IFIRSTWEEKOFYEAR
Definition: winnls.h:78
#define LOCALE_IMEASURE
Definition: winnls.h:43
#define LOCALE_SLONGDATE
Definition: winnls.h:63
#define LOCALE_S1159
Definition: winnls.h:73
#define LOCALE_SSHORTDATE
Definition: winnls.h:62
#define LOCALE_SPOSITIVESIGN
Definition: winnls.h:119
#define LOCALE_SMONDECIMALSEP
Definition: winnls.h:53
#define LOCALE_ITIME
Definition: winnls.h:67
#define LOCALE_ICURRENCY
Definition: winnls.h:58
#define LOCALE_ITLZERO
Definition: winnls.h:70
#define LOCALE_SMONTHOUSANDSEP
Definition: winnls.h:54
#define LOCALE_NOUSEROVERRIDE
Definition: winnls.h:19
#define LOCALE_IDIGITS
Definition: winnls.h:47
#define LOCALE_STHOUSAND
Definition: winnls.h:45
#define LOCALE_STIMEFORMAT
Definition: winnls.h:64
#define LOCALE_IFIRSTDAYOFWEEK
Definition: winnls.h:77
#define LOCALE_STIME
Definition: winnls.h:61
#define LOCALE_SABBREVLANGNAME
Definition: winnls.h:29
#define LOCALE_INEGNUMBER
Definition: winnls.h:49
#define LOCALE_SNEGATIVESIGN
Definition: winnls.h:120
DWORD LCTYPE
Definition: winnls.h:519
#define LOCALE_S2359
Definition: winnls.h:74
#define LOCALE_SNATIVEDIGITS
Definition: winnls.h:50
#define LOCALE_SLIST
Definition: winnls.h:42
#define LOCALE_ILZERO
Definition: winnls.h:48
#define LOCALE_ICALENDARTYPE
Definition: winnls.h:75
#define LOCALE_SMONGROUPING
Definition: winnls.h:55
#define LOCALE_SCURRENCY
Definition: winnls.h:51
#define LOCALE_INEGCURR
Definition: winnls.h:59
#define LOCALE_ITIMEMARKPOSN
Definition: winnls.h:68
#define SE_SHUTDOWN_NAME
Definition: winnt_old.h:413
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define HKEY_USERS
Definition: winreg.h:13
#define SERVICE_START
Definition: winsvc.h:57
#define SERVICE_QUERY_STATUS
Definition: winsvc.h:55
@ SC_STATUS_PROCESS_INFO
Definition: winsvc.h:119
#define SC_MANAGER_ENUMERATE_SERVICE
Definition: winsvc.h:16
#define SERVICE_NO_CHANGE
Definition: winsvc.h:20
#define SERVICE_CHANGE_CONFIG
Definition: winsvc.h:54
#define StartService
Definition: winsvc.h:585
#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 GetWindowLongPtrW
Definition: winuser.h:4840
#define WM_QUIT
Definition: winuser.h:1634
BOOL WINAPI TranslateMessage(_In_ const MSG *)
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define VK_F10
Definition: winuser.h:2275
BOOL WINAPI GetMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
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:2540
#define CreateDialogParam
Definition: winuser.h:5772
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:1750
#define PostThreadMessage
Definition: winuser.h:5853
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:1656
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:5810
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:1753
BOOL WINAPI UpdateWindow(_In_ HWND)
#define SendMessage
Definition: winuser.h:5863
#define MB_OK
Definition: winuser.h:801
BOOL WINAPI ExitWindowsEx(_In_ UINT, _In_ DWORD)
#define WM_HOTKEY
Definition: winuser.h:1890
#define LR_DEFAULTCOLOR
Definition: winuser.h:1098
#define SW_SHOW
Definition: winuser.h:786
#define WM_DESTROY
Definition: winuser.h:1620
#define DispatchMessage
Definition: winuser.h:5785
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:5366
#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:930
#define SE_PRIVILEGE_ENABLED
Definition: setypes.h:63
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185