[SETUPLIB][USETUP] Use NT RTL String Safe functions instead of Win32-oriented ones (and remove usage of HRESULT too).

Based on:
svn path=/branches/setup_improvements/; revision=75755
svn path=/branches/setup_improvements/; revision=75757
This commit is contained in:
Hermès Bélusca-Maïto 2017-09-03 20:05:11 +00:00
parent 254aa472e8
commit 48aab0fb20
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
10 changed files with 69 additions and 70 deletions

View file

@ -883,9 +883,9 @@ InstallMbrBootCodeToDisk(
#if 0 #if 0
WCHAR DestinationDevicePathBuffer[MAX_PATH]; WCHAR DestinationDevicePathBuffer[MAX_PATH];
StringCchPrintfW(DestinationDevicePathBuffer, ARRAYSIZE(DestinationDevicePathBuffer), RtlStringCchPrintfW(DestinationDevicePathBuffer, ARRAYSIZE(DestinationDevicePathBuffer),
L"\\Device\\Harddisk%d\\Partition0", L"\\Device\\Harddisk%d\\Partition0",
DiskNumber); DiskNumber);
#endif #endif
CombinePaths(SourceMbrPathBuffer, ARRAYSIZE(SourceMbrPathBuffer), 2, CombinePaths(SourceMbrPathBuffer, ARRAYSIZE(SourceMbrPathBuffer), 2,

View file

@ -298,10 +298,10 @@ AddKbLayoutsToRegistry(
{ {
if (uIndex > 19) break; if (uIndex > 19) break;
swprintf(szValueName, L"%u", uIndex + 1); RtlStringCchPrintfW(szValueName, ARRAYSIZE(szValueName), L"%u", uIndex + 1);
RtlInitUnicodeString(&ValueName, szValueName); RtlInitUnicodeString(&ValueName, szValueName);
swprintf(szLangID, L"0000%s", MuiLayouts[uIndex].LangID); RtlStringCchPrintfW(szLangID, ARRAYSIZE(szLangID), L"0000%s", MuiLayouts[uIndex].LangID);
if (_wcsicmp(szLangID, MuiLayouts[uIndex].LayoutID) == 0) if (_wcsicmp(szLangID, MuiLayouts[uIndex].LayoutID) == 0)
{ {
@ -321,7 +321,7 @@ AddKbLayoutsToRegistry(
} }
else else
{ {
swprintf(szLangID, L"d%03lu%s", uCount, MuiLayouts[uIndex].LangID); RtlStringCchPrintfW(szLangID, ARRAYSIZE(szLangID), L"d%03lu%s", uCount, MuiLayouts[uIndex].LangID);
Status = NtSetValueKey(KeyHandle, Status = NtSetValueKey(KeyHandle,
&ValueName, &ValueName,
0, 0,

View file

@ -34,9 +34,6 @@
#include "registry.h" #include "registry.h"
// HACK!
#include <strsafe.h>
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
@ -1098,8 +1095,8 @@ RegCleanupRegistry(
CombinePaths(SrcPath, ARRAYSIZE(SrcPath), 3, CombinePaths(SrcPath, ARRAYSIZE(SrcPath), 3,
InstallPath->Buffer, L"System32\\config", RegistryHives[i].HiveName); InstallPath->Buffer, L"System32\\config", RegistryHives[i].HiveName);
StringCchCopyW(DstPath, ARRAYSIZE(DstPath), SrcPath); RtlStringCchCopyW(DstPath, ARRAYSIZE(DstPath), SrcPath);
StringCchCatW(DstPath, ARRAYSIZE(DstPath), L".sav"); RtlStringCchCatW(DstPath, ARRAYSIZE(DstPath), L".sav");
DPRINT1("Copy hive: %S ==> %S\n", SrcPath, DstPath); DPRINT1("Copy hive: %S ==> %S\n", SrcPath, DstPath);
Status = SetupCopyFile(SrcPath, DstPath, FALSE); Status = SetupCopyFile(SrcPath, DstPath, FALSE);

View file

@ -422,7 +422,7 @@ DefaultProcessEntry(
} }
wcscpy((PWCHAR)*UserData, KeyName); wcscpy((PWCHAR)*UserData, KeyName);
wcscpy(DisplayText, KeyValue); RtlStringCbCopyW(DisplayText, DisplayTextSize, KeyValue);
*Current = (CompareKey ? !_wcsicmp(KeyName, CompareKey) : FALSE); *Current = (CompareKey ? !_wcsicmp(KeyName, CompareKey) : FALSE);
@ -483,7 +483,7 @@ CreateComputerTypeList(
} }
DPRINT("Computer key: %S\n", KeyName); DPRINT("Computer key: %S\n", KeyName);
wcscpy(ComputerKey, KeyName); RtlStringCchCopyW(ComputerKey, ARRAYSIZE(ComputerKey), KeyName);
INF_FreeData(KeyName); INF_FreeData(KeyName);
} while (SetupFindNextLine(&Context, &Context)); } while (SetupFindNextLine(&Context, &Context));
@ -548,7 +548,7 @@ GetDisplayIdentifier(
BusInstance = 0; BusInstance = 0;
while (TRUE) while (TRUE)
{ {
swprintf(Buffer, L"%lu", BusInstance); RtlStringCchPrintfW(Buffer, ARRAYSIZE(Buffer), L"%lu", BusInstance);
RtlInitUnicodeString(&KeyName, Buffer); RtlInitUnicodeString(&KeyName, Buffer);
InitializeObjectAttributes(&ObjectAttributes, InitializeObjectAttributes(&ObjectAttributes,
&KeyName, &KeyName,
@ -584,7 +584,7 @@ GetDisplayIdentifier(
while (TRUE) while (TRUE)
{ {
/* Open the pointer controller instance key */ /* Open the pointer controller instance key */
swprintf(Buffer, L"%lu", ControllerInstance); RtlStringCchPrintfW(Buffer, ARRAYSIZE(Buffer), L"%lu", ControllerInstance);
RtlInitUnicodeString(&KeyName, Buffer); RtlInitUnicodeString(&KeyName, Buffer);
InitializeObjectAttributes(&ObjectAttributes, InitializeObjectAttributes(&ObjectAttributes,
&KeyName, &KeyName,
@ -719,7 +719,7 @@ CreateDisplayDriverList(
} }
DPRINT("Display key: %S\n", KeyName); DPRINT("Display key: %S\n", KeyName);
wcscpy(DisplayKey, KeyName); RtlStringCchCopyW(DisplayKey, ARRAYSIZE(DisplayKey), KeyName);
INF_FreeData(KeyName); INF_FreeData(KeyName);
} while (SetupFindNextLine(&Context, &Context)); } while (SetupFindNextLine(&Context, &Context));
@ -764,8 +764,8 @@ ProcessComputerFiles(
return FALSE; return FALSE;
} }
wcscpy(SectionName, L"Files."); RtlStringCchPrintfW(SectionName, ARRAYSIZE(SectionName),
wcscat(SectionName, (const wchar_t*)GetListEntryUserData(Entry)); L"Files.%s", (PCWSTR)GetListEntryUserData(Entry));
*AdditionalSectionName = SectionName; *AdditionalSectionName = SectionName;
return TRUE; return TRUE;
@ -813,7 +813,9 @@ ProcessDisplayRegistry(
ASSERT(wcslen(ServiceName) < 10); ASSERT(wcslen(ServiceName) < 10);
DPRINT1("Service name: '%S'\n", ServiceName); DPRINT1("Service name: '%S'\n", ServiceName);
swprintf(RegPath, L"System\\CurrentControlSet\\Services\\%s", ServiceName); RtlStringCchPrintfW(RegPath, ARRAYSIZE(RegPath),
L"System\\CurrentControlSet\\Services\\%s",
ServiceName);
RtlInitUnicodeString(&KeyName, RegPath); RtlInitUnicodeString(&KeyName, RegPath);
InitializeObjectAttributes(&ObjectAttributes, InitializeObjectAttributes(&ObjectAttributes,
&KeyName, &KeyName,
@ -850,9 +852,9 @@ ProcessDisplayRegistry(
return FALSE; return FALSE;
} }
swprintf(RegPath, RtlStringCchPrintfW(RegPath, ARRAYSIZE(RegPath),
L"System\\CurrentControlSet\\Hardware Profiles\\Current\\System\\CurrentControlSet\\Services\\%s\\Device0", L"System\\CurrentControlSet\\Hardware Profiles\\Current\\System\\CurrentControlSet\\Services\\%s\\Device0",
ServiceName); ServiceName);
DPRINT1("RegPath: '%S'\n", RegPath); DPRINT1("RegPath: '%S'\n", RegPath);
RtlInitUnicodeString(&KeyName, RegPath); RtlInitUnicodeString(&KeyName, RegPath);
InitializeObjectAttributes(&ObjectAttributes, InitializeObjectAttributes(&ObjectAttributes,
@ -1110,7 +1112,7 @@ ProcessLangEntry(
} }
wcscpy((PWCHAR)*UserData, KeyName); wcscpy((PWCHAR)*UserData, KeyName);
wcscpy(DisplayText, KeyValue); RtlStringCbCopyW(DisplayText, DisplayTextSize, KeyValue);
*Current = FALSE; *Current = FALSE;

View file

@ -16,9 +16,6 @@
#include "setuplib.h" #include "setuplib.h"
// HACK!
#include <strsafe.h>
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
@ -147,7 +144,11 @@ CheckUnattendedSetup(
DPRINT("INF_GetData() failed for key 'InstallationDirectory'\n"); DPRINT("INF_GetData() failed for key 'InstallationDirectory'\n");
goto Quit; goto Quit;
} }
wcscpy(pSetupData->InstallationDirectory, Value);
RtlStringCchCopyW(pSetupData->InstallationDirectory,
ARRAYSIZE(pSetupData->InstallationDirectory),
Value);
INF_FreeData(Value); INF_FreeData(Value);
} }
@ -189,7 +190,9 @@ CheckUnattendedSetup(
if (INF_GetData(&Context, NULL, &Value)) if (INF_GetData(&Context, NULL, &Value))
{ {
LONG Id = wcstol(Value, NULL, 16); LONG Id = wcstol(Value, NULL, 16);
swprintf(pSetupData->LocaleID, L"%08lx", Id); RtlStringCchPrintfW(pSetupData->LocaleID,
ARRAYSIZE(pSetupData->LocaleID),
L"%08lx", Id);
INF_FreeData(Value); INF_FreeData(Value);
} }
} }
@ -233,8 +236,8 @@ InstallSetupInfFile(
if (IniSection) if (IniSection)
{ {
/* Key "skipmissingfiles" */ /* Key "skipmissingfiles" */
// StringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer), // RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
// L"\"%s\"", L"WinNt5.2"); // L"\"%s\"", L"WinNt5.2");
// IniCacheInsertKey(IniSection, NULL, INSERT_LAST, // IniCacheInsertKey(IniSection, NULL, INSERT_LAST,
// L"Version", PathBuffer); // L"Version", PathBuffer);
} }
@ -242,20 +245,20 @@ InstallSetupInfFile(
IniSection = IniCacheAppendSection(IniCache, L"Data"); IniSection = IniCacheAppendSection(IniCache, L"Data");
if (IniSection) if (IniSection)
{ {
StringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer), RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
L"\"%s\"", IsUnattendedSetup ? L"yes" : L"no"); L"\"%s\"", IsUnattendedSetup ? L"yes" : L"no");
IniCacheInsertKey(IniSection, NULL, INSERT_LAST, IniCacheInsertKey(IniSection, NULL, INSERT_LAST,
L"UnattendedInstall", PathBuffer); L"UnattendedInstall", PathBuffer);
// "floppylessbootpath" (yes/no) // "floppylessbootpath" (yes/no)
StringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer), RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
L"\"%s\"", L"winnt"); L"\"%s\"", L"winnt");
IniCacheInsertKey(IniSection, NULL, INSERT_LAST, IniCacheInsertKey(IniSection, NULL, INSERT_LAST,
L"ProductType", PathBuffer); L"ProductType", PathBuffer);
StringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer), RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
L"\"%s\\\"", pSetupData->SourceRootPath.Buffer); L"\"%s\\\"", pSetupData->SourceRootPath.Buffer);
IniCacheInsertKey(IniSection, NULL, INSERT_LAST, IniCacheInsertKey(IniSection, NULL, INSERT_LAST,
L"SourcePath", PathBuffer); L"SourcePath", PathBuffer);
@ -561,7 +564,10 @@ LoadSetupInf(
if (!INF_GetData(&Context, NULL, &Value)) if (!INF_GetData(&Context, NULL, &Value))
return ERROR_CORRUPT_TXTSETUPSIF; return ERROR_CORRUPT_TXTSETUPSIF;
wcscpy(pSetupData->InstallationDirectory, Value); RtlStringCchCopyW(pSetupData->InstallationDirectory,
ARRAYSIZE(pSetupData->InstallationDirectory),
Value);
INF_FreeData(Value); INF_FreeData(Value);
} }

View file

@ -20,8 +20,6 @@
#include <ntstatus.h> #include <ntstatus.h>
#include <strsafe.h>
#include "arcname.h" #include "arcname.h"
#define OBJ_NAME_PATH_SEPARATOR ((WCHAR)L'\\') #define OBJ_NAME_PATH_SEPARATOR ((WCHAR)L'\\')

View file

@ -21,9 +21,7 @@ CreateGenericList(VOID)
{ {
PGENERIC_LIST List; PGENERIC_LIST List;
List = (PGENERIC_LIST)RtlAllocateHeap(ProcessHeap, List = RtlAllocateHeap(ProcessHeap, 0, sizeof(GENERIC_LIST));
0,
sizeof(GENERIC_LIST));
if (List == NULL) if (List == NULL)
return NULL; return NULL;
@ -70,15 +68,15 @@ AppendGenericListEntry(
IN BOOLEAN Current) IN BOOLEAN Current)
{ {
PGENERIC_LIST_ENTRY Entry; PGENERIC_LIST_ENTRY Entry;
SIZE_T TextSize;
Entry = (PGENERIC_LIST_ENTRY)RtlAllocateHeap(ProcessHeap, TextSize = (wcslen(Text) + 1) * sizeof(WCHAR);
0, Entry = RtlAllocateHeap(ProcessHeap, 0,
sizeof(GENERIC_LIST_ENTRY) + sizeof(GENERIC_LIST_ENTRY) + TextSize);
(wcslen(Text) + 1) * sizeof(WCHAR));
if (Entry == NULL) if (Entry == NULL)
return FALSE; return FALSE;
wcscpy(Entry->Text, Text); RtlStringCbCopyW(Entry->Text, TextSize, Text);
Entry->List = List; Entry->List = List;
Entry->UserData = UserData; Entry->UserData = UserData;

View file

@ -13,9 +13,6 @@
#include "regutil.h" #include "regutil.h"
// HACK!
#include <strsafe.h>
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
@ -180,7 +177,8 @@ CreateRegistryFile(
// i = 1; // i = 1;
/* Try first by just appending the '.old' extension */ /* Try first by just appending the '.old' extension */
StringCchPrintfW(PathBuffer2, ARRAYSIZE(PathBuffer2), L"%s.%s", PathBuffer, Extension); RtlStringCchPrintfW(PathBuffer2, ARRAYSIZE(PathBuffer2),
L"%s.%s", PathBuffer, Extension);
#if 0 #if 0
while (DoesFileExist(NULL, PathBuffer2)) while (DoesFileExist(NULL, PathBuffer2))
{ {
@ -188,7 +186,8 @@ CreateRegistryFile(
if (i <= 0xFFFF) if (i <= 0xFFFF)
{ {
/* Append '_N.old' extension */ /* Append '_N.old' extension */
StringCchPrintfW(PathBuffer2, ARRAYSIZE(PathBuffer2), L"%s_%lu.%s", PathBuffer, i, Extension); RtlStringCchPrintfW(PathBuffer2, ARRAYSIZE(PathBuffer2),
L"%s_%lu.%s", PathBuffer, i, Extension);
++i; ++i;
} }
else else
@ -197,7 +196,8 @@ CreateRegistryFile(
* Too many old files exist, we will rename the file * Too many old files exist, we will rename the file
* using the name of the oldest one. * using the name of the oldest one.
*/ */
StringCchPrintfW(PathBuffer2, ARRAYSIZE(PathBuffer2), L"%s.%s", PathBuffer, Extension); RtlStringCchPrintfW(PathBuffer2, ARRAYSIZE(PathBuffer2),
L"%s.%s", PathBuffer, Extension);
break; break;
} }
} }

View file

@ -36,9 +36,6 @@
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
// HACK!
#include <strsafe.h>
/* GLOBALS & LOCALS *********************************************************/ /* GLOBALS & LOCALS *********************************************************/
@ -1679,7 +1676,7 @@ SelectPartitionPage(PINPUT_RECORD Ir)
return SELECT_PARTITION_PAGE; return SELECT_PARTITION_PAGE;
} }
StringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer), RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
L"\\Device\\Harddisk%lu\\Partition%lu\\", L"\\Device\\Harddisk%lu\\Partition%lu\\",
PartitionList->CurrentDisk->DiskNumber, PartitionList->CurrentDisk->DiskNumber,
PartitionList->CurrentPartition->PartitionNumber); PartitionList->CurrentPartition->PartitionNumber);
@ -3007,7 +3004,7 @@ FormatPartitionPage(PINPUT_RECORD Ir)
} }
/* Set PartitionRootPath */ /* Set PartitionRootPath */
StringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer), RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
L"\\Device\\Harddisk%lu\\Partition%lu", L"\\Device\\Harddisk%lu\\Partition%lu",
DiskEntry->DiskNumber, DiskEntry->DiskNumber,
PartEntry->PartitionNumber); PartEntry->PartitionNumber);
@ -3080,7 +3077,7 @@ CheckFileSystemPage(PINPUT_RECORD Ir)
} }
/* Set PartitionRootPath */ /* Set PartitionRootPath */
StringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer), RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
L"\\Device\\Harddisk%lu\\Partition%lu", L"\\Device\\Harddisk%lu\\Partition%lu",
DiskEntry->DiskNumber, DiskEntry->DiskNumber,
PartEntry->PartitionNumber); PartEntry->PartitionNumber);
@ -3171,7 +3168,7 @@ BuildInstallPaths(PWSTR InstallDir,
/* Create 'USetupData.DestinationRootPath' string */ /* Create 'USetupData.DestinationRootPath' string */
RtlFreeUnicodeString(&USetupData.DestinationRootPath); RtlFreeUnicodeString(&USetupData.DestinationRootPath);
StringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer), RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
L"\\Device\\Harddisk%lu\\Partition%lu\\", L"\\Device\\Harddisk%lu\\Partition%lu\\",
DiskEntry->DiskNumber, DiskEntry->DiskNumber,
PartEntry->PartitionNumber); PartEntry->PartitionNumber);
@ -3188,7 +3185,7 @@ BuildInstallPaths(PWSTR InstallDir,
/** Equivalent of 'NTOS_INSTALLATION::SystemArcPath' **/ /** Equivalent of 'NTOS_INSTALLATION::SystemArcPath' **/
/* Create 'USetupData.DestinationArcPath' */ /* Create 'USetupData.DestinationArcPath' */
RtlFreeUnicodeString(&USetupData.DestinationArcPath); RtlFreeUnicodeString(&USetupData.DestinationArcPath);
StringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer), RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
L"multi(0)disk(0)rdisk(%lu)partition(%lu)\\", L"multi(0)disk(0)rdisk(%lu)partition(%lu)\\",
DiskEntry->BiosDiskNumber, DiskEntry->BiosDiskNumber,
PartEntry->PartitionNumber); PartEntry->PartitionNumber);
@ -3598,8 +3595,8 @@ AddSectionToCopyQueue(HINF InfFile,
/* Installation path */ /* Installation path */
DPRINT("InstallationPath: '%S'\n", DirKeyValue); DPRINT("InstallationPath: '%S'\n", DirKeyValue);
StringCchCopyW(CompleteOrigDirName, ARRAYSIZE(CompleteOrigDirName), RtlStringCchCopyW(CompleteOrigDirName, ARRAYSIZE(CompleteOrigDirName),
USetupData.SourceRootDir.Buffer); USetupData.SourceRootDir.Buffer);
DPRINT("InstallationPath(2): '%S'\n", CompleteOrigDirName); DPRINT("InstallationPath(2): '%S'\n", CompleteOrigDirName);
} }
@ -3608,8 +3605,8 @@ AddSectionToCopyQueue(HINF InfFile,
/* Absolute path */ /* Absolute path */
DPRINT("AbsolutePath: '%S'\n", DirKeyValue); DPRINT("AbsolutePath: '%S'\n", DirKeyValue);
StringCchCopyW(CompleteOrigDirName, ARRAYSIZE(CompleteOrigDirName), RtlStringCchCopyW(CompleteOrigDirName, ARRAYSIZE(CompleteOrigDirName),
DirKeyValue); DirKeyValue);
DPRINT("AbsolutePath(2): '%S'\n", CompleteOrigDirName); DPRINT("AbsolutePath(2): '%S'\n", CompleteOrigDirName);
} }
@ -3684,7 +3681,7 @@ PrepareCopyPageInfFile(HINF InfFile,
*/ */
/* Get destination path */ /* Get destination path */
StringCchCopyW(PathBuffer, ARRAYSIZE(PathBuffer), USetupData.DestinationPath.Buffer); RtlStringCchCopyW(PathBuffer, ARRAYSIZE(PathBuffer), USetupData.DestinationPath.Buffer);
DPRINT("FullPath(1): '%S'\n", PathBuffer); DPRINT("FullPath(1): '%S'\n", PathBuffer);
@ -3726,8 +3723,8 @@ PrepareCopyPageInfFile(HINF InfFile,
/* Installation path */ /* Installation path */
DPRINT("InstallationPath: '%S'\n", DirKeyValue); DPRINT("InstallationPath: '%S'\n", DirKeyValue);
StringCchCopyW(PathBuffer, ARRAYSIZE(PathBuffer), RtlStringCchCopyW(PathBuffer, ARRAYSIZE(PathBuffer),
USetupData.DestinationPath.Buffer); USetupData.DestinationPath.Buffer);
DPRINT("InstallationPath(2): '%S'\n", PathBuffer); DPRINT("InstallationPath(2): '%S'\n", PathBuffer);
} }
@ -4321,7 +4318,7 @@ BootLoaderPage(PINPUT_RECORD Ir)
CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT)); CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT));
RtlFreeUnicodeString(&USetupData.SystemRootPath); RtlFreeUnicodeString(&USetupData.SystemRootPath);
StringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer), RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
L"\\Device\\Harddisk%lu\\Partition%lu\\", L"\\Device\\Harddisk%lu\\Partition%lu\\",
PartitionList->SystemPartition->DiskEntry->DiskNumber, PartitionList->SystemPartition->DiskEntry->DiskNumber,
PartitionList->SystemPartition->PartitionNumber); PartitionList->SystemPartition->PartitionNumber);
@ -4620,7 +4617,7 @@ BootLoaderHarddiskMbrPage(PINPUT_RECORD Ir)
} }
/* Step 2: Write the MBR */ /* Step 2: Write the MBR */
StringCchPrintfW(DestinationDevicePathBuffer, ARRAYSIZE(DestinationDevicePathBuffer), RtlStringCchPrintfW(DestinationDevicePathBuffer, ARRAYSIZE(DestinationDevicePathBuffer),
L"\\Device\\Harddisk%d\\Partition0", L"\\Device\\Harddisk%d\\Partition0",
PartitionList->SystemPartition->DiskEntry->DiskNumber); PartitionList->SystemPartition->DiskEntry->DiskNumber);
Status = InstallMbrBootCodeToDisk(&USetupData.SystemRootPath, Status = InstallMbrBootCodeToDisk(&USetupData.SystemRootPath,

View file

@ -52,6 +52,7 @@
#include <ntstrsafe.h> #include <ntstrsafe.h>
/* Setup library headers */ /* Setup library headers */
#include <reactos/rosioctl.h> #include <reactos/rosioctl.h>
#include <../lib/setuplib.h> #include <../lib/setuplib.h>