ReactOS 0.4.16-dev-91-g764881a
setuplib.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Setup Library
4 * FILE: base/setup/lib/setuplib.c
5 * PURPOSE: Setup Library - Main initialization helpers
6 * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
7 * Hermes Belusca-Maito (hermes.belusca@sfr.fr)
8 */
9
10/* INCLUDES *****************************************************************/
11
12#include "precomp.h"
13#include "filesup.h"
14#include "infsupp.h"
15#include "inicache.h"
16
17#include "setuplib.h"
18
19#define NDEBUG
20#include <debug.h>
21
22
23/* GLOBALS ******************************************************************/
24
25/* FUNCTIONS ****************************************************************/
26
27VOID
29 IN OUT PUSETUP_DATA pSetupData)
30{
32 HINF UnattendInf;
33 UINT ErrorLine;
34 INT IntValue;
36 WCHAR UnattendInfPath[MAX_PATH];
37
38 CombinePaths(UnattendInfPath, ARRAYSIZE(UnattendInfPath), 2,
39 pSetupData->SourcePath.Buffer, L"unattend.inf");
40
41 DPRINT("UnattendInf path: '%S'\n", UnattendInfPath);
42
43 if (DoesFileExist(NULL, UnattendInfPath) == FALSE)
44 {
45 DPRINT("Does not exist: %S\n", UnattendInfPath);
46 return;
47 }
48
49 /* Load 'unattend.inf' from installation media */
50 UnattendInf = SpInfOpenInfFile(UnattendInfPath,
51 NULL,
53 pSetupData->LanguageId,
54 &ErrorLine);
55 if (UnattendInf == INVALID_HANDLE_VALUE)
56 {
57 DPRINT("SpInfOpenInfFile() failed\n");
58 return;
59 }
60
61 /* Open 'Unattend' section */
62 if (!SpInfFindFirstLine(UnattendInf, L"Unattend", L"Signature", &Context))
63 {
64 DPRINT("SpInfFindFirstLine() failed for section 'Unattend'\n");
65 goto Quit;
66 }
67
68 /* Get pointer 'Signature' key */
69 if (!INF_GetData(&Context, NULL, &Value))
70 {
71 DPRINT("INF_GetData() failed for key 'Signature'\n");
72 goto Quit;
73 }
74
75 /* Check 'Signature' string */
76 if (_wcsicmp(Value, L"$ReactOS$") != 0)
77 {
78 DPRINT("Signature not $ReactOS$\n");
80 goto Quit;
81 }
82
84
85 /* Check if Unattend setup is enabled */
86 if (!SpInfFindFirstLine(UnattendInf, L"Unattend", L"UnattendSetupEnabled", &Context))
87 {
88 DPRINT("Can't find key 'UnattendSetupEnabled'\n");
89 goto Quit;
90 }
91
92 if (!INF_GetData(&Context, NULL, &Value))
93 {
94 DPRINT("Can't read key 'UnattendSetupEnabled'\n");
95 goto Quit;
96 }
97
98 if (_wcsicmp(Value, L"yes") != 0)
99 {
100 DPRINT("Unattend setup is disabled by 'UnattendSetupEnabled' key!\n");
102 goto Quit;
103 }
104
106
107 /* Search for 'DestinationDiskNumber' */
108 if (!SpInfFindFirstLine(UnattendInf, L"Unattend", L"DestinationDiskNumber", &Context))
109 {
110 DPRINT("SpInfFindFirstLine() failed for key 'DestinationDiskNumber'\n");
111 goto Quit;
112 }
113
114 if (!SpInfGetIntField(&Context, 1, &IntValue))
115 {
116 DPRINT("SpInfGetIntField() failed for key 'DestinationDiskNumber'\n");
117 goto Quit;
118 }
119
120 pSetupData->DestinationDiskNumber = (LONG)IntValue;
121
122 /* Search for 'DestinationPartitionNumber' */
123 if (!SpInfFindFirstLine(UnattendInf, L"Unattend", L"DestinationPartitionNumber", &Context))
124 {
125 DPRINT("SpInfFindFirstLine() failed for key 'DestinationPartitionNumber'\n");
126 goto Quit;
127 }
128
129 if (!SpInfGetIntField(&Context, 1, &IntValue))
130 {
131 DPRINT("SpInfGetIntField() failed for key 'DestinationPartitionNumber'\n");
132 goto Quit;
133 }
134
135 pSetupData->DestinationPartitionNumber = (LONG)IntValue;
136
137 /* Search for 'InstallationDirectory' (optional) */
138 if (SpInfFindFirstLine(UnattendInf, L"Unattend", L"InstallationDirectory", &Context))
139 {
140 if (INF_GetData(&Context, NULL, &Value))
141 {
142 RtlStringCchCopyW(pSetupData->InstallationDirectory,
143 ARRAYSIZE(pSetupData->InstallationDirectory),
144 Value);
146 }
147 else
148 {
149 DPRINT("INF_GetData() failed for key 'InstallationDirectory'\n");
150 }
151 }
152
154 DPRINT("Running unattended setup\n");
155
156 /* Search for 'BootLoaderLocation' (optional) */
157 if (SpInfFindFirstLine(UnattendInf, L"Unattend", L"BootLoaderLocation", &Context))
158 {
159 if (SpInfGetIntField(&Context, 1, &IntValue))
160 pSetupData->BootLoaderLocation = IntValue;
161 }
162
163 /* Search for 'FormatPartition' (optional) */
164 if (SpInfFindFirstLine(UnattendInf, L"Unattend", L"FormatPartition", &Context))
165 {
166 if (SpInfGetIntField(&Context, 1, &IntValue))
167 pSetupData->FormatPartition = IntValue;
168 }
169
170 /* Search for 'AutoPartition' (optional) */
171 if (SpInfFindFirstLine(UnattendInf, L"Unattend", L"AutoPartition", &Context))
172 {
173 if (SpInfGetIntField(&Context, 1, &IntValue))
174 pSetupData->AutoPartition = IntValue;
175 }
176
177 /* Search for 'LocaleID' (optional) */
178 if (SpInfFindFirstLine(UnattendInf, L"Unattend", L"LocaleID", &Context))
179 {
180 if (INF_GetData(&Context, NULL, &Value))
181 {
182 LONG Id = wcstol(Value, NULL, 16);
183 RtlStringCchPrintfW(pSetupData->LocaleID,
184 ARRAYSIZE(pSetupData->LocaleID),
185 L"%08lx", Id);
187 }
188 }
189
190 /* Search for 'FsType' (optional) */
191 if (SpInfFindFirstLine(UnattendInf, L"Unattend", L"FsType", &Context))
192 {
193 if (SpInfGetIntField(&Context, 1, &IntValue))
194 pSetupData->FsType = IntValue;
195 }
196
197Quit:
198 SpInfCloseInfFile(UnattendInf);
199}
200
201VOID
203 IN OUT PUSETUP_DATA pSetupData)
204{
206 PINICACHE IniCache;
207
208#if 0 // HACK FIXME!
209 PINICACHE UnattendCache;
211#else
212 // WCHAR CrLf[] = {L'\r', L'\n'};
213 CHAR CrLf[] = {'\r', '\n'};
214 HANDLE FileHandle, UnattendFileHandle, SectionHandle;
217 PVOID ViewBase;
221#endif
222
223 PINI_SECTION IniSection;
224 WCHAR PathBuffer[MAX_PATH];
225 WCHAR UnattendInfPath[MAX_PATH];
226
227 /* Create a $winnt$.inf file with default entries */
228 IniCache = IniCacheCreate();
229 if (!IniCache)
230 return;
231
232 IniSection = IniAddSection(IniCache, L"SetupParams");
233 if (IniSection)
234 {
235 /* Key "skipmissingfiles" */
236 // RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
237 // L"\"%s\"", L"WinNt5.2");
238 // IniAddKey(IniSection, L"Version", PathBuffer);
239 }
240
241 IniSection = IniAddSection(IniCache, L"Data");
242 if (IniSection)
243 {
244 RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
245 L"\"%s\"", IsUnattendedSetup ? L"yes" : L"no");
246 IniAddKey(IniSection, L"UnattendedInstall", PathBuffer);
247
248 // "floppylessbootpath" (yes/no)
249
250 RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
251 L"\"%s\"", L"winnt");
252 IniAddKey(IniSection, L"ProductType", PathBuffer);
253
254 RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
255 L"\"%s\\\"", pSetupData->SourceRootPath.Buffer);
256 IniAddKey(IniSection, L"SourcePath", PathBuffer);
257
258 // "floppyless" ("0")
259 }
260
261#if 0
262
263 /* TODO: Append the standard unattend.inf file */
264 CombinePaths(UnattendInfPath, ARRAYSIZE(UnattendInfPath), 2,
265 pSetupData->SourcePath.Buffer, L"unattend.inf");
266 if (DoesFileExist(NULL, UnattendInfPath) == FALSE)
267 {
268 DPRINT("Does not exist: %S\n", UnattendInfPath);
269 goto Quit;
270 }
271
272 Status = IniCacheLoad(&UnattendCache, UnattendInfPath, FALSE);
273 if (!NT_SUCCESS(Status))
274 {
275 DPRINT1("Cannot load %S as an INI file!\n", UnattendInfPath);
276 goto Quit;
277 }
278
279 IniCacheDestroy(UnattendCache);
280
281Quit:
282 CombinePaths(PathBuffer, ARRAYSIZE(PathBuffer), 2,
283 pSetupData->DestinationPath.Buffer, L"System32\\$winnt$.inf");
284 IniCacheSave(IniCache, PathBuffer);
285 IniCacheDestroy(IniCache);
286
287#else
288
289 CombinePaths(PathBuffer, ARRAYSIZE(PathBuffer), 2,
290 pSetupData->DestinationPath.Buffer, L"System32\\$winnt$.inf");
291 IniCacheSave(IniCache, PathBuffer);
292 IniCacheDestroy(IniCache);
293
294 /* TODO: Append the standard unattend.inf file */
295 CombinePaths(UnattendInfPath, ARRAYSIZE(UnattendInfPath), 2,
296 pSetupData->SourcePath.Buffer, L"unattend.inf");
297 if (DoesFileExist(NULL, UnattendInfPath) == FALSE)
298 {
299 DPRINT("Does not exist: %S\n", UnattendInfPath);
300 return;
301 }
302
303 RtlInitUnicodeString(&FileName, PathBuffer);
305 &FileName,
307 NULL,
308 NULL);
315 if (!NT_SUCCESS(Status))
316 {
317 DPRINT1("Cannot load %S as an INI file!\n", PathBuffer);
318 return;
319 }
320
321 /* Query the file size */
324 &FileInfo,
325 sizeof(FileInfo),
327 if (!NT_SUCCESS(Status))
328 {
329 DPRINT("NtQueryInformationFile() failed (Status %lx)\n", Status);
330 FileInfo.EndOfFile.QuadPart = 0ULL;
331 }
332
334 UnattendInfPath,
335 &UnattendFileHandle,
336 &FileSize,
337 &SectionHandle,
338 &ViewBase,
339 FALSE);
340 if (!NT_SUCCESS(Status))
341 {
342 DPRINT1("Cannot load %S !\n", UnattendInfPath);
344 return;
345 }
346
347 /* Write to the INI file */
348
349 /* "\r\n" */
351 NULL,
352 NULL,
353 NULL,
355 (PVOID)CrLf,
356 sizeof(CrLf),
357 &FileInfo.EndOfFile,
358 NULL);
359
361 NULL,
362 NULL,
363 NULL,
365 ViewBase,
366 FileSize,
367 NULL,
368 NULL);
369 if (!NT_SUCCESS(Status))
370 {
371 DPRINT("NtWriteFile() failed (Status %lx)\n", Status);
372 }
373
374 /* Finally, unmap and close the file */
375 UnMapAndCloseFile(UnattendFileHandle, SectionHandle, ViewBase);
376
378#endif
379}
380
383 OUT PUNICODE_STRING SourcePath,
384 OUT PUNICODE_STRING SourceRootPath,
385 OUT PUNICODE_STRING SourceRootDir)
386{
388 HANDLE LinkHandle;
390 UCHAR ImageFileBuffer[sizeof(UNICODE_STRING) + MAX_PATH * sizeof(WCHAR)];
391 PUNICODE_STRING InstallSourcePath = (PUNICODE_STRING)&ImageFileBuffer;
392 WCHAR SystemRootBuffer[MAX_PATH] = L"";
393 UNICODE_STRING SystemRootPath = RTL_CONSTANT_STRING(L"\\SystemRoot");
395 PWCHAR Ptr;
396
397 // FIXME: commented out to allow installation from USB
398#if 0
399 /* Determine the installation source path via the full path of the installer */
400 RtlInitEmptyUnicodeString(InstallSourcePath,
401 (PWSTR)((ULONG_PTR)ImageFileBuffer + sizeof(UNICODE_STRING)),
402 sizeof(ImageFileBuffer) - sizeof(UNICODE_STRING)
403 /* Reserve space for a NULL terminator */ - sizeof(UNICODE_NULL));
404 BufferSize = sizeof(ImageFileBuffer);
407 InstallSourcePath,
409 NULL);
410 // STATUS_INFO_LENGTH_MISMATCH or STATUS_BUFFER_TOO_SMALL ?
411 if (!NT_SUCCESS(Status))
412 return Status;
413
414 /* Manually NULL-terminate */
415 InstallSourcePath->Buffer[InstallSourcePath->Length / sizeof(WCHAR)] = UNICODE_NULL;
416
417 /* Strip the trailing file name */
418 Ptr = wcsrchr(InstallSourcePath->Buffer, OBJ_NAME_PATH_SEPARATOR);
419 if (Ptr)
420 *Ptr = UNICODE_NULL;
421 InstallSourcePath->Length = wcslen(InstallSourcePath->Buffer) * sizeof(WCHAR);
422#endif
423
424 /*
425 * Now resolve the full path to \SystemRoot. In case it prefixes
426 * the installation source path determined from the full path of
427 * the installer, we use instead the resolved \SystemRoot as the
428 * installation source path.
429 * Otherwise, we use instead the path from the full installer path.
430 */
431
433 &SystemRootPath,
435 NULL,
436 NULL);
437
438 Status = NtOpenSymbolicLinkObject(&LinkHandle,
441 if (!NT_SUCCESS(Status))
442 {
443 /*
444 * We failed at opening the \SystemRoot link (usually due to wrong
445 * access rights). Do not consider this as a fatal error, but use
446 * instead the image file path as the installation source path.
447 */
448 DPRINT1("NtOpenSymbolicLinkObject(%wZ) failed with Status 0x%08lx\n",
449 &SystemRootPath, Status);
450 goto InitPaths;
451 }
452
453 RtlInitEmptyUnicodeString(&SystemRootPath,
454 SystemRootBuffer,
455 sizeof(SystemRootBuffer));
456
457 /* Resolve the link and close its handle */
459 &SystemRootPath,
460 &BufferSize);
461 NtClose(LinkHandle);
462
463 if (!NT_SUCCESS(Status))
464 return Status; // Unexpected error
465
466 /* Check whether the resolved \SystemRoot is a prefix of the image file path */
467 // FIXME: commented out to allow installation from USB
468 // if (RtlPrefixUnicodeString(&SystemRootPath, InstallSourcePath, TRUE))
469 {
470 /* Yes it is, so we use instead SystemRoot as the installation source path */
471 InstallSourcePath = &SystemRootPath;
472 }
473
474
475InitPaths:
476 /*
477 * Retrieve the different source path components
478 */
479 RtlCreateUnicodeString(SourcePath, InstallSourcePath->Buffer);
480
481 /* Strip trailing directory */
482 Ptr = wcsrchr(InstallSourcePath->Buffer, OBJ_NAME_PATH_SEPARATOR);
483 if (Ptr)
484 {
485 RtlCreateUnicodeString(SourceRootDir, Ptr);
486 *Ptr = UNICODE_NULL;
487 }
488 else
489 {
490 RtlCreateUnicodeString(SourceRootDir, L"");
491 }
492
493 RtlCreateUnicodeString(SourceRootPath, InstallSourcePath->Buffer);
494
495 return STATUS_SUCCESS;
496}
497
500 IN OUT PUSETUP_DATA pSetupData)
501{
503 UINT ErrorLine;
504 INT IntValue;
507
509 pSetupData->SourcePath.Buffer, L"txtsetup.sif");
510
511 DPRINT("SetupInf path: '%S'\n", FileNameBuffer);
512
513 pSetupData->SetupInf =
515 NULL,
517 pSetupData->LanguageId,
518 &ErrorLine);
519 if (pSetupData->SetupInf == INVALID_HANDLE_VALUE)
521
522 /* Open 'Version' section */
523 if (!SpInfFindFirstLine(pSetupData->SetupInf, L"Version", L"Signature", &Context))
525
526 /* Get pointer 'Signature' key */
527 if (!INF_GetData(&Context, NULL, &Value))
529
530 /* Check 'Signature' string */
531 if (_wcsicmp(Value, L"$ReactOS$") != 0 &&
532 _wcsicmp(Value, L"$Windows NT$") != 0)
533 {
536 }
537
539
540 /* Open 'DiskSpaceRequirements' section */
541 if (!SpInfFindFirstLine(pSetupData->SetupInf, L"DiskSpaceRequirements", L"FreeSysPartDiskSpace", &Context))
543
544 pSetupData->RequiredPartitionDiskSpace = ~0;
545
546 /* Get the 'FreeSysPartDiskSpace' value */
547 if (!SpInfGetIntField(&Context, 1, &IntValue))
549
550 pSetupData->RequiredPartitionDiskSpace = (ULONG)IntValue;
551
552 //
553 // Support "SetupSourceDevice" and "SetupSourcePath" in txtsetup.sif
554 // See CORE-9023
555 // Support for that should also be added in setupldr.
556 //
557
558 /* Update the Setup Source paths */
559 if (SpInfFindFirstLine(pSetupData->SetupInf, L"SetupData", L"SetupSourceDevice", &Context))
560 {
561 /*
562 * Get optional pointer 'SetupSourceDevice' key, its presence
563 * will dictate whether we also need 'SetupSourcePath'.
564 */
565 if (INF_GetData(&Context, NULL, &Value))
566 {
567 /* Free the old source root path string and create the new one */
568 RtlFreeUnicodeString(&pSetupData->SourceRootPath);
569 RtlCreateUnicodeString(&pSetupData->SourceRootPath, Value);
571
572 if (!SpInfFindFirstLine(pSetupData->SetupInf, L"SetupData", L"SetupSourcePath", &Context))
573 {
574 /* The 'SetupSourcePath' value is mandatory! */
576 }
577
578 /* Get pointer 'SetupSourcePath' key */
579 if (!INF_GetData(&Context, NULL, &Value))
580 {
581 /* The 'SetupSourcePath' value is mandatory! */
583 }
584
585 /* Free the old source path string and create the new one */
586 RtlFreeUnicodeString(&pSetupData->SourceRootDir);
587 RtlCreateUnicodeString(&pSetupData->SourceRootDir, Value);
589 }
590 }
591
592 /* Search for 'DefaultPath' in the 'SetupData' section */
593 pSetupData->InstallationDirectory[0] = 0;
594 if (SpInfFindFirstLine(pSetupData->SetupInf, L"SetupData", L"DefaultPath", &Context))
595 {
596 /* Get pointer 'DefaultPath' key */
597 if (!INF_GetData(&Context, NULL, &Value))
599
600 RtlStringCchCopyW(pSetupData->InstallationDirectory,
601 ARRAYSIZE(pSetupData->InstallationDirectory),
602 Value);
603
605 }
606
607 return ERROR_SUCCESS;
608}
609
615 _In_ PPARTLIST PartitionList, /* HACK HACK! */
616 _In_ PPARTENTRY InstallPartition, /* HACK HACK! */
617 _Out_ PPARTENTRY* pSystemPartition, /* HACK HACK! */
620{
623 PPARTENTRY OldActivePart;
624
625 /*
626 * If we install on a fixed disk, try to find a supported system
627 * partition on the system. Otherwise if we install on a removable disk
628 * use the install partition as the system partition.
629 */
630 if (InstallPartition->DiskEntry->MediaType == FixedMedia)
631 {
633 FALSE,
636 /* Use the original system partition as the old active partition hint */
637 OldActivePart = PartitionList->SystemPartition;
638
641 {
642 DPRINT1("We are using a different system partition!!\n");
643
647 0);
648 if (Result != FSVOL_DOIT)
649 return FALSE;
650 }
651 }
652 else // if (InstallPartition->DiskEntry->MediaType == RemovableMedia)
653 {
655 /* Don't specify any old active partition hint */
656 OldActivePart = NULL;
657 }
658
659 if (!SystemPartition)
660 {
664 0);
665 return FALSE;
666 }
667
668 *pSystemPartition = SystemPartition;
669
670 /*
671 * If the system partition can be created in some
672 * non-partitioned space, create it now.
673 */
675 {
676 /* Automatically create the partition; it will be
677 * formatted later with default parameters */
678 // FIXME: Don't use the whole empty space, but a minimal size
679 // specified from the TXTSETUP.SIF or unattended setup.
682 0ULL,
683 0);
685 }
686
687 /* Set it as such */
689 {
690 DPRINT1("SetActivePartition(0x%p) failed?!\n", SystemPartition);
691 ASSERT(FALSE);
692 }
693
694 /*
695 * In all cases, whether or not we are going to perform a formatting,
696 * we must perform a filesystem check of the system partition.
697 */
700
701 return TRUE;
702}
703
704
705#define IS_PATH_SEPARATOR(c) ((c) == L'\\' || (c) == L'/')
706
714 _In_ PCWSTR InstallDir)
715{
716 PCWCH p;
717
718 /* As with the NT installer, fail if the path is empty or "\\" */
719 p = InstallDir;
720 if (!*p || (IS_PATH_SEPARATOR(*p) && !*(p + 1)))
721 return FALSE;
722
723 /* The path must contain only valid characters */
724 for (p = InstallDir; *p; ++p)
725 {
727 return FALSE;
728 }
729
730 /*
731 * Loop over each path component and verify that each is a valid 8.3 name.
732 */
733 for (p = InstallDir; *p;)
734 {
735 PCWSTR Path;
738 BOOLEAN IsNameLegal, SpacesInName;
739
740 /* Skip any first separator */
741 if (IS_PATH_SEPARATOR(*p))
742 ++p;
743
744 /* Now skip past the path component until we reach the next separator */
745 Path = p;
746 while (*p && !IS_PATH_SEPARATOR(*p))
747 ++p;
748 if (p == Path)
749 {
750 /* Succeed if nothing else follows this separator; otherwise
751 * it's a separator and consecutive ones are not supported */
752 return (!*p);
753 }
754
755 /* Calculate the path component length */
756 Length = p - Path;
757
758 /* As with the NT installer, fail for '.' and '..';
759 * RtlIsNameLegalDOS8Dot3() would succeed otherwise */
760 if ((Length == 1 && *Path == '.') || (Length == 2 && *Path == '.' && *(Path + 1) == '.'))
761 return FALSE;
762
763 /* As with the NT installer, allow _only ONE trailing_ dot in
764 * the path component (but not 2 or more), by reducing Length
765 * in that case; RtlIsNameLegalDOS8Dot3() would fail otherwise */
766 if (Length > 1 && *(p - 2) != L'.' && *(p - 1) == L'.')
767 --Length;
768
769 if (Length == 0)
770 return FALSE;
771
772 /* Verify that the path component is a valid 8.3 name */
773 // if (Length > 8+1+3)
774 // return FALSE;
775 Name.Length = Name.MaximumLength = (USHORT)(Length * sizeof(WCHAR));
776 Name.Buffer = (PWCHAR)Path;
777 SpacesInName = FALSE;
778 IsNameLegal = RtlIsNameLegalDOS8Dot3(&Name, NULL, &SpacesInName);
779
780 /* If it isn't legal or contain spaces, fail */
781 if (!IsNameLegal || SpacesInName)
782 {
783 DPRINT("'%wZ' is %s 8.3 filename %s spaces\n",
784 &Name,
785 (IsNameLegal ? "a valid" : "an invalid"),
786 (SpacesInName ? "with" : "without"));
787 return FALSE;
788 }
789 /* Go to the next path component */
790 }
791
792 return TRUE;
793}
794
795
798 _Inout_ PUSETUP_DATA pSetupData,
799 _In_ PCWSTR InstallationDir,
801{
803 PPARTENTRY PartEntry = Volume->PartEntry;
804 PDISKENTRY DiskEntry = PartEntry->DiskEntry;
806
807 ASSERT(PartEntry->IsPartitioned && PartEntry->PartitionNumber != 0);
808
809 /* Create 'pSetupData->DestinationRootPath' string */
810 RtlFreeUnicodeString(&pSetupData->DestinationRootPath);
811 Status = RtlStringCchPrintfW(PathBuffer, _countof(PathBuffer),
812 L"%s\\", Volume->Info.DeviceName);
813 if (!NT_SUCCESS(Status))
814 {
815 DPRINT1("RtlStringCchPrintfW() failed with status 0x%08lx\n", Status);
816 return Status;
817 }
818
819 Status = RtlCreateUnicodeString(&pSetupData->DestinationRootPath, PathBuffer) ? STATUS_SUCCESS : STATUS_NO_MEMORY;
820
821 if (!NT_SUCCESS(Status))
822 {
823 DPRINT1("RtlCreateUnicodeString() failed with status 0x%08lx\n", Status);
824 return Status;
825 }
826
827 DPRINT("DestinationRootPath: %wZ\n", &pSetupData->DestinationRootPath);
828
829 // FIXME! Which variable to choose?
830 if (!InstallationDir)
831 InstallationDir = pSetupData->InstallationDirectory;
832
834 /* Create 'pSetupData->DestinationArcPath' */
835 RtlFreeUnicodeString(&pSetupData->DestinationArcPath);
836
837 if (DiskEntry->MediaType == FixedMedia)
838 {
839 if (DiskEntry->BiosFound)
840 {
841#if 1
842 Status = RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
843 L"multi(0)disk(0)rdisk(%lu)partition(%lu)\\",
844 DiskEntry->HwFixedDiskNumber,
845 PartEntry->OnDiskPartitionNumber);
846#else
847 Status = RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
848 L"multi(%lu)disk(%lu)rdisk(%lu)partition(%lu)\\",
849 DiskEntry->HwAdapterNumber,
850 DiskEntry->HwControllerNumber,
851 DiskEntry->HwFixedDiskNumber,
852 PartEntry->OnDiskPartitionNumber);
853#endif
854 DPRINT1("Fixed disk found by BIOS, using MULTI ARC path '%S'\n", PathBuffer);
855 }
856 else
857 {
858 Status = RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
859 L"scsi(%u)disk(%u)rdisk(%u)partition(%lu)\\",
860 DiskEntry->Port,
861 DiskEntry->Bus,
862 DiskEntry->Id,
863 PartEntry->OnDiskPartitionNumber);
864 DPRINT1("Fixed disk not found by BIOS, using SCSI ARC path '%S'\n", PathBuffer);
865 }
866 }
867 else // if (DiskEntry->MediaType == RemovableMedia)
868 {
869#if 1
870 Status = RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
871 L"multi(0)disk(0)rdisk(%lu)partition(%lu)\\",
872 0, 1);
873 DPRINT1("Removable disk, using MULTI ARC path '%S'\n", PathBuffer);
874#else
875 Status = RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
876 L"signature(%08x)disk(%u)rdisk(%u)partition(%lu)\\",
877 DiskEntry->LayoutBuffer->Signature,
878 DiskEntry->Bus,
879 DiskEntry->Id,
880 PartEntry->OnDiskPartitionNumber);
881 DPRINT1("Removable disk, using SIGNATURE ARC path '%S'\n", PathBuffer);
882#endif
883 }
884
885 if (!NT_SUCCESS(Status))
886 {
887 DPRINT1("RtlStringCchPrintfW() failed with status 0x%08lx\n", Status);
888 RtlFreeUnicodeString(&pSetupData->DestinationRootPath);
889 return Status;
890 }
891
892 Status = ConcatPaths(PathBuffer, ARRAYSIZE(PathBuffer), 1, InstallationDir);
893
894 if (!NT_SUCCESS(Status))
895 {
896 DPRINT1("ConcatPaths() failed with status 0x%08lx\n", Status);
897 RtlFreeUnicodeString(&pSetupData->DestinationRootPath);
898 return Status;
899 }
900
901 Status = RtlCreateUnicodeString(&pSetupData->DestinationArcPath, PathBuffer) ? STATUS_SUCCESS : STATUS_NO_MEMORY;
902
903 if (!NT_SUCCESS(Status))
904 {
905 DPRINT1("RtlCreateUnicodeString() failed with status 0x%08lx\n", Status);
906 RtlFreeUnicodeString(&pSetupData->DestinationRootPath);
907 return Status;
908 }
909
911 /* Create 'pSetupData->DestinationPath' string */
912 RtlFreeUnicodeString(&pSetupData->DestinationPath);
913 Status = CombinePaths(PathBuffer, ARRAYSIZE(PathBuffer), 2,
914 pSetupData->DestinationRootPath.Buffer, InstallationDir);
915
916 if (!NT_SUCCESS(Status))
917 {
918 DPRINT1("CombinePaths() failed with status 0x%08lx\n", Status);
919 RtlFreeUnicodeString(&pSetupData->DestinationArcPath);
920 RtlFreeUnicodeString(&pSetupData->DestinationRootPath);
921 return Status;
922 }
923
924 Status = RtlCreateUnicodeString(&pSetupData->DestinationPath, PathBuffer) ? STATUS_SUCCESS : STATUS_NO_MEMORY;
925
926 if (!NT_SUCCESS(Status))
927 {
928 DPRINT1("RtlCreateUnicodeString() failed with status 0x%08lx\n", Status);
929 RtlFreeUnicodeString(&pSetupData->DestinationArcPath);
930 RtlFreeUnicodeString(&pSetupData->DestinationRootPath);
931 return Status;
932 }
933
935 // FIXME: This is only temporary!! Must be removed later!
936 Status = RtlCreateUnicodeString(&pSetupData->InstallPath, InstallationDir) ? STATUS_SUCCESS : STATUS_NO_MEMORY;
937
938 if (!NT_SUCCESS(Status))
939 {
940 DPRINT1("RtlCreateUnicodeString() failed with status 0x%08lx\n", Status);
941 RtlFreeUnicodeString(&pSetupData->DestinationPath);
942 RtlFreeUnicodeString(&pSetupData->DestinationArcPath);
943 RtlFreeUnicodeString(&pSetupData->DestinationRootPath);
944 return Status;
945 }
946
947 return STATUS_SUCCESS;
948}
949
950// NTSTATUS
953 IN OUT PUSETUP_DATA pSetupData,
954 IN ULONG InitPhase)
955{
956 if (InitPhase == 0)
957 {
958 RtlZeroMemory(pSetupData, sizeof(*pSetupData));
959
960 /* Initialize error handling */
961 pSetupData->LastErrorNumber = ERROR_SUCCESS;
962 pSetupData->ErrorRoutine = NULL;
963
964 /* Initialize global unicode strings */
965 RtlInitUnicodeString(&pSetupData->SourcePath, NULL);
966 RtlInitUnicodeString(&pSetupData->SourceRootPath, NULL);
967 RtlInitUnicodeString(&pSetupData->SourceRootDir, NULL);
968 RtlInitUnicodeString(&pSetupData->DestinationArcPath, NULL);
969 RtlInitUnicodeString(&pSetupData->DestinationPath, NULL);
970 RtlInitUnicodeString(&pSetupData->DestinationRootPath, NULL);
971 RtlInitUnicodeString(&pSetupData->SystemRootPath, NULL);
972
973 // FIXME: This is only temporary!! Must be removed later!
974 /***/RtlInitUnicodeString(&pSetupData->InstallPath, NULL);/***/
975
976 //
977 // TODO: Load and start SetupDD, and ask it for the information
978 //
979
980 return ERROR_SUCCESS;
981 }
982 else
983 if (InitPhase == 1)
984 {
987
988 /* Get the source path and source root path */
989 //
990 // NOTE: Sometimes the source path may not be in SystemRoot !!
991 // (and this is the case when using the 1st-stage GUI setup!)
992 //
993 Status = GetSourcePaths(&pSetupData->SourcePath,
994 &pSetupData->SourceRootPath,
995 &pSetupData->SourceRootDir);
996 if (!NT_SUCCESS(Status))
997 {
998 DPRINT1("GetSourcePaths() failed (Status 0x%08lx)\n", Status);
1000 }
1001 /*
1002 * Example of output:
1003 * SourcePath: '\Device\CdRom0\I386'
1004 * SourceRootPath: '\Device\CdRom0'
1005 * SourceRootDir: '\I386'
1006 */
1007 DPRINT1("SourcePath (1): '%wZ'\n", &pSetupData->SourcePath);
1008 DPRINT1("SourceRootPath (1): '%wZ'\n", &pSetupData->SourceRootPath);
1009 DPRINT1("SourceRootDir (1): '%wZ'\n", &pSetupData->SourceRootDir);
1010
1011 /* Set up default values */
1012 pSetupData->DestinationDiskNumber = 0;
1013 pSetupData->DestinationPartitionNumber = 1;
1014 pSetupData->BootLoaderLocation = 2; // Default to "System partition"
1015 pSetupData->FormatPartition = 0;
1016 pSetupData->AutoPartition = 0;
1017 pSetupData->FsType = 0;
1018
1019 /* Load 'txtsetup.sif' from the installation media */
1020 Error = LoadSetupInf(pSetupData);
1021 if (Error != ERROR_SUCCESS)
1022 {
1023 DPRINT1("LoadSetupInf() failed (Error 0x%lx)\n", Error);
1024 return Error;
1025 }
1026 DPRINT1("SourcePath (2): '%wZ'\n", &pSetupData->SourcePath);
1027 DPRINT1("SourceRootPath (2): '%wZ'\n", &pSetupData->SourceRootPath);
1028 DPRINT1("SourceRootDir (2): '%wZ'\n", &pSetupData->SourceRootDir);
1029
1030 /* Retrieve the target machine architecture type */
1031 // FIXME: This should be determined at runtime!!
1032 // FIXME: Allow for (pre-)installing on an architecture
1033 // different from the current one?
1034#if defined(SARCH_XBOX)
1035 pSetupData->ArchType = ARCH_Xbox;
1036// #elif defined(SARCH_PC98)
1037#else // TODO: Arc, UEFI
1038 pSetupData->ArchType = (IsNEC_98 ? ARCH_NEC98x86 : ARCH_PcAT);
1039#endif
1040
1041 return ERROR_SUCCESS;
1042 }
1043
1044 return ERROR_SUCCESS;
1045}
1046
1047VOID
1049 IN OUT PUSETUP_DATA pSetupData)
1050{
1051 /* Destroy the computer settings list */
1052 if (pSetupData->ComputerList != NULL)
1053 {
1054 DestroyGenericList(pSetupData->ComputerList, TRUE);
1055 pSetupData->ComputerList = NULL;
1056 }
1057
1058 /* Destroy the display settings list */
1059 if (pSetupData->DisplayList != NULL)
1060 {
1061 DestroyGenericList(pSetupData->DisplayList, TRUE);
1062 pSetupData->DisplayList = NULL;
1063 }
1064
1065 /* Destroy the keyboard settings list */
1066 if (pSetupData->KeyboardList != NULL)
1067 {
1068 DestroyGenericList(pSetupData->KeyboardList, TRUE);
1069 pSetupData->KeyboardList = NULL;
1070 }
1071
1072 /* Destroy the keyboard layout list */
1073 if (pSetupData->LayoutList != NULL)
1074 {
1075 DestroyGenericList(pSetupData->LayoutList, TRUE);
1076 pSetupData->LayoutList = NULL;
1077 }
1078
1079 /* Destroy the languages list */
1080 if (pSetupData->LanguageList != NULL)
1081 {
1082 DestroyGenericList(pSetupData->LanguageList, FALSE);
1083 pSetupData->LanguageList = NULL;
1084 }
1085
1086 /* Close the Setup INF */
1087 SpInfCloseInfFile(pSetupData->SetupInf);
1088}
1089
1090/*
1091 * SIDEEFFECTS
1092 * Calls RegInitializeRegistry
1093 * Calls ImportRegistryFile
1094 * Calls SetDefaultPagefile
1095 * Calls SetMountedDeviceValues
1096 */
1099 IN OUT PUSETUP_DATA pSetupData,
1100 IN BOOLEAN RepairUpdateFlag, /* HACK HACK! */
1101 IN PPARTLIST PartitionList, /* HACK HACK! */
1102 IN WCHAR DestinationDriveLetter, /* HACK HACK! */
1103 IN PCWSTR SelectedLanguageId, /* HACK HACK! */
1105 IN PFONTSUBSTSETTINGS SubstSettings OPTIONAL)
1106{
1107 ERROR_NUMBER ErrorNumber;
1109 INFCONTEXT InfContext;
1110 PCWSTR Action;
1111 PCWSTR File;
1112 PCWSTR Section;
1114 BOOLEAN ShouldRepairRegistry = FALSE;
1116
1117 if (RepairUpdateFlag)
1118 {
1119 DPRINT1("TODO: Updating / repairing the registry is not completely implemented yet!\n");
1120
1121 /* Verify the registry hives and check whether we need to update or repair any of them */
1122 Status = VerifyRegistryHives(&pSetupData->DestinationPath, &ShouldRepairRegistry);
1123 if (!NT_SUCCESS(Status))
1124 {
1125 DPRINT1("VerifyRegistryHives failed, Status 0x%08lx\n", Status);
1126 ShouldRepairRegistry = FALSE;
1127 }
1128 if (!ShouldRepairRegistry)
1129 DPRINT1("No need to repair the registry\n");
1130 }
1131
1132DoUpdate:
1133 ErrorNumber = ERROR_SUCCESS;
1134
1135 /* Update the registry */
1137
1138 /* Initialize the registry and setup the registry hives */
1139 Status = RegInitializeRegistry(&pSetupData->DestinationPath);
1140 if (!NT_SUCCESS(Status))
1141 {
1142 DPRINT1("RegInitializeRegistry() failed\n");
1143 /********** HACK!!!!!!!!!!! **********/
1145 {
1146 /* The hack was called, return its corresponding error */
1148 }
1149 else
1150 /*************************************/
1151 {
1152 /* Something else failed */
1153 return ERROR_CREATE_HIVE;
1154 }
1155 }
1156
1157 if (!RepairUpdateFlag || ShouldRepairRegistry)
1158 {
1159 /*
1160 * We fully setup the hives, in case we are doing a fresh installation
1161 * (RepairUpdateFlag == FALSE), or in case we are doing an update
1162 * (RepairUpdateFlag == TRUE) BUT we have some registry hives to
1163 * "repair" (aka. recreate: ShouldRepairRegistry == TRUE).
1164 */
1165
1166 Success = SpInfFindFirstLine(pSetupData->SetupInf, L"HiveInfs.Fresh", NULL, &InfContext); // Windows-compatible
1167 if (!Success)
1168 Success = SpInfFindFirstLine(pSetupData->SetupInf, L"HiveInfs.Install", NULL, &InfContext); // ReactOS-specific
1169
1170 if (!Success)
1171 {
1172 DPRINT1("SpInfFindFirstLine() failed\n");
1173 ErrorNumber = ERROR_FIND_REGISTRY;
1174 goto Cleanup;
1175 }
1176 }
1177 else // if (RepairUpdateFlag && !ShouldRepairRegistry)
1178 {
1179 /*
1180 * In case we are doing an update (RepairUpdateFlag == TRUE) and
1181 * NO registry hives need a repair (ShouldRepairRegistry == FALSE),
1182 * we only update the hives.
1183 */
1184
1185 Success = SpInfFindFirstLine(pSetupData->SetupInf, L"HiveInfs.Upgrade", NULL, &InfContext);
1186 if (!Success)
1187 {
1188 /* Nothing to do for update! */
1189 DPRINT1("No update needed for the registry!\n");
1190 goto Cleanup;
1191 }
1192 }
1193
1194 do
1195 {
1196 INF_GetDataField(&InfContext, 0, &Action);
1197 INF_GetDataField(&InfContext, 1, &File);
1198 INF_GetDataField(&InfContext, 2, &Section);
1199
1200 DPRINT("Action: %S File: %S Section %S\n", Action, File, Section);
1201
1202 if (Action == NULL)
1203 {
1206 INF_FreeData(Section);
1207 break; // Hackfix
1208 }
1209
1210 if (!_wcsicmp(Action, L"AddReg"))
1211 Delete = FALSE;
1212 else if (!_wcsicmp(Action, L"DelReg"))
1213 Delete = TRUE;
1214 else
1215 {
1216 DPRINT1("Unrecognized registry INF action '%S'\n", Action);
1219 INF_FreeData(Section);
1220 continue;
1221 }
1222
1224
1226
1227 if (!ImportRegistryFile(pSetupData->SourcePath.Buffer,
1228 File, Section,
1229 pSetupData->LanguageId, Delete))
1230 {
1231 DPRINT1("Importing %S failed\n", File);
1233 INF_FreeData(Section);
1234 ErrorNumber = ERROR_IMPORT_HIVE;
1235 goto Cleanup;
1236 }
1237 } while (SpInfFindNextLine(&InfContext, &InfContext));
1238
1239 if (!RepairUpdateFlag || ShouldRepairRegistry)
1240 {
1241 /* See the explanation for this test above */
1242
1244 PCWSTR LanguageId; // LocaleID;
1245
1246 Entry = GetCurrentListEntry(pSetupData->DisplayList);
1247 ASSERT(Entry);
1248 pSetupData->DisplayType = ((PGENENTRY)GetListEntryData(Entry))->Id;
1249 ASSERT(pSetupData->DisplayType);
1250
1251 /* Update display registry settings */
1253 if (!ProcessDisplayRegistry(pSetupData->SetupInf, pSetupData->DisplayType))
1254 {
1255 ErrorNumber = ERROR_UPDATE_DISPLAY_SETTINGS;
1256 goto Cleanup;
1257 }
1258
1259 Entry = GetCurrentListEntry(pSetupData->LanguageList);
1260 ASSERT(Entry);
1261 LanguageId = ((PGENENTRY)GetListEntryData(Entry))->Id;
1262 ASSERT(LanguageId);
1263
1264 /* Set the locale */
1266 if (!ProcessLocaleRegistry(/*pSetupData->*/LanguageId))
1267 {
1268 ErrorNumber = ERROR_UPDATE_LOCALESETTINGS;
1269 goto Cleanup;
1270 }
1271
1272 /* Add the keyboard layouts for the given language (without user override) */
1275 {
1276 ErrorNumber = ERROR_ADDING_KBLAYOUTS;
1277 goto Cleanup;
1278 }
1279
1280 if (!IsUnattendedSetup)
1281 {
1282 Entry = GetCurrentListEntry(pSetupData->LayoutList);
1283 ASSERT(Entry);
1284 pSetupData->LayoutId = ((PGENENTRY)GetListEntryData(Entry))->Id;
1285 ASSERT(pSetupData->LayoutId);
1286
1287 /* Update keyboard layout settings with user-overridden values */
1288 // FIXME: Wouldn't it be better to do it all at once
1289 // with the AddKeyboardLayouts() step?
1291 if (!ProcessKeyboardLayoutRegistry(pSetupData->LayoutId, SelectedLanguageId))
1292 {
1293 ErrorNumber = ERROR_UPDATE_KBSETTINGS;
1294 goto Cleanup;
1295 }
1296 }
1297
1298 /* Set GeoID */
1300 {
1301 ErrorNumber = ERROR_UPDATE_GEOID;
1302 goto Cleanup;
1303 }
1304
1305 /* Add codepage information to registry */
1308 {
1309 ErrorNumber = ERROR_ADDING_CODEPAGE;
1310 goto Cleanup;
1311 }
1312
1313 /* Set the default pagefile entry */
1314 SetDefaultPagefile(DestinationDriveLetter);
1315
1316 /* Update the mounted devices list */
1317 // FIXME: This should technically be done by mountmgr (if AutoMount is enabled)!
1319 }
1320
1321#ifdef __REACTOS__
1322 if (SubstSettings)
1323 {
1324 /* HACK */
1325 DoRegistryFontFixup(SubstSettings, wcstoul(SelectedLanguageId, NULL, 16));
1326 }
1327#endif
1328
1329Cleanup:
1330 //
1331 // TODO: Unload all the registry stuff, perform cleanup,
1332 // and copy the created hive files into .sav files.
1333 //
1334 RegCleanupRegistry(&pSetupData->DestinationPath);
1335
1336 /*
1337 * Check whether we were in update/repair mode but we were actually
1338 * repairing the registry hives. If so, we have finished repairing them,
1339 * and we now reset the flag and run the proper registry update.
1340 * Otherwise we have finished the registry update!
1341 */
1342 if (RepairUpdateFlag && ShouldRepairRegistry)
1343 {
1344 ShouldRepairRegistry = FALSE;
1345 goto DoUpdate;
1346 }
1347
1348 return ErrorNumber;
1349}
1350
1351/* EOF */
DWORD Id
unsigned char BOOLEAN
PRTL_UNICODE_STRING_BUFFER Path
struct NameRec_ * Name
Definition: cdprocs.h:460
#define OBJ_NAME_PATH_SEPARATOR
Definition: arcname_tests.c:25
LONG NTSTATUS
Definition: precomp.h:26
#define FILE_NON_DIRECTORY_FILE
Definition: constants.h:492
#define DPRINT1
Definition: precomp.h:8
static BOOL ImportRegistryFile(HWND hWnd)
Definition: framewnd.c:439
WCHAR FileNameBuffer[MAX_PATH]
Definition: framewnd.c:225
BOOL Delete(LPCTSTR ServiceName)
Definition: delete.c:12
VOID RegCleanupRegistry(IN PUNICODE_STRING NtSystemRoot)
Definition: registry.c:997
NTSTATUS RegInitializeRegistry(IN PUNICODE_STRING NtSystemRoot)
Definition: registry.c:679
NTSTATUS VerifyRegistryHives(IN PUNICODE_STRING NtSystemRoot, OUT PBOOLEAN ShouldRepairRegistry)
Definition: registry.c:603
BOOLEAN SetDefaultPagefile(_In_ WCHAR Drive)
Definition: settings.c:1370
BOOLEAN ProcessKeyboardLayoutRegistry(_In_ PCWSTR pszLayoutId, _In_ PCWSTR LanguageId)
Definition: settings.c:1267
BOOLEAN ProcessDisplayRegistry(_In_ HINF InfFile, _In_ PCWSTR DisplayType)
Definition: settings.c:806
BOOLEAN SetGeoID(_In_ GEOID GeoId)
Definition: settings.c:1320
BOOLEAN ProcessLocaleRegistry(_In_ PCWSTR LanguageId)
Definition: settings.c:969
struct _GENENTRY * PGENENTRY
static FSVOL_OP CALLBACK FsVolCallback(_In_opt_ PVOID Context, _In_ FSVOLNOTIFY FormatStatus, _In_ ULONG_PTR Param1, _In_ ULONG_PTR Param2)
Definition: reactos.c:1250
PPARTENTRY InstallPartition
Definition: reactos.c:45
PPARTENTRY SystemPartition
Definition: reactos.c:50
BOOL Error
Definition: chkdsk.c:66
Definition: File.h:16
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
#define BufferSize
Definition: mmc.h:75
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define wcsrchr
Definition: compat.h:16
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define MAX_PATH
Definition: compat.h:34
#define FILE_SHARE_READ
Definition: compat.h:136
static const WCHAR Cleanup[]
Definition: register.c:80
UNICODE_STRING * PUNICODE_STRING
Definition: env_spec_w32.h:373
struct _UNICODE_STRING UNICODE_STRING
enum _ERROR_NUMBER ERROR_NUMBER
@ ERROR_ADDING_CODEPAGE
Definition: errorcode.h:52
@ ERROR_SIGNATURE_TXTSETUPSIF
Definition: errorcode.h:26
@ ERROR_CORRUPT_TXTSETUPSIF
Definition: errorcode.h:25
@ ERROR_UPDATE_GEOID
Definition: errorcode.h:55
@ ERROR_LOAD_TXTSETUPSIF
Definition: errorcode.h:24
@ ERROR_IMPORT_HIVE
Definition: errorcode.h:39
@ ERROR_FIND_REGISTRY
Definition: errorcode.h:40
@ ERROR_UPDATE_LOCALESETTINGS
Definition: errorcode.h:53
@ ERROR_INITIALIZE_REGISTRY
Definition: errorcode.h:42
@ ERROR_CREATE_HIVE
Definition: errorcode.h:41
@ ERROR_ADDING_KBLAYOUTS
Definition: errorcode.h:54
@ ERROR_NO_SOURCE_DRIVE
Definition: errorcode.h:23
@ ERROR_UPDATE_DISPLAY_SETTINGS
Definition: errorcode.h:38
@ ERROR_UPDATE_KBSETTINGS
Definition: errorcode.h:37
@ Success
Definition: eventcreate.c:712
struct _FileName FileName
Definition: fatprocs.h:897
NTSTATUS CombinePaths(OUT PWSTR PathBuffer, IN SIZE_T cchPathSize, IN ULONG NumberOfPathComponents, IN ...)
Definition: filesup.c:671
NTSTATUS OpenAndMapFile(_In_opt_ HANDLE RootDirectory, _In_ PCWSTR PathNameToFile, _Out_opt_ PHANDLE FileHandle, _Out_opt_ PULONG FileSize, _Out_ PHANDLE SectionHandle, _Out_ PVOID *BaseAddress, _In_ BOOLEAN ReadWriteAccess)
Opens and maps a file in memory.
Definition: filesup.c:886
NTSTATUS ConcatPaths(IN OUT PWSTR PathBuffer, IN SIZE_T cchPathSize, IN ULONG NumberOfPathComponents, IN ...)
Definition: filesup.c:649
#define UnMapAndCloseFile(FileHandle, SectionHandle, BaseAddress)
Definition: filesup.h:121
#define DoesFileExist(RootDirectory, FileName)
Definition: filesup.h:83
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE FileHandle
Definition: fltkernel.h:1231
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
_Must_inspect_result_ _Out_ PLARGE_INTEGER FileSize
Definition: fsrtlfuncs.h:108
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
Status
Definition: gdiplustypes.h:25
GLfloat GLfloat p
Definition: glext.h:8902
_Check_return_ long __cdecl wcstol(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
_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 OBJ_OPENIF
Definition: winternl.h:229
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
@ ProcessImageFileName
Definition: winternl.h:397
BOOLEAN NTAPI RtlIsNameLegalDOS8Dot3(_In_ PUNICODE_STRING Name, _Inout_opt_ POEM_STRING OemName, _Inout_opt_ PBOOLEAN NameContainsSpaces)
#define INF_STYLE_OLDNT
Definition: infsupp.h:37
#define INF_STYLE_WIN4
Definition: infsupp.h:41
pSpInfFindNextLine SpInfFindNextLine
Definition: infsupp.c:88
pSpInfGetIntField SpInfGetIntField
Definition: infsupp.c:91
pSpInfFindFirstLine SpInfFindFirstLine
Definition: infsupp.c:87
FORCEINLINE VOID INF_FreeData(IN PCWSTR InfData)
Definition: infsupp.h:157
pSpInfOpenInfFile SpInfOpenInfFile
Definition: infsupp.c:95
pSpInfCloseInfFile SpInfCloseInfFile
Definition: infsupp.c:86
VOID IniCacheDestroy(_In_ PINICACHE Cache)
Definition: inicache.c:699
NTSTATUS IniCacheLoad(PINICACHE *Cache, PWCHAR FileName, BOOLEAN String)
Definition: inicache.c:655
PINI_SECTION IniAddSection(_In_ PINICACHE Cache, _In_ PCWSTR Name)
Definition: inicache.c:838
NTSTATUS IniCacheSave(PINICACHE Cache, PWCHAR FileName)
Definition: inicache.c:1038
PINICACHE IniCacheCreate(VOID)
Definition: inicache.c:919
PINI_KEYWORD IniAddKey(_In_ PINI_SECTION Section, _In_ PCWSTR Name, _In_ PCWSTR Data)
Definition: inicache.c:883
GEOID MUIGetGeoID(IN PCWSTR LanguageId)
Definition: mui.c:104
BOOLEAN AddCodePage(IN PCWSTR LanguageId)
Definition: mui.c:534
BOOLEAN AddKeyboardLayouts(IN PCWSTR LanguageId)
Definition: mui.c:362
BOOLEAN INF_GetDataField(IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT PCWSTR *Data)
Definition: infsupp.c:42
BOOLEAN INF_GetData(IN PINFCONTEXT Context, OUT PCWSTR *Key, OUT PCWSTR *Data)
Definition: infsupp.c:90
VOID DestroyGenericList(IN OUT PGENERIC_LIST List, IN BOOLEAN FreeData)
Definition: genlist.c:36
PGENERIC_LIST_ENTRY GetCurrentListEntry(IN PGENERIC_LIST List)
Definition: genlist.c:97
PVOID GetListEntryData(IN PGENERIC_LIST_ENTRY Entry)
Definition: genlist.c:126
UNICODE_STRING Volume
Definition: fltkernel.h:1172
#define ASSERT(a)
Definition: mode.c:44
static const char const char const char PIMAGEHLP_STATUS_ROUTINE StatusRoutine
Definition: image.c:35
#define ULL(a, b)
Definition: format_msg.c:27
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define _Inout_
Definition: ms_sal.h:378
#define _Out_
Definition: ms_sal.h:345
#define _In_
Definition: ms_sal.h:308
#define _In_opt_
Definition: ms_sal.h:309
unsigned int UINT
Definition: ndis.h:50
NTSYSAPI NTSTATUS NTAPI NtOpenFile(OUT PHANDLE phFile, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG ShareMode, IN ULONG OpenMode)
Definition: file.c:3952
#define SYNCHRONIZE
Definition: nt_native.h:61
#define SYMBOLIC_LINK_QUERY
Definition: nt_native.h:1265
NTSYSAPI NTSTATUS NTAPI NtWriteFile(IN HANDLE hFile, IN HANDLE hEvent OPTIONAL, IN PIO_APC_ROUTINE IoApcRoutine OPTIONAL, IN PVOID IoApcContext OPTIONAL, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN PVOID WriteBuffer, IN ULONG WriteBufferLength, IN PLARGE_INTEGER FileOffset OPTIONAL, IN PULONG LockOperationKey OPTIONAL)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define NtCurrentProcess()
Definition: nt_native.h:1657
NTSYSAPI NTSTATUS NTAPI NtQueryInformationFile(IN HANDLE hFile, OUT PIO_STATUS_BLOCK pIoStatusBlock, OUT PVOID FileInformationBuffer, IN ULONG FileInformationBufferLength, IN FILE_INFORMATION_CLASS FileInfoClass)
#define FILE_APPEND_DATA
Definition: nt_native.h:634
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3402
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define RTL_NUMBER_OF_FIELD(type, field)
Definition: ntbasedef.h:703
CONST WCHAR * PCWCH
Definition: ntbasedef.h:411
#define UNICODE_NULL
@ FixedMedia
Definition: ntdddisk.h:383
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
NTSTATUS NTAPI NtQueryInformationProcess(_In_ HANDLE ProcessHandle, _In_ PROCESSINFOCLASS ProcessInformationClass, _Out_ PVOID ProcessInformation, _In_ ULONG ProcessInformationLength, _Out_opt_ PULONG ReturnLength)
Definition: query.c:59
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:239
NTSTRSAFEAPI RtlStringCchCopyW(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_ NTSTRSAFE_PCWSTR pszSrc)
Definition: ntstrsafe.h:127
NTSTRSAFEVAPI RtlStringCchPrintfW(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,...)
Definition: ntstrsafe.h:1110
#define L(x)
Definition: ntvdm.h:50
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
#define FileStandardInformation
Definition: propsheet.cpp:61
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
@ FSVOLNOTIFY_PARTITIONERROR
Definition: fsutil.h:142
@ ChangeSystemPartition
Definition: fsutil.h:149
enum _FSVOL_OP FSVOL_OP
@ FSVOL_DOIT
Definition: fsutil.h:159
FSVOL_OP(CALLBACK * PFSVOL_CALLBACK)(_In_opt_ PVOID Context, _In_ FSVOLNOTIFY FormatStatus, _In_ ULONG_PTR Param1, _In_ ULONG_PTR Param2)
Definition: fsutil.h:196
BOOLEAN SetMountedDeviceValues(_In_ PPARTLIST List)
Definition: partlist.c:3810
BOOLEAN CreatePartition(_In_ PPARTLIST List, _Inout_ PPARTENTRY PartEntry, _In_opt_ ULONGLONG SizeBytes, _In_opt_ ULONG_PTR PartitionInfo)
Definition: partlist.c:2843
BOOLEAN SetActivePartition(IN PPARTLIST List, IN PPARTENTRY PartEntry, IN PPARTENTRY OldActivePart OPTIONAL)
Definition: partlist.c:3461
PPARTENTRY FindSupportedSystemPartition(IN PPARTLIST List, IN BOOLEAN ForceSelect, IN PDISKENTRY AlternativeDisk OPTIONAL, IN PPARTENTRY AlternativePart OPTIONAL)
Definition: partlist.c:3161
NTSTATUS InitDestinationPaths(_Inout_ PUSETUP_DATA pSetupData, _In_ PCWSTR InstallationDir, _In_ PVOLENTRY Volume)
Definition: setuplib.c:797
BOOLEAN InitSystemPartition(_In_ PPARTLIST PartitionList, _In_ PPARTENTRY InstallPartition, _Out_ PPARTENTRY *pSystemPartition, _In_opt_ PFSVOL_CALLBACK FsVolCallback, _In_opt_ PVOID Context)
Find or set the active system partition.
Definition: setuplib.c:614
ERROR_NUMBER LoadSetupInf(IN OUT PUSETUP_DATA pSetupData)
Definition: setuplib.c:499
VOID FinishSetup(IN OUT PUSETUP_DATA pSetupData)
Definition: setuplib.c:1048
BOOLEAN IsValidInstallDirectory(_In_ PCWSTR InstallDir)
Verify whether the given directory is suitable for ReactOS installation. Each path component must be ...
Definition: setuplib.c:713
VOID CheckUnattendedSetup(IN OUT PUSETUP_DATA pSetupData)
Definition: setuplib.c:28
ERROR_NUMBER UpdateRegistry(IN OUT PUSETUP_DATA pSetupData, IN BOOLEAN RepairUpdateFlag, IN PPARTLIST PartitionList, IN WCHAR DestinationDriveLetter, IN PCWSTR SelectedLanguageId, IN PREGISTRY_STATUS_ROUTINE StatusRoutine OPTIONAL, IN PFONTSUBSTSETTINGS SubstSettings OPTIONAL)
Definition: setuplib.c:1098
NTSTATUS GetSourcePaths(OUT PUNICODE_STRING SourcePath, OUT PUNICODE_STRING SourceRootPath, OUT PUNICODE_STRING SourceRootDir)
Definition: setuplib.c:382
#define IS_PATH_SEPARATOR(c)
Definition: setuplib.c:705
VOID InstallSetupInfFile(IN OUT PUSETUP_DATA pSetupData)
Definition: setuplib.c:202
ERROR_NUMBER InitializeSetup(IN OUT PUSETUP_DATA pSetupData, IN ULONG InitPhase)
Definition: setuplib.c:952
#define ERROR_SYSTEM_PARTITION_NOT_FOUND
Definition: setuplib.h:181
@ ARCH_NEC98x86
Definition: setuplib.h:72
@ ARCH_PcAT
Definition: setuplib.h:71
@ ARCH_Xbox
Definition: setuplib.h:73
#define IS_VALID_INSTALL_PATH_CHAR(c)
Defines the class of characters valid for the installation directory.
Definition: setuplib.h:198
@ KeybLayouts
Definition: setuplib.h:229
@ DisplaySettingsUpdate
Definition: setuplib.h:227
@ CodePageInfoUpdate
Definition: setuplib.h:231
@ LocaleSettingsUpdate
Definition: setuplib.h:228
@ RegHiveUpdate
Definition: setuplib.h:225
@ ImportRegHive
Definition: setuplib.h:226
@ KeybSettingsUpdate
Definition: setuplib.h:230
VOID(__cdecl * PREGISTRY_STATUS_ROUTINE)(IN REGISTRY_STATUS,...)
Definition: setuplib.h:235
BOOLEAN IsUnattendedSetup
Definition: reactos.c:41
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:73
#define _countof(array)
Definition: sndvol32.h:70
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
base of all file and directory entries
Definition: entries.h:83
ULONG HwAdapterNumber
Definition: partlist.h:121
ULONG HwControllerNumber
Definition: partlist.h:122
BOOLEAN BiosFound
Definition: partlist.h:120
USHORT Bus
Definition: partlist.h:132
USHORT Id
Definition: partlist.h:133
USHORT Port
Definition: partlist.h:131
MEDIA_TYPE MediaType
Definition: partlist.h:106
ULONG HwFixedDiskNumber
Definition: partlist.h:124
PDRIVE_LAYOUT_INFORMATION LayoutBuffer
Definition: partlist.h:143
Definition: genlist.h:11
BOOLEAN IsPartitioned
Definition: partlist.h:82
PVOLENTRY Volume
Definition: partlist.h:95
struct _DISKENTRY * DiskEntry
Definition: partlist.h:66
ULONG OnDiskPartitionNumber
Definition: partlist.h:74
ULONG PartitionNumber
Definition: partlist.h:75
PPARTENTRY SystemPartition
Definition: partlist.h:181
BOOLEAN NeedsCheck
Definition: partlist.h:51
BOOL DoRegistryFontFixup(PFONTSUBSTSETTINGS pSettings, LANGID LangID)
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
uint16_t * PWSTR
Definition: typedefs.h:56
const uint16_t * PCWSTR
Definition: typedefs.h:57
ULONG_PTR SIZE_T
Definition: typedefs.h:80
int32_t INT
Definition: typedefs.h:58
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
uint16_t * PWCHAR
Definition: typedefs.h:56
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
static PPARTLIST PartitionList
Definition: usetup.c:75
static BOOLEAN RepairUpdateFlag
Definition: usetup.c:72
PCWSTR SelectedLanguageId
Definition: usetup.c:68
_In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR Iterator
Definition: wdfchildlist.h:656
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3275
_In_ WDFIOTARGET _In_ _Strict_type_match_ WDF_IO_TARGET_SENT_IO_ACTION Action
Definition: wdfiotarget.h:510
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:254
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409
#define IsNEC_98
Definition: ketypes.h:911
unsigned char UCHAR
Definition: xmlstorage.h:181
__wchar_t WCHAR
Definition: xmlstorage.h:180
char CHAR
Definition: xmlstorage.h:175