Change the MBR partition type to 0x0C when select FAT32 for installation.

This commit is contained in:
longpanda 2022-12-20 00:16:01 +08:00
parent 44a3e23740
commit 201f7cc13c
7 changed files with 11 additions and 5 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1587,7 +1587,7 @@ int InstallVentoy2FileImage(PHY_DRIVE_INFO *pPhyDrive, int PartStyle)
memset(pData, 0, 512);
pMBR = (MBR_HEAD *)pData;
VentoyFillMBR(pPhyDrive->SizeInBytes, pMBR, PartStyle);
VentoyFillMBR(pPhyDrive->SizeInBytes, pMBR, PartStyle, 0x07);
Part1StartSector = pMBR->PartTbl[0].StartSectorId;
Part1SectorCount = pMBR->PartTbl[0].SectorCount;
Part2StartSector = pMBR->PartTbl[1].StartSectorId;
@ -1751,6 +1751,7 @@ int InstallVentoy2PhyDrive(PHY_DRIVE_INFO *pPhyDrive, int PartStyle, int TryId)
UINT64 Part2StartSector = 0;
BOOL LargeFAT32 = FALSE;
BOOL DefaultExFAT = FALSE;
UINT8 FsFlag = 0x07;
Log("#####################################################");
Log("InstallVentoy2PhyDrive try%d %s PhyDrive%d <<%s %s %dGB>>", TryId,
@ -1775,7 +1776,12 @@ int InstallVentoy2PhyDrive(PHY_DRIVE_INFO *pPhyDrive, int PartStyle, int TryId)
}
else
{
VentoyFillMBR(pPhyDrive->SizeInBytes, &MBR, PartStyle);
if (GetVentoyFsType() == VTOY_FS_FAT32)
{
FsFlag = 0x0C;
}
VentoyFillMBR(pPhyDrive->SizeInBytes, &MBR, PartStyle, FsFlag);
Part1StartSector = MBR.PartTbl[0].StartSectorId;
Part1SectorCount = MBR.PartTbl[0].SectorCount;
Part2StartSector = MBR.PartTbl[1].StartSectorId;

View File

@ -669,7 +669,7 @@ int VentoyFillMBRLocation(UINT64 DiskSizeInBytes, UINT32 StartSectorId, UINT32 S
return 0;
}
int VentoyFillMBR(UINT64 DiskSizeBytes, MBR_HEAD *pMBR, int PartStyle)
int VentoyFillMBR(UINT64 DiskSizeBytes, MBR_HEAD *pMBR, int PartStyle, UINT8 FsFlag)
{
GUID Guid;
int ReservedValue;
@ -733,7 +733,7 @@ int VentoyFillMBR(UINT64 DiskSizeBytes, MBR_HEAD *pMBR, int PartStyle)
VentoyFillMBRLocation(DiskSizeBytes, PartStartSector, PartSectorCount, pMBR->PartTbl);
pMBR->PartTbl[0].Active = 0x80; // bootable
pMBR->PartTbl[0].FsFlag = 0x07; // exFAT/NTFS/HPFS
pMBR->PartTbl[0].FsFlag = FsFlag; // File system flag 07:exFAT/NTFS/HPFS 0C:FAT32
//Part2
PartStartSector += PartSectorCount;

View File

@ -238,7 +238,7 @@ const CHAR * GetBusTypeString(STORAGE_BUS_TYPE Type);
int VentoyGetLocalBootImg(MBR_HEAD *pMBR);
int GetHumanReadableGBSize(UINT64 SizeBytes);
void TrimString(CHAR *String);
int VentoyFillMBR(UINT64 DiskSizeBytes, MBR_HEAD *pMBR, int PartStyle);
int VentoyFillMBR(UINT64 DiskSizeBytes, MBR_HEAD *pMBR, int PartStyle, UINT8 FsFlag);
int VentoyFillGpt(UINT64 DiskSizeBytes, VTOY_GPT_INFO *pInfo);
BOOL IsVentoyLogicalDrive(CHAR DriveLetter);
int GetRegDwordValue(HKEY Key, LPCSTR SubKey, LPCSTR ValueName, DWORD *pValue);