Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
754e754412 | ||
|
5af01de7c2 | ||
|
f9763a44b2 | ||
|
d063dbb7f2 | ||
|
89938e3c78 | ||
|
85840f626b |
BIN
ICON/forums.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
ICON/logo_128.png
Normal file
After Width: | Height: | Size: 26 KiB |
BIN
ICON/logo_16.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
ICON/logo_256.png
Normal file
After Width: | Height: | Size: 76 KiB |
BIN
ICON/logo_32.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
ICON/logo_48.png
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
ICON/logo_512.png
Normal file
After Width: | Height: | Size: 223 KiB |
BIN
ICON/logo_64.png
Normal file
After Width: | Height: | Size: 7.7 KiB |
BIN
ICON/logo_72.png
Normal file
After Width: | Height: | Size: 9.0 KiB |
@@ -624,7 +624,7 @@ function efi_unsupport_menuentry {
|
|||||||
#############################################################
|
#############################################################
|
||||||
#############################################################
|
#############################################################
|
||||||
|
|
||||||
set VENTOY_VERSION="1.0.16"
|
set VENTOY_VERSION="1.0.17"
|
||||||
|
|
||||||
# Default menu display mode, you can change it as you want.
|
# Default menu display mode, you can change it as you want.
|
||||||
# 0: List mode
|
# 0: List mode
|
||||||
|
BIN
INSTALL/grub/i386-pc/file.mod
Normal file
BIN
INSTALL/grub/i386-pc/net.mod
Normal file
BIN
INSTALL/grub/i386-pc/pbkdf2.mod
Normal file
BIN
INSTALL/grub/x86_64-efi/efinet.mod
Normal file
BIN
INSTALL/grub/x86_64-efi/file.mod
Normal file
BIN
INSTALL/grub/x86_64-efi/help.mod
Normal file
BIN
INSTALL/grub/x86_64-efi/time.mod
Normal file
@@ -1814,7 +1814,7 @@ int UpdateVentoy2PhyDrive(PHY_DRIVE_INFO *pPhyDrive)
|
|||||||
|
|
||||||
Log("Lock volume for update .......................... ");
|
Log("Lock volume for update .......................... ");
|
||||||
hVolume = INVALID_HANDLE_VALUE;
|
hVolume = INVALID_HANDLE_VALUE;
|
||||||
Status = GetVentoyVolumeName(pPhyDrive->PhyDrive, MBR.PartTbl[1].StartSectorId, DriveLetters, sizeof(DriveLetters), TRUE);
|
Status = GetVentoyVolumeName(pPhyDrive->PhyDrive, (UINT32)StartSector, DriveLetters, sizeof(DriveLetters), TRUE);
|
||||||
if (ERROR_SUCCESS == Status)
|
if (ERROR_SUCCESS == Status)
|
||||||
{
|
{
|
||||||
Log("Now lock and dismount volume <%s>", DriveLetters);
|
Log("Now lock and dismount volume <%s>", DriveLetters);
|
||||||
@@ -1852,24 +1852,26 @@ int UpdateVentoy2PhyDrive(PHY_DRIVE_INFO *pPhyDrive)
|
|||||||
|
|
||||||
if (!TryWritePart2(hDrive, StartSector))
|
if (!TryWritePart2(hDrive, StartSector))
|
||||||
{
|
{
|
||||||
ForceMBR = TRUE;
|
if (pPhyDrive->PartStyle == 0)
|
||||||
Log("Try write failed, now delete partition 2...");
|
{
|
||||||
|
ForceMBR = TRUE;
|
||||||
|
Log("Try write failed, now delete partition 2...");
|
||||||
|
|
||||||
CHECK_CLOSE_HANDLE(hDrive);
|
CHECK_CLOSE_HANDLE(hDrive);
|
||||||
|
|
||||||
Log("Now delete partition 2...");
|
Log("Now delete partition 2...");
|
||||||
DeletePartitions(pPhyDrive->PhyDrive, TRUE);
|
DeletePartitions(pPhyDrive->PhyDrive, TRUE);
|
||||||
|
|
||||||
hDrive = GetPhysicalHandle(pPhyDrive->PhyDrive, TRUE, TRUE, FALSE);
|
hDrive = GetPhysicalHandle(pPhyDrive->PhyDrive, TRUE, TRUE, FALSE);
|
||||||
if (hDrive == INVALID_HANDLE_VALUE)
|
if (hDrive == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
Log("Failed to GetPhysicalHandle for write.");
|
Log("Failed to GetPhysicalHandle for write.");
|
||||||
rc = 1;
|
rc = 1;
|
||||||
goto End;
|
goto End;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PROGRESS_BAR_SET_POS(PT_FORMAT_PART2);
|
PROGRESS_BAR_SET_POS(PT_FORMAT_PART2);
|
||||||
|
|
||||||
Log("Write Ventoy to disk ............................ ");
|
Log("Write Ventoy to disk ............................ ");
|
||||||
|
@@ -588,7 +588,7 @@ int VentoyFillGpt(UINT64 DiskSizeBytes, VTOY_GPT_INFO *pInfo)
|
|||||||
CoCreateGuid(&(Table[1].PartGuid));
|
CoCreateGuid(&(Table[1].PartGuid));
|
||||||
Table[1].StartLBA = Table[0].LastLBA + 1;
|
Table[1].StartLBA = Table[0].LastLBA + 1;
|
||||||
Table[1].LastLBA = Table[1].StartLBA + VENTOY_EFI_PART_SIZE / 512 - 1;
|
Table[1].LastLBA = Table[1].StartLBA + VENTOY_EFI_PART_SIZE / 512 - 1;
|
||||||
Table[1].Attr = 0xC000000000000001ULL;
|
Table[1].Attr = 0x8000000000000001ULL;
|
||||||
memcpy(Table[1].Name, L"VTOYEFI", 7 * 2);
|
memcpy(Table[1].Name, L"VTOYEFI", 7 * 2);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@@ -244,7 +244,7 @@ int DumpGptInfo(VTOY_GPT_INFO *pGptInfo)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define VENTOY_EFI_PART_ATTR 0xC000000000000001ULL
|
#define VENTOY_EFI_PART_ATTR 0x8000000000000001ULL
|
||||||
|
|
||||||
int main(int argc, const char **argv)
|
int main(int argc, const char **argv)
|
||||||
{
|
{
|
||||||
|
@@ -513,6 +513,55 @@ static CHAR GetMountLogicalDrive(void)
|
|||||||
return Letter;
|
return Letter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UINT64 GetVentoyEfiPartStartSector(HANDLE hDrive)
|
||||||
|
{
|
||||||
|
BOOL bRet;
|
||||||
|
DWORD dwSize;
|
||||||
|
MBR_HEAD MBR;
|
||||||
|
VTOY_GPT_INFO *pGpt = NULL;
|
||||||
|
UINT64 StartSector = 0;
|
||||||
|
|
||||||
|
SetFilePointer(hDrive, 0, NULL, FILE_BEGIN);
|
||||||
|
|
||||||
|
bRet = ReadFile(hDrive, &MBR, sizeof(MBR), &dwSize, NULL);
|
||||||
|
Log("Read MBR Ret:%u Size:%u code:%u", bRet, dwSize, LASTERR);
|
||||||
|
|
||||||
|
if ((!bRet) || (dwSize != sizeof(MBR)))
|
||||||
|
{
|
||||||
|
0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (MBR.PartTbl[0].FsFlag == 0xEE)
|
||||||
|
{
|
||||||
|
Log("GPT partition style");
|
||||||
|
|
||||||
|
pGpt = malloc(sizeof(VTOY_GPT_INFO));
|
||||||
|
if (!pGpt)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetFilePointer(hDrive, 0, NULL, FILE_BEGIN);
|
||||||
|
bRet = ReadFile(hDrive, pGpt, sizeof(VTOY_GPT_INFO), &dwSize, NULL);
|
||||||
|
if ((!bRet) || (dwSize != sizeof(VTOY_GPT_INFO)))
|
||||||
|
{
|
||||||
|
Log("Failed to read gpt info %d %u %d", bRet, dwSize, LASTERR);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
StartSector = pGpt->PartTbl[1].StartLBA;
|
||||||
|
free(pGpt);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Log("MBR partition style");
|
||||||
|
StartSector = MBR.PartTbl[1].StartSectorId;
|
||||||
|
}
|
||||||
|
|
||||||
|
Log("GetVentoyEfiPart StartSector: %llu", StartSector);
|
||||||
|
return StartSector;
|
||||||
|
}
|
||||||
|
|
||||||
int VentoyMountISOByImdisk(const char *IsoPath, DWORD PhyDrive)
|
int VentoyMountISOByImdisk(const char *IsoPath, DWORD PhyDrive)
|
||||||
{
|
{
|
||||||
int rc = 1;
|
int rc = 1;
|
||||||
@@ -543,7 +592,7 @@ int VentoyMountISOByImdisk(const char *IsoPath, DWORD PhyDrive)
|
|||||||
}
|
}
|
||||||
|
|
||||||
g_FatPhyDrive = hDrive;
|
g_FatPhyDrive = hDrive;
|
||||||
g_Part2StartSec = (LengthInfo.Length.QuadPart - VENTOY_EFI_PART_SIZE) / 512;
|
g_Part2StartSec = GetVentoyEfiPartStartSector(hDrive);
|
||||||
|
|
||||||
Log("Parse FAT fs...");
|
Log("Parse FAT fs...");
|
||||||
|
|
||||||
@@ -778,7 +827,7 @@ static int DecompressInjectionArchive(const char *archive, DWORD PhyDrive)
|
|||||||
}
|
}
|
||||||
|
|
||||||
g_FatPhyDrive = hDrive;
|
g_FatPhyDrive = hDrive;
|
||||||
g_Part2StartSec = (LengthInfo.Length.QuadPart - VENTOY_EFI_PART_SIZE) / 512;
|
g_Part2StartSec = GetVentoyEfiPartStartSector(hDrive);
|
||||||
|
|
||||||
Log("Parse FAT fs...");
|
Log("Parse FAT fs...");
|
||||||
|
|
||||||
|
@@ -72,6 +72,72 @@ typedef struct ventoy_windows_data
|
|||||||
UINT8 reserved[256];
|
UINT8 reserved[256];
|
||||||
}ventoy_windows_data;
|
}ventoy_windows_data;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct PART_TABLE
|
||||||
|
{
|
||||||
|
UINT8 Active; // 0x00 0x80
|
||||||
|
|
||||||
|
UINT8 StartHead;
|
||||||
|
UINT16 StartSector : 6;
|
||||||
|
UINT16 StartCylinder : 10;
|
||||||
|
|
||||||
|
UINT8 FsFlag;
|
||||||
|
|
||||||
|
UINT8 EndHead;
|
||||||
|
UINT16 EndSector : 6;
|
||||||
|
UINT16 EndCylinder : 10;
|
||||||
|
|
||||||
|
UINT32 StartSectorId;
|
||||||
|
UINT32 SectorCount;
|
||||||
|
}PART_TABLE;
|
||||||
|
|
||||||
|
typedef struct MBR_HEAD
|
||||||
|
{
|
||||||
|
UINT8 BootCode[446];
|
||||||
|
PART_TABLE PartTbl[4];
|
||||||
|
UINT8 Byte55;
|
||||||
|
UINT8 ByteAA;
|
||||||
|
}MBR_HEAD;
|
||||||
|
|
||||||
|
typedef struct VTOY_GPT_HDR
|
||||||
|
{
|
||||||
|
CHAR Signature[8]; /* EFI PART */
|
||||||
|
UINT8 Version[4];
|
||||||
|
UINT32 Length;
|
||||||
|
UINT32 Crc;
|
||||||
|
UINT8 Reserved1[4];
|
||||||
|
UINT64 EfiStartLBA;
|
||||||
|
UINT64 EfiBackupLBA;
|
||||||
|
UINT64 PartAreaStartLBA;
|
||||||
|
UINT64 PartAreaEndLBA;
|
||||||
|
GUID DiskGuid;
|
||||||
|
UINT64 PartTblStartLBA;
|
||||||
|
UINT32 PartTblTotNum;
|
||||||
|
UINT32 PartTblEntryLen;
|
||||||
|
UINT32 PartTblCrc;
|
||||||
|
UINT8 Reserved2[420];
|
||||||
|
}VTOY_GPT_HDR;
|
||||||
|
|
||||||
|
typedef struct VTOY_GPT_PART_TBL
|
||||||
|
{
|
||||||
|
GUID PartType;
|
||||||
|
GUID PartGuid;
|
||||||
|
UINT64 StartLBA;
|
||||||
|
UINT64 LastLBA;
|
||||||
|
UINT64 Attr;
|
||||||
|
UINT16 Name[36];
|
||||||
|
}VTOY_GPT_PART_TBL;
|
||||||
|
|
||||||
|
typedef struct VTOY_GPT_INFO
|
||||||
|
{
|
||||||
|
MBR_HEAD MBR;
|
||||||
|
VTOY_GPT_HDR Head;
|
||||||
|
VTOY_GPT_PART_TBL PartTbl[128];
|
||||||
|
}VTOY_GPT_INFO;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#pragma pack()
|
#pragma pack()
|
||||||
|
|
||||||
|
|
||||||
@@ -84,5 +150,6 @@ typedef struct ventoy_windows_data
|
|||||||
}\
|
}\
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define LASTERR GetLastError()
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|