ReactOS 0.4.15-dev-7788-g1ad9096
cdrom.h File Reference
#include "wdf.h"
#include "ntddmmc.h"
#include "ntddcdvd.h"
#include "ntddcdrm.h"
#include "ntdddisk.h"
#include "ntddtape.h"
#include "ntddscsi.h"
#include "ntddvol.h"
#include "specstrings.h"
#include "cdromp.h"
#include <initguid.h>
#include <storswtr.h>
Include dependency graph for cdrom.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _ERROR_RECOVERY_DATA
 
struct  _CDROM_DRIVER_EXTENSION
 
struct  _CDROM_MMC_EXTENSION
 
struct  _CDROM_SCRATCH_READ_WRITE_CONTEXT
 
struct  _CDROM_SCRATCH_CONTEXT
 
struct  _CDROM_IOCTL_CONTEXT
 
struct  _CDROM_READ_WRITE_CONTEXT
 
struct  _CDROM_DATA
 
struct  _CDROM_POWER_OPTIONS
 
struct  _CDROM_POWER_CONTEXT
 
struct  _CDROM_DEVICE_EXTENSION
 
struct  _CDROM_REQUEST_CONTEXT
 
struct  _COMPLETION_CONTEXT
 

Macros

#define DEBUG_COMP_ID   DPFLTR_CDROM_ID
 
#define WPP_GUID_CDROM   (A4196372, C3C4, 42d5, 87BF, 7EDB2E9BCC27)
 
#define WPP_CONTROL_GUIDS   WPP_CONTROL_GUIDS_NORMAL_FLAGS(WPP_GUID_CDROM)
 
#define CDROM_HACK_DEC_RRD   (0x00000001)
 
#define CDROM_HACK_FUJITSU_FMCD_10x   (0x00000002)
 
#define CDROM_HACK_HITACHI_GD_2000   (0x00000008)
 
#define CDROM_HACK_TOSHIBA_SD_W1101   (0x00000010)
 
#define CDROM_HACK_BAD_GET_CONFIG_SUPPORT   (0x00000100)
 
#define CDROM_HACK_BAD_TYPE_ONE_GET_CONFIG   (0x00000800)
 
#define CDROM_HACK_BAD_VENDOR_PROFILES   (0x00001000)
 
#define CDROM_HACK_MSFT_VIRTUAL_ODD   (0x00002000)
 
#define CDROM_HACK_LOCKED_PAGES   (0x80000000)
 
#define CDROM_HACK_VALID_FLAGS   (0x00003fff)
 
#define CDROM_HACK_INVALID_FLAGS   (~CDROM_HACK_VALID_FLAGS)
 
#define WRITE_RETRY_DELAY_CD_1x   ((LONGLONG)4266667)
 
#define WRITE_RETRY_DELAY_CD_4x   ((LONGLONG)1066667)
 
#define WRITE_RETRY_DELAY_CD_10x   ((LONGLONG) 426667)
 
#define WRITE_RETRY_DELAY_DVD_1x   ((LONGLONG) 473373)
 
#define WRITE_RETRY_DELAY_DVD_4x   ((LONGLONG) 118343)
 
#define WRITE_RETRY_DELAY_DVD_16x   ((LONGLONG) 29586)
 
#define WRITE_RETRY_DELAY_HDDVD_1x   ((LONGLONG) 143498)
 
#define MAXIMUM_RETRIES   4
 
#define CDROM_GET_CONFIGURATION_TIMEOUT   (0x4)
 
#define CDROM_READ_DISC_INFORMATION_TIMEOUT   (0x4)
 
#define CDROM_TEST_UNIT_READY_TIMEOUT   (0x14)
 
#define CDROM_GET_PERFORMANCE_TIMEOUT   (0x14)
 
#define CDROM_READ_CAPACITY_TIMEOUT   (0x14)
 
#define START_UNIT_TIMEOUT   (60 * 4)
 
#define MEDIA_CHANGE_TIMEOUT_TIME   300
 
#define DEV_SAFE_START_UNIT   0x00000004
 
#define DEV_POWER_PROTECTED   0x00000010
 
#define CDROM_SPECIAL_DISABLE_SPIN_DOWN   0x00000001
 
#define CDROM_SPECIAL_DISABLE_WRITE_CACHE   0x00000010
 
#define SRB_CLASS_FLAGS_LOW_PRIORITY   0x10000000
 
#define SRB_CLASS_FLAGS_PAGING   0x40000000
 
#define CDROM_INTERPRET_SENSE_INFO2_MAXIMUM_HISTORY_COUNT   30000
 
#define IOCTL_MCN_SYNC_FAKE_IOCTL   IOCTL_DISK_UPDATE_DRIVE_SIZE
 
#define CDROM_FLAG_WINPE_MODE   0x00000001
 
#define CdromMmcUpdateComplete   0
 
#define CdromMmcUpdateRequired   1
 
#define CdromMmcUpdateStarted   2
 
#define SCSI_CDROM_TIMEOUT   10
 
#define SCSI_CHANGER_BONUS_TIMEOUT   10
 
#define SCSI_CDROM_OPC_TIMEOUT   260
 
#define HITACHI_MODE_DATA_SIZE   12
 
#define MODE_DATA_SIZE   64
 
#define RAW_SECTOR_SIZE   2352
 
#define COOKED_SECTOR_SIZE   2048
 
#define CDROM_SRB_LIST_SIZE   4
 
#define PLAY_ACTIVE(x)   (x->DeviceAdditionalData.PlayActive)
 
#define MSF_TO_LBA(Minutes, Seconds, Frames)    (ULONG)((60 * 75 * (Minutes)) + (75 * (Seconds)) + ((Frames) - 150))
 
#define ANY_SECTOR   0
 
#define CD_DA_SECTOR   1
 
#define YELLOW_MODE1_SECTOR   2
 
#define YELLOW_MODE2_SECTOR   3
 
#define FORM2_MODE1_SECTOR   4
 
#define FORM2_MODE2_SECTOR   5
 
#define MAX_COPY_PROTECT_AGID   4
 
#define CDROM_TAG_AUTORUN_DISABLE   'ACcS'
 
#define CDROM_TAG_MEDIA_CHANGE_DETECTION   'aCcS'
 
#define CDROM_TAG_SCRATCH   'BCcS'
 
#define CDROM_TAG_GET_CONFIG   'CCcS'
 
#define CDROM_TAG_COMPLETION_CONTEXT   'cCcS'
 
#define CDROM_TAG_DESCRIPTOR   'DCcS'
 
#define CDROM_TAG_DISC_INFO   'dCcS'
 
#define CDROM_TAG_SYNC_EVENT   'eCcS'
 
#define CDROM_TAG_FEATURE   'FCcS'
 
#define CDROM_TAG_GESN   'GCcS'
 
#define CDROM_TAG_SENSE_INFO   'ICcS'
 
#define CDROM_TAG_INQUIRY   'iCcS'
 
#define CDROM_TAG_MODE_DATA   'MCcS'
 
#define CDROM_TAG_STREAM   'OCCS'
 
#define CDROM_TAG_NOTIFICATION   'oCcS'
 
#define CDROM_TAG_PLAY_ACTIVE   'pCcS'
 
#define CDROM_TAG_REGISTRY   'rCcS'
 
#define CDROM_TAG_SRB   'SCcS'
 
#define CDROM_TAG_STRINGS   'sCcS'
 
#define CDROM_TAG_UPDATE_CAP   'UCcS'
 
#define CDROM_TAG_ZERO_POWER_ODD   'ZCcS'
 
#define DVD_TAG_READ_KEY   'uCcS'
 
#define DVD_TAG_RPC2_CHECK   'VCcS'
 
#define DVD_TAG_DVD_REGION   'vCcS'
 
#define DVD_TAG_SECURITY   'XCcS'
 
#define CDROM_SUBKEY_NAME   (L"CdRom")
 
#define CDROM_READ_CD_NAME   (L"ReadCD")
 
#define CDROM_NON_MMC_DRIVE_NAME   (L"NonMmc")
 
#define CDROM_TYPE_ONE_GET_CONFIG_NAME   (L"NoTypeOneGetConfig")
 
#define CDROM_NON_MMC_VENDOR_SPECIFIC_PROFILE   (L"NonMmcVendorSpecificProfile")
 
#define DVD_DEFAULT_REGION   (L"DefaultDvdRegion")
 
#define DVD_MAX_REGION   8
 
#define AACS_MKB_PACK_SIZE   0x8000
 
#define FREE_POOL(_PoolPtr)
 
#define EXCLUSIVE_MODE(_CdData)   (_CdData->ExclusiveOwner != NULL)
 
#define EXCLUSIVE_OWNER(_CdData, _FileObject)   (_CdData->ExclusiveOwner == _FileObject)
 
#define IS_SCSIOP_READ(opCode)
 
#define IS_SCSIOP_WRITE(opCode)
 
#define IS_SCSIOP_READWRITE(opCode)   (IS_SCSIOP_READ(opCode) || IS_SCSIOP_WRITE(opCode))
 
#define SET_FLAG(Flags, Bit)   ((Flags) |= (Bit))
 
#define CLEAR_FLAG(Flags, Bit)   ((Flags) &= ~(Bit))
 
#define TEST_FLAG(Flags, Bit)   (((Flags) & (Bit)) != 0)
 
#define SIZEOF_ARRAY(ar)   (sizeof(ar)/sizeof((ar)[0]))
 
#define UNIT_100NS_PER_SECOND   (10*1000*1000)
 
#define SECONDS_TO_100NS_UNITS(x)   (((LONGLONG)x) * UNIT_100NS_PER_SECOND)
 
#define SET_FLAG(Flags, Bit)   ((Flags) |= (Bit))
 
#define CLEAR_FLAG(Flags, Bit)   ((Flags) &= ~(Bit))
 
#define TEST_FLAG(Flags, Bit)   (((Flags) & (Bit)) != 0)
 

Typedefs

typedef struct _ERROR_RECOVERY_DATA ERROR_RECOVERY_DATA
 
typedef struct _ERROR_RECOVERY_DATAPERROR_RECOVERY_DATA
 
typedef struct _CDROM_DEVICE_EXTENSION CDROM_DEVICE_EXTENSION
 
typedef struct _CDROM_DEVICE_EXTENSIONPCDROM_DEVICE_EXTENSION
 
typedef VOID(* PCDROM_ERROR_HANDLER) (_In_ PCDROM_DEVICE_EXTENSION DeviceExtension, _In_ PSCSI_REQUEST_BLOCK Srb, _Inout_ PNTSTATUS Status, _Inout_ PBOOLEAN Retry)
 
typedef struct _CDROM_DRIVER_EXTENSION CDROM_DRIVER_EXTENSION
 
typedef struct _CDROM_DRIVER_EXTENSIONPCDROM_DRIVER_EXTENSION
 
typedef struct _CDROM_MMC_EXTENSION CDROM_MMC_EXTENSION
 
typedef struct _CDROM_MMC_EXTENSIONPCDROM_MMC_EXTENSION
 
typedef struct _CDROM_SCRATCH_READ_WRITE_CONTEXT CDROM_SCRATCH_READ_WRITE_CONTEXT
 
typedef struct _CDROM_SCRATCH_READ_WRITE_CONTEXTPCDROM_SCRATCH_READ_WRITE_CONTEXT
 
typedef struct _CDROM_SCRATCH_CONTEXT CDROM_SCRATCH_CONTEXT
 
typedef struct _CDROM_SCRATCH_CONTEXTPCDROM_SCRATCH_CONTEXT
 
typedef struct _CDROM_IOCTL_CONTEXT CDROM_IOCTL_CONTEXT
 
typedef struct _CDROM_IOCTL_CONTEXTPCDROM_IOCTL_CONTEXT
 
typedef struct _CDROM_READ_WRITE_CONTEXT CDROM_READ_WRITE_CONTEXT
 
typedef struct _CDROM_READ_WRITE_CONTEXTPCDROM_READ_WRITE_CONTEXT
 
typedef struct _CDROM_DATA CDROM_DATA
 
typedef struct _CDROM_DATAPCDROM_DATA
 
typedef struct _CDROM_POWER_OPTIONS CDROM_POWER_OPTIONS
 
typedef struct _CDROM_POWER_OPTIONSPCDROM_POWER_OPTIONS
 
typedef struct _CDROM_POWER_CONTEXT CDROM_POWER_CONTEXT
 
typedef struct _CDROM_POWER_CONTEXTPCDROM_POWER_CONTEXT
 
typedef NTSTATUS SYNC_HANDLER(_In_ WDFDEVICE Device, _In_ WDFREQUEST Request)
 
typedef SYNC_HANDLERPSYNC_HANDLER
 
typedef struct _CDROM_REQUEST_CONTEXT CDROM_REQUEST_CONTEXT
 
typedef struct _CDROM_REQUEST_CONTEXTPCDROM_REQUEST_CONTEXT
 
typedef struct _COMPLETION_CONTEXT COMPLETION_CONTEXT
 
typedef struct _COMPLETION_CONTEXTPCOMPLETION_CONTEXT
 
typedef enum CDROM_DEVICE_INTERFACESPCDROM_DEVICE_INTERFACES
 
typedef VOID(* PCDROM_SCAN_FOR_SPECIAL_HANDLER) (_In_ PCDROM_DEVICE_EXTENSION DeviceExtension, _In_ ULONG_PTR Data)
 

Enumerations

enum  CDROM_POWER_DOWN_STATE {
  PowerDownDeviceInitial , PowerDownDeviceLocked , PowerDownDeviceQuiesced , PowerDownDeviceFlushed ,
  PowerDownDeviceStopped , PowerDownDeviceOff , PowerDownDeviceUnlocked
}
 
enum  CDROM_POWER_UP_STATE {
  PowerUpDeviceInitial , PowerUpDeviceLocked , PowerUpDeviceOn , PowerUpDeviceStarted ,
  PowerUpDeviceUnlocked
}
 
enum  CDROM_DEVICE_INTERFACES { CdRomDeviceInterface = 0 , MountedDeviceInterface }
 

Functions

 _IRQL_requires_max_ (DISPATCH_LEVEL) NTKERNELAPI BOOLEAN NTAPI PsIsThreadTerminating(_In_ PETHREAD Thread)
 
 C_ASSERT ((MAXULONG - sizeof(SRB_HISTORY))/30000 >=sizeof(SRB_HISTORY_ITEM))
 
FORCEINLINE BOOLEAN ValidChar (UCHAR Ch)
 
FORCEINLINE BOOLEAN PORT_ALLOCATED_SENSE (_In_ PCDROM_DEVICE_EXTENSION DeviceExtension, _In_ PSCSI_REQUEST_BLOCK Srb)
 
FORCEINLINE VOID FREE_PORT_ALLOCATED_SENSE_BUFFER (_In_ PCDROM_DEVICE_EXTENSION DeviceExtension, _In_ PSCSI_REQUEST_BLOCK Srb)
 
VOID NTAPI SequentialQueueEvtIoReadWrite (_In_ WDFQUEUE Queue, _In_ WDFREQUEST Request, _In_ size_t Length)
 
 _IRQL_requires_max_ (PASSIVE_LEVEL) NTSTATUS DeviceClaimRelease(_In_ PCDROM_DEVICE_EXTENSION DeviceExtension
 
 _IRQL_requires_max_ (APC_LEVEL) VOID DeviceReleaseMcnResources(_In_ PCDROM_DEVICE_EXTENSION DeviceExtension)
 
BOOLEAN RequestSenseInfoInterpret (_In_ PCDROM_DEVICE_EXTENSION DeviceExtension, _In_ WDFREQUEST Request, _In_ PSCSI_REQUEST_BLOCK Srb, _In_ ULONG RetriedCount, _Out_ NTSTATUS *Status, _Out_opt_ _Deref_out_range_(0, MAXIMUM_RETRY_FOR_SINGLE_IO_IN_100NS_UNITS) LONGLONG *RetryIntervalIn100ns)
 
VOID RequestSetReceivedTime (_In_ WDFREQUEST Request)
 
VOID RequestSetSentTime (_In_ WDFREQUEST Request)
 
VOID RequestClearSendTime (_In_ WDFREQUEST Request)
 
BOOLEAN RequestSenseInfoInterpretForScratchBuffer (_In_ PCDROM_DEVICE_EXTENSION DeviceExtension, _In_ ULONG RetriedCount, _Out_ NTSTATUS *Status, _Out_ _Deref_out_range_(0, MAXIMUM_RETRY_FOR_SINGLE_IO_IN_100NS_UNITS) LONGLONG *RetryIntervalIn100ns)
 
VOID DeviceSendNotification (_In_ PCDROM_DEVICE_EXTENSION DeviceExtension, _In_ const GUID *Guid, _In_ ULONG ExtraDataSize, _In_opt_ PVOID ExtraData)
 
VOID DeviceSendStartUnit (_In_ WDFDEVICE Device)
 
VOID DeviceReleaseQueue (_In_ WDFDEVICE Device)
 
VOID DevicePerfIncrementErrorCount (_In_ PCDROM_DEVICE_EXTENSION DeviceExtension)
 
NTSTATUS DeviceErrorHandlerForMmc (_In_ PCDROM_DEVICE_EXTENSION DeviceExtension, _In_ PSCSI_REQUEST_BLOCK Srb, _Inout_ PNTSTATUS Status, _Inout_ PBOOLEAN Retry)
 
NTSTATUS DeviceErrorHandlerForHitachiGD2000 (_In_ PCDROM_DEVICE_EXTENSION DeviceExtension, _In_ PSCSI_REQUEST_BLOCK Srb, _Inout_ PNTSTATUS Status, _Inout_ PBOOLEAN Retry)
 
VOID DeviceSetMediaChangeStateEx (_In_ PCDROM_DEVICE_EXTENSION DeviceExtension, _In_ MEDIA_CHANGE_DETECTION_STATE NewState, _Inout_opt_ PMEDIA_CHANGE_DETECTION_STATE OldState)
 
NTSTATUS RequestSynchronizeProcessWithSerialQueue (_In_ WDFDEVICE Device, _In_ WDFREQUEST Request)
 
NTSTATUS RequestIsIoctlBlockedByExclusiveAccess (_In_ WDFREQUEST Request, _Out_ PBOOLEAN IsBlocked)
 
VOID DeviceSendIoctlAsynchronously (_In_ PCDROM_DEVICE_EXTENSION DeviceExtension, _In_ ULONG IoControlCode, _In_ PDEVICE_OBJECT TargetDeviceObject)
 
BOOLEAN DeviceIsMmcUpdateRequired (_In_ WDFDEVICE Device)
 
NTSTATUS RequestSetContextFields (_In_ WDFREQUEST Request, _In_ PSYNC_HANDLER Handler)
 
NTSTATUS RequestDuidGetDeviceIdProperty (_In_ PCDROM_DEVICE_EXTENSION DeviceExtension, _In_ WDFREQUEST Request, _In_ WDF_REQUEST_PARAMETERS RequestParameters, _Out_ size_t *DataLength)
 
NTSTATUS RequestDuidGetDeviceProperty (_In_ PCDROM_DEVICE_EXTENSION DeviceExtension, _In_ WDFREQUEST Request, _In_ WDF_REQUEST_PARAMETERS RequestParameters, _Out_ size_t *DataLength)
 
 _In_reads_bytes_ (Length) PCHAR ModeSenseBuffer
 
VOID RequestSetupMcnSyncIrp (_In_ PCDROM_DEVICE_EXTENSION DeviceExtension)
 
NTSTATUS DeviceZPODDGetPowerupReason (_In_ PCDROM_DEVICE_EXTENSION DeviceExtension, _Out_ PSTORAGE_IDLE_POWERUP_REASON PowerupReason)
 
FORCEINLINE ULONG CountOfSetBitsUChar (UCHAR _X)
 
FORCEINLINE ULONG CountOfSetBitsULong (ULONG _X)
 
FORCEINLINE ULONG CountOfSetBitsULong32 (ULONG32 _X)
 
FORCEINLINE ULONG CountOfSetBitsULong64 (ULONG64 _X)
 
FORCEINLINE ULONG CountOfSetBitsUlongPtr (ULONG_PTR _X)
 
FORCEINLINE BOOLEAN IsVolumeMounted (_In_ PDEVICE_OBJECT DeviceObject)
 
FORCEINLINE _Ret_range_ (0, MAXIMUM_RETRY_FOR_SINGLE_IO_IN_100NS_UNITS) LONGLONG ConvertSectorsPerSecondTo100nsUnitsFor64kWrite(_In_range_(1
 
FORCEINLINE UCHAR RequestGetCurrentStackLocationFlags (_In_ WDFREQUEST Request)
 
FORCEINLINE ULONG TimeOutValueGetCapValue (_In_ ULONG TimeOutValue, _In_ ULONG Times)
 
VOID RequestCompletion (_In_ PCDROM_DEVICE_EXTENSION DeviceExtension, _In_ WDFREQUEST Request, _In_ NTSTATUS Status, _In_ ULONG_PTR Information)
 
NTSTATUS RequestSend (_In_ PCDROM_DEVICE_EXTENSION DeviceExtension, _In_ WDFREQUEST Request, _In_ WDFIOTARGET IoTarget, _In_ ULONG Flags, _Out_opt_ PBOOLEAN RequestSent)
 
VOID RequestProcessInternalDeviceControl (_In_ WDFREQUEST Request, _In_ PCDROM_DEVICE_EXTENSION DeviceExtension)
 

Variables

CDROM_SCAN_FOR_SPECIAL_INFO CdromHackItems []
 
DRIVER_INITIALIZE DriverEntry
 
EVT_WDF_DRIVER_DEVICE_ADD DriverEvtDeviceAdd
 
EVT_WDF_OBJECT_CONTEXT_CLEANUP DriverEvtCleanup
 
EVT_WDF_OBJECT_CONTEXT_CLEANUP DeviceEvtCleanup
 
EVT_WDF_FILE_CLOSE DeviceEvtFileClose
 
EVT_WDF_IO_IN_CALLER_CONTEXT DeviceEvtIoInCallerContext
 
EVT_WDF_DEVICE_SELF_MANAGED_IO_INIT DeviceEvtSelfManagedIoInit
 
EVT_WDF_DEVICE_SELF_MANAGED_IO_CLEANUP DeviceEvtSelfManagedIoCleanup
 
EVT_WDF_DEVICE_D0_ENTRY DeviceEvtD0Entry
 
EVT_WDF_DEVICE_D0_EXIT DeviceEvtD0Exit
 
EVT_WDF_DEVICE_SURPRISE_REMOVAL DeviceEvtSurpriseRemoval
 
EVT_WDF_IO_QUEUE_IO_DEFAULT CreateQueueEvtIoDefault
 
EVT_WDF_IO_QUEUE_IO_DEVICE_CONTROL SequentialQueueEvtIoDeviceControl
 
EVT_WDF_IO_QUEUE_IO_CANCELED_ON_QUEUE SequentialQueueEvtCanceledOnQueue
 
EVT_WDF_OBJECT_CONTEXT_CLEANUP RequestEvtCleanup
 
EVT_WDFDEVICE_WDM_IRP_PREPROCESS RequestProcessShutdownFlush
 
EVT_WDFDEVICE_WDM_IRP_PREPROCESS RequestProcessSetPower
 
_In_ BOOLEAN Release
 
_In_ PSTORAGE_PROPERTY_ID PropertyId
 
_In_ PSTORAGE_PROPERTY_ID _Outptr_ PSTORAGE_DESCRIPTOR_HEADERDescriptor
 
_In_ ULONG_PTR Data
 
_In_z_ PCHAR TargetString
 
_In_opt_ PWSTR SubkeyName
 
_In_opt_ PWSTR _In_ PWSTR ParameterName
 
_In_opt_ PWSTR _In_ PWSTR _Inout_ PULONG ParameterValue
 
_In_ ULONG_PTR HackFlags
 
_In_ PSCSI_REQUEST_BLOCK Srb
 
_In_ PSCSI_REQUEST_BLOCK _In_opt_ PVOID BufferAddress
 
_In_ PSCSI_REQUEST_BLOCK _In_opt_ PVOID _In_ ULONG BufferLength
 
_In_ PSCSI_REQUEST_BLOCK _In_opt_ PVOID _In_ ULONG _In_ BOOLEAN WriteToDevice
 
_In_ PSCSI_REQUEST_BLOCK _In_opt_ PVOID _In_ ULONG _In_ BOOLEAN _In_opt_ WDFREQUEST OriginalRequest
 
EVT_WDF_REQUEST_COMPLETION_ROUTINE DeviceAsynchronousCompletion
 
EVT_WDF_REQUEST_COMPLETION_ROUTINE DeviceReleaseQueueCompletion
 
_In_ ULONG const Length
 
_In_ ULONG const _In_ FEATURE_NUMBER const Feature
 
_In_ ULONG const Usable
 
_In_ PREAD_CAPACITY_DATA ReadCapacityBuffer
 
_In_ CDROM_DEVICE_INTERFACES InterfaceType
 
_In_opt_ PFN_WDF_REQUEST_COMPLETION_ROUTINE CompletionRoutine
 
_In_opt_ PFN_WDF_REQUEST_COMPLETION_ROUTINE _In_opt_ WDFCONTEXT Context
 
_In_ CDROM_SCAN_FOR_SPECIAL_INFO DeviceList []
 
_In_ CDROM_SCAN_FOR_SPECIAL_INFO _In_ PCDROM_SCAN_FOR_SPECIAL_HANDLER Function
 
EVT_WDF_WORKITEM DeviceRestoreDefaultSpeed
 
_In_ PFILE_OBJECT_CONTEXT FileObjectContext
 
_In_ WDFFILEOBJECT FileObject
 
_In_ WDFFILEOBJECT _In_ BOOLEAN IgnorePreviousMediaChanges
 
_In_ WDFREQUEST Request
 
_In_ WDFREQUEST _In_ BOOLEAN RequestFormated
 
IO_COMPLETION_ROUTINE RequestAsynchronousIrpCompletion
 
_In_ ULONG _In_ UCHAR PageCode
 
_In_ ULONG _In_ UCHAR _In_ UCHAR PageControl
 
_In_ size_t _In_ UCHAR PageMode
 
_In_ size_t _In_ UCHAR _In_ BOOLEAN Use6Byte
 
_In_ WDFREQUEST _In_ MEDIA_LOCK_TYPE LockType
 
_In_ WDFREQUEST _In_ MEDIA_LOCK_TYPE _In_ BOOLEAN Lock
 
EVT_WDF_TIMER DeviceMainTimerTickHandler
 
_In_ BOOLEAN UseGesn
 
POWER_SETTING_CALLBACK DevicePowerSettingCallback
 
_In_ BOOLEAN IsActive
 
_In_ BOOLEAN _In_ BOOLEAN SetIdleTimeout
 
_In_ ULONG IoControlCode
 
_In_ ULONG _In_opt_ WDFREQUEST _In_opt_ PVOID InputBuffer
 
_In_ ULONG _In_opt_ WDFREQUEST _In_opt_ PVOID _In_ size_t InputBufferLength
 
_In_ ULONG _In_opt_ WDFREQUEST _In_opt_ PVOID _In_ size_t _In_ PVOID OutputBuffer
 
_In_ ULONG _In_opt_ WDFREQUEST _In_opt_ PVOID _In_ size_t _In_ PVOID _In_ size_t OutputBufferLength
 
_In_ ULONG _In_opt_ WDFREQUEST _In_opt_ PVOID _In_ size_t _In_ PVOID _In_ size_t _Out_ size_tDataLength
 
FORCEINLINE ULONG SectorsPerSecond
 
EVT_WDF_REQUEST_COMPLETION_ROUTINE RequestDummyCompletionRoutine
 
EVT_WDF_WORKITEM IoctlWorkItemRoutine
 
EVT_WDF_WORKITEM ReadWriteWorkItemRoutine
 

Macro Definition Documentation

◆ AACS_MKB_PACK_SIZE

#define AACS_MKB_PACK_SIZE   0x8000

Definition at line 764 of file cdrom.h.

◆ ANY_SECTOR

#define ANY_SECTOR   0

Definition at line 705 of file cdrom.h.

◆ CD_DA_SECTOR

#define CD_DA_SECTOR   1

Definition at line 706 of file cdrom.h.

◆ CDROM_FLAG_WINPE_MODE

#define CDROM_FLAG_WINPE_MODE   0x00000001

Definition at line 237 of file cdrom.h.

◆ CDROM_GET_CONFIGURATION_TIMEOUT

#define CDROM_GET_CONFIGURATION_TIMEOUT   (0x4)

Definition at line 126 of file cdrom.h.

◆ CDROM_GET_PERFORMANCE_TIMEOUT

#define CDROM_GET_PERFORMANCE_TIMEOUT   (0x14)

Definition at line 129 of file cdrom.h.

◆ CDROM_HACK_BAD_GET_CONFIG_SUPPORT

#define CDROM_HACK_BAD_GET_CONFIG_SUPPORT   (0x00000100)

Definition at line 96 of file cdrom.h.

◆ CDROM_HACK_BAD_TYPE_ONE_GET_CONFIG

#define CDROM_HACK_BAD_TYPE_ONE_GET_CONFIG   (0x00000800)

Definition at line 99 of file cdrom.h.

◆ CDROM_HACK_BAD_VENDOR_PROFILES

#define CDROM_HACK_BAD_VENDOR_PROFILES   (0x00001000)

Definition at line 100 of file cdrom.h.

◆ CDROM_HACK_DEC_RRD

#define CDROM_HACK_DEC_RRD   (0x00000001)

Definition at line 88 of file cdrom.h.

◆ CDROM_HACK_FUJITSU_FMCD_10x

#define CDROM_HACK_FUJITSU_FMCD_10x   (0x00000002)

Definition at line 89 of file cdrom.h.

◆ CDROM_HACK_HITACHI_GD_2000

#define CDROM_HACK_HITACHI_GD_2000   (0x00000008)

Definition at line 91 of file cdrom.h.

◆ CDROM_HACK_INVALID_FLAGS

#define CDROM_HACK_INVALID_FLAGS   (~CDROM_HACK_VALID_FLAGS)

Definition at line 105 of file cdrom.h.

◆ CDROM_HACK_LOCKED_PAGES

#define CDROM_HACK_LOCKED_PAGES   (0x80000000)

Definition at line 102 of file cdrom.h.

◆ CDROM_HACK_MSFT_VIRTUAL_ODD

#define CDROM_HACK_MSFT_VIRTUAL_ODD   (0x00002000)

Definition at line 101 of file cdrom.h.

◆ CDROM_HACK_TOSHIBA_SD_W1101

#define CDROM_HACK_TOSHIBA_SD_W1101   (0x00000010)

Definition at line 92 of file cdrom.h.

◆ CDROM_HACK_VALID_FLAGS

#define CDROM_HACK_VALID_FLAGS   (0x00003fff)

Definition at line 104 of file cdrom.h.

◆ CDROM_INTERPRET_SENSE_INFO2_MAXIMUM_HISTORY_COUNT

#define CDROM_INTERPRET_SENSE_INFO2_MAXIMUM_HISTORY_COUNT   30000

Definition at line 176 of file cdrom.h.

◆ CDROM_NON_MMC_DRIVE_NAME

#define CDROM_NON_MMC_DRIVE_NAME   (L"NonMmc")

Definition at line 756 of file cdrom.h.

◆ CDROM_NON_MMC_VENDOR_SPECIFIC_PROFILE

#define CDROM_NON_MMC_VENDOR_SPECIFIC_PROFILE   (L"NonMmcVendorSpecificProfile")

Definition at line 758 of file cdrom.h.

◆ CDROM_READ_CAPACITY_TIMEOUT

#define CDROM_READ_CAPACITY_TIMEOUT   (0x14)

Definition at line 130 of file cdrom.h.

◆ CDROM_READ_CD_NAME

#define CDROM_READ_CD_NAME   (L"ReadCD")

Definition at line 755 of file cdrom.h.

◆ CDROM_READ_DISC_INFORMATION_TIMEOUT

#define CDROM_READ_DISC_INFORMATION_TIMEOUT   (0x4)

Definition at line 127 of file cdrom.h.

◆ CDROM_SPECIAL_DISABLE_SPIN_DOWN

#define CDROM_SPECIAL_DISABLE_SPIN_DOWN   0x00000001

Definition at line 149 of file cdrom.h.

◆ CDROM_SPECIAL_DISABLE_WRITE_CACHE

#define CDROM_SPECIAL_DISABLE_WRITE_CACHE   0x00000010

Definition at line 157 of file cdrom.h.

◆ CDROM_SRB_LIST_SIZE

#define CDROM_SRB_LIST_SIZE   4

Definition at line 696 of file cdrom.h.

◆ CDROM_SUBKEY_NAME

#define CDROM_SUBKEY_NAME   (L"CdRom")

Definition at line 754 of file cdrom.h.

◆ CDROM_TAG_AUTORUN_DISABLE

#define CDROM_TAG_AUTORUN_DISABLE   'ACcS'

Definition at line 724 of file cdrom.h.

◆ CDROM_TAG_COMPLETION_CONTEXT

#define CDROM_TAG_COMPLETION_CONTEXT   'cCcS'

Definition at line 729 of file cdrom.h.

◆ CDROM_TAG_DESCRIPTOR

#define CDROM_TAG_DESCRIPTOR   'DCcS'

Definition at line 730 of file cdrom.h.

◆ CDROM_TAG_DISC_INFO

#define CDROM_TAG_DISC_INFO   'dCcS'

Definition at line 731 of file cdrom.h.

◆ CDROM_TAG_FEATURE

#define CDROM_TAG_FEATURE   'FCcS'

Definition at line 733 of file cdrom.h.

◆ CDROM_TAG_GESN

#define CDROM_TAG_GESN   'GCcS'

Definition at line 734 of file cdrom.h.

◆ CDROM_TAG_GET_CONFIG

#define CDROM_TAG_GET_CONFIG   'CCcS'

Definition at line 728 of file cdrom.h.

◆ CDROM_TAG_INQUIRY

#define CDROM_TAG_INQUIRY   'iCcS'

Definition at line 736 of file cdrom.h.

◆ CDROM_TAG_MEDIA_CHANGE_DETECTION

#define CDROM_TAG_MEDIA_CHANGE_DETECTION   'aCcS'

Definition at line 725 of file cdrom.h.

◆ CDROM_TAG_MODE_DATA

#define CDROM_TAG_MODE_DATA   'MCcS'

Definition at line 737 of file cdrom.h.

◆ CDROM_TAG_NOTIFICATION

#define CDROM_TAG_NOTIFICATION   'oCcS'

Definition at line 739 of file cdrom.h.

◆ CDROM_TAG_PLAY_ACTIVE

#define CDROM_TAG_PLAY_ACTIVE   'pCcS'

Definition at line 740 of file cdrom.h.

◆ CDROM_TAG_REGISTRY

#define CDROM_TAG_REGISTRY   'rCcS'

Definition at line 741 of file cdrom.h.

◆ CDROM_TAG_SCRATCH

#define CDROM_TAG_SCRATCH   'BCcS'

Definition at line 727 of file cdrom.h.

◆ CDROM_TAG_SENSE_INFO

#define CDROM_TAG_SENSE_INFO   'ICcS'

Definition at line 735 of file cdrom.h.

◆ CDROM_TAG_SRB

#define CDROM_TAG_SRB   'SCcS'

Definition at line 742 of file cdrom.h.

◆ CDROM_TAG_STREAM

#define CDROM_TAG_STREAM   'OCCS'

Definition at line 738 of file cdrom.h.

◆ CDROM_TAG_STRINGS

#define CDROM_TAG_STRINGS   'sCcS'

Definition at line 743 of file cdrom.h.

◆ CDROM_TAG_SYNC_EVENT

#define CDROM_TAG_SYNC_EVENT   'eCcS'

Definition at line 732 of file cdrom.h.

◆ CDROM_TAG_UPDATE_CAP

#define CDROM_TAG_UPDATE_CAP   'UCcS'

Definition at line 744 of file cdrom.h.

◆ CDROM_TAG_ZERO_POWER_ODD

#define CDROM_TAG_ZERO_POWER_ODD   'ZCcS'

Definition at line 745 of file cdrom.h.

◆ CDROM_TEST_UNIT_READY_TIMEOUT

#define CDROM_TEST_UNIT_READY_TIMEOUT   (0x14)

Definition at line 128 of file cdrom.h.

◆ CDROM_TYPE_ONE_GET_CONFIG_NAME

#define CDROM_TYPE_ONE_GET_CONFIG_NAME   (L"NoTypeOneGetConfig")

Definition at line 757 of file cdrom.h.

◆ CdromMmcUpdateComplete

#define CdromMmcUpdateComplete   0

Definition at line 241 of file cdrom.h.

◆ CdromMmcUpdateRequired

#define CdromMmcUpdateRequired   1

Definition at line 242 of file cdrom.h.

◆ CdromMmcUpdateStarted

#define CdromMmcUpdateStarted   2

Definition at line 243 of file cdrom.h.

◆ CLEAR_FLAG [1/2]

#define CLEAR_FLAG (   Flags,
  Bit 
)    ((Flags) &= ~(Bit))

Definition at line 1494 of file cdrom.h.

◆ CLEAR_FLAG [2/2]

#define CLEAR_FLAG (   Flags,
  Bit 
)    ((Flags) &= ~(Bit))

Definition at line 1494 of file cdrom.h.

◆ COOKED_SECTOR_SIZE

#define COOKED_SECTOR_SIZE   2048

Definition at line 694 of file cdrom.h.

◆ DEBUG_COMP_ID

#define DEBUG_COMP_ID   DPFLTR_CDROM_ID

Definition at line 48 of file cdrom.h.

◆ DEV_POWER_PROTECTED

#define DEV_POWER_PROTECTED   0x00000010

Definition at line 143 of file cdrom.h.

◆ DEV_SAFE_START_UNIT

#define DEV_SAFE_START_UNIT   0x00000004

Definition at line 139 of file cdrom.h.

◆ DVD_DEFAULT_REGION

#define DVD_DEFAULT_REGION   (L"DefaultDvdRegion")

Definition at line 760 of file cdrom.h.

◆ DVD_MAX_REGION

#define DVD_MAX_REGION   8

Definition at line 761 of file cdrom.h.

◆ DVD_TAG_DVD_REGION

#define DVD_TAG_DVD_REGION   'vCcS'

Definition at line 749 of file cdrom.h.

◆ DVD_TAG_READ_KEY

#define DVD_TAG_READ_KEY   'uCcS'

Definition at line 747 of file cdrom.h.

◆ DVD_TAG_RPC2_CHECK

#define DVD_TAG_RPC2_CHECK   'VCcS'

Definition at line 748 of file cdrom.h.

◆ DVD_TAG_SECURITY

#define DVD_TAG_SECURITY   'XCcS'

Definition at line 750 of file cdrom.h.

◆ EXCLUSIVE_MODE

#define EXCLUSIVE_MODE (   _CdData)    (_CdData->ExclusiveOwner != NULL)

Definition at line 788 of file cdrom.h.

◆ EXCLUSIVE_OWNER

#define EXCLUSIVE_OWNER (   _CdData,
  _FileObject 
)    (_CdData->ExclusiveOwner == _FileObject)

Definition at line 789 of file cdrom.h.

◆ FORM2_MODE1_SECTOR

#define FORM2_MODE1_SECTOR   4

Definition at line 709 of file cdrom.h.

◆ FORM2_MODE2_SECTOR

#define FORM2_MODE2_SECTOR   5

Definition at line 710 of file cdrom.h.

◆ FREE_POOL

#define FREE_POOL (   _PoolPtr)
Value:
if (_PoolPtr != NULL) { \
ExFreePool(_PoolPtr); \
_PoolPtr = NULL; \
}
#define NULL
Definition: types.h:112

Definition at line 782 of file cdrom.h.

◆ HITACHI_MODE_DATA_SIZE

#define HITACHI_MODE_DATA_SIZE   12

Definition at line 690 of file cdrom.h.

◆ IOCTL_MCN_SYNC_FAKE_IOCTL

#define IOCTL_MCN_SYNC_FAKE_IOCTL   IOCTL_DISK_UPDATE_DRIVE_SIZE

Definition at line 181 of file cdrom.h.

◆ IS_SCSIOP_READ

#define IS_SCSIOP_READ (   opCode)
Value:
((opCode == SCSIOP_READ6) || \
(opCode == SCSIOP_READ) || \
(opCode == SCSIOP_READ12) || \
(opCode == SCSIOP_READ16))
#define SCSIOP_READ6
Definition: cdrw_hw.h:874
#define SCSIOP_READ12
Definition: cdrw_hw.h:956
#define SCSIOP_READ
Definition: cdrw_hw.h:905
#define SCSIOP_READ16
Definition: scsi.h:914

Definition at line 791 of file cdrom.h.

◆ IS_SCSIOP_READWRITE

#define IS_SCSIOP_READWRITE (   opCode)    (IS_SCSIOP_READ(opCode) || IS_SCSIOP_WRITE(opCode))

Definition at line 803 of file cdrom.h.

◆ IS_SCSIOP_WRITE

#define IS_SCSIOP_WRITE (   opCode)
Value:
((opCode == SCSIOP_WRITE6) || \
(opCode == SCSIOP_WRITE) || \
(opCode == SCSIOP_WRITE12) || \
(opCode == SCSIOP_WRITE16))
#define SCSIOP_WRITE6
Definition: cdrw_hw.h:876
#define SCSIOP_WRITE
Definition: cdrw_hw.h:906
#define SCSIOP_WRITE12
Definition: cdrw_hw.h:957
#define SCSIOP_WRITE16
Definition: scsi.h:915

Definition at line 797 of file cdrom.h.

◆ MAX_COPY_PROTECT_AGID

#define MAX_COPY_PROTECT_AGID   4

Definition at line 712 of file cdrom.h.

◆ MAXIMUM_RETRIES

#define MAXIMUM_RETRIES   4

Definition at line 124 of file cdrom.h.

◆ MEDIA_CHANGE_TIMEOUT_TIME

#define MEDIA_CHANGE_TIMEOUT_TIME   300

Definition at line 135 of file cdrom.h.

◆ MODE_DATA_SIZE

#define MODE_DATA_SIZE   64

Definition at line 691 of file cdrom.h.

◆ MSF_TO_LBA

#define MSF_TO_LBA (   Minutes,
  Seconds,
  Frames 
)     (ULONG)((60 * 75 * (Minutes)) + (75 * (Seconds)) + ((Frames) - 150))

Definition at line 700 of file cdrom.h.

◆ PLAY_ACTIVE

#define PLAY_ACTIVE (   x)    (x->DeviceAdditionalData.PlayActive)

Definition at line 698 of file cdrom.h.

◆ RAW_SECTOR_SIZE

#define RAW_SECTOR_SIZE   2352

Definition at line 693 of file cdrom.h.

◆ SCSI_CDROM_OPC_TIMEOUT

#define SCSI_CDROM_OPC_TIMEOUT   260

Definition at line 688 of file cdrom.h.

◆ SCSI_CDROM_TIMEOUT

#define SCSI_CDROM_TIMEOUT   10

Definition at line 680 of file cdrom.h.

◆ SCSI_CHANGER_BONUS_TIMEOUT

#define SCSI_CHANGER_BONUS_TIMEOUT   10

Definition at line 681 of file cdrom.h.

◆ SECONDS_TO_100NS_UNITS

#define SECONDS_TO_100NS_UNITS (   x)    (((LONGLONG)x) * UNIT_100NS_PER_SECOND)

Definition at line 1488 of file cdrom.h.

◆ SET_FLAG [1/2]

#define SET_FLAG (   Flags,
  Bit 
)    ((Flags) |= (Bit))

Definition at line 1493 of file cdrom.h.

◆ SET_FLAG [2/2]

#define SET_FLAG (   Flags,
  Bit 
)    ((Flags) |= (Bit))

Definition at line 1493 of file cdrom.h.

◆ SIZEOF_ARRAY

#define SIZEOF_ARRAY (   ar)    (sizeof(ar)/sizeof((ar)[0]))

Definition at line 1482 of file cdrom.h.

◆ SRB_CLASS_FLAGS_LOW_PRIORITY

#define SRB_CLASS_FLAGS_LOW_PRIORITY   0x10000000

Definition at line 162 of file cdrom.h.

◆ SRB_CLASS_FLAGS_PAGING

#define SRB_CLASS_FLAGS_PAGING   0x40000000

Definition at line 165 of file cdrom.h.

◆ START_UNIT_TIMEOUT

#define START_UNIT_TIMEOUT   (60 * 4)

Definition at line 132 of file cdrom.h.

◆ TEST_FLAG [1/2]

#define TEST_FLAG (   Flags,
  Bit 
)    (((Flags) & (Bit)) != 0)

Definition at line 1495 of file cdrom.h.

◆ TEST_FLAG [2/2]

#define TEST_FLAG (   Flags,
  Bit 
)    (((Flags) & (Bit)) != 0)

Definition at line 1495 of file cdrom.h.

◆ UNIT_100NS_PER_SECOND

#define UNIT_100NS_PER_SECOND   (10*1000*1000)

Definition at line 1487 of file cdrom.h.

◆ WPP_CONTROL_GUIDS

Definition at line 58 of file cdrom.h.

◆ WPP_GUID_CDROM

#define WPP_GUID_CDROM   (A4196372, C3C4, 42d5, 87BF, 7EDB2E9BCC27)

Definition at line 56 of file cdrom.h.

◆ WRITE_RETRY_DELAY_CD_10x

#define WRITE_RETRY_DELAY_CD_10x   ((LONGLONG) 426667)

Definition at line 117 of file cdrom.h.

◆ WRITE_RETRY_DELAY_CD_1x

#define WRITE_RETRY_DELAY_CD_1x   ((LONGLONG)4266667)

Definition at line 115 of file cdrom.h.

◆ WRITE_RETRY_DELAY_CD_4x

#define WRITE_RETRY_DELAY_CD_4x   ((LONGLONG)1066667)

Definition at line 116 of file cdrom.h.

◆ WRITE_RETRY_DELAY_DVD_16x

#define WRITE_RETRY_DELAY_DVD_16x   ((LONGLONG) 29586)

Definition at line 120 of file cdrom.h.

◆ WRITE_RETRY_DELAY_DVD_1x

#define WRITE_RETRY_DELAY_DVD_1x   ((LONGLONG) 473373)

Definition at line 118 of file cdrom.h.

◆ WRITE_RETRY_DELAY_DVD_4x

#define WRITE_RETRY_DELAY_DVD_4x   ((LONGLONG) 118343)

Definition at line 119 of file cdrom.h.

◆ WRITE_RETRY_DELAY_HDDVD_1x

#define WRITE_RETRY_DELAY_HDDVD_1x   ((LONGLONG) 143498)

Definition at line 121 of file cdrom.h.

◆ YELLOW_MODE1_SECTOR

#define YELLOW_MODE1_SECTOR   2

Definition at line 707 of file cdrom.h.

◆ YELLOW_MODE2_SECTOR

#define YELLOW_MODE2_SECTOR   3

Definition at line 708 of file cdrom.h.

Typedef Documentation

◆ CDROM_DATA

◆ CDROM_DEVICE_EXTENSION

Definition at line 217 of file cdrom.h.

◆ CDROM_DRIVER_EXTENSION

◆ CDROM_IOCTL_CONTEXT

◆ CDROM_MMC_EXTENSION

◆ CDROM_POWER_CONTEXT

◆ CDROM_POWER_OPTIONS

◆ CDROM_READ_WRITE_CONTEXT

◆ CDROM_REQUEST_CONTEXT

◆ CDROM_SCRATCH_CONTEXT

◆ CDROM_SCRATCH_READ_WRITE_CONTEXT

◆ COMPLETION_CONTEXT

◆ ERROR_RECOVERY_DATA

◆ PCDROM_DATA

◆ PCDROM_DEVICE_EXTENSION

Definition at line 218 of file cdrom.h.

◆ PCDROM_DEVICE_INTERFACES

◆ PCDROM_DRIVER_EXTENSION

◆ PCDROM_ERROR_HANDLER

typedef VOID(* PCDROM_ERROR_HANDLER) (_In_ PCDROM_DEVICE_EXTENSION DeviceExtension, _In_ PSCSI_REQUEST_BLOCK Srb, _Inout_ PNTSTATUS Status, _Inout_ PBOOLEAN Retry)

Definition at line 221 of file cdrom.h.

◆ PCDROM_IOCTL_CONTEXT

◆ PCDROM_MMC_EXTENSION

◆ PCDROM_POWER_CONTEXT

◆ PCDROM_POWER_OPTIONS

◆ PCDROM_READ_WRITE_CONTEXT

◆ PCDROM_REQUEST_CONTEXT

◆ PCDROM_SCAN_FOR_SPECIAL_HANDLER

typedef VOID(* PCDROM_SCAN_FOR_SPECIAL_HANDLER) (_In_ PCDROM_DEVICE_EXTENSION DeviceExtension, _In_ ULONG_PTR Data)

Definition at line 774 of file cdrom.h.

◆ PCDROM_SCRATCH_CONTEXT

◆ PCDROM_SCRATCH_READ_WRITE_CONTEXT

◆ PCOMPLETION_CONTEXT

◆ PERROR_RECOVERY_DATA

◆ PSYNC_HANDLER

Definition at line 628 of file cdrom.h.

◆ SYNC_HANDLER

typedef NTSTATUS SYNC_HANDLER(_In_ WDFDEVICE Device, _In_ WDFREQUEST Request)

Definition at line 623 of file cdrom.h.

Enumeration Type Documentation

◆ CDROM_DEVICE_INTERFACES

Enumerator
CdRomDeviceInterface 
MountedDeviceInterface 

Definition at line 767 of file cdrom.h.

767 {
768 CdRomDeviceInterface = 0, // CdRomClassGuid
769 MountedDeviceInterface // MOUNTDEV_MOUNTED_DEVICE_GUID
enum CDROM_DEVICE_INTERFACES * PCDROM_DEVICE_INTERFACES
CDROM_DEVICE_INTERFACES
Definition: cdrom.h:767
@ CdRomDeviceInterface
Definition: cdrom.h:768
@ MountedDeviceInterface
Definition: cdrom.h:769

◆ CDROM_POWER_DOWN_STATE

Enumerator
PowerDownDeviceInitial 
PowerDownDeviceLocked 
PowerDownDeviceQuiesced 
PowerDownDeviceFlushed 
PowerDownDeviceStopped 
PowerDownDeviceOff 
PowerDownDeviceUnlocked 

Definition at line 407 of file cdrom.h.

407 {
CDROM_POWER_DOWN_STATE
Definition: cdrom.h:407
@ PowerDownDeviceUnlocked
Definition: cdrom.h:414
@ PowerDownDeviceStopped
Definition: cdrom.h:412
@ PowerDownDeviceQuiesced
Definition: cdrom.h:410
@ PowerDownDeviceOff
Definition: cdrom.h:413
@ PowerDownDeviceInitial
Definition: cdrom.h:408
@ PowerDownDeviceLocked
Definition: cdrom.h:409
@ PowerDownDeviceFlushed
Definition: cdrom.h:411

◆ CDROM_POWER_UP_STATE

Enumerator
PowerUpDeviceInitial 
PowerUpDeviceLocked 
PowerUpDeviceOn 
PowerUpDeviceStarted 
PowerUpDeviceUnlocked 

Definition at line 419 of file cdrom.h.

419 {
CDROM_POWER_UP_STATE
Definition: cdrom.h:419
@ PowerUpDeviceOn
Definition: cdrom.h:422
@ PowerUpDeviceUnlocked
Definition: cdrom.h:424
@ PowerUpDeviceStarted
Definition: cdrom.h:423
@ PowerUpDeviceInitial
Definition: cdrom.h:420
@ PowerUpDeviceLocked
Definition: cdrom.h:421

Function Documentation

◆ _In_reads_bytes_()

_In_reads_bytes_ ( Length  )

◆ _IRQL_requires_max_() [1/3]

_IRQL_requires_max_ ( APC_LEVEL  )

Definition at line 37 of file cddata.c.

254{
255 THREAD_CONTEXT ThreadContext = {0};
256 PIRP_CONTEXT IrpContext = NULL;
258
259#ifdef CD_SANITY
260 PVOID PreviousTopLevel;
261#endif
262
264
265#if DBG
266
267 KIRQL SaveIrql = KeGetCurrentIrql();
268
269#endif
270
272
274
276
277#ifdef CD_SANITY
278 PreviousTopLevel = IoGetTopLevelIrp();
279#endif
280
281 //
282 // Loop until this request has been completed or posted.
283 //
284
285 do {
286
287 //
288 // Use a try-except to handle the exception cases.
289 //
290
291 _SEH2_TRY {
292
293 //
294 // If the IrpContext is NULL then this is the first pass through
295 // this loop.
296 //
297
298 if (IrpContext == NULL) {
299
300 //
301 // Decide if this request is waitable an allocate the IrpContext.
302 // If the file object in the stack location is NULL then this
303 // is a mount which is always waitable. Otherwise we look at
304 // the file object flags.
305 //
306
308
309 Wait = TRUE;
310
311 } else {
312
313 Wait = CanFsdWait( Irp );
314 }
315
316 IrpContext = CdCreateIrpContext( Irp, Wait );
317
318 //
319 // Update the thread context information.
320 //
321
322 CdSetThreadContext( IrpContext, &ThreadContext );
323
324#ifdef CD_SANITY
325 NT_ASSERT( !CdTestTopLevel ||
326 SafeNodeType( IrpContext->TopLevel ) == CDFS_NTC_IRP_CONTEXT );
327#endif
328
329 //
330 // Otherwise cleanup the IrpContext for the retry.
331 //
332
333 } else {
334
335 //
336 // Set the MORE_PROCESSING flag to make sure the IrpContext
337 // isn't inadvertently deleted here. Then cleanup the
338 // IrpContext to perform the retry.
339 //
340
341 SetFlag( IrpContext->Flags, IRP_CONTEXT_FLAG_MORE_PROCESSING );
342 CdCleanupIrpContext( IrpContext, FALSE );
343 }
344
345 //
346 // Case on the major irp code.
347 //
348
349 switch (IrpContext->MajorFunction) {
350
351 case IRP_MJ_CREATE :
352
353 Status = CdCommonCreate( IrpContext, Irp );
354 break;
355
356 case IRP_MJ_CLOSE :
357
358 Status = CdCommonClose( IrpContext, Irp );
359 break;
360
361 case IRP_MJ_READ :
362
363 //
364 // If this is an Mdl complete request, don't go through
365 // common read.
366 //
367
368 if (FlagOn( IrpContext->MinorFunction, IRP_MN_COMPLETE )) {
369
370 Status = CdCompleteMdl( IrpContext, Irp );
371
372 } else {
373
374 Status = CdCommonRead( IrpContext, Irp );
375 }
376
377 break;
378
379 case IRP_MJ_WRITE :
380
381 Status = CdCommonWrite( IrpContext, Irp );
382 break;
383
385
386 Status = CdCommonQueryInfo( IrpContext, Irp );
387 break;
388
390
391 Status = CdCommonSetInfo( IrpContext, Irp );
392 break;
393
395
396 Status = CdCommonQueryVolInfo( IrpContext, Irp );
397 break;
398
400
401 Status = CdCommonDirControl( IrpContext, Irp );
402 break;
403
405
406 Status = CdCommonFsControl( IrpContext, Irp );
407 break;
408
410
411 Status = CdCommonDevControl( IrpContext, Irp );
412 break;
413
415
416 Status = CdCommonLockControl( IrpContext, Irp );
417 break;
418
419 case IRP_MJ_CLEANUP :
420
421 Status = CdCommonCleanup( IrpContext, Irp );
422 break;
423
424 case IRP_MJ_PNP :
425
426 Status = CdCommonPnp( IrpContext, Irp );
427 break;
428
429 case IRP_MJ_SHUTDOWN :
430
431 Status = CdCommonShutdown( IrpContext, Irp );
432 break;
433
434 default :
435
437 CdCompleteRequest( IrpContext, Irp, Status );
438 }
439
441
442 Status = CdProcessException( IrpContext, Irp, _SEH2_GetExceptionCode() );
443 } _SEH2_END;
444
445 } while (Status == STATUS_CANT_WAIT);
446
447#ifdef CD_SANITY
448 NT_ASSERT( !CdTestTopLevel ||
449 (PreviousTopLevel == IoGetTopLevelIrp()) );
450#endif
451
453
454 NT_ASSERT( SaveIrql == KeGetCurrentIrql( ));
455
456 return Status;
457}
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
VOID CdCompleteRequest(_Inout_opt_ PIRP_CONTEXT IrpContext, _Inout_opt_ PIRP Irp, _In_ NTSTATUS Status)
Definition: cddata.c:914
LONG CdExceptionFilter(_Inout_ PIRP_CONTEXT IrpContext, _In_ PEXCEPTION_POINTERS ExceptionPointer)
Definition: cddata.c:525
VOID CdSetThreadContext(_Inout_ PIRP_CONTEXT IrpContext, _In_ PTHREAD_CONTEXT ThreadContext)
Definition: cddata.c:981
#define ASSERT_OPTIONAL_IRP(I)
Definition: cddata.h:251
NTSTATUS CdCompleteMdl(_In_ PIRP_CONTEXT IrpContext, _Inout_ PIRP Irp)
Definition: cachesup.c:411
VOID CdCleanupIrpContext(_In_ PIRP_CONTEXT IrpContext, _In_ BOOLEAN Post)
Definition: strucsup.c:1733
#define CanFsdWait(I)
Definition: cdprocs.h:2001
NTSTATUS CdCommonLockControl(_Inout_ PIRP_CONTEXT IrpContext, _Inout_ PIRP Irp)
Definition: lockctrl.c:35
NTSTATUS CdCommonDevControl(_Inout_ PIRP_CONTEXT IrpContext, _Inout_ PIRP Irp)
Definition: devctrl.c:46
_Ret_valid_ PIRP_CONTEXT CdCreateIrpContext(_In_ PIRP Irp, _In_ BOOLEAN Wait)
Definition: strucsup.c:1573
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
#define IRP_CONTEXT_FLAG_MORE_PROCESSING
Definition: cdstruc.h:1214
_In_ PIRP Irp
Definition: csq.h:116
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define CDFS_NTC_IRP_CONTEXT
Definition: nodetype.h:34
#define SafeNodeType(Ptr)
Definition: nodetype.h:54
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
#define SetFlag(_F, _SF)
Definition: ext2fs.h:187
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
Status
Definition: gdiplustypes.h:25
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
PIRP NTAPI IoGetTopLevelIrp(VOID)
Definition: irp.c:1843
#define STATUS_CANT_WAIT
Definition: ntstatus.h:452
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:159
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:34
#define _SEH2_GetExceptionInformation()
Definition: pseh2_64.h:158
#define IRP_MJ_DIRECTORY_CONTROL
Definition: rdpdr.c:51
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
#define IRP_MJ_READ
Definition: rdpdr.c:46
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52
#define IRP_MJ_QUERY_VOLUME_INFORMATION
Definition: rdpdr.c:50
#define IRP_MJ_LOCK_CONTROL
Definition: rdpdr.c:53
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
#define IRP_MJ_SET_INFORMATION
Definition: rdpdr.c:49
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
#define IRP_MJ_QUERY_INFORMATION
Definition: rdpdr.c:48
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550
_In_ WDFDPC _In_ BOOLEAN Wait
Definition: wdfdpc.h:170
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2793
#define IRP_MN_COMPLETE
Definition: iotypes.h:4420
#define IRP_MJ_FILE_SYSTEM_CONTROL
#define IRP_MJ_SHUTDOWN
#define IRP_MJ_CLEANUP
#define NT_ASSERT
Definition: rtlfuncs.h:3310

◆ _IRQL_requires_max_() [2/3]

_IRQL_requires_max_ ( DISPATCH_LEVEL  )

Definition at line 347 of file hardware.c.

1709{
1710 SendKey();
1712}
static VOID SendKey(VOID)
Definition: hardware.c:332
static VOID Wake(_In_ UCHAR Csn)
Definition: hardware.c:149
_In_ PISAPNP_LOGICAL_DEVICE LogicalDevice
Definition: isapnp.h:399

◆ _IRQL_requires_max_() [3/3]

_IRQL_requires_max_ ( PASSIVE_LEVEL  )

Definition at line 923 of file Messaging.c.

75{
76 PFLT_SERVER_PORT_OBJECT PortObject;
78
79 /* The caller must allow at least one connection */
80 if (MaxConnections == 0)
81 {
83 }
84
85 /* The request must be for a kernel handle */
86 if (!(ObjectAttributes->Attributes & OBJ_KERNEL_HANDLE))
87 {
89 }
90
91 /*
92 * Get rundown protection on the target to stop the owner
93 * from unloading whilst this port object is open. It gets
94 * removed in the FltpServerPortClose callback
95 */
97 if (!NT_SUCCESS(Status))
98 {
99 return Status;
100 }
101
102 /* Create the server port object for this filter */
107 NULL,
109 0,
110 0,
111 (PVOID *)&PortObject);
112 if (NT_SUCCESS(Status))
113 {
114 /* Zero out the struct */
115 RtlZeroMemory(PortObject, sizeof(FLT_SERVER_PORT_OBJECT));
116
117 /* Increment the ref count on the target filter */
119
120 /* Setup the filter port object */
121 PortObject->Filter = Filter;
125 PortObject->Cookie = ServerPortCookie;
126 PortObject->MaxConnections = MaxConnections;
127
128 /* Insert the object */
129 Status = ObInsertObject(PortObject,
130 NULL,
132 0,
133 NULL,
135 if (NT_SUCCESS(Status))
136 {
137 /* Lock the connection list */
139
140 /* Add the new port object to the connection list and increment the count */
143
144 /* Unlock the connection list*/
146 }
147 }
148
149 if (!NT_SUCCESS(Status))
150 {
151 /* Allow the filter to be cleaned up */
153 }
154
155 return Status;
156}
static const INTERNET_PORT ServerPort
Definition: CWebService.cpp:11
POBJECT_TYPE ServerPortObjectType
Definition: Messaging.c:24
VOID FLTAPI FltObjectDereference(_Inout_ PVOID Object)
Definition: Object.c:53
NTSTATUS FLTAPI FltObjectReference(_Inout_ PVOID Object)
Definition: Object.c:41
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define InsertTailList(ListHead, Entry)
_Must_inspect_result_ _In_opt_ PFLT_FILTER Filter
Definition: fltkernel.h:1801
_Must_inspect_result_ _Outptr_ PFLT_PORT _In_ POBJECT_ATTRIBUTES _In_opt_ PVOID _In_ PFLT_CONNECT_NOTIFY _In_ PFLT_DISCONNECT_NOTIFY _In_opt_ PFLT_MESSAGE_NOTIFY MessageNotifyCallback
Definition: fltkernel.h:1877
_Must_inspect_result_ _Outptr_ PFLT_PORT _In_ POBJECT_ATTRIBUTES _In_opt_ PVOID _In_ PFLT_CONNECT_NOTIFY ConnectNotifyCallback
Definition: fltkernel.h:1875
_Must_inspect_result_ _Outptr_ PFLT_PORT _In_ POBJECT_ATTRIBUTES _In_opt_ PVOID ServerPortCookie
Definition: fltkernel.h:1874
_Must_inspect_result_ _Outptr_ PFLT_PORT _In_ POBJECT_ATTRIBUTES _In_opt_ PVOID _In_ PFLT_CONNECT_NOTIFY _In_ PFLT_DISCONNECT_NOTIFY DisconnectNotifyCallback
Definition: fltkernel.h:1876
ULONG FltpObjectPointerReference(_In_ PFLT_OBJECT Object)
Definition: Object.c:322
VOID FASTCALL ExAcquireFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:23
VOID FASTCALL ExReleaseFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:31
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
static LONG MaxConnections
#define KernelMode
Definition: asm.h:34
#define FILE_READ_DATA
Definition: nt_native.h:628
#define STANDARD_RIGHTS_ALL
Definition: nt_native.h:69
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:455
NTSTATUS NTAPI ObInsertObject(IN PVOID Object, IN PACCESS_STATE AccessState OPTIONAL, IN ACCESS_MASK DesiredAccess, IN ULONG ObjectPointerBias, OUT PVOID *NewObject OPTIONAL, OUT PHANDLE Handle)
Definition: obhandle.c:2935
NTSTATUS NTAPI ObCreateObject(IN KPROCESSOR_MODE ProbeMode OPTIONAL, IN POBJECT_TYPE Type, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN KPROCESSOR_MODE AccessMode, IN OUT PVOID ParseContext OPTIONAL, IN ULONG ObjectSize, IN ULONG PagedPoolCharge OPTIONAL, IN ULONG NonPagedPoolCharge OPTIONAL, OUT PVOID *Object)
Definition: oblife.c:1039
FLT_MUTEX_LIST_HEAD ConnectionList
Definition: fltmgrint.h:121
LIST_ENTRY mList
Definition: fltmgrint.h:56
FAST_MUTEX mLock
Definition: fltmgrint.h:55
PFLT_DISCONNECT_NOTIFY DisconnectNotify
Definition: fltmgrint.h:192
PFLT_MESSAGE_NOTIFY MessageNotify
Definition: fltmgrint.h:193
PFLT_CONNECT_NOTIFY ConnectNotify
Definition: fltmgrint.h:191
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135

◆ _Ret_range_()

◆ C_ASSERT()

C_ASSERT ( (MAXULONG - sizeof(SRB_HISTORY))/30000 >=sizeof(SRB_HISTORY_ITEM )

◆ CountOfSetBitsUChar()

FORCEINLINE ULONG CountOfSetBitsUChar ( UCHAR  _X)

Definition at line 1500 of file cdrom.h.

1501 { ULONG i = 0; while (_X) { _X &= _X - 1; i++; } return i; }
#define _X(x)
Definition: CPath.cpp:42
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
uint32_t ULONG
Definition: typedefs.h:59

Referenced by ClasspInitializeGesn(), and ClasspInterpretGesnData().

◆ CountOfSetBitsULong()

FORCEINLINE ULONG CountOfSetBitsULong ( ULONG  _X)

Definition at line 1502 of file cdrom.h.

1503 { ULONG i = 0; while (_X) { _X &= _X - 1; i++; } return i; }

◆ CountOfSetBitsULong32()

FORCEINLINE ULONG CountOfSetBitsULong32 ( ULONG32  _X)

Definition at line 1504 of file cdrom.h.

1505 { ULONG i = 0; while (_X) { _X &= _X - 1; i++; } return i; }

◆ CountOfSetBitsULong64()

FORCEINLINE ULONG CountOfSetBitsULong64 ( ULONG64  _X)

Definition at line 1506 of file cdrom.h.

1507 { ULONG i = 0; while (_X) { _X &= _X - 1; i++; } return i; }

◆ CountOfSetBitsUlongPtr()

FORCEINLINE ULONG CountOfSetBitsUlongPtr ( ULONG_PTR  _X)

Definition at line 1508 of file cdrom.h.

1509 { ULONG i = 0; while (_X) { _X &= _X - 1; i++; } return i; }

◆ DeviceErrorHandlerForHitachiGD2000()

NTSTATUS DeviceErrorHandlerForHitachiGD2000 ( _In_ PCDROM_DEVICE_EXTENSION  DeviceExtension,
_In_ PSCSI_REQUEST_BLOCK  Srb,
_Inout_ PNTSTATUS  Status,
_Inout_ PBOOLEAN  Retry 
)

Definition at line 361 of file sense.c.

394{
395 PSENSE_DATA senseBuffer = Srb->SenseInfoBuffer;
396
398 {
399 return STATUS_SUCCESS; //nobody cares about this return value yet.
400 }
401
402 if (((senseBuffer->SenseKey & 0xf) == SCSI_SENSE_HARDWARE_ERROR) &&
403 (senseBuffer->AdditionalSenseCode == 0x44))
404 {
405 TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_GENERAL,
406 "DeviceErrorHandlerForHitachiGD2000 (%p) => Internal Target "
407 "Failure Detected -- spinning up drive\n", DeviceExtension->Device));
408
409 // the request should be retried because the device isn't ready
410 *Retry = TRUE;
412
413 // send a START_STOP unit to spin up the drive
414 // NOTE: this temporarily violates the StartIo serialization
415 // mechanism, but the completion routine on this will NOT
416 // call StartNextPacket(), so it's a temporary disruption
417 // of the serialization only.
418 DeviceSendStartUnit(DeviceExtension->Device);
419 }
420
421 return STATUS_SUCCESS;
422}
_In_ PSCSI_REQUEST_BLOCK Srb
Definition: cdrom.h:989
#define TEST_FLAG(Flags, Bit)
Definition: cdrom.h:1495
VOID DeviceSendStartUnit(_In_ WDFDEVICE Device)
Definition: common.c:877
#define SCSI_SENSE_HARDWARE_ERROR
Definition: cdrw_hw.h:1191
_In_ PSCSI_REQUEST_BLOCK _Out_ NTSTATUS _Inout_ BOOLEAN * Retry
Definition: classpnp.h:312
#define SRB_STATUS_AUTOSENSE_VALID
Definition: srb.h:387
#define STATUS_DEVICE_NOT_READY
Definition: shellext.h:70
#define STATUS_SUCCESS
Definition: shellext.h:65
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
PVOID SenseInfoBuffer
Definition: srb.h:264
UCHAR SrbStatus
Definition: srb.h:251
UCHAR AdditionalSenseCode
Definition: cdrw_hw.h:1175
UCHAR SenseKey
Definition: cdrw_hw.h:1167

◆ DeviceErrorHandlerForMmc()

NTSTATUS DeviceErrorHandlerForMmc ( _In_ PCDROM_DEVICE_EXTENSION  DeviceExtension,
_In_ PSCSI_REQUEST_BLOCK  Srb,
_Inout_ PNTSTATUS  Status,
_Inout_ PBOOLEAN  Retry 
)

Definition at line 87 of file sense.c.

117{
118 BOOLEAN mediaChange = FALSE;
119 PCDB cdb = (PCDB)Srb->Cdb;
120
122 {
123 PSENSE_DATA senseBuffer = Srb->SenseInfoBuffer;
124
125 // the following sense keys could indicate a change in capabilities.
126
127 // we used to expect this to be serialized, and only hit from our
128 // own routine. we now allow some requests to continue during our
129 // processing of the capabilities update in order to allow
130 // IoReadPartitionTable() to succeed.
131 switch (senseBuffer->SenseKey & 0xf)
132 {
133
135 {
137 {
138 if (DeviceExtension->DeviceAdditionalData.Mmc.WriteAllowed)
139 {
140 TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL,
141 "DeviceErrorHandlerForMmc: media removed, writes will be "
142 "failed until new media detected\n"));
143 }
144
145 // NOTE - REF #0002
146 DeviceExtension->DeviceAdditionalData.Mmc.WriteAllowed = FALSE;
147 }
148 else if (senseBuffer->AdditionalSenseCode == SCSI_ADSENSE_LUN_NOT_READY)
149 {
151 {
152 TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL,
153 "DeviceErrorHandlerForMmc: media becoming ready, "
154 "SHOULD notify shell of change time by sending "
155 "GESN request immediately!\n"));
156 }
159 ) &&
160 ((Srb->Cdb[0] == SCSIOP_READ) ||
161 (Srb->Cdb[0] == SCSIOP_READ6) ||
162 (Srb->Cdb[0] == SCSIOP_READ_CAPACITY) ||
163 (Srb->Cdb[0] == SCSIOP_READ_CD) ||
164 (Srb->Cdb[0] == SCSIOP_READ_CD_MSF) ||
165 (Srb->Cdb[0] == SCSIOP_READ_TOC) ||
166 (Srb->Cdb[0] == SCSIOP_WRITE) ||
167 (Srb->Cdb[0] == SCSIOP_WRITE6) ||
170 )
171 )
172 {
173 TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_GENERAL,
174 "DeviceErrorHandlerForMmc: LONG_WRITE or "
175 "OP_IN_PROGRESS for limited subset of cmds -- "
176 "setting retry to TRUE\n"));
177 *Retry = TRUE;
179 }
180 }
181 break;
182 } // end SCSI_SENSE_NOT_READY
183
185 {
186 switch (senseBuffer->AdditionalSenseCode)
187 {
189 {
190 // always update if the medium may have changed
191
192 // NOTE - REF #0002
193 DeviceExtension->DeviceAdditionalData.Mmc.WriteAllowed = FALSE;
194 DeviceExtension->DeviceAdditionalData.Mmc.UpdateState = CdromMmcUpdateRequired;
195
196 TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL,
197 "DeviceErrorHandlerForMmc: media change detected, need to "
198 "update drive capabilities\n"));
199 mediaChange = TRUE;
200 break;
201
202 } // end SCSI_ADSENSE_MEDIUM_CHANGED
203
205 {
206 // NOTE - REF #0002
207 DeviceExtension->DeviceAdditionalData.Mmc.WriteAllowed = FALSE;
208 DeviceExtension->DeviceAdditionalData.Mmc.UpdateState = CdromMmcUpdateRequired;
209
210 TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL,
211 "DeviceErrorHandlerForMmc: bus reset detected, need to "
212 "update drive capabilities\n"));
213 break;
214
215 } // end SCSI_ADSENSE_BUS_RESET
216
218 {
219
220 BOOLEAN b = FALSE;
221
222 switch (senseBuffer->AdditionalSenseCodeQualifier)
223 {
225 {
226 // eject notification currently handled by classpnp
227 TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL,
228 "DeviceErrorHandlerForMmc: Eject requested by user\n"));
229 *Retry = TRUE;
231 break;
232 }
233
235 b = TRUE;
237 {
238 TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL,
239 "DeviceErrorHandlerForMmc: Write protect %s requested "
240 "by user\n",
241 (b ? "disable" : "enable")));
242 *Retry = TRUE;
244 // NOTE - REF #0002
245 DeviceExtension->DeviceAdditionalData.Mmc.WriteAllowed = FALSE;
246 DeviceExtension->DeviceAdditionalData.Mmc.UpdateState = CdromMmcUpdateRequired;
247
248 break;
249 }
250
251 } // end of AdditionalSenseCodeQualifier switch
252
253
254 break;
255
256 } // end SCSI_ADSENSE_OPERATOR_REQUEST
257
258 default:
259 {
260 TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_GENERAL,
261 "DeviceErrorHandlerForMmc: Unit attention %02x/%02x\n",
262 senseBuffer->AdditionalSenseCode,
263 senseBuffer->AdditionalSenseCodeQualifier));
264 break;
265 }
266
267 } // end of AdditionSenseCode switch
268 break;
269
270 } // end SCSI_SENSE_UNIT_ATTENTION
271
273 {
275 {
276 if (DeviceExtension->DeviceAdditionalData.Mmc.WriteAllowed)
277 {
278 TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_GENERAL,
279 "DeviceErrorHandlerForMmc: media was writable, but "
280 "failed request with WRITE_PROTECT error...\n"));
281 }
282 // NOTE - REF #0002
283 // do not update all the capabilities just because
284 // we can't write to the disc.
285 DeviceExtension->DeviceAdditionalData.Mmc.WriteAllowed = FALSE;
286 }
287 break;
288 } // end SCSI_SENSE_ILLEGAL_REQUEST
289
290 } // end of SenseKey switch
291
292 // Check if we failed to set the DVD region key and send appropriate error
293 if (cdb->CDB16.OperationCode == SCSIOP_SEND_KEY)
294 {
295 if (cdb->SEND_KEY.KeyFormat == DvdSetRpcKey)
296 {
298 {
299 // media of appropriate region required
301 *Retry = FALSE;
302 }
303 else if ((senseBuffer->SenseKey == SCSI_SENSE_ILLEGAL_REQUEST) &&
306 {
307 // media of appropriate region required
309 *Retry = FALSE;
310 }
311 else if ((senseBuffer->SenseKey == SCSI_SENSE_ILLEGAL_REQUEST) &&
314 {
315 // media of appropriate region required
317 *Retry = FALSE;
318 }
319 }
320 }
321 } // end of SRB_STATUS_AUTOSENSE_VALID
322
323 // On media change, if device speed should be reset to default then
324 // queue a workitem to send the commands to the device. Do this on
325 // media arrival as some device will fail this command if no media
326 // is present. Ignore the fake media change from classpnp driver.
327 if ((mediaChange == TRUE) && (*Status != STATUS_MEDIA_CHANGED))
328 {
329 if (DeviceExtension->DeviceAdditionalData.RestoreDefaults == TRUE)
330 {
332 WDF_OBJECT_ATTRIBUTES attributes;
333 WDF_WORKITEM_CONFIG workitemConfig;
334 WDFWORKITEM workItem;
335
336 WDF_OBJECT_ATTRIBUTES_INIT(&attributes);
337 attributes.ParentObject = DeviceExtension->Device;
338
339 WDF_WORKITEM_CONFIG_INIT(&workitemConfig,
341
342 status = WdfWorkItemCreate(&workitemConfig,
343 &attributes,
344 &workItem);
345 if (!NT_SUCCESS(status))
346 {
347 return STATUS_SUCCESS;
348 }
349
350 WdfWorkItemEnqueue(workItem);
351
352 TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL,
353 "DeviceErrorHandlerForMmc: Restore device default speed for %p\n",
354 DeviceExtension->DeviceObject));
355 }
356 }
357 return STATUS_SUCCESS;
358}
#define CdromMmcUpdateRequired
Definition: cdrom.h:242
EVT_WDF_WORKITEM DeviceRestoreDefaultSpeed
Definition: cdrom.h:1180
#define SCSI_ADSENSE_LUN_NOT_READY
Definition: cdrw_hw.h:1218
#define SCSIOP_READ_CD
Definition: cdrw_hw.h:967
#define SCSI_SENSEQ_OPERATION_IN_PROGRESS
Definition: cdrw_hw.h:1317
#define SCSI_SENSEQ_INCOMPATIBLE_FORMAT
Definition: cdrw_hw.h:1323
#define SCSIOP_READ_TOC
Definition: cdrw_hw.h:927
#define SCSI_ADSENSE_WRITE_PROTECT
Definition: cdrw_hw.h:1268
#define SCSIOP_READ_CAPACITY
Definition: cdrw_hw.h:904
#define SCSI_SENSEQ_MEDIA_CODE_MISMATCHED_TO_LOGICAL_UNIT
Definition: cdrw_hw.h:1394
#define SCSI_SENSEQ_BECOMING_READY
Definition: cdrw_hw.h:1313
#define SCSI_ADSENSE_INVALID_MEDIA
Definition: cdrw_hw.h:1220
#define SCSIOP_SEND_KEY
Definition: cdrw_hw.h:951
#define SCSI_SENSE_ILLEGAL_REQUEST
Definition: cdrw_hw.h:1192
#define SCSI_SENSE_UNIT_ATTENTION
Definition: cdrw_hw.h:1193
#define SCSI_ADSENSE_NO_MEDIA_IN_DEVICE
Definition: cdrw_hw.h:1221
#define SCSI_ADSENSE_MEDIUM_CHANGED
Definition: cdrw_hw.h:1288
#define SCSIOP_READ_CD_MSF
Definition: cdrw_hw.h:964
union _CDB * PCDB
#define SCSI_SENSE_NOT_READY
Definition: cdrw_hw.h:1189
#define SCSI_ADSENSE_BUS_RESET
Definition: cdrw_hw.h:1289
#define SCSI_SENSEQ_LONG_WRITE_IN_PROGRESS
Definition: cdrw_hw.h:1318
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
if(dx< 0)
Definition: linetemp.h:194
#define STATUS_MEDIA_CHANGED
Definition: ntstatus.h:207
#define STATUS_CSS_REGION_MISMATCH
Definition: ntstatus.h:886
@ DvdSetRpcKey
Definition: ntddcdvd.h:169
#define SCSI_ADSENSE_COPY_PROTECTION_FAILURE
Definition: scsi.h:694
#define SCSIOP_READ_TRACK_INFORMATION
Definition: scsi.h:315
#define SCSI_SENSEQ_WRITE_PROTECT_DISABLE
Definition: scsi.h:881
#define SCSIOP_READ_DISK_INFORMATION
Definition: scsi.h:313
#define SCSI_SENSEQ_MEDIUM_REMOVAL
Definition: scsi.h:879
#define SCSI_ADSENSE_OPERATOR_REQUEST
Definition: scsi.h:691
#define SCSI_SENSEQ_WRITE_PROTECT_ENABLE
Definition: scsi.h:880
#define TRACE_LEVEL_WARNING
Definition: storswtr.h:28
#define TRACE_LEVEL_INFORMATION
Definition: storswtr.h:29
UCHAR Cdb[16]
Definition: srb.h:279
UCHAR AdditionalSenseCodeQualifier
Definition: cdrw_hw.h:1176
WDFOBJECT ParentObject
Definition: wdfobject.h:130
Definition: ps.c:97
#define STATUS_NO_MEDIA_IN_DEVICE
Definition: udferr_usr.h:141
#define STATUS_DEVICE_BUSY
Definition: udferr_usr.h:129
Definition: cdrw_hw.h:28
struct _CDB::_SEND_KEY SEND_KEY
struct _CDB::_CDB16 CDB16
FORCEINLINE VOID WDF_OBJECT_ATTRIBUTES_INIT(_Out_ PWDF_OBJECT_ATTRIBUTES Attributes)
Definition: wdfobject.h:147
FORCEINLINE VOID WDF_WORKITEM_CONFIG_INIT(_Out_ PWDF_WORKITEM_CONFIG Config, _In_ PFN_WDF_WORKITEM EvtWorkItemFunc)
Definition: wdfworkitem.h:85

◆ DeviceIsMmcUpdateRequired()

BOOLEAN DeviceIsMmcUpdateRequired ( _In_ WDFDEVICE  Device)

Definition at line 4180 of file cdrom.c.

4197{
4198 PCDROM_DEVICE_EXTENSION deviceExtension = DeviceGetExtension(Device);
4199 PCDROM_DATA cdData = &(deviceExtension->DeviceAdditionalData);
4200
4201 if ((cdData->Mmc.IsMmc) &&
4203 {
4204 return TRUE;
4205 }
4206 else
4207 {
4208 // no update required: just proceed
4209 return FALSE;
4210 }
4211}
CDROM_MMC_EXTENSION Mmc
Definition: cdrom.h:341
CDROM_DATA DeviceAdditionalData
Definition: cdrom.h:598
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474

Referenced by IoctlWorkItemRoutine(), ReadWriteWorkItemRoutine(), and SequentialQueueEvtIoReadWrite().

◆ DevicePerfIncrementErrorCount()

VOID DevicePerfIncrementErrorCount ( _In_ PCDROM_DEVICE_EXTENSION  DeviceExtension)

Definition at line 1378 of file common.c.

1381{
1382 PCDROM_PRIVATE_FDO_DATA fdoData = DeviceExtension->PrivateFdoData;
1383 KIRQL oldIrql;
1384 ULONG errors;
1385
1386 KeAcquireSpinLock(&fdoData->SpinLock, &oldIrql);
1387
1388 fdoData->Perf.SuccessfulIO = 0; // implicit interlock
1389 errors = InterlockedIncrement((PLONG)&DeviceExtension->ErrorCount);
1390
1391 if (errors >= CLASS_ERROR_LEVEL_1)
1392 {
1393 // If the error count has exceeded the error limit, then disable
1394 // any tagged queuing, multiple requests per lu queueing
1395 // and sychronous data transfers.
1396 //
1397 // Clearing the no queue freeze flag prevents the port driver
1398 // from sending multiple requests per logical unit.
1399 CLEAR_FLAG(DeviceExtension->SrbFlags, SRB_FLAGS_NO_QUEUE_FREEZE);
1400 CLEAR_FLAG(DeviceExtension->SrbFlags, SRB_FLAGS_QUEUE_ACTION_ENABLE);
1401
1402 SET_FLAG(DeviceExtension->SrbFlags, SRB_FLAGS_DISABLE_SYNCH_TRANSFER);
1403
1404 TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_GENERAL,
1405 "PerfIncrementErrorCount: Too many errors; disabling tagged queuing and "
1406 "synchronous data tranfers.\n"));
1407 }
1408
1409 if (errors >= CLASS_ERROR_LEVEL_2)
1410 {
1411 // If a second threshold is reached, disable disconnects.
1412 SET_FLAG(DeviceExtension->SrbFlags, SRB_FLAGS_DISABLE_DISCONNECT);
1413 TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_GENERAL,
1414 "PerfIncrementErrorCount: Too many errors; disabling disconnects.\n"));
1415 }
1416
1417 KeReleaseSpinLock(&fdoData->SpinLock, oldIrql);
1418 return;
1419}
#define InterlockedIncrement
Definition: armddk.h:53
#define CLEAR_FLAG(Flags, Bit)
Definition: cdrom.h:1494
#define SET_FLAG(Flags, Bit)
Definition: cdrom.h:1493
#define CLASS_ERROR_LEVEL_2
Definition: cdromp.h:131
#define CLASS_ERROR_LEVEL_1
Definition: cdromp.h:130
#define SRB_FLAGS_DISABLE_DISCONNECT
Definition: srb.h:396
#define SRB_FLAGS_QUEUE_ACTION_ENABLE
Definition: srb.h:395
#define SRB_FLAGS_DISABLE_SYNCH_TRANSFER
Definition: srb.h:397
#define SRB_FLAGS_NO_QUEUE_FREEZE
Definition: srb.h:404
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
struct _CDROM_PRIVATE_FDO_DATA::@1046 Perf
KSPIN_LOCK SpinLock
Definition: cdromp.h:351
int32_t * PLONG
Definition: typedefs.h:58

Referenced by SenseInfoInterpretBySrbStatus().

◆ DeviceReleaseQueue()

VOID DeviceReleaseQueue ( _In_ WDFDEVICE  Device)

Definition at line 1179 of file common.c.

1203{
1204 PCDROM_DEVICE_EXTENSION deviceExtension = DeviceGetExtension(Device);
1206 KIRQL currentIrql;
1207
1208 // we raise irql seperately so we're not swapped out or suspended
1209 // while holding the release queue irp in this routine. this lets
1210 // us release the spin lock before lowering irql.
1211 KeRaiseIrql(DISPATCH_LEVEL, &currentIrql);
1212
1213 WdfSpinLockAcquire(deviceExtension->ReleaseQueueSpinLock);
1214
1215 if (deviceExtension->ReleaseQueueInProgress)
1216 {
1217 // Someone is already doing this work - just set the flag to indicate that
1218 // we need to release the queue again.
1219 deviceExtension->ReleaseQueueNeeded = TRUE;
1220 WdfSpinLockRelease(deviceExtension->ReleaseQueueSpinLock);
1221 KeLowerIrql(currentIrql);
1222
1223 return;
1224 }
1225
1226 // Mark that there is a release queue in progress and drop the spinlock.
1227 deviceExtension->ReleaseQueueInProgress = TRUE;
1228
1229 WdfSpinLockRelease(deviceExtension->ReleaseQueueSpinLock);
1230
1231 srb = &(deviceExtension->ReleaseQueueSrb);
1232
1233 // Optical media are removable, so we just flush the queue. This will also release it.
1235
1236 srb->OriginalRequest = WdfRequestWdmGetIrp(deviceExtension->ReleaseQueueRequest);
1237
1238 // Set a CompletionRoutine callback function.
1239 WdfRequestSetCompletionRoutine(deviceExtension->ReleaseQueueRequest,
1241 Device);
1242 // Send the request. If an error occurs, complete the request.
1243 RequestSend(deviceExtension,
1244 deviceExtension->ReleaseQueueRequest,
1245 deviceExtension->IoTarget,
1247 NULL);
1248
1249 KeLowerIrql(currentIrql);
1250
1251 return;
1252
1253} // end DeviceReleaseQueue()
EVT_WDF_REQUEST_COMPLETION_ROUTINE DeviceReleaseQueueCompletion
Definition: cdrom.h:1052
NTSTATUS RequestSend(_In_ PCDROM_DEVICE_EXTENSION DeviceExtension, _In_ WDFREQUEST Request, _In_ WDFIOTARGET IoTarget, _In_ ULONG Flags, _Out_opt_ PBOOLEAN RequestSent)
Definition: common.c:3793
#define SRB_FUNCTION_FLUSH_QUEUE
Definition: srb.h:329
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
WDFIOTARGET IoTarget
Definition: cdrom.h:476
BOOLEAN ReleaseQueueInProgress
Definition: cdrom.h:581
BOOLEAN ReleaseQueueNeeded
Definition: cdrom.h:580
WDFSPINLOCK ReleaseQueueSpinLock
Definition: cdrom.h:576
WDFREQUEST ReleaseQueueRequest
Definition: cdrom.h:577
SCSI_REQUEST_BLOCK ReleaseQueueSrb
Definition: cdrom.h:578
PVOID OriginalRequest
Definition: srb.h:266
UCHAR Function
Definition: srb.h:250
@ WDF_REQUEST_SEND_OPTION_IGNORE_TARGET_STATE
Definition: wdfrequest.h:110

Referenced by DeviceAsynchronousCompletion(), DeviceReleaseQueueCompletion(), and RequestSenseInfoInterpret().

◆ DeviceSendIoctlAsynchronously()

VOID DeviceSendIoctlAsynchronously ( _In_ PCDROM_DEVICE_EXTENSION  DeviceExtension,
_In_ ULONG  IoControlCode,
_In_ PDEVICE_OBJECT  TargetDeviceObject 
)

Definition at line 1030 of file common.c.

1052{
1053 PIRP irp = NULL;
1054 PIO_STACK_LOCATION nextIrpStack = NULL;
1055
1056 irp = IoAllocateIrp(DeviceExtension->DeviceObject->StackSize, FALSE);
1057
1058 if (irp != NULL)
1059 {
1060 nextIrpStack = IoGetNextIrpStackLocation(irp);
1061
1062 nextIrpStack->MajorFunction = IRP_MJ_DEVICE_CONTROL;
1063
1064 nextIrpStack->Parameters.DeviceIoControl.OutputBufferLength = 0;
1065 nextIrpStack->Parameters.DeviceIoControl.InputBufferLength = 0;
1066 nextIrpStack->Parameters.DeviceIoControl.IoControlCode = IoControlCode;
1067 nextIrpStack->Parameters.DeviceIoControl.Type3InputBuffer = NULL;
1068
1071 DeviceExtension,
1072 TRUE,
1073 TRUE,
1074 TRUE);
1075
1077 }
1078}
#define VOID
Definition: acefi.h:82
IO_COMPLETION_ROUTINE RequestAsynchronousIrpCompletion
Definition: cdrom.h:1257
IN OUT PVCB IN PDEVICE_OBJECT TargetDeviceObject
Definition: fatprocs.h:1674
FxIrp * irp
#define IoSetCompletionRoutine(_Irp, _CompletionRoutine, _Context, _InvokeOnSuccess, _InvokeOnError, _InvokeOnCancel)
Definition: irp.cpp:490
PIRP NTAPI IoAllocateIrp(IN CCHAR StackSize, IN BOOLEAN ChargeQuota)
Definition: irp.c:615
#define IoCallDriver
Definition: irp.c:1225
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3128
_In_ WDFREQUEST _In_ size_t _In_ size_t _In_ ULONG IoControlCode
Definition: wdfio.h:325
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetNextIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2695

Referenced by DeviceEvtD0Entry().

◆ DeviceSendNotification()

VOID DeviceSendNotification ( _In_ PCDROM_DEVICE_EXTENSION  DeviceExtension,
_In_ const GUID Guid,
_In_ ULONG  ExtraDataSize,
_In_opt_ PVOID  ExtraData 
)

Definition at line 799 of file common.c.

824{
826 ULONG requiredSize;
828
829 status = RtlULongAdd((sizeof(TARGET_DEVICE_CUSTOM_NOTIFICATION) - sizeof(UCHAR)),
831 &requiredSize);
832
833 if (!(NT_SUCCESS(status)) || (requiredSize > 0x0000ffff))
834 {
835 // MAX_USHORT, max total size for these events!
836 TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_MCN,
837 "Error sending event: size too large! (%x)\n",
838 requiredSize));
839 return;
840 }
841
842 notification = ExAllocatePoolWithTag(NonPagedPoolNx,
843 requiredSize,
845
846 // if none allocated, exit
847 if (notification == NULL)
848 {
849 return;
850 }
851
852 // Prepare and send the request!
853 RtlZeroMemory(notification, requiredSize);
854 notification->Version = 1;
855 notification->Size = (USHORT)(requiredSize);
856 notification->FileObject = NULL;
857 notification->NameBufferOffset = -1;
858 notification->Event = *Guid;
859
860 if (ExtraData != NULL)
861 {
862 RtlCopyMemory(notification->CustomDataBuffer, ExtraData, ExtraDataSize);
863 }
864
865 IoReportTargetDeviceChangeAsynchronous(DeviceExtension->LowerPdo,
867 NULL,
868 NULL);
869
871
872 return;
873}
#define FREE_POOL(_PoolPtr)
Definition: cdrom.h:782
#define CDROM_TAG_NOTIFICATION
Definition: cdrom.h:739
_In_ const GUID _In_ ULONG ExtraDataSize
Definition: classpnp.h:1430
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
unsigned short USHORT
Definition: pedump.c:61
NTSTATUS NTAPI IoReportTargetDeviceChangeAsynchronous(IN PDEVICE_OBJECT PhysicalDeviceObject, IN PVOID NotificationStructure, IN PDEVICE_CHANGE_COMPLETE_CALLBACK Callback OPTIONAL, IN PVOID Context OPTIONAL)
Definition: pnpreport.c:498
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
_Must_inspect_result_ _In_ WDFOBJECT _In_ CONST GUID * Guid
Definition: wdfobject.h:762
unsigned char UCHAR
Definition: xmlstorage.h:181

Referenced by DeviceInternalSetMediaChangeState(), SenseInfoInterpretByAdditionalSenseCode(), and SenseInfoInterpretForZPODD().

◆ DeviceSendStartUnit()

VOID DeviceSendStartUnit ( _In_ WDFDEVICE  Device)

Definition at line 877 of file common.c.

907{
909 PCDROM_DEVICE_EXTENSION deviceExtension = NULL;
910 WDF_OBJECT_ATTRIBUTES attributes;
911 WDFREQUEST startUnitRequest = NULL;
912 WDFMEMORY inputMemory = NULL;
913
916 PCDB cdb = NULL;
917
918 deviceExtension = DeviceGetExtension(Device);
919
920 if (NT_SUCCESS(status))
921 {
922 // Allocate Srb from nonpaged pool.
923 context = ExAllocatePoolWithTag(NonPagedPoolNx,
924 sizeof(COMPLETION_CONTEXT),
926
927 if (context == NULL)
928 {
929 TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_GENERAL,
930 "DeviceSendStartUnit: Failed to allocate completion context\n"));
931
933 }
934 }
935
936 if (NT_SUCCESS(status))
937 {
938 // Save the device object in the context for use by the completion
939 // routine.
940 context->Device = Device;
941 srb = &context->Srb;
942
943 // Zero out srb.
944 RtlZeroMemory(srb, sizeof(SCSI_REQUEST_BLOCK));
945
946 // setup SRB structure.
947 srb->Length = sizeof(SCSI_REQUEST_BLOCK);
950
953
954 // setup CDB
955 srb->CdbLength = 6;
956 cdb = (PCDB)srb->Cdb;
957
958 cdb->START_STOP.OperationCode = SCSIOP_START_STOP_UNIT;
959 cdb->START_STOP.Start = 1;
960 cdb->START_STOP.Immediate = 0;
961 cdb->START_STOP.LogicalUnitNumber = srb->Lun;
962
963 //Create Request for sending down to port driver
966 attributes.ParentObject = deviceExtension->IoTarget;
967
968 status = WdfRequestCreate(&attributes,
969 deviceExtension->IoTarget,
970 &startUnitRequest);
971 }
972
973 if (NT_SUCCESS(status))
974 {
975 srb->OriginalRequest = WdfRequestWdmGetIrp(startUnitRequest);
977
978 //Prepare the request
979 WDF_OBJECT_ATTRIBUTES_INIT(&attributes);
980 attributes.ParentObject = startUnitRequest;
981
982 status = WdfMemoryCreatePreallocated(&attributes,
983 (PVOID)srb,
984 sizeof(SCSI_REQUEST_BLOCK),
985 &inputMemory);
986 }
987
988 if (NT_SUCCESS(status))
989 {
990 status = WdfIoTargetFormatRequestForInternalIoctlOthers(deviceExtension->IoTarget,
991 startUnitRequest,
993 inputMemory,
994 NULL,
995 NULL,
996 NULL,
997 NULL,
998 NULL);
999 }
1000
1001 if (NT_SUCCESS(status))
1002 {
1003 // Set a CompletionRoutine callback function.
1004 WdfRequestSetCompletionRoutine(startUnitRequest,
1006 context);
1007
1008 status = RequestSend(deviceExtension,
1009 startUnitRequest,
1010 deviceExtension->IoTarget,
1011 0,
1012 NULL);
1013 }
1014
1015 // release resources when failed.
1016 if (!NT_SUCCESS(status))
1017 {
1019 if (startUnitRequest != NULL)
1020 {
1021 WdfObjectDelete(startUnitRequest);
1022 }
1023 }
1024
1025 return;
1026} // end StartUnit()
#define START_UNIT_TIMEOUT
Definition: cdrom.h:132
EVT_WDF_REQUEST_COMPLETION_ROUTINE DeviceAsynchronousCompletion
Definition: cdrom.h:1045
#define CDROM_TAG_COMPLETION_CONTEXT
Definition: cdrom.h:729
#define IOCTL_SCSI_EXECUTE_NONE
Definition: cdrw_hw.h:1453
#define SCSIOP_START_STOP_UNIT
Definition: cdrw_hw.h:897
struct _SCSI_REQUEST_BLOCK SCSI_REQUEST_BLOCK
#define SRB_FUNCTION_EXECUTE_SCSI
Definition: srb.h:315
#define SRB_FLAGS_NO_DATA_TRANSFER
Definition: srb.h:402
#define STATUS_INTERNAL_ERROR
Definition: ntstatus.h:465
ULONG TimeOutValue
Definition: srb.h:262
UCHAR CdbLength
Definition: srb.h:258
ULONG SrbFlags
Definition: srb.h:260
USHORT Length
Definition: srb.h:249
Definition: http.c:7252
struct _CDB::_START_STOP START_STOP
#define WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(_attributes, _contexttype)
Definition: wdfobject.h:170

Referenced by DeviceErrorHandlerForHitachiGD2000(), and SenseInfoInterpretByAdditionalSenseCode().

◆ DeviceSetMediaChangeStateEx()

VOID DeviceSetMediaChangeStateEx ( _In_ PCDROM_DEVICE_EXTENSION  DeviceExtension,
_In_ MEDIA_CHANGE_DETECTION_STATE  NewState,
_Inout_opt_ PMEDIA_CHANGE_DETECTION_STATE  OldState 
)

Definition at line 751 of file autorun.c.

778{
779 PMEDIA_CHANGE_DETECTION_INFO info = DeviceExtension->MediaChangeDetectionInfo;
782
783 // timeout value must be 0, as this function can be called at DISPATCH_LEVEL.
784 zero.QuadPart = 0;
785
786 if (info == NULL)
787 {
788 return;
789 }
790
791 status = KeWaitForMutexObject(&info->MediaChangeMutex,
792 Executive,
794 FALSE,
795 &zero);
796
797 if (status == STATUS_TIMEOUT)
798 {
799 // Someone else is in the process of setting the media state.
800 return;
801 }
802
803 // Change the media present state and signal an event, if applicable
804 DeviceInternalSetMediaChangeState(DeviceExtension, NewState, OldState);
805
806 KeReleaseMutex(&info->MediaChangeMutex, FALSE);
807
808 return;
809} // end DeviceSetMediaChangeStateEx()
VOID DeviceInternalSetMediaChangeState(_In_ PCDROM_DEVICE_EXTENSION DeviceExtension, _In_ MEDIA_CHANGE_DETECTION_STATE NewState, _Inout_opt_ PMEDIA_CHANGE_DETECTION_STATE OldState)
Definition: autorun.c:630
LONG NTAPI KeReleaseMutex(IN PKMUTEX Mutex, IN BOOLEAN Wait)
Definition: mutex.c:189
#define STATUS_TIMEOUT
Definition: ntstatus.h:81
int zero
Definition: sehframes.cpp:29
#define KeWaitForMutexObject
Definition: kefuncs.h:543
@ Executive
Definition: ketypes.h:415

Referenced by DeviceEvtSelfManagedIoInit(), and SenseInfoInterpretByAdditionalSenseCode().

◆ DeviceZPODDGetPowerupReason()

NTSTATUS DeviceZPODDGetPowerupReason ( _In_ PCDROM_DEVICE_EXTENSION  DeviceExtension,
_Out_ PSTORAGE_IDLE_POWERUP_REASON  PowerupReason 
)

Definition at line 608 of file zpodd.c.

627{
629 PIRP irp = NULL;
630 IO_STATUS_BLOCK ioStatus = {0};
632
633 RtlZeroMemory(PowerupReason, sizeof (STORAGE_IDLE_POWERUP_REASON));
634
635 PowerupReason->Size = sizeof (STORAGE_IDLE_POWERUP_REASON);
636 PowerupReason->Version = STORAGE_IDLE_POWERUP_REASON_VERSION_V1;
637
638 //
639 // Setup a synchronous irp.
640 //
641
643
645 DeviceExtension->LowerPdo,
646 PowerupReason,
648 PowerupReason,
650 FALSE,
651 &event,
652 &ioStatus);
653
654 if (irp == NULL)
655 {
657 }
658 else
659 {
660 //
661 // Send the synchronous request to port driver.
662 //
663
664 status = IoCallDriver(DeviceExtension->LowerPdo, irp);
665
666 if (status == STATUS_PENDING)
667 {
669
670 status = ioStatus.Status;
671 }
672 }
673
674 return status;
675}
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
Definition: env_spec_w32.h:478
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
struct _cl_event * event
Definition: glext.h:7739
struct _STORAGE_IDLE_POWERUP_REASON STORAGE_IDLE_POWERUP_REASON
#define IOCTL_STORAGE_GET_IDLE_POWERUP_REASON
Definition: ntddstor.h:217
#define STORAGE_IDLE_POWERUP_REASON_VERSION_V1
Definition: ntddstor.h:1105
@ NotificationEvent
PIRP NTAPI IoBuildDeviceIoControlRequest(IN ULONG IoControlCode, IN PDEVICE_OBJECT DeviceObject, IN PVOID InputBuffer, IN ULONG InputBufferLength, IN PVOID OutputBuffer, IN ULONG OutputBufferLength, IN BOOLEAN InternalDeviceIoControl, IN PKEVENT Event, IN PIO_STATUS_BLOCK IoStatusBlock)
Definition: irp.c:881
#define STATUS_PENDING
Definition: ntstatus.h:82
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList

Referenced by DeviceEvtD0Entry().

◆ FREE_PORT_ALLOCATED_SENSE_BUFFER()

FORCEINLINE VOID FREE_PORT_ALLOCATED_SENSE_BUFFER ( _In_ PCDROM_DEVICE_EXTENSION  DeviceExtension,
_In_ PSCSI_REQUEST_BLOCK  Srb 
)

Definition at line 839 of file cdrom.h.

843{
844#ifndef DEBUG
845 UNREFERENCED_PARAMETER(DeviceExtension);
846#endif
849 NT_ASSERT(Srb->SenseInfoBuffer != DeviceExtension->SenseData);
850
855 return;
856}
#define SRB_FLAGS_FREE_SENSE_BUFFER
Definition: srb.h:406
#define SRB_FLAGS_PORT_DRIVER_ALLOCSENSE
Definition: srb.h:413
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
UCHAR SenseInfoBufferLength
Definition: srb.h:259

Referenced by ClassAsynchronousCompletion(), ClassIoComplete(), ClassIoCompleteAssociated(), and DeviceAsynchronousCompletion().

◆ IsVolumeMounted()

FORCEINLINE BOOLEAN IsVolumeMounted ( _In_ PDEVICE_OBJECT  DeviceObject)

Definition at line 1514 of file cdrom.h.

1517{
1518#pragma prefast(push)
1519#pragma prefast(disable: 28175, "there is no other way to check if there is volume mounted")
1520 return (DeviceObject->Vpb != NULL) &&
1521 ((DeviceObject->Vpb->Flags & VPB_MOUNTED) != 0);
1522#pragma prefast(pop)
1523}
#define VPB_MOUNTED
Definition: iotypes.h:1807

Referenced by SenseInfoInterpretByAdditionalSenseCode(), and SenseInfoInterpretBySenseKey().

◆ PORT_ALLOCATED_SENSE()

◆ RequestClearSendTime()

VOID RequestClearSendTime ( _In_ WDFREQUEST  Request)

Definition at line 111 of file common.c.

126{
127 PCDROM_REQUEST_CONTEXT requestContext = RequestGetContext(Request);
128
129 requestContext->TimeSentDownFirstTime.QuadPart = 0;
130 requestContext->TimeSentDownLasttTime.QuadPart = 0;
131
132 return;
133}
LARGE_INTEGER TimeSentDownLasttTime
Definition: cdrom.h:637
LARGE_INTEGER TimeSentDownFirstTime
Definition: cdrom.h:636
LONGLONG QuadPart
Definition: typedefs.h:114
_In_ WDFREQUEST Request
Definition: wdfdevice.h:547

Referenced by _IRQL_requires_max_(), DeviceReleaseQueueCompletion(), and ScratchBuffer_BeginUseX().

◆ RequestCompletion()

VOID RequestCompletion ( _In_ PCDROM_DEVICE_EXTENSION  DeviceExtension,
_In_ WDFREQUEST  Request,
_In_ NTSTATUS  Status,
_In_ ULONG_PTR  Information 
)

Definition at line 3439 of file common.c.

3445{
3446#ifdef DBG
3447 ULONG ioctlCode = 0;
3448 WDF_REQUEST_PARAMETERS requestParameters;
3449
3450 // Get the Request parameters
3451 WDF_REQUEST_PARAMETERS_INIT(&requestParameters);
3452 WdfRequestGetParameters(Request, &requestParameters);
3453
3454 if (requestParameters.Type == WdfRequestTypeDeviceControl)
3455 {
3456 ioctlCode = requestParameters.Parameters.DeviceIoControl.IoControlCode;
3457
3458 if (requestParameters.Parameters.DeviceIoControl.IoControlCode != IOCTL_MCN_SYNC_FAKE_IOCTL)
3459 {
3460 TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL,
3461 "Request complete - IOCTL - code: %X; Status: %X; Information: %X\n",
3462 ioctlCode,
3463 Status,
3464 (ULONG)Information));
3465 }
3466 else
3467 {
3468 TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_GENERAL,
3469 "Request complete - IOCTL - code: %X; Status: %X; Information: %X\n",
3470 ioctlCode,
3471 Status,
3472 (ULONG)Information));
3473 }
3474 }
3475 else if (requestParameters.Type == WdfRequestTypeRead)
3476 {
3477 TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL,
3478 "Request complete - READ - Starting Offset: %X; Length: %X; Transferred Length: %X; Status: %X\n",
3479 (ULONG)requestParameters.Parameters.Read.DeviceOffset,
3480 (ULONG)requestParameters.Parameters.Read.Length,
3482 Status));
3483 }
3484 else if (requestParameters.Type == WdfRequestTypeWrite)
3485 {
3486 TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL,
3487 "Request complete - WRITE - Starting Offset: %X; Length: %X; Transferred Length: %X; Status: %X\n",
3488 (ULONG)requestParameters.Parameters.Write.DeviceOffset,
3489 (ULONG)requestParameters.Parameters.Write.Length,
3491 Status));
3492 }
3493#endif
3494
3496 {
3497 PIRP irp = WdfRequestWdmGetIrp(Request);
3498 if (irp->Tail.Overlay.Thread)
3499 {
3500 IoSetHardErrorOrVerifyDevice(irp, DeviceExtension->DeviceObject);
3501 }
3502 }
3503
3504 if (!NT_SUCCESS(Status) && DeviceExtension->SurpriseRemoved == TRUE)
3505 {
3506 // IMAPI expects ERROR_DEV_NOT_EXISTS if recorder has been surprised removed,
3507 // or it will retry WRITE commands for up to 3 minutes
3508 // CDROM behavior should be consistent for all requests, including SCSI pass-through
3510 }
3511
3512 WdfRequestCompleteWithInformation(Request, Status, Information);
3513
3514 return;
3515}
#define IOCTL_MCN_SYNC_FAKE_IOCTL
Definition: cdrom.h:181
VOID NTAPI IoSetHardErrorOrVerifyDevice(IN PIRP Irp, IN PDEVICE_OBJECT DeviceObject)
Definition: util.c:316
#define STATUS_DEVICE_DOES_NOT_EXIST
Definition: ntstatus.h:428
#define TRACE_LEVEL_VERBOSE
Definition: storswtr.h:30
WDF_REQUEST_TYPE Type
Definition: wdfrequest.h:142
struct _WDF_REQUEST_PARAMETERS::@3876::@3879 Write
struct _WDF_REQUEST_PARAMETERS::@3876::@3878 Read
struct _WDF_REQUEST_PARAMETERS::@3876::@3880 DeviceIoControl
union _WDF_REQUEST_PARAMETERS::@3876 Parameters
@ WdfRequestTypeWrite
Definition: wdfdevice.h:507
@ WdfRequestTypeRead
Definition: wdfdevice.h:506
@ WdfRequestTypeDeviceControl
Definition: wdfdevice.h:517
FORCEINLINE VOID WDF_REQUEST_PARAMETERS_INIT(_Out_ PWDF_REQUEST_PARAMETERS Parameters)
Definition: wdfrequest.h:211
_In_ WDFREQUEST _In_ NTSTATUS _In_ ULONG_PTR Information
Definition: wdfrequest.h:1049
#define IoIsErrorUserInduced(Status)
Definition: iofuncs.h:2817

