Synchronize with trunk's revision r57629.
[reactos.git] / ntoskrnl / fstub / fstubex.c
index 5f99ce8..26c6106 100644 (file)
@@ -53,27 +53,6 @@ typedef struct _EFI_PARTITION_ENTRY
     WCHAR Name[0x24];      // 56
 } EFI_PARTITION_ENTRY, *PEFI_PARTITION_ENTRY;
 
-typedef struct _CREATE_DISK_MBR
-{
-    ULONG Signature;
-} CREATE_DISK_MBR, *PCREATE_DISK_MBR;
-
-typedef struct _CREATE_DISK_GPT
-{
-    GUID DiskId;
-    ULONG MaxPartitionCount;
-} CREATE_DISK_GPT, *PCREATE_DISK_GPT;
-
-typedef struct _CREATE_DISK
-{
-    PARTITION_STYLE PartitionStyle;
-    union
-    {
-        CREATE_DISK_MBR Mbr;
-        CREATE_DISK_GPT Gpt;
-    };
-} CREATE_DISK, *PCREATE_DISK;
-
 typedef struct _PARTITION_TABLE_ENTRY
 {
     UCHAR BootIndicator;
@@ -290,7 +269,7 @@ FstubConvertExtendedToLayout(IN PDRIVE_LAYOUT_INFORMATION_EX LayoutEx)
     DriveLayout = ExAllocatePoolWithTag(NonPagedPool,
                                         FIELD_OFFSET(DRIVE_LAYOUT_INFORMATION, PartitionEntry) +
                                         LayoutEx->PartitionCount * sizeof(PARTITION_INFORMATION),
-                                        'BtsF');
+                                        TAG_FSTUB);
     if (!DriveLayout)
     {
         return NULL;
@@ -893,7 +872,7 @@ FstubReadHeaderEFI(IN PDISK_INFORMATION Disk,
     /* Allocate a buffer to read a sector on the disk */
     Sector = ExAllocatePoolWithTag(NonPagedPool,
                                    Disk->SectorSize,
-                                   'BtsF');
+                                   TAG_FSTUB);
     if (!Sector)
     {
         DPRINT("EFI::Lacking resources!\n");
@@ -911,7 +890,7 @@ FstubReadHeaderEFI(IN PDISK_INFORMATION Disk,
                                  (PUSHORT)Sector);
         if (!NT_SUCCESS(Status))
         {
-            ExFreePoolWithTag(Sector, 'BtsF');
+            ExFreePoolWithTag(Sector, TAG_FSTUB);
             DPRINT("EFI::Failed reading sector for partition entry!\n");
             return Status;
         }
@@ -931,7 +910,7 @@ FstubReadHeaderEFI(IN PDISK_INFORMATION Disk,
                                  (PUSHORT)Sector);
         if (!NT_SUCCESS(Status))
         {
-            ExFreePoolWithTag(Sector, 'BtsF');
+            ExFreePoolWithTag(Sector, TAG_FSTUB);
             DPRINT("EFI::Failed reading sector for partition entry!\n");
             return Status;
         }
@@ -944,7 +923,7 @@ FstubReadHeaderEFI(IN PDISK_INFORMATION Disk,
     }
 
     /* Finally, release memory */
-    ExFreePoolWithTag(Sector, 'BtsF');
+    ExFreePoolWithTag(Sector, TAG_FSTUB);
 
     /* Compare checksums */
     if (PreviousCRC32 == EFIHeader->PartitionEntryCRC32)
@@ -1006,7 +985,7 @@ FstubReadPartitionTableEFI(IN PDISK_INFORMATION Disk,
         if ((Disk->SectorCount - 1ULL) != EfiHeader.AlternateLBA)
         {
             /* We'll update it. First, count number of sectors needed to store partitions */
-            SectorsForPartitions = (EfiHeader.NumberOfEntries * PARTITION_ENTRY_SIZE) / Disk->SectorSize;
+            SectorsForPartitions = ((ULONGLONG)EfiHeader.NumberOfEntries * PARTITION_ENTRY_SIZE) / Disk->SectorSize;
             /* Then set first usable LBA: Legacy MBR + GPT header + Partitions entries */
             EfiHeader.FirstUsableLBA = SectorsForPartitions + 2;
             /* Then set last usable LBA: Last sector - GPT header - Partitions entries */
@@ -1626,7 +1605,7 @@ FstubWritePartitionTableMBR(IN PDISK_INFORMATION Disk,
                                    DriveLayout);
 
     /* Free allocated structure and return */
-    ExFreePool(DriveLayout);
+    ExFreePoolWithTag(DriveLayout, TAG_FSTUB);
     return Status;
 }