/* INCLUDES *****************************************************************/
-#include <ddk/ntddk.h>
-#include <ddk/scsi.h>
-#include <ddk/class2.h>
-#include <ddk/ntddscsi.h>
-#include <ntos/minmax.h>
+#include <ntddk.h>
+#include <scsi.h>
+#include <ntddscsi.h>
+#include <ntdddisk.h>
+#include <ntddcdrm.h>
+#include <include/class2.h>
+#include <stdio.h>
#define NDEBUG
#include <debug.h>
MODE_READ_RECOVERY_PAGE ReadRecoveryPage;
} ERROR_RECOVERY_DATA10, *PERROR_RECOVERY_DATA10;
+typedef struct _MODE_CAPABILITIES_PAGE2
+{
+ UCHAR PageCode:6;
+ UCHAR Reserved1:1;
+ UCHAR PSBit:1;
+ UCHAR PageLength;
+ UCHAR Reserved2[2];
+ UCHAR Capabilities[4];
+ UCHAR MaximumSpeedSupported[2];
+ UCHAR Reserved3;
+ UCHAR NumberVolumeLevels;
+ UCHAR BufferSize[2];
+ UCHAR CurrentSpeed[2];
+ UCHAR Reserved4;
+ UCHAR Reserved5:1;
+ UCHAR DigitalOutput:4;
+ UCHAR Reserved6:3;
+ UCHAR Reserved7[2];
+} MODE_CAPABILITIES_PAGE2, *PMODE_CAPABILITIES_PAGE2;
+
typedef struct _MODE_CAPABILITIES_DATA6
{
MODE_PARAMETER_HEADER Header;
CdromTimerRoutine(IN PDEVICE_OBJECT DeviceObject,
IN PVOID Context);
-VOID
+VOID STDCALL
CdromWorkItem(IN PDEVICE_OBJECT DeviceObject,
IN PVOID Context);
* DriverEntry
*
* DESCRIPTION:
- * This function initializes the driver, locates and claims
+ * This function initializes the driver, locates and claims
* hardware resources, and creates various NT objects needed
* to process I/O requests.
*
CdromClassCreateMediaChangeEvent(IN PDEVICE_EXTENSION DeviceExtension,
IN ULONG DeviceNumber)
{
- WCHAR NameBuffer[MAX_PATH];
- UNICODE_STRING Name;
- swprintf (NameBuffer,
- L"\\Device\\MediaChangeEvent%lu",
- DeviceNumber);
- RtlInitUnicodeString (&Name,
- NameBuffer);
DeviceExtension->MediaChangeEvent =
- IoCreateSynchronizationEvent (&Name,
+ IoCreateSynchronizationEvent (NULL,
&DeviceExtension->MediaChangeEventHandle);
KeClearEvent (DeviceExtension->MediaChangeEvent);
Cdb->MODE_SENSE.AllocationLength = (UCHAR)Length;
Buffer = ExAllocatePool (NonPagedPool,
- max(sizeof(ERROR_RECOVERY_DATA6),
- max(sizeof(ERROR_RECOVERY_DATA10),
- max(sizeof(MODE_CAPABILITIES_DATA6),
+ max(sizeof(ERROR_RECOVERY_DATA6),
+ max(sizeof(ERROR_RECOVERY_DATA10),
+ max(sizeof(MODE_CAPABILITIES_DATA6),
sizeof(MODE_CAPABILITIES_DATA10)))));
if (Buffer == NULL)
{
/* Try the 10 byte version */
Length = sizeof(MODE_READ_RECOVERY_PAGE) + MODE_HEADER_LENGTH10;
- RtlZeroMemory (&Srb,
+ RtlZeroMemory (&Srb,
sizeof(SCSI_REQUEST_BLOCK));
Srb.CdbLength = 10;
Srb.TimeOutValue = DiskDeviceExtension->TimeOutValue;
{
DbgPrint(" Drive supports software slot selection\n");
}
- DbgPrint(" Maximum speed is %d kB/s\n",
- (CapabilitiesData->MaximumSpeedSupported[0] << 8)
+ DbgPrint(" Maximum speed is %d kB/s\n",
+ (CapabilitiesData->MaximumSpeedSupported[0] << 8)
| CapabilitiesData->MaximumSpeedSupported[1]);
- DbgPrint(" Current speed is %d kB/s\n",
- (CapabilitiesData->CurrentSpeed[0] << 8)
+ DbgPrint(" Current speed is %d kB/s\n",
+ (CapabilitiesData->CurrentSpeed[0] << 8)
| CapabilitiesData->CurrentSpeed[1]);
DbgPrint(" Number of discrete volume levels is %d\n",
- (CapabilitiesData->Reserved3 << 8)
+ (CapabilitiesData->Reserved3 << 8)
| CapabilitiesData->NumberVolumeLevels);
DbgPrint(" Buffer size is %d kB\n",
- (CapabilitiesData->BufferSize[0] << 8)
+ (CapabilitiesData->BufferSize[0] << 8)
| CapabilitiesData->BufferSize[1]);
#endif
}
*/
static NTSTATUS
CdromClassReadTocEntry (PDEVICE_OBJECT DeviceObject,
- UINT TrackNo,
+ SIZE_T TrackNo,
PVOID Buffer,
- UINT Length)
+ SIZE_T Length)
{
PDEVICE_EXTENSION DeviceExtension;
SCSI_REQUEST_BLOCK Srb;
static NTSTATUS
CdromClassReadLastSession (PDEVICE_OBJECT DeviceObject,
- UINT TrackNo,
+ SIZE_T TrackNo,
PVOID Buffer,
- UINT Length)
+ SIZE_T Length)
{
PDEVICE_EXTENSION DeviceExtension;
SCSI_REQUEST_BLOCK Srb;
if (Retry == TRUE &&
(ULONG)OrigNextIrpStack->Parameters.Others.Argument1 > 0)
{
- DPRINT1 ("Try again (Retry count %lu)\n",
+ DPRINT1 ("Try again (Retry count 0x%p)\n",
(ULONG)OrigNextIrpStack->Parameters.Others.Argument1);
- (ULONG)OrigNextIrpStack->Parameters.Others.Argument1--;
+ OrigNextIrpStack->Parameters.Others.Argument1 = (PVOID)((ULONG_PTR)OrigNextIrpStack->Parameters.Others.Argument1 - 1);
/* Release 'old' buffers */
ExFreePool (Srb->SenseInfoBuffer);
}
-VOID
+VOID STDCALL
CdromWorkItem(IN PDEVICE_OBJECT DeviceObject,
IN PVOID Context)
{