mirror of
https://github.com/reactos/reactos.git
synced 2025-07-28 11:21: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 "fsutil.h"
|
||||
|
||||
#include "setuplib.h" // HACK for IsUnattendedSetup
|
||||
#include "setuplib.h"
|
||||
extern BOOLEAN IsUnattendedSetup; // HACK
|
||||
|
||||
#include "bootsup.h"
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ BOOLEAN IsUnattendedSetup = FALSE;
|
|||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
VOID
|
||||
BOOLEAN
|
||||
NTAPI
|
||||
CheckUnattendedSetup(
|
||||
IN OUT PUSETUP_DATA pSetupData)
|
||||
|
@ -47,7 +47,7 @@ CheckUnattendedSetup(
|
|||
if (DoesFileExist(NULL, UnattendInfPath) == FALSE)
|
||||
{
|
||||
DPRINT("Does not exist: %S\n", UnattendInfPath);
|
||||
return;
|
||||
return IsUnattendedSetup;
|
||||
}
|
||||
|
||||
/* Load 'unattend.inf' from installation media */
|
||||
|
@ -59,7 +59,7 @@ CheckUnattendedSetup(
|
|||
if (UnattendInf == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
DPRINT("SpInfOpenInfFile() failed\n");
|
||||
return;
|
||||
return IsUnattendedSetup;
|
||||
}
|
||||
|
||||
/* Open 'Unattend' section */
|
||||
|
@ -200,6 +200,7 @@ CheckUnattendedSetup(
|
|||
|
||||
Quit:
|
||||
SpInfCloseInfFile(UnattendInf);
|
||||
return IsUnattendedSetup;
|
||||
}
|
||||
|
||||
VOID
|
||||
|
|
|
@ -30,8 +30,6 @@ extern "C" {
|
|||
|
||||
#endif
|
||||
|
||||
extern SPLIBAPI BOOLEAN IsUnattendedSetup; // HACK
|
||||
|
||||
/* NOTE: Please keep the header inclusion order! */
|
||||
|
||||
#include "errorcode.h"
|
||||
|
@ -167,7 +165,7 @@ typedef struct _USETUP_DATA
|
|||
|
||||
#include "substset.h"
|
||||
|
||||
VOID
|
||||
BOOLEAN
|
||||
NTAPI
|
||||
CheckUnattendedSetup(
|
||||
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
|
||||
;;@ extern SpFileExports
|
||||
;;@ extern SpInfExports
|
||||
|
@ -10,7 +6,6 @@
|
|||
;; infsupp
|
||||
@ cdecl INF_GetDataField(ptr long ptr) ## -private
|
||||
|
||||
|
||||
;; filesup
|
||||
@ cdecl ConcatPathsV(ptr long long ptr)
|
||||
@ cdecl CombinePathsV(ptr long long ptr)
|
||||
|
@ -44,6 +39,9 @@
|
|||
@ cdecl IsPartitionActive(ptr) ## -private
|
||||
@ cdecl SelectPartition(ptr long long)
|
||||
|
||||
;; partinfo
|
||||
@ stdcall LookupPartitionTypeString(long ptr)
|
||||
|
||||
;; osdetect
|
||||
@ stdcall CreateNTOSInstallationsList(ptr)
|
||||
@ stdcall FindSubStrI(wstr wstr)
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/*
|
||||
* 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
|
||||
* 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 "partinfo.h"
|
||||
|
||||
/* MBR PARTITION TYPES ******************************************************/
|
||||
/* MBR PARTITION TYPES *******************************************************/
|
||||
|
||||
/*
|
||||
* This partition type list is based from:
|
||||
|
@ -42,8 +42,14 @@
|
|||
* 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 */
|
||||
const MBR_PARTITION_TYPE MbrPartitionTypes[NUM_MBR_PARTITION_TYPES] =
|
||||
const MBR_PARTITION_TYPE MbrPartitionTypes[] =
|
||||
{
|
||||
{ 0x00, "(Empty)" }, // PARTITION_ENTRY_UNUSED
|
||||
{ 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) \
|
||||
{ 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_*
|
||||
*/
|
||||
|
||||
typedef struct _GPT_PARTITION_TYPE
|
||||
{
|
||||
GUID Guid;
|
||||
PCSTR Description;
|
||||
} GPT_PARTITION_TYPE, *PGPT_PARTITION_TYPE;
|
||||
|
||||
/* Known GPT partition type GUIDs and descriptions */
|
||||
const GPT_PARTITION_TYPE GptPartitionTypes[NUM_GPT_PARTITION_TYPES] =
|
||||
const GPT_PARTITION_TYPE GptPartitionTypes[] =
|
||||
{
|
||||
/*
|
||||
* EFI specification
|
||||
|
@ -784,4 +796,44 @@ const GPT_PARTITION_TYPE GptPartitionTypes[NUM_GPT_PARTITION_TYPES] =
|
|||
"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 */
|
||||
|
|
|
@ -1,32 +1,16 @@
|
|||
/*
|
||||
* 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
|
||||
* COPYRIGHT: Copyright 2018-2020 Hermes Belusca-Maito
|
||||
* COPYRIGHT: Copyright 2018-2025 Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/* MBR PARTITION TYPES ******************************************************/
|
||||
|
||||
typedef struct _MBR_PARTITION_TYPE
|
||||
{
|
||||
UCHAR Type;
|
||||
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];
|
||||
PCSTR
|
||||
NTAPI
|
||||
LookupPartitionTypeString(
|
||||
_In_ PARTITION_STYLE PartitionStyle,
|
||||
_In_ PVOID PartitionType);
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -896,36 +896,14 @@ GetPartitionTypeString(
|
|||
}
|
||||
else
|
||||
{
|
||||
UINT i;
|
||||
|
||||
/* 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)
|
||||
{
|
||||
if (PartEntry->PartitionType == MbrPartitionTypes[i].Type)
|
||||
{
|
||||
StringCchCopyA(strBuffer, cchBuffer,
|
||||
MbrPartitionTypes[i].Description);
|
||||
return;
|
||||
}
|
||||
}
|
||||
StringCchCopyA(strBuffer, cchBuffer, 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 */
|
||||
if (cchBuffer > 0) *strBuffer = '\0';
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
|
||||
HANDLE ProcessHeap;
|
||||
SETUPDATA SetupData;
|
||||
static BOOLEAN IsUnattendedSetup;
|
||||
|
||||
/* The partition where to perform the installation */
|
||||
PPARTENTRY InstallPartition = NULL;
|
||||
|
@ -2880,8 +2881,7 @@ _tWinMain(HINSTANCE hInst,
|
|||
}
|
||||
|
||||
/* Retrieve any supplemental options from the unattend file */
|
||||
CheckUnattendedSetup(&SetupData.USetupData);
|
||||
SetupData.bUnattend = IsUnattendedSetup; // FIXME :-)
|
||||
SetupData.bUnattend = IsUnattendedSetup = CheckUnattendedSetup(&SetupData.USetupData);
|
||||
|
||||
/* Load extra setup data (HW lists etc...) */
|
||||
if (!LoadSetupData(&SetupData))
|
||||
|
|
|
@ -49,36 +49,14 @@ GetPartitionTypeString(
|
|||
}
|
||||
else
|
||||
{
|
||||
UINT i;
|
||||
|
||||
/* 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)
|
||||
{
|
||||
if (PartEntry->PartitionType == MbrPartitionTypes[i].Type)
|
||||
{
|
||||
RtlStringCchCopyA(strBuffer, cchBuffer,
|
||||
MbrPartitionTypes[i].Description);
|
||||
return;
|
||||
}
|
||||
}
|
||||
RtlStringCchCopyA(strBuffer, cchBuffer, 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 */
|
||||
if (cchBuffer > 0) *strBuffer = '\0';
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
HANDLE ProcessHeap;
|
||||
|
||||
static USETUP_DATA USetupData;
|
||||
static BOOLEAN IsUnattendedSetup;
|
||||
|
||||
/* The partition where to perform the installation */
|
||||
static PPARTENTRY InstallPartition = NULL;
|
||||
|
@ -604,8 +605,7 @@ SetupStartPage(PINPUT_RECORD Ir)
|
|||
if (WaitNoPendingInstallEvents(NULL) != STATUS_WAIT_0)
|
||||
DPRINT1("WaitNoPendingInstallEvents() failed to wait!\n");
|
||||
|
||||
CheckUnattendedSetup(&USetupData);
|
||||
|
||||
IsUnattendedSetup = CheckUnattendedSetup(&USetupData);
|
||||
if (IsUnattendedSetup)
|
||||
{
|
||||
// TODO: Read options from inf
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue