Организация ввода-вывода. Часть 2. Драйверы для WINDOWS NT. Рощин А.В. - 106 стр.

UptoLike

Составители: 

106
{
PDISK_GEOMETRY outputBuffer;
outputBuffer = ( PDISK_GEOMETRY ) Irp-
AssociatedIrp.SystemBuffer;
outputBuffer->MediaType = RemovableMedia;
outputBuffer->Cylinders = RtlConvertUlongToLargeInteger(
diskExtension->NumberOfCylinders );
outputBuffer->TracksPerCylinder =
diskExtension->TracksPerCylinder;
outputBuffer->SectorsPerTrack = diskExtension-
>SectorsPerTrack;
outputBuffer->BytesPerSector = diskExtension-
>BytesPerSector;
Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = sizeof( DISK_GEOMETRY );
}
break;
case IOCTL_DISK_GET_PARTITION_INFO:
Возвращает информацию о разделе
{
PPARTITION_INFORMATION outputBuffer;
PBOOT_SECTOR bootSector =
(PBOOT_SECTOR) diskExtension->DiskImage;
outputBuffer = ( PPARTITION_INFORMATION )Irp-
>AssociatedIrp.SystemBuffer;
outputBuffer->PartitionType =
(bootSector->bsFileSystemType[4] == '6') ?
PARTITION_FAT_16 : PARTITION_FAT_12;
outputBuffer->BootIndicator = FALSE;
outputBuffer->RecognizedPartition = TRUE;
outputBuffer->RewritePartition = FALSE;
outputBuffer->StartingOffset =
RtlConvertUlongToLargeInteger(0);
outputBuffer->PartitionLength =
RtlConvertUlongToLargeInteger(diskExtension-
>DiskLength);
outputBuffer->HiddenSectors = 1L;
Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = sizeof( PARTITION_INFORMATION
);
}
break;
case IOCTL_DISK_VERIFY:
{
Выполняет проверку носителя. Операция идентична чтению
   {
   PDISK_GEOMETRY outputBuffer;

    outputBuffer = ( PDISK_GEOMETRY ) Irp-
AssociatedIrp.SystemBuffer;
    outputBuffer->MediaType = RemovableMedia;
    outputBuffer->Cylinders = RtlConvertUlongToLargeInteger(
           diskExtension->NumberOfCylinders );
    outputBuffer->TracksPerCylinder =
           diskExtension->TracksPerCylinder;
    outputBuffer->SectorsPerTrack = diskExtension-
>SectorsPerTrack;
    outputBuffer->BytesPerSector = diskExtension-
>BytesPerSector;

    Irp->IoStatus.Status = STATUS_SUCCESS;
   Irp->IoStatus.Information = sizeof( DISK_GEOMETRY );
  }
  break;

  case IOCTL_DISK_GET_PARTITION_INFO:
          … Возвращает информацию о разделе
  {
   PPARTITION_INFORMATION outputBuffer;
   PBOOT_SECTOR     bootSector =
          (PBOOT_SECTOR) diskExtension->DiskImage;

   outputBuffer = ( PPARTITION_INFORMATION )Irp-
          >AssociatedIrp.SystemBuffer;

   outputBuffer->PartitionType =
         (bootSector->bsFileSystemType[4] == '6') ?
             PARTITION_FAT_16 : PARTITION_FAT_12;

   outputBuffer->BootIndicator = FALSE;
   outputBuffer->RecognizedPartition = TRUE;
   outputBuffer->RewritePartition = FALSE;
   outputBuffer->StartingOffset =
RtlConvertUlongToLargeInteger(0);
   outputBuffer->PartitionLength =
          RtlConvertUlongToLargeInteger(diskExtension-
     >DiskLength);
   outputBuffer->HiddenSectors = 1L;

   Irp->IoStatus.Status = STATUS_SUCCESS;
   Irp->IoStatus.Information = sizeof( PARTITION_INFORMATION
);
  }
  break;

  case IOCTL_DISK_VERIFY:
  {
     Выполняет проверку носителя. Операция идентична чтению



                                     106