Referenced by CreateQueueEvtIoDefault(), DeviceEvtIoInCallerContext(), ReadWriteWorkItemRoutine(), RequestDispatchProcessDirectly(), RequestDispatchSpecialIoctls(), RequestDispatchSyncWithSequentialQueue(), RequestDispatchToSequentialQueue(), RequestDispatchUnknownRequests(), RequestHandleQueryPropertyDeviceUniqueId(), RequestHandleQueryPropertyWriteCache(), RequestHandleReadWrite(), RequestProcessInternalDeviceControl(), RequestSynchronizeProcessWithSerialQueue(), ScratchBuffer_ReadWriteCompletionRoutine(), ScratchBuffer_ReadWriteEvtRequestCancel(), ScratchBuffer_ReadWriteTimerRoutine(), SequentialQueueEvtCanceledOnQueue(), SequentialQueueEvtIoDeviceControl(), and SequentialQueueEvtIoReadWrite().

◆ RequestDuidGetDeviceIdProperty()

NTSTATUS RequestDuidGetDeviceIdProperty ( _In_ PCDROM_DEVICE_EXTENSION  DeviceExtension,
_In_ WDFREQUEST  Request,
_In_ WDF_REQUEST_PARAMETERS  RequestParameters,
_Out_ size_t DataLength 
)

Definition at line 2797 of file common.c.

2821{
2823 PSTORAGE_DEVICE_ID_DESCRIPTOR deviceIdDescriptor = NULL;
2824 PSTORAGE_DESCRIPTOR_HEADER descHeader = NULL;
2826
2827 *DataLength = 0;
2828
2829 // Get the VPD page 83h data.
2830 status = DeviceRetrieveDescriptor(DeviceExtension->Device,
2831 &propertyId,
2832 (PSTORAGE_DESCRIPTOR_HEADER*)&deviceIdDescriptor);
2833
2834 if (NT_SUCCESS(status) && (deviceIdDescriptor == NULL))
2835 {
2837 }
2838
2839 if (NT_SUCCESS(status))
2840 {
2841 status = WdfRequestRetrieveOutputBuffer(Request,
2842 RequestParameters.Parameters.DeviceIoControl.OutputBufferLength,
2843 &descHeader,
2844 NULL);
2845 }
2846
2847 if (NT_SUCCESS(status))
2848 {
2850 ULONG offset = descHeader->Size;
2851 PUCHAR dest = (PUCHAR)descHeader + offset;
2852 size_t outputBufferSize;
2853
2854 outputBufferSize = RequestParameters.Parameters.DeviceIoControl.OutputBufferLength;
2855
2856 // Adjust required size and potential destination location.
2857 status = RtlULongAdd(descHeader->Size, deviceIdDescriptor->Size, &descHeader->Size);
2858
2859 if (NT_SUCCESS(status) &&
2860 (outputBufferSize < descHeader->Size))
2861 {
2862 // Output buffer is too small. Return error and make sure
2863 // the caller gets info about required buffer size.
2864 *DataLength = descHeader->Size;
2866 }
2867
2868 if (NT_SUCCESS(status))
2869 {
2870 storageDuid = (PSTORAGE_DEVICE_UNIQUE_IDENTIFIER)descHeader;
2871 storageDuid->StorageDeviceIdOffset = offset;
2872
2874 deviceIdDescriptor,
2875 deviceIdDescriptor->Size);
2876
2877 *DataLength = storageDuid->Size;
2879 }
2880
2881 FREE_POOL(deviceIdDescriptor);
2882 }
2883
2884 return status;
2885}
_In_ ULONG _In_opt_ WDFREQUEST _In_opt_ PVOID _In_ size_t _In_ PVOID _In_ size_t _Out_ size_t * DataLength
Definition: cdrom.h:1444
_In_opt_ WDFREQUEST _In_opt_ PWDF_REQUEST_PARAMETERS RequestParameters
Definition: ioctl.h:138
GLintptr offset
Definition: glext.h:5920
static char * dest
Definition: rtl.c:135
* PSTORAGE_DESCRIPTOR_HEADER
Definition: ntddstor.h:560
enum _STORAGE_PROPERTY_ID STORAGE_PROPERTY_ID
@ StorageDeviceIdProperty
Definition: ntddstor.h:514
* PSTORAGE_DEVICE_ID_DESCRIPTOR
Definition: ntddstor.h:742
#define STATUS_NOT_FOUND
Definition: shellext.h:72
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
struct _STORAGE_DEVICE_UNIQUE_IDENTIFIER * PSTORAGE_DEVICE_UNIQUE_IDENTIFIER
unsigned char * PUCHAR
Definition: typedefs.h:53
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533

Referenced by RequestHandleQueryPropertyDeviceUniqueId().

◆ RequestDuidGetDeviceProperty()

NTSTATUS RequestDuidGetDeviceProperty ( _In_ PCDROM_DEVICE_EXTENSION  DeviceExtension,
_In_ WDFREQUEST  Request,
_In_ WDF_REQUEST_PARAMETERS  RequestParameters,
_Out_ size_t DataLength 
)

Definition at line 2888 of file common.c.

2912{
2914 PSTORAGE_DEVICE_DESCRIPTOR deviceDescriptor = DeviceExtension->DeviceDescriptor;
2915 PSTORAGE_DESCRIPTOR_HEADER descHeader = NULL;
2917 PUCHAR dest = NULL;
2918
2919 if (deviceDescriptor == NULL)
2920 {
2922 }
2923
2924 if (NT_SUCCESS(status))
2925 {
2926 status = WdfRequestRetrieveOutputBuffer(Request,
2927 RequestParameters.Parameters.DeviceIoControl.OutputBufferLength,
2928 &descHeader,
2929 NULL);
2930 }
2931
2932 if (NT_SUCCESS(status) &&
2933 (deviceDescriptor->SerialNumberOffset == 0))
2934 {
2936 }
2937
2938 // Use this info only if serial number is available.
2939 if (NT_SUCCESS(status))
2940 {
2941 ULONG offset = descHeader->Size;
2942 size_t outputBufferSize = RequestParameters.Parameters.DeviceIoControl.OutputBufferLength;
2943
2944 // Adjust required size and potential destination location.
2945 dest = (PUCHAR)descHeader + offset;
2946
2947 status = RtlULongAdd(descHeader->Size, deviceDescriptor->Size, &descHeader->Size);
2948
2949 if (NT_SUCCESS(status) &&
2950 (outputBufferSize < descHeader->Size))
2951 {
2952 // Output buffer is too small. Return error and make sure
2953 // the caller get info about required buffer size.
2954 *DataLength = descHeader->Size;
2956 }
2957
2958 if (NT_SUCCESS(status))
2959 {
2960 storageDuid = (PSTORAGE_DEVICE_UNIQUE_IDENTIFIER)descHeader;
2961 storageDuid->StorageDeviceOffset = offset;
2962
2964 deviceDescriptor,
2965 deviceDescriptor->Size);
2966
2967 *DataLength = storageDuid->Size;
2969 }
2970 }
2971
2972 return status;
2973}
* PSTORAGE_DEVICE_DESCRIPTOR
Definition: ntddstor.h:576

Referenced by RequestHandleQueryPropertyDeviceUniqueId().

◆ RequestGetCurrentStackLocationFlags()

FORCEINLINE UCHAR RequestGetCurrentStackLocationFlags ( _In_ WDFREQUEST  Request)

Definition at line 1554 of file cdrom.h.

1557{
1558 PIRP irp = NULL;
1559 PIO_STACK_LOCATION currentStack = NULL;
1560
1561 irp = WdfRequestWdmGetIrp(Request);
1562 currentStack = IoGetCurrentIrpStackLocation(irp);
1563
1564 return currentStack->Flags;
1565}

Referenced by RequestDispatchProcessDirectly(), RequestDispatchSpecialIoctls(), RequestDispatchSyncWithSequentialQueue(), RequestDispatchToSequentialQueue(), and RequestIsRealtimeStreaming().

◆ RequestIsIoctlBlockedByExclusiveAccess()

NTSTATUS RequestIsIoctlBlockedByExclusiveAccess ( _In_ WDFREQUEST  Request,
_Out_ PBOOLEAN  IsBlocked 
)

Definition at line 4058 of file cdrom.c.

4079{
4081 ULONG ioctlCode = 0;
4082 ULONG baseCode = 0;
4083 WDF_REQUEST_PARAMETERS requestParameters;
4084
4085 // Get the Request parameters
4086 WDF_REQUEST_PARAMETERS_INIT(&requestParameters);
4087 WdfRequestGetParameters(Request, &requestParameters);
4088
4089 // check and initialize parameter
4090 if (IsBlocked == NULL)
4091 {
4092 //This is an internal function and this parameter must be supplied.
4094
4096 }
4097 else
4098 {
4099 *IsBlocked = FALSE;
4100 }
4101
4102 // check if this is an IOCTL
4103 if ((requestParameters.Type == WdfRequestTypeDeviceControl) ||
4104 (requestParameters.Type == WdfRequestTypeDeviceControlInternal))
4105 {
4106 //
4107 // Allow minimum set of commands that are required for the disk manager
4108 // to show the CD device, while in exclusive mode.
4109 // Note: These commands should not generate any requests to the device,
4110 // and thus must be handled directly in StartIO during exclusive
4111 // access (except for the exclusive owner, of course).
4112 //
4113 ioctlCode = requestParameters.Parameters.DeviceIoControl.IoControlCode;
4114 baseCode = DEVICE_TYPE_FROM_CTL_CODE(ioctlCode);
4115
4116 if (ioctlCode == IOCTL_SCSI_GET_ADDRESS ||
4117 ioctlCode == IOCTL_STORAGE_GET_HOTPLUG_INFO ||
4118 ioctlCode == IOCTL_STORAGE_GET_DEVICE_NUMBER ||
4119 ioctlCode == IOCTL_STORAGE_GET_MEDIA_TYPES_EX ||
4120 ioctlCode == IOCTL_CDROM_EXCLUSIVE_ACCESS ||
4121 ioctlCode == IOCTL_CDROM_GET_INQUIRY_DATA
4122 )
4123 {
4124 *IsBlocked = FALSE;
4125 }
4126
4127 //
4128 // Handle IOCTL_STORAGE_QUERY_PROPERTY special because:
4129 // (1) PropertyExistsQuery should not generate device i/o
4130 // (2) Queries for StorageDeviceProperty and StorageAdapterDescriptor
4131 // will return cache'd data
4132 else if (ioctlCode == IOCTL_STORAGE_QUERY_PROPERTY)
4133 {
4135 status = WdfRequestRetrieveInputBuffer(Request,
4136 requestParameters.Parameters.DeviceIoControl.InputBufferLength,
4137 (PVOID*)&query,
4138 NULL);
4139
4140 if (NT_SUCCESS(status))
4141 {
4142 if (query != NULL)
4143 {
4144 if (query->QueryType == PropertyExistsQuery)
4145 {
4146 *IsBlocked = FALSE;
4147 }
4148 else if ((query->QueryType == PropertyStandardQuery) &&
4149 ((query->PropertyId == StorageDeviceProperty) ||
4150 (query->PropertyId == StorageAdapterProperty)))
4151 {
4152 *IsBlocked = FALSE;
4153 }
4154 }
4155 }
4156 }
4157
4158 // Return TRUE for unknown IOCTLs with STORAGE bases
4159 else if (baseCode == IOCTL_SCSI_BASE ||
4160 baseCode == IOCTL_DISK_BASE ||
4161 baseCode == IOCTL_CDROM_BASE ||
4162 baseCode == IOCTL_STORAGE_BASE ||
4163 baseCode == IOCTL_DVD_BASE )
4164 {
4165 *IsBlocked = TRUE;
4166 }
4167 }
4168 else
4169 {
4170 // this should only be called with an IOCTL
4172
4174 }
4175
4176 return status;
4177}
#define IOCTL_STORAGE_GET_MEDIA_TYPES_EX
Definition: cdrw_usr.h:190
#define IOCTL_STORAGE_GET_HOTPLUG_INFO
Definition: imports.h:238
#define IOCTL_CDROM_GET_INQUIRY_DATA
Definition: ntddcdrm.h:91
#define IOCTL_CDROM_EXCLUSIVE_ACCESS
Definition: ntddcdrm.h:85
#define IOCTL_DISK_BASE
Definition: ntdddisk.h:44
#define IOCTL_STORAGE_QUERY_PROPERTY
Definition: ntddstor.h:178
#define IOCTL_STORAGE_GET_DEVICE_NUMBER
Definition: ntddstor.h:143
@ StorageAdapterProperty
Definition: ntddstor.h:513
@ StorageDeviceProperty
Definition: ntddstor.h:512
@ PropertyExistsQuery
Definition: ntddstor.h:506
@ PropertyStandardQuery
Definition: ntddstor.h:505
#define IOCTL_STORAGE_BASE
Definition: ntddstor.h:96
#define IOCTL_DVD_BASE
Definition: ntddcdvd.h:32
#define DEVICE_TYPE_FROM_CTL_CODE(c)
Definition: winioctl.h:205
#define IOCTL_SCSI_GET_ADDRESS
Definition: scsi_port.h:52
#define IOCTL_SCSI_BASE
Definition: scsi_port.h:37
#define IOCTL_CDROM_BASE
Definition: vcdcli.c:21
@ WdfRequestTypeDeviceControlInternal
Definition: wdfdevice.h:518

Referenced by DeviceEvtIoInCallerContext(), RequestSynchronizeProcessWithSerialQueue(), and SequentialQueueEvtIoDeviceControl().

◆ RequestProcessInternalDeviceControl()

VOID RequestProcessInternalDeviceControl ( _In_ WDFREQUEST  Request,
_In_ PCDROM_DEVICE_EXTENSION  DeviceExtension 
)

Definition at line 3154 of file cdrom.c.

3173{
3175 PIRP irp = NULL;
3176 PIO_STACK_LOCATION irpStack = NULL;
3177 PIO_STACK_LOCATION nextStack = NULL;
3178 BOOLEAN requestSent = FALSE;
3179
3180 irp = WdfRequestWdmGetIrp(Request);
3182 nextStack = IoGetNextIrpStackLocation(irp);
3183
3184 // Set the parameters in the next stack location.
3185 nextStack->Parameters.Scsi.Srb = irpStack->Parameters.Scsi.Srb;
3186 nextStack->MajorFunction = IRP_MJ_SCSI;
3187 nextStack->MinorFunction = IRP_MN_SCSI_CLASS;
3188
3189 WdfRequestSetCompletionRoutine(Request, RequestDummyCompletionRoutine, NULL);
3190
3191 status = RequestSend(DeviceExtension,
3192 Request,
3193 DeviceExtension->IoTarget,
3194 0,
3195 &requestSent);
3196
3197 // send the request straight down (asynchronously)
3198 if (!requestSent)
3199 {
3200 // fail the request
3201 RequestCompletion(DeviceExtension, Request, status, WdfRequestGetInformation(Request));
3202 }
3203
3204 return;
3205}
NTSTATUS RequestSend(_In_ PCDROM_DEVICE_EXTENSION DeviceExtension, _In_ WDFREQUEST Request, _In_ WDFIOTARGET IoTarget, _In_ ULONG Flags, _Out_opt_ PBOOLEAN RequestSent)
Definition: common.c:3793
EVT_WDF_REQUEST_COMPLETION_ROUTINE RequestDummyCompletionRoutine
Definition: cdrom.h:1608
VOID RequestCompletion(_In_ PCDROM_DEVICE_EXTENSION DeviceExtension, _In_ WDFREQUEST Request, _In_ NTSTATUS Status, _In_ ULONG_PTR Information)
Definition: common.c:3439
#define IRP_MJ_SCSI
#define IRP_MN_SCSI_CLASS

Referenced by DeviceEvtIoInCallerContext().

◆ RequestSend()

NTSTATUS RequestSend ( _In_ PCDROM_DEVICE_EXTENSION  DeviceExtension,
_In_ WDFREQUEST  Request,
_In_ WDFIOTARGET  IoTarget,
_In_ ULONG  Flags,
_Out_opt_ PBOOLEAN  RequestSent 
)

Definition at line 3793 of file common.c.

3819{
3821 BOOLEAN requestSent = FALSE;
3823
3824 UNREFERENCED_PARAMETER(DeviceExtension);
3825
3826 if ((DeviceExtension->ZeroPowerODDInfo != NULL) &&
3827 (DeviceExtension->ZeroPowerODDInfo->InZeroPowerState != FALSE))
3828 {
3829 }
3830
3831 // Now send down the request
3832 if (NT_SUCCESS(status))
3833 {
3835
3837
3838 // send request and check status
3839
3840 // Disable SDV warning about infinitely waiting in caller's context:
3841 // 1. Some requests (such as SCSI_PASS_THROUGH, contains buffer from user space) need to be sent down in caller’s context.
3842 // Consequently, these requests wait in caller’s context until they are allowed to be sent down.
3843 // 2. Considering the situation that during sleep, a request can be hold by storage port driver. When system resumes, any time out value (if we set using KMDF time out value) might be expires.
3844 // This will cause the waiting request being failed (behavior change). We’d rather not set time out value.
3845
3846 _Analysis_assume_(options.Timeout != 0);
3847 requestSent = WdfRequestSend(Request, IoTarget, &options);
3848 _Analysis_assume_(options.Timeout == 0);
3849
3850 // If WdfRequestSend fails, or if the WDF_REQUEST_SEND_OPTION_SYNCHRONOUS flag is set,
3851 // the driver can call WdfRequestGetStatus immediately after calling WdfRequestSend.
3852 if ((requestSent == FALSE) ||
3854 {
3855 status = WdfRequestGetStatus(Request);
3856
3857 if (requestSent == FALSE)
3858 {
3859 TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_GENERAL,
3860 "WdfRequestSend failed: %lx\n",
3861 status
3862 ));
3863 }
3864 }
3865 else
3866 {
3868 }
3869
3870 if (RequestSent != NULL)
3871 {
3872 *RequestSent = requestSent;
3873 }
3874 }
3875
3876 return status;
3877}
VOID RequestSetSentTime(_In_ WDFREQUEST Request)
Definition: common.c:79
#define _Analysis_assume_(expr)
Definition: ms_sal.h:2901
_Must_inspect_result_ _In_ WDFDEVICE _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFIOTARGET * IoTarget
Definition: wdfiotarget.h:368
_Must_inspect_result_ FORCEINLINE BOOLEAN WdfRequestSend(_In_ WDFREQUEST Request, _In_ WDFIOTARGET Target, _In_opt_ PWDF_REQUEST_SEND_OPTIONS Options)
Definition: wdfrequest.h:677
FORCEINLINE VOID WDF_REQUEST_SEND_OPTIONS_INIT(_Out_ PWDF_REQUEST_SEND_OPTIONS Options, _In_ ULONG Flags)
Definition: wdfrequest.h:409
@ WDF_REQUEST_SEND_OPTION_SYNCHRONOUS
Definition: wdfrequest.h:109
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

Referenced by _IRQL_requires_max_(), DeviceReleaseQueue(), DeviceSendStartUnit(), RequestProcessInternalDeviceControl(), and ScratchBuffer_SendSrb().

◆ RequestSenseInfoInterpret()

BOOLEAN RequestSenseInfoInterpret ( _In_ PCDROM_DEVICE_EXTENSION  DeviceExtension,
_In_ WDFREQUEST  Request,
_In_ PSCSI_REQUEST_BLOCK  Srb,
_In_ ULONG  RetriedCount,
_Out_ NTSTATUS Status,
_Out_opt_ _Deref_out_range_(0, MAXIMUM_RETRY_FOR_SINGLE_IO_IN_100NS_UNITS) LONGLONG RetryIntervalIn100ns 
)

Definition at line 2467 of file sense.c.

2500{
2501 BOOLEAN retry = FALSE;
2502 LONGLONG retryIntervalIn100ns = 0;
2503 PZERO_POWER_ODD_INFO zpoddInfo = DeviceExtension->ZeroPowerODDInfo;
2504
2506 {
2507 // request succeeded.
2508 if ((zpoddInfo != NULL) &&
2509 (zpoddInfo->BecomingReadyRetryCount > 0))
2510 {
2511 zpoddInfo->BecomingReadyRetryCount = 0;
2512 }
2513
2515 retry = FALSE;
2516 }
2517 else
2518 {
2519 // request failed. We need to process the error.
2520
2521 // 1. Release the queue if it is frozen.
2523 {
2524 DeviceReleaseQueue(DeviceExtension->Device);
2525 }
2526
2527 if ((zpoddInfo != NULL) &&
2528 ((zpoddInfo->RetryFirstCommand != FALSE) || (zpoddInfo->BecomingReadyRetryCount > 0)))
2529 {
2530 retry = SenseInfoInterpretForZPODD(DeviceExtension,
2531 Srb,
2532 Status,
2533 &retryIntervalIn100ns);
2534 }
2535
2536 if (retry == FALSE)
2537 {
2538 // 2. Error Processing
2539 if ((zpoddInfo != NULL) &&
2540 (zpoddInfo->BecomingReadyRetryCount > 0))
2541 {
2542 zpoddInfo->BecomingReadyRetryCount = 0;
2543 }
2544
2545 retry = SenseInfoInterpret(DeviceExtension,
2546 Request,
2547 Srb,
2548 RetriedCount,
2549 Status,
2550 &retryIntervalIn100ns);
2551 }
2552 }
2553
2554 if (RetryIntervalIn100ns != NULL)
2555 {
2556 *RetryIntervalIn100ns = retryIntervalIn100ns;
2557 }
2558
2559 return retry;
2560}
VOID DeviceReleaseQueue(_In_ WDFDEVICE Device)
Definition: common.c:1179
#define SRB_STATUS(Status)
Definition: srb.h:389
#define SRB_STATUS_QUEUE_FROZEN
Definition: srb.h:386
#define SRB_STATUS_SUCCESS
Definition: srb.h:341
BOOLEAN SenseInfoInterpretForZPODD(_In_ PCDROM_DEVICE_EXTENSION DeviceExtension, _In_ PSCSI_REQUEST_BLOCK Srb, _Out_ NTSTATUS *Status, _Out_ _Out_range_(0, MAXIMUM_RETRY_FOR_SINGLE_IO_IN_100NS_UNITS) LONGLONG *RetryIntervalIn100ns)
Definition: sense.c:2341
BOOLEAN SenseInfoInterpret(_In_ PCDROM_DEVICE_EXTENSION DeviceExtension, _In_ WDFREQUEST Request, _In_ PSCSI_REQUEST_BLOCK Srb, _In_ ULONG RetriedCount, _Out_ NTSTATUS *Status, _Out_ _Deref_out_range_(0, MAXIMUM_RETRY_FOR_SINGLE_IO_IN_100NS_UNITS) LONGLONG *RetryIntervalIn100ns)
Definition: sense.c:2038
BOOLEAN RetryFirstCommand
Definition: cdromp.h:273
ULONG BecomingReadyRetryCount
Definition: cdromp.h:277
int64_t LONGLONG
Definition: typedefs.h:68

