ReactOS 0.4.17-dev-484-g30b02d0
setuplib.h File Reference
#include "errorcode.h"
#include "spapisup/fileqsup.h"
#include "spapisup/infsupp.h"
#include "utils/linklist.h"
#include "utils/ntverrsrc.h"
#include "utils/bldrsup.h"
#include "utils/filesup.h"
#include "utils/fsrec.h"
#include "utils/genlist.h"
#include "utils/inicache.h"
#include "utils/partinfo.h"
#include "utils/partlist.h"
#include "utils/arcname.h"
#include "utils/osdetect.h"
#include "utils/regutil.h"
#include "bootcode.h"
#include "fsutil.h"
#include "bootsup.h"
#include "registry.h"
#include "mui.h"
#include "settings.h"
#include "install.h"
#include "substset.h"
Include dependency graph for setuplib.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _USETUP_DATA
 

Macros

#define SPLIBAPI   DECLSPEC_IMPORT
 
#define KB   ((ULONGLONG)1024)
 
#define MB   (KB*KB)
 
#define GB   (KB*KB*KB)
 
#define ERROR_SYSTEM_PARTITION_NOT_FOUND   (ERROR_LAST_ERROR_CODE + 1)
 
#define IS_VALID_INSTALL_PATH_CHAR(c)    (isalnum(c) || (c) == L'.' || (c) == L'\\' || (c) == L'-' || (c) == L'_')
 Defines the class of characters valid for the installation directory.
 

Typedefs

typedef enum _ARCHITECTURE_TYPE ARCHITECTURE_TYPE
 
typedef VOID(__cdeclPSETUP_ERROR_ROUTINE) (IN struct _USETUP_DATA *,...)
 
typedef struct _USETUP_DATA USETUP_DATA
 
typedef struct _USETUP_DATAPUSETUP_DATA
 
typedef enum _REGISTRY_STATUS REGISTRY_STATUS
 
typedef VOID(__cdeclPREGISTRY_STATUS_ROUTINE) (IN REGISTRY_STATUS,...)
 

Enumerations

enum  _ARCHITECTURE_TYPE {
  ARCH_PcAT , ARCH_NEC98x86 , ARCH_Xbox , ARCH_Arc ,
  ARCH_Efi
}
 
enum  _REGISTRY_STATUS {
  Success = 0 , RegHiveUpdate , ImportRegHive , DisplaySettingsUpdate ,
  LocaleSettingsUpdate , KeybLayouts , KeybSettingsUpdate , CodePageInfoUpdate
}
 

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)
 

Macro Definition Documentation

◆ ERROR_SYSTEM_PARTITION_NOT_FOUND

#define ERROR_SYSTEM_PARTITION_NOT_FOUND   (ERROR_LAST_ERROR_CODE + 1)

Definition at line 188 of file setuplib.h.

◆ GB

#define GB   (KB*KB*KB)

Definition at line 76 of file setuplib.h.

◆ IS_VALID_INSTALL_PATH_CHAR

#define IS_VALID_INSTALL_PATH_CHAR (   c)     (isalnum(c) || (c) == L'.' || (c) == L'\\' || (c) == L'-' || (c) == L'_')

Defines the class of characters valid for the installation directory.

The valid characters are: ASCII alphanumericals (a-z, A-Z, 0-9), and: '.', '\', '-', '_' . Spaces are not allowed.

Definition at line 206 of file setuplib.h.

◆ KB

#define KB   ((ULONGLONG)1024)

Definition at line 74 of file setuplib.h.

◆ MB

#define MB   (KB*KB)

Definition at line 75 of file setuplib.h.

◆ SPLIBAPI

#define SPLIBAPI   DECLSPEC_IMPORT

Definition at line 15 of file setuplib.h.

Typedef Documentation

◆ ARCHITECTURE_TYPE

◆ PREGISTRY_STATUS_ROUTINE

typedef VOID(__cdecl * PREGISTRY_STATUS_ROUTINE) (IN REGISTRY_STATUS,...)

Definition at line 248 of file setuplib.h.

◆ PSETUP_ERROR_ROUTINE

typedef VOID(__cdecl * PSETUP_ERROR_ROUTINE) (IN struct _USETUP_DATA *,...)

Definition at line 85 of file setuplib.h.

◆ PUSETUP_DATA

◆ REGISTRY_STATUS

◆ USETUP_DATA

Enumeration Type Documentation

◆ _ARCHITECTURE_TYPE

Enumerator
ARCH_PcAT 
ARCH_NEC98x86 
ARCH_Xbox 
ARCH_Arc 
ARCH_Efi 

Definition at line 52 of file setuplib.h.

53{
54 ARCH_PcAT, //< Standard BIOS-based PC-AT
55 ARCH_NEC98x86, //< NEC PC-98
56 ARCH_Xbox, //< Original Xbox
57 ARCH_Arc, //< ARC-based (MIPS, SGI)
58 ARCH_Efi, //< EFI and UEFI
59// Place other architectures supported by the Setup below.
@ ARCH_Arc
Definition: setuplib.h:57
@ ARCH_NEC98x86
Definition: setuplib.h:55
@ ARCH_PcAT
Definition: setuplib.h:54
@ ARCH_Xbox
Definition: setuplib.h:56
@ ARCH_Efi
Definition: setuplib.h:58
enum _ARCHITECTURE_TYPE ARCHITECTURE_TYPE

◆ _REGISTRY_STATUS

Enumerator
Success 
RegHiveUpdate 
ImportRegHive 
DisplaySettingsUpdate 
LocaleSettingsUpdate 
KeybLayouts 
KeybSettingsUpdate 
CodePageInfoUpdate 

Definition at line 236 of file setuplib.h.

237{
238 Success = 0,
@ 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
@ Success
Definition: setuplib.h:238
enum _REGISTRY_STATUS REGISTRY_STATUS

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
_ACRTIMP __msvcrt_long __cdecl wcstol(const wchar_t *, wchar_t **, int)
Definition: wcs.c:2752
_ACRTIMP int __cdecl _wcsicmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:164
#define L(x)
Definition: resources.c:13
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
unsigned int UINT
Definition: sysinfo.c:13
#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
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
short WCHAR
Definition: pedump.c:58
long LONG
Definition: pedump.c:60
BOOLEAN IsUnattendedSetup
Definition: setuplib.c:26
#define DPRINT
Definition: sndvol32.h:73
_In_ PVOID Context
Definition: storport.h:2269
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

Referenced by _tWinMain(), and SetupStartPage().

◆ FinishSetup()

VOID NTAPI FinishSetup ( IN OUT PUSETUP_DATA  pSetupData)

Definition at line 1106 of file setuplib.c.

1108{
1109 /* Destroy the computer settings list */
1110 if (pSetupData->ComputerList != NULL)
1111 {
1112 DestroyGenericList(pSetupData->ComputerList, TRUE);
1113 pSetupData->ComputerList = NULL;
1114 }
1115
1116 /* Destroy the display settings list */
1117 if (pSetupData->DisplayList != NULL)
1118 {
1119 DestroyGenericList(pSetupData->DisplayList, TRUE);
1120 pSetupData->DisplayList = NULL;
1121 }
1122
1123 /* Destroy the keyboard settings list */
1124 if (pSetupData->KeyboardList != NULL)
1125 {
1126 DestroyGenericList(pSetupData->KeyboardList, TRUE);
1127 pSetupData->KeyboardList = NULL;
1128 }
1129
1130 /* Destroy the keyboard layout list */
1131 if (pSetupData->LayoutList != NULL)
1132 {
1133 DestroyGenericList(pSetupData->LayoutList, TRUE);
1134 pSetupData->LayoutList = NULL;
1135 }
1136
1137 /* Destroy the languages list */
1138 if (pSetupData->LanguageList != NULL)
1139 {
1140 DestroyGenericList(pSetupData->LanguageList, FALSE);
1141 pSetupData->LanguageList = NULL;
1142 }
1143
1144 /* Close the Setup INF */
1145 SpInfCloseInfFile(pSetupData->SetupInf);
1146}
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 410 of file setuplib.c.

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

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

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 1022 of file setuplib.c.

1027{
1030
1032 RtlZeroMemory(pSetupData, sizeof(*pSetupData));
1033
1034 /* Initialize error handling */
1035 pSetupData->LastErrorNumber = ERROR_SUCCESS;
1036 pSetupData->ErrorRoutine = ErrorRoutine;
1037
1038 /* Initialize global unicode strings */
1039 RtlInitUnicodeString(&pSetupData->SourcePath, NULL);
1040 RtlInitUnicodeString(&pSetupData->SourceRootPath, NULL);
1041 RtlInitUnicodeString(&pSetupData->SourceRootDir, NULL);
1042 RtlInitUnicodeString(&pSetupData->DestinationArcPath, NULL);
1043 RtlInitUnicodeString(&pSetupData->DestinationPath, NULL);
1044 RtlInitUnicodeString(&pSetupData->DestinationRootPath, NULL);
1045 RtlInitUnicodeString(&pSetupData->SystemRootPath, NULL);
1046
1047 // FIXME: This is only temporary!! Must be removed later!
1048 /***/RtlInitUnicodeString(&pSetupData->InstallPath, NULL);/***/
1049
1050 /* Initialize SpFile and SpInf support */
1051 RtlCopyMemory(&SpFileExports, pSpFileExports, sizeof(SpFileExports));
1052 RtlCopyMemory(&SpInfExports, pSpInfExports, sizeof(SpInfExports));
1053
1054 //
1055 // TODO: Load and start SetupDD, and ask it for the information
1056 //
1057
1058 /* Get the source path and source root path */
1059 Status = GetSourcePaths(&pSetupData->SourcePath,
1060 &pSetupData->SourceRootPath,
1061 &pSetupData->SourceRootDir);
1062 if (!NT_SUCCESS(Status))
1063 {
1064 DPRINT1("GetSourcePaths() failed (Status 0x%08lx)\n", Status);
1065 return ERROR_NO_SOURCE_DRIVE;
1066 }
1067 DPRINT1("SourcePath (1): '%wZ'\n", &pSetupData->SourcePath);
1068 DPRINT1("SourceRootPath (1): '%wZ'\n", &pSetupData->SourceRootPath);
1069 DPRINT1("SourceRootDir (1): '%wZ'\n", &pSetupData->SourceRootDir);
1070
1071 /* Set up default values */
1072 pSetupData->DestinationDiskNumber = 0;
1073 pSetupData->DestinationPartitionNumber = 1;
1074 pSetupData->BootLoaderLocation = 2; // Default to "System partition"
1075 pSetupData->FormatPartition = 0;
1076 pSetupData->AutoPartition = 0;
1077 pSetupData->FsType = 0;
1078
1079 /* Load 'txtsetup.sif' from the installation media */
1080 Error = LoadSetupInf(pSetupData);
1081 if (Error != ERROR_SUCCESS)
1082 {
1083 DPRINT1("LoadSetupInf() failed (Error 0x%lx)\n", Error);
1084 return Error;
1085 }
1086 DPRINT1("SourcePath (2): '%wZ'\n", &pSetupData->SourcePath);
1087 DPRINT1("SourceRootPath (2): '%wZ'\n", &pSetupData->SourceRootPath);
1088 DPRINT1("SourceRootDir (2): '%wZ'\n", &pSetupData->SourceRootDir);
1089
1090 /* Retrieve the target machine architecture type */
1091 // FIXME: This should be determined at runtime!!
1092 // FIXME: Allow for (pre-)installing on an architecture
1093 // different from the current one?
1094#if defined(SARCH_XBOX)
1095 pSetupData->ArchType = ARCH_Xbox;
1096// #elif defined(SARCH_PC98)
1097#else // TODO: Arc, UEFI
1098 pSetupData->ArchType = (IsNEC_98 ? ARCH_NEC98x86 : ARCH_PcAT);
1099#endif
1100
1101 return ERROR_SUCCESS;
1102}
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:565
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:410
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define IsNEC_98
Definition: ketypes.h:979

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 681 of file setuplib.c.

687{
690 PPARTENTRY OldActivePart;
691
692 /*
693 * If we install on a fixed disk, try to find a supported system
694 * partition on the system. Otherwise if we install on a removable disk
695 * use the install partition as the system partition.
696 */
697 if (InstallPartition->DiskEntry->MediaType == FixedMedia)
698 {
700 FALSE,
703 /* Use the original system partition as the old active partition hint */
704 OldActivePart = PartitionList->SystemPartition;
705
708 {
709 DPRINT1("We are using a different system partition!!\n");
710
714 0);
715 if (Result != FSVOL_DOIT)
716 return FALSE;
717 }
718 }
719 else // if (InstallPartition->DiskEntry->MediaType == RemovableMedia)
720 {
722 /* Don't specify any old active partition hint */
723 OldActivePart = NULL;
724 }
725
726 if (!SystemPartition)
727 {
731 0);
732 return FALSE;
733 }
734
735 *pSystemPartition = SystemPartition;
736
737 /*
738 * If the system partition can be created in some
739 * non-partitioned space, create it now.
740 */
742 {
743 /* Automatically create the partition; it will be
744 * formatted later with default parameters */
745 // FIXME: Don't use the whole empty space, but a minimal size
746 // specified from the TXTSETUP.SIF or unattended setup.
749 0ULL,
750 0);
752 }
753
754 /* Set it as such */
756 {
757 DPRINT1("SetActivePartition(0x%p) failed?!\n", SystemPartition);
758 ASSERT(FALSE);
759 }
760
761 /*
762 * In all cases, whether or not we are going to perform a formatting,
763 * we must perform a filesystem check of the system partition.
764 */
767
768 return TRUE;
769}
static FSVOL_OP CALLBACK FsVolCallback(_In_opt_ PVOID Context, _In_ FSVOLNOTIFY FormatStatus, _In_ ULONG_PTR Param1, _In_ ULONG_PTR Param2)
Definition: reactos.c:1372
PPARTENTRY InstallPartition
Definition: reactos.c:28
PPARTENTRY SystemPartition
Definition: reactos.c:33
#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:2975
BOOLEAN SetActivePartition(IN PPARTLIST List, IN PPARTENTRY PartEntry, IN PPARTENTRY OldActivePart OPTIONAL)
Definition: partlist.c:3603
PPARTENTRY FindSupportedSystemPartition(IN PPARTLIST List, IN BOOLEAN ForceSelect, IN PDISKENTRY AlternativeDisk OPTIONAL, IN PPARTENTRY AlternativePart OPTIONAL)
Definition: partlist.c:3300
#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#if 0 /* If you need to put something in this section, do it after the merge with Unattend.inf */
239 IniSection = IniAddSection(IniCache, L"SetupParams");
240 if (IniSection)
241 {
242 /* Key "skipmissingfiles" */
243 // RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
244 // L"\"%s\"", L"WinNt5.2");
245 // IniAddKey(IniSection, L"Version", PathBuffer);
246 }
247#endif
248
249 IniSection = IniAddSection(IniCache, L"Data");
250 if (IniSection)
251 {
252 RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
253 L"\"%s\"", IsUnattendedSetup ? L"yes" : L"no");
254 IniAddKey(IniSection, L"UnattendedInstall", PathBuffer);
255
256 // "floppylessbootpath" (yes/no)
257
258 RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
259 L"\"%s\"", L"winnt");
260 IniAddKey(IniSection, L"ProductType", PathBuffer);
261
262 RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
263 L"\"%s\\\"", pSetupData->SourceRootPath.Buffer);
264 IniAddKey(IniSection, L"SourcePath", PathBuffer);
265
266 // "floppyless" ("0")
267 }
268
269#if 0
270
271 /* TODO: Append the standard unattend.inf file */
272 CombinePaths(UnattendInfPath, ARRAYSIZE(UnattendInfPath), 2,
273 pSetupData->SourcePath.Buffer, L"unattend.inf");
274 if (DoesFileExist(NULL, UnattendInfPath) == FALSE)
275 {
276 DPRINT("Does not exist: %S\n", UnattendInfPath);
277 goto Quit;
278 }
279
280 Status = IniCacheLoad(&UnattendCache, UnattendInfPath, FALSE);
281 if (!NT_SUCCESS(Status))
282 {
283 DPRINT1("Cannot load %S as an INI file!\n", UnattendInfPath);
284 goto Quit;
285 }
286
287 IniCacheDestroy(UnattendCache);
288
289Quit:
290 CombinePaths(PathBuffer, ARRAYSIZE(PathBuffer), 2,
291 pSetupData->DestinationPath.Buffer, L"System32\\$winnt$.inf");
292 IniCacheSave(IniCache, PathBuffer);
293 IniCacheDestroy(IniCache);
294
295#else
296
297 CombinePaths(PathBuffer, ARRAYSIZE(PathBuffer), 2,
298 pSetupData->DestinationPath.Buffer, L"System32\\$winnt$.inf");
299 IniCacheSave(IniCache, PathBuffer);
300 IniCacheDestroy(IniCache);
301
302 /* TODO: Append the standard unattend.inf file */
303 CombinePaths(UnattendInfPath, ARRAYSIZE(UnattendInfPath), 2,
304 pSetupData->SourcePath.Buffer, L"unattend.inf");
305 if (DoesFileExist(NULL, UnattendInfPath) == FALSE)
306 {
307 DPRINT("Does not exist: %S\n", UnattendInfPath);
308 return;
309 }
310
311 RtlInitUnicodeString(&FileName, PathBuffer);
313 &FileName,
315 NULL,
316 NULL);
323 if (!NT_SUCCESS(Status))
324 {
325 DPRINT1("Cannot load %S as an INI file!\n", PathBuffer);
326 return;
327 }
328
329 /* Query the file size */
332 &FileInfo,
333 sizeof(FileInfo),
335 if (!NT_SUCCESS(Status))
336 {
337 DPRINT("NtQueryInformationFile() failed (Status %lx)\n", Status);
338 FileInfo.EndOfFile.QuadPart = 0ULL;
339 }
340
342 UnattendInfPath,
343 &UnattendFileHandle,
344 &FileSize,
345 &SectionHandle,
346 &ViewBase,
347 FALSE);
348 if (!NT_SUCCESS(Status))
349 {
350 DPRINT1("Cannot load %S !\n", UnattendInfPath);
352 return;
353 }
354
355 /* Write to the INI file */
356
357 /* "\r\n" */
359 NULL,
360 NULL,
361 NULL,
363 (PVOID)CrLf,
364 sizeof(CrLf),
365 &FileInfo.EndOfFile,
366 NULL);
367
369 NULL,
370 NULL,
371 NULL,
373 ViewBase,
374 FileSize,
375 NULL,
376 NULL);
377 if (!NT_SUCCESS(Status))
378 {
379 DPRINT("NtWriteFile() failed (Status %lx)\n", Status);
380 }
381
382 /* Finally, unmap and close the file */
383 UnMapAndCloseFile(UnattendFileHandle, SectionHandle, ViewBase);
384
386#endif
387}
#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
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
char CHAR
Definition: pedump.c:57
#define OBJ_OPENIF
Definition: winternl.h:229
#define FileStandardInformation
Definition: propsheet.cpp:61
_In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR Iterator
Definition: wdfchildlist.h:656

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 781 of file setuplib.c.

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

◆ LoadSetupInf()

ERROR_NUMBER LoadSetupInf ( IN OUT PUSETUP_DATA  pSetupData)

Definition at line 565 of file setuplib.c.

567{
569 UINT ErrorLine;
570 INT IntValue;
573
575 pSetupData->SourcePath.Buffer, L"txtsetup.sif");
576
577 DPRINT("SetupInf path: '%S'\n", FileNameBuffer);
578
579 pSetupData->SetupInf =
581 NULL,
583 pSetupData->LanguageId,
584 &ErrorLine);
585 if (pSetupData->SetupInf == INVALID_HANDLE_VALUE)
587
588 /* Open 'Version' section */
589 if (!SpInfFindFirstLine(pSetupData->SetupInf, L"Version", L"Signature", &Context))
591
592 /* Get pointer 'Signature' key */
593 if (!INF_GetData(&Context, NULL, &Value))
595
596 /* Check 'Signature' string */
597 if (_wcsicmp(Value, L"$ReactOS$") != 0 &&
598 _wcsicmp(Value, L"$Windows NT$") != 0)
599 {
602 }
603
605
606 /* Open 'DiskSpaceRequirements' section */
607 if (!SpInfFindFirstLine(pSetupData->SetupInf, L"DiskSpaceRequirements", L"FreeSysPartDiskSpace", &Context))
609
610 pSetupData->RequiredPartitionDiskSpace = ~0;
611
612 /* Get the 'FreeSysPartDiskSpace' value */
613 if (!SpInfGetIntField(&Context, 1, &IntValue))
615
616 pSetupData->RequiredPartitionDiskSpace = (ULONG)IntValue;
617
618 //
619 // Support "SetupSourceDevice" and "SetupSourcePath" in txtsetup.sif
620 // See CORE-9023
621 // Support for that should also be added in setupldr.
622 //
623
624 /* Update the Setup Source paths */
625 if (SpInfFindFirstLine(pSetupData->SetupInf, L"SetupData", L"SetupSourceDevice", &Context))
626 {
627 /*
628 * Get optional pointer 'SetupSourceDevice' key, its presence
629 * will dictate whether we also need 'SetupSourcePath'.
630 */
631 if (INF_GetData(&Context, NULL, &Value))
632 {
633 /* Free the old source root path string and create the new one */
634 RtlFreeUnicodeString(&pSetupData->SourceRootPath);
635 RtlCreateUnicodeString(&pSetupData->SourceRootPath, Value);
637
638 if (!SpInfFindFirstLine(pSetupData->SetupInf, L"SetupData", L"SetupSourcePath", &Context))
639 {
640 /* The 'SetupSourcePath' value is mandatory! */
642 }
643
644 /* Get pointer 'SetupSourcePath' key */
645 if (!INF_GetData(&Context, NULL, &Value))
646 {
647 /* The 'SetupSourcePath' value is mandatory! */
649 }
650
651 /* Free the old source path string and create the new one */
652 RtlFreeUnicodeString(&pSetupData->SourceRootDir);
653 RtlCreateUnicodeString(&pSetupData->SourceRootDir, Value);
655 }
656 }
657
658 /* Search for 'DefaultPath' in the 'SetupData' section */
659 pSetupData->InstallationDirectory[0] = 0;
660 if (SpInfFindFirstLine(pSetupData->SetupInf, L"SetupData", L"DefaultPath", &Context))
661 {
662 /* Get pointer 'DefaultPath' key */
663 if (!INF_GetData(&Context, NULL, &Value))
665
666 RtlStringCchCopyW(pSetupData->InstallationDirectory,
667 ARRAYSIZE(pSetupData->InstallationDirectory),
668 Value);
669
671 }
672
673 return ERROR_SUCCESS;
674}
WCHAR FileNameBuffer[MAX_PATH]
Definition: framewnd.c:248
@ 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 1157 of file setuplib.c.

1165{
1166 ERROR_NUMBER ErrorNumber;
1168 INFCONTEXT InfContext;
1169 PCWSTR Action;
1170 PCWSTR File;
1171 PCWSTR Section;
1173 BOOLEAN ShouldRepairRegistry = FALSE;
1175
1176 if (RepairUpdateFlag)
1177 {
1178 DPRINT1("TODO: Updating / repairing the registry is not completely implemented yet!\n");
1179
1180 /* Verify the registry hives and check whether we need to update or repair any of them */
1181 Status = VerifyRegistryHives(&pSetupData->DestinationPath, &ShouldRepairRegistry);
1182 if (!NT_SUCCESS(Status))
1183 {
1184 DPRINT1("VerifyRegistryHives failed, Status 0x%08lx\n", Status);
1185 ShouldRepairRegistry = FALSE;
1186 }
1187 if (!ShouldRepairRegistry)
1188 DPRINT1("No need to repair the registry\n");
1189 }
1190
1191DoUpdate:
1192 ErrorNumber = ERROR_SUCCESS;
1193
1194 /* Update the registry */
1196
1197 /* Initialize the registry and setup the registry hives */
1198 Status = RegInitializeRegistry(&pSetupData->DestinationPath);
1199 if (!NT_SUCCESS(Status))
1200 {
1201 DPRINT1("RegInitializeRegistry() failed\n");
1202 /********** HACK!!!!!!!!!!! **********/
1204 {
1205 /* The hack was called, return its corresponding error */
1207 }
1208 else
1209 /*************************************/
1210 {
1211 /* Something else failed */
1212 return ERROR_CREATE_HIVE;
1213 }
1214 }
1215
1216 if (!RepairUpdateFlag || ShouldRepairRegistry)
1217 {
1218 /*
1219 * We fully setup the hives, in case we are doing a fresh installation
1220 * (RepairUpdateFlag == FALSE), or in case we are doing an update
1221 * (RepairUpdateFlag == TRUE) BUT we have some registry hives to
1222 * "repair" (aka. recreate: ShouldRepairRegistry == TRUE).
1223 */
1224
1225 Success = SpInfFindFirstLine(pSetupData->SetupInf, L"HiveInfs.Fresh", NULL, &InfContext); // Windows-compatible
1226 if (!Success)
1227 Success = SpInfFindFirstLine(pSetupData->SetupInf, L"HiveInfs.Install", NULL, &InfContext); // ReactOS-specific
1228
1229 if (!Success)
1230 {
1231 DPRINT1("SpInfFindFirstLine() failed\n");
1232 ErrorNumber = ERROR_FIND_REGISTRY;
1233 goto Cleanup;
1234 }
1235 }
1236 else // if (RepairUpdateFlag && !ShouldRepairRegistry)
1237 {
1238 /*
1239 * In case we are doing an update (RepairUpdateFlag == TRUE) and
1240 * NO registry hives need a repair (ShouldRepairRegistry == FALSE),
1241 * we only update the hives.
1242 */
1243
1244 Success = SpInfFindFirstLine(pSetupData->SetupInf, L"HiveInfs.Upgrade", NULL, &InfContext);
1245 if (!Success)
1246 {
1247 /* Nothing to do for update! */
1248 DPRINT1("No update needed for the registry!\n");
1249 goto Cleanup;
1250 }
1251 }
1252
1253 do
1254 {
1255 INF_GetDataField(&InfContext, 0, &Action);
1256 INF_GetDataField(&InfContext, 1, &File);
1257 INF_GetDataField(&InfContext, 2, &Section);
1258
1259 DPRINT("Action: %S File: %S Section %S\n", Action, File, Section);
1260
1261 if (Action == NULL)
1262 {
1265 INF_FreeData(Section);
1266 break; // Hackfix
1267 }
1268
1269 if (!_wcsicmp(Action, L"AddReg"))
1270 Delete = FALSE;
1271 else if (!_wcsicmp(Action, L"DelReg"))
1272 Delete = TRUE;
1273 else
1274 {
1275 DPRINT1("Unrecognized registry INF action '%S'\n", Action);
1278 INF_FreeData(Section);
1279 continue;
1280 }
1281
1283
1285
1286 if (!ImportRegistryFile(pSetupData->SourcePath.Buffer,
1287 File, Section,
1288 pSetupData->LanguageId, Delete))
1289 {
1290 DPRINT1("Importing %S failed\n", File);
1292 INF_FreeData(Section);
1293 ErrorNumber = ERROR_IMPORT_HIVE;
1294 goto Cleanup;
1295 }
1296 } while (SpInfFindNextLine(&InfContext, &InfContext));
1297
1298 if (!RepairUpdateFlag || ShouldRepairRegistry)
1299 {
1300 /* See the explanation for this test above */
1301
1303 PCWSTR LanguageId; // LocaleID;
1304
1305 Entry = GetCurrentListEntry(pSetupData->DisplayList);
1306 ASSERT(Entry);
1307 pSetupData->DisplayType = ((PGENENTRY)GetListEntryData(Entry))->Id;
1308 ASSERT(pSetupData->DisplayType);
1309
1310 /* Update display registry settings */
1312 if (!ProcessDisplayRegistry(pSetupData->SetupInf, pSetupData->DisplayType))
1313 {
1314 ErrorNumber = ERROR_UPDATE_DISPLAY_SETTINGS;
1315 goto Cleanup;
1316 }
1317
1318 Entry = GetCurrentListEntry(pSetupData->LanguageList);
1319 ASSERT(Entry);
1320 LanguageId = ((PGENENTRY)GetListEntryData(Entry))->Id;
1321 ASSERT(LanguageId);
1322
1323 /* Set the locale */
1325 if (!ProcessLocaleRegistry(/*pSetupData->*/LanguageId))
1326 {
1327 ErrorNumber = ERROR_UPDATE_LOCALESETTINGS;
1328 goto Cleanup;
1329 }
1330
1331 /* Add the keyboard layouts for the given language (without user override) */
1334 {
1335 ErrorNumber = ERROR_ADDING_KBLAYOUTS;
1336 goto Cleanup;
1337 }
1338
1339 if (!IsUnattendedSetup)
1340 {
1341 Entry = GetCurrentListEntry(pSetupData->LayoutList);
1342 ASSERT(Entry);
1343 pSetupData->LayoutId = ((PGENENTRY)GetListEntryData(Entry))->Id;
1344 ASSERT(pSetupData->LayoutId);
1345
1346 /* Update keyboard layout settings with user-overridden values */
1347 // FIXME: Wouldn't it be better to do it all at once
1348 // with the AddKeyboardLayouts() step?
1350 if (!ProcessKeyboardLayoutRegistry(pSetupData->LayoutId, SelectedLanguageId))
1351 {
1352 ErrorNumber = ERROR_UPDATE_KBSETTINGS;
1353 goto Cleanup;
1354 }
1355 }
1356
1357 /* Set GeoID */
1359 {
1360 ErrorNumber = ERROR_UPDATE_GEOID;
1361 goto Cleanup;
1362 }
1363
1364 /* Add codepage information to registry */
1367 {
1368 ErrorNumber = ERROR_ADDING_CODEPAGE;
1369 goto Cleanup;
1370 }
1371
1372 /* Set the default pagefile entry */
1373 SetDefaultPagefile(DestinationDriveLetter);
1374
1375 /* Update the mounted devices list */
1376 // FIXME: This should technically be done by mountmgr (if AutoMount is enabled)!
1378 }
1379
1380#ifdef __REACTOS__
1381 if (SubstSettings)
1382 {
1383 /* HACK */
1384 DoRegistryFontFixup(SubstSettings, wcstoul(SelectedLanguageId, NULL, 16));
1385 }
1386#endif
1387
1388Cleanup:
1389 //
1390 // TODO: Unload all the registry stuff, perform cleanup,
1391 // and copy the created hive files into .sav files.
1392 //
1393 RegCleanupRegistry(&pSetupData->DestinationPath);
1394
1395 /*
1396 * Check whether we were in update/repair mode but we were actually
1397 * repairing the registry hives. If so, we have finished repairing them,
1398 * and we now reset the flag and run the proper registry update.
1399 * Otherwise we have finished the registry update!
1400 */
1401 if (RepairUpdateFlag && ShouldRepairRegistry)
1402 {
1403 ShouldRepairRegistry = FALSE;
1404 goto DoUpdate;
1405 }
1406
1407 return ErrorNumber;
1408}
static BOOL ImportRegistryFile(HWND hWnd)
Definition: framewnd.c:462
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
_ACRTIMP __msvcrt_ulong __cdecl wcstoul(const wchar_t *, wchar_t **, int)
Definition: wcs.c:2917
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
#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
Entry
Definition: section.c:5216
BOOLEAN SetMountedDeviceValues(_In_ PPARTLIST List)
Definition: partlist.c:3967
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().