mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[CLASS2]: - In ScsiClassCreateDeviceObject() don't drop received object name and store it in the device extension
- Implement support for the IOCTL_MOUNTDEV_QUERY_DEVICE_NAME IOCTL; return the store device name
This commit is contained in:
parent
6882d62790
commit
fdb72d7f85
2 changed files with 39 additions and 10 deletions
|
@ -4041,9 +4041,9 @@ Return Value:
|
||||||
goto SetStatusAndReturn;
|
goto SetStatusAndReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (irpStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_MOUNTDEV_QUERY_DEVICE_NAME ||
|
if (irpStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_MOUNTDEV_QUERY_UNIQUE_ID ||
|
||||||
irpStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_MOUNTDEV_QUERY_UNIQUE_ID ||
|
|
||||||
irpStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_MOUNTDEV_QUERY_SUGGESTED_LINK_NAME) {
|
irpStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_MOUNTDEV_QUERY_SUGGESTED_LINK_NAME) {
|
||||||
|
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
Irp->IoStatus.Information = 0;
|
Irp->IoStatus.Information = 0;
|
||||||
Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
|
Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
|
||||||
|
@ -4052,6 +4052,40 @@ Return Value:
|
||||||
goto SetStatusAndReturn;
|
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);
|
srb = ExAllocatePool(NonPagedPool, SCSI_REQUEST_BLOCK_SIZE);
|
||||||
|
|
||||||
if (srb == NULL) {
|
if (srb == NULL) {
|
||||||
|
@ -4691,20 +4725,14 @@ Return Value:
|
||||||
} else {
|
} else {
|
||||||
deviceExtension->PhysicalDevice = deviceObject;
|
deviceExtension->PhysicalDevice = deviceObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
deviceExtension->DeviceName = ntUnicodeString;
|
||||||
}
|
}
|
||||||
|
|
||||||
deviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
|
deviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
|
||||||
|
|
||||||
*DeviceObject = deviceObject;
|
*DeviceObject = deviceObject;
|
||||||
|
|
||||||
RtlFreeUnicodeString(&ntUnicodeString);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Indicate the ntUnicodeString is free.
|
|
||||||
//
|
|
||||||
|
|
||||||
ntUnicodeString.Buffer = NULL;
|
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -132,6 +132,7 @@ typedef struct _DEVICE_EXTENSION
|
||||||
HANDLE MediaChangeEventHandle;
|
HANDLE MediaChangeEventHandle;
|
||||||
BOOLEAN MediaChangeNoMedia;
|
BOOLEAN MediaChangeNoMedia;
|
||||||
ULONG MediaChangeCount;
|
ULONG MediaChangeCount;
|
||||||
|
UNICODE_STRING DeviceName;
|
||||||
} DEVICE_EXTENSION, *PDEVICE_EXTENSION;
|
} DEVICE_EXTENSION, *PDEVICE_EXTENSION;
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue