mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 20:15:59 +00:00
[SETUPLIB][REACTOS][USETUP] Don't export setup data. Make IsUnattendedSetup local to the installer.
This commit is contained in:
parent
8d80203d65
commit
8e53386de9
10 changed files with 89 additions and 99 deletions
|
@ -19,7 +19,8 @@
|
||||||
#include "bootcode.h"
|
#include "bootcode.h"
|
||||||
#include "fsutil.h"
|
#include "fsutil.h"
|
||||||
|
|
||||||
#include "setuplib.h" // HACK for IsUnattendedSetup
|
#include "setuplib.h"
|
||||||
|
extern BOOLEAN IsUnattendedSetup; // HACK
|
||||||
|
|
||||||
#include "bootsup.h"
|
#include "bootsup.h"
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ BOOLEAN IsUnattendedSetup = FALSE;
|
||||||
|
|
||||||
/* FUNCTIONS ****************************************************************/
|
/* FUNCTIONS ****************************************************************/
|
||||||
|
|
||||||
VOID
|
BOOLEAN
|
||||||
NTAPI
|
NTAPI
|
||||||
CheckUnattendedSetup(
|
CheckUnattendedSetup(
|
||||||
IN OUT PUSETUP_DATA pSetupData)
|
IN OUT PUSETUP_DATA pSetupData)
|
||||||
|
@ -47,7 +47,7 @@ CheckUnattendedSetup(
|
||||||
if (DoesFileExist(NULL, UnattendInfPath) == FALSE)
|
if (DoesFileExist(NULL, UnattendInfPath) == FALSE)
|
||||||
{
|
{
|
||||||
DPRINT("Does not exist: %S\n", UnattendInfPath);
|
DPRINT("Does not exist: %S\n", UnattendInfPath);
|
||||||
return;
|
return IsUnattendedSetup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Load 'unattend.inf' from installation media */
|
/* Load 'unattend.inf' from installation media */
|
||||||
|
@ -59,7 +59,7 @@ CheckUnattendedSetup(
|
||||||
if (UnattendInf == INVALID_HANDLE_VALUE)
|
if (UnattendInf == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
DPRINT("SpInfOpenInfFile() failed\n");
|
DPRINT("SpInfOpenInfFile() failed\n");
|
||||||
return;
|
return IsUnattendedSetup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Open 'Unattend' section */
|
/* Open 'Unattend' section */
|
||||||
|
@ -200,6 +200,7 @@ CheckUnattendedSetup(
|
||||||
|
|
||||||
Quit:
|
Quit:
|
||||||
SpInfCloseInfFile(UnattendInf);
|
SpInfCloseInfFile(UnattendInf);
|
||||||
|
return IsUnattendedSetup;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
|
|
@ -30,8 +30,6 @@ extern "C" {
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern SPLIBAPI BOOLEAN IsUnattendedSetup; // HACK
|
|
||||||
|
|
||||||
/* NOTE: Please keep the header inclusion order! */
|
/* NOTE: Please keep the header inclusion order! */
|
||||||
|
|
||||||
#include "errorcode.h"
|
#include "errorcode.h"
|
||||||
|
@ -167,7 +165,7 @@ typedef struct _USETUP_DATA
|
||||||
|
|
||||||
#include "substset.h"
|
#include "substset.h"
|
||||||
|
|
||||||
VOID
|
BOOLEAN
|
||||||
NTAPI
|
NTAPI
|
||||||
CheckUnattendedSetup(
|
CheckUnattendedSetup(
|
||||||
IN OUT PUSETUP_DATA pSetupData);
|
IN OUT PUSETUP_DATA pSetupData);
|
||||||
|
|
|
@ -1,8 +1,4 @@
|
||||||
|
|
||||||
@ extern IsUnattendedSetup
|
|
||||||
@ extern MbrPartitionTypes
|
|
||||||
@ extern GptPartitionTypes
|
|
||||||
|
|
||||||
;; fileqsup and infsupp function pointers to be initialized by the user of this library
|
;; fileqsup and infsupp function pointers to be initialized by the user of this library
|
||||||
;;@ extern SpFileExports
|
;;@ extern SpFileExports
|
||||||
;;@ extern SpInfExports
|
;;@ extern SpInfExports
|
||||||
|
@ -10,7 +6,6 @@
|
||||||
;; infsupp
|
;; infsupp
|
||||||
@ cdecl INF_GetDataField(ptr long ptr) ## -private
|
@ cdecl INF_GetDataField(ptr long ptr) ## -private
|
||||||
|
|
||||||
|
|
||||||
;; filesup
|
;; filesup
|
||||||
@ cdecl ConcatPathsV(ptr long long ptr)
|
@ cdecl ConcatPathsV(ptr long long ptr)
|
||||||
@ cdecl CombinePathsV(ptr long long ptr)
|
@ cdecl CombinePathsV(ptr long long ptr)
|
||||||
|
@ -44,6 +39,9 @@
|
||||||
@ cdecl IsPartitionActive(ptr) ## -private
|
@ cdecl IsPartitionActive(ptr) ## -private
|
||||||
@ cdecl SelectPartition(ptr long long)
|
@ cdecl SelectPartition(ptr long long)
|
||||||
|
|
||||||
|
;; partinfo
|
||||||
|
@ stdcall LookupPartitionTypeString(long ptr)
|
||||||
|
|
||||||
;; osdetect
|
;; osdetect
|
||||||
@ stdcall CreateNTOSInstallationsList(ptr)
|
@ stdcall CreateNTOSInstallationsList(ptr)
|
||||||
@ stdcall FindSubStrI(wstr wstr)
|
@ stdcall FindSubStrI(wstr wstr)
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
/*
|
/*
|
||||||
* PROJECT: ReactOS Setup Library
|
* PROJECT: ReactOS Setup Library
|
||||||
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
|
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
|
||||||
* PURPOSE: MBR and GPT Partition types
|
* PURPOSE: MBR and GPT Partition types
|
||||||
* COPYRIGHT: Copyright 2018-2020 Hermes Belusca-Maito
|
* COPYRIGHT: Copyright 2018-2025 Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
#include "partinfo.h"
|
#include "partinfo.h"
|
||||||
|
|
||||||
/* MBR PARTITION TYPES ******************************************************/
|
/* MBR PARTITION TYPES *******************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This partition type list is based from:
|
* This partition type list is based from:
|
||||||
|
@ -42,8 +42,14 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
typedef struct _MBR_PARTITION_TYPE
|
||||||
|
{
|
||||||
|
UCHAR Type;
|
||||||
|
PCSTR Description;
|
||||||
|
} MBR_PARTITION_TYPE, *PMBR_PARTITION_TYPE;
|
||||||
|
|
||||||
/* Known MBR partition type codes and descriptions */
|
/* Known MBR partition type codes and descriptions */
|
||||||
const MBR_PARTITION_TYPE MbrPartitionTypes[NUM_MBR_PARTITION_TYPES] =
|
const MBR_PARTITION_TYPE MbrPartitionTypes[] =
|
||||||
{
|
{
|
||||||
{ 0x00, "(Empty)" }, // PARTITION_ENTRY_UNUSED
|
{ 0x00, "(Empty)" }, // PARTITION_ENTRY_UNUSED
|
||||||
{ 0x01, "FAT12" }, // PARTITION_FAT_12
|
{ 0x01, "FAT12" }, // PARTITION_FAT_12
|
||||||
|
@ -201,7 +207,7 @@ const MBR_PARTITION_TYPE MbrPartitionTypes[NUM_MBR_PARTITION_TYPES] =
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* GPT PARTITION TYPES ******************************************************/
|
/* GPT PARTITION TYPES *******************************************************/
|
||||||
|
|
||||||
#define GUID_CONST(l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
#define GUID_CONST(l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
||||||
{ l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
|
{ l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
|
||||||
|
@ -267,8 +273,14 @@ DEFINE_GUID(PARTITION_DPP_GUID, 0x57434F53, 0x94CB, 0x43F0, 0xA5, 0
|
||||||
* https://www.magnumdb.com/search?q=PARTITION_*
|
* https://www.magnumdb.com/search?q=PARTITION_*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
typedef struct _GPT_PARTITION_TYPE
|
||||||
|
{
|
||||||
|
GUID Guid;
|
||||||
|
PCSTR Description;
|
||||||
|
} GPT_PARTITION_TYPE, *PGPT_PARTITION_TYPE;
|
||||||
|
|
||||||
/* Known GPT partition type GUIDs and descriptions */
|
/* Known GPT partition type GUIDs and descriptions */
|
||||||
const GPT_PARTITION_TYPE GptPartitionTypes[NUM_GPT_PARTITION_TYPES] =
|
const GPT_PARTITION_TYPE GptPartitionTypes[] =
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* EFI specification
|
* EFI specification
|
||||||
|
@ -784,4 +796,44 @@ const GPT_PARTITION_TYPE GptPartitionTypes[NUM_GPT_PARTITION_TYPES] =
|
||||||
"ArcaOS Type 1" },
|
"ArcaOS Type 1" },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* PARTITION TYPES LOOKUP ****************************************************/
|
||||||
|
|
||||||
|
PCSTR
|
||||||
|
NTAPI
|
||||||
|
LookupPartitionTypeString(
|
||||||
|
_In_ PARTITION_STYLE PartitionStyle,
|
||||||
|
_In_ PVOID PartitionType)
|
||||||
|
{
|
||||||
|
UINT i;
|
||||||
|
|
||||||
|
/* Do the table lookup */
|
||||||
|
if (PartitionStyle == PARTITION_STYLE_MBR)
|
||||||
|
{
|
||||||
|
for (i = 0; i < _countof(MbrPartitionTypes); ++i)
|
||||||
|
{
|
||||||
|
if (*(PUCHAR)PartitionType == MbrPartitionTypes[i].Type)
|
||||||
|
{
|
||||||
|
return MbrPartitionTypes[i].Description;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#if 0 // TODO: GPT support!
|
||||||
|
else if (PartitionStyle == PARTITION_STYLE_GPT)
|
||||||
|
{
|
||||||
|
for (i = 0; i < _countof(GptPartitionTypes); ++i)
|
||||||
|
{
|
||||||
|
if (IsEqualPartitionType((PGUID)PartitionType,
|
||||||
|
&GptPartitionTypes[i].Guid))
|
||||||
|
{
|
||||||
|
return GptPartitionTypes[i].Description;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The partition type is unknown */
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -1,32 +1,16 @@
|
||||||
/*
|
/*
|
||||||
* PROJECT: ReactOS Setup Library
|
* PROJECT: ReactOS Setup Library
|
||||||
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
|
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
|
||||||
* PURPOSE: MBR and GPT Partition types
|
* PURPOSE: MBR and GPT Partition types
|
||||||
* COPYRIGHT: Copyright 2018-2020 Hermes Belusca-Maito
|
* COPYRIGHT: Copyright 2018-2025 Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
/* MBR PARTITION TYPES ******************************************************/
|
PCSTR
|
||||||
|
NTAPI
|
||||||
typedef struct _MBR_PARTITION_TYPE
|
LookupPartitionTypeString(
|
||||||
{
|
_In_ PARTITION_STYLE PartitionStyle,
|
||||||
UCHAR Type;
|
_In_ PVOID PartitionType);
|
||||||
PCSTR Description;
|
|
||||||
} MBR_PARTITION_TYPE, *PMBR_PARTITION_TYPE;
|
|
||||||
|
|
||||||
#define NUM_MBR_PARTITION_TYPES 153
|
|
||||||
extern SPLIBAPI const MBR_PARTITION_TYPE MbrPartitionTypes[NUM_MBR_PARTITION_TYPES];
|
|
||||||
|
|
||||||
/* GPT PARTITION TYPES ******************************************************/
|
|
||||||
|
|
||||||
typedef struct _GPT_PARTITION_TYPE
|
|
||||||
{
|
|
||||||
GUID Guid;
|
|
||||||
PCSTR Description;
|
|
||||||
} GPT_PARTITION_TYPE, *PGPT_PARTITION_TYPE;
|
|
||||||
|
|
||||||
#define NUM_GPT_PARTITION_TYPES 177
|
|
||||||
extern SPLIBAPI const GPT_PARTITION_TYPE GptPartitionTypes[NUM_GPT_PARTITION_TYPES];
|
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -896,36 +896,14 @@ GetPartitionTypeString(
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UINT i;
|
|
||||||
|
|
||||||
/* Do the table lookup */
|
/* Do the table lookup */
|
||||||
if (PartEntry->DiskEntry->DiskStyle == PARTITION_STYLE_MBR)
|
PCSTR Description = LookupPartitionTypeString(PartEntry->DiskEntry->DiskStyle,
|
||||||
|
&PartEntry->PartitionType);
|
||||||
|
if (Description)
|
||||||
{
|
{
|
||||||
for (i = 0; i < ARRAYSIZE(MbrPartitionTypes); ++i)
|
StringCchCopyA(strBuffer, cchBuffer, Description);
|
||||||
{
|
return;
|
||||||
if (PartEntry->PartitionType == MbrPartitionTypes[i].Type)
|
|
||||||
{
|
|
||||||
StringCchCopyA(strBuffer, cchBuffer,
|
|
||||||
MbrPartitionTypes[i].Description);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#if 0 // TODO: GPT support!
|
|
||||||
else if (PartEntry->DiskEntry->DiskStyle == PARTITION_STYLE_GPT)
|
|
||||||
{
|
|
||||||
for (i = 0; i < ARRAYSIZE(GptPartitionTypes); ++i)
|
|
||||||
{
|
|
||||||
if (IsEqualPartitionType(PartEntry->PartitionType,
|
|
||||||
GptPartitionTypes[i].Guid))
|
|
||||||
{
|
|
||||||
StringCchCopyA(strBuffer, cchBuffer,
|
|
||||||
GptPartitionTypes[i].Description);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* We are here because the partition type is unknown */
|
/* We are here because the partition type is unknown */
|
||||||
if (cchBuffer > 0) *strBuffer = '\0';
|
if (cchBuffer > 0) *strBuffer = '\0';
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
|
|
||||||
HANDLE ProcessHeap;
|
HANDLE ProcessHeap;
|
||||||
SETUPDATA SetupData;
|
SETUPDATA SetupData;
|
||||||
|
static BOOLEAN IsUnattendedSetup;
|
||||||
|
|
||||||
/* The partition where to perform the installation */
|
/* The partition where to perform the installation */
|
||||||
PPARTENTRY InstallPartition = NULL;
|
PPARTENTRY InstallPartition = NULL;
|
||||||
|
@ -2880,8 +2881,7 @@ _tWinMain(HINSTANCE hInst,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Retrieve any supplemental options from the unattend file */
|
/* Retrieve any supplemental options from the unattend file */
|
||||||
CheckUnattendedSetup(&SetupData.USetupData);
|
SetupData.bUnattend = IsUnattendedSetup = CheckUnattendedSetup(&SetupData.USetupData);
|
||||||
SetupData.bUnattend = IsUnattendedSetup; // FIXME :-)
|
|
||||||
|
|
||||||
/* Load extra setup data (HW lists etc...) */
|
/* Load extra setup data (HW lists etc...) */
|
||||||
if (!LoadSetupData(&SetupData))
|
if (!LoadSetupData(&SetupData))
|
||||||
|
|
|
@ -49,36 +49,14 @@ GetPartitionTypeString(
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UINT i;
|
|
||||||
|
|
||||||
/* Do the table lookup */
|
/* Do the table lookup */
|
||||||
if (PartEntry->DiskEntry->DiskStyle == PARTITION_STYLE_MBR)
|
PCSTR Description = LookupPartitionTypeString(PartEntry->DiskEntry->DiskStyle,
|
||||||
|
&PartEntry->PartitionType);
|
||||||
|
if (Description)
|
||||||
{
|
{
|
||||||
for (i = 0; i < ARRAYSIZE(MbrPartitionTypes); ++i)
|
RtlStringCchCopyA(strBuffer, cchBuffer, Description);
|
||||||
{
|
return;
|
||||||
if (PartEntry->PartitionType == MbrPartitionTypes[i].Type)
|
|
||||||
{
|
|
||||||
RtlStringCchCopyA(strBuffer, cchBuffer,
|
|
||||||
MbrPartitionTypes[i].Description);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#if 0 // TODO: GPT support!
|
|
||||||
else if (PartEntry->DiskEntry->DiskStyle == PARTITION_STYLE_GPT)
|
|
||||||
{
|
|
||||||
for (i = 0; i < ARRAYSIZE(GptPartitionTypes); ++i)
|
|
||||||
{
|
|
||||||
if (IsEqualPartitionType(PartEntry->PartitionType,
|
|
||||||
GptPartitionTypes[i].Guid))
|
|
||||||
{
|
|
||||||
RtlStringCchCopyA(strBuffer, cchBuffer,
|
|
||||||
GptPartitionTypes[i].Description);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* We are here because the partition type is unknown */
|
/* We are here because the partition type is unknown */
|
||||||
if (cchBuffer > 0) *strBuffer = '\0';
|
if (cchBuffer > 0) *strBuffer = '\0';
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
HANDLE ProcessHeap;
|
HANDLE ProcessHeap;
|
||||||
|
|
||||||
static USETUP_DATA USetupData;
|
static USETUP_DATA USetupData;
|
||||||
|
static BOOLEAN IsUnattendedSetup;
|
||||||
|
|
||||||
/* The partition where to perform the installation */
|
/* The partition where to perform the installation */
|
||||||
static PPARTENTRY InstallPartition = NULL;
|
static PPARTENTRY InstallPartition = NULL;
|
||||||
|
@ -604,8 +605,7 @@ SetupStartPage(PINPUT_RECORD Ir)
|
||||||
if (WaitNoPendingInstallEvents(NULL) != STATUS_WAIT_0)
|
if (WaitNoPendingInstallEvents(NULL) != STATUS_WAIT_0)
|
||||||
DPRINT1("WaitNoPendingInstallEvents() failed to wait!\n");
|
DPRINT1("WaitNoPendingInstallEvents() failed to wait!\n");
|
||||||
|
|
||||||
CheckUnattendedSetup(&USetupData);
|
IsUnattendedSetup = CheckUnattendedSetup(&USetupData);
|
||||||
|
|
||||||
if (IsUnattendedSetup)
|
if (IsUnattendedSetup)
|
||||||
{
|
{
|
||||||
// TODO: Read options from inf
|
// TODO: Read options from inf
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue