mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 17:34:57 +00:00
[CDROM_NEW]
- Misc build fixes for mingw and msvc with cmake svn path=/trunk/; revision=55669
This commit is contained in:
parent
3fec97b52e
commit
c0f7614fb0
6 changed files with 90 additions and 25 deletions
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
add_subdirectory(cdrom)
|
add_subdirectory(cdrom)
|
||||||
|
add_subdirectory(cdrom_new)
|
||||||
add_subdirectory(class2)
|
add_subdirectory(class2)
|
||||||
add_subdirectory(disk)
|
add_subdirectory(disk)
|
||||||
add_subdirectory(disk_new)
|
add_subdirectory(disk_new)
|
||||||
|
|
15
reactos/drivers/storage/class/cdrom_new/CMakeLists.txt
Normal file
15
reactos/drivers/storage/class/cdrom_new/CMakeLists.txt
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
include_directories(..)
|
||||||
|
|
||||||
|
add_library(cdrom_new SHARED cdrom.c data.c ioctl.c mmc.c sec.c)
|
||||||
|
|
||||||
|
target_link_libraries(cdrom_new libcntpr wdmguid)
|
||||||
|
if(ARCH MATCHES i386)
|
||||||
|
if(MSVC)
|
||||||
|
add_target_compile_flags(cdrom_new "/Gz")
|
||||||
|
else()
|
||||||
|
add_target_compile_flags(cdrom_new "-mrtd -fno-builtin -Wno-unused-variable -Wno-pointer-sign")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set_module_type(cdrom_new kernelmodedriver)
|
||||||
|
add_importlibs(cdrom_new classpnp ntoskrnl hal)
|
|
@ -114,7 +114,7 @@ Return Value:
|
||||||
status = IoAllocateDriverObjectExtension(DriverObject,
|
status = IoAllocateDriverObjectExtension(DriverObject,
|
||||||
CDROM_DRIVER_EXTENSION_ID,
|
CDROM_DRIVER_EXTENSION_ID,
|
||||||
sizeof(CDROM_DRIVER_EXTENSION),
|
sizeof(CDROM_DRIVER_EXTENSION),
|
||||||
&driverExtension);
|
(PVOID*)&driverExtension);
|
||||||
|
|
||||||
if (!NT_SUCCESS(status)) {
|
if (!NT_SUCCESS(status)) {
|
||||||
TraceLog((CdromDebugWarning,
|
TraceLog((CdromDebugWarning,
|
||||||
|
@ -555,7 +555,7 @@ Return Value:
|
||||||
PVOID senseData = NULL;
|
PVOID senseData = NULL;
|
||||||
|
|
||||||
ULONG timeOut;
|
ULONG timeOut;
|
||||||
PCDROM_DATA cddata;
|
PCDROM_DATA cddata = NULL;
|
||||||
|
|
||||||
BOOLEAN changerDevice;
|
BOOLEAN changerDevice;
|
||||||
BOOLEAN isMmcDevice = FALSE;
|
BOOLEAN isMmcDevice = FALSE;
|
||||||
|
@ -3366,7 +3366,7 @@ Return Value:
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((startingOffset.QuadPart > commonExtension->PartitionLength.QuadPart) ||
|
if ((startingOffset.QuadPart > commonExtension->PartitionLength.QuadPart) ||
|
||||||
(transferByteCount & fdoExtension->DiskGeometry.BytesPerSector - 1)) {
|
(transferByteCount & (fdoExtension->DiskGeometry.BytesPerSector - 1))) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Fail request with status of invalid parameters.
|
// Fail request with status of invalid parameters.
|
||||||
|
@ -3390,18 +3390,18 @@ CdRomSwitchModeCompletion(
|
||||||
IN PVOID Context
|
IN PVOID Context
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
PFUNCTIONAL_DEVICE_EXTENSION fdoExtension = DeviceObject->DeviceExtension;
|
|
||||||
PCOMMON_DEVICE_EXTENSION commonExtension = DeviceObject->DeviceExtension;
|
|
||||||
|
|
||||||
PIO_STACK_LOCATION irpStack = IoGetCurrentIrpStackLocation(Irp);
|
|
||||||
PCDROM_DATA cdData = (PCDROM_DATA)(commonExtension->DriverData);
|
|
||||||
BOOLEAN use6Byte = TEST_FLAG(cdData->XAFlags, XA_USE_6_BYTE);
|
|
||||||
PIO_STACK_LOCATION realIrpStack;
|
PIO_STACK_LOCATION realIrpStack;
|
||||||
PIO_STACK_LOCATION realIrpNextStack;
|
PIO_STACK_LOCATION realIrpNextStack;
|
||||||
PSCSI_REQUEST_BLOCK srb = Context;
|
|
||||||
PIRP realIrp = NULL;
|
PIRP realIrp = NULL;
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
BOOLEAN retry;
|
BOOLEAN retry;
|
||||||
|
PSCSI_REQUEST_BLOCK srb = Context;
|
||||||
|
PFUNCTIONAL_DEVICE_EXTENSION fdoExtension = DeviceObject->DeviceExtension;
|
||||||
|
PCOMMON_DEVICE_EXTENSION commonExtension = DeviceObject->DeviceExtension;
|
||||||
|
PCDROM_DATA cdData = (PCDROM_DATA)(commonExtension->DriverData);
|
||||||
|
PIO_STACK_LOCATION irpStack = IoGetCurrentIrpStackLocation(Irp);
|
||||||
|
BOOLEAN use6Byte = TEST_FLAG(cdData->XAFlags, XA_USE_6_BYTE);
|
||||||
|
ULONG retryCount;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Extract the 'real' irp from the irpstack.
|
// Extract the 'real' irp from the irpstack.
|
||||||
|
@ -3454,7 +3454,17 @@ CdRomSwitchModeCompletion(
|
||||||
retry = TRUE;
|
retry = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (retry && realIrpNextStack->Parameters.Others.Argument1--) {
|
//
|
||||||
|
// get current retry count
|
||||||
|
//
|
||||||
|
retryCount = PtrToUlong(realIrpNextStack->Parameters.Others.Argument1);
|
||||||
|
|
||||||
|
if (retry && retryCount) {
|
||||||
|
|
||||||
|
//
|
||||||
|
// decrement retryCount and update
|
||||||
|
//
|
||||||
|
realIrpNextStack->Parameters.Others.Argument1 = UlongToPtr(retryCount-1);
|
||||||
|
|
||||||
if (((ULONG)(ULONG_PTR)realIrpNextStack->Parameters.Others.Argument1)) {
|
if (((ULONG)(ULONG_PTR)realIrpNextStack->Parameters.Others.Argument1)) {
|
||||||
|
|
||||||
|
@ -5923,6 +5933,8 @@ Return Value:
|
||||||
ULONG pickDvdRegion;
|
ULONG pickDvdRegion;
|
||||||
ULONG defaultDvdRegion;
|
ULONG defaultDvdRegion;
|
||||||
ULONG dvdRegion;
|
ULONG dvdRegion;
|
||||||
|
ULONG a, b;
|
||||||
|
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
@ -5948,8 +5960,7 @@ Return Value:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ULONG a, b;
|
|
||||||
|
|
||||||
a = max(sizeof(DVD_DESCRIPTOR_HEADER) +
|
a = max(sizeof(DVD_DESCRIPTOR_HEADER) +
|
||||||
sizeof(DVD_COPYRIGHT_DESCRIPTOR),
|
sizeof(DVD_COPYRIGHT_DESCRIPTOR),
|
||||||
sizeof(DVD_READ_STRUCTURE)
|
sizeof(DVD_READ_STRUCTURE)
|
||||||
|
@ -6434,7 +6445,9 @@ Return Value:
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
NTSTATUS
|
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
CdRomMmcErrorHandler(
|
CdRomMmcErrorHandler(
|
||||||
IN PDEVICE_OBJECT Fdo,
|
IN PDEVICE_OBJECT Fdo,
|
||||||
IN PSCSI_REQUEST_BLOCK Srb,
|
IN PSCSI_REQUEST_BLOCK Srb,
|
||||||
|
@ -6600,8 +6613,6 @@ CdRomMmcErrorHandler(
|
||||||
} // end of SenseKey switch
|
} // end of SenseKey switch
|
||||||
|
|
||||||
} // end of SRB_STATUS_AUTOSENSE_VALID
|
} // end of SRB_STATUS_AUTOSENSE_VALID
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -6748,6 +6759,7 @@ Return Value:
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
CdRomShutdownFlushCompletion(
|
CdRomShutdownFlushCompletion(
|
||||||
IN PDEVICE_OBJECT Fdo,
|
IN PDEVICE_OBJECT Fdo,
|
||||||
IN PIRP NewIrp,
|
IN PIRP NewIrp,
|
||||||
|
@ -6836,7 +6848,7 @@ CdRomShutdownFlushCompletion(
|
||||||
newIrpStack = IoGetCurrentIrpStackLocation(newIrp);
|
newIrpStack = IoGetCurrentIrpStackLocation(newIrp);
|
||||||
newIrpStack->DeviceObject = Fdo;
|
newIrpStack->DeviceObject = Fdo;
|
||||||
IoSetCompletionRoutine(newIrp,
|
IoSetCompletionRoutine(newIrp,
|
||||||
CdRomShutdownFlushCompletion,
|
(PIO_COMPLETION_ROUTINE)CdRomShutdownFlushCompletion,
|
||||||
OriginalIrp,
|
OriginalIrp,
|
||||||
TRUE, TRUE, TRUE);
|
TRUE, TRUE, TRUE);
|
||||||
IoSetNextIrpStackLocation(newIrp);
|
IoSetNextIrpStackLocation(newIrp);
|
||||||
|
|
|
@ -45,7 +45,7 @@ typedef enum {
|
||||||
CdromDebug = z, // set bit 0x00000000 in nt!kd_cdrom_mask
|
CdromDebug = z, // set bit 0x00000000 in nt!kd_cdrom_mask
|
||||||
#endif
|
#endif
|
||||||
CdromDebugFeatures = 32 // set bit 0x80000000 in nt!kd_cdrom_mask
|
CdromDebugFeatures = 32 // set bit 0x80000000 in nt!kd_cdrom_mask
|
||||||
};
|
}CdromError;
|
||||||
|
|
||||||
#define CDROM_GET_CONFIGURATION_TIMEOUT (0x4)
|
#define CDROM_GET_CONFIGURATION_TIMEOUT (0x4)
|
||||||
|
|
||||||
|
@ -744,7 +744,8 @@ CdRomIsDeviceMmcDevice(
|
||||||
OUT PBOOLEAN IsMmc
|
OUT PBOOLEAN IsMmc
|
||||||
);
|
);
|
||||||
|
|
||||||
NTSTATUS
|
VOID
|
||||||
|
NTAPI
|
||||||
CdRomMmcErrorHandler(
|
CdRomMmcErrorHandler(
|
||||||
IN PDEVICE_OBJECT Fdo,
|
IN PDEVICE_OBJECT Fdo,
|
||||||
IN PSCSI_REQUEST_BLOCK Srb,
|
IN PSCSI_REQUEST_BLOCK Srb,
|
||||||
|
|
|
@ -2086,6 +2086,7 @@ CdRomDeviceControlCompletion(
|
||||||
|
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
BOOLEAN retry;
|
BOOLEAN retry;
|
||||||
|
ULONG retryCount;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Extract the 'real' irp from the irpstack.
|
// Extract the 'real' irp from the irpstack.
|
||||||
|
@ -2231,7 +2232,17 @@ CdRomDeviceControlCompletion(
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (retry && realIrpNextStack->Parameters.Others.Argument1--) {
|
//
|
||||||
|
// get current retry count
|
||||||
|
//
|
||||||
|
retryCount = PtrToUlong(realIrpNextStack->Parameters.Others.Argument1);
|
||||||
|
|
||||||
|
if (retry && retryCount) {
|
||||||
|
|
||||||
|
//
|
||||||
|
// update retry count
|
||||||
|
//
|
||||||
|
realIrpNextStack->Parameters.Others.Argument1 = UlongToPtr(retryCount-1);
|
||||||
|
|
||||||
if (((ULONG)(ULONG_PTR)realIrpNextStack->Parameters.Others.Argument1)) {
|
if (((ULONG)(ULONG_PTR)realIrpNextStack->Parameters.Others.Argument1)) {
|
||||||
|
|
||||||
|
@ -2844,6 +2855,7 @@ CdRomSetVolumeIntermediateCompletion(
|
||||||
PIRP realIrp = NULL;
|
PIRP realIrp = NULL;
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
BOOLEAN retry;
|
BOOLEAN retry;
|
||||||
|
ULONG retryCount;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Extract the 'real' irp from the irpstack.
|
// Extract the 'real' irp from the irpstack.
|
||||||
|
@ -2901,7 +2913,18 @@ CdRomSetVolumeIntermediateCompletion(
|
||||||
retry = TRUE;
|
retry = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (retry && realIrpNextStack->Parameters.Others.Argument1--) {
|
//
|
||||||
|
// get current retry count
|
||||||
|
//
|
||||||
|
retryCount = PtrToUlong(realIrpNextStack->Parameters.Others.Argument1);
|
||||||
|
|
||||||
|
if (retry && retryCount) {
|
||||||
|
|
||||||
|
//
|
||||||
|
// update retry count
|
||||||
|
//
|
||||||
|
realIrpNextStack->Parameters.Others.Argument1 = UlongToPtr(retryCount-1);
|
||||||
|
|
||||||
|
|
||||||
if (((ULONG)(ULONG_PTR)realIrpNextStack->Parameters.Others.Argument1)) {
|
if (((ULONG)(ULONG_PTR)realIrpNextStack->Parameters.Others.Argument1)) {
|
||||||
|
|
||||||
|
|
|
@ -837,6 +837,7 @@ CdRompPrintAllFeaturePages(
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
CdRomUpdateMmcDriveCapabilitiesCompletion(
|
CdRomUpdateMmcDriveCapabilitiesCompletion(
|
||||||
IN PDEVICE_OBJECT Unused,
|
IN PDEVICE_OBJECT Unused,
|
||||||
IN PIRP Irp,
|
IN PIRP Irp,
|
||||||
|
@ -851,6 +852,9 @@ CdRomUpdateMmcDriveCapabilitiesCompletion(
|
||||||
PIO_STACK_LOCATION irpStack = IoGetCurrentIrpStackLocation(Irp);
|
PIO_STACK_LOCATION irpStack = IoGetCurrentIrpStackLocation(Irp);
|
||||||
NTSTATUS status = STATUS_UNSUCCESSFUL;
|
NTSTATUS status = STATUS_UNSUCCESSFUL;
|
||||||
PIRP delayedIrp;
|
PIRP delayedIrp;
|
||||||
|
ULONG retryCount;
|
||||||
|
LARGE_INTEGER delay;
|
||||||
|
|
||||||
|
|
||||||
// completion routine should retry as neccessary.
|
// completion routine should retry as neccessary.
|
||||||
// when success, clear the flag to allow startio to proceed.
|
// when success, clear the flag to allow startio to proceed.
|
||||||
|
@ -910,9 +914,19 @@ CdRomUpdateMmcDriveCapabilitiesCompletion(
|
||||||
retry = TRUE;
|
retry = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (retry && irpStack->Parameters.Others.Argument4--) {
|
//
|
||||||
|
// get current retry count
|
||||||
|
//
|
||||||
|
retryCount = PtrToUlong(irpStack->Parameters.Others.Argument1);
|
||||||
|
|
||||||
|
if (retry && retryCount) {
|
||||||
|
|
||||||
|
//
|
||||||
|
// update retry count
|
||||||
|
//
|
||||||
|
irpStack->Parameters.Others.Argument1 = UlongToPtr(retryCount-1);
|
||||||
|
|
||||||
|
|
||||||
LARGE_INTEGER delay;
|
|
||||||
delay.QuadPart = retryInterval;
|
delay.QuadPart = retryInterval;
|
||||||
delay.QuadPart *= (LONGLONG)1000 * 1000 * 10;
|
delay.QuadPart *= (LONGLONG)1000 * 1000 * 10;
|
||||||
|
|
||||||
|
@ -1038,7 +1052,7 @@ CdRomPrepareUpdateCapabilitiesIrp(
|
||||||
nextStack->Parameters.Scsi.Srb = srb;
|
nextStack->Parameters.Scsi.Srb = srb;
|
||||||
irp->MdlAddress = mmcData->CapabilitiesMdl;
|
irp->MdlAddress = mmcData->CapabilitiesMdl;
|
||||||
irp->AssociatedIrp.SystemBuffer = mmcData->CapabilitiesBuffer;
|
irp->AssociatedIrp.SystemBuffer = mmcData->CapabilitiesBuffer;
|
||||||
IoSetCompletionRoutine(irp, CdRomUpdateMmcDriveCapabilitiesCompletion, Fdo,
|
IoSetCompletionRoutine(irp, (PIO_COMPLETION_ROUTINE)CdRomUpdateMmcDriveCapabilitiesCompletion, Fdo,
|
||||||
TRUE, TRUE, TRUE);
|
TRUE, TRUE, TRUE);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue