mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 21:03:00 +00:00
[USETUP][REACTOS] Check the status return value of InitDestinationPaths() (#1264)
- Within the function's body code, check the status values returned by the called functions. - Change the BuildInstallPaths's function type to NTSTATUS instead of VOID (and check the status of InitDestinationPaths() as well.
This commit is contained in:
parent
3cd3d896b7
commit
8bde4de2d6
3 changed files with 96 additions and 24 deletions
|
@ -628,18 +628,29 @@ InitDestinationPaths(
|
||||||
IN PPARTENTRY PartEntry) // FIXME: HACK!
|
IN PPARTENTRY PartEntry) // FIXME: HACK!
|
||||||
{
|
{
|
||||||
WCHAR PathBuffer[MAX_PATH];
|
WCHAR PathBuffer[MAX_PATH];
|
||||||
|
NTSTATUS Status;
|
||||||
//
|
|
||||||
// TODO: Check return status values of the functions!
|
|
||||||
//
|
|
||||||
|
|
||||||
/* Create 'pSetupData->DestinationRootPath' string */
|
/* Create 'pSetupData->DestinationRootPath' string */
|
||||||
RtlFreeUnicodeString(&pSetupData->DestinationRootPath);
|
RtlFreeUnicodeString(&pSetupData->DestinationRootPath);
|
||||||
RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
|
Status = RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
|
||||||
L"\\Device\\Harddisk%lu\\Partition%lu\\",
|
L"\\Device\\Harddisk%lu\\Partition%lu\\",
|
||||||
DiskEntry->DiskNumber,
|
DiskEntry->DiskNumber,
|
||||||
PartEntry->PartitionNumber);
|
PartEntry->PartitionNumber);
|
||||||
RtlCreateUnicodeString(&pSetupData->DestinationRootPath, PathBuffer);
|
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("RtlStringCchPrintfW() failed with status 0x%08lx\n", Status);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = RtlCreateUnicodeString(&pSetupData->DestinationRootPath, PathBuffer) ? STATUS_SUCCESS : STATUS_NO_MEMORY;
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("RtlCreateUnicodeString() failed with status 0x%08lx\n", Status);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
DPRINT("DestinationRootPath: %wZ\n", &pSetupData->DestinationRootPath);
|
DPRINT("DestinationRootPath: %wZ\n", &pSetupData->DestinationRootPath);
|
||||||
|
|
||||||
// FIXME! Which variable to choose?
|
// FIXME! Which variable to choose?
|
||||||
|
@ -649,23 +660,72 @@ InitDestinationPaths(
|
||||||
/** Equivalent of 'NTOS_INSTALLATION::SystemArcPath' **/
|
/** Equivalent of 'NTOS_INSTALLATION::SystemArcPath' **/
|
||||||
/* Create 'pSetupData->DestinationArcPath' */
|
/* Create 'pSetupData->DestinationArcPath' */
|
||||||
RtlFreeUnicodeString(&pSetupData->DestinationArcPath);
|
RtlFreeUnicodeString(&pSetupData->DestinationArcPath);
|
||||||
RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
|
Status = 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->OnDiskPartitionNumber);
|
PartEntry->OnDiskPartitionNumber);
|
||||||
ConcatPaths(PathBuffer, ARRAYSIZE(PathBuffer), 1, InstallationDir);
|
|
||||||
RtlCreateUnicodeString(&pSetupData->DestinationArcPath, PathBuffer);
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("RtlStringCchPrintfW() failed with status 0x%08lx\n", Status);
|
||||||
|
RtlFreeUnicodeString(&pSetupData->DestinationRootPath);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = ConcatPaths(PathBuffer, ARRAYSIZE(PathBuffer), 1, InstallationDir);
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("ConcatPaths() failed with status 0x%08lx\n", Status);
|
||||||
|
RtlFreeUnicodeString(&pSetupData->DestinationRootPath);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = RtlCreateUnicodeString(&pSetupData->DestinationArcPath, PathBuffer) ? STATUS_SUCCESS : STATUS_NO_MEMORY;
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("RtlCreateUnicodeString() failed with status 0x%08lx\n", Status);
|
||||||
|
RtlFreeUnicodeString(&pSetupData->DestinationRootPath);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
/** Equivalent of 'NTOS_INSTALLATION::SystemNtPath' **/
|
/** Equivalent of 'NTOS_INSTALLATION::SystemNtPath' **/
|
||||||
/* Create 'pSetupData->DestinationPath' string */
|
/* Create 'pSetupData->DestinationPath' string */
|
||||||
RtlFreeUnicodeString(&pSetupData->DestinationPath);
|
RtlFreeUnicodeString(&pSetupData->DestinationPath);
|
||||||
CombinePaths(PathBuffer, ARRAYSIZE(PathBuffer), 2,
|
Status = CombinePaths(PathBuffer, ARRAYSIZE(PathBuffer), 2,
|
||||||
pSetupData->DestinationRootPath.Buffer, InstallationDir);
|
pSetupData->DestinationRootPath.Buffer, InstallationDir);
|
||||||
RtlCreateUnicodeString(&pSetupData->DestinationPath, PathBuffer);
|
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("CombinePaths() failed with status 0x%08lx\n", Status);
|
||||||
|
RtlFreeUnicodeString(&pSetupData->DestinationRootPath);
|
||||||
|
RtlFreeUnicodeString(&pSetupData->DestinationArcPath);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = RtlCreateUnicodeString(&pSetupData->DestinationPath, PathBuffer) ? STATUS_SUCCESS : STATUS_NO_MEMORY;
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("RtlCreateUnicodeString() failed with status 0x%08lx\n", Status);
|
||||||
|
RtlFreeUnicodeString(&pSetupData->DestinationRootPath);
|
||||||
|
RtlFreeUnicodeString(&pSetupData->DestinationArcPath);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
/** Equivalent of 'NTOS_INSTALLATION::PathComponent' **/
|
/** Equivalent of 'NTOS_INSTALLATION::PathComponent' **/
|
||||||
// FIXME: This is only temporary!! Must be removed later!
|
// FIXME: This is only temporary!! Must be removed later!
|
||||||
/***/RtlCreateUnicodeString(&pSetupData->InstallPath, InstallationDir);/***/
|
Status = RtlCreateUnicodeString(&pSetupData->InstallPath, InstallationDir) ? STATUS_SUCCESS : STATUS_NO_MEMORY;
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("RtlCreateUnicodeString() failed with status 0x%08lx\n", Status);
|
||||||
|
RtlFreeUnicodeString(&pSetupData->DestinationRootPath);
|
||||||
|
RtlFreeUnicodeString(&pSetupData->DestinationArcPath);
|
||||||
|
RtlFreeUnicodeString(&pSetupData->DestinationPath);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,9 @@
|
||||||
|
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
|
#define NDEBUG
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
/* GLOBALS ******************************************************************/
|
/* GLOBALS ******************************************************************/
|
||||||
|
|
||||||
#define IDS_LIST_COLUMN_FIRST IDS_PARTITION_NAME
|
#define IDS_LIST_COLUMN_FIRST IDS_PARTITION_NAME
|
||||||
|
@ -795,8 +798,11 @@ DisableWizNext:
|
||||||
Status = InitDestinationPaths(&pSetupData->USetupData,
|
Status = InitDestinationPaths(&pSetupData->USetupData,
|
||||||
NULL, // pSetupData->USetupData.InstallationDirectory,
|
NULL, // pSetupData->USetupData.InstallationDirectory,
|
||||||
&DiskEntry, &PartEntry);
|
&DiskEntry, &PartEntry);
|
||||||
// TODO: Check Status
|
|
||||||
UNREFERENCED_PARAMETER(Status);
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("InitDestinationPaths() failed with status 0x%08lx\n", Status);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3238,7 +3238,7 @@ CheckFileSystemPage(PINPUT_RECORD Ir)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static VOID
|
static NTSTATUS
|
||||||
BuildInstallPaths(PWSTR InstallDir,
|
BuildInstallPaths(PWSTR InstallDir,
|
||||||
PDISKENTRY DiskEntry,
|
PDISKENTRY DiskEntry,
|
||||||
PPARTENTRY PartEntry)
|
PPARTENTRY PartEntry)
|
||||||
|
@ -3246,11 +3246,17 @@ BuildInstallPaths(PWSTR InstallDir,
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
Status = InitDestinationPaths(&USetupData, InstallDir, DiskEntry, PartEntry);
|
Status = InitDestinationPaths(&USetupData, InstallDir, DiskEntry, PartEntry);
|
||||||
// TODO: Check Status
|
|
||||||
UNREFERENCED_PARAMETER(Status);
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("InitDestinationPaths() failed with status 0x%08lx\n", Status);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
/* Initialize DestinationDriveLetter */
|
/* Initialize DestinationDriveLetter */
|
||||||
DestinationDriveLetter = PartEntry->DriveLetter;
|
DestinationDriveLetter = PartEntry->DriveLetter;
|
||||||
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue