ReactOS 0.4.16-dev-833-g4bc97ad
setuplib.c File Reference
#include "precomp.h"
#include "filesup.h"
#include "infsupp.h"
#include "inicache.h"
#include "setuplib.h"
#include <debug.h>
Include dependency graph for setuplib.c:

Go to the source code of this file.

Macros

#define NDEBUG
 
#define IS_PATH_SEPARATOR(c)   ((c) == L'\\' || (c) == L'/')
 

Functions

BOOLEAN NTAPI CheckUnattendedSetup (IN OUT PUSETUP_DATA pSetupData)
 
VOID NTAPI InstallSetupInfFile (IN OUT PUSETUP_DATA pSetupData)
 
NTSTATUS GetSourcePaths (_Out_ PUNICODE_STRING SourcePath, _Out_ PUNICODE_STRING SourceRootPath, _Out_ PUNICODE_STRING SourceRootDir)
 Determine the installation source path and isolate its useful path components (root path and source sub-directory).
 
ERROR_NUMBER LoadSetupInf (IN OUT PUSETUP_DATA pSetupData)
 
BOOLEAN NTAPI 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.
 
BOOLEAN NTAPI IsValidInstallDirectory (_In_ PCWSTR InstallDir)
 Verify whether the given directory is suitable for ReactOS installation. Each path component must be a valid 8.3 name.
 
NTSTATUS NTAPI InitDestinationPaths (_Inout_ PUSETUP_DATA pSetupData, _In_ PCWSTR InstallationDir, _In_ PVOLENTRY Volume)
 
ERROR_NUMBER NTAPI InitializeSetup (_Inout_ PUSETUP_DATA pSetupData, _In_opt_ PSETUP_ERROR_ROUTINE ErrorRoutine, _In_ PSPFILE_EXPORTS pSpFileExports, _In_ PSPINF_EXPORTS pSpInfExports)
 
VOID NTAPI FinishSetup (IN OUT PUSETUP_DATA pSetupData)
 
ERROR_NUMBER NTAPI 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)
 
NTSTATUS NTAPI LdrDisableThreadCalloutsForDll (_In_ PVOID BaseAddress)
 
BOOL NTAPI DllMain (_In_ HINSTANCE hDll, _In_ ULONG dwReason, _In_opt_ PVOID pReserved)
 

Variables

HANDLE ProcessHeap
 
BOOLEAN IsUnattendedSetup = FALSE
 

Macro Definition Documentation

◆ IS_PATH_SEPARATOR

#define IS_PATH_SEPARATOR (   c)    ((c) == L'\\' || (c) == L'/')

Definition at line 770 of file setuplib.c.

◆ NDEBUG

#define NDEBUG

Definition at line 19 of file setuplib.c.

Function Documentation

◆ CheckUnattendedSetup()

BOOLEAN NTAPI CheckUnattendedSetup ( IN OUT PUSETUP_DATA  pSetupData)

Definition at line 32 of file setuplib.c.

34{
36 HINF UnattendInf;
37 UINT ErrorLine;
38 INT IntValue;
40 WCHAR UnattendInfPath[MAX_PATH];
41
42 CombinePaths(UnattendInfPath, ARRAYSIZE(UnattendInfPath), 2,
43 pSetupData->SourcePath.Buffer, L"unattend.inf");
44
45 DPRINT("UnattendInf path: '%S'\n", UnattendInfPath);
46
47 if (DoesFileExist(NULL, UnattendInfPath) == FALSE)
48 {
49 DPRINT("Does not exist: %S\n", UnattendInfPath);
50 return IsUnattendedSetup;
51 }
52
53 /* Load 'unattend.inf' from installation media */
54 UnattendInf = SpInfOpenInfFile(UnattendInfPath,
55 NULL,
57 pSetupData->LanguageId,
58 &ErrorLine);
59 if (UnattendInf == INVALID_HANDLE_VALUE)
60 {
61 DPRINT("SpInfOpenInfFile() failed\n");
62 return IsUnattendedSetup;
63 }
64
65 /* Open 'Unattend' section */
66 if (!SpInfFindFirstLine(UnattendInf, L"Unattend", L"Signature", &Context))
67 {
68 DPRINT("SpInfFindFirstLine() failed for section 'Unattend'\n");
69 goto Quit;
70 }
71
72 /* Get pointer 'Signature' key */
73 if (!INF_GetData(&Context, NULL, &Value))
74 {
75 DPRINT("INF_GetData() failed for key 'Signature'\n");
76 goto Quit;
77 }
78
79 /* Check 'Signature' string */
80 if (_wcsicmp(Value, L"$ReactOS$") != 0)
81 {
82 DPRINT("Signature not $ReactOS$\n");
84 goto Quit;
85 }
86
88
89 /* Check if Unattend setup is enabled */
90 if (!SpInfFindFirstLine(UnattendInf, L"Unattend", L"UnattendSetupEnabled", &Context))
91 {
92 DPRINT("Can't find key 'UnattendSetupEnabled'\n");
93 goto Quit;
94 }
95
96 if (!INF_GetData(&Context, NULL, &Value))
97 {
98 DPRINT("Can't read key 'UnattendSetupEnabled'\n");
99 goto Quit;
100 }
101
102 if (_wcsicmp(Value, L"yes") != 0)
103 {
104 DPRINT("Unattend setup is disabled by 'UnattendSetupEnabled' key!\n");
106 goto Quit;
107 }
108
110
111 /* Search for 'DestinationDiskNumber' */
112 if (!SpInfFindFirstLine(UnattendInf, L"Unattend", L"DestinationDiskNumber", &Context))
113 {
114 DPRINT("SpInfFindFirstLine() failed for key 'DestinationDiskNumber'\n");
115 goto Quit;
116 }
117
118 if (!SpInfGetIntField(&Context, 1, &IntValue))
119 {
120 DPRINT("SpInfGetIntField() failed for key 'DestinationDiskNumber'\n");
121 goto Quit;
122 }
123
124 pSetupData->DestinationDiskNumber = (LONG)IntValue;
125
126 /* Search for 'DestinationPartitionNumber' */
127 if (!SpInfFindFirstLine(UnattendInf, L"Unattend", L"DestinationPartitionNumber", &Context))
128 {
129 DPRINT("SpInfFindFirstLine() failed for key 'DestinationPartitionNumber'\n");
130 goto Quit;
131 }
132
133 if (!SpInfGetIntField(&Context, 1, &IntValue))
134 {
135 DPRINT("SpInfGetIntField() failed for key 'DestinationPartitionNumber'\n");
136 goto Quit;
137 }
138
139 pSetupData->DestinationPartitionNumber = (LONG)IntValue;
140
141 /* Search for 'InstallationDirectory' (optional) */
142 if (SpInfFindFirstLine(UnattendInf, L"Unattend", L"InstallationDirectory", &Context))
143 {
144 if (INF_GetData(&Context, NULL, &Value))
145 {
146 RtlStringCchCopyW(pSetupData->InstallationDirectory,
147 ARRAYSIZE(pSetupData->InstallationDirectory),
148 Value);
150 }
151 else
152 {
153 DPRINT("INF_GetData() failed for key 'InstallationDirectory'\n");
154 }
155 }
156
158 DPRINT("Running unattended setup\n");
159
160 /* Search for 'BootLoaderLocation' (optional) */
161 if (SpInfFindFirstLine(UnattendInf, L"Unattend", L"BootLoaderLocation", &Context))
162 {
163 if (SpInfGetIntField(&Context, 1, &IntValue))
164 pSetupData->BootLoaderLocation = IntValue;
165 }
166
167 /* Search for 'FormatPartition' (optional) */
168 if (SpInfFindFirstLine(UnattendInf, L"Unattend", L"FormatPartition", &Context))
169 {
170 if (SpInfGetIntField(&Context, 1, &IntValue))
171 pSetupData->FormatPartition = IntValue;
172 }
173
174 /* Search for 'AutoPartition' (optional) */
175 if (SpInfFindFirstLine(UnattendInf, L"Unattend", L"AutoPartition", &Context))
176 {
177 if (SpInfGetIntField(&Context, 1, &IntValue))
178 pSetupData->AutoPartition = IntValue;
179 }
180
181 /* Search for 'LocaleID' (optional) */
182 if (SpInfFindFirstLine(UnattendInf, L"Unattend", L"LocaleID", &Context))
183 {
184 if (INF_GetData(&Context, NULL, &Value))
185 {
186 LONG Id = wcstol(Value, NULL, 16);
187 RtlStringCchPrintfW(pSetupData->LocaleID,
188 ARRAYSIZE(pSetupData->LocaleID),
189 L"%08lx", Id);
191 }
192 }
193
194 /* Search for 'FsType' (optional) */
195 if (SpInfFindFirstLine(UnattendInf, L"Unattend", L"FsType", &Context))
196 {
197 if (SpInfGetIntField(&Context, 1, &IntValue))
198 pSetupData->FsType = IntValue;
199 }
200
201Quit:
202 SpInfCloseInfFile(UnattendInf);
203 return IsUnattendedSetup;
204}
DWORD Id
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define MAX_PATH
Definition: compat.h:34
NTSTATUS CombinePaths(OUT PWSTR PathBuffer, IN SIZE_T cchPathSize, IN ULONG NumberOfPathComponents, IN ...)
Definition: filesup.c:664
#define DoesFileExist(RootDirectory, FileName)
Definition: filesup.h:83
_Check_return_ long __cdecl wcstol(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define INF_STYLE_OLDNT
Definition: infsupp.h:39
#define SpInfGetIntField
Definition: infsupp.h:144
FORCEINLINE VOID INF_FreeData(IN PCWSTR InfData)
Definition: infsupp.h:154
#define SpInfOpenInfFile
Definition: infsupp.h:148
#define SpInfCloseInfFile
Definition: infsupp.h:139
#define SpInfFindFirstLine
Definition: infsupp.h:140
BOOLEAN INF_GetData(IN PINFCONTEXT Context, OUT PCWSTR *Key, OUT PCWSTR *Data)
Definition: infsupp.c:77
unsigned int UINT
Definition: ndis.h:50
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
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
BOOLEAN IsUnattendedSetup
Definition: setuplib.c:26
#define DPRINT
Definition: sndvol32.h:73
const uint16_t * PCWSTR
Definition: typedefs.h:57
int32_t INT
Definition: typedefs.h:58
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by _tWinMain(), and SetupStartPage().

◆ DllMain()

BOOL NTAPI DllMain ( _In_ HINSTANCE  hDll,
_In_ ULONG  dwReason,
_In_opt_ PVOID  pReserved 
)

Definition at line 1419 of file setuplib.c.

1423{
1424 UNREFERENCED_PARAMETER(pReserved);
1425
1427 {
1429 ProcessHeap = RtlGetProcessHeap();
1430 }
1431
1432 return TRUE;
1433}
DWORD dwReason
Definition: misc.cpp:135
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:325
HANDLE ProcessHeap
Definition: setuplib.c:25
NTSTATUS NTAPI LdrDisableThreadCalloutsForDll(_In_ PVOID BaseAddress)
Definition: ldrapi.c:1154

◆ FinishSetup()

VOID NTAPI FinishSetup ( IN OUT PUSETUP_DATA  pSetupData)

Definition at line 1104 of file setuplib.c.

1106{
1107 /* Destroy the computer settings list */
1108 if (pSetupData->ComputerList != NULL)
1109 {
1110 DestroyGenericList(pSetupData->ComputerList, TRUE);
1111 pSetupData->ComputerList = NULL;
1112 }
1113
1114 /* Destroy the display settings list */
1115 if (pSetupData->DisplayList != NULL)
1116 {
1117 DestroyGenericList(pSetupData->DisplayList, TRUE);
1118 pSetupData->DisplayList = NULL;
1119 }
1120
1121 /* Destroy the keyboard settings list */
1122 if (pSetupData->KeyboardList != NULL)
1123 {
1124 DestroyGenericList(pSetupData->KeyboardList, TRUE);
1125 pSetupData->KeyboardList = NULL;
1126 }
1127
1128 /* Destroy the keyboard layout list */
1129 if (pSetupData->LayoutList != NULL)
1130 {
1131 DestroyGenericList(pSetupData->LayoutList, TRUE);
1132 pSetupData->LayoutList = NULL;
1133 }
1134
1135 /* Destroy the languages list */
1136 if (pSetupData->LanguageList != NULL)
1137 {
1138 DestroyGenericList(pSetupData->LanguageList, FALSE);
1139 pSetupData->LanguageList = NULL;
1140 }
1141
1142 /* Close the Setup INF */
1143 SpInfCloseInfFile(pSetupData->SetupInf);
1144}
VOID NTAPI DestroyGenericList(IN OUT PGENERIC_LIST List, IN BOOLEAN FreeData)
Definition: genlist.c:38

Referenced by _tWinMain(), and RunUSetup().

◆ GetSourcePaths()

NTSTATUS GetSourcePaths ( _Out_ PUNICODE_STRING  SourcePath,
_Out_ PUNICODE_STRING  SourceRootPath,
_Out_ PUNICODE_STRING  SourceRootDir 
)

Determine the installation source path and isolate its useful path components (root path and source sub-directory).

The installation source path is based either on the installer's image file path, or on the \SystemRoot full path.

In case the \SystemRoot full path prefixes the image file path, use the resolved \SystemRoot as the installation source path. Otherwise, use the image file path.

The returned strings are allocated with RtlCreateUnicodeString(), and need to be freed with RtlFreeUnicodeString() after being used.

Example of output: SourcePath: '\Device\CdRom0\I386' SourceRootPath: '\Device\CdRom0' SourceRootDir: '\I386'

Definition at line 408 of file setuplib.c.

412{
415 PWCHAR Ptr;
416 HANDLE LinkHandle;
419 struct { OBJECT_NAME_INFORMATION; WCHAR Buffer[MAX_PATH]; } ImageFileBuffer;
420 PUNICODE_STRING InstallSourcePath = &ImageFileBuffer.Name;
421 struct { OBJECT_NAME_INFORMATION; WCHAR Buffer[MAX_PATH]; } SystemRootBuffer;
422 PUNICODE_STRING SystemRootPath = &SystemRootBuffer.Name;
423 const UNICODE_STRING SystemRoot = RTL_CONSTANT_STRING(L"\\SystemRoot");
424
425 /* Retrieve the installer's full image file path */
426 RtlInitEmptyUnicodeString(InstallSourcePath,
427 ImageFileBuffer.Buffer,
428 sizeof(ImageFileBuffer.Buffer));
429 BufferSize = sizeof(ImageFileBuffer);
432 InstallSourcePath,
434 NULL);
435 // STATUS_INFO_LENGTH_MISMATCH or STATUS_BUFFER_TOO_SMALL ?
436 if (!NT_SUCCESS(Status))
437 return Status;
438 ASSERT(InstallSourcePath->Length < InstallSourcePath->MaximumLength);
439
440 /* Go to the beginning of the path component, stop at the separator */
441 Ptr = ImageFileBuffer.Buffer + (InstallSourcePath->Length / sizeof(WCHAR));
442 while ((Ptr > ImageFileBuffer.Buffer) && (*Ptr != OBJ_NAME_PATH_SEPARATOR))
443 --Ptr;
444 /* Strip the trailing file name (at the separator or beginning of buffer)
445 * and manually NULL-terminate */
446 InstallSourcePath->Length = (ULONG_PTR)Ptr - (ULONG_PTR)ImageFileBuffer.Buffer;
447 InstallSourcePath->Buffer[InstallSourcePath->Length / sizeof(WCHAR)] = UNICODE_NULL;
448
449
450 /*
451 * Now, resolve the \SystemRoot symlink target full path.
452 *
453 * The symlink target path resolution requires reparsing, because it
454 * can reference other symlinks. This is what happens, for example when
455 * booting the installation from a removable hard-disk. We can have:
456 *
457 * \SystemRoot ---> \Device\Harddisk1\Partition1\ReactOS
458 * and: \Device\Harddisk1\Partition1 ---> \Device\HarddiskVolume2
459 * etc.
460 * and we wish to resolve \SystemRoot to: \Device\HarddiskVolume2\ReactOS
461 *
462 * We then verify whether it prefixes the image file path obtained
463 * from the step above, which is a fully reparsed path.
464 *
465 * - Using NtOpenSymbolicLinkObject(SYMBOLIC_LINK_QUERY) followed by
466 * NtQuerySymbolicLinkObject() would only resolve the first symlink
467 * but not the others (\Device\Harddisk1\Partition1 left as is).
468 *
469 * - Since \SystemRoot has to point to a directory, we try opening
470 * the directory itself: NtOpenFile(..., FILE_DIRECTORY_FILE).
471 *
472 * - A call to NtQueryInformationFile(FileNameInformation) alone on
473 * the obtained handle would only retrieve the FS directory name,
474 * i.e. \ReactOS , but not the whole NT path.
475 *
476 * - We therefore use NtQueryObject(), which allows retrieving the
477 * full resolved NT path (device name + FS directory name).
478 */
479
483 NULL,
484 NULL);
485
486 RtlInitEmptyUnicodeString(SystemRootPath,
487 SystemRootBuffer.Buffer,
488 sizeof(SystemRootBuffer.Buffer));
489
490 Status = NtOpenFile(&LinkHandle,
496 /*| FILE_OPEN_FOR_BACKUP_INTENT*/);
497 if (NT_SUCCESS(Status))
498 {
499 /* Resolve the path and close its handle */
500 Status = NtQueryObject(LinkHandle,
502 &SystemRootBuffer,
503 sizeof(SystemRootBuffer),
504 &BufferSize);
505 NtClose(LinkHandle);
506 }
507 /* If any of the calls above failed, try to naively resolve the symlink */
508 if (!NT_SUCCESS(Status))
509 {
510 RtlInitEmptyUnicodeString(SystemRootPath,
511 SystemRootBuffer.Buffer,
512 sizeof(SystemRootBuffer.Buffer));
513
514 Status = NtOpenSymbolicLinkObject(&LinkHandle,
517 if (NT_SUCCESS(Status))
518 {
519 /* Resolve the link and close its handle */
521 SystemRootPath,
522 &BufferSize);
523 NtClose(LinkHandle);
524 }
525 }
526 ASSERT(SystemRootPath->Length < SystemRootPath->MaximumLength);
527
528 /*
529 * If the resolved \SystemRoot is a prefix of the image file path,
530 * use \SystemRoot instead as the installation source path.
531 *
532 * If opening the \SystemRoot link failed (usually due to wrong
533 * access rights), do not consider this as a fatal error, and
534 * use the image file path as the installation source path.
535 */
536 if (NT_SUCCESS(Status) && RtlPrefixUnicodeString(SystemRootPath, InstallSourcePath, TRUE))
537 InstallSourcePath = SystemRootPath;
538
539
540 /*
541 * Retrieve the different source path components.
542 */
543 RtlCreateUnicodeString(SourcePath, InstallSourcePath->Buffer);
544
545 /* Isolate and strip the trailing (source root) directory */
546 Ptr = wcsrchr(InstallSourcePath->Buffer, OBJ_NAME_PATH_SEPARATOR);
547 if (Ptr)
548 {
549 RtlCreateUnicodeString(SourceRootDir, Ptr);
550 *Ptr = UNICODE_NULL;
551 }
552 else
553 {
554 RtlCreateUnicodeString(SourceRootDir, L"");
555 }
556
557 RtlCreateUnicodeString(SourceRootPath, InstallSourcePath->Buffer);
558
559 return STATUS_SUCCESS;
560}
@ ObjectNameInformation
Definition: DriverTester.h:55
NTSTATUS NtQueryObject(IN HANDLE Handle, IN OBJECT_INFO_CLASS ObjectInformationClass, OUT PVOID ObjectInformation, IN ULONG ObjectInformationLength, OUT PULONG ReturnLength)
#define OBJ_NAME_PATH_SEPARATOR
Definition: arcname_tests.c:25
LONG NTSTATUS
Definition: precomp.h:26
#define FILE_DIRECTORY_FILE
Definition: constants.h:491
Definition: bufpool.h:45
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 NT_SUCCESS(StatCode)
Definition: apphelp.c:33
static const WCHAR SystemRoot[]
Definition: reg.c:38
#define wcsrchr
Definition: compat.h:16
#define FILE_SHARE_READ
Definition: compat.h:136
#define ULONG_PTR
Definition: config.h:101
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
Status
Definition: gdiplustypes.h:25
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
@ ProcessImageFileName
Definition: winternl.h:397
#define ASSERT(a)
Definition: mode.c:44
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
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:3953
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define SYNCHRONIZE
Definition: nt_native.h:61
#define SYMBOLIC_LINK_QUERY
Definition: nt_native.h:1265
#define NtCurrentProcess()
Definition: nt_native.h:1657
struct _OBJECT_NAME_INFORMATION OBJECT_NAME_INFORMATION
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3402
NTSYSAPI BOOLEAN NTAPI RtlPrefixUnicodeString(IN PUNICODE_STRING String1, IN PUNICODE_STRING String2, IN BOOLEAN CaseInSensitive)
#define UNICODE_NULL
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_SUCCESS
Definition: shellext.h:65
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint16_t * PWCHAR
Definition: typedefs.h:56
uint32_t ULONG
Definition: typedefs.h:59
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:254

Referenced by InitializeSetup().

◆ InitDestinationPaths()

NTSTATUS NTAPI InitDestinationPaths ( _Inout_ PUSETUP_DATA  pSetupData,
_In_ PCWSTR  InstallationDir,
_In_ PVOLENTRY  Volume 
)

Equivalent of 'NTOS_INSTALLATION::SystemArcPath'

Equivalent of 'NTOS_INSTALLATION::SystemNtPath'

Equivalent of 'NTOS_INSTALLATION::PathComponent'

Definition at line 864 of file setuplib.c.

868{
870 PPARTENTRY PartEntry = Volume->PartEntry;
871 PDISKENTRY DiskEntry = PartEntry->DiskEntry;
873
874 ASSERT(PartEntry->IsPartitioned && PartEntry->PartitionNumber != 0);
875
876 /* Create 'pSetupData->DestinationRootPath' string */
877 RtlFreeUnicodeString(&pSetupData->DestinationRootPath);
878 Status = RtlStringCchPrintfW(PathBuffer, _countof(PathBuffer),
879 L"%s\\", Volume->Info.DeviceName);
880 if (!NT_SUCCESS(Status))
881 {
882 DPRINT1("RtlStringCchPrintfW() failed with status 0x%08lx\n", Status);
883 return Status;
884 }
885
886 Status = RtlCreateUnicodeString(&pSetupData->DestinationRootPath, PathBuffer) ? STATUS_SUCCESS : STATUS_NO_MEMORY;
887
888 if (!NT_SUCCESS(Status))
889 {
890 DPRINT1("RtlCreateUnicodeString() failed with status 0x%08lx\n", Status);
891 return Status;
892 }
893
894 DPRINT("DestinationRootPath: %wZ\n", &pSetupData->DestinationRootPath);
895
896 // FIXME! Which variable to choose?
897 if (!InstallationDir)
898 InstallationDir = pSetupData->InstallationDirectory;
899
901 /* Create 'pSetupData->DestinationArcPath' */
902 RtlFreeUnicodeString(&pSetupData->DestinationArcPath);
903
904 if (DiskEntry->MediaType == FixedMedia)
905 {
906 if (DiskEntry->BiosFound)
907 {
908#if 1
909 Status = RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
910 L"multi(0)disk(0)rdisk(%lu)partition(%lu)\\",
911 DiskEntry->HwFixedDiskNumber,
912 PartEntry->OnDiskPartitionNumber);
913#else
914 Status = RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
915 L"multi(%lu)disk(%lu)rdisk(%lu)partition(%lu)\\",
916 DiskEntry->HwAdapterNumber,
917 DiskEntry->HwControllerNumber,
918 DiskEntry->HwFixedDiskNumber,
919 PartEntry->OnDiskPartitionNumber);
920#endif
921 DPRINT1("Fixed disk found by BIOS, using MULTI ARC path '%S'\n", PathBuffer);
922 }
923 else
924 {
925 Status = RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
926 L"scsi(%u)disk(%u)rdisk(%u)partition(%lu)\\",
927 DiskEntry->Port,
928 DiskEntry->Bus,
929 DiskEntry->Id,
930 PartEntry->OnDiskPartitionNumber);
931 DPRINT1("Fixed disk not found by BIOS, using SCSI ARC path '%S'\n", PathBuffer);
932 }
933 }
934 else // if (DiskEntry->MediaType == RemovableMedia)
935 {
936#if 1
937 Status = RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
938 L"multi(0)disk(0)rdisk(%lu)partition(%lu)\\",
939 0, 1);
940 DPRINT1("Removable disk, using MULTI ARC path '%S'\n", PathBuffer);
941#else
942 Status = RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
943 L"signature(%08x)disk(%u)rdisk(%u)partition(%lu)\\",
944 DiskEntry->LayoutBuffer->Signature,
945 DiskEntry->Bus,
946 DiskEntry->Id,
947 PartEntry->OnDiskPartitionNumber);
948 DPRINT1("Removable disk, using SIGNATURE ARC path '%S'\n", PathBuffer);
949#endif
950 }
951
952 if (!NT_SUCCESS(Status))
953 {
954 DPRINT1("RtlStringCchPrintfW() failed with status 0x%08lx\n", Status);
955 RtlFreeUnicodeString(&pSetupData->DestinationRootPath);
956 return Status;
957 }
958
959 Status = ConcatPaths(PathBuffer, ARRAYSIZE(PathBuffer), 1, InstallationDir);
960
961 if (!NT_SUCCESS(Status))
962 {
963 DPRINT1("ConcatPaths() failed with status 0x%08lx\n", Status);
964 RtlFreeUnicodeString(&pSetupData->DestinationRootPath);
965 return Status;
966 }
967
968 Status = RtlCreateUnicodeString(&pSetupData->DestinationArcPath, PathBuffer) ? STATUS_SUCCESS : STATUS_NO_MEMORY;
969
970 if (!NT_SUCCESS(Status))
971 {
972 DPRINT1("RtlCreateUnicodeString() failed with status 0x%08lx\n", Status);
973 RtlFreeUnicodeString(&pSetupData->DestinationRootPath);
974 return Status;
975 }
976
978 /* Create 'pSetupData->DestinationPath' string */
979 RtlFreeUnicodeString(&pSetupData->DestinationPath);
980 Status = CombinePaths(PathBuffer, ARRAYSIZE(PathBuffer), 2,
981 pSetupData->DestinationRootPath.Buffer, InstallationDir);
982
983 if (!NT_SUCCESS(Status))
984 {
985 DPRINT1("CombinePaths() failed with status 0x%08lx\n", Status);
986 RtlFreeUnicodeString(&pSetupData->DestinationArcPath);
987 RtlFreeUnicodeString(&pSetupData->DestinationRootPath);
988 return Status;
989 }
990
991 Status = RtlCreateUnicodeString(&pSetupData->DestinationPath, PathBuffer) ? STATUS_SUCCESS : STATUS_NO_MEMORY;
992
993 if (!NT_SUCCESS(Status))
994 {
995 DPRINT1("RtlCreateUnicodeString() failed with status 0x%08lx\n", Status);
996 RtlFreeUnicodeString(&pSetupData->DestinationArcPath);
997 RtlFreeUnicodeString(&pSetupData->DestinationRootPath);
998 return Status;
999 }
1000
1002 // FIXME: This is only temporary!! Must be removed later!
1003 Status = RtlCreateUnicodeString(&pSetupData->InstallPath, InstallationDir) ? STATUS_SUCCESS : STATUS_NO_MEMORY;
1004
1005 if (!NT_SUCCESS(Status))
1006 {
1007 DPRINT1("RtlCreateUnicodeString() failed with status 0x%08lx\n", Status);
1008 RtlFreeUnicodeString(&pSetupData->DestinationPath);
1009 RtlFreeUnicodeString(&pSetupData->DestinationArcPath);
1010 RtlFreeUnicodeString(&pSetupData->DestinationRootPath);
1011 return Status;
1012 }
1013
1014 return STATUS_SUCCESS;
1015}
#define DPRINT1
Definition: precomp.h:8
#define STATUS_NO_MEMORY
Definition: d3dkmdt.h:51
NTSTATUS ConcatPaths(IN OUT PWSTR PathBuffer, IN SIZE_T cchPathSize, IN ULONG NumberOfPathComponents, IN ...)
Definition: filesup.c:642
UNICODE_STRING Volume
Definition: fltkernel.h:1172
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define RTL_NUMBER_OF_FIELD(type, field)
Definition: ntbasedef.h:711
@ FixedMedia
Definition: ntdddisk.h:383
#define _countof(array)
Definition: sndvol32.h:70
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
BOOLEAN IsPartitioned
Definition: partlist.h:82
struct _DISKENTRY * DiskEntry
Definition: partlist.h:66
ULONG OnDiskPartitionNumber
Definition: partlist.h:74
ULONG PartitionNumber
Definition: partlist.h:75
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3275

Referenced by InstallDirectoryPage(), and PrepareAndDoCopyThread().

◆ InitializeSetup()

ERROR_NUMBER NTAPI InitializeSetup ( _Inout_ PUSETUP_DATA  pSetupData,
_In_opt_ PSETUP_ERROR_ROUTINE  ErrorRoutine,
_In_ PSPFILE_EXPORTS  pSpFileExports,
_In_ PSPINF_EXPORTS  pSpInfExports 
)

Definition at line 1020 of file setuplib.c.

1025{
1028
1030 RtlZeroMemory(pSetupData, sizeof(*pSetupData));
1031
1032 /* Initialize error handling */
1033 pSetupData->LastErrorNumber = ERROR_SUCCESS;
1034 pSetupData->ErrorRoutine = ErrorRoutine;
1035
1036 /* Initialize global unicode strings */
1037 RtlInitUnicodeString(&pSetupData->SourcePath, NULL);
1038 RtlInitUnicodeString(&pSetupData->SourceRootPath, NULL);
1039 RtlInitUnicodeString(&pSetupData->SourceRootDir, NULL);
1040 RtlInitUnicodeString(&pSetupData->DestinationArcPath, NULL);
1041 RtlInitUnicodeString(&pSetupData->DestinationPath, NULL);
1042 RtlInitUnicodeString(&pSetupData->DestinationRootPath, NULL);
1043 RtlInitUnicodeString(&pSetupData->SystemRootPath, NULL);
1044
1045 // FIXME: This is only temporary!! Must be removed later!
1046 /***/RtlInitUnicodeString(&pSetupData->InstallPath, NULL);/***/
1047
1048 /* Initialize SpFile and SpInf support */
1049 RtlCopyMemory(&SpFileExports, pSpFileExports, sizeof(SpFileExports));
1050 RtlCopyMemory(&SpInfExports, pSpInfExports, sizeof(SpInfExports));
1051
1052 //
1053 // TODO: Load and start SetupDD, and ask it for the information
1054 //
1055
1056 /* Get the source path and source root path */
1057 Status = GetSourcePaths(&pSetupData->SourcePath,
1058 &pSetupData->SourceRootPath,
1059 &pSetupData->SourceRootDir);
1060 if (!NT_SUCCESS(Status))
1061 {
1062 DPRINT1("GetSourcePaths() failed (Status 0x%08lx)\n", Status);
1063 return ERROR_NO_SOURCE_DRIVE;
1064 }
1065 DPRINT1("SourcePath (1): '%wZ'\n", &pSetupData->SourcePath);
1066 DPRINT1("SourceRootPath (1): '%wZ'\n", &pSetupData->SourceRootPath);
1067 DPRINT1("SourceRootDir (1): '%wZ'\n", &pSetupData->SourceRootDir);
1068
1069 /* Set up default values */
1070 pSetupData->DestinationDiskNumber = 0;
1071 pSetupData->DestinationPartitionNumber = 1;
1072 pSetupData->BootLoaderLocation = 2; // Default to "System partition"
1073 pSetupData->FormatPartition = 0;
1074 pSetupData->AutoPartition = 0;
1075 pSetupData->FsType = 0;
1076
1077 /* Load 'txtsetup.sif' from the installation media */
1078 Error = LoadSetupInf(pSetupData);
1079 if (Error != ERROR_SUCCESS)
1080 {
1081 DPRINT1("LoadSetupInf() failed (Error 0x%lx)\n", Error);
1082 return Error;
1083 }
1084 DPRINT1("SourcePath (2): '%wZ'\n", &pSetupData->SourcePath);
1085 DPRINT1("SourceRootPath (2): '%wZ'\n", &pSetupData->SourceRootPath);
1086 DPRINT1("SourceRootDir (2): '%wZ'\n", &pSetupData->SourceRootDir);
1087
1088 /* Retrieve the target machine architecture type */
1089 // FIXME: This should be determined at runtime!!
1090 // FIXME: Allow for (pre-)installing on an architecture
1091 // different from the current one?
1092#if defined(SARCH_XBOX)
1093 pSetupData->ArchType = ARCH_Xbox;
1094// #elif defined(SARCH_PC98)
1095#else // TODO: Arc, UEFI
1096 pSetupData->ArchType = (IsNEC_98 ? ARCH_NEC98x86 : ARCH_PcAT);
1097#endif
1098
1099 return ERROR_SUCCESS;
1100}
BOOL Error
Definition: chkdsk.c:66
#define ERROR_SUCCESS
Definition: deptool.c:10
enum _ERROR_NUMBER ERROR_NUMBER
@ ERROR_NO_SOURCE_DRIVE
Definition: errorcode.h:23
SPFILE_EXPORTS SpFileExports
Definition: fileqsup.c:23
SPINF_EXPORTS SpInfExports
Definition: infsupp.c:24
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
ERROR_NUMBER LoadSetupInf(IN OUT PUSETUP_DATA pSetupData)
Definition: setuplib.c:563
NTSTATUS GetSourcePaths(_Out_ PUNICODE_STRING SourcePath, _Out_ PUNICODE_STRING SourceRootPath, _Out_ PUNICODE_STRING SourceRootDir)
Determine the installation source path and isolate its useful path components (root path and source s...
Definition: setuplib.c:408
@ ARCH_NEC98x86
Definition: setuplib.h:55
@ ARCH_PcAT
Definition: setuplib.h:54
@ ARCH_Xbox
Definition: setuplib.h:56
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define IsNEC_98
Definition: ketypes.h:911

Referenced by _tWinMain(), and SetupStartPage().

◆ InitSystemPartition()

BOOLEAN NTAPI 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 at line 679 of file setuplib.c.

685{
688 PPARTENTRY OldActivePart;
689
690 /*
691 * If we install on a fixed disk, try to find a supported system
692 * partition on the system. Otherwise if we install on a removable disk
693 * use the install partition as the system partition.
694 */
695 if (InstallPartition->DiskEntry->MediaType == FixedMedia)
696 {
698 FALSE,
701 /* Use the original system partition as the old active partition hint */
702 OldActivePart = PartitionList->SystemPartition;
703
706 {
707 DPRINT1("We are using a different system partition!!\n");
708
712 0);
713 if (Result != FSVOL_DOIT)
714 return FALSE;
715 }
716 }
717 else // if (InstallPartition->DiskEntry->MediaType == RemovableMedia)
718 {
720 /* Don't specify any old active partition hint */
721 OldActivePart = NULL;
722 }
723
724 if (!SystemPartition)
725 {
729 0);
730 return FALSE;
731 }
732
733 *pSystemPartition = SystemPartition;
734
735 /*
736 * If the system partition can be created in some
737 * non-partitioned space, create it now.
738 */
740 {
741 /* Automatically create the partition; it will be
742 * formatted later with default parameters */
743 // FIXME: Don't use the whole empty space, but a minimal size
744 // specified from the TXTSETUP.SIF or unattended setup.
747 0ULL,
748 0);
750 }
751
752 /* Set it as such */
754 {
755 DPRINT1("SetActivePartition(0x%p) failed?!\n", SystemPartition);
756 ASSERT(FALSE);
757 }
758
759 /*
760 * In all cases, whether or not we are going to perform a formatting,
761 * we must perform a filesystem check of the system partition.
762 */
765
766 return TRUE;
767}
static FSVOL_OP CALLBACK FsVolCallback(_In_opt_ PVOID Context, _In_ FSVOLNOTIFY FormatStatus, _In_ ULONG_PTR Param1, _In_ ULONG_PTR Param2)
Definition: reactos.c:1292
PPARTENTRY InstallPartition
Definition: reactos.c:45
PPARTENTRY SystemPartition
Definition: reactos.c:50
#define ULL(a, b)
Definition: format_msg.c:27
@ FSVOLNOTIFY_PARTITIONERROR
Definition: fsutil.h:149
@ ChangeSystemPartition
Definition: fsutil.h:156
enum _FSVOL_OP FSVOL_OP
@ FSVOL_DOIT
Definition: fsutil.h:166
BOOLEAN NTAPI CreatePartition(_In_ PPARTLIST List, _Inout_ PPARTENTRY PartEntry, _In_opt_ ULONGLONG SizeBytes, _In_opt_ ULONG_PTR PartitionInfo)
Definition: partlist.c:2910
BOOLEAN SetActivePartition(IN PPARTLIST List, IN PPARTENTRY PartEntry, IN PPARTENTRY OldActivePart OPTIONAL)
Definition: partlist.c:3526
PPARTENTRY FindSupportedSystemPartition(IN PPARTLIST List, IN BOOLEAN ForceSelect, IN PDISKENTRY AlternativeDisk OPTIONAL, IN PPARTENTRY AlternativePart OPTIONAL)
Definition: partlist.c:3226
#define ERROR_SYSTEM_PARTITION_NOT_FOUND
Definition: setuplib.h:188
PVOLENTRY Volume
Definition: partlist.h:95
PPARTENTRY SystemPartition
Definition: partlist.h:181
BOOLEAN NeedsCheck
Definition: partlist.h:51
static PPARTLIST PartitionList
Definition: usetup.c:75
_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

Referenced by PrepareAndDoCopyThread(), and StartPartitionOperationsPage().

◆ InstallSetupInfFile()

VOID NTAPI InstallSetupInfFile ( IN OUT PUSETUP_DATA  pSetupData)

Definition at line 208 of file setuplib.c.

210{
212 PINICACHE IniCache;
213
214#if 0 // HACK FIXME!
215 PINICACHE UnattendCache;
217#else
218 // WCHAR CrLf[] = {L'\r', L'\n'};
219 CHAR CrLf[] = {'\r', '\n'};
220 HANDLE FileHandle, UnattendFileHandle, SectionHandle;
223 PVOID ViewBase;
227#endif
228
229 PINI_SECTION IniSection;
230 WCHAR PathBuffer[MAX_PATH];
231 WCHAR UnattendInfPath[MAX_PATH];
232
233 /* Create a $winnt$.inf file with default entries */
234 IniCache = IniCacheCreate();
235 if (!IniCache)
236 return;
237
238 IniSection = IniAddSection(IniCache, L"SetupParams");
239 if (IniSection)
240 {
241 /* Key "skipmissingfiles" */
242 // RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
243 // L"\"%s\"", L"WinNt5.2");
244 // IniAddKey(IniSection, L"Version", PathBuffer);
245 }
246
247 IniSection = IniAddSection(IniCache, L"Data");
248 if (IniSection)
249 {
250 RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
251 L"\"%s\"", IsUnattendedSetup ? L"yes" : L"no");
252 IniAddKey(IniSection, L"UnattendedInstall", PathBuffer);
253
254 // "floppylessbootpath" (yes/no)
255
256 RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
257 L"\"%s\"", L"winnt");
258 IniAddKey(IniSection, L"ProductType", PathBuffer);
259
260 RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
261 L"\"%s\\\"", pSetupData->SourceRootPath.Buffer);
262 IniAddKey(IniSection, L"SourcePath", PathBuffer);
263
264 // "floppyless" ("0")
265 }
266
267#if 0
268
269 /* TODO: Append the standard unattend.inf file */
270 CombinePaths(UnattendInfPath, ARRAYSIZE(UnattendInfPath), 2,
271 pSetupData->SourcePath.Buffer, L"unattend.inf");
272 if (DoesFileExist(NULL, UnattendInfPath) == FALSE)
273 {
274 DPRINT("Does not exist: %S\n", UnattendInfPath);
275 goto Quit;
276 }
277
278 Status = IniCacheLoad(&UnattendCache, UnattendInfPath, FALSE);
279 if (!NT_SUCCESS(Status))
280 {
281 DPRINT1("Cannot load %S as an INI file!\n", UnattendInfPath);
282 goto Quit;
283 }
284
285 IniCacheDestroy(UnattendCache);
286
287Quit:
288 CombinePaths(PathBuffer, ARRAYSIZE(PathBuffer), 2,
289 pSetupData->DestinationPath.Buffer, L"System32\\$winnt$.inf");
290 IniCacheSave(IniCache, PathBuffer);
291 IniCacheDestroy(IniCache);
292
293#else
294
295 CombinePaths(PathBuffer, ARRAYSIZE(PathBuffer), 2,
296 pSetupData->DestinationPath.Buffer, L"System32\\$winnt$.inf");
297 IniCacheSave(IniCache, PathBuffer);
298 IniCacheDestroy(IniCache);
299
300 /* TODO: Append the standard unattend.inf file */
301 CombinePaths(UnattendInfPath, ARRAYSIZE(UnattendInfPath), 2,
302 pSetupData->SourcePath.Buffer, L"unattend.inf");
303 if (DoesFileExist(NULL, UnattendInfPath) == FALSE)
304 {
305 DPRINT("Does not exist: %S\n", UnattendInfPath);
306 return;
307 }
308
309 RtlInitUnicodeString(&FileName, PathBuffer);
311 &FileName,
313 NULL,
314 NULL);
321 if (!NT_SUCCESS(Status))
322 {
323 DPRINT1("Cannot load %S as an INI file!\n", PathBuffer);
324 return;
325 }
326
327 /* Query the file size */
330 &FileInfo,
331 sizeof(FileInfo),
333 if (!NT_SUCCESS(Status))
334 {
335 DPRINT("NtQueryInformationFile() failed (Status %lx)\n", Status);
336 FileInfo.EndOfFile.QuadPart = 0ULL;
337 }
338
340 UnattendInfPath,
341 &UnattendFileHandle,
342 &FileSize,
343 &SectionHandle,
344 &ViewBase,
345 FALSE);
346 if (!NT_SUCCESS(Status))
347 {
348 DPRINT1("Cannot load %S !\n", UnattendInfPath);
350 return;
351 }
352
353 /* Write to the INI file */
354
355 /* "\r\n" */
357 NULL,
358 NULL,
359 NULL,
361 (PVOID)CrLf,
362 sizeof(CrLf),
363 &FileInfo.EndOfFile,
364 NULL);
365
367 NULL,
368 NULL,
369 NULL,
371 ViewBase,
372 FileSize,
373 NULL,
374 NULL);
375 if (!NT_SUCCESS(Status))
376 {
377 DPRINT("NtWriteFile() failed (Status %lx)\n", Status);
378 }
379
380 /* Finally, unmap and close the file */
381 UnMapAndCloseFile(UnattendFileHandle, SectionHandle, ViewBase);
382
384#endif
385}
#define FILE_NON_DIRECTORY_FILE
Definition: constants.h:492
struct _FileName FileName
Definition: fatprocs.h:897
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:879
#define UnMapAndCloseFile(FileHandle, SectionHandle, BaseAddress)
Definition: filesup.h:121
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE FileHandle
Definition: fltkernel.h:1231
_Must_inspect_result_ _Out_ PLARGE_INTEGER FileSize
Definition: fsrtlfuncs.h:108
#define OBJ_OPENIF
Definition: winternl.h:229
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
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 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
#define FileStandardInformation
Definition: propsheet.cpp:61
_In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR Iterator
Definition: wdfchildlist.h:656
char CHAR
Definition: xmlstorage.h:175

Referenced by FileCopyPage(), and PrepareAndDoCopyThread().

◆ IsValidInstallDirectory()

BOOLEAN NTAPI IsValidInstallDirectory ( _In_ PCWSTR  InstallDir)

Verify whether the given directory is suitable for ReactOS installation. Each path component must be a valid 8.3 name.

Definition at line 779 of file setuplib.c.

781{
782 PCWCH p;
783
784 /* As with the NT installer, fail if the path is empty or "\\" */
785 p = InstallDir;
786 if (!*p || (IS_PATH_SEPARATOR(*p) && !*(p + 1)))
787 return FALSE;
788
789 /* The path must contain only valid characters */
790 for (p = InstallDir; *p; ++p)
791 {
793 return FALSE;
794 }
795
796 /*
797 * Loop over each path component and verify that each is a valid 8.3 name.
798 */
799 for (p = InstallDir; *p;)
800 {
801 PCWSTR Path;
804 BOOLEAN IsNameLegal, SpacesInName;
805
806 /* Skip any first separator */
807 if (IS_PATH_SEPARATOR(*p))
808 ++p;
809
810 /* Now skip past the path component until we reach the next separator */
811 Path = p;
812 while (*p && !IS_PATH_SEPARATOR(*p))
813 ++p;
814 if (p == Path)
815 {
816 /* Succeed if nothing else follows this separator; otherwise
817 * it's a separator and consecutive ones are not supported */
818 return (!*p);
819 }
820
821 /* Calculate the path component length */
822 Length = p - Path;
823
824 /* As with the NT installer, fail for '.' and '..';
825 * RtlIsNameLegalDOS8Dot3() would succeed otherwise */
826 if ((Length == 1 && *Path == '.') || (Length == 2 && *Path == '.' && *(Path + 1) == '.'))
827 return FALSE;
828
829 /* As with the NT installer, allow _only ONE trailing_ dot in
830 * the path component (but not 2 or more), by reducing Length
831 * in that case; RtlIsNameLegalDOS8Dot3() would fail otherwise */
832 if (Length > 1 && *(p - 2) != L'.' && *(p - 1) == L'.')
833 --Length;
834
835 if (Length == 0)
836 return FALSE;
837
838 /* Verify that the path component is a valid 8.3 name */
839 // if (Length > 8+1+3)
840 // return FALSE;
841 Name.Length = Name.MaximumLength = (USHORT)(Length * sizeof(WCHAR));
842 Name.Buffer = (PWCHAR)Path;
843 SpacesInName = FALSE;
844 IsNameLegal = RtlIsNameLegalDOS8Dot3(&Name, NULL, &SpacesInName);
845
846 /* If it isn't legal or contain spaces, fail */
847 if (!IsNameLegal || SpacesInName)
848 {
849 DPRINT("'%wZ' is %s 8.3 filename %s spaces\n",
850 &Name,
851 (IsNameLegal ? "a valid" : "an invalid"),
852 (SpacesInName ? "with" : "without"));
853 return FALSE;
854 }
855 /* Go to the next path component */
856 }
857
858 return TRUE;
859}
unsigned char BOOLEAN
PRTL_UNICODE_STRING_BUFFER Path
struct NameRec_ * Name
Definition: cdprocs.h:460
GLfloat GLfloat p
Definition: glext.h:8902
BOOLEAN NTAPI RtlIsNameLegalDOS8Dot3(_In_ PUNICODE_STRING Name, _Inout_opt_ POEM_STRING OemName, _Inout_opt_ PBOOLEAN NameContainsSpaces)
CONST WCHAR * PCWCH
Definition: ntbasedef.h:419
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
unsigned short USHORT
Definition: pedump.c:61
#define IS_PATH_SEPARATOR(c)
Definition: setuplib.c:770
#define IS_VALID_INSTALL_PATH_CHAR(c)
Defines the class of characters valid for the installation directory.
Definition: setuplib.h:206
ULONG_PTR SIZE_T
Definition: typedefs.h:80

Referenced by InstallDirectoryPage(), MoreOptDlgProc(), and START_TEST().

◆ LdrDisableThreadCalloutsForDll()

NTSTATUS NTAPI LdrDisableThreadCalloutsForDll ( _In_ PVOID  BaseAddress)

Definition at line 1154 of file ldrapi.c.

1156{
1157 PLDR_DATA_TABLE_ENTRY LdrEntry;
1159 BOOLEAN LockHeld;
1161 DPRINT("LdrDisableThreadCalloutsForDll (BaseAddress %p)\n", BaseAddress);
1162
1163 /* Don't do it during shutdown */
1165
1166 /* Check if we should grab the lock */
1167 LockHeld = FALSE;
1168 if (!LdrpInLdrInit)
1169 {
1170 /* Grab the lock */
1172 if (!NT_SUCCESS(Status)) return Status;
1173 LockHeld = TRUE;
1174 }
1175
1176 /* Make sure the DLL is valid and get its entry */
1179 {
1180 /* Get if it has a TLS slot */
1181 if (!LdrEntry->TlsIndex)
1182 {
1183 /* It doesn't, so you're allowed to call this */
1184 LdrEntry->Flags |= LDRP_DONT_CALL_FOR_THREADS;
1186 }
1187 }
1188
1189 /* Check if the lock was held */
1190 if (LockHeld)
1191 {
1192 /* Release it */
1194 }
1195
1196 /* Return the status */
1197 return Status;
1198}
NTSTATUS NTAPI LdrUnlockLoaderLock(_In_ ULONG Flags, _In_opt_ ULONG_PTR Cookie)
Definition: ldrapi.c:101
NTSTATUS NTAPI LdrLockLoaderLock(_In_ ULONG Flags, _Out_opt_ PULONG Disposition, _Out_opt_ PULONG_PTR Cookie)
Definition: ldrapi.c:174
#define LDRP_DONT_CALL_FOR_THREADS
Definition: ldrtypes.h:52
#define LDR_UNLOCK_LOADER_LOCK_FLAG_RAISE_ON_ERRORS
Definition: ldrtypes.h:86
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
BOOLEAN LdrpInLdrInit
Definition: ldrinit.c:30
BOOLEAN LdrpShutdownInProgress
Definition: ldrinit.c:34
BOOLEAN NTAPI LdrpCheckForLoadedDllHandle(IN PVOID Base, OUT PLDR_DATA_TABLE_ENTRY *LdrEntry)
Definition: ldrutils.c:1600
#define STATUS_DLL_NOT_FOUND
Definition: ntstatus.h:545
Definition: btrfs_drv.h:1876
USHORT TlsIndex
Definition: ntddk_ex.h:209
ULONG Flags
Definition: ntddk_ex.h:207
_In_opt_ PVOID _Out_ PLARGE_INTEGER Cookie
Definition: cmfuncs.h:14

Referenced by DisableThreadLibraryCalls(), and DllMain().

◆ LoadSetupInf()

ERROR_NUMBER LoadSetupInf ( IN OUT PUSETUP_DATA  pSetupData)

Definition at line 563 of file setuplib.c.

565{
567 UINT ErrorLine;
568 INT IntValue;
571
573 pSetupData->SourcePath.Buffer, L"txtsetup.sif");
574
575 DPRINT("SetupInf path: '%S'\n", FileNameBuffer);
576
577 pSetupData->SetupInf =
579 NULL,
581 pSetupData->LanguageId,
582 &ErrorLine);
583 if (pSetupData->SetupInf == INVALID_HANDLE_VALUE)
585
586 /* Open 'Version' section */
587 if (!SpInfFindFirstLine(pSetupData->SetupInf, L"Version", L"Signature", &Context))
589
590 /* Get pointer 'Signature' key */
591 if (!INF_GetData(&Context, NULL, &Value))
593
594 /* Check 'Signature' string */
595 if (_wcsicmp(Value, L"$ReactOS$") != 0 &&
596 _wcsicmp(Value, L"$Windows NT$") != 0)
597 {
600 }
601
603
604 /* Open 'DiskSpaceRequirements' section */
605 if (!SpInfFindFirstLine(pSetupData->SetupInf, L"DiskSpaceRequirements", L"FreeSysPartDiskSpace", &Context))
607
608 pSetupData->RequiredPartitionDiskSpace = ~0;
609
610 /* Get the 'FreeSysPartDiskSpace' value */
611 if (!SpInfGetIntField(&Context, 1, &IntValue))
613
614 pSetupData->RequiredPartitionDiskSpace = (ULONG)IntValue;
615
616 //
617 // Support "SetupSourceDevice" and "SetupSourcePath" in txtsetup.sif
618 // See CORE-9023
619 // Support for that should also be added in setupldr.
620 //
621
622 /* Update the Setup Source paths */
623 if (SpInfFindFirstLine(pSetupData->SetupInf, L"SetupData", L"SetupSourceDevice", &Context))
624 {
625 /*
626 * Get optional pointer 'SetupSourceDevice' key, its presence
627 * will dictate whether we also need 'SetupSourcePath'.
628 */
629 if (INF_GetData(&Context, NULL, &Value))
630 {
631 /* Free the old source root path string and create the new one */
632 RtlFreeUnicodeString(&pSetupData->SourceRootPath);
633 RtlCreateUnicodeString(&pSetupData->SourceRootPath, Value);
635
636 if (!SpInfFindFirstLine(pSetupData->SetupInf, L"SetupData", L"SetupSourcePath", &Context))
637 {
638 /* The 'SetupSourcePath' value is mandatory! */
640 }
641
642 /* Get pointer 'SetupSourcePath' key */
643 if (!INF_GetData(&Context, NULL, &Value))
644 {
645 /* The 'SetupSourcePath' value is mandatory! */
647 }
648
649 /* Free the old source path string and create the new one */
650 RtlFreeUnicodeString(&pSetupData->SourceRootDir);
651 RtlCreateUnicodeString(&pSetupData->SourceRootDir, Value);
653 }
654 }
655
656 /* Search for 'DefaultPath' in the 'SetupData' section */
657 pSetupData->InstallationDirectory[0] = 0;
658 if (SpInfFindFirstLine(pSetupData->SetupInf, L"SetupData", L"DefaultPath", &Context))
659 {
660 /* Get pointer 'DefaultPath' key */
661 if (!INF_GetData(&Context, NULL, &Value))
663
664 RtlStringCchCopyW(pSetupData->InstallationDirectory,
665 ARRAYSIZE(pSetupData->InstallationDirectory),
666 Value);
667
669 }
670
671 return ERROR_SUCCESS;
672}
WCHAR FileNameBuffer[MAX_PATH]
Definition: framewnd.c:225
@ ERROR_SIGNATURE_TXTSETUPSIF
Definition: errorcode.h:26
@ ERROR_CORRUPT_TXTSETUPSIF
Definition: errorcode.h:25
@ ERROR_LOAD_TXTSETUPSIF
Definition: errorcode.h:24
#define INF_STYLE_WIN4
Definition: infsupp.h:43

Referenced by InitializeSetup().

◆ UpdateRegistry()

ERROR_NUMBER NTAPI 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 at line 1155 of file setuplib.c.

1163{
1164 ERROR_NUMBER ErrorNumber;
1166 INFCONTEXT InfContext;
1167 PCWSTR Action;
1168 PCWSTR File;
1169 PCWSTR Section;
1171 BOOLEAN ShouldRepairRegistry = FALSE;
1173
1174 if (RepairUpdateFlag)
1175 {
1176 DPRINT1("TODO: Updating / repairing the registry is not completely implemented yet!\n");
1177
1178 /* Verify the registry hives and check whether we need to update or repair any of them */
1179 Status = VerifyRegistryHives(&pSetupData->DestinationPath, &ShouldRepairRegistry);
1180 if (!NT_SUCCESS(Status))
1181 {
1182 DPRINT1("VerifyRegistryHives failed, Status 0x%08lx\n", Status);
1183 ShouldRepairRegistry = FALSE;
1184 }
1185 if (!ShouldRepairRegistry)
1186 DPRINT1("No need to repair the registry\n");
1187 }
1188
1189DoUpdate:
1190 ErrorNumber = ERROR_SUCCESS;
1191
1192 /* Update the registry */
1194
1195 /* Initialize the registry and setup the registry hives */
1196 Status = RegInitializeRegistry(&pSetupData->DestinationPath);
1197 if (!NT_SUCCESS(Status))
1198 {
1199 DPRINT1("RegInitializeRegistry() failed\n");
1200 /********** HACK!!!!!!!!!!! **********/
1202 {
1203 /* The hack was called, return its corresponding error */
1205 }
1206 else
1207 /*************************************/
1208 {
1209 /* Something else failed */
1210 return ERROR_CREATE_HIVE;
1211 }
1212 }
1213
1214 if (!RepairUpdateFlag || ShouldRepairRegistry)
1215 {
1216 /*
1217 * We fully setup the hives, in case we are doing a fresh installation
1218 * (RepairUpdateFlag == FALSE), or in case we are doing an update
1219 * (RepairUpdateFlag == TRUE) BUT we have some registry hives to
1220 * "repair" (aka. recreate: ShouldRepairRegistry == TRUE).
1221 */
1222
1223 Success = SpInfFindFirstLine(pSetupData->SetupInf, L"HiveInfs.Fresh", NULL, &InfContext); // Windows-compatible
1224 if (!Success)
1225 Success = SpInfFindFirstLine(pSetupData->SetupInf, L"HiveInfs.Install", NULL, &InfContext); // ReactOS-specific
1226
1227 if (!Success)
1228 {
1229 DPRINT1("SpInfFindFirstLine() failed\n");
1230 ErrorNumber = ERROR_FIND_REGISTRY;
1231 goto Cleanup;
1232 }
1233 }
1234 else // if (RepairUpdateFlag && !ShouldRepairRegistry)
1235 {
1236 /*
1237 * In case we are doing an update (RepairUpdateFlag == TRUE) and
1238 * NO registry hives need a repair (ShouldRepairRegistry == FALSE),
1239 * we only update the hives.
1240 */
1241
1242 Success = SpInfFindFirstLine(pSetupData->SetupInf, L"HiveInfs.Upgrade", NULL, &InfContext);
1243 if (!Success)
1244 {
1245 /* Nothing to do for update! */
1246 DPRINT1("No update needed for the registry!\n");
1247 goto Cleanup;
1248 }
1249 }
1250
1251 do
1252 {
1253 INF_GetDataField(&InfContext, 0, &Action);
1254 INF_GetDataField(&InfContext, 1, &File);
1255 INF_GetDataField(&InfContext, 2, &Section);
1256
1257 DPRINT("Action: %S File: %S Section %S\n", Action, File, Section);
1258
1259 if (Action == NULL)
1260 {
1263 INF_FreeData(Section);
1264 break; // Hackfix
1265 }
1266
1267 if (!_wcsicmp(Action, L"AddReg"))
1268 Delete = FALSE;
1269 else if (!_wcsicmp(Action, L"DelReg"))
1270 Delete = TRUE;
1271 else
1272 {
1273 DPRINT1("Unrecognized registry INF action '%S'\n", Action);
1276 INF_FreeData(Section);
1277 continue;
1278 }
1279
1281
1283
1284 if (!ImportRegistryFile(pSetupData->SourcePath.Buffer,
1285 File, Section,
1286 pSetupData->LanguageId, Delete))
1287 {
1288 DPRINT1("Importing %S failed\n", File);
1290 INF_FreeData(Section);
1291 ErrorNumber = ERROR_IMPORT_HIVE;
1292 goto Cleanup;
1293 }
1294 } while (SpInfFindNextLine(&InfContext, &InfContext));
1295
1296 if (!RepairUpdateFlag || ShouldRepairRegistry)
1297 {
1298 /* See the explanation for this test above */
1299
1301 PCWSTR LanguageId; // LocaleID;
1302
1303 Entry = GetCurrentListEntry(pSetupData->DisplayList);
1304 ASSERT(Entry);
1305 pSetupData->DisplayType = ((PGENENTRY)GetListEntryData(Entry))->Id;
1306 ASSERT(pSetupData->DisplayType);
1307
1308 /* Update display registry settings */
1310 if (!ProcessDisplayRegistry(pSetupData->SetupInf, pSetupData->DisplayType))
1311 {
1312 ErrorNumber = ERROR_UPDATE_DISPLAY_SETTINGS;
1313 goto Cleanup;
1314 }
1315
1316 Entry = GetCurrentListEntry(pSetupData->LanguageList);
1317 ASSERT(Entry);
1318 LanguageId = ((PGENENTRY)GetListEntryData(Entry))->Id;
1319 ASSERT(LanguageId);
1320
1321 /* Set the locale */
1323 if (!ProcessLocaleRegistry(/*pSetupData->*/LanguageId))
1324 {
1325 ErrorNumber = ERROR_UPDATE_LOCALESETTINGS;
1326 goto Cleanup;
1327 }
1328
1329 /* Add the keyboard layouts for the given language (without user override) */
1332 {
1333 ErrorNumber = ERROR_ADDING_KBLAYOUTS;
1334 goto Cleanup;
1335 }
1336
1337 if (!IsUnattendedSetup)
1338 {
1339 Entry = GetCurrentListEntry(pSetupData->LayoutList);
1340 ASSERT(Entry);
1341 pSetupData->LayoutId = ((PGENENTRY)GetListEntryData(Entry))->Id;
1342 ASSERT(pSetupData->LayoutId);
1343
1344 /* Update keyboard layout settings with user-overridden values */
1345 // FIXME: Wouldn't it be better to do it all at once
1346 // with the AddKeyboardLayouts() step?
1348 if (!ProcessKeyboardLayoutRegistry(pSetupData->LayoutId, SelectedLanguageId))
1349 {
1350 ErrorNumber = ERROR_UPDATE_KBSETTINGS;
1351 goto Cleanup;
1352 }
1353 }
1354
1355 /* Set GeoID */
1357 {
1358 ErrorNumber = ERROR_UPDATE_GEOID;
1359 goto Cleanup;
1360 }
1361
1362 /* Add codepage information to registry */
1365 {
1366 ErrorNumber = ERROR_ADDING_CODEPAGE;
1367 goto Cleanup;
1368 }
1369
1370 /* Set the default pagefile entry */
1371 SetDefaultPagefile(DestinationDriveLetter);
1372
1373 /* Update the mounted devices list */
1374 // FIXME: This should technically be done by mountmgr (if AutoMount is enabled)!
1376 }
1377
1378#ifdef __REACTOS__
1379 if (SubstSettings)
1380 {
1381 /* HACK */
1382 DoRegistryFontFixup(SubstSettings, wcstoul(SelectedLanguageId, NULL, 16));
1383 }
1384#endif
1385
1386Cleanup:
1387 //
1388 // TODO: Unload all the registry stuff, perform cleanup,
1389 // and copy the created hive files into .sav files.
1390 //
1391 RegCleanupRegistry(&pSetupData->DestinationPath);
1392
1393 /*
1394 * Check whether we were in update/repair mode but we were actually
1395 * repairing the registry hives. If so, we have finished repairing them,
1396 * and we now reset the flag and run the proper registry update.
1397 * Otherwise we have finished the registry update!
1398 */
1399 if (RepairUpdateFlag && ShouldRepairRegistry)
1400 {
1401 ShouldRepairRegistry = FALSE;
1402 goto DoUpdate;
1403 }
1404
1405 return ErrorNumber;
1406}
static BOOL ImportRegistryFile(HWND hWnd)
Definition: framewnd.c:439
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
Definition: File.h:16
#define STATUS_NOT_IMPLEMENTED
Definition: d3dkmdt.h:42
static const WCHAR Cleanup[]
Definition: register.c:80
@ ERROR_ADDING_CODEPAGE
Definition: errorcode.h:52
@ ERROR_UPDATE_GEOID
Definition: errorcode.h:55
@ 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_UPDATE_DISPLAY_SETTINGS
Definition: errorcode.h:38
@ ERROR_UPDATE_KBSETTINGS
Definition: errorcode.h:37
@ Success
Definition: eventcreate.c:712
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define SpInfFindNextLine
Definition: infsupp.h:141
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:29
PGENERIC_LIST_ENTRY NTAPI GetCurrentListEntry(IN PGENERIC_LIST List)
Definition: genlist.c:102
PVOID NTAPI GetListEntryData(IN PGENERIC_LIST_ENTRY Entry)
Definition: genlist.c:134
static const char const char const char PIMAGEHLP_STATUS_ROUTINE StatusRoutine
Definition: image.c:35
BOOLEAN SetMountedDeviceValues(_In_ PPARTLIST List)
Definition: partlist.c:3875
@ KeybLayouts
Definition: setuplib.h:243
@ DisplaySettingsUpdate
Definition: setuplib.h:241
@ CodePageInfoUpdate
Definition: setuplib.h:245
@ LocaleSettingsUpdate
Definition: setuplib.h:242
@ RegHiveUpdate
Definition: setuplib.h:239
@ ImportRegHive
Definition: setuplib.h:240
@ KeybSettingsUpdate
Definition: setuplib.h:244
base of all file and directory entries
Definition: entries.h:83
Definition: genlist.h:11
BOOL DoRegistryFontFixup(PFONTSUBSTSETTINGS pSettings, LANGID LangID)
static BOOLEAN RepairUpdateFlag
Definition: usetup.c:72
PCWSTR SelectedLanguageId
Definition: usetup.c:68
_In_ WDFIOTARGET _In_ _Strict_type_match_ WDF_IO_TARGET_SENT_IO_ACTION Action
Definition: wdfiotarget.h:510

Referenced by PrepareAndDoCopyThread(), and RegistryPage().

Variable Documentation

◆ IsUnattendedSetup

◆ ProcessHeap

HANDLE ProcessHeap
  • Internal Headers *‍/

Definition at line 25 of file setuplib.c.

Referenced by DllMain().