Referenced by _IRQL_requires_max_(), and RequestSenseInfoInterpretForScratchBuffer().

◆ RequestSenseInfoInterpretForScratchBuffer()

BOOLEAN RequestSenseInfoInterpretForScratchBuffer ( _In_ PCDROM_DEVICE_EXTENSION  DeviceExtension,
_In_ ULONG  RetriedCount,
_Out_ NTSTATUS Status,
_Out_ _Deref_out_range_(0, MAXIMUM_RETRY_FOR_SINGLE_IO_IN_100NS_UNITS) LONGLONG RetryIntervalIn100ns 
)

Definition at line 2564 of file sense.c.

2589{
2590 NT_ASSERT(DeviceExtension->ScratchContext.ScratchInUse != 0);
2591
2592 return RequestSenseInfoInterpret(DeviceExtension,
2593 DeviceExtension->ScratchContext.ScratchRequest,
2594 DeviceExtension->ScratchContext.ScratchSrb,
2595 RetriedCount,
2596 Status,
2597 RetryIntervalIn100ns);
2598}
BOOLEAN RequestSenseInfoInterpret(_In_ PCDROM_DEVICE_EXTENSION DeviceExtension, _In_ WDFREQUEST Request, _In_ PSCSI_REQUEST_BLOCK Srb, _In_ ULONG RetriedCount, _Out_ NTSTATUS *Status, _Out_opt_ _Deref_out_range_(0, MAXIMUM_RETRY_FOR_SINGLE_IO_IN_100NS_UNITS) LONGLONG *RetryIntervalIn100ns)
Definition: sense.c:2467

Referenced by RequestIssueShutdownFlush(), and ScratchBuffer_ReadWriteCompletionRoutine().

◆ RequestSetContextFields()

NTSTATUS RequestSetContextFields ( _In_ WDFREQUEST  Request,
_In_ PSYNC_HANDLER  Handler 
)

Definition at line 2748 of file common.c.

2768{
2770 PCDROM_REQUEST_CONTEXT requestContext = RequestGetContext(Request);
2771 PKEVENT syncEvent = NULL;
2772
2773 syncEvent = ExAllocatePoolWithTag(NonPagedPoolNx,
2774 sizeof(KEVENT),
2776
2777 if (syncEvent == NULL)
2778 {
2779 // memory allocation failed.
2781 }
2782 else
2783 {
2784 // now, put the special synchronization information into the context
2785 requestContext->SyncRequired = TRUE;
2786 requestContext->SyncEvent = syncEvent;
2787 requestContext->SyncCallback = Handler;
2788
2790 }
2791
2792 return status;
2793}
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER Handler
Definition: acpixf.h:672
#define CDROM_TAG_SYNC_EVENT
Definition: cdrom.h:732
BOOLEAN SyncRequired
Definition: cdrom.h:643
PSYNC_HANDLER SyncCallback
Definition: cdrom.h:645

Referenced by RequestDispatchSpecialIoctls(), RequestDispatchSyncWithSequentialQueue(), and RequestDispatchUnknownRequests().

◆ RequestSetReceivedTime()

VOID RequestSetReceivedTime ( _In_ WDFREQUEST  Request)

Definition at line 64 of file common.c.

67{
68 PCDROM_REQUEST_CONTEXT requestContext = RequestGetContext(Request);
70
72
73 requestContext->TimeReceived = temp;
74
75 return;
76}
static calc_node_t temp
Definition: rpn_ieee.c:38
#define KeQueryTickCount(CurrentCount)
Definition: ke.h:43
LARGE_INTEGER TimeReceived
Definition: cdrom.h:635

Referenced by DeviceEvtIoInCallerContext().

◆ RequestSetSentTime()

VOID RequestSetSentTime ( _In_ WDFREQUEST  Request)

Definition at line 79 of file common.c.

82{
83 PCDROM_REQUEST_CONTEXT requestContext = RequestGetContext(Request);
85
87
88 if (requestContext->TimeSentDownFirstTime.QuadPart == 0)
89 {
90 requestContext->TimeSentDownFirstTime = temp;
91 }
92
93 requestContext->TimeSentDownLasttTime = temp;
94
95 if (requestContext->OriginalRequest != NULL)
96 {
97 PCDROM_REQUEST_CONTEXT originalRequestContext = RequestGetContext(requestContext->OriginalRequest);
98
99 if (originalRequestContext->TimeSentDownFirstTime.QuadPart == 0)
100 {
101 originalRequestContext->TimeSentDownFirstTime = temp;
102 }
103
104 originalRequestContext->TimeSentDownLasttTime = temp;
105 }
106
107 return;
108}
WDFREQUEST OriginalRequest
Definition: cdrom.h:633

Referenced by RequestSend().

◆ RequestSetupMcnSyncIrp()

VOID RequestSetupMcnSyncIrp ( _In_ PCDROM_DEVICE_EXTENSION  DeviceExtension)

Definition at line 2749 of file autorun.c.

2766{
2767 PIRP irp = NULL;
2768 PIO_STACK_LOCATION irpStack = NULL;
2769 PIO_STACK_LOCATION nextIrpStack = NULL;
2770
2771 irp = DeviceExtension->MediaChangeDetectionInfo->MediaChangeSyncIrp;
2772 NT_ASSERT(irp != NULL);
2773
2774 //
2775 // For the driver that creates an IRP, there is no 'current' stack location.
2776 // Step down one IRP stack location so that the extra top one
2777 // becomes our 'current' one.
2778 //
2780
2781 /*
2782 * Cache our device object in the extra top IRP stack location
2783 * so we have it in our completion routine.
2784 */
2786 irpStack->DeviceObject = DeviceExtension->DeviceObject;
2787
2788 //
2789 // If the irp is sent down when the volume needs to be
2790 // verified, CdRomUpdateGeometryCompletion won't complete
2791 // it since it's not associated with a thread. Marking
2792 // it to override the verify causes it always be sent
2793 // to the port driver
2794 //
2795 nextIrpStack = IoGetNextIrpStackLocation(irp);
2796
2798
2799 nextIrpStack->MajorFunction = IRP_MJ_DEVICE_CONTROL;
2800 // pick up this IOCTL code as it's not normaly seen for CD/DVD drive and does not require input.
2801 // set other fields to make this IOCTL recognizable by CDROM.SYS
2802 nextIrpStack->Parameters.Others.Argument1 = RequestSetupMcnSyncIrp;
2803 nextIrpStack->Parameters.Others.Argument2 = RequestSetupMcnSyncIrp;
2804 nextIrpStack->Parameters.DeviceIoControl.IoControlCode = IOCTL_MCN_SYNC_FAKE_IOCTL; //Argument3.
2805 nextIrpStack->Parameters.Others.Argument4 = RequestSetupMcnSyncIrp;
2806
2809 DeviceExtension,
2810 TRUE,
2811 TRUE,
2812 TRUE);
2813
2814 return;
2815}
IO_COMPLETION_ROUTINE RequestMcnSyncIrpCompletion
Definition: autorun.c:2691
VOID RequestSetupMcnSyncIrp(_In_ PCDROM_DEVICE_EXTENSION DeviceExtension)
Definition: autorun.c:2749
PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:3223
FORCEINLINE VOID IoSetNextIrpStackLocation(_Inout_ PIRP Irp)
Definition: iofuncs.h:2680
#define SL_OVERRIDE_VERIFY_VOLUME
Definition: iotypes.h:1823

Referenced by RequestDispatchSpecialIoctls(), and RequestSetupMcnSyncIrp().

◆ RequestSynchronizeProcessWithSerialQueue()

NTSTATUS RequestSynchronizeProcessWithSerialQueue ( _In_ WDFDEVICE  Device,
_In_ WDFREQUEST  Request 
)

Definition at line 3893 of file cdrom.c.

3916{
3918 PCDROM_DEVICE_EXTENSION deviceExtension = DeviceGetExtension(Device);
3919 PCDROM_REQUEST_CONTEXT requestContext = RequestGetContext(Request);
3920 PKEVENT bufferToFree = requestContext->SyncEvent;
3921
3923 // cannot block at or above DISPATCH_LEVEL
3924 TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_IOCTL,
3925 "RequestSynchronousProcessWithSerialQueue called at DISPATCH_LEVEL or above"));
3927 RequestCompletion(deviceExtension, Request, STATUS_INVALID_LEVEL, 0);
3928 return STATUS_INVALID_LEVEL;
3929 }
3930
3931 // init the synchronization event
3933
3934 // do we still need to do something like this?
3935 // SET_FLAG(nextStack->Flags, SL_OVERRIDE_VERIFY_VOLUME);
3936
3937 // NOTE: this mechanism relies on that KMDF will not complete request by itself.
3938 // Doing that will cause the syncEvent not fired thus this thread will stuck.
3939 // This should not really happen: our EvtCanceledOnQueue callbacks should be
3940 // called even if queues are purged for some reason. The only case when these
3941 // callbacks are not called is when a request is owned by the driver (i.e. has
3942 // already been passed to one of the registered handlers). In this case, it is
3943 // our responsibility to cancel such requests properly.
3944 status = WdfDeviceEnqueueRequest(Device, Request);
3945
3946 if (!NT_SUCCESS(status))
3947 {
3948 // Failed to forward request! Pretend the sync event already occured, otherwise we'll hit
3949 // an assert in RequestEvtCleanup.
3950 KeSetEvent(requestContext->SyncEvent, IO_CD_ROM_INCREMENT, FALSE);
3951 RequestCompletion(deviceExtension, Request, status, WdfRequestGetInformation(Request));
3952 }
3953 else
3954 {
3955 NTSTATUS waitStatus = STATUS_UNSUCCESSFUL;
3956 PCDROM_DATA cdData = &(deviceExtension->DeviceAdditionalData);
3957 BOOLEAN fCallSyncCallback = FALSE;
3958 PIRP irp = WdfRequestWdmGetIrp(Request);
3959
3960 // ok, now wait on the event
3961 while (waitStatus != STATUS_SUCCESS)
3962 {
3963 waitStatus = KeWaitForSingleObject(requestContext->SyncEvent, Executive, KernelMode, TRUE, NULL);
3964 if (waitStatus == STATUS_SUCCESS) // must check equality -- STATUS_ALERTED is success code
3965 {
3966 // do nothing
3967 }
3968 else if (waitStatus != STATUS_ALERTED)
3969 {
3970 // do nothing
3971 TracePrint((TRACE_LEVEL_FATAL, TRACE_FLAG_IOCTL,
3972 "Request %p on device object %p had a non-alert, non-success result from wait (%!HRESULT!)\n",
3973 Request, Device, waitStatus));
3975 }
3977 {
3978 // the thread was alerted and is terminating, so cancel the irp
3979 // this will cause EvtIoCanceledOnQueue to be called, which will signal the event,
3980 // so we will get out of the while loop and eventually complete the request.
3981 if (IoCancelIrp(irp))
3982 {
3983 // cancellation routine was called
3984 TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL,
3985 "Sychronize Ioctl: request %p cancelled from device %p\n",
3986 Request, Device));
3987 }
3988 else
3989 {
3990 TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL,
3991 "Sychronize Ioctl: request %p could not be cancelled from device %p\n",
3992 Request, Device));
3993 }
3994 }
3995 else
3996 {
3997 TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL,
3998 "SPURIOUS ALERT waiting for Request %p on device %p (%!STATUS!)\n",
3999 Request, Device, status));
4000 }
4001 } // end of wait loop on the event
4002
4003 // because we've waited an unknown amount of time, should check
4004 // the cancelled flag to immediately fail the irp as appropriate
4005 if (WdfRequestIsCanceled(Request))
4006 {
4007 // the request was cancelled, thus we should always stop
4008 // processing here if possible.
4010 RequestCompletion(deviceExtension, Request, status, 0);
4011 }
4012 else if (EXCLUSIVE_MODE(cdData) && !EXCLUSIVE_OWNER(cdData, WdfRequestGetFileObject(Request)))
4013 {
4014 WDF_REQUEST_PARAMETERS requestParameters;
4015 BOOLEAN isBlocked = FALSE;
4016
4017 // get the request parameters
4018 WDF_REQUEST_PARAMETERS_INIT(&requestParameters);
4019 WdfRequestGetParameters(Request, &requestParameters);
4020
4022 if (isBlocked)
4023 {
4024 TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_IOCTL,
4025 "Access Denied! Device in exclusive mode.Failing Ioctl %lx\n",
4026 requestParameters.Parameters.DeviceIoControl.IoControlCode));
4027 RequestCompletion(deviceExtension, Request, STATUS_ACCESS_DENIED, 0);
4028 }
4029 else
4030 {
4031 TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL,
4032 "Ioctl %lx not blocked by cdrom being in exclusive mode\n",
4033 requestParameters.Parameters.DeviceIoControl.IoControlCode));
4034 fCallSyncCallback = TRUE;
4035 }
4036 }
4037 else
4038 {
4039 fCallSyncCallback = TRUE;
4040 }
4041
4042 if (fCallSyncCallback)
4043 {
4044 // Synchronization completed successfully. Call the requested routine
4045 status = requestContext->SyncCallback(Device, Request);
4046 }
4047 }
4048
4049 // The next SequentialQueue evt routine will not be triggered until the current request is completed.
4050
4051 // clean up the request context setting.
4052 FREE_POOL(bufferToFree);
4053
4054 return status;
4055}
NTSTATUS RequestIsIoctlBlockedByExclusiveAccess(_In_ WDFREQUEST Request, _Out_ PBOOLEAN IsBlocked)
Definition: cdrom.c:4058
#define EXCLUSIVE_OWNER(_CdData, _FileObject)
Definition: cdrom.h:789
#define EXCLUSIVE_MODE(_CdData)
Definition: cdrom.h:788
#define PsGetCurrentThread()
Definition: env_spec_w32.h:81
#define KeSetEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:476
BOOLEAN NTAPI IoCancelIrp(IN PIRP Irp)
Definition: irp.c:1101
BOOLEAN NTAPI PsIsThreadTerminating(IN PETHREAD Thread)
Definition: thread.c:868
#define STATUS_ALERTED
Definition: ntstatus.h:80
#define STATUS_INVALID_LEVEL
Definition: ntstatus.h:564
#define TRACE_LEVEL_FATAL
Definition: storswtr.h:26
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define STATUS_CANCELLED
Definition: udferr_usr.h:170
#define IO_CD_ROM_INCREMENT
Definition: iotypes.h:599

Referenced by RequestDispatchSpecialIoctls(), RequestDispatchSyncWithSequentialQueue(), and RequestDispatchUnknownRequests().

◆ SequentialQueueEvtIoReadWrite()

VOID NTAPI SequentialQueueEvtIoReadWrite ( _In_ WDFQUEUE  Queue,
_In_ WDFREQUEST  Request,
_In_ size_t  Length 
)

Definition at line 3215 of file cdrom.c.

3238{
3240 WDFDEVICE device = WdfIoQueueGetDevice(Queue);
3241 PCDROM_DEVICE_EXTENSION deviceExtension = DeviceGetExtension(device);
3242 WDF_REQUEST_PARAMETERS requestParameters;
3243 PIRP wdmIrp = WdfRequestWdmGetIrp(Request);
3244 PIO_STACK_LOCATION currentIrpStack = IoGetCurrentIrpStackLocation(wdmIrp);
3245 PCDROM_DATA cdData = &(deviceExtension->DeviceAdditionalData);
3246
3247 // Get the request parameters
3248 WDF_REQUEST_PARAMETERS_INIT(&requestParameters);
3249 WdfRequestGetParameters(Request, &requestParameters);
3250
3251 if (requestParameters.Type == WdfRequestTypeRead)
3252 {
3253 TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_GENERAL,
3254 "Receiving READ, Length %Ix\n", (ULONG) Length));
3255 }
3256 else
3257 {
3258 TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_GENERAL,
3259 "Receiving WRITE, Length %Ix\n", (ULONG) Length));
3260 }
3261
3262 // Check if a verify is required before a READ/WRITE
3263 if (TEST_FLAG(deviceExtension->DeviceObject->Flags, DO_VERIFY_VOLUME) &&
3264 (requestParameters.MinorFunction != CDROM_VOLUME_VERIFY_CHECKED) &&
3265 !TEST_FLAG(currentIrpStack->Flags, SL_OVERRIDE_VERIFY_VOLUME))
3266 {
3267 // DO_VERIFY_VOLUME is set for the device object,
3268 // but this request is not itself a verify request.
3269 // So fail this request.
3270 RequestCompletion(deviceExtension, Request, STATUS_VERIFY_REQUIRED, 0);
3271 }
3272 else
3273 {
3274 // Since we've bypassed the verify-required tests we don't need to repeat
3275 // them with this IRP - in particular we don't want to worry about
3276 // hitting them at the partition 0 level if the request has come through
3277 // a non-zero partition.
3278 currentIrpStack->MinorFunction = CDROM_VOLUME_VERIFY_CHECKED;
3279
3280 // Fail READ/WRITE requests when music is playing
3281 if (deviceExtension->DeviceAdditionalData.PlayActive)
3282 {
3283 RequestCompletion(deviceExtension, Request, STATUS_DEVICE_BUSY, 0);
3284
3285 return;
3286 }
3287
3288 // Fail READ/WRITE requests from non-owners if the drive is locked
3289 if (EXCLUSIVE_MODE(cdData) && !EXCLUSIVE_OWNER(cdData, WdfRequestGetFileObject(Request)))
3290 {
3291 RequestCompletion(deviceExtension, Request, STATUS_ACCESS_DENIED, 0);
3292
3293 return;
3294 }
3295
3296 // Succeed READ/WRITE requests of length 0
3297 if (Length == 0)
3298 {
3299 // Several parts of the code turn 0 into 0xffffffff,
3300 // so don't process a zero-length request any further.
3301 RequestCompletion(deviceExtension, Request, STATUS_SUCCESS, Length);
3302
3303 return;
3304 }
3305
3306 // If there is an unexpected write request, we want to rediscover MMC capabilities
3307 if (!deviceExtension->DeviceAdditionalData.Mmc.WriteAllowed &&
3308 (requestParameters.Type == WdfRequestTypeWrite))
3309 {
3310 // Schedule MMC capabilities update now, but perform it later in a work item
3312 }
3313
3314 // If MMC capabilities update is required, we create a separate work item to avoid blocking
3315 // the current thread; otherwise, we initiate an async read/write in the current thread.
3316 if (DeviceIsMmcUpdateRequired(deviceExtension->Device))
3317 {
3319 WdfWorkItemEnqueue(deviceExtension->ReadWriteWorkItem);
3320
3322 }
3323 else
3324 {
3325 status = RequestValidateReadWrite(deviceExtension, Request, requestParameters);
3326
3327 if (NT_SUCCESS(status))
3328 {
3329 status = RequestHandleReadWrite(deviceExtension, Request, requestParameters);
3330 }
3331 }
3332
3333 if (!NT_SUCCESS(status))
3334 {
3335 RequestCompletion(deviceExtension, Request, status, 0);
3336 }
3337 }
3338
3339 return;
3340}
BOOLEAN DeviceIsMmcUpdateRequired(_In_ WDFDEVICE Device)
Definition: cdrom.c:4180
#define CDROM_VOLUME_VERIFY_CHECKED
Definition: cdromp.h:171
NTSTATUS RequestValidateReadWrite(_In_ PCDROM_DEVICE_EXTENSION DeviceExtension, _In_ WDFREQUEST Request, _In_ WDF_REQUEST_PARAMETERS RequestParameters)
Definition: ioctl.c:6117
NTSTATUS RequestHandleReadWrite(_In_ PCDROM_DEVICE_EXTENSION DeviceExtension, _In_ WDFREQUEST Request, _In_ WDF_REQUEST_PARAMETERS RequestParameters)
Definition: ioctl.c:6353
#define DO_VERIFY_VOLUME
Definition: env_spec_w32.h:393
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
BOOLEAN PlayActive
Definition: cdrom.h:351
PDEVICE_OBJECT DeviceObject
Definition: cdrom.h:493
CDROM_READ_WRITE_CONTEXT ReadWriteWorkItemContext
Definition: cdrom.h:609
WDFWORKITEM ReadWriteWorkItem
Definition: cdrom.h:608
WDFDEVICE Device
Definition: cdrom.h:473
BOOLEAN WriteAllowed
Definition: cdrom.h:250
WDFREQUEST OriginalRequest
Definition: cdrom.h:335
Definition: devices.h:37
#define STATUS_VERIFY_REQUIRED
Definition: udferr_usr.h:130
_Must_inspect_result_ _In_ WDFDEVICE _In_ PIRP _In_ WDFQUEUE Queue
Definition: wdfdevice.h:2225

Referenced by DriverEvtDeviceAdd().

◆ TimeOutValueGetCapValue()

