0

我有一个带有 3 个分区的 USB 图像:

  • 分区 1:FAT32
  • 分区 2:exFAT
  • 分区 3:NTFS

我正在制作一个通过分区的程序,但我不确定如何知道我的程序应该查找多少个分区。通过查看原始数据,我可以看到它具有预期的三个分区,但是我的程序当然不知道这一点。

我试图查看“80(0x50)4 字节数组中的分区条目数”,但在我的示例中,它给了我值 128(0x80000000)。

这是我的示例图像中的十六进制屏幕截图。

保护性 MBR 在此处输入图像描述

分区表头 (LBA 1) 在此处输入图像描述

signature=- HexLe=4546492050415254 HexBe=5452415020494645
revisionHexLe=000001 HexLe=4546492050415254 HexBe=5452415020494645
headerSizeDec=92 HexLe=5C000000 HexBe=0000005C
crc2OfHeaderDec=82845332 HexLe=941EF004 HexBe=04F01E94
reservedADec=0 HexLe=00000000 HexBe=00000000
currentLBADec=1 HexLe=0100000000000000 HexBe=0000000000000001
backupLBADec=30277631 HexLe=FFFFCD0100000000 HexBe=0000000001CDFFFF
firstUsableLBAForPartitionsDec=34 HexLe=2200000000000000 HexBe=0000000000000022
lastUsableLBADec=30277598 HexLe=DEFFCD0100000000 HexBe=0000000001CDFFDE
diskGUIDHexMe=8B3F71C5AF9D744D9CA3EBFF7D1F9DC9
startingLBAOfArrayOfPartitionEntriesDec=2 HexLe=0200000000000000 HexBe=0000000000000002
numberOfPartitionEntriesInArrayDec=128 HexLe=80000000 HexBe=00000080
sizeOfASinglePartitionEntryDec=128 HexLe=80000000 HexBe=00000080
crc2OfPartitionEntriesArrayDec=-2043475264 HexLe=C00A3386 HexBe=86330AC0
reservedBDec=00000000 HexLe=00000000 HexBe=00000000
We are going to look for partitions now at offset 1024

分区条目 (LBA 2–33) 在此处输入图像描述

4

1 回答 1

0

Bit late, and you may have already figured it out by now.

Refer following figure from wiki page. Wiki page itself will provide you further information.

It is not possible to determine the number of partitions just by looking at the GUID partition table header at LBA1, you have to examine the partition entries and check whether the Partition type GUID says it is unused (all zeros) or not.

Number of partition entries in the header at offset 80 (=0x50) is the total number of entries as determined by the size of a single partition entry at offset 84.

gpt

于 2021-03-02T12:33:50.907 回答