+IOCTL_DISK_GET_PARTITION_INFO handler
authorshort <>
Tue, 4 Feb 2003 18:11:24 +0000 (18:11 +0000)
committershort <>
Tue, 4 Feb 2003 18:11:24 +0000 (18:11 +0000)
src/libcaptive/storage/media.c

index c409a5f..3c95e4e 100644 (file)
@@ -195,6 +195,28 @@ CDROM_TOC *CdromToc;
                        Irp->IoStatus.Status=STATUS_SUCCESS;
                        break;
 
+               case IOCTL_DISK_GET_PARTITION_INFO: {
+PARTITION_INFORMATION *PartitionInformation;
+
+                       if (IrpStack->Parameters.DeviceIoControl.OutputBufferLength<sizeof(PARTITION_INFORMATION)) {
+                               Irp->IoStatus.Status=STATUS_BUFFER_TOO_SMALL;
+                               Irp->IoStatus.Information=sizeof(PARTITION_INFORMATION);
+                               g_assert_not_reached();
+                               goto done;
+                               }
+                       PartitionInformation=(PARTITION_INFORMATION *)Irp->AssociatedIrp.SystemBuffer;
+                       PartitionInformation->StartingOffset.QuadPart=0;
+                       PartitionInformation->PartitionLength.QuadPart=captive_image_size;      /* unit=bytes */
+                       PartitionInformation->HiddenSectors=0;  /* FIXME: real image disk offset */
+                       PartitionInformation->PartitionNumber=1;
+                       PartitionInformation->PartitionType=0;  /* FIXME: meaning? */
+                       PartitionInformation->BootIndicator=TRUE;
+                       PartitionInformation->RecognizedPartition=TRUE;
+                       PartitionInformation->RewritePartition=FALSE;   /* FIXME: meaning? */
+                       Irp->IoStatus.Information=sizeof(PARTITION_INFORMATION);
+                       Irp->IoStatus.Status=STATUS_SUCCESS;
+                       } break;
+
                case IOCTL_DISK_GET_PARTITION_INFO_EX: {
 PARTITION_INFORMATION_EX *PartitionInformationEx;
 
@@ -207,7 +229,7 @@ PARTITION_INFORMATION_EX *PartitionInformationEx;
                        PartitionInformationEx=(PARTITION_INFORMATION_EX *)Irp->AssociatedIrp.SystemBuffer;
                        PartitionInformationEx->PartitionStyle=PARTITION_STYLE_RAW;     /* not MBR or GPT */
                        PartitionInformationEx->StartingOffset.QuadPart=0;
-                       PartitionInformationEx->PartitionLength.QuadPart=captive_image_size;    /* FIXME: what units? */
+                       PartitionInformationEx->PartitionLength.QuadPart=captive_image_size;    /* unit=bytes */
                        PartitionInformationEx->PartitionNumber=0;      /* FIXME: what number? */
                        PartitionInformationEx->RewritePartition=FALSE; /* FIXME: meaning? */
                        Irp->IoStatus.Information=sizeof(PARTITION_INFORMATION_EX);