mirror of
https://github.com/reactos/reactos.git
synced 2024-07-08 21:55:08 +00:00
- Make class2 and disk completely warning-free.
svn path=/trunk/; revision=26268
This commit is contained in:
parent
43b354a3d4
commit
96924455c4
|
@ -210,7 +210,7 @@ Return Value:
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|
||||||
sprintf(deviceNameBuffer, "\\Device\\ScsiPort%d", portNumber);
|
sprintf(deviceNameBuffer, "\\Device\\ScsiPort%lu", portNumber);
|
||||||
|
|
||||||
DebugPrint((2, "ScsiClassInitialize: Open Port %s\n", deviceNameBuffer));
|
DebugPrint((2, "ScsiClassInitialize: Open Port %s\n", deviceNameBuffer));
|
||||||
|
|
||||||
|
@ -334,7 +334,6 @@ Return Value:
|
||||||
PIO_STACK_LOCATION currentIrpStack = IoGetCurrentIrpStackLocation(Irp);
|
PIO_STACK_LOCATION currentIrpStack = IoGetCurrentIrpStackLocation(Irp);
|
||||||
ULONG transferPages;
|
ULONG transferPages;
|
||||||
ULONG transferByteCount = currentIrpStack->Parameters.Read.Length;
|
ULONG transferByteCount = currentIrpStack->Parameters.Read.Length;
|
||||||
LARGE_INTEGER startingOffset = currentIrpStack->Parameters.Read.ByteOffset;
|
|
||||||
ULONG maximumTransferLength = deviceExtension->PortCapabilities->MaximumTransferLength;
|
ULONG maximumTransferLength = deviceExtension->PortCapabilities->MaximumTransferLength;
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
|
|
||||||
|
@ -1513,7 +1512,7 @@ Return Value:
|
||||||
retry = TRUE;
|
retry = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (retry && (irpStack->Parameters.Others.Argument4 = (ULONG)irpStack->Parameters.Others.Argument4-1)) {
|
if (retry && (irpStack->Parameters.Others.Argument4 = (PVOID)((ULONG)irpStack->Parameters.Others.Argument4-1))) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Retry request.
|
// Retry request.
|
||||||
|
@ -1665,7 +1664,7 @@ Return Value:
|
||||||
retry = TRUE;
|
retry = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (retry && (irpStack->Parameters.Others.Argument4 = (ULONG)irpStack->Parameters.Others.Argument4-1)) {
|
if (retry && (irpStack->Parameters.Others.Argument4 = (PVOID)((ULONG)irpStack->Parameters.Others.Argument4-1))) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Retry request. If the class driver has supplied a StartIo,
|
// Retry request. If the class driver has supplied a StartIo,
|
||||||
|
@ -2115,7 +2114,7 @@ Return Value:
|
||||||
BOOLEAN retry = TRUE;
|
BOOLEAN retry = TRUE;
|
||||||
BOOLEAN logError = FALSE;
|
BOOLEAN logError = FALSE;
|
||||||
ULONG badSector = 0;
|
ULONG badSector = 0;
|
||||||
ULONG uniqueId;
|
ULONG uniqueId = 0;
|
||||||
NTSTATUS logStatus;
|
NTSTATUS logStatus;
|
||||||
ULONG readSector;
|
ULONG readSector;
|
||||||
ULONG index;
|
ULONG index;
|
||||||
|
@ -2885,7 +2884,7 @@ Return Value:
|
||||||
// Pass the request to the port driver.
|
// Pass the request to the port driver.
|
||||||
//
|
//
|
||||||
|
|
||||||
(PVOID)IoCallDriver(deviceExtension->PortDeviceObject, Irp);
|
(VOID)IoCallDriver(deviceExtension->PortDeviceObject, Irp);
|
||||||
|
|
||||||
} // end RetryRequest()
|
} // end RetryRequest()
|
||||||
|
|
||||||
|
@ -3246,7 +3245,7 @@ Return Value:
|
||||||
PUCHAR limit;
|
PUCHAR limit;
|
||||||
ULONG parameterHeaderLength;
|
ULONG parameterHeaderLength;
|
||||||
|
|
||||||
limit = ModeSenseBuffer + Length;
|
limit = (PUCHAR)ModeSenseBuffer + Length;
|
||||||
parameterHeaderLength = (Use6Byte) ? sizeof(MODE_PARAMETER_HEADER) : sizeof(MODE_PARAMETER_HEADER10);
|
parameterHeaderLength = (Use6Byte) ? sizeof(MODE_PARAMETER_HEADER) : sizeof(MODE_PARAMETER_HEADER10);
|
||||||
|
|
||||||
|
|
||||||
|
@ -3269,7 +3268,7 @@ Return Value:
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
while (ModeSenseBuffer < limit) {
|
while ((PUCHAR)ModeSenseBuffer < limit) {
|
||||||
|
|
||||||
if (((PMODE_DISCONNECT_PAGE) ModeSenseBuffer)->PageCode == PageMode) {
|
if (((PMODE_DISCONNECT_PAGE) ModeSenseBuffer)->PageCode == PageMode) {
|
||||||
return(ModeSenseBuffer);
|
return(ModeSenseBuffer);
|
||||||
|
@ -4603,7 +4602,7 @@ Return Value:
|
||||||
NULL,
|
NULL,
|
||||||
NonPagedPoolMustSucceed,
|
NonPagedPoolMustSucceed,
|
||||||
SCSI_REQUEST_BLOCK_SIZE,
|
SCSI_REQUEST_BLOCK_SIZE,
|
||||||
'HscS',
|
TAG('H','s','c','S'),
|
||||||
(USHORT)NumberElements);
|
(USHORT)NumberElements);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<module name="class2" type="exportdriver" installbase="system32/drivers" installname="class2.sys" allowwarnings="true">
|
<module name="class2" type="exportdriver" installbase="system32/drivers" installname="class2.sys">
|
||||||
<bootstrap base="$(CDOUTPUT)" />
|
<bootstrap base="$(CDOUTPUT)" />
|
||||||
<define name="__USE_W32API" />
|
<define name="__USE_W32API" />
|
||||||
<importlibrary definition="class2.def" />
|
<importlibrary definition="class2.def" />
|
||||||
|
|
|
@ -448,8 +448,6 @@ Return Value:
|
||||||
PSCSI_ADAPTER_BUS_INFO adapterInfo;
|
PSCSI_ADAPTER_BUS_INFO adapterInfo;
|
||||||
PINQUIRYDATA inquiryData;
|
PINQUIRYDATA inquiryData;
|
||||||
ULONG scsiBus;
|
ULONG scsiBus;
|
||||||
ULONG size;
|
|
||||||
ULONG sizeElement;
|
|
||||||
ULONG adapterDisk;
|
ULONG adapterDisk;
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
BOOLEAN foundOne = FALSE;
|
BOOLEAN foundOne = FALSE;
|
||||||
|
@ -638,7 +636,7 @@ Return Value:
|
||||||
PDEVICE_OBJECT physicalDevice;
|
PDEVICE_OBJECT physicalDevice;
|
||||||
PDISK_GEOMETRY diskGeometry = NULL;
|
PDISK_GEOMETRY diskGeometry = NULL;
|
||||||
PDRIVE_LAYOUT_INFORMATION partitionList;
|
PDRIVE_LAYOUT_INFORMATION partitionList;
|
||||||
PDEVICE_EXTENSION deviceExtension;
|
PDEVICE_EXTENSION deviceExtension = NULL;
|
||||||
PDEVICE_EXTENSION physicalDeviceExtension;
|
PDEVICE_EXTENSION physicalDeviceExtension;
|
||||||
PDISK_DATA diskData;
|
PDISK_DATA diskData;
|
||||||
ULONG bytesPerSector;
|
ULONG bytesPerSector;
|
||||||
|
@ -649,7 +647,7 @@ Return Value:
|
||||||
BOOLEAN writeCache;
|
BOOLEAN writeCache;
|
||||||
PVOID senseData = NULL;
|
PVOID senseData = NULL;
|
||||||
ULONG srbFlags;
|
ULONG srbFlags;
|
||||||
ULONG dmByteSkew;
|
ULONG dmByteSkew = 0;
|
||||||
PULONG dmSkew;
|
PULONG dmSkew;
|
||||||
BOOLEAN dmActive = FALSE;
|
BOOLEAN dmActive = FALSE;
|
||||||
ULONG timeOut = 0;
|
ULONG timeOut = 0;
|
||||||
|
@ -665,7 +663,7 @@ Return Value:
|
||||||
//
|
//
|
||||||
|
|
||||||
sprintf(ntNameBuffer,
|
sprintf(ntNameBuffer,
|
||||||
"\\Device\\Harddisk%d",
|
"\\Device\\Harddisk%lu",
|
||||||
*DeviceCount);
|
*DeviceCount);
|
||||||
|
|
||||||
RtlInitString(&ntNameString,
|
RtlInitString(&ntNameString,
|
||||||
|
@ -723,7 +721,7 @@ Return Value:
|
||||||
//
|
//
|
||||||
|
|
||||||
sprintf(ntNameBuffer,
|
sprintf(ntNameBuffer,
|
||||||
"\\Device\\Harddisk%d\\Partition0",
|
"\\Device\\Harddisk%lu\\Partition0",
|
||||||
*DeviceCount);
|
*DeviceCount);
|
||||||
|
|
||||||
|
|
||||||
|
@ -1042,7 +1040,7 @@ Return Value:
|
||||||
HalExamineMBR(deviceExtension->DeviceObject,
|
HalExamineMBR(deviceExtension->DeviceObject,
|
||||||
deviceExtension->DiskGeometry->BytesPerSector,
|
deviceExtension->DiskGeometry->BytesPerSector,
|
||||||
(ULONG)0x54,
|
(ULONG)0x54,
|
||||||
&dmSkew);
|
(PVOID)&dmSkew);
|
||||||
|
|
||||||
if (dmSkew) {
|
if (dmSkew) {
|
||||||
|
|
||||||
|
@ -1179,7 +1177,7 @@ Return Value:
|
||||||
//
|
//
|
||||||
|
|
||||||
sprintf(ntNameBuffer,
|
sprintf(ntNameBuffer,
|
||||||
"\\Device\\Harddisk%d\\Partition%d",
|
"\\Device\\Harddisk%lu\\Partition%lu",
|
||||||
*DeviceCount,
|
*DeviceCount,
|
||||||
partitionNumber + 1);
|
partitionNumber + 1);
|
||||||
|
|
||||||
|
@ -1425,9 +1423,6 @@ Return Value:
|
||||||
PIO_STACK_LOCATION currentIrpStack = IoGetCurrentIrpStackLocation(Irp);
|
PIO_STACK_LOCATION currentIrpStack = IoGetCurrentIrpStackLocation(Irp);
|
||||||
ULONG transferByteCount = currentIrpStack->Parameters.Read.Length;
|
ULONG transferByteCount = currentIrpStack->Parameters.Read.Length;
|
||||||
LARGE_INTEGER startingOffset;
|
LARGE_INTEGER startingOffset;
|
||||||
ULONG maximumTransferLength =
|
|
||||||
deviceExtension->PortCapabilities->MaximumTransferLength;
|
|
||||||
ULONG transferPages;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Verify parameters of this request.
|
// Verify parameters of this request.
|
||||||
|
@ -1533,7 +1528,7 @@ Return Value:
|
||||||
|
|
||||||
case SMART_GET_VERSION: {
|
case SMART_GET_VERSION: {
|
||||||
|
|
||||||
PUCHAR buffer;
|
ULONG_PTR buffer;
|
||||||
PSRB_IO_CONTROL srbControl;
|
PSRB_IO_CONTROL srbControl;
|
||||||
PGETVERSIONINPARAMS versionParams;
|
PGETVERSIONINPARAMS versionParams;
|
||||||
|
|
||||||
|
@ -1572,8 +1567,7 @@ Return Value:
|
||||||
// Point to the 'buffer' portion of the SRB_CONTROL
|
// Point to the 'buffer' portion of the SRB_CONTROL
|
||||||
//
|
//
|
||||||
|
|
||||||
buffer = (PUCHAR)srbControl;
|
buffer = (ULONG_PTR)srbControl + srbControl->HeaderLength;
|
||||||
buffer = (ULONG)buffer + srbControl->HeaderLength;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Ensure correct target is set in the cmd parameters.
|
// Ensure correct target is set in the cmd parameters.
|
||||||
|
@ -1586,7 +1580,7 @@ Return Value:
|
||||||
// Copy the IOCTL parameters to the srb control buffer area.
|
// Copy the IOCTL parameters to the srb control buffer area.
|
||||||
//
|
//
|
||||||
|
|
||||||
RtlMoveMemory(buffer, Irp->AssociatedIrp.SystemBuffer, sizeof(GETVERSIONINPARAMS));
|
RtlMoveMemory((PVOID)buffer, Irp->AssociatedIrp.SystemBuffer, sizeof(GETVERSIONINPARAMS));
|
||||||
|
|
||||||
|
|
||||||
irp2 = IoBuildDeviceIoControlRequest(IOCTL_SCSI_MINIPORT,
|
irp2 = IoBuildDeviceIoControlRequest(IOCTL_SCSI_MINIPORT,
|
||||||
|
@ -1622,10 +1616,9 @@ Return Value:
|
||||||
|
|
||||||
if (NT_SUCCESS(status)) {
|
if (NT_SUCCESS(status)) {
|
||||||
|
|
||||||
buffer = (PUCHAR)srbControl;
|
buffer = (ULONG_PTR)srbControl + srbControl->HeaderLength;
|
||||||
buffer = (ULONG)buffer + srbControl->HeaderLength;
|
|
||||||
|
|
||||||
RtlMoveMemory ( Irp->AssociatedIrp.SystemBuffer, buffer, sizeof(GETVERSIONINPARAMS));
|
RtlMoveMemory ( Irp->AssociatedIrp.SystemBuffer, (PVOID)buffer, sizeof(GETVERSIONINPARAMS));
|
||||||
Irp->IoStatus.Information = sizeof(GETVERSIONINPARAMS);
|
Irp->IoStatus.Information = sizeof(GETVERSIONINPARAMS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1638,7 +1631,7 @@ Return Value:
|
||||||
PSENDCMDINPARAMS cmdInParameters = ((PSENDCMDINPARAMS)Irp->AssociatedIrp.SystemBuffer);
|
PSENDCMDINPARAMS cmdInParameters = ((PSENDCMDINPARAMS)Irp->AssociatedIrp.SystemBuffer);
|
||||||
ULONG controlCode = 0;
|
ULONG controlCode = 0;
|
||||||
PSRB_IO_CONTROL srbControl;
|
PSRB_IO_CONTROL srbControl;
|
||||||
PUCHAR buffer;
|
ULONG_PTR buffer;
|
||||||
|
|
||||||
if (irpStack->Parameters.DeviceIoControl.InputBufferLength <
|
if (irpStack->Parameters.DeviceIoControl.InputBufferLength <
|
||||||
(sizeof(SENDCMDINPARAMS) - 1)) {
|
(sizeof(SENDCMDINPARAMS) - 1)) {
|
||||||
|
@ -1709,8 +1702,7 @@ Return Value:
|
||||||
// Point to the 'buffer' portion of the SRB_CONTROL
|
// Point to the 'buffer' portion of the SRB_CONTROL
|
||||||
//
|
//
|
||||||
|
|
||||||
buffer = (PUCHAR)srbControl;
|
buffer = (ULONG_PTR)srbControl + srbControl->HeaderLength;
|
||||||
buffer = (ULONG)buffer + srbControl->HeaderLength;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Ensure correct target is set in the cmd parameters.
|
// Ensure correct target is set in the cmd parameters.
|
||||||
|
@ -1722,7 +1714,7 @@ Return Value:
|
||||||
// Copy the IOCTL parameters to the srb control buffer area.
|
// Copy the IOCTL parameters to the srb control buffer area.
|
||||||
//
|
//
|
||||||
|
|
||||||
RtlMoveMemory(buffer, Irp->AssociatedIrp.SystemBuffer, sizeof(SENDCMDINPARAMS) - 1);
|
RtlMoveMemory((PVOID)buffer, Irp->AssociatedIrp.SystemBuffer, sizeof(SENDCMDINPARAMS) - 1);
|
||||||
|
|
||||||
irp2 = IoBuildDeviceIoControlRequest(IOCTL_SCSI_MINIPORT,
|
irp2 = IoBuildDeviceIoControlRequest(IOCTL_SCSI_MINIPORT,
|
||||||
deviceExtension->PortDeviceObject,
|
deviceExtension->PortDeviceObject,
|
||||||
|
@ -1754,17 +1746,16 @@ Return Value:
|
||||||
// If successful, copy the data received into the output buffer
|
// If successful, copy the data received into the output buffer
|
||||||
//
|
//
|
||||||
|
|
||||||
buffer = (PUCHAR)srbControl;
|
buffer = (ULONG_PTR)srbControl + srbControl->HeaderLength;
|
||||||
buffer = (ULONG)buffer + srbControl->HeaderLength;
|
|
||||||
|
|
||||||
if (NT_SUCCESS(status)) {
|
if (NT_SUCCESS(status)) {
|
||||||
|
|
||||||
RtlMoveMemory ( Irp->AssociatedIrp.SystemBuffer, buffer, length - 1);
|
RtlMoveMemory ( Irp->AssociatedIrp.SystemBuffer, (PVOID)buffer, length - 1);
|
||||||
Irp->IoStatus.Information = length - 1;
|
Irp->IoStatus.Information = length - 1;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
RtlMoveMemory ( Irp->AssociatedIrp.SystemBuffer, buffer, (sizeof(SENDCMDOUTPARAMS) - 1));
|
RtlMoveMemory ( Irp->AssociatedIrp.SystemBuffer, (PVOID)buffer, (sizeof(SENDCMDOUTPARAMS) - 1));
|
||||||
Irp->IoStatus.Information = sizeof(SENDCMDOUTPARAMS) - 1;
|
Irp->IoStatus.Information = sizeof(SENDCMDOUTPARAMS) - 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1779,7 +1770,7 @@ Return Value:
|
||||||
PSENDCMDINPARAMS cmdInParameters = ((PSENDCMDINPARAMS)Irp->AssociatedIrp.SystemBuffer);
|
PSENDCMDINPARAMS cmdInParameters = ((PSENDCMDINPARAMS)Irp->AssociatedIrp.SystemBuffer);
|
||||||
PSRB_IO_CONTROL srbControl;
|
PSRB_IO_CONTROL srbControl;
|
||||||
ULONG controlCode = 0;
|
ULONG controlCode = 0;
|
||||||
PUCHAR buffer;
|
ULONG_PTR buffer;
|
||||||
|
|
||||||
if (irpStack->Parameters.DeviceIoControl.InputBufferLength <
|
if (irpStack->Parameters.DeviceIoControl.InputBufferLength <
|
||||||
(sizeof(SENDCMDINPARAMS) - 1)) {
|
(sizeof(SENDCMDINPARAMS) - 1)) {
|
||||||
|
@ -1877,8 +1868,7 @@ Return Value:
|
||||||
// Point to the 'buffer' portion of the SRB_CONTROL
|
// Point to the 'buffer' portion of the SRB_CONTROL
|
||||||
//
|
//
|
||||||
|
|
||||||
buffer = (PUCHAR)srbControl;
|
buffer = (ULONG_PTR)srbControl + srbControl->HeaderLength;
|
||||||
buffer = (ULONG)buffer + srbControl->HeaderLength;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Ensure correct target is set in the cmd parameters.
|
// Ensure correct target is set in the cmd parameters.
|
||||||
|
@ -1890,7 +1880,7 @@ Return Value:
|
||||||
// Copy the IOCTL parameters to the srb control buffer area.
|
// Copy the IOCTL parameters to the srb control buffer area.
|
||||||
//
|
//
|
||||||
|
|
||||||
RtlMoveMemory(buffer, Irp->AssociatedIrp.SystemBuffer, sizeof(SENDCMDINPARAMS) - 1);
|
RtlMoveMemory((PVOID)buffer, Irp->AssociatedIrp.SystemBuffer, sizeof(SENDCMDINPARAMS) - 1);
|
||||||
|
|
||||||
srbControl->ControlCode = controlCode;
|
srbControl->ControlCode = controlCode;
|
||||||
|
|
||||||
|
@ -1926,8 +1916,7 @@ Return Value:
|
||||||
// either pass this back to the app, or zero it, in case of error.
|
// either pass this back to the app, or zero it, in case of error.
|
||||||
//
|
//
|
||||||
|
|
||||||
buffer = (PUCHAR)srbControl;
|
buffer = (ULONG_PTR)srbControl + srbControl->HeaderLength;
|
||||||
buffer = (ULONG)buffer + srbControl->HeaderLength;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Update the return buffer size based on the sub-command.
|
// Update the return buffer size based on the sub-command.
|
||||||
|
@ -1939,7 +1928,7 @@ Return Value:
|
||||||
length = sizeof(SENDCMDOUTPARAMS) - 1;
|
length = sizeof(SENDCMDOUTPARAMS) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlMoveMemory ( Irp->AssociatedIrp.SystemBuffer, buffer, length);
|
RtlMoveMemory ( Irp->AssociatedIrp.SystemBuffer, (PVOID)buffer, length);
|
||||||
Irp->IoStatus.Information = length;
|
Irp->IoStatus.Information = length;
|
||||||
|
|
||||||
ExFreePool(srbControl);
|
ExFreePool(srbControl);
|
||||||
|
@ -2532,7 +2521,7 @@ Return Value:
|
||||||
RtlZeroMemory(modeData, MODE_DATA_SIZE);
|
RtlZeroMemory(modeData, MODE_DATA_SIZE);
|
||||||
|
|
||||||
length = ScsiClassModeSense(DeviceObject,
|
length = ScsiClassModeSense(DeviceObject,
|
||||||
(PUCHAR) modeData,
|
(PCHAR) modeData,
|
||||||
MODE_DATA_SIZE,
|
MODE_DATA_SIZE,
|
||||||
MODE_SENSE_RETURN_ALL);
|
MODE_SENSE_RETURN_ALL);
|
||||||
|
|
||||||
|
@ -2543,7 +2532,7 @@ Return Value:
|
||||||
//
|
//
|
||||||
|
|
||||||
length = ScsiClassModeSense(DeviceObject,
|
length = ScsiClassModeSense(DeviceObject,
|
||||||
(PUCHAR) modeData,
|
(PCHAR) modeData,
|
||||||
MODE_DATA_SIZE,
|
MODE_DATA_SIZE,
|
||||||
MODE_SENSE_RETURN_ALL);
|
MODE_SENSE_RETURN_ALL);
|
||||||
|
|
||||||
|
@ -3004,7 +2993,7 @@ Return Value:
|
||||||
ULONG retries = 1;
|
ULONG retries = 1;
|
||||||
ULONG length2;
|
ULONG length2;
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
PULONG buffer;
|
ULONG_PTR buffer;
|
||||||
PMODE_PARAMETER_BLOCK blockDescriptor;
|
PMODE_PARAMETER_BLOCK blockDescriptor;
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
@ -3015,9 +3004,9 @@ Return Value:
|
||||||
// Allocate buffer for mode select header, block descriptor, and mode page.
|
// Allocate buffer for mode select header, block descriptor, and mode page.
|
||||||
//
|
//
|
||||||
|
|
||||||
buffer = ExAllocatePool(NonPagedPoolCacheAligned,length2);
|
buffer = (ULONG_PTR)ExAllocatePool(NonPagedPoolCacheAligned,length2);
|
||||||
|
|
||||||
RtlZeroMemory(buffer, length2);
|
RtlZeroMemory((PVOID)buffer, length2);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Set length in header to size of mode page.
|
// Set length in header to size of mode page.
|
||||||
|
@ -3025,7 +3014,7 @@ Return Value:
|
||||||
|
|
||||||
((PMODE_PARAMETER_HEADER)buffer)->BlockDescriptorLength = sizeof(MODE_PARAMETER_BLOCK);
|
((PMODE_PARAMETER_HEADER)buffer)->BlockDescriptorLength = sizeof(MODE_PARAMETER_BLOCK);
|
||||||
|
|
||||||
blockDescriptor = (PULONG)(buffer + 1);
|
blockDescriptor = (PMODE_PARAMETER_BLOCK)(buffer + 1);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Set size
|
// Set size
|
||||||
|
@ -3037,7 +3026,7 @@ Return Value:
|
||||||
// Copy mode page to buffer.
|
// Copy mode page to buffer.
|
||||||
//
|
//
|
||||||
|
|
||||||
RtlCopyMemory(buffer + 3, ModeSelectBuffer, Length);
|
RtlCopyMemory((PVOID)(buffer + 3), ModeSelectBuffer, Length);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Zero SRB.
|
// Zero SRB.
|
||||||
|
@ -3067,7 +3056,7 @@ Retry:
|
||||||
|
|
||||||
status = ScsiClassSendSrbSynchronous(DeviceObject,
|
status = ScsiClassSendSrbSynchronous(DeviceObject,
|
||||||
&srb,
|
&srb,
|
||||||
buffer,
|
(PVOID)buffer,
|
||||||
length2,
|
length2,
|
||||||
TRUE);
|
TRUE);
|
||||||
|
|
||||||
|
@ -3092,7 +3081,7 @@ Retry:
|
||||||
status = STATUS_SUCCESS;
|
status = STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExFreePool(buffer);
|
ExFreePool((PVOID)buffer);
|
||||||
|
|
||||||
if (NT_SUCCESS(status)) {
|
if (NT_SUCCESS(status)) {
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
|
@ -3122,7 +3111,7 @@ DisableWriteCache(
|
||||||
|
|
||||||
controller = &ScsiDiskBadControllers[j];
|
controller = &ScsiDiskBadControllers[j];
|
||||||
|
|
||||||
if (!controller->DisableWriteCache || strncmp(controller->InquiryString, InquiryData->VendorId, strlen(controller->InquiryString))) {
|
if (!controller->DisableWriteCache || strncmp(controller->InquiryString, (PCCHAR)InquiryData->VendorId, strlen(controller->InquiryString))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3234,7 +3223,7 @@ DisableWriteCache(
|
||||||
//
|
//
|
||||||
|
|
||||||
if (ScsiDiskModeSelect(DeviceObject,
|
if (ScsiDiskModeSelect(DeviceObject,
|
||||||
pageData,
|
(PCHAR)pageData,
|
||||||
length,
|
length,
|
||||||
savePage)) {
|
savePage)) {
|
||||||
|
|
||||||
|
@ -3246,7 +3235,7 @@ DisableWriteCache(
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (ScsiDiskModeSelect(DeviceObject,
|
if (ScsiDiskModeSelect(DeviceObject,
|
||||||
pageData,
|
(PCHAR)pageData,
|
||||||
length,
|
length,
|
||||||
savePage)) {
|
savePage)) {
|
||||||
|
|
||||||
|
@ -3488,12 +3477,12 @@ Return Value:
|
||||||
// Open controller name key.
|
// Open controller name key.
|
||||||
//
|
//
|
||||||
|
|
||||||
sprintf(buffer,
|
sprintf((PCHAR)buffer,
|
||||||
"%d",
|
"%lu",
|
||||||
busNumber);
|
busNumber);
|
||||||
|
|
||||||
RtlInitString(&string,
|
RtlInitString(&string,
|
||||||
buffer);
|
(PCSZ)buffer);
|
||||||
|
|
||||||
status = RtlAnsiStringToUnicodeString(&unicodeString,
|
status = RtlAnsiStringToUnicodeString(&unicodeString,
|
||||||
&string,
|
&string,
|
||||||
|
@ -3549,12 +3538,12 @@ Return Value:
|
||||||
// Open disk key.
|
// Open disk key.
|
||||||
//
|
//
|
||||||
|
|
||||||
sprintf(buffer,
|
sprintf((PCHAR)buffer,
|
||||||
"%d\\DiskPeripheral",
|
"%lu\\DiskPeripheral",
|
||||||
adapterNumber);
|
adapterNumber);
|
||||||
|
|
||||||
RtlInitString(&string,
|
RtlInitString(&string,
|
||||||
buffer);
|
(PCSZ)buffer);
|
||||||
|
|
||||||
status = RtlAnsiStringToUnicodeString(&unicodeString,
|
status = RtlAnsiStringToUnicodeString(&unicodeString,
|
||||||
&string,
|
&string,
|
||||||
|
@ -3582,12 +3571,12 @@ Return Value:
|
||||||
|
|
||||||
for (diskNumber = 0; ; diskNumber++) {
|
for (diskNumber = 0; ; diskNumber++) {
|
||||||
|
|
||||||
sprintf(buffer,
|
sprintf((PCHAR)buffer,
|
||||||
"%d",
|
"%lu",
|
||||||
diskNumber);
|
diskNumber);
|
||||||
|
|
||||||
RtlInitString(&string,
|
RtlInitString(&string,
|
||||||
buffer);
|
(PCSZ)buffer);
|
||||||
|
|
||||||
status = RtlAnsiStringToUnicodeString(&unicodeString,
|
status = RtlAnsiStringToUnicodeString(&unicodeString,
|
||||||
&string,
|
&string,
|
||||||
|
@ -3675,7 +3664,7 @@ Return Value:
|
||||||
// Convert checksum to ansi string.
|
// Convert checksum to ansi string.
|
||||||
//
|
//
|
||||||
|
|
||||||
sprintf(buffer, "%08x", diskData->MbrCheckSum);
|
sprintf((PCHAR)buffer, "%08lx", diskData->MbrCheckSum);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
@ -3683,7 +3672,7 @@ Return Value:
|
||||||
// Convert signature to ansi string.
|
// Convert signature to ansi string.
|
||||||
//
|
//
|
||||||
|
|
||||||
sprintf(buffer, "%08x", diskData->Signature);
|
sprintf((PCHAR)buffer, "%08lx", diskData->Signature);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Make string point at signature. Can't use scan
|
// Make string point at signature. Can't use scan
|
||||||
|
@ -3698,7 +3687,7 @@ Return Value:
|
||||||
//
|
//
|
||||||
|
|
||||||
RtlInitString(&string,
|
RtlInitString(&string,
|
||||||
buffer);
|
(PCSZ)buffer);
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -4314,15 +4303,13 @@ Return Value:
|
||||||
PDEVICE_EXTENSION deviceExtension = DeviceObject->DeviceExtension;
|
PDEVICE_EXTENSION deviceExtension = DeviceObject->DeviceExtension;
|
||||||
PINQUIRYDATA InquiryData = (PINQUIRYDATA)LunInfo->InquiryData;
|
PINQUIRYDATA InquiryData = (PINQUIRYDATA)LunInfo->InquiryData;
|
||||||
BAD_CONTROLLER_INFORMATION const *controller;
|
BAD_CONTROLLER_INFORMATION const *controller;
|
||||||
ULONG j,length;
|
ULONG j;
|
||||||
PVOID modeData;
|
|
||||||
PUCHAR pageData;
|
|
||||||
|
|
||||||
for (j = 0; j < NUMBER_OF_BAD_CONTROLLERS; j++) {
|
for (j = 0; j < NUMBER_OF_BAD_CONTROLLERS; j++) {
|
||||||
|
|
||||||
controller = &ScsiDiskBadControllers[j];
|
controller = &ScsiDiskBadControllers[j];
|
||||||
|
|
||||||
if (strncmp(controller->InquiryString, InquiryData->VendorId, strlen(controller->InquiryString))) {
|
if (strncmp(controller->InquiryString, (PCCHAR)InquiryData->VendorId, strlen(controller->InquiryString))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4376,7 +4363,7 @@ Return Value:
|
||||||
deviceExtension->DeviceFlags |= DEV_SAFE_START_UNIT;
|
deviceExtension->DeviceFlags |= DEV_SAFE_START_UNIT;
|
||||||
|
|
||||||
if (DeviceObject->Characteristics & FILE_REMOVABLE_MEDIA) {
|
if (DeviceObject->Characteristics & FILE_REMOVABLE_MEDIA) {
|
||||||
if (_strnicmp(InquiryData->VendorId, "iomega", strlen("iomega"))) {
|
if (_strnicmp((PCCHAR)InquiryData->VendorId, "iomega", strlen("iomega"))) {
|
||||||
deviceExtension->DeviceFlags &= ~DEV_SAFE_START_UNIT;
|
deviceExtension->DeviceFlags &= ~DEV_SAFE_START_UNIT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4798,7 +4785,7 @@ Return Value:
|
||||||
//
|
//
|
||||||
|
|
||||||
sprintf(ntNameBuffer,
|
sprintf(ntNameBuffer,
|
||||||
"\\Device\\Harddisk%d\\Partition%d",
|
"\\Device\\Harddisk%lu\\Partition%lu",
|
||||||
physicalExtension->DeviceNumber,
|
physicalExtension->DeviceNumber,
|
||||||
partitionNumber);
|
partitionNumber);
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<module name="disk" type="kernelmodedriver" installbase="system32/drivers" installname="disk.sys" allowwarnings="true">
|
<module name="disk" type="kernelmodedriver" installbase="system32/drivers" installname="disk.sys">
|
||||||
<bootstrap base="$(CDOUTPUT)" />
|
<bootstrap base="$(CDOUTPUT)" />
|
||||||
<define name="__USE_W32API" />
|
<define name="__USE_W32API" />
|
||||||
<linkerflag>-lgcc</linkerflag>
|
<linkerflag>-lgcc</linkerflag>
|
||||||
|
|
Loading…
Reference in a new issue