+int VentoyFillWholeGpt(UINT64 DiskSizeBytes, VTOY_GPT_INFO *pInfo)\r
+{\r
+ UINT64 Part1SectorCount = 0;\r
+ UINT64 DiskSectorCount = DiskSizeBytes / 512;\r
+ VTOY_GPT_HDR *Head = &pInfo->Head;\r
+ VTOY_GPT_PART_TBL *Table = pInfo->PartTbl;\r
+ static GUID WindowsDataPartType = { 0xebd0a0a2, 0xb9e5, 0x4433, { 0x87, 0xc0, 0x68, 0xb6, 0xb7, 0x26, 0x99, 0xc7 } };\r
+\r
+ VentoyFillProtectMBR(DiskSizeBytes, &pInfo->MBR);\r
+\r
+ Part1SectorCount = DiskSectorCount - 33 - 2048;\r
+\r
+ memcpy(Head->Signature, "EFI PART", 8);\r
+ Head->Version[2] = 0x01;\r
+ Head->Length = 92;\r
+ Head->Crc = 0;\r
+ Head->EfiStartLBA = 1;\r
+ Head->EfiBackupLBA = DiskSectorCount - 1;\r
+ Head->PartAreaStartLBA = 34;\r
+ Head->PartAreaEndLBA = DiskSectorCount - 34;\r
+ CoCreateGuid(&Head->DiskGuid);\r
+ Head->PartTblStartLBA = 2;\r
+ Head->PartTblTotNum = 128;\r
+ Head->PartTblEntryLen = 128;\r
+\r
+\r
+ memcpy(&(Table[0].PartType), &WindowsDataPartType, sizeof(GUID));\r
+ CoCreateGuid(&(Table[0].PartGuid));\r
+ Table[0].StartLBA = 2048;\r
+ Table[0].LastLBA = 2048 + Part1SectorCount - 1;\r
+ Table[0].Attr = 0;\r
+ memcpy(Table[0].Name, L"Data", 4 * 2);\r
+\r
+ //Update CRC\r
+ Head->PartTblCrc = VentoyCrc32(Table, sizeof(pInfo->PartTbl));\r
+ Head->Crc = VentoyCrc32(Head, Head->Length);\r
+\r
+ return 0;\r
+}\r