FORCEINLINE ULONG TimeOutValueGetCapValue ( _In_ ULONG  TimeOutValue,
_In_ ULONG  Times 
)

Definition at line 1569 of file cdrom.h.

1573{
1574 ULONG value = 0;
1575
1576 if (TimeOutValue > SCSI_CDROM_OPC_TIMEOUT)
1577 {
1578 // if time out value is specified by user in registry, and is
1579 // bigger than OPC time out, it should be big enough
1580 value = TimeOutValue;
1581 }
1582 else
1583 {
1584 // otherwise, OPC time out value should be the upper limit
1585 value = min(TimeOutValue * Times, SCSI_CDROM_OPC_TIMEOUT);
1586 }
1587
1588 return value;
1589}
#define SCSI_CDROM_OPC_TIMEOUT
Definition: cdrom.h:688
#define min(a, b)
Definition: monoChain.cc:55
Definition: pdh_main.c:94

Referenced by DeviceScratchSyncCache(), RequestHandleQueryPropertyWriteCache(), and RequestIssueShutdownFlush().

◆ ValidChar()

FORCEINLINE BOOLEAN ValidChar ( UCHAR  Ch)

Definition at line 812 of file cdrom.h.

813{
814 if (((Ch >= '0') && (Ch <= '9')) ||
815 (((Ch|0x20) >= 'a') && ((Ch|0x20) <= 'z')) ||
816 (strchr(" .,:;_-", Ch) != NULL))
817 {
818 return TRUE;
819 }
820 return FALSE;
821}
char * strchr(const char *String, int ch)
Definition: utclib.c:501
#define Ch(x, y, z)
Definition: sha2.c:141

Variable Documentation

◆ BufferAddress

◆ BufferLength

◆ CdromHackItems

CDROM_SCAN_FOR_SPECIAL_INFO CdromHackItems[]
extern

Definition at line 44 of file data.c.

◆ CompletionRoutine

◆ Context

◆ CreateQueueEvtIoDefault

EVT_WDF_IO_QUEUE_IO_DEFAULT CreateQueueEvtIoDefault

Definition at line 886 of file cdrom.h.

Referenced by DriverEvtDeviceAdd().

◆ Data

Definition at line 946 of file cdrom.h.

◆ DataLength

Definition at line 1443 of file cdrom.h.

Referenced by _IRQL_requires_max_(), FxRegKey::_VerifyMultiSzString(), AcpiExWriteDataToField(), AcpiExWriteSerialBus(), AcpiRegQueryValue(), AddUDPHeaderIPv4(), ApphelpCacheParse(), BiConvertRegistryDataToElement(), CdAddInitialAllocation(), CmpFreeValueData(), CmSetValueKey(), compat_FsRtlValidateReparsePointBuffer(), CsrClientCallServer(), DECLARE_INTERFACE_(), DECLSPEC_UUID(), CWebService::DoRequest(), EnumerateValueTest(), FltpReadRegistryValue(), FormatOutput(), FsRtlAddToTunnelCache(), FsRtlFindInTunnelCache(), FsRtlNotifyCompleteIrp(), FsRtlNotifyCompleteIrpList(), FsRtlNotifyFilterReportChange(), FsRtlNotifyUpdateBuffer(), FsRtlValidateReparsePointBuffer(), HandleDataIntersection(), HandlePhysicalConnection(), HwReadWriteData(), IKsControl_fnKsEvent(), IKsControl_fnKsMethod(), IKsControl_fnKsProperty(), IniCacheAddKey(), KdReceivePacket(), CInputPin::KsEvent(), CKsNode::KsEvent(), COutputPin::KsEvent(), CKsProxy::KsEvent(), KsFastMethodHandler(), KsFastPropertyHandler(), CInputPin::KsMethod(), CKsNode::KsMethod(), COutputPin::KsMethod(), CKsProxy::KsMethod(), KspCacheAddData(), KspHandleDataIntersection(), CInputPin::KsProperty(), CKsNode::KsProperty(), COutputPin::KsProperty(), CKsProxy::KsProperty(), LsapRegEnumerateValue(), LsapRegQueryValue(), LsapRegSetValue(), LsarEnumerateAccounts(), main(), NpQueryClientProcess(), NpReadDataQueue(), ProcessorSetFriendlyName(), RegEnumValueA(), RegQueryValueExA(), RepGetValueData(), RequestDuidGetDeviceIdProperty(), RequestDuidGetDeviceProperty(), RequestHandleGetDeviceNumber(), RequestHandleGetHotPlugInfo(), RequestHandleGetInquiryData(), RequestHandleGetMediaTypeEx(), RequestHandleMountQueryDeviceName(), RequestHandleMountQuerySuggestedLinkName(), RequestHandleMountQueryUniqueId(), RequestHandleQueryPropertyRetrieveCachedData(), RequestHandleSetHotPlugInfo(), RequestValidateAacsBindingNonce(), RequestValidateAacsEndSession(), RequestValidateAacsGetCertificate(), RequestValidateAacsGetChallengeKey(), RequestValidateAacsReadMediaId(), RequestValidateAacsReadMediaKeyBlock(), RequestValidateAacsReadSerialNumber(), RequestValidateAacsReadVolumeId(), RequestValidateAacsSendCertificate(), RequestValidateAacsSendChallengeKey(), RequestValidateAacsStartSession(), RequestValidateDvdEndSession(), RequestValidateDvdReadKey(), RequestValidateDvdReadStructure(), RequestValidateDvdSendKey(), RequestValidateDvdStartSession(), RequestValidateEnableStreaming(), RequestValidateExclusiveAccess(), RequestValidateGetConfiguration(), RequestValidateGetLastSession(), RequestValidateGetPerformance(), RequestValidatePersistentReserve(), RequestValidateRawRead(), RequestValidateReadQChannel(), RequestValidateReadToc(), RequestValidateReadTocEx(), RequestValidateSendOpcInformation(), RequestValidateSetSpeed(), RtlpNtQueryValueKey(), RtlpNtSetValueKey(), SampGetMembersInAlias(), SampRegEnumerateValue(), SampRegQueryValue(), SampRegSetValue(), SamrEnumerateAliasesInDomain(), SamrEnumerateDomainsInSamServer(), SamrEnumerateGroupsInDomain(), SamrEnumerateUsersInDomain(), SamrGetAliasMembership(), SamrLookupIdsInDomain(), SamrLookupNamesInDomain(), ScmCheckDriver(), ScmGetDriverStatus(), SepRegQueryHelper(), SmLookupSubsystem(), SmQueryInformation(), SmSendMsgToSm(), START_TEST(), test1(), test2(), test3(), test6(), test9(), UDPv4ChecksumCalculate(), UpdateMftMirror(), USBD_GetPdoRegistryParameter(), WriteMidiUartMulti(), WTSSetUserConfigA(), and WTSSetUserConfigW().

◆ Descriptor

◆ DeviceAsynchronousCompletion

EVT_WDF_REQUEST_COMPLETION_ROUTINE DeviceAsynchronousCompletion

Definition at line 1045 of file cdrom.h.

Referenced by DeviceSendStartUnit().

◆ DeviceEvtCleanup

EVT_WDF_OBJECT_CONTEXT_CLEANUP DeviceEvtCleanup

Definition at line 868 of file cdrom.h.

Referenced by DriverEvtDeviceAdd().

◆ DeviceEvtD0Entry

EVT_WDF_DEVICE_D0_ENTRY DeviceEvtD0Entry

Definition at line 878 of file cdrom.h.

Referenced by DriverEvtDeviceAdd().

◆ DeviceEvtD0Exit

EVT_WDF_DEVICE_D0_EXIT DeviceEvtD0Exit

Definition at line 880 of file cdrom.h.

Referenced by DriverEvtDeviceAdd().

◆ DeviceEvtFileClose

EVT_WDF_FILE_CLOSE DeviceEvtFileClose

Definition at line 870 of file cdrom.h.

Referenced by DriverEvtDeviceAdd().

◆ DeviceEvtIoInCallerContext

EVT_WDF_IO_IN_CALLER_CONTEXT DeviceEvtIoInCallerContext

Definition at line 872 of file cdrom.h.

Referenced by DriverEvtDeviceAdd().

◆ DeviceEvtSelfManagedIoCleanup

EVT_WDF_DEVICE_SELF_MANAGED_IO_CLEANUP DeviceEvtSelfManagedIoCleanup

Definition at line 876 of file cdrom.h.

Referenced by DriverEvtDeviceAdd().

◆ DeviceEvtSelfManagedIoInit

EVT_WDF_DEVICE_SELF_MANAGED_IO_INIT DeviceEvtSelfManagedIoInit

Definition at line 874 of file cdrom.h.

Referenced by DriverEvtDeviceAdd().

◆ DeviceEvtSurpriseRemoval

EVT_WDF_DEVICE_SURPRISE_REMOVAL DeviceEvtSurpriseRemoval

Definition at line 882 of file cdrom.h.

Referenced by DriverEvtDeviceAdd().

◆ DeviceList

Definition at line 1154 of file cdrom.h.

◆ DeviceMainTimerTickHandler

EVT_WDF_TIMER DeviceMainTimerTickHandler

Definition at line 1351 of file cdrom.h.

◆ DevicePowerSettingCallback

POWER_SETTING_CALLBACK DevicePowerSettingCallback

Definition at line 1395 of file cdrom.h.

◆ DeviceReleaseQueueCompletion

EVT_WDF_REQUEST_COMPLETION_ROUTINE DeviceReleaseQueueCompletion

Definition at line 1052 of file cdrom.h.

Referenced by DeviceReleaseQueue().

◆ DeviceRestoreDefaultSpeed

EVT_WDF_WORKITEM DeviceRestoreDefaultSpeed

Definition at line 1180 of file cdrom.h.

Referenced by DeviceErrorHandlerForMmc().

◆ DriverEntry

DRIVER_INITIALIZE DriverEntry

Definition at line 859 of file cdrom.h.

◆ DriverEvtCleanup

EVT_WDF_OBJECT_CONTEXT_CLEANUP DriverEvtCleanup

Definition at line 864 of file cdrom.h.

Referenced by DriverEntry().

◆ DriverEvtDeviceAdd

EVT_WDF_DRIVER_DEVICE_ADD DriverEvtDeviceAdd

Definition at line 862 of file cdrom.h.

Referenced by DriverEntry().

◆ Feature

◆ FileObject

_In_ WDFFILEOBJECT FileObject

Definition at line 1225 of file cdrom.h.

◆ FileObjectContext

_Inout_ PFILE_OBJECT_CONTEXT FileObjectContext

Definition at line 1211 of file cdrom.h.

Referenced by _IRQL_requires_max_().

◆ Function

◆ HackFlags

◆ IgnorePreviousMediaChanges

_Inout_ PFILE_OBJECT_CONTEXT _In_ BOOLEAN IgnorePreviousMediaChanges

Definition at line 1226 of file cdrom.h.

◆ InputBuffer

Definition at line 1439 of file cdrom.h.

◆ InputBufferLength

Definition at line 1440 of file cdrom.h.

◆ InterfaceType

Definition at line 1139 of file cdrom.h.

◆ IoControlCode

Definition at line 1437 of file cdrom.h.

◆ IoctlWorkItemRoutine

EVT_WDF_WORKITEM IoctlWorkItemRoutine

Definition at line 1616 of file cdrom.h.

Referenced by DriverEvtDeviceAdd().

◆ IsActive

_In_ BOOLEAN IsActive

Definition at line 1427 of file cdrom.h.

Referenced by ChannelIsActive(), and MiniportHalt().

◆ Length

Definition at line 1075 of file cdrom.h.

◆ Lock

Definition at line 1336 of file cdrom.h.

◆ LockType

◆ OriginalRequest

◆ OutputBuffer

Definition at line 1441 of file cdrom.h.

◆ OutputBufferLength

Definition at line 1442 of file cdrom.h.

◆ PageCode

_In_ ULONG _In_ UCHAR PageCode

Definition at line 1317 of file cdrom.h.

Referenced by ClassFindModePage(), and Scsi2Atapi().

◆ PageControl

◆ PageMode

◆ ParameterName

◆ ParameterValue

◆ PropertyId

◆ ReadCapacityBuffer

_In_ PREAD_CAPACITY_DATA ReadCapacityBuffer

Definition at line 1102 of file cdrom.h.

Referenced by DiskOpen(), and SetupDriveCapacityTransferPacket().

◆ ReadWriteWorkItemRoutine

EVT_WDF_WORKITEM ReadWriteWorkItemRoutine

Definition at line 1618 of file cdrom.h.

Referenced by DriverEvtDeviceAdd().

◆ Release

◆ Request

_In_ WDFREQUEST Request

Definition at line 1233 of file cdrom.h.

◆ RequestAsynchronousIrpCompletion

IO_COMPLETION_ROUTINE RequestAsynchronousIrpCompletion

Definition at line 1257 of file cdrom.h.

Referenced by DeviceSendIoctlAsynchronously().

◆ RequestDummyCompletionRoutine

EVT_WDF_REQUEST_COMPLETION_ROUTINE RequestDummyCompletionRoutine

Definition at line 1608 of file cdrom.h.

Referenced by RequestProcessInternalDeviceControl().

◆ RequestEvtCleanup

EVT_WDF_OBJECT_CONTEXT_CLEANUP RequestEvtCleanup

Definition at line 906 of file cdrom.h.

Referenced by DriverEvtDeviceAdd().

◆ RequestFormated

_In_ WDFREQUEST _In_ BOOLEAN RequestFormated

Definition at line 1247 of file cdrom.h.

Referenced by _IRQL_requires_max_().

◆ RequestProcessSetPower

EVT_WDFDEVICE_WDM_IRP_PREPROCESS RequestProcessSetPower

Definition at line 910 of file cdrom.h.

Referenced by DriverEvtDeviceAdd().

◆ RequestProcessShutdownFlush

EVT_WDFDEVICE_WDM_IRP_PREPROCESS RequestProcessShutdownFlush

Definition at line 908 of file cdrom.h.

Referenced by DriverEvtDeviceAdd().

◆ SectorsPerSecond

return SectorsPerSecond
Initial value:
{
#define MAXIMUM_RETRY_FOR_SINGLE_IO_IN_100NS_UNITS
Definition: cdromp.h:50
#define C_ASSERT(e)
Definition: intsafe.h:73

Definition at line 1529 of file cdrom.h.

◆ SequentialQueueEvtCanceledOnQueue

EVT_WDF_IO_QUEUE_IO_CANCELED_ON_QUEUE SequentialQueueEvtCanceledOnQueue

Definition at line 902 of file cdrom.h.

Referenced by DriverEvtDeviceAdd().

◆ SequentialQueueEvtIoDeviceControl

EVT_WDF_IO_QUEUE_IO_DEVICE_CONTROL SequentialQueueEvtIoDeviceControl

Definition at line 900 of file cdrom.h.

Referenced by DriverEvtDeviceAdd().

◆ SetIdleTimeout

_In_ BOOLEAN _In_ BOOLEAN SetIdleTimeout

Definition at line 1428 of file cdrom.h.

◆ Srb

Definition at line 989 of file cdrom.h.

Referenced by _IRQL_requires_max_(), _Success_(), AddQueue(), AhciATAPICommand(), AhciCommandCompletionDpcRoutine(), AhciCompleteIssuedSrb(), AhciHwStartIo(), AhciProcessIO(), AhciProcessSrb(), Atapi2Scsi(), AtapiDmaDBPreSync(), AtapiDmaDBSync(), AtapiDmaPioSync(), AtapiDmaSetup(), AtapiDmaStart(), AtapiHwInitializeChanger(), AtapiInquiryCompletion(), AtapiInterrupt__(), AtapiSendCommand(), AtapiStartIo(), AtapiStartIo__(), AtapiVirtToPhysAddr_(), BT958HwStartIO(), BT958WmiSrb(), BuildMechanismStatusSrb(), BuildRequestSenseSrb(), BusLogic_QueueCommand(), BusLogic_SendBusDeviceReset(), ClassDeviceGetLBProvisioningResources(), ClassDeviceHwFirmwareActivateProcess(), ClassDeviceHwFirmwareDownloadProcess(), ClassFreeOrReuseSrb(), ClassGetLBProvisioningLogPage(), ClassGetLBProvisioningResources(), ClassInterpretSenseInfo(), ClasspAccessAlignmentProperty(), ClasspBuildRequestEx(), ClasspConvertToScsiRequestBlock(), ClasspDeviceGetBlockDeviceCharacteristicsVPDPage(), ClasspDeviceGetBlockLimitsVPDPage(), ClasspDeviceGetLBAStatus(), ClasspDeviceGetLBAStatusWorker(), ClasspDeviceGetLBProvisioningVPDPage(), ClasspDeviceLBProvisioningProperty(), ClasspDeviceMediaTypeProperty(), ClasspDeviceSeekPenaltyProperty(), ClasspDeviceTrimProcess(), ClasspDeviceTrimProperty(), ClasspIsThinProvisioningError(), ClasspMcnControl(), ClasspMediaChangeDetectionCompletion(), ClasspPersistentReserve(), ClasspWriteCacheProperty(), ClassReadCapacity16(), ClassSendSrbSynchronous(), CreateStorageRequestBlock(), DbgGetAdditionalSenseCodeQualifierStr(), DbgGetAdditionalSenseCodeStr(), DbgGetScsiOpStr(), DbgGetSenseCodeStr(), DbgGetSrbStatusStr(), DeviceErrorHandlerForHitachiGD2000(), DeviceErrorHandlerForMmc(), DeviceInquiryRequest(), DeviceProcessDsmTrimRequest(), DeviceReportLuns(), DeviceRequestCapacity(), DeviceRequestComplete(), DeviceRequestReadWrite(), DeviceRequestSense(), DiskFdoProcessError(), DiskIoctlVerifyThread(), DiskOpen(), DiskRead(), FdoSendInquiry(), FREE_PORT_ALLOCATED_SENSE_BUFFER(), GetLBAStatus(), GetSrbExtension(), IdeBuildSenseBuffer(), IdeReadWrite(), IdeSendCommand(), IdeSendSmartCommand(), IdeVerify(), InitializeStorageRequestBlock(), InquiryCompletion(), InterpretSenseInfoWithoutHistory(), IsRequestValid(), MapError(), MiniportStartIo(), pInitializeStorageRequestBlock(), PORT_ALLOCATED_SENSE(), PortSendInquiry(), RemoveQueue(), RequestSenseInfoInterpret(), RetryRequest(), Scsi2Atapi(), ScsiFlopProcessError(), ScsiPortDispatchScsi(), ScsiPortGetPhysicalAddress(), ScsiPortNotification(), ScsiPortStartIo(), ScsiPortStartPacket(), SenseInfoInterpret(), SenseInfoInterpretByAdditionalSenseCode(), SenseInfoInterpretBySrbStatus(), SenseInfoInterpretForZPODD(), SenseInfoInterpretRefineByScsiCommand(), SenseInfoLogError(), SpiAdapterControl(), SpiAllocateSrbStructures(), SpiCompleteRequest(), SpiGetNextRequestFromLun(), SpiHandleAttachRelease(), SpiProcessCompletedRequest(), SpiSaveInterruptData(), SpiScanAdapter(), SpiSendRequestSense(), SpiSendSynchronousSrb(), SpiSenseCompletionRoutine(), SrbAssignSrbFlags(), SrbClearSrbFlags(), SrbGetAddress(), SrbGetCdb(), SrbGetCdbLength(), SrbGetDataBuffer(), SrbGetDataTransferLength(), SrbGetLun(), SrbGetMiniportContext(), SrbGetNextSrb(), SrbGetOriginalRequest(), SrbGetPathId(), SrbGetPathTargetLun(), SrbGetPortContext(), SrbGetPrimarySrbExData(), SrbGetQueueTag(), SrbGetRequestAttribute(), SrbGetScsiStatus(), SrbGetSenseInfoBuffer(), SrbGetSenseInfoBufferLength(), SrbGetSrbExDataByIndex(), SrbGetSrbExDataByType(), SrbGetSrbFlags(), SrbGetSrbFunction(), SrbGetSrbLength(), SrbGetSrbStatus(), SrbGetSystemStatus(), SrbGetTargetId(), SrbGetTimeOutValue(), SrbSetCdbLength(), SrbSetDataBuffer(), SrbSetDataTransferLength(), SrbSetNextSrb(), SrbSetOriginalRequest(), SrbSetPortContext(), SrbSetQueueSortKey(), SrbSetQueueTag(), SrbSetRequestAttribute(), SrbSetScsiStatus(), SrbSetSenseInfoBuffer(), SrbSetSenseInfoBufferLength(), SrbSetSrbFlags(), SrbSetSrbLength(), SrbSetSrbStatus(), SrbSetSystemStatus(), SrbSetTimeOutValue(), SrbZeroSrb(), StorPortGetOriginalMdl(), StorPortGetPhysicalAddress(), StorPortGetStartIoPerfParams(), StorPortGetSystemAddress(), StorPortNotification(), UniataAhciBeginTransaction(), UniataAhciEndTransaction(), UniataAhciSendPIOCommand(), UniataAhciSendPIOCommandDirect(), UniataNeedQueueing(), UniataQueueRequest(), UniataRemoveRequest(), USBSTOR_SendInternalCdb(), and USBSTOR_SrbStatusToNtStatus().

◆ SubkeyName

_In_opt_ PWSTR SubkeyName

Definition at line 960 of file cdrom.h.

Referenced by _IRQL_requires_max_(), and EnumDeviceKeys().

◆ TargetString

_In_z_ PCHAR TargetString

Definition at line 953 of file cdrom.h.

Referenced by ClasspMyStringMatches(), ExpCreateSystemRootLink(), and IopReassignSystemRoot().

◆ Usable

_In_ ULONG const Usable

Definition at line 1083 of file cdrom.h.

◆ Use6Byte

Definition at line 1327 of file cdrom.h.

Referenced by ClassFindModePage().

◆ UseGesn

_In_ BOOLEAN UseGesn

Definition at line 1362 of file cdrom.h.

Referenced by ClasspPrepareMcnIrp().

◆ WriteToDevice