#include <ntddk.h>
#include <ntdddisk.h>
+#include <mountdev.h>
#include <scsi.h>
#include <include/class2.h>
#include <stdio.h>
This routine builds and sends a request to the port driver to
get a pointer to a structure that describes the adapter's
- capabilities/limitations. This routine is sychronous.
+ capabilities/limitations. This routine is synchronous.
Arguments:
Routine Description:
Send command to SCSI unit to start or power up.
- Because this command is issued asynchronounsly, that is, without
+ Because this command is issued asynchronously, that is, without
waiting on it to complete, the IMMEDIATE flag is not set. This
means that the CDB will not return until the drive has powered up.
This should keep subsequent requests from being submitted to the
Routine Description:
This routine is called when an asynchronous I/O request
- which was issused by the class driver completes. Examples of such requests
+ which was issued by the class driver completes. Examples of such requests
are release queue or START UNIT. This routine releases the queue if
necessary. It then frees the context and the IRP.
DeviceObject - Pointer to the class device object to be addressed.
- Irp - Pointer to Irp the orginal request.
+ Irp - Pointer to Irp the original request.
Return Value:
DebugPrint((1,"ScsiClassSplitRequest: Can't allocate Irp\n"));
//
- // If an Irp can't be allocated then the orginal request cannot
+ // If an Irp can't be allocated then the original request cannot
// be executed. If this is the first request then just fail the
- // orginal request; otherwise just return. When the pending
+ // original request; otherwise just return. When the pending
// requests complete, they will complete the original request.
// In either case set the IRP status to failure.
//
//
// NOTICE: The SCSI-II specification indicates that this field should be
// zero; however, some target controllers ignore the logical unit number
- // in the INDENTIFY message and only look at the logical unit number field
+ // in the IDENTIFY message and only look at the logical unit number field
// in the CDB.
//
//
// If the error count has exceeded the error limit, then disable
// any tagged queuing, multiple requests per lu queueing
- // and sychronous data transfers.
+ // and synchronous data transfers.
//
if (deviceExtension->ErrorCount == 4) {
Srb - Supplies a Pointer to the SCSI request block to be retied.
- Assocaiated - Indicates this is an assocatied Irp created by split request.
+ Associated - Indicates this is an associated Irp created by split request.
Return Value:
Length - Supplies the length in bytes of the mode sense buffer.
- PageMode - Supplies the page or pages of mode sense data to be retrived.
+ PageMode - Supplies the page or pages of mode sense data to be retrieved.
Return Value:
the port driver.
Arguments:
- DeviceObject - Supplies the device object for the orginal request.
+ DeviceObject - Supplies the device object for the original request.
- Srb - Supplies a paritally build ScsiRequestBlock. In particular, the
+ Srb - Supplies a partially built ScsiRequestBlock. In particular, the
CDB and the SRB timeout value must be filled in. The SRB must not be
allocated from zone.
nextStack = IoGetNextIrpStackLocation(Irp);
//
- // Validiate the user buffer.
+ // Validate the user buffer.
//
if (irpStack->Parameters.DeviceIoControl.InputBufferLength < sizeof(SCSI_PASS_THROUGH)){
scsiPass->Lun = deviceExtension->Lun;
//
- // NOTICE: The SCSI-II specificaiton indicates that this field
+ // NOTICE: The SCSI-II specification indicates that this field
// should be zero; however, some target controllers ignore the logical
- // unit number in the INDENTIFY message and only look at the logical
+ // unit number in the IDENTIFY message and only look at the logical
// unit number field in the CDB.
//
goto SetStatusAndReturn;
}
+ if (irpStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_MOUNTDEV_QUERY_UNIQUE_ID ||
+ irpStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_MOUNTDEV_QUERY_SUGGESTED_LINK_NAME) {
+
+ UNIMPLEMENTED;
+ Irp->IoStatus.Information = 0;
+ Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+ status = STATUS_NOT_IMPLEMENTED;
+ goto SetStatusAndReturn;
+ }
+
+ if (irpStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_MOUNTDEV_QUERY_DEVICE_NAME) {
+
+ PMOUNTDEV_NAME name = Irp->AssociatedIrp.SystemBuffer;
+
+ if (irpStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(MOUNTDEV_NAME)) {
+
+ Irp->IoStatus.Information = 0;
+ Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+ status = STATUS_BUFFER_TOO_SMALL;
+ goto SetStatusAndReturn;
+ }
+
+ RtlZeroMemory(name, sizeof(MOUNTDEV_NAME));
+ name->NameLength = deviceExtension->DeviceName.Length;
+
+ if (irpStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(USHORT) + name->NameLength) {
+
+ Irp->IoStatus.Information = sizeof(MOUNTDEV_NAME);
+ Irp->IoStatus.Status = STATUS_BUFFER_OVERFLOW;
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+ status = STATUS_BUFFER_OVERFLOW;
+ goto SetStatusAndReturn;
+ }
+
+ RtlCopyMemory(name->Name, deviceExtension->DeviceName.Buffer,
+ name->NameLength);
+ status = STATUS_SUCCESS;
+ Irp->IoStatus.Status = STATUS_SUCCESS;
+ Irp->IoStatus.Information = sizeof(USHORT) + name->NameLength;
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+ goto SetStatusAndReturn;
+ }
+
srb = ExAllocatePool(NonPagedPool, SCSI_REQUEST_BLOCK_SIZE);
if (srb == NULL) {
} else {
deviceExtension->PhysicalDevice = deviceObject;
}
+
+ deviceExtension->DeviceName = ntUnicodeString;
}
deviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
*DeviceObject = deviceObject;
- RtlFreeUnicodeString(&ntUnicodeString);
-
- //
- // Indicate the ntUnicodeString is free.
- //
-
- ntUnicodeString.Buffer = NULL;
-
return status;
}
srb->Lun = deviceExtension->Lun;
//
- // NOTICE: The SCSI-II specificaiton indicates that this field should be
+ // NOTICE: The SCSI-II specification indicates that this field should be
// zero; however, some target controllers ignore the logical unit number
- // in the INDENTIFY message and only look at the logical unit number field
+ // in the IDENTIFY message and only look at the logical unit number field
// in the CDB.
//