ReactOS 0.4.15-dev-5666-gc548b97
classpnp.h File Reference
#include <ntdddisk.h>
#include <ntddcdrm.h>
#include <ntddtape.h>
#include <ntddscsi.h>
#include <ntddstor.h>
#include <stdio.h>
#include <scsi.h>
Include dependency graph for classpnp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _DICTIONARY
 
struct  _CLASSPNP_SCAN_FOR_SPECIAL_INFO
 
struct  _SRB_HISTORY_ITEM
 
struct  _SRB_HISTORY
 
struct  GUIDREGINFO
 
struct  _CLASS_WMI_INFO
 
struct  _CLASS_DEV_INFO
 
struct  _CLASS_INIT_DATA
 
struct  _FILE_OBJECT_EXTENSION
 
struct  _CLASS_WORKING_SET
 
struct  _CLASS_INTERPRET_SENSE_INFO2
 
struct  _CLASS_DRIVER_EXTENSION
 
struct  _COMMON_DEVICE_EXTENSION
 
struct  _PHYSICAL_DEVICE_EXTENSION
 
struct  _CLASS_POWER_OPTIONS
 
struct  _CLASS_POWER_CONTEXT
 
struct  _COMPLETION_CONTEXT
 
struct  _CLASS_QUERY_WMI_REGINFO_EX_LIST
 
struct  _CLASS_VPD_B1_DATA
 
struct  _CLASS_VPD_B0_DATA
 
struct  _CLASS_VPD_B2_DATA
 
struct  _CLASS_READ_CAPACITY16_DATA
 
struct  _CLASS_VPD_ECOP_BLOCK_DEVICE_ROD_LIMITS
 
struct  _CLASS_FUNCTION_SUPPORT_INFO
 
struct  _FUNCTIONAL_DEVICE_EXTENSION
 

Macros

#define _CLASS_
 
#define max(a, b)   (((a) > (b)) ? (a) : (b))
 
#define min(a, b)   (((a) < (b)) ? (a) : (b))
 
#define SRB_CLASS_FLAGS_LOW_PRIORITY   0x10000000
 
#define SRB_CLASS_FLAGS_PERSISTANT   0x20000000
 
#define SRB_CLASS_FLAGS_PAGING   0x40000000
 
#define SRB_CLASS_FLAGS_FREE_MDL   0x80000000
 
#define ASSERT_FDO(x)    ASSERT(((PCOMMON_DEVICE_EXTENSION) (x)->DeviceExtension)->IsFdo)
 
#define ASSERT_PDO(x)    ASSERT(!(((PCOMMON_DEVICE_EXTENSION) (x)->DeviceExtension)->IsFdo))
 
#define IS_CLEANUP_REQUEST(majorFunction)
 
#define DO_MCD(fdoExtension)
 
#define IS_SCSIOP_READ(opCode)
 
#define IS_SCSIOP_WRITE(opCode)
 
#define IS_SCSIOP_READWRITE(opCode)   (IS_SCSIOP_READ(opCode) || IS_SCSIOP_WRITE(opCode))
 
#define ADJUST_FUA_FLAG(fdoExt)
 
#define FREE_POOL(_PoolPtr)
 
#define CLASS_TAG_AUTORUN_DISABLE   'ALcS'
 
#define CLASS_TAG_FILE_OBJECT_EXTENSION   'FLcS'
 
#define CLASS_TAG_MEDIA_CHANGE_DETECTION   'MLcS'
 
#define CLASS_TAG_MOUNT   'mLcS'
 
#define CLASS_TAG_RELEASE_QUEUE   'qLcS'
 
#define CLASS_TAG_POWER   'WLcS'
 
#define CLASS_TAG_WMI   'wLcS'
 
#define CLASS_TAG_FAILURE_PREDICT   'fLcS'
 
#define CLASS_TAG_DEVICE_CONTROL   'OIcS'
 
#define CLASS_TAG_MODE_DATA   'oLcS'
 
#define CLASS_TAG_MULTIPATH   'mPcS'
 
#define CLASS_TAG_LOCK_TRACKING   'TLcS'
 
#define CLASS_TAG_LB_PROVISIONING   'PLcS'
 
#define CLASS_TAG_MANAGE_DATASET   'MDcS'
 
#define MAXIMUM_RETRIES   4
 
#define CLASS_DRIVER_EXTENSION_KEY   ((PVOID) ClassInitialize)
 
#define NO_REMOVE   0
 
#define REMOVE_PENDING   1
 
#define REMOVE_COMPLETE   2
 
#define ClassAcquireRemoveLock(devobj, tag)    ClassAcquireRemoveLockEx(devobj, tag, __FILE__, __LINE__)
 
#define TRY
 
#define LEAVE   goto __tryLabel;
 
#define FINALLY   __tryLabel:
 
#define DebugPrint(x)
 
#define DEBUG_BUFFER_LENGTH   256
 
#define START_UNIT_TIMEOUT   (60 * 4)
 
#define MEDIA_CHANGE_DEFAULT_TIME   1
 
#define MEDIA_CHANGE_TIMEOUT_TIME   300
 
#define ClasspAllocateSrb(ext)
 
#define ClasspFreeSrb(ext, srb)
 
#define SET_FLAG(Flags, Bit)   ((Flags) |= (Bit))
 
#define CLEAR_FLAG(Flags, Bit)   ((Flags) &= ~(Bit))
 
#define TEST_FLAG(Flags, Bit)   (((Flags) & (Bit)) != 0)
 
#define CLASS_WORKING_SET_MAXIMUM   2048
 
#define CLASS_INTERPRET_SENSE_INFO2_MAXIMUM_HISTORY_COUNT   30000
 
#define CLASS_SPECIAL_DISABLE_SPIN_DOWN   0x00000001
 
#define CLASS_SPECIAL_DISABLE_SPIN_UP   0x00000002
 
#define CLASS_SPECIAL_NO_QUEUE_LOCK   0x00000008
 
#define CLASS_SPECIAL_DISABLE_WRITE_CACHE   0x00000010
 
#define CLASS_SPECIAL_CAUSE_NOT_REPORTABLE_HACK   0x00000020
 
#define CLASS_SPECIAL_DISABLE_WRITE_CACHE_NOT_SUPPORTED   0x00000040
 
#define CLASS_SPECIAL_MODIFY_CACHE_UNSUCCESSFUL   0x00000040
 
#define CLASS_SPECIAL_FUA_NOT_SUPPORTED   0x00000080
 
#define CLASS_SPECIAL_VALID_MASK   0x000000FB
 
#define CLASS_SPECIAL_RESERVED   (~CLASS_SPECIAL_VALID_MASK)
 
#define DEV_WRITE_CACHE   0x00000001
 
#define DEV_USE_SCSI1   0x00000002
 
#define DEV_SAFE_START_UNIT   0x00000004
 
#define DEV_NO_12BYTE_CDB   0x00000008
 
#define DEV_POWER_PROTECTED   0x00000010
 
#define DEV_USE_16BYTE_CDB   0x00000020
 
#define GUID_CLASSPNP_QUERY_REGINFOEX   {0x00e34b11, 0x2444, 0x4745, {0xa5, 0x3d, 0x62, 0x01, 0x00, 0xcd, 0x82, 0xf7}}
 
#define GUID_CLASSPNP_SENSEINFO2   {0x509a8c5f, 0x71d7, 0x48f6, {0x82, 0x1e, 0x17, 0x3c, 0x49, 0xbf, 0x2f, 0x18}}
 
#define GUID_CLASSPNP_WORKING_SET   {0x105701b0, 0x9e9b, 0x47cb, {0x97, 0x80, 0x81, 0x19, 0x8a, 0xf7, 0xb5, 0x24}}
 
#define GUID_CLASSPNP_SRB_SUPPORT   {0x0a483941, 0xbdfd, 0x4f7b, {0xbe, 0x95, 0xce, 0xe2, 0xa2, 0x16, 0x09, 0x0c}}
 
#define DEFAULT_FAILURE_PREDICTION_PERIOD   60 * 60 * 1
 
#define MAXIMUM_RETRY_FOR_SINGLE_IO_IN_100NS_UNITS   (0x3b9aca00)
 
#define CLASS_SRB_SCSI_REQUEST_BLOCK   0x1
 
#define CLASS_SRB_STORAGE_REQUEST_BLOCK   0x2
 
#define CLASS_SRBEX_SCSI_CDB16_BUFFER_SIZE   (sizeof(STORAGE_REQUEST_BLOCK) + sizeof(STOR_ADDR_BTL8) + sizeof(SRBEX_DATA_SCSI_CDB16))
 
#define CLASS_SRBEX_NO_SRBEX_DATA_BUFFER_SIZE   (sizeof(STORAGE_REQUEST_BLOCK) + sizeof(STOR_ADDR_BTL8))
 

Typedefs

typedef enum _MEDIA_CHANGE_DETECTION_STATE MEDIA_CHANGE_DETECTION_STATE
 
typedef enum _MEDIA_CHANGE_DETECTION_STATEPMEDIA_CHANGE_DETECTION_STATE
 
typedef enum _CLASS_DEBUG_LEVEL CLASS_DEBUG_LEVEL
 
typedef enum _CLASS_DEBUG_LEVELPCLASS_DEBUG_LEVEL
 
typedef enum FAILURE_PREDICTION_METHODPFAILURE_PREDICTION_METHOD
 
typedef struct _CLASS_INIT_DATA CLASS_INIT_DATA
 
typedef struct _CLASS_INIT_DATAPCLASS_INIT_DATA
 
typedef struct _CLASS_PRIVATE_FDO_DATA CLASS_PRIVATE_FDO_DATA
 
typedef struct _CLASS_PRIVATE_FDO_DATAPCLASS_PRIVATE_FDO_DATA
 
typedef struct _CLASS_PRIVATE_PDO_DATA CLASS_PRIVATE_PDO_DATA
 
typedef struct _CLASS_PRIVATE_PDO_DATA * PCLASS_PRIVATE_PDO_DATA
 
typedef struct _CLASS_PRIVATE_COMMON_DATA CLASS_PRIVATE_COMMON_DATA
 
typedef struct _CLASS_PRIVATE_COMMON_DATAPCLASS_PRIVATE_COMMON_DATA
 
typedef struct _MEDIA_CHANGE_DETECTION_INFO MEDIA_CHANGE_DETECTION_INFO
 
typedef struct _MEDIA_CHANGE_DETECTION_INFOPMEDIA_CHANGE_DETECTION_INFO
 
typedef struct _DICTIONARY_HEADER DICTIONARY_HEADER
 
typedef struct _DICTIONARY_HEADERPDICTIONARY_HEADER
 
typedef struct _DICTIONARY DICTIONARY
 
typedef struct _DICTIONARYPDICTIONARY
 
typedef struct _CLASSPNP_SCAN_FOR_SPECIAL_INFO CLASSPNP_SCAN_FOR_SPECIAL_INFO
 
typedef struct _CLASSPNP_SCAN_FOR_SPECIAL_INFOPCLASSPNP_SCAN_FOR_SPECIAL_INFO
 
typedef NTSTATUS(NTAPIPCLASS_POWER_DEVICE) (_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
 
typedef struct _SRB_HISTORY_ITEM SRB_HISTORY_ITEM
 
typedef struct _SRB_HISTORY_ITEMPSRB_HISTORY_ITEM
 
typedef struct _SRB_HISTORY SRB_HISTORY
 
typedef struct _SRB_HISTORYPSRB_HISTORY
 
typedef struct GUIDREGINFOPGUIDREGINFO
 
typedef struct _CLASS_WMI_INFO CLASS_WMI_INFO
 
typedef struct _CLASS_WMI_INFOPCLASS_WMI_INFO
 
typedef struct _CLASS_DEV_INFO CLASS_DEV_INFO
 
typedef struct _CLASS_DEV_INFOPCLASS_DEV_INFO
 
typedef struct _FILE_OBJECT_EXTENSION FILE_OBJECT_EXTENSION
 
typedef struct _FILE_OBJECT_EXTENSIONPFILE_OBJECT_EXTENSION
 
typedef struct _CLASS_WORKING_SET CLASS_WORKING_SET
 
typedef struct _CLASS_WORKING_SETPCLASS_WORKING_SET
 
typedef struct _CLASS_INTERPRET_SENSE_INFO2 CLASS_INTERPRET_SENSE_INFO2
 
typedef struct _CLASS_INTERPRET_SENSE_INFO2PCLASS_INTERPRET_SENSE_INFO2
 
typedef struct _CLASS_DRIVER_EXTENSION CLASS_DRIVER_EXTENSION
 
typedef struct _CLASS_DRIVER_EXTENSIONPCLASS_DRIVER_EXTENSION
 
typedef struct _COMMON_DEVICE_EXTENSION COMMON_DEVICE_EXTENSION
 
typedef struct _COMMON_DEVICE_EXTENSIONPCOMMON_DEVICE_EXTENSION
 
typedef struct _PHYSICAL_DEVICE_EXTENSION PHYSICAL_DEVICE_EXTENSION
 
typedef struct _PHYSICAL_DEVICE_EXTENSIONPPHYSICAL_DEVICE_EXTENSION
 
typedef struct _CLASS_POWER_OPTIONS CLASS_POWER_OPTIONS
 
typedef struct _CLASS_POWER_OPTIONSPCLASS_POWER_OPTIONS
 
typedef struct _CLASS_POWER_CONTEXT CLASS_POWER_CONTEXT
 
typedef struct _CLASS_POWER_CONTEXTPCLASS_POWER_CONTEXT
 
typedef struct _COMPLETION_CONTEXT COMPLETION_CONTEXT
 
typedef struct _COMPLETION_CONTEXTPCOMPLETION_CONTEXT
 
typedef struct _CLASS_QUERY_WMI_REGINFO_EX_LIST CLASS_QUERY_WMI_REGINFO_EX_LIST
 
typedef struct _CLASS_QUERY_WMI_REGINFO_EX_LISTPCLASS_QUERY_WMI_REGINFO_EX_LIST
 
typedef struct _CLASS_VPD_B1_DATA CLASS_VPD_B1_DATA
 
typedef struct _CLASS_VPD_B1_DATAPCLASS_VPD_B1_DATA
 
typedef struct _CLASS_VPD_B0_DATA CLASS_VPD_B0_DATA
 
typedef struct _CLASS_VPD_B0_DATAPCLASS_VPD_B0_DATA
 
typedef struct _CLASS_VPD_B2_DATA CLASS_VPD_B2_DATA
 
typedef struct _CLASS_VPD_B2_DATAPCLASS_VPD_B2_DATA
 
typedef struct _CLASS_READ_CAPACITY16_DATA CLASS_READ_CAPACITY16_DATA
 
typedef struct _CLASS_READ_CAPACITY16_DATAPCLASS_READ_CAPACITY16_DATA
 
typedef struct _CLASS_VPD_ECOP_BLOCK_DEVICE_ROD_LIMITS CLASS_VPD_ECOP_BLOCK_DEVICE_ROD_LIMITS
 
typedef struct _CLASS_VPD_ECOP_BLOCK_DEVICE_ROD_LIMITSPCLASS_VPD_ECOP_BLOCK_DEVICE_ROD_LIMITS
 
typedef struct _CLASS_FUNCTION_SUPPORT_INFO CLASS_FUNCTION_SUPPORT_INFO
 
typedef struct _CLASS_FUNCTION_SUPPORT_INFOPCLASS_FUNCTION_SUPPORT_INFO
 
typedef struct _FUNCTIONAL_DEVICE_EXTENSION FUNCTIONAL_DEVICE_EXTENSION
 
typedef struct _FUNCTIONAL_DEVICE_EXTENSIONPFUNCTIONAL_DEVICE_EXTENSION
 

Enumerations

enum  _MEDIA_CHANGE_DETECTION_STATE {
  MediaUnknown , MediaPresent , MediaNotPresent , MediaUnavailable ,
  MediaUnknown , MediaPresent , MediaNotPresent , MediaUnavailable
}
 
enum  _CLASS_DEBUG_LEVEL {
  ClassDebugError = 0 , ClassDebugWarning = 1 , ClassDebugTrace = 2 , ClassDebugInfo = 3 ,
  ClassDebugMediaLocks = 8 , ClassDebugMCN = 9 , ClassDebugDelayedRetry = 10 , ClassDebugSenseInfo = 11 ,
  ClassDebugRemoveLock = 12 , ClassDebugExternal4 = 13 , ClassDebugExternal3 = 14 , ClassDebugExternal2 = 15 ,
  ClassDebugExternal1 = 16
}
 
enum  CLASSENABLEDISABLEFUNCTION { EventGeneration , DataBlockCollection }
 
enum  FAILURE_PREDICTION_METHOD { FailurePredictionNone = 0 , FailurePredictionIoctl , FailurePredictionSmart , FailurePredictionSense }
 
enum  CLASS_POWER_DOWN_STATE {
  PowerDownDeviceInitial , PowerDownDeviceLocked , PowerDownDeviceStopped , PowerDownDeviceOff ,
  PowerDownDeviceUnlocked
}
 
enum  CLASS_POWER_DOWN_STATE2 {
  PowerDownDeviceInitial2 , PowerDownDeviceLocked2 , PowerDownDeviceFlushed2 , PowerDownDeviceStopped2 ,
  PowerDownDeviceOff2 , PowerDownDeviceUnlocked2
}
 
enum  CLASS_POWER_DOWN_STATE3 {
  PowerDownDeviceInitial3 = 0 , PowerDownDeviceLocked3 , PowerDownDeviceQuiesced3 , PowerDownDeviceFlushed3 ,
  PowerDownDeviceStopped3 , PowerDownDeviceOff3 , PowerDownDeviceUnlocked3
}
 
enum  CLASS_POWER_UP_STATE {
  PowerUpDeviceInitial , PowerUpDeviceLocked , PowerUpDeviceOn , PowerUpDeviceStarted ,
  PowerUpDeviceUnlocked
}
 
enum  CLASS_FUNCTION_SUPPORT { SupportUnknown = 0 , Supported , NotSupported }
 

Functions

static ULONG CountOfSetBitsUChar (UCHAR _X)
 
static ULONG CountOfSetBitsULong (ULONG _X)
 
static ULONG CountOfSetBitsULong32 (ULONG32 _X)
 
static ULONG CountOfSetBitsULong64 (ULONG64 _X)
 
static ULONG CountOfSetBitsUlongPtr (ULONG_PTR _X)
 
 _IRQL_requires_max_ (DISPATCH_LEVEL) typedef VOID(NTAPI *PCLASS_ERROR)(_In_ PDEVICE_OBJECT DeviceObject
 
 _IRQL_requires_max_ (PASSIVE_LEVEL) typedef NTSTATUS(NTAPI *PCLASS_ADD_DEVICE)(_In_ PDRIVER_OBJECT DriverObject
 Queries information details about a security descriptor.
 
 _IRQL_requires_ (DISPATCH_LEVEL) typedef VOID(NTAPI *PCLASS_TICK)(_In_ PDEVICE_OBJECT DeviceObject)
 
_In_ PIRP _In_ ULONG _In_ ULONG _Out_writes_bytes_ (BufferAvail) PUCHAR Buffer)
 
_In_ PIRP _In_ ULONG _In_ ULONG _In_reads_bytes_ (BufferSize) PUCHAR Buffer)
 
_In_ PIRP _In_ ULONG _In_ ULONG _In_ ULONG _In_ ULONG _In_reads_ (_Inexpressible_(max(InBufferSize, OutBufferSize))) PUCHAR Buffer)
 
_In_opt_ PIRP _In_ PSCSI_REQUEST_BLOCK _In_ UCHAR _In_ ULONG _In_ ULONG _In_opt_ SRB_HISTORY _Out_ NTSTATUS _Out_ _Deref_out_range_ (0, MAXIMUM_RETRY_FOR_SINGLE_IO_IN_100NS_UNITS) LONGLONG *RetryIn100nsUnits)
 
 C_ASSERT ((MAXULONG - sizeof(SRB_HISTORY))/30000 >=sizeof(SRB_HISTORY_ITEM))
 
_In_z_ PCCHAR _In_ PDEVICE_OBJECT _In_ BOOLEAN _Outptr_result_nullonfailure_ _At_DeviceObject (Mem) __drv_aliasesMem) PDEVICE_OBJECT *DeviceObject
 
_Must_inspect_result_ SCSIPORT_API NTSTATUS NTAPI ClassReadDriveCapacity (_In_ PDEVICE_OBJECT DeviceObject)
 
SCSIPORT_API VOID NTAPI ClassReleaseQueue (_In_ PDEVICE_OBJECT DeviceObject)
 
SCSIPORT_API VOID NTAPI ClassSplitRequest (_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp, _In_ ULONG MaximumBytes)
 
SCSIPORT_API NTSTATUS NTAPI ClassDeviceControl (_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp)
 
SCSIPORT_API NTSTATUS NTAPI ClassIoComplete (PDEVICE_OBJECT DeviceObject, PIRP Irp, PVOID Context)
 
SCSIPORT_API NTSTATUS NTAPI ClassIoCompleteAssociated (PDEVICE_OBJECT DeviceObject, PIRP Irp, PVOID Context)
 
SCSIPORT_API BOOLEAN NTAPI ClassInterpretSenseInfo (_In_ PDEVICE_OBJECT DeviceObject, _In_ PSCSI_REQUEST_BLOCK Srb, _In_ UCHAR MajorFunctionCode, _In_ ULONG IoDeviceCode, _In_ ULONG RetryCount, _Out_ NTSTATUS *Status, _Out_opt_ _Deref_out_range_(0, 100) ULONG *RetryInterval)
 
VOID NTAPI ClassSendDeviceIoControlSynchronous (_In_ ULONG IoControlCode, _In_ PDEVICE_OBJECT TargetDeviceObject, _Inout_updates_opt_(_Inexpressible_(max(InputBufferLength, OutputBufferLength))) PVOID Buffer, _In_ ULONG InputBufferLength, _In_ ULONG OutputBufferLength, _In_ BOOLEAN InternalDeviceIoControl, _Out_ PIO_STATUS_BLOCK IoStatus)
 
SCSIPORT_API NTSTATUS NTAPI ClassSendIrpSynchronous (_In_ PDEVICE_OBJECT TargetDeviceObject, _In_ PIRP Irp)
 
SCSIPORT_API NTSTATUS NTAPI ClassForwardIrpSynchronous (_In_ PCOMMON_DEVICE_EXTENSION CommonExtension, _In_ PIRP Irp)
 
SCSIPORT_API NTSTATUS NTAPI ClassSendSrbSynchronous (_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PSCSI_REQUEST_BLOCK Srb, _In_reads_bytes_opt_(BufferLength) PVOID BufferAddress, _In_ ULONG BufferLength, _In_ BOOLEAN WriteToDevice)
 
SCSIPORT_API NTSTATUS NTAPI ClassSendSrbAsynchronous (_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PSCSI_REQUEST_BLOCK Srb, _In_ PIRP Irp, _In_reads_bytes_opt_(BufferLength) __drv_aliasesMem PVOID BufferAddress, _In_ ULONG BufferLength, _In_ BOOLEAN WriteToDevice)
 
SCSIPORT_API NTSTATUS NTAPI ClassBuildRequest (_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
 
SCSIPORT_API ULONG NTAPI ClassModeSense (_In_ PDEVICE_OBJECT DeviceObject, _In_reads_bytes_(Length) PCHAR ModeSenseBuffer, _In_ ULONG Length, _In_ UCHAR PageMode)
 
SCSIPORT_API PVOID NTAPI ClassFindModePage (_In_reads_bytes_(Length) PCHAR ModeSenseBuffer, _In_ ULONG Length, _In_ UCHAR PageMode, _In_ BOOLEAN Use6Byte)
 
SCSIPORT_API NTSTATUS NTAPI ClassInternalIoControl (PDEVICE_OBJECT DeviceObject, PIRP Irp)
 
SCSIPORT_API VOID ClassDebugPrint (_In_ CLASS_DEBUG_LEVEL DebugPrintLevel, _In_z_ PCCHAR DebugMessage,...)
 
SCSIPORT_API VOID NTAPI ClassCompleteRequest (_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp, _In_ CCHAR PriorityBoost)
 
SCSIPORT_API VOID NTAPI ClassReleaseRemoveLock (_In_ PDEVICE_OBJECT DeviceObject, PIRP Tag)
 
SCSIPORT_API ULONG NTAPI ClassAcquireRemoveLockEx (_In_ PDEVICE_OBJECT DeviceObject, PVOID Tag, _In_ PCSTR File, _In_ ULONG Line)
 
_In_ PCHAR _In_ ULONG _In_reads_bytes_opt_ (InquiryDataLength) PINQUIRYDATA InquiryData
 
SCSIPORT_API NTSTATUS NTAPI ClassWmiCompleteRequest (_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp, _In_ NTSTATUS Status, _In_ ULONG BufferUsed, _In_ CCHAR PriorityBoost)
 
_In_ LPGUID _In_ ULONG _In_ ULONG _In_reads_bytes_ (EventDataSize) PVOID EventData)
 
SCSIPORT_API VOID NTAPI ClassResetMediaChangeTimer (_In_ PFUNCTIONAL_DEVICE_EXTENSION FdoExtension)
 
SCSIPORT_API PVPB NTAPI ClassGetVpb (_In_ PDEVICE_OBJECT DeviceObject)
 
SCSIPORT_API NTSTATUS NTAPI ClassSpinDownPowerHandler (_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
 
NTSTATUS NTAPI ClassStopUnitPowerHandler (_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
 
SCSIPORT_API VOID NTAPI ClassReleaseChildLock (_In_ PFUNCTIONAL_DEVICE_EXTENSION FdoExtension)
 
VOID NTAPI ClassSendStartUnit (_In_ PDEVICE_OBJECT DeviceObject)
 
SCSIPORT_API NTSTATUS NTAPI ClassAsynchronousCompletion (PDEVICE_OBJECT DeviceObject, PIRP Irp, PVOID Event)
 
SCSIPORT_API VOID NTAPI ClassCheckMediaState (_In_ PFUNCTIONAL_DEVICE_EXTENSION FdoExtension)
 
SCSIPORT_API NTSTATUS NTAPI ClassCheckVerifyComplete (PDEVICE_OBJECT DeviceObject, PIRP Irp, PVOID Context)
 
_In_ const GUID _In_ ULONG _In_reads_bytes_opt_ (ExtraDataSize) PVOID ExtraData)
 
FORCEINLINE UCHAR GET_FDO_EXTENSON_SENSE_DATA_LENGTH (_In_ PFUNCTIONAL_DEVICE_EXTENSION FdoExtension)
 
static __inline BOOLEAN PORT_ALLOCATED_SENSE (_In_ PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, _In_ PSCSI_REQUEST_BLOCK Srb)
 
static __inline VOID FREE_PORT_ALLOCATED_SENSE_BUFFER (_In_ PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, _In_ PSCSI_REQUEST_BLOCK Srb)
 

Variables

_In_ PSCSI_REQUEST_BLOCK Srb
 
_In_ PSCSI_REQUEST_BLOCK _Out_ NTSTATUSStatus
 
_In_ PSCSI_REQUEST_BLOCK _Out_ NTSTATUS _Inout_ BOOLEANRetry
 
_In_ PDEVICE_OBJECT Pdo
 
_In_ UCHAR Type
 
_In_ PIRP Irp
 
_In_ BUS_QUERY_ID_TYPE IdType
 
_In_ BUS_QUERY_ID_TYPE _In_ PUNICODE_STRING IdString
 
_In_ PDEVICE_CAPABILITIES Capabilities
 
_Out_ ULONGRegFlags
 
_Out_ ULONG _Out_ PUNICODE_STRING Name
 
_Out_ ULONG _Out_ PUNICODE_STRING _Out_ PUNICODE_STRING MofResourceName
 
_In_ PIRP _In_ ULONG GuidIndex
 
_In_ PIRP _In_ ULONG _In_ ULONG BufferAvail
 
_In_ PIRP _In_ ULONG _In_ ULONG BufferSize
 
_In_ PIRP _In_ ULONG _In_ ULONG DataItemId
 
_In_ PIRP _In_ ULONG _In_ ULONG MethodId
 
_In_ PIRP _In_ ULONG _In_ ULONG _In_ ULONG InBufferSize
 
_In_ PIRP _In_ ULONG _In_ ULONG _In_ ULONG _In_ ULONG OutBufferSize
 
_In_ PIRP _In_ ULONG _In_ CLASSENABLEDISABLEFUNCTION Function
 
_In_ PIRP _In_ ULONG _In_ CLASSENABLEDISABLEFUNCTION _In_ BOOLEAN Enable
 
_In_opt_ PIRP OriginalRequest
 
_In_opt_ PIRP _In_ PSCSI_REQUEST_BLOCK _In_ UCHAR MajorFunctionCode
 
_In_opt_ PIRP _In_ PSCSI_REQUEST_BLOCK _In_ UCHAR _In_ ULONG IoDeviceCode
 
_In_opt_ PIRP _In_ PSCSI_REQUEST_BLOCK _In_ UCHAR _In_ ULONG _In_ ULONG PreviousRetryCount
 
_In_opt_ PIRP _In_ PSCSI_REQUEST_BLOCK _In_ UCHAR _In_ ULONG _In_ ULONG _In_opt_ SRB_HISTORYRequestHistory
 
_In_ PVOID Argument2
 
_In_ PVOID _In_ PCLASS_INIT_DATA InitializationData
 
_In_ LPGUID Guid
 
_In_ LPGUID _In_ PVOID Data
 
_In_z_ PCCHAR ObjectNameBuffer
 
_In_z_ PCCHAR _In_ PDEVICE_OBJECT LowerDeviceObject
 
_In_z_ PCCHAR _In_ PDEVICE_OBJECT _In_ BOOLEAN IsFdo
 
_In_ BOOLEAN Release
 
_In_ ULONG NumberElements
 
_In_ PSTORAGE_PROPERTY_ID PropertyId
 
_In_ PSTORAGE_PROPERTY_ID _Outptr_ PVOIDDescriptor
 
_In_ BOOLEAN AcquireChildLock
 
_In_ PCHAR DeviceName
 
_In_ PCHAR _In_ ULONG DeviceNumber
 
_In_ PCHAR _In_ ULONG _In_ ULONG InquiryDataLength
 
_In_ LPGUID _In_ ULONG InstanceIndex
 
_In_ LPGUID _In_ ULONG _In_ ULONG EventDataSize
 
_In_ PUCHAR EventPrefix
 
_In_ BOOLEAN AllowDriveToSleep
 
_In_ FAILURE_PREDICTION_METHOD FailurePredictionMethod
 
_In_ FAILURE_PREDICTION_METHOD _In_ ULONG PollingPeriod
 
_In_ ULONG _In_ BOOLEAN LogError
 
_In_ ULONG _In_ BOOLEAN _In_ ULONG UniqueErrorValue
 
_In_ ULONG _In_ BOOLEAN _In_ ULONG _In_ UCHAR PathId
 
_In_ ULONG _In_ BOOLEAN _In_ ULONG _In_ UCHAR _In_ UCHAR TargetId
 
_In_ ULONG _In_ BOOLEAN _In_ ULONG _In_ UCHAR _In_ UCHAR _In_ UCHAR Lun
 
IO_COMPLETION_ROUTINE ClassSignalCompletion
 
_In_ UCHAR RemoveType
 
_In_ MEDIA_CHANGE_DETECTION_STATE State
 
_In_ MEDIA_CHANGE_DETECTION_STATE _In_ BOOLEAN Wait
 
_In_opt_ PWSTR SubkeyName
 
_In_opt_ PWSTR _In_ PWSTR ParameterName
 
_In_opt_ PWSTR _In_ PWSTR _Inout_ PULONG ParameterValue
 
_In_ PFILE_OBJECT FileObject
 
_In_ const GUID _In_ ULONG ExtraDataSize
 
_In_ CLASSPNP_SCAN_FOR_SPECIAL_INFO DeviceList []
 

Macro Definition Documentation

◆ _CLASS_

#define _CLASS_

Definition at line 4 of file classpnp.h.

◆ ADJUST_FUA_FLAG

#define ADJUST_FUA_FLAG (   fdoExt)
Value:
{ \
if (TEST_FLAG(fdoExt->DeviceFlags, DEV_WRITE_CACHE) && \
!TEST_FLAG(fdoExt->DeviceFlags, DEV_POWER_PROTECTED) && \
!TEST_FLAG(fdoExt->ScanForSpecialFlags, CLASS_SPECIAL_FUA_NOT_SUPPORTED) ) { \
fdoExt->CdbForceUnitAccess = TRUE; \
} else { \
fdoExt->CdbForceUnitAccess = FALSE; \
} \
}
#define CLASS_SPECIAL_FUA_NOT_SUPPORTED
Definition: classpnp.h:174
#define DEV_WRITE_CACHE
Definition: classpnp.h:178
#define DEV_POWER_PROTECTED
Definition: classpnp.h:182
#define TEST_FLAG(Flags, Bit)
Definition: classpnp.h:159
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117

Definition at line 53 of file classpnp.h.

◆ ASSERT_FDO

#define ASSERT_FDO (   x)     ASSERT(((PCOMMON_DEVICE_EXTENSION) (x)->DeviceExtension)->IsFdo)

Definition at line 24 of file classpnp.h.

◆ ASSERT_PDO

#define ASSERT_PDO (   x)     ASSERT(!(((PCOMMON_DEVICE_EXTENSION) (x)->DeviceExtension)->IsFdo))

Definition at line 27 of file classpnp.h.

◆ CLASS_DRIVER_EXTENSION_KEY

#define CLASS_DRIVER_EXTENSION_KEY   ((PVOID) ClassInitialize)

Definition at line 94 of file classpnp.h.

◆ CLASS_INTERPRET_SENSE_INFO2_MAXIMUM_HISTORY_COUNT

#define CLASS_INTERPRET_SENSE_INFO2_MAXIMUM_HISTORY_COUNT   30000

Definition at line 163 of file classpnp.h.

◆ CLASS_SPECIAL_CAUSE_NOT_REPORTABLE_HACK

#define CLASS_SPECIAL_CAUSE_NOT_REPORTABLE_HACK   0x00000020

Definition at line 169 of file classpnp.h.

◆ CLASS_SPECIAL_DISABLE_SPIN_DOWN

#define CLASS_SPECIAL_DISABLE_SPIN_DOWN   0x00000001

Definition at line 165 of file classpnp.h.

◆ CLASS_SPECIAL_DISABLE_SPIN_UP

#define CLASS_SPECIAL_DISABLE_SPIN_UP   0x00000002

Definition at line 166 of file classpnp.h.

◆ CLASS_SPECIAL_DISABLE_WRITE_CACHE

#define CLASS_SPECIAL_DISABLE_WRITE_CACHE   0x00000010

Definition at line 168 of file classpnp.h.

◆ CLASS_SPECIAL_DISABLE_WRITE_CACHE_NOT_SUPPORTED

#define CLASS_SPECIAL_DISABLE_WRITE_CACHE_NOT_SUPPORTED   0x00000040

Definition at line 171 of file classpnp.h.

◆ CLASS_SPECIAL_FUA_NOT_SUPPORTED

#define CLASS_SPECIAL_FUA_NOT_SUPPORTED   0x00000080

Definition at line 174 of file classpnp.h.

◆ CLASS_SPECIAL_MODIFY_CACHE_UNSUCCESSFUL

#define CLASS_SPECIAL_MODIFY_CACHE_UNSUCCESSFUL   0x00000040

Definition at line 173 of file classpnp.h.

◆ CLASS_SPECIAL_NO_QUEUE_LOCK

#define CLASS_SPECIAL_NO_QUEUE_LOCK   0x00000008

Definition at line 167 of file classpnp.h.

◆ CLASS_SPECIAL_RESERVED

#define CLASS_SPECIAL_RESERVED   (~CLASS_SPECIAL_VALID_MASK)

Definition at line 176 of file classpnp.h.

◆ CLASS_SPECIAL_VALID_MASK

#define CLASS_SPECIAL_VALID_MASK   0x000000FB

Definition at line 175 of file classpnp.h.

◆ CLASS_SRB_SCSI_REQUEST_BLOCK

#define CLASS_SRB_SCSI_REQUEST_BLOCK   0x1

Definition at line 572 of file classpnp.h.

◆ CLASS_SRB_STORAGE_REQUEST_BLOCK

#define CLASS_SRB_STORAGE_REQUEST_BLOCK   0x2

Definition at line 573 of file classpnp.h.

◆ CLASS_SRBEX_NO_SRBEX_DATA_BUFFER_SIZE

#define CLASS_SRBEX_NO_SRBEX_DATA_BUFFER_SIZE   (sizeof(STORAGE_REQUEST_BLOCK) + sizeof(STOR_ADDR_BTL8))

Definition at line 696 of file classpnp.h.

◆ CLASS_SRBEX_SCSI_CDB16_BUFFER_SIZE

#define CLASS_SRBEX_SCSI_CDB16_BUFFER_SIZE   (sizeof(STORAGE_REQUEST_BLOCK) + sizeof(STOR_ADDR_BTL8) + sizeof(SRBEX_DATA_SCSI_CDB16))

Definition at line 695 of file classpnp.h.

◆ CLASS_TAG_AUTORUN_DISABLE

#define CLASS_TAG_AUTORUN_DISABLE   'ALcS'

Definition at line 77 of file classpnp.h.

◆ CLASS_TAG_DEVICE_CONTROL

#define CLASS_TAG_DEVICE_CONTROL   'OIcS'

Definition at line 85 of file classpnp.h.

◆ CLASS_TAG_FAILURE_PREDICT

#define CLASS_TAG_FAILURE_PREDICT   'fLcS'

Definition at line 84 of file classpnp.h.

◆ CLASS_TAG_FILE_OBJECT_EXTENSION

#define CLASS_TAG_FILE_OBJECT_EXTENSION   'FLcS'

Definition at line 78 of file classpnp.h.

◆ CLASS_TAG_LB_PROVISIONING

#define CLASS_TAG_LB_PROVISIONING   'PLcS'

Definition at line 89 of file classpnp.h.

◆ CLASS_TAG_LOCK_TRACKING

#define CLASS_TAG_LOCK_TRACKING   'TLcS'

Definition at line 88 of file classpnp.h.

◆ CLASS_TAG_MANAGE_DATASET

#define CLASS_TAG_MANAGE_DATASET   'MDcS'

Definition at line 90 of file classpnp.h.

◆ CLASS_TAG_MEDIA_CHANGE_DETECTION

#define CLASS_TAG_MEDIA_CHANGE_DETECTION   'MLcS'

Definition at line 79 of file classpnp.h.

◆ CLASS_TAG_MODE_DATA

#define CLASS_TAG_MODE_DATA   'oLcS'

Definition at line 86 of file classpnp.h.

◆ CLASS_TAG_MOUNT

#define CLASS_TAG_MOUNT   'mLcS'

Definition at line 80 of file classpnp.h.

◆ CLASS_TAG_MULTIPATH

#define CLASS_TAG_MULTIPATH   'mPcS'

Definition at line 87 of file classpnp.h.

◆ CLASS_TAG_POWER

#define CLASS_TAG_POWER   'WLcS'

Definition at line 82 of file classpnp.h.

◆ CLASS_TAG_RELEASE_QUEUE

#define CLASS_TAG_RELEASE_QUEUE   'qLcS'

Definition at line 81 of file classpnp.h.

◆ CLASS_TAG_WMI

#define CLASS_TAG_WMI   'wLcS'

Definition at line 83 of file classpnp.h.

◆ CLASS_WORKING_SET_MAXIMUM

#define CLASS_WORKING_SET_MAXIMUM   2048

Definition at line 161 of file classpnp.h.

◆ ClassAcquireRemoveLock

#define ClassAcquireRemoveLock (   devobj,
  tag 
)     ClassAcquireRemoveLockEx(devobj, tag, __FILE__, __LINE__)

Definition at line 100 of file classpnp.h.

◆ ClasspAllocateSrb

#define ClasspAllocateSrb (   ext)
Value:
ExAllocateFromNPagedLookasideList( \
&((ext)->CommonExtension.SrbLookasideList))
static const WCHAR *const ext[]
Definition: module.c:53

Definition at line 146 of file classpnp.h.

◆ ClasspFreeSrb

#define ClasspFreeSrb (   ext,
  srb 
)
Value:
ExFreeToNPagedLookasideList( \
&((ext)->CommonExtension.SrbLookasideList), \
(srb))

Definition at line 150 of file classpnp.h.

◆ CLEAR_FLAG

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

Definition at line 158 of file classpnp.h.

◆ DEBUG_BUFFER_LENGTH

#define DEBUG_BUFFER_LENGTH   256

Definition at line 128 of file classpnp.h.

◆ DebugPrint

#define DebugPrint (   x)

Definition at line 125 of file classpnp.h.

◆ DEFAULT_FAILURE_PREDICTION_PERIOD

#define DEFAULT_FAILURE_PREDICTION_PERIOD   60 * 60 * 1

Definition at line 190 of file classpnp.h.

◆ DEV_NO_12BYTE_CDB

#define DEV_NO_12BYTE_CDB   0x00000008

Definition at line 181 of file classpnp.h.

◆ DEV_POWER_PROTECTED

#define DEV_POWER_PROTECTED   0x00000010

Definition at line 182 of file classpnp.h.

◆ DEV_SAFE_START_UNIT

#define DEV_SAFE_START_UNIT   0x00000004

Definition at line 180 of file classpnp.h.

◆ DEV_USE_16BYTE_CDB

#define DEV_USE_16BYTE_CDB   0x00000020

Definition at line 183 of file classpnp.h.

◆ DEV_USE_SCSI1

#define DEV_USE_SCSI1   0x00000002

Definition at line 179 of file classpnp.h.

◆ DEV_WRITE_CACHE

#define DEV_WRITE_CACHE   0x00000001

Definition at line 178 of file classpnp.h.

◆ DO_MCD

#define DO_MCD (   fdoExtension)
Value:
(((fdoExtension)->MediaChangeDetectionInfo != NULL) && \
((fdoExtension)->MediaChangeDetectionInfo->MediaChangeDetectionDisableCount == 0))
#define NULL
Definition: types.h:112

Definition at line 35 of file classpnp.h.

◆ FINALLY

#define FINALLY   __tryLabel:

Definition at line 116 of file classpnp.h.

◆ FREE_POOL

#define FREE_POOL (   _PoolPtr)
Value:
if (_PoolPtr != NULL) { \
ExFreePool(_PoolPtr); \
_PoolPtr = NULL; \
}

Definition at line 63 of file classpnp.h.

◆ GUID_CLASSPNP_QUERY_REGINFOEX

#define GUID_CLASSPNP_QUERY_REGINFOEX   {0x00e34b11, 0x2444, 0x4745, {0xa5, 0x3d, 0x62, 0x01, 0x00, 0xcd, 0x82, 0xf7}}

Definition at line 185 of file classpnp.h.

◆ GUID_CLASSPNP_SENSEINFO2

#define GUID_CLASSPNP_SENSEINFO2   {0x509a8c5f, 0x71d7, 0x48f6, {0x82, 0x1e, 0x17, 0x3c, 0x49, 0xbf, 0x2f, 0x18}}

Definition at line 186 of file classpnp.h.

◆ GUID_CLASSPNP_SRB_SUPPORT

#define GUID_CLASSPNP_SRB_SUPPORT   {0x0a483941, 0xbdfd, 0x4f7b, {0xbe, 0x95, 0xce, 0xe2, 0xa2, 0x16, 0x09, 0x0c}}

Definition at line 188 of file classpnp.h.

◆ GUID_CLASSPNP_WORKING_SET

#define GUID_CLASSPNP_WORKING_SET   {0x105701b0, 0x9e9b, 0x47cb, {0x97, 0x80, 0x81, 0x19, 0x8a, 0xf7, 0xb5, 0x24}}

Definition at line 187 of file classpnp.h.

◆ IS_CLEANUP_REQUEST

#define IS_CLEANUP_REQUEST (   majorFunction)
Value:
UCHAR majorFunction
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
#define IRP_MJ_SHUTDOWN
#define IRP_MJ_CLEANUP

Definition at line 30 of file classpnp.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 39 of file classpnp.h.

◆ IS_SCSIOP_READWRITE

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

Definition at line 51 of file classpnp.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 45 of file classpnp.h.

◆ LEAVE

#define LEAVE   goto __tryLabel;

Definition at line 115 of file classpnp.h.

◆ max

#define max (   a,
  b 
)    (((a) > (b)) ? (a) : (b))

Definition at line 16 of file classpnp.h.

◆ MAXIMUM_RETRIES

#define MAXIMUM_RETRIES   4

Definition at line 92 of file classpnp.h.

◆ MAXIMUM_RETRY_FOR_SINGLE_IO_IN_100NS_UNITS

#define MAXIMUM_RETRY_FOR_SINGLE_IO_IN_100NS_UNITS   (0x3b9aca00)

Definition at line 192 of file classpnp.h.

◆ MEDIA_CHANGE_DEFAULT_TIME

#define MEDIA_CHANGE_DEFAULT_TIME   1

Definition at line 132 of file classpnp.h.

◆ MEDIA_CHANGE_TIMEOUT_TIME

#define MEDIA_CHANGE_TIMEOUT_TIME   300

Definition at line 133 of file classpnp.h.

◆ min

#define min (   a,
  b 
)    (((a) < (b)) ? (a) : (b))

Definition at line 17 of file classpnp.h.

◆ NO_REMOVE

#define NO_REMOVE   0

Definition at line 96 of file classpnp.h.

◆ REMOVE_COMPLETE

#define REMOVE_COMPLETE   2

Definition at line 98 of file classpnp.h.

◆ REMOVE_PENDING

#define REMOVE_PENDING   1

Definition at line 97 of file classpnp.h.

◆ SET_FLAG

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

Definition at line 157 of file classpnp.h.

◆ SRB_CLASS_FLAGS_FREE_MDL

#define SRB_CLASS_FLAGS_FREE_MDL   0x80000000

Definition at line 22 of file classpnp.h.

◆ SRB_CLASS_FLAGS_LOW_PRIORITY

#define SRB_CLASS_FLAGS_LOW_PRIORITY   0x10000000

Definition at line 19 of file classpnp.h.

◆ SRB_CLASS_FLAGS_PAGING

#define SRB_CLASS_FLAGS_PAGING   0x40000000

Definition at line 21 of file classpnp.h.

◆ SRB_CLASS_FLAGS_PERSISTANT

#define SRB_CLASS_FLAGS_PERSISTANT   0x20000000

Definition at line 20 of file classpnp.h.

◆ START_UNIT_TIMEOUT

#define START_UNIT_TIMEOUT   (60 * 4)

Definition at line 130 of file classpnp.h.

◆ TEST_FLAG

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

Definition at line 159 of file classpnp.h.

◆ TRY

#define TRY

Definition at line 114 of file classpnp.h.

Typedef Documentation

◆ CLASS_DEBUG_LEVEL

◆ CLASS_DEV_INFO

◆ CLASS_DRIVER_EXTENSION

◆ CLASS_FUNCTION_SUPPORT_INFO

◆ CLASS_INIT_DATA

Definition at line 276 of file classpnp.h.

◆ CLASS_INTERPRET_SENSE_INFO2

◆ CLASS_POWER_CONTEXT

◆ CLASS_POWER_OPTIONS

◆ CLASS_PRIVATE_COMMON_DATA

◆ CLASS_PRIVATE_FDO_DATA

◆ CLASS_PRIVATE_PDO_DATA

typedef struct _CLASS_PRIVATE_PDO_DATA CLASS_PRIVATE_PDO_DATA

Definition at line 282 of file classpnp.h.

◆ CLASS_QUERY_WMI_REGINFO_EX_LIST

◆ CLASS_READ_CAPACITY16_DATA

◆ CLASS_VPD_B0_DATA

◆ CLASS_VPD_B1_DATA

◆ CLASS_VPD_B2_DATA

◆ CLASS_VPD_ECOP_BLOCK_DEVICE_ROD_LIMITS

◆ CLASS_WMI_INFO

◆ CLASS_WORKING_SET

◆ CLASSPNP_SCAN_FOR_SPECIAL_INFO

◆ COMMON_DEVICE_EXTENSION

◆ COMPLETION_CONTEXT

◆ DICTIONARY

◆ DICTIONARY_HEADER

Definition at line 291 of file classpnp.h.

◆ FILE_OBJECT_EXTENSION

◆ FUNCTIONAL_DEVICE_EXTENSION

◆ MEDIA_CHANGE_DETECTION_INFO

◆ MEDIA_CHANGE_DETECTION_STATE

◆ PCLASS_DEBUG_LEVEL

◆ PCLASS_DEV_INFO

◆ PCLASS_DRIVER_EXTENSION

◆ PCLASS_FUNCTION_SUPPORT_INFO

◆ PCLASS_INIT_DATA

Definition at line 276 of file classpnp.h.

◆ PCLASS_INTERPRET_SENSE_INFO2

◆ PCLASS_POWER_CONTEXT

◆ PCLASS_POWER_DEVICE

typedef NTSTATUS(NTAPI * PCLASS_POWER_DEVICE) (_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)

Definition at line 320 of file classpnp.h.

◆ PCLASS_POWER_OPTIONS

◆ PCLASS_PRIVATE_COMMON_DATA

◆ PCLASS_PRIVATE_FDO_DATA

Definition at line 279 of file classpnp.h.

◆ PCLASS_PRIVATE_PDO_DATA

typedef struct _CLASS_PRIVATE_PDO_DATA * PCLASS_PRIVATE_PDO_DATA

Definition at line 282 of file classpnp.h.

◆ PCLASS_QUERY_WMI_REGINFO_EX_LIST

◆ PCLASS_READ_CAPACITY16_DATA

◆ PCLASS_VPD_B0_DATA

◆ PCLASS_VPD_B1_DATA

◆ PCLASS_VPD_B2_DATA

◆ PCLASS_VPD_ECOP_BLOCK_DEVICE_ROD_LIMITS

◆ PCLASS_WMI_INFO

◆ PCLASS_WORKING_SET

◆ PCLASSPNP_SCAN_FOR_SPECIAL_INFO

◆ PCOMMON_DEVICE_EXTENSION

◆ PCOMPLETION_CONTEXT

◆ PDICTIONARY

◆ PDICTIONARY_HEADER

Definition at line 291 of file classpnp.h.

◆ PFAILURE_PREDICTION_METHOD

◆ PFILE_OBJECT_EXTENSION

◆ PFUNCTIONAL_DEVICE_EXTENSION

◆ PGUIDREGINFO

◆ PHYSICAL_DEVICE_EXTENSION

◆ PMEDIA_CHANGE_DETECTION_INFO

◆ PMEDIA_CHANGE_DETECTION_STATE

◆ PPHYSICAL_DEVICE_EXTENSION

◆ PSRB_HISTORY

◆ PSRB_HISTORY_ITEM

◆ SRB_HISTORY

◆ SRB_HISTORY_ITEM

Enumeration Type Documentation

◆ _CLASS_DEBUG_LEVEL

Enumerator
ClassDebugError 
ClassDebugWarning 
ClassDebugTrace 
ClassDebugInfo 
ClassDebugMediaLocks 
ClassDebugMCN 
ClassDebugDelayedRetry 
ClassDebugSenseInfo 
ClassDebugRemoveLock 
ClassDebugExternal4 
ClassDebugExternal3 
ClassDebugExternal2 
ClassDebugExternal1 

Definition at line 212 of file classpnp.h.

212 {
213 ClassDebugError = 0,
215 ClassDebugTrace = 2,
216 ClassDebugInfo = 3,
218 ClassDebugMCN = 9,
enum _CLASS_DEBUG_LEVEL CLASS_DEBUG_LEVEL
enum _CLASS_DEBUG_LEVEL * PCLASS_DEBUG_LEVEL
@ ClassDebugExternal4
Definition: classpnp.h:222
@ ClassDebugDelayedRetry
Definition: classpnp.h:219
@ ClassDebugMediaLocks
Definition: classpnp.h:217
@ ClassDebugWarning
Definition: classpnp.h:214
@ ClassDebugExternal3
Definition: classpnp.h:223
@ ClassDebugSenseInfo
Definition: classpnp.h:220
@ ClassDebugExternal2
Definition: classpnp.h:224
@ ClassDebugMCN
Definition: classpnp.h:218
@ ClassDebugTrace
Definition: classpnp.h:215
@ ClassDebugInfo
Definition: classpnp.h:216
@ ClassDebugError
Definition: classpnp.h:213
@ ClassDebugRemoveLock
Definition: classpnp.h:221
@ ClassDebugExternal1
Definition: classpnp.h:225

◆ _MEDIA_CHANGE_DETECTION_STATE

Enumerator
MediaUnknown 
MediaPresent 
MediaNotPresent 
MediaUnavailable 
MediaUnknown 
MediaPresent 
MediaNotPresent 
MediaUnavailable 

Definition at line 205 of file classpnp.h.

205 {
enum _MEDIA_CHANGE_DETECTION_STATE * PMEDIA_CHANGE_DETECTION_STATE
@ MediaUnknown
Definition: classpnp.h:206
@ MediaPresent
Definition: classpnp.h:207
@ MediaNotPresent
Definition: classpnp.h:208
@ MediaUnavailable
Definition: classpnp.h:209
enum _MEDIA_CHANGE_DETECTION_STATE MEDIA_CHANGE_DETECTION_STATE

◆ CLASS_FUNCTION_SUPPORT

Enumerator
SupportUnknown 
Supported 
NotSupported 

Definition at line 730 of file classpnp.h.

731{
732 SupportUnknown = 0,
733 Supported,
CLASS_FUNCTION_SUPPORT
Definition: classpnp.h:731
@ Supported
Definition: classpnp.h:733
@ SupportUnknown
Definition: classpnp.h:732
@ NotSupported
Definition: classpnp.h:734

◆ CLASS_POWER_DOWN_STATE

Enumerator
PowerDownDeviceInitial 
PowerDownDeviceLocked 
PowerDownDeviceStopped 
PowerDownDeviceOff 
PowerDownDeviceUnlocked 

Definition at line 240 of file classpnp.h.

240 {
CLASS_POWER_DOWN_STATE
Definition: classpnp.h:240
@ PowerDownDeviceUnlocked
Definition: classpnp.h:245
@ PowerDownDeviceStopped
Definition: classpnp.h:243
@ PowerDownDeviceOff
Definition: classpnp.h:244
@ PowerDownDeviceInitial
Definition: classpnp.h:241
@ PowerDownDeviceLocked
Definition: classpnp.h:242

◆ CLASS_POWER_DOWN_STATE2

Enumerator
PowerDownDeviceInitial2 
PowerDownDeviceLocked2 
PowerDownDeviceFlushed2 
PowerDownDeviceStopped2 
PowerDownDeviceOff2 
PowerDownDeviceUnlocked2 

Definition at line 248 of file classpnp.h.

248 {
CLASS_POWER_DOWN_STATE2
Definition: classpnp.h:248
@ PowerDownDeviceStopped2
Definition: classpnp.h:252
@ PowerDownDeviceOff2
Definition: classpnp.h:253
@ PowerDownDeviceLocked2
Definition: classpnp.h:250
@ PowerDownDeviceFlushed2
Definition: classpnp.h:251
@ PowerDownDeviceInitial2
Definition: classpnp.h:249
@ PowerDownDeviceUnlocked2
Definition: classpnp.h:254

◆ CLASS_POWER_DOWN_STATE3

Enumerator
PowerDownDeviceInitial3 
PowerDownDeviceLocked3 
PowerDownDeviceQuiesced3 
PowerDownDeviceFlushed3 
PowerDownDeviceStopped3 
PowerDownDeviceOff3 
PowerDownDeviceUnlocked3 

Definition at line 257 of file classpnp.h.

257 {
CLASS_POWER_DOWN_STATE3
Definition: classpnp.h:257
@ PowerDownDeviceUnlocked3
Definition: classpnp.h:264
@ PowerDownDeviceOff3
Definition: classpnp.h:263
@ PowerDownDeviceFlushed3
Definition: classpnp.h:261
@ PowerDownDeviceLocked3
Definition: classpnp.h:259
@ PowerDownDeviceInitial3
Definition: classpnp.h:258
@ PowerDownDeviceStopped3
Definition: classpnp.h:262
@ PowerDownDeviceQuiesced3
Definition: classpnp.h:260

◆ CLASS_POWER_UP_STATE

Enumerator
PowerUpDeviceInitial 
PowerUpDeviceLocked 
PowerUpDeviceOn 
PowerUpDeviceStarted 
PowerUpDeviceUnlocked 

Definition at line 267 of file classpnp.h.

267 {
CLASS_POWER_UP_STATE
Definition: classpnp.h:267
@ PowerUpDeviceOn
Definition: classpnp.h:270
@ PowerUpDeviceUnlocked
Definition: classpnp.h:272
@ PowerUpDeviceStarted
Definition: classpnp.h:271
@ PowerUpDeviceInitial
Definition: classpnp.h:268
@ PowerUpDeviceLocked
Definition: classpnp.h:269

◆ CLASSENABLEDISABLEFUNCTION

Enumerator
EventGeneration 
DataBlockCollection 

Definition at line 228 of file classpnp.h.

228 {
CLASSENABLEDISABLEFUNCTION
Definition: classpnp.h:228
@ DataBlockCollection
Definition: classpnp.h:230
@ EventGeneration
Definition: classpnp.h:229

◆ FAILURE_PREDICTION_METHOD

Enumerator
FailurePredictionNone 
FailurePredictionIoctl 
FailurePredictionSmart 
FailurePredictionSense 

Definition at line 233 of file classpnp.h.

233 {
enum FAILURE_PREDICTION_METHOD * PFAILURE_PREDICTION_METHOD
FAILURE_PREDICTION_METHOD
Definition: classpnp.h:233
@ FailurePredictionSense
Definition: classpnp.h:237
@ FailurePredictionSmart
Definition: classpnp.h:236
@ FailurePredictionNone
Definition: classpnp.h:234
@ FailurePredictionIoctl
Definition: classpnp.h:235

Function Documentation

◆ _Deref_out_range_()

◆ _In_reads_()

_In_ PIRP _In_ ULONG _In_ ULONG _In_ ULONG _In_ ULONG _In_reads_ ( _Inexpressible_(max(InBufferSize, OutBufferSize))  )

◆ _In_reads_bytes_() [1/2]

_In_ PIRP _In_ ULONG _In_ ULONG _In_reads_bytes_ ( BufferSize  )

◆ _In_reads_bytes_() [2/2]

_In_ LPGUID _In_ ULONG _In_ ULONG _In_reads_bytes_ ( EventDataSize  )

◆ _In_reads_bytes_opt_() [1/2]

_In_ const GUID _In_ ULONG _In_reads_bytes_opt_ ( ExtraDataSize  )

◆ _In_reads_bytes_opt_() [2/2]

_In_ PCHAR _In_ ULONG _In_reads_bytes_opt_ ( InquiryDataLength  )

◆ _IRQL_requires_()

_IRQL_requires_ ( DISPATCH_LEVEL  )

Definition at line 1456 of file expool.c.

1462{
1463 SIZE_T OldSize = PoolBigPageTableSize;
1464 SIZE_T NewSize, NewSizeInBytes;
1465 PPOOL_TRACKER_BIG_PAGES NewTable;
1466 PPOOL_TRACKER_BIG_PAGES OldTable;
1467 ULONG i;
1468 ULONG PagesFreed;
1469 ULONG Hash;
1470 ULONG HashMask;
1471
1472 /* Must be holding ExpLargePoolTableLock */
1474
1475 /* Make sure we don't overflow */
1476 if (Shrink)
1477 {
1478 NewSize = OldSize / 2;
1479
1480 /* Make sure we don't shrink too much. */
1482
1484 ASSERT(NewSize <= OldSize);
1485
1486 /* If there is only one page left, then keep it around. Not a failure either. */
1487 if (NewSize == OldSize)
1488 {
1491 return TRUE;
1492 }
1493 }
1494 else
1495 {
1496 if (!NT_SUCCESS(RtlSIZETMult(2, OldSize, &NewSize)))
1497 {
1498 DPRINT1("Overflow expanding big page table. Size=%lu\n", OldSize);
1500 return FALSE;
1501 }
1502
1503 /* Make sure we don't stupidly waste pages */
1505 ASSERT(NewSize > OldSize);
1506 }
1507
1508 if (!NT_SUCCESS(RtlSIZETMult(sizeof(POOL_TRACKER_BIG_PAGES), NewSize, &NewSizeInBytes)))
1509 {
1510 DPRINT1("Overflow while calculating big page table size. Size=%lu\n", OldSize);
1512 return FALSE;
1513 }
1514
1515 NewTable = MiAllocatePoolPages(NonPagedPool, NewSizeInBytes);
1516 if (NewTable == NULL)
1517 {
1518 DPRINT("Could not allocate %lu bytes for new big page table\n", NewSizeInBytes);
1520 return FALSE;
1521 }
1522
1523 DPRINT("%s big pool tracker table to %lu entries\n", Shrink ? "Shrinking" : "Expanding", NewSize);
1524
1525 /* Initialize the new table */
1526 RtlZeroMemory(NewTable, NewSizeInBytes);
1527 for (i = 0; i < NewSize; i++)
1528 {
1529 NewTable[i].Va = (PVOID)POOL_BIG_TABLE_ENTRY_FREE;
1530 }
1531
1532 /* Copy over all items */
1533 OldTable = PoolBigPageTable;
1534 HashMask = NewSize - 1;
1535 for (i = 0; i < OldSize; i++)
1536 {
1537 /* Skip over empty items */
1538 if ((ULONG_PTR)OldTable[i].Va & POOL_BIG_TABLE_ENTRY_FREE)
1539 {
1540 continue;
1541 }
1542
1543 /* Recalculate the hash due to the new table size */
1544 Hash = ExpComputePartialHashForAddress(OldTable[i].Va) % HashMask;
1545
1546 /* Find the location in the new table */
1547 while (!((ULONG_PTR)NewTable[Hash].Va & POOL_BIG_TABLE_ENTRY_FREE))
1548 {
1549 if (++Hash == NewSize)
1550 Hash = 0;
1551 }
1552
1553 /* We must have space */
1555
1556 /* Finally, copy the item */
1557 NewTable[Hash] = OldTable[i];
1558 }
1559
1560 /* Activate the new table */
1561 PoolBigPageTable = NewTable;
1564
1565 /* Release the lock, we're done changing global state */
1567
1568 /* Free the old table and update our tracker */
1569 PagesFreed = MiFreePoolPages(OldTable);
1570 ExpRemovePoolTracker('looP', PagesFreed << PAGE_SHIFT, 0);
1571 ExpInsertPoolTracker('looP', ALIGN_UP_BY(NewSizeInBytes, PAGE_SIZE), 0);
1572
1573 return TRUE;
1574}
#define ALIGN_DOWN_BY(size, align)
#define ALIGN_UP_BY(size, align)
#define DPRINT1
Definition: precomp.h:8
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static int Hash(const char *)
Definition: reader.c:2257
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
#define PAGE_SIZE
Definition: env_spec_w32.h:49
#define PAGE_SHIFT
Definition: env_spec_w32.h:45
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
#define NonPagedPool
Definition: env_spec_w32.h:307
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
ULONG ExpPoolBigEntriesInUse
Definition: expool.c:55
VOID NTAPI ExpRemovePoolTracker(IN ULONG Key, IN SIZE_T NumberOfBytes, IN POOL_TYPE PoolType)
Definition: expool.c:756
SIZE_T PoolBigPageTableSize
Definition: expool.c:47
FORCEINLINE ULONG ExpComputePartialHashForAddress(IN PVOID BaseAddress)
Definition: expool.c:457
PPOOL_TRACKER_BIG_PAGES PoolBigPageTable
Definition: expool.c:50
#define POOL_BIG_TABLE_ENTRY_FREE
Definition: expool.c:23
KSPIN_LOCK ExpLargePoolTableLock
Definition: expool.c:54
VOID NTAPI ExpInsertPoolTracker(IN ULONG Key, IN SIZE_T NumberOfBytes, IN POOL_TYPE PoolType)
Definition: expool.c:847
SIZE_T PoolBigPageTableHash
Definition: expool.c:47
_Must_inspect_result_ _In_ USHORT NewSize
Definition: fltkernel.h:975
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
void * PVOID
Definition: retypes.h:9
unsigned int ULONG
Definition: retypes.h:1
#define ASSERT(a)
Definition: mode.c:44
PVOID NTAPI MiAllocatePoolPages(IN POOL_TYPE PoolType, IN SIZE_T SizeInBytes)
Definition: pool.c:422
ULONG NTAPI MiFreePoolPages(IN PVOID StartingAddress)
Definition: pool.c:918
#define DPRINT
Definition: sndvol32.h:71
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG_PTR
Definition: typedefs.h:65
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:792

◆ _IRQL_requires_max_() [1/2]

_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_() [2/2]

_IRQL_requires_max_ ( PASSIVE_LEVEL  )

Queries information details about a security descriptor.

Computes the quota size of a security descriptor.

Assigns a security descriptor for a new object.

An extended function that assigns a security descriptor for a new object.

Frees a security descriptor.

An extended function that sets new information data to a security descriptor.

Modifies some information data about a security descriptor.

Parameters
[in]SecurityInformationSecurity information details to be queried from a security descriptor.
[out]SecurityDescriptorThe returned security descriptor with security information data.
[in,out]LengthThe returned length of a security descriptor.
[in,out]ObjectsSecurityDescriptorThe returned object security descriptor.
Returns
Returns STATUS_SUCCESS if the operations have been completed successfully and that the specific information about the security descriptor has been queried. STATUS_BUFFER_TOO_SMALL is returned if the buffer size is too small to contain the queried info about the security descriptor.
Parameters
[in]ObjectIf specified, the function will use this arbitrary object that points to an object security descriptor.
[in]SecurityInformationSecurity information details to be set.
[in]SecurityDescriptorA security descriptor where its info is to be changed.
[in,out]ObjectsSecurityDescriptorThe returned pointer to security descriptor objects.
[in]PoolTypePool type for the new security descriptor to allocate.
[in]GenericMappingThe generic mapping of access rights masks.
Returns
See SeSetSecurityDescriptorInfoEx.
Parameters
[in]ObjectIf specified, the function will use this arbitrary object that points to an object security descriptor.
[in]SecurityInformationSecurity information details to be set.
[in]SecurityDescriptorA security descriptor where its info is to be changed.
[in,out]ObjectsSecurityDescriptorThe returned pointer to security descriptor objects.
[in]AutoInheritFlagsFlags bitmask inheritation, influencing how the security descriptor can be inherited and if it can be in the first place.
[in]PoolTypePool type for the new security descriptor to allocate.
[in]GenericMappingThe generic mapping of access rights masks.
Returns
Returns STATUS_SUCCESS if the operations have been completed without problems and that new info has been set to the security descriptor. STATUS_NO_SECURITY_ON_OBJECT is returned if the object does not have a security descriptor. STATUS_INSUFFICIENT_RESOURCES is returned if memory pool allocation for the new security descriptor with new info set has failed.
Parameters
[in]SecurityDescriptorA security descriptor to be freed from memory.
Returns
Returns STATUS_SUCCESS.
Parameters
[in]_ParentDescriptorA security descriptor of the parent object that is being created.
[in]_ExplicitDescriptorAn explicit security descriptor that is applied to a new object.
[out]NewDescriptorThe new allocated security descriptor.
[in]ObjectTypeThe type of the new object.
[in]IsDirectoryObjectSet this to TRUE if the newly created object is a directory object, otherwise set this to FALSE.
[in]AutoInheritFlagsAutomatic inheritance flags that influence how access control entries within ACLs from security descriptors are inherited.
[in]SubjectContextSecurity subject context of the new object.
[in]GenericMappingGeneric mapping of access mask rights.
[in]PoolTypeThis parameter is unused.
Returns
Returns STATUS_SUCCESS if the operations have been completed successfully and that the security descriptor has been assigned to the new object. STATUS_NO_TOKEN is returned if the caller hasn't supplied a valid argument to a security subject context. STATUS_INVALID_OWNER is returned if the caller hasn't supplied a parent descriptor that belongs to the main user (owner). STATUS_INVALID_PRIMARY_GROUP is returned by the same reason as with the previous NTSTATUS code. The two NTSTATUS codes are returned if the calling thread stated that the owner and/or group is defaulted to the parent descriptor (SEF_DEFAULT_OWNER_FROM_PARENT and/or SEF_DEFAULT_GROUP_FROM_PARENT respectively). STATUS_INSUFFICIENT_RESOURCES is returned if memory pool allocation for the descriptor buffer has failed. A failure NTSTATUS is returned otherwise.
Parameters
[in]ParentDescriptorA security descriptor of the parent object that is being created.
[in]ExplicitDescriptorAn explicit security descriptor that is applied to a new object.
[out]NewDescriptorThe new allocated security descriptor.
[in]IsDirectoryObjectSet this to TRUE if the newly created object is a directory object, otherwise set this to FALSE.
[in]SubjectContextSecurity subject context of the new object.
[in]GenericMappingGeneric mapping of access mask rights.
[in]PoolTypeThis parameter is unused.
Returns
See SeAssignSecurityEx.
Parameters
[in]SecurityDescriptorA security descriptor.
[out]QuotaInfoSizeThe returned quota size of the given security descriptor to the caller. The function may return 0 to this parameter if the descriptor doesn't have a group or a discretionary access control list (DACL) even.
Returns
Returns STATUS_SUCCESS if the quota size of a security descriptor has been computed successfully. STATUS_UNKNOWN_REVISION is returned if the security descriptor has an invalid revision.

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
LONG NTSTATUS
Definition: precomp.h:26
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
#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
Status
Definition: gdiplustypes.h:25
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:951
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 STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135

◆ _Out_writes_bytes_()

_In_ PIRP _In_ ULONG _In_ ULONG _Out_writes_bytes_ ( BufferAvail  )

◆ C_ASSERT()

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

◆ ClassAcquireRemoveLockEx()

SCSIPORT_API ULONG NTAPI ClassAcquireRemoveLockEx ( _In_ PDEVICE_OBJECT  DeviceObject,
PVOID  Tag,
_In_ PCSTR  File,
_In_ ULONG  Line 
)

◆ ClassAsynchronousCompletion()

SCSIPORT_API NTSTATUS NTAPI ClassAsynchronousCompletion ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp,
PVOID  Event 
)

Definition at line 3246 of file class.c.

3251{
3254 ULONG srbFunction;
3255 ULONG srbFlags;
3256
3257 if (context == NULL) {
3259 }
3260
3261 if (DeviceObject == NULL) {
3262
3263 DeviceObject = context->DeviceObject;
3264 }
3265
3266 srb = &context->Srb.Srb;
3267
3269 srbFunction = ((PSTORAGE_REQUEST_BLOCK)srb)->SrbFunction;
3270 srbFlags = ((PSTORAGE_REQUEST_BLOCK)srb)->SrbFlags;
3271 } else {
3272 srbFunction = srb->Function;
3273 srbFlags = srb->SrbFlags;
3274 }
3275
3276 //
3277 // If this is an execute srb, then check the return status and make sure.
3278 // the queue is not frozen.
3279 //
3280
3281 if (srbFunction == SRB_FUNCTION_EXECUTE_SCSI) {
3282
3283 //
3284 // Check for a frozen queue.
3285 //
3286
3288
3289 //
3290 // Unfreeze the queue getting the device object from the context.
3291 //
3292
3293 ClassReleaseQueue(context->DeviceObject);
3294 }
3295 }
3296
3297 { // free port-allocated sense buffer if we can detect
3298
3299 if (((PCOMMON_DEVICE_EXTENSION)(DeviceObject->DeviceExtension))->IsFdo) {
3300
3301 PFUNCTIONAL_DEVICE_EXTENSION fdoExtension = DeviceObject->DeviceExtension;
3302 if (PORT_ALLOCATED_SENSE(fdoExtension, srb)) {
3303 FREE_PORT_ALLOCATED_SENSE_BUFFER(fdoExtension, srb);
3304 }
3305
3306 } else {
3307
3309
3310 }
3311 }
3312
3313
3314 //
3315 // Free the context and the Irp.
3316 //
3317
3318 if (Irp->MdlAddress != NULL) {
3319 MmUnlockPages(Irp->MdlAddress);
3320 IoFreeMdl(Irp->MdlAddress);
3321
3322 Irp->MdlAddress = NULL;
3323 }
3324
3326
3328
3329 IoFreeIrp(Irp);
3330
3331 //
3332 // Indicate the I/O system should stop processing the Irp completion.
3333 //
3334
3336
3337} // end ClassAsynchronousCompletion()
FORCEINLINE BOOLEAN PORT_ALLOCATED_SENSE(_In_ PCDROM_DEVICE_EXTENSION DeviceExtension, _In_ PSCSI_REQUEST_BLOCK Srb)
Definition: cdrom.h:826
#define FREE_POOL(_PoolPtr)
Definition: cdrom.h:782
FORCEINLINE VOID FREE_PORT_ALLOCATED_SENSE_BUFFER(_In_ PCDROM_DEVICE_EXTENSION DeviceExtension, _In_ PSCSI_REQUEST_BLOCK Srb)
Definition: cdrom.h:839
#define TEST_FLAG(Flags, Bit)
Definition: cdrom.h:1495
_In_ PIRP Irp
Definition: csq.h:116
VOID NTAPI ClassReleaseQueue(_In_ PDEVICE_OBJECT Fdo)
Definition: class.c:11589
VOID NTAPI ClassReleaseRemoveLock(_In_ PDEVICE_OBJECT DeviceObject, _In_opt_ PIRP Tag)
Definition: lock.c:251
#define SRB_FLAGS_FREE_SENSE_BUFFER
Definition: srb.h:406
#define SRB_FUNCTION_EXECUTE_SCSI
Definition: srb.h:315
#define SRB_STATUS_QUEUE_FROZEN
Definition: srb.h:386
#define IoFreeMdl
Definition: fxmdl.h:89
VOID NTAPI MmUnlockPages(IN PMDL Mdl)
Definition: mdlsup.c:1435
VOID NTAPI IoFreeIrp(IN PIRP Irp)
Definition: irp.c:1666
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
Definition: srb.h:99
* PSTORAGE_REQUEST_BLOCK
Definition: srb.h:652
#define STATUS_MORE_PROCESSING_REQUIRED
Definition: shellext.h:68
UCHAR Function
Definition: srb.h:250
ULONG SrbFlags
Definition: srb.h:260
UCHAR SrbStatus
Definition: srb.h:251
Definition: http.c:7252
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define NT_ASSERT
Definition: rtlfuncs.h:3310

Referenced by ClassSendStartUnit(), ResetBus(), and ScsiFlopProcessError().

◆ ClassBuildRequest()

SCSIPORT_API NTSTATUS NTAPI ClassBuildRequest ( _In_ PDEVICE_OBJECT  DeviceObject,
_In_ PIRP  Irp 
)

Definition at line 505 of file obsolete.c.

509{
510 PFUNCTIONAL_DEVICE_EXTENSION fdoExtension = Fdo->DeviceExtension;
511
513
514 // This function is obsolete, but still called by CDROM.SYS .
515 // TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_GENERAL, "ClassBuildRequest is OBSOLETE !"));
516
517 //
518 // Allocate an Srb.
519 //
520
521 srb = ClasspAllocateSrb(fdoExtension);
522
523 if (srb == NULL) {
525 }
526
527 ClasspBuildRequestEx(fdoExtension, Irp, srb);
528 return STATUS_SUCCESS;
529
530} // end ClassBuildRequest()
#define ClasspAllocateSrb(ext)
Definition: classpnp.h:146
VOID ClasspBuildRequestEx(_In_ PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, _In_ PIRP Irp, _In_ __drv_aliasesMem PSCSI_REQUEST_BLOCK Srb)
Definition: obsolete.c:537
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_Must_inspect_result_ _In_ WDFDEVICE Fdo
Definition: wdffdo.h:461

◆ ClassCheckMediaState()

SCSIPORT_API VOID NTAPI ClassCheckMediaState ( _In_ PFUNCTIONAL_DEVICE_EXTENSION  FdoExtension)

Definition at line 1752 of file autorun.c.

1755{
1756 PMEDIA_CHANGE_DETECTION_INFO info = FdoExtension->MediaChangeDetectionInfo;
1757 LONG countDown;
1758
1759 if(info == NULL) {
1760 TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_MCN,
1761 "ClassCheckMediaState: detection not enabled\n"));
1762 return;
1763 }
1764
1765 //
1766 // Media change support is active and the IRP is waiting. Decrement the
1767 // timer. There is no MP protection on the timer counter. This code
1768 // is the only code that will manipulate the timer counter and only one
1769 // instance of it should be running at any given time.
1770 //
1771
1772 countDown = InterlockedDecrement(&(info->MediaChangeCountDown));
1773
1774 //
1775 // Try to acquire the media change event. If we can't do it immediately
1776 // then bail out and assume the caller will try again later.
1777 //
1779 info,
1780 countDown);
1781
1782 return;
1783} // end ClassCheckMediaState()
#define InterlockedDecrement
Definition: armddk.h:52
VOID ClasspSendMediaStateIrp(IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, IN PMEDIA_CHANGE_DETECTION_INFO Info, IN ULONG CountDown)
Definition: autorun.c:1559
@ FdoExtension
Definition: precomp.h:48
long LONG
Definition: pedump.c:60
#define TRACE_LEVEL_INFORMATION
Definition: storswtr.h:29

Referenced by _Function_class_(), and ClasspStorageEventNotification().

◆ ClassCheckVerifyComplete()

SCSIPORT_API NTSTATUS NTAPI ClassCheckVerifyComplete ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp,
PVOID  Context 
)

◆ ClassCompleteRequest()

SCSIPORT_API VOID NTAPI ClassCompleteRequest ( _In_ PDEVICE_OBJECT  DeviceObject,
_In_ PIRP  Irp,
_In_ CCHAR  PriorityBoost 
)

Definition at line 401 of file lock.c.

406{
407 #if DBG
408 PCOMMON_DEVICE_EXTENSION commonExtension = DeviceObject->DeviceExtension;
409
410 PRTL_GENERIC_TABLE removeTrackingList = NULL;
411 REMOVE_TRACKING_BLOCK searchDataBlock;
412 PREMOVE_TRACKING_BLOCK foundTrackingBlock;
413
414 KIRQL oldIrql;
415
416 KeAcquireSpinLock(&commonExtension->RemoveTrackingSpinlock, &oldIrql);
417
418 removeTrackingList = commonExtension->RemoveTrackingList;
419
420 if (removeTrackingList != NULL)
421 {
422 searchDataBlock.Tag = Irp;
423
424 foundTrackingBlock = RtlLookupElementGenericTable(removeTrackingList, &searchDataBlock);
425
426 if(foundTrackingBlock != NULL) {
427
428 TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_LOCK, ">>>>>ClassCompleteRequest: "
429 "Irp %p completed while still holding the remove lock\n", Irp));
430 TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_LOCK, ">>>>>ClassCompleteRequest: "
431 "Lock acquired in file %s on line %d\n",
432 foundTrackingBlock->File, foundTrackingBlock->Line));
434 }
435 }
436
437 KeReleaseSpinLock(&commonExtension->RemoveTrackingSpinlock, oldIrql);
438 #endif
439
440
442
444 return;
445} // end ClassCompleteRequest()
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define IoCompleteRequest
Definition: irp.c:1240
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
KSPIN_LOCK RemoveTrackingSpinlock
Definition: classpnp.h:603
_In_ WDFREQUEST _In_ NTSTATUS _In_ CCHAR PriorityBoost
Definition: wdfrequest.h:1016
_Must_inspect_result_ NTSYSAPI PVOID NTAPI RtlLookupElementGenericTable(_In_ PRTL_GENERIC_TABLE Table, _In_ PVOID Buffer)

Referenced by _IRQL_requires_max_(), _Success_(), ClassCheckVerifyComplete(), ClassCreateClose(), ClassDeviceControl(), ClassDeviceControlDispatch(), ClassDeviceGetLBProvisioningResources(), ClassDeviceHwFirmwareActivateProcess(), ClassDeviceHwFirmwareDownloadProcess(), ClassDeviceHwFirmwareGetInfoProcess(), ClassDispatchPnp(), ClassDispatchPower(), ClassInternalIoControl(), ClassIoCompleteAssociated(), ClassMinimalPowerHandler(), ClasspAccessAlignmentProperty(), ClasspCompleteOffloadRequest(), ClasspDeviceGetLBAStatus(), ClasspDeviceLBProvisioningProperty(), ClasspDeviceMediaTypeProperty(), ClasspDeviceSeekPenaltyProperty(), ClasspDeviceTrimProcess(), ClasspDeviceTrimProperty(), ClasspDuidQueryProperty(), ClasspMcnControl(), ClasspPersistentReserve(), ClasspPowerDownCompletion(), ClasspPowerHandler(), ClasspPowerUpCompletion(), ClasspPriorityHint(), ClasspStartIo(), ClasspStorageEventNotification(), ClasspWriteCacheProperty(), ClassReadWrite(), ClassShutdownFlush(), ClassSystemControl(), ClassWmiCompleteRequest(), DiskDeviceControl(), DiskFlushComplete(), DiskIoctlVerifyThread(), DiskShutdownFlush(), ScsiFlopDeviceControl(), and TransferPktComplete().

◆ ClassDebugPrint()

SCSIPORT_API VOID ClassDebugPrint ( _In_ CLASS_DEBUG_LEVEL  DebugPrintLevel,
_In_z_ PCCHAR  DebugMessage,
  ... 
)

Definition at line 563 of file debug.c.

564 {
565 UNREFERENCED_PARAMETER(DebugPrintLevel);
566 UNREFERENCED_PARAMETER(DebugMessage);
567 }

◆ ClassDeviceControl()

SCSIPORT_API NTSTATUS NTAPI ClassDeviceControl ( _In_ PDEVICE_OBJECT  DeviceObject,
_Inout_ PIRP  Irp 
)

Definition at line 7317 of file class.c.

7321{
7322 PCOMMON_DEVICE_EXTENSION commonExtension = DeviceObject->DeviceExtension;
7323
7325 PIO_STACK_LOCATION nextStack = NULL;
7326
7327 ULONG controlCode = irpStack->Parameters.DeviceIoControl.IoControlCode;
7328
7330 PCDB cdb = NULL;
7331
7333 ULONG modifiedIoControlCode = 0;
7334 GUID activityId = {0};
7335
7336
7337 //
7338 // If this is a pass through I/O control, set the minor function code
7339 // and device address and pass it to the port driver.
7340 //
7341
7342 if ( (controlCode == IOCTL_SCSI_PASS_THROUGH) ||
7343 (controlCode == IOCTL_SCSI_PASS_THROUGH_DIRECT) ||
7344 (controlCode == IOCTL_SCSI_PASS_THROUGH_EX) ||
7345 (controlCode == IOCTL_SCSI_PASS_THROUGH_DIRECT_EX) ) {
7346
7347
7348
7349 //
7350 // Validiate the user buffer for SCSI pass through.
7351 // For pass through EX: as the handler will validate the size anyway,
7352 // do not apply the similar check and leave the work to the handler.
7353 //
7354 if ( (controlCode == IOCTL_SCSI_PASS_THROUGH) ||
7355 (controlCode == IOCTL_SCSI_PASS_THROUGH_DIRECT) ) {
7356
7357 #if BUILD_WOW64_ENABLED && defined(_WIN64)
7358
7359 if (IoIs32bitProcess(Irp)) {
7360
7361 if (irpStack->Parameters.DeviceIoControl.InputBufferLength < sizeof(SCSI_PASS_THROUGH32)){
7362
7363 Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
7364
7367
7369 goto SetStatusAndReturn;
7370 }
7371 }
7372 else
7373
7374 #endif
7375
7376 {
7377 if (irpStack->Parameters.DeviceIoControl.InputBufferLength <
7378 sizeof(SCSI_PASS_THROUGH)) {
7379
7380 Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
7381
7384
7386 goto SetStatusAndReturn;
7387 }
7388 }
7389 }
7390
7391
7393
7394 nextStack = IoGetNextIrpStackLocation(Irp);
7395 nextStack->MinorFunction = 1;
7396
7398
7399 status = IoCallDriver(commonExtension->LowerDeviceObject, Irp);
7400 goto SetStatusAndReturn;
7401
7402 }
7403
7404 Irp->IoStatus.Information = 0;
7405
7406
7407 switch (controlCode) {
7408
7410
7411 PMOUNTDEV_UNIQUE_ID uniqueId;
7412
7413 if (!commonExtension->MountedDeviceInterfaceName.Buffer) {
7415 break;
7416 }
7417
7418 if (irpStack->Parameters.DeviceIoControl.OutputBufferLength <
7419 sizeof(MOUNTDEV_UNIQUE_ID)) {
7420
7422 Irp->IoStatus.Information = sizeof(MOUNTDEV_UNIQUE_ID);
7423 break;
7424 }
7425
7426 uniqueId = Irp->AssociatedIrp.SystemBuffer;
7427 RtlZeroMemory(uniqueId, sizeof(MOUNTDEV_UNIQUE_ID));
7428 uniqueId->UniqueIdLength =
7429 commonExtension->MountedDeviceInterfaceName.Length;
7430
7431 if (irpStack->Parameters.DeviceIoControl.OutputBufferLength <
7432 sizeof(USHORT) + uniqueId->UniqueIdLength) {
7433
7435 Irp->IoStatus.Information = sizeof(MOUNTDEV_UNIQUE_ID);
7436 break;
7437 }
7438
7439 RtlCopyMemory(uniqueId->UniqueId,
7440 commonExtension->MountedDeviceInterfaceName.Buffer,
7441 uniqueId->UniqueIdLength);
7442
7444 Irp->IoStatus.Information = sizeof(USHORT) +
7445 uniqueId->UniqueIdLength;
7446 break;
7447 }
7448
7450
7452
7453 NT_ASSERT(commonExtension->DeviceName.Buffer);
7454
7455 if (irpStack->Parameters.DeviceIoControl.OutputBufferLength <
7456 sizeof(MOUNTDEV_NAME)) {
7457
7459 Irp->IoStatus.Information = sizeof(MOUNTDEV_NAME);
7460 break;
7461 }
7462
7463 name = Irp->AssociatedIrp.SystemBuffer;
7465 name->NameLength = commonExtension->DeviceName.Length;
7466
7467 if (irpStack->Parameters.DeviceIoControl.OutputBufferLength <
7468 sizeof(USHORT) + name->NameLength) {
7469
7471 Irp->IoStatus.Information = sizeof(MOUNTDEV_NAME);
7472 break;
7473 }
7474
7475 RtlCopyMemory(name->Name, commonExtension->DeviceName.Buffer,
7476 name->NameLength);
7477
7479 Irp->IoStatus.Information = sizeof(USHORT) + name->NameLength;
7480 break;
7481 }
7482
7484
7485 PMOUNTDEV_SUGGESTED_LINK_NAME suggestedName;
7486 WCHAR driveLetterNameBuffer[10] = {0};
7487 RTL_QUERY_REGISTRY_TABLE queryTable[2] = {0};
7488 PWSTR valueName;
7489 UNICODE_STRING driveLetterName;
7490
7491 if (irpStack->Parameters.DeviceIoControl.OutputBufferLength <
7493
7495 Irp->IoStatus.Information = sizeof(MOUNTDEV_SUGGESTED_LINK_NAME);
7496 break;
7497 }
7498
7499 valueName = ExAllocatePoolWithTag(
7500 PagedPool,
7501 commonExtension->DeviceName.Length + sizeof(WCHAR),
7502 '8CcS');
7503
7504 if (!valueName) {
7506 break;
7507 }
7508
7509 RtlCopyMemory(valueName, commonExtension->DeviceName.Buffer,
7510 commonExtension->DeviceName.Length);
7511 valueName[commonExtension->DeviceName.Length/sizeof(WCHAR)] = 0;
7512
7513 driveLetterName.Buffer = driveLetterNameBuffer;
7514 driveLetterName.MaximumLength = sizeof(driveLetterNameBuffer);
7515 driveLetterName.Length = 0;
7516
7517 queryTable[0].Flags = RTL_QUERY_REGISTRY_REQUIRED |
7520 queryTable[0].Name = valueName;
7521 queryTable[0].EntryContext = &driveLetterName;
7523
7525 L"\\Registry\\Machine\\System\\DISK",
7526 queryTable, NULL, NULL);
7527
7528 if (!NT_SUCCESS(status)) {
7529 FREE_POOL(valueName);
7530 break;
7531 }
7532
7533 if (driveLetterName.Length == 4 &&
7534 driveLetterName.Buffer[0] == '%' &&
7535 driveLetterName.Buffer[1] == ':') {
7536
7537 driveLetterName.Buffer[0] = 0xFF;
7538
7539 } else if (driveLetterName.Length != 4 ||
7540 driveLetterName.Buffer[0] < FirstDriveLetter ||
7541 driveLetterName.Buffer[0] > LastDriveLetter ||
7542 driveLetterName.Buffer[1] != ':') {
7543
7545 FREE_POOL(valueName);
7546 break;
7547 }
7548
7549 suggestedName = Irp->AssociatedIrp.SystemBuffer;
7550 RtlZeroMemory(suggestedName, sizeof(MOUNTDEV_SUGGESTED_LINK_NAME));
7551 suggestedName->UseOnlyIfThereAreNoOtherLinks = TRUE;
7552 suggestedName->NameLength = 28;
7553
7554 Irp->IoStatus.Information =
7556
7557 if (irpStack->Parameters.DeviceIoControl.OutputBufferLength <
7558 Irp->IoStatus.Information) {
7559
7560 Irp->IoStatus.Information =
7563 FREE_POOL(valueName);
7564 break;
7565 }
7566
7568 L"\\Registry\\Machine\\System\\DISK",
7569 valueName);
7570
7571 FREE_POOL(valueName);
7572
7573 RtlCopyMemory(suggestedName->Name, L"\\DosDevices\\", 24);
7574 suggestedName->Name[12] = driveLetterName.Buffer[0];
7575 suggestedName->Name[13] = ':';
7576
7577 //
7578 // NT_SUCCESS(status) based on RtlQueryRegistryValues
7579 //
7581
7582 break;
7583 }
7584
7585 default:
7587 break;
7588 }
7589
7590 if (status != STATUS_PENDING) {
7592 Irp->IoStatus.Status = status;
7593
7594
7596 return status;
7597 }
7598
7599 if (commonExtension->IsFdo){
7600
7601 PULONG_PTR function;
7602 PFUNCTIONAL_DEVICE_EXTENSION fdoExtension = (PFUNCTIONAL_DEVICE_EXTENSION)commonExtension;
7603 size_t sizeNeeded;
7604
7605 //
7606 // Allocate a SCSI SRB for handling various IOCTLs.
7607 // NOTE - there is a case where an IOCTL is sent to classpnp before AdapterDescriptor
7608 // is initialized. In this case, default to legacy SRB.
7609 //
7610 if ((fdoExtension->AdapterDescriptor != NULL) &&
7611 (fdoExtension->AdapterDescriptor->SrbType == SRB_TYPE_STORAGE_REQUEST_BLOCK)) {
7613 } else {
7614 sizeNeeded = sizeof(SCSI_REQUEST_BLOCK);
7615 }
7616
7617 srb = ExAllocatePoolWithTag(NonPagedPoolNx,
7618 sizeNeeded +
7619 (sizeof(ULONG_PTR) * 2),
7620 '9CcS');
7621
7622 if (srb == NULL) {
7623
7624 Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;
7628 goto SetStatusAndReturn;
7629 }
7630
7631 if ((fdoExtension->AdapterDescriptor != NULL) &&
7632 (fdoExtension->AdapterDescriptor->SrbType == SRB_TYPE_STORAGE_REQUEST_BLOCK)) {
7636 1,
7638 if (NT_SUCCESS(status)) {
7640 function = (PULONG_PTR)((PCHAR)srb + sizeNeeded);
7641 } else {
7642 //
7643 // Should not occur.
7644 //
7646 goto SetStatusAndReturn;
7647 }
7648 } else {
7649 RtlZeroMemory(srb, sizeof(SCSI_REQUEST_BLOCK));
7650 srb->Length = sizeof(SCSI_REQUEST_BLOCK);
7651 srb->Function = SRB_FUNCTION_EXECUTE_SCSI;
7652 function = (PULONG_PTR) ((PSCSI_REQUEST_BLOCK) (srb + 1));
7653 }
7654
7655 //
7656 // Save the function code and the device object in the memory after
7657 // the SRB.
7658 //
7659
7660 *function = (ULONG_PTR) DeviceObject;
7661 function++;
7662 *function = (ULONG_PTR) controlCode;
7663
7664 } else {
7665 srb = NULL;
7666 }
7667
7668 //
7669 // Change the device type to storage for the switch statement, but only
7670 // if from a legacy device type
7671 //
7672
7673 if (((controlCode & 0xffff0000) == (IOCTL_DISK_BASE << 16)) ||
7674 ((controlCode & 0xffff0000) == (IOCTL_TAPE_BASE << 16)) ||
7675 ((controlCode & 0xffff0000) == (IOCTL_CDROM_BASE << 16))
7676 ) {
7677
7678 modifiedIoControlCode = (controlCode & ~0xffff0000);
7679 modifiedIoControlCode |= (IOCTL_STORAGE_BASE << 16);
7680
7681 } else {
7682
7683 modifiedIoControlCode = controlCode;
7684
7685 }
7686
7687 TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_GENERAL, "> ioctl %xh (%s)", modifiedIoControlCode, DBGGETIOCTLSTR(modifiedIoControlCode)));
7688
7689
7690 switch (modifiedIoControlCode) {
7691
7693
7694 FREE_POOL(srb);
7695
7696 if (irpStack->Parameters.DeviceIoControl.OutputBufferLength <
7697 sizeof(STORAGE_HOTPLUG_INFO)) {
7698
7699 //
7700 // Indicate unsuccessful status and no data transferred.
7701 //
7702
7703 Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;
7704 Irp->IoStatus.Information = sizeof(STORAGE_HOTPLUG_INFO);
7705
7709
7710 } else if (!commonExtension->IsFdo) {
7711
7712
7713 //
7714 // Just forward this down and return
7715 //
7716
7718
7720 status = IoCallDriver(commonExtension->LowerDeviceObject, Irp);
7721
7722 } else {
7723
7724 PFUNCTIONAL_DEVICE_EXTENSION fdoExtension;
7726
7727 fdoExtension = (PFUNCTIONAL_DEVICE_EXTENSION)commonExtension;
7728 info = Irp->AssociatedIrp.SystemBuffer;
7729
7730 *info = fdoExtension->PrivateFdoData->HotplugInfo;
7731 Irp->IoStatus.Status = STATUS_SUCCESS;
7732 Irp->IoStatus.Information = sizeof(STORAGE_HOTPLUG_INFO);
7736 }
7737 break;
7738 }
7739
7741
7742 FREE_POOL(srb);
7743
7744 if (irpStack->Parameters.DeviceIoControl.InputBufferLength <
7745 sizeof(STORAGE_HOTPLUG_INFO)) {
7746
7747 //
7748 // Indicate unsuccessful status and no data transferred.
7749 //
7750
7751 Irp->IoStatus.Status = STATUS_INFO_LENGTH_MISMATCH;
7752
7756 goto SetStatusAndReturn;
7757
7758 }
7759
7760 if (!commonExtension->IsFdo) {
7761
7762
7763 //
7764 // Just forward this down and return
7765 //
7766
7768
7770 status = IoCallDriver(commonExtension->LowerDeviceObject, Irp);
7771
7772 } else {
7773
7774 PFUNCTIONAL_DEVICE_EXTENSION fdoExtension = (PFUNCTIONAL_DEVICE_EXTENSION)commonExtension;
7775 PSTORAGE_HOTPLUG_INFO info = Irp->AssociatedIrp.SystemBuffer;
7776
7778
7779 if (info->Size != fdoExtension->PrivateFdoData->HotplugInfo.Size)
7780 {
7782 }
7783
7784 if (info->MediaRemovable != fdoExtension->PrivateFdoData->HotplugInfo.MediaRemovable)
7785 {
7787 }
7788
7789 if (info->MediaHotplug != fdoExtension->PrivateFdoData->HotplugInfo.MediaHotplug)
7790 {
7792 }
7793
7794 if (NT_SUCCESS(status))
7795 {
7796 if (info->WriteCacheEnableOverride != fdoExtension->PrivateFdoData->HotplugInfo.WriteCacheEnableOverride)
7797 {
7798 fdoExtension->PrivateFdoData->HotplugInfo.WriteCacheEnableOverride = info->WriteCacheEnableOverride;
7799
7800 //
7801 // Store the user-defined override in the registry
7802 //
7803
7804 ClassSetDeviceParameter(fdoExtension,
7807 info->WriteCacheEnableOverride);
7808 }
7809
7810 fdoExtension->PrivateFdoData->HotplugInfo.DeviceHotplug = info->DeviceHotplug;
7811
7812 //
7813 // Store the user-defined override in the registry
7814 //
7815
7816 ClassSetDeviceParameter(fdoExtension,
7820 }
7821
7822 Irp->IoStatus.Status = status;
7823
7826 }
7827
7828 break;
7829 }
7830
7833
7834 PIRP irp2 = NULL;
7835 PIO_STACK_LOCATION newStack;
7836
7837 PFUNCTIONAL_DEVICE_EXTENSION fdoExtension = NULL;
7838
7839 TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, "DeviceIoControl: Check verify\n"));
7840
7841 //
7842 // If a buffer for a media change count was provided, make sure it's
7843 // big enough to hold the result
7844 //
7845
7846 if (irpStack->Parameters.DeviceIoControl.OutputBufferLength) {
7847
7848 //
7849 // If the buffer is too small to hold the media change count
7850 // then return an error to the caller
7851 //
7852
7853 if (irpStack->Parameters.DeviceIoControl.OutputBufferLength <
7854 sizeof(ULONG)) {
7855
7856 TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL, "DeviceIoControl: media count "
7857 "buffer too small\n"));
7858
7859 Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;
7860 Irp->IoStatus.Information = sizeof(ULONG);
7861
7862 FREE_POOL(srb);
7863
7866
7868 goto SetStatusAndReturn;
7869 }
7870 }
7871
7872 if (!commonExtension->IsFdo) {
7873
7874
7875 //
7876 // If this is a PDO then we should just forward the request down
7877 //
7878 NT_ASSERT(!srb);
7879
7881
7883
7884 status = IoCallDriver(commonExtension->LowerDeviceObject, Irp);
7885
7886 goto SetStatusAndReturn;
7887
7888 } else {
7889
7890 fdoExtension = DeviceObject->DeviceExtension;
7891
7892 }
7893
7894 if (irpStack->Parameters.DeviceIoControl.OutputBufferLength) {
7895
7896 //
7897 // The caller has provided a valid buffer. Allocate an additional
7898 // irp and stick the CheckVerify completion routine on it. We will
7899 // then send this down to the port driver instead of the irp the
7900 // caller sent in
7901 //
7902
7903 TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, "DeviceIoControl: Check verify wants "
7904 "media count\n"));
7905
7906 //
7907 // Allocate a new irp to send the TestUnitReady to the port driver
7908 //
7909
7910 irp2 = IoAllocateIrp((CCHAR) (DeviceObject->StackSize + 3), FALSE);
7911
7912 if (irp2 == NULL) {
7913 Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;
7914 Irp->IoStatus.Information = 0;
7915 FREE_POOL(srb);
7919 goto SetStatusAndReturn;
7920
7921 break;
7922 }
7923
7924 //
7925 // Make sure to acquire the lock for the new irp.
7926 //
7927
7929
7930 irp2->Tail.Overlay.Thread = Irp->Tail.Overlay.Thread;
7932
7933 //
7934 // Set the top stack location and shove the master Irp into the
7935 // top location
7936 //
7937
7938 newStack = IoGetCurrentIrpStackLocation(irp2);
7939 newStack->Parameters.Others.Argument1 = Irp;
7940 newStack->DeviceObject = DeviceObject;
7941
7942 //
7943 // Stick the check verify completion routine onto the stack
7944 // and prepare the irp for the port driver
7945 //
7946
7949 NULL,
7950 TRUE,
7951 TRUE,
7952 TRUE);
7953
7955 newStack = IoGetCurrentIrpStackLocation(irp2);
7956 newStack->DeviceObject = DeviceObject;
7957 newStack->MajorFunction = irpStack->MajorFunction;
7958 newStack->MinorFunction = irpStack->MinorFunction;
7959 newStack->Flags = irpStack->Flags;
7960
7961
7962 //
7963 // Mark the master irp as pending - whether the lower level
7964 // driver completes it immediately or not this should allow it
7965 // to go all the way back up.
7966 //
7967
7969
7970 Irp = irp2;
7971
7972 }
7973
7974 //
7975 // Test Unit Ready
7976 //
7977
7978 SrbSetCdbLength(srb, 6);
7979 cdb = SrbGetCdb(srb);
7980 cdb->CDB6GENERIC.OperationCode = SCSIOP_TEST_UNIT_READY;
7981
7982 //
7983 // Set timeout value.
7984 //
7985
7986 SrbSetTimeOutValue(srb, fdoExtension->TimeOutValue);
7987
7988 //
7989 // If this was a CV2 then mark the request as low-priority so we don't
7990 // spin up the drive just to satisfy it.
7991 //
7992
7993 if (controlCode == IOCTL_STORAGE_CHECK_VERIFY2) {
7995 }
7996
7997 //
7998 // Since this routine will always hand the request to the
7999 // port driver if there isn't a data transfer to be done
8000 // we don't have to worry about completing the request here
8001 // on an error
8002 //
8003
8004 //
8005 // This routine uses a completion routine so we don't want to release
8006 // the remove lock until then.
8007 //
8008
8010 srb,
8011 Irp,
8012 NULL,
8013 0,
8014 FALSE);
8015
8016 break;
8017 }
8018
8021
8022 PPREVENT_MEDIA_REMOVAL mediaRemoval = Irp->AssociatedIrp.SystemBuffer;
8023
8024 TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, "DiskIoControl: ejection control\n"));
8025
8026 FREE_POOL(srb);
8027
8028 if (irpStack->Parameters.DeviceIoControl.InputBufferLength <
8029 sizeof(PREVENT_MEDIA_REMOVAL)) {
8030
8031 //
8032 // Indicate unsuccessful status and no data transferred.
8033 //
8034
8035 Irp->IoStatus.Status = STATUS_INFO_LENGTH_MISMATCH;
8036
8040 goto SetStatusAndReturn;
8041 }
8042
8043 if (!commonExtension->IsFdo) {
8044
8045
8046 //
8047 // Just forward this down and return
8048 //
8049
8051
8053 status = IoCallDriver(commonExtension->LowerDeviceObject, Irp);
8054 }
8055 else {
8056
8057 // i don't believe this assertion is valid. this is a request
8058 // from user-mode, so they could request this for any device
8059 // they want? also, we handle it properly.
8060 // NT_ASSERT(TEST_FLAG(DeviceObject->Characteristics, FILE_REMOVABLE_MEDIA));
8063 Irp,
8064 ((modifiedIoControlCode ==
8067 mediaRemoval->PreventMediaRemoval);
8068
8069 Irp->IoStatus.Status = status;
8072 }
8073
8074 break;
8075 }
8076
8078
8079 TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, "DiskIoControl: MCN control\n"));
8080
8081 if (irpStack->Parameters.DeviceIoControl.InputBufferLength <
8082 sizeof(PREVENT_MEDIA_REMOVAL)) {
8083
8084 //
8085 // Indicate unsuccessful status and no data transferred.
8086 //
8087
8088 Irp->IoStatus.Status = STATUS_INFO_LENGTH_MISMATCH;
8089 Irp->IoStatus.Information = 0;
8090
8091 FREE_POOL(srb);
8092
8096 goto SetStatusAndReturn;
8097 }
8098
8099 if (!commonExtension->IsFdo) {
8100
8101
8102 //
8103 // Just forward this down and return
8104 //
8105
8106 FREE_POOL(srb);
8107
8109
8111 status = IoCallDriver(commonExtension->LowerDeviceObject, Irp);
8112
8113 } else {
8114
8115 //
8116 // Call to the FDO - handle the ejection control.
8117 //
8118
8119 status = ClasspMcnControl(DeviceObject->DeviceExtension,
8120 Irp,
8121 srb);
8122 }
8123 goto SetStatusAndReturn;
8124 }
8125
8127 case IOCTL_STORAGE_RELEASE: {
8128
8129 //
8130 // Reserve logical unit.
8131 //
8132
8133 PFUNCTIONAL_DEVICE_EXTENSION fdoExtension = NULL;
8134
8135 if (!commonExtension->IsFdo) {
8136
8137
8139
8141 status = IoCallDriver(commonExtension->LowerDeviceObject, Irp);
8142 goto SetStatusAndReturn;
8143
8144 } else {
8145 fdoExtension = DeviceObject->DeviceExtension;
8146 }
8147
8148 if (TEST_FLAG(fdoExtension->PrivateFdoData->HackFlags, FDO_HACK_NO_RESERVE6))
8149 {
8150 SrbSetCdbLength(srb, 10);
8151 cdb = SrbGetCdb(srb);
8152 cdb->CDB10.OperationCode = (modifiedIoControlCode == IOCTL_STORAGE_RESERVE) ? SCSIOP_RESERVE_UNIT10 : SCSIOP_RELEASE_UNIT10;
8153 }
8154 else
8155 {
8156 SrbSetCdbLength(srb, 6);
8157 cdb = SrbGetCdb(srb);
8158 cdb->CDB6GENERIC.OperationCode = (modifiedIoControlCode == IOCTL_STORAGE_RESERVE) ? SCSIOP_RESERVE_UNIT : SCSIOP_RELEASE_UNIT;
8159 }
8160
8161 //
8162 // Set timeout value.
8163 //
8164
8165 SrbSetTimeOutValue(srb, fdoExtension->TimeOutValue);
8166
8167 //
8168 // Send reserves as tagged requests.
8169 //
8170
8171 if ( IOCTL_STORAGE_RESERVE == modifiedIoControlCode ) {
8174 }
8175
8177 srb,
8178 Irp,
8179 NULL,
8180 0,
8181 FALSE);
8182
8183 break;
8184 }
8185
8188
8189 if (!commonExtension->IsFdo) {
8190
8192
8194 status = IoCallDriver(commonExtension->LowerDeviceObject, Irp);
8195 goto SetStatusAndReturn;
8196 }
8197
8198 //
8199 // Process Persistent Reserve
8200 //
8201
8203
8204 break;
8205
8206 }
8207
8211
8212 //
8213 // Eject media.
8214 //
8215
8216 PFUNCTIONAL_DEVICE_EXTENSION fdoExtension = NULL;
8217
8218 if (!commonExtension->IsFdo) {
8219
8220
8222
8224
8225 status = IoCallDriver(commonExtension->LowerDeviceObject, Irp);
8226 goto SetStatusAndReturn;
8227 } else {
8228 fdoExtension = DeviceObject->DeviceExtension;
8229 }
8230
8231 if (commonExtension->PagingPathCount != 0) {
8232
8233 TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL, "ClassDeviceControl: call to eject paging device - "
8234 "failure\n"));
8235
8237 Irp->IoStatus.Status = status;
8238
8239 Irp->IoStatus.Information = 0;
8240
8241 FREE_POOL(srb);
8242
8245 goto SetStatusAndReturn;
8246 }
8247
8248 //
8249 // Synchronize with ejection control and ejection cleanup code as
8250 // well as other eject/load requests.
8251 //
8252
8256 KernelMode,
8257 FALSE,
8258 NULL);
8259
8260 if (fdoExtension->ProtectedLockCount != 0) {
8261
8262 TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL, "ClassDeviceControl: call to eject protected locked "
8263 "device - failure\n"));
8264
8266 Irp->IoStatus.Status = status;
8267 Irp->IoStatus.Information = 0;
8268
8269 FREE_POOL(srb);
8270
8273
8276 FALSE);
8278
8279 goto SetStatusAndReturn;
8280 }
8281
8282 SrbSetCdbLength(srb, 6);
8283 cdb = SrbGetCdb(srb);
8284
8285 cdb->START_STOP.OperationCode = SCSIOP_START_STOP_UNIT;
8286 cdb->START_STOP.LoadEject = 1;
8287
8288 if (modifiedIoControlCode == IOCTL_STORAGE_EJECT_MEDIA) {
8289 cdb->START_STOP.Start = 0;
8290 } else {
8291 cdb->START_STOP.Start = 1;
8292 }
8293
8294 //
8295 // Set timeout value.
8296 //
8297
8298 SrbSetTimeOutValue(srb, fdoExtension->TimeOutValue);
8300 srb,
8301 Irp,
8302 NULL,
8303 0,
8304 FALSE);
8305
8308
8309 break;
8310 }
8311
8313
8314 FREE_POOL(srb);
8315
8316 if (commonExtension->IsFdo) {
8317
8319 ((PFUNCTIONAL_DEVICE_EXTENSION) commonExtension)->LowerPdo,
8320 BusRelations);
8321
8323 Irp->IoStatus.Status = status;
8324
8327 }
8328 else {
8329
8330
8332
8334 status = IoCallDriver(commonExtension->LowerDeviceObject, Irp);
8335 }
8336 break;
8337 }
8338
8340
8341 FREE_POOL(srb);
8342
8343 if (irpStack->Parameters.DeviceIoControl.OutputBufferLength >=
8344 sizeof(STORAGE_DEVICE_NUMBER)) {
8345
8346 PSTORAGE_DEVICE_NUMBER deviceNumber =
8347 Irp->AssociatedIrp.SystemBuffer;
8348 PFUNCTIONAL_DEVICE_EXTENSION fdoExtension =
8349 commonExtension->PartitionZeroExtension;
8350
8351 deviceNumber->DeviceType = fdoExtension->CommonExtension.DeviceObject->DeviceType;
8352 deviceNumber->DeviceNumber = fdoExtension->DeviceNumber;
8353 deviceNumber->PartitionNumber = commonExtension->PartitionNumber;
8354
8356 Irp->IoStatus.Information = sizeof(STORAGE_DEVICE_NUMBER);
8357
8358 } else {
8360 Irp->IoStatus.Information = sizeof(STORAGE_DEVICE_NUMBER);
8361 }
8362
8363 Irp->IoStatus.Status = status;
8366
8367 break;
8368 }
8369
8370
8372
8373 FREE_POOL(srb);
8374
8375 if (irpStack->Parameters.DeviceIoControl.OutputBufferLength <
8376 sizeof(STORAGE_READ_CAPACITY)) {
8377
8378 //
8379 // Indicate unsuccessful status and no data transferred.
8380 //
8381
8382 Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;
8383 Irp->IoStatus.Information = sizeof(STORAGE_READ_CAPACITY);
8384
8388 break;
8389 }
8390
8391 if (!commonExtension->IsFdo) {
8392
8393
8394 //
8395 // Just forward this down and return
8396 //
8397
8399
8401 status = IoCallDriver(commonExtension->LowerDeviceObject, Irp);
8402 }
8403 else {
8404
8405 PFUNCTIONAL_DEVICE_EXTENSION fdoExt = DeviceObject->DeviceExtension;
8406 PCLASS_PRIVATE_FDO_DATA fdoData = fdoExt->PrivateFdoData;
8407 PSTORAGE_READ_CAPACITY readCapacity = Irp->AssociatedIrp.SystemBuffer;
8408 LARGE_INTEGER diskLength;
8409
8411 if (NT_SUCCESS(status) && fdoData->IsCachedDriveCapDataValid) {
8412
8413 readCapacity->Version = sizeof(STORAGE_READ_CAPACITY);
8414 readCapacity->Size = sizeof(STORAGE_READ_CAPACITY);
8415
8416 REVERSE_BYTES(&readCapacity->BlockLength,
8418 REVERSE_BYTES_QUAD(&readCapacity->NumberOfBlocks,
8420 readCapacity->NumberOfBlocks.QuadPart++;
8421
8422 readCapacity->DiskLength = fdoExt->CommonExtension.PartitionLength;
8423
8424 //
8425 // Make sure the lengths are equal.
8426 // Remove this after testing.
8427 //
8428 diskLength.QuadPart = readCapacity->NumberOfBlocks.QuadPart *
8429 readCapacity->BlockLength;
8430
8431 Irp->IoStatus.Status = STATUS_SUCCESS;
8432 Irp->IoStatus.Information = sizeof(STORAGE_READ_CAPACITY);
8433
8434 } else {
8435 //
8436 // Read capacity request failed.
8437 //
8438 TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_IOCTL, "ClassDeviceControl: ClassReadDriveCapacity failed: 0x%X IsCachedDriveCapDataValid: %d\n",
8440 Irp->IoStatus.Status = status;
8441 Irp->IoStatus.Information = 0;
8442 }
8445 }
8446
8447 break;
8448 }
8449
8451
8452 PSTORAGE_PROPERTY_QUERY query = Irp->AssociatedIrp.SystemBuffer;
8453
8454 if (irpStack->Parameters.DeviceIoControl.InputBufferLength < sizeof(STORAGE_PROPERTY_QUERY)) {
8455
8457 Irp->IoStatus.Status = status;
8460 FREE_POOL(srb);
8461 break;
8462 }
8463
8464 if (!commonExtension->IsFdo) {
8465
8466
8468
8470 status = IoCallDriver(commonExtension->LowerDeviceObject, Irp);
8471 FREE_POOL(srb);
8472 break;
8473 }
8474
8475 //
8476 // Determine PropertyId type and either call appropriate routine
8477 // or pass request to lower drivers.
8478 //
8479
8480 switch ( query->PropertyId ) {
8481
8483
8485 break;
8486 }
8487
8489
8491 break;
8492 }
8493
8494 // these propertyId has been implemented in some port driver and filter drivers.
8495 // to keep the backwards compatibility, classpnp will send the request down if it's supported by lower layer.
8496 // otherwise, classpnp sends SCSI command and then interprets the result.
8498
8500 break;
8501 }
8502
8504
8506 break;
8507 }
8508
8510
8512 break;
8513 }
8514
8516
8518 break;
8519 }
8520
8522
8523 status = ClasspDeviceCopyOffloadProperty(DeviceObject, Irp, srb);
8524 break;
8525 }
8526
8528
8530 break;
8531 }
8532
8533 default: {
8534
8535 //
8536 // Copy the Irp stack parameters to the next stack location.
8537 //
8538
8540
8542 status = IoCallDriver(commonExtension->LowerDeviceObject, Irp);
8543 break;
8544 }
8545 } // end switch
8546
8547 FREE_POOL(srb);
8548 break;
8549 }
8550
8552
8553 FREE_POOL(srb);
8554
8555 if (!commonExtension->IsFdo) {
8556
8557
8559
8561 status = IoCallDriver(commonExtension->LowerDeviceObject, Irp);
8562 break;
8563 }
8564
8565 //
8566 // Process priority hit request
8567 //
8568
8570 break;
8571 }
8572
8574
8575 PDEVICE_MANAGE_DATA_SET_ATTRIBUTES dsmAttributes = Irp->AssociatedIrp.SystemBuffer;
8576
8577 if (irpStack->Parameters.DeviceIoControl.InputBufferLength < sizeof(DEVICE_MANAGE_DATA_SET_ATTRIBUTES)) {
8578
8580 Irp->IoStatus.Status = status;
8583 FREE_POOL(srb);
8584 break;
8585 }
8586
8587 if (irpStack->Parameters.DeviceIoControl.InputBufferLength <
8588 (sizeof(DEVICE_MANAGE_DATA_SET_ATTRIBUTES) + dsmAttributes->ParameterBlockLength + dsmAttributes->DataSetRangesLength)) {
8589
8591 Irp->IoStatus.Status = status;
8594 FREE_POOL(srb);
8595 break;
8596 }
8597
8598 if (!commonExtension->IsFdo) {
8599
8600
8602
8604 status = IoCallDriver(commonExtension->LowerDeviceObject, Irp);
8605 FREE_POOL(srb);
8606 break;
8607 }
8608
8609 switch(dsmAttributes->Action) {
8610
8611 // only process Trim action in class layer if possible.
8612 case DeviceDsmAction_Trim: {
8613 status = ClasspDeviceTrimProcess(DeviceObject, Irp, &activityId, srb);
8614 break;
8615 }
8616
8618 status = ClassDeviceProcessOffloadRead(DeviceObject, Irp, srb);
8619 break;
8620 }
8621
8623 status = ClassDeviceProcessOffloadWrite(DeviceObject, Irp, srb);
8624 break;
8625 }
8626
8629 break;
8630 }
8631
8632
8633 default: {
8634
8635
8636 //
8637 // Copy the Irp stack parameters to the next stack location.
8638 //
8639
8641
8643 status = IoCallDriver(commonExtension->LowerDeviceObject, Irp);
8644 break;
8645 }
8646 } // end switch
8647
8648 FREE_POOL(srb);
8649 break;
8650 }
8651
8653
8654 if (commonExtension->IsFdo) {
8655
8657
8658 } else {
8659
8661
8663 status = IoCallDriver(commonExtension->LowerDeviceObject, Irp);
8664 }
8665
8666 FREE_POOL(srb);
8667
8668 break;
8669 }
8670
8672
8673 FREE_POOL(srb);
8674
8676 break;
8677 }
8678
8679#if (NTDDI_VERSION >= NTDDI_WINTRHESHOLD)
8681 FREE_POOL(srb);
8682
8684 break;
8685 }
8686
8688 if (!commonExtension->IsFdo) {
8689
8691
8693 status = IoCallDriver(commonExtension->LowerDeviceObject, Irp);
8694 goto SetStatusAndReturn;
8695 }
8696
8698 break;
8699 }
8700
8702 if (!commonExtension->IsFdo) {
8703
8705
8707 status = IoCallDriver(commonExtension->LowerDeviceObject, Irp);
8708 goto SetStatusAndReturn;
8709 }
8710
8712 break;
8713 }
8714#endif
8715
8716
8717 default: {
8718
8719 TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_IOCTL, "IoDeviceControl: Unsupported device IOCTL %x for %p\n",
8720 controlCode, DeviceObject));
8721
8722
8723 //
8724 // Pass the device control to the next driver.
8725 //
8726
8727 FREE_POOL(srb);
8728
8729 //
8730 // Copy the Irp stack parameters to the next stack location.
8731 //
8732
8734
8736 status = IoCallDriver(commonExtension->LowerDeviceObject, Irp);
8737 break;
8738 }
8739
8740 } // end switch( ...
8741
8742SetStatusAndReturn:
8743
8744 TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_IOCTL, "< ioctl %xh (%s): status %xh.", modifiedIoControlCode, DBGGETIOCTLSTR(modifiedIoControlCode), status));
8745
8746 return status;
8747} // end ClassDeviceControl()
#define VOID
Definition: acefi.h:82
#define SRB_CLASS_FLAGS_LOW_PRIORITY
Definition: cdrom.h:162
#define FDO_HACK_NO_RESERVE6
Definition: cdromp.h:135
#define CLASSP_REG_WRITE_CACHE_VALUE_NAME
Definition: cdromp.h:124
@ SimpleMediaLock
Definition: cdromp.h:289
@ SecureMediaLock
Definition: cdromp.h:290
#define CLASSP_REG_REMOVAL_POLICY_VALUE_NAME
Definition: cdromp.h:126
#define CLASSP_REG_SUBKEY_NAME
Definition: cdromp.h:120
#define SCSIOP_TEST_UNIT_READY
Definition: cdrw_hw.h:866
#define SCSIOP_RELEASE_UNIT
Definition: cdrw_hw.h:893
#define SCSIOP_RESERVE_UNIT
Definition: cdrw_hw.h:892
#define SCSIOP_START_STOP_UNIT
Definition: cdrw_hw.h:897
NTSTATUS InitializeStorageRequestBlock(_Inout_bytecount_(ByteSize) PSTORAGE_REQUEST_BLOCK Srb, _In_ USHORT AddressType, _In_ ULONG ByteSize, _In_ ULONG NumSrbExData,...)
Definition: srblib.c:206
NTSTATUS ClasspDeviceLBProvisioningProperty(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp, _Inout_ PSCSI_REQUEST_BLOCK Srb)
Definition: utils.c:2894
NTSTATUS ClasspWriteCacheProperty(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp, _Inout_ PSCSI_REQUEST_BLOCK Srb)
Definition: utils.c:1199
NTSTATUS ClasspDeviceTrimProcess(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp, _In_ PGUID ActivityId, _Inout_ PSCSI_REQUEST_BLOCK Srb)
Definition: utils.c:3476
_IRQL_requires_same_ NTSTATUS ClasspStorageEventNotification(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
Definition: utils.c:7826
NTSTATUS ClassDeviceHwFirmwareDownloadProcess(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp, _Inout_ PSCSI_REQUEST_BLOCK Srb)
Definition: utils.c:8541
NTSTATUS ClasspDeviceGetLBAStatus(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp, _Inout_ PSCSI_REQUEST_BLOCK Srb)
Definition: utils.c:3861
NTSTATUS ClasspPersistentReserve(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp, _Inout_ PSCSI_REQUEST_BLOCK Srb)
Definition: utils.c:6211
NTSTATUS ClasspDuidQueryProperty(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: utils.c:997
NTSTATUS ClasspAccessAlignmentProperty(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp, _Inout_ PSCSI_REQUEST_BLOCK Srb)
Definition: utils.c:1700
NTSTATUS ClassDeviceHwFirmwareGetInfoProcess(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp)
Definition: utils.c:8366
NTSTATUS ClasspPriorityHint(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: utils.c:6480
NTSTATUS ClasspDeviceSeekPenaltyProperty(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp, _Inout_ PSCSI_REQUEST_BLOCK Srb)
Definition: utils.c:2172
NTSTATUS ClasspDeviceTrimProperty(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp, _Inout_ PSCSI_REQUEST_BLOCK Srb)
Definition: utils.c:2730
NTSTATUS ClasspEjectionControl(IN PDEVICE_OBJECT Fdo, IN PIRP Irp, IN MEDIA_LOCK_TYPE LockType, IN BOOLEAN Lock)
Definition: create.c:474
NTSTATUS ClassDeviceGetLBProvisioningResources(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp, _Inout_ PSCSI_REQUEST_BLOCK Srb)
Definition: utils.c:5087
NTSTATUS ClassDeviceHwFirmwareActivateProcess(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp, _Inout_ PSCSI_REQUEST_BLOCK Srb)
Definition: utils.c:8902
NTSTATUS ClasspDeviceMediaTypeProperty(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp, _Inout_ PSCSI_REQUEST_BLOCK Srb)
Definition: utils.c:1917
NTSTATUS ClasspMcnControl(IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, IN PIRP Irp, IN PSCSI_REQUEST_BLOCK Srb)
Definition: autorun.c:3276
#define ClassAcquireRemoveLock(devobj, tag)
Definition: classpnp.h:100
struct _FUNCTIONAL_DEVICE_EXTENSION * PFUNCTIONAL_DEVICE_EXTENSION
#define CLASS_SRBEX_SCSI_CDB16_BUFFER_SIZE
Definition: classpnp.h:695
SCSIPORT_API NTSTATUS NTAPI ClassSendSrbAsynchronous(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PSCSI_REQUEST_BLOCK Srb, _In_ PIRP Irp, _In_reads_bytes_opt_(BufferLength) __drv_aliasesMem PVOID BufferAddress, _In_ ULONG BufferLength, _In_ BOOLEAN WriteToDevice)
IO_COMPLETION_ROUTINE ClassCheckVerifyComplete
Definition: class.c:84
#define LastDriveLetter
Definition: class.c:93
_Must_inspect_result_ NTSTATUS NTAPI ClassReadDriveCapacity(_In_ PDEVICE_OBJECT Fdo)
Definition: class.c:2742
#define FirstDriveLetter
Definition: class.c:92
#define DBGGETIOCTLSTR(_ioctl)
Definition: debug.h:25
VOID NTAPI ClassCompleteRequest(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp, _In_ CCHAR PriorityBoost)
Definition: lock.c:401
#define ULONG_PTR
Definition: config.h:101
struct _SCSI_REQUEST_BLOCK SCSI_REQUEST_BLOCK
#define SRB_SIMPLE_TAG_REQUEST
Definition: srb.h:423
#define SRB_FLAGS_QUEUE_ACTION_ENABLE
Definition: srb.h:395
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
Definition: env_spec_w32.h:478
#define KeSetEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:476
#define PagedPool
Definition: env_spec_w32.h:308
#define IOCTL_STORAGE_CHECK_VERIFY2
Definition: ntddk_ex.h:212
#define IOCTL_STORAGE_LOAD_MEDIA2
Definition: ntddk_ex.h:210
NTSYSAPI NTSTATUS WINAPI RtlDeleteRegistryValue(ULONG, PCWSTR, PCWSTR)
NTSYSAPI NTSTATUS WINAPI RtlQueryRegistryValues(ULONG, PCWSTR, PRTL_QUERY_REGISTRY_TABLE, PVOID, PVOID)
IoMarkIrpPending(Irp)
#define IoSetCompletionRoutine(_Irp, _CompletionRoutine, _Context, _InvokeOnSuccess, _InvokeOnError, _InvokeOnCancel)
Definition: irp.cpp:498
#define KeLeaveCriticalRegion()
Definition: ke_x.h:119
#define KeEnterCriticalRegion()
Definition: ke_x.h:88
#define REG_SZ
Definition: layer.c:22
signed char * PCHAR
Definition: retypes.h:7
struct _MOUNTDEV_NAME MOUNTDEV_NAME
struct _MOUNTDEV_UNIQUE_ID MOUNTDEV_UNIQUE_ID
struct _STORAGE_HOTPLUG_INFO STORAGE_HOTPLUG_INFO
#define IOCTL_MOUNTDEV_QUERY_DEVICE_NAME
Definition: imports.h:93
#define IOCTL_MOUNTDEV_QUERY_SUGGESTED_LINK_NAME
Definition: imports.h:99
#define IOCTL_MOUNTDEV_QUERY_UNIQUE_ID
Definition: imports.h:80
#define IOCTL_STORAGE_GET_HOTPLUG_INFO
Definition: imports.h:238
struct _MOUNTDEV_SUGGESTED_LINK_NAME MOUNTDEV_SUGGESTED_LINK_NAME
#define RTL_REGISTRY_ABSOLUTE
Definition: nt_native.h:161
#define RTL_QUERY_REGISTRY_REQUIRED
Definition: nt_native.h:132
#define RTL_QUERY_REGISTRY_DIRECT
Definition: nt_native.h:144
#define REG_NONE
Definition: nt_native.h:1492
#define IOCTL_DISK_BASE
Definition: ntdddisk.h:44
#define IOCTL_STORAGE_QUERY_PROPERTY
Definition: ntddstor.h:178
#define IOCTL_STORAGE_RELEASE
Definition: ntddstor.h:119
#define DeviceDsmAction_OffloadRead
Definition: ntddstor.h:278
STORAGE_READ_CAPACITY
Definition: ntddstor.h:861
#define IOCTL_STORAGE_EVENT_NOTIFICATION
Definition: ntddstor.h:226
#define DeviceDsmAction_Allocation
Definition: ntddstor.h:280
struct _STORAGE_DEVICE_NUMBER STORAGE_DEVICE_NUMBER
#define IOCTL_STORAGE_SET_HOTPLUG_INFO
Definition: ntddstor.h:157
#define IOCTL_STORAGE_GET_DEVICE_NUMBER
Definition: ntddstor.h:143
#define IOCTL_STORAGE_FIRMWARE_ACTIVATE
Definition: ntddstor.h:211
#define IOCTL_STORAGE_CHECK_VERIFY
Definition: ntddstor.h:98
#define IOCTL_STORAGE_READ_CAPACITY
Definition: ntddstor.h:175
#define IOCTL_STORAGE_FIRMWARE_DOWNLOAD
Definition: ntddstor.h:208
#define DeviceDsmAction_OffloadWrite
Definition: ntddstor.h:279
#define IOCTL_STORAGE_MANAGE_DATA_SET_ATTRIBUTES
Definition: ntddstor.h:181
#define IOCTL_STORAGE_PERSISTENT_RESERVE_IN
Definition: ntddstor.h:169
#define IOCTL_STORAGE_PERSISTENT_RESERVE_OUT
Definition: ntddstor.h:172
#define IOCTL_STORAGE_LOAD_MEDIA
Definition: ntddstor.h:110
#define IOCTL_STORAGE_RESERVE
Definition: ntddstor.h:116
@ StorageDeviceUniqueIdProperty
Definition: ntddstor.h:515
@ StorageDeviceMediumProductType
Definition: ntddstor.h:527
@ StorageDeviceSeekPenaltyProperty
Definition: ntddstor.h:519
@ StorageDeviceLBProvisioningProperty
Definition: ntddstor.h:523
@ StorageDeviceWriteCacheProperty
Definition: ntddstor.h:516
@ StorageDeviceTrimProperty
Definition: ntddstor.h:520
@ StorageDeviceCopyOffloadProperty
Definition: ntddstor.h:525
@ StorageAccessAlignmentProperty
Definition: ntddstor.h:518
#define IOCTL_STORAGE_FIRMWARE_GET_INFO
Definition: ntddstor.h:205
#define IOCTL_STORAGE_GET_LB_PROVISIONING_MAP_RESOURCES
Definition: ntddstor.h:184
#define IOCTL_STORAGE_FIND_NEW_DEVICES
Definition: ntddstor.h:122
#define IOCTL_STORAGE_BASE
Definition: ntddstor.h:96
#define IOCTL_STORAGE_MCN_CONTROL
Definition: ntddstor.h:128
#define IOCTL_STORAGE_CHECK_PRIORITY_HINT_SUPPORT
Definition: ntddstor.h:196
#define DeviceDsmAction_Trim
Definition: ntddstor.h:276
#define IOCTL_STORAGE_EJECT_MEDIA
Definition: ntddstor.h:107
#define IOCTL_STORAGE_EJECTION_CONTROL
Definition: ntddstor.h:125
#define IOCTL_STORAGE_MEDIA_REMOVAL
Definition: ntddstor.h:104
* PSTORAGE_READ_CAPACITY
Definition: ntddstor.h:861
#define IOCTL_TAPE_BASE
Definition: ntddtape.h:35
#define IoCopyCurrentIrpStackLocationToNext(Irp)
Definition: ntifs_ex.h:413
PIRP NTAPI IoAllocateIrp(IN CCHAR StackSize, IN BOOLEAN ChargeQuota)
Definition: irp.c:615
#define IoCallDriver
Definition: irp.c:1225
#define STATUS_INVALID_PARAMETER_2
Definition: ntstatus.h:476
#define STATUS_PENDING
Definition: ntstatus.h:82
#define STATUS_INVALID_PARAMETER_1
Definition: ntstatus.h:475
#define STATUS_INVALID_PARAMETER_3
Definition: ntstatus.h:477
#define STATUS_FILES_OPEN
Definition: ntstatus.h:499
#define L(x)
Definition: ntvdm.h:50
unsigned short USHORT
Definition: pedump.c:61
VOID NTAPI IoInvalidateDeviceRelations(IN PDEVICE_OBJECT DeviceObject, IN DEVICE_RELATION_TYPE Type)
Definition: pnpmgr.c:2342
#define IOCTL_SCSI_PASS_THROUGH
Definition: scsi_port.h:47
#define IOCTL_SCSI_PASS_THROUGH_DIRECT
Definition: scsi_port.h:51
#define SCSIOP_RELEASE_UNIT10
Definition: scsi.h:322
#define SCSIOP_RESERVE_UNIT10
Definition: scsi.h:320
#define REVERSE_BYTES_QUAD(Destination, Source)
Definition: scsi.h:3452
#define REVERSE_BYTES(Destination, Source)
Definition: scsi.h:3465
#define SRB_TYPE_STORAGE_REQUEST_BLOCK
Definition: srb.h:655
#define STORAGE_ADDRESS_TYPE_BTL8
Definition: srb.h:657
@ SrbExDataTypeScsiCdb16
Definition: srb.h:450
#define IOCTL_SCSI_PASS_THROUGH_DIRECT_EX
Definition: ntddscsi.h:38
#define IOCTL_SCSI_PASS_THROUGH_EX
Definition: ntddscsi.h:37
#define STATUS_NOT_FOUND
Definition: shellext.h:72
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
FORCEINLINE VOID SrbSetSrbFlags(_In_ PVOID Srb, _In_ ULONG Flags)
Definition: srbhelper.h:964
FORCEINLINE VOID SrbSetRequestAttribute(_In_ PVOID Srb, _In_ UCHAR RequestAttribute)
Definition: srbhelper.h:1131
FORCEINLINE VOID SrbSetCdbLength(_In_ PVOID Srb, _In_ UCHAR CdbLength)
Definition: srbhelper.h:1093
FORCEINLINE VOID SrbSetTimeOutValue(_In_ PVOID Srb, _In_ ULONG TimeOutValue)
Definition: srbhelper.h:821
#define TRACE_LEVEL_WARNING
Definition: storswtr.h:28
#define TRACE_LEVEL_VERBOSE
Definition: storswtr.h:30
BOOLEAN IsCachedDriveCapDataValid
Definition: classp.h:803
READ_CAPACITY_DATA_EX LastKnownDriveCapacityData
Definition: classp.h:802
PDEVICE_OBJECT DeviceObject
Definition: pci.h:46
PDEVICE_OBJECT LowerDeviceObject
Definition: classpnp.h:598
UNICODE_STRING DeviceName
Definition: classpnp.h:615
struct _FUNCTIONAL_DEVICE_EXTENSION * PartitionZeroExtension
Definition: classpnp.h:599
UNICODE_STRING MountedDeviceInterfaceName
Definition: classpnp.h:628
LARGE_INTEGER PartitionLength
Definition: classpnp.h:618
DEVICE_DATA_MANAGEMENT_SET_ACTION Action
Definition: ntddstor.h:773
COMMON_DEVICE_EXTENSION CommonExtension
Definition: classpnp.h:873
PSTORAGE_ADAPTER_DESCRIPTOR AdapterDescriptor
Definition: classpnp.h:877
PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:3223
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3128
USHORT UniqueIdLength
Definition: imports.h:138
UCHAR UniqueId[1]
Definition: imports.h:139
BOOLEAN PreventMediaRemoval
Definition: ntddstor.h:343
LARGE_INTEGER LogicalBlockAddress
Definition: scsi.h:2749
DEVICE_TYPE DeviceType
Definition: ntddstor.h:324
USHORT MaximumLength
Definition: env_spec_w32.h:370
Definition: name.c:39
Definition: ps.c:97
uint16_t * PWSTR
Definition: typedefs.h:56
uint32_t * PULONG_PTR
Definition: typedefs.h:65
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
char CCHAR
Definition: typedefs.h:51
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
#define STATUS_DEVICE_BUSY
Definition: udferr_usr.h:129
Definition: cdrw_hw.h:28
struct _CDB::_CDB10 CDB10
struct _CDB::_CDB6GENERIC CDB6GENERIC
struct _CDB::_START_STOP START_STOP
LONGLONG QuadPart
Definition: typedefs.h:114
#define SrbGetCdb(srb)
Definition: usbstor.h:17
#define IOCTL_CDROM_BASE
Definition: vcdcli.c:21
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetNextIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2695
FORCEINLINE VOID IoSetNextIrpStackLocation(_Inout_ PIRP Irp)
Definition: iofuncs.h:2680
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2793
@ BusRelations
Definition: iotypes.h:2152
#define IO_NO_INCREMENT
Definition: iotypes.h:598
@ RemovalPolicyExpectSurpriseRemoval
Definition: iotypes.h:842
@ RemovalPolicyExpectOrderlyRemoval
Definition: iotypes.h:841
@ UserRequest
Definition: ketypes.h:409
#define RTL_QUERY_REGISTRY_TYPECHECK
#define RTL_QUERY_REGISTRY_TYPECHECK_SHIFT
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ ClassFindModePage()

SCSIPORT_API PVOID NTAPI ClassFindModePage ( _In_reads_bytes_(Length) PCHAR  ModeSenseBuffer,
_In_ ULONG  Length,
_In_ UCHAR  PageMode,
_In_ BOOLEAN  Use6Byte 
)

Definition at line 6798 of file class.c.

6804{
6805 PUCHAR limit;
6806 ULONG parameterHeaderLength;
6807 PVOID result = NULL;
6808
6809 limit = (PUCHAR)ModeSenseBuffer + Length;
6810 parameterHeaderLength = (Use6Byte) ? sizeof(MODE_PARAMETER_HEADER) : sizeof(MODE_PARAMETER_HEADER10);
6811
6812 if (Length >= parameterHeaderLength) {
6813
6814 PMODE_PARAMETER_HEADER10 modeParam10;
6815 ULONG blockDescriptorLength;
6816
6817 /*
6818 * Skip the mode select header and block descriptors.
6819 */
6820 if (Use6Byte){
6821 blockDescriptorLength = ((PMODE_PARAMETER_HEADER) ModeSenseBuffer)->BlockDescriptorLength;
6822 }
6823 else {
6824 modeParam10 = (PMODE_PARAMETER_HEADER10) ModeSenseBuffer;
6825 blockDescriptorLength = modeParam10->BlockDescriptorLength[1];
6826 }
6827
6828 ModeSenseBuffer += parameterHeaderLength + blockDescriptorLength;
6829
6830 //
6831 // ModeSenseBuffer now points at pages. Walk the pages looking for the
6832 // requested page until the limit is reached.
6833 //
6834
6835 while (ModeSenseBuffer +
6837
6838 if (((PMODE_DISCONNECT_PAGE) ModeSenseBuffer)->PageCode == PageMode) {
6839
6840 /*
6841 * found the mode page. make sure it's safe to touch it all
6842 * before returning the pointer to caller
6843 */
6844
6845 if (ModeSenseBuffer + ((PMODE_DISCONNECT_PAGE)ModeSenseBuffer)->PageLength > (PCHAR)limit) {
6846 /*
6847 * Return NULL since the page is not safe to access in full
6848 */
6849 result = NULL;
6850 }
6851 else {
6852 result = ModeSenseBuffer;
6853 }
6854 break;
6855 }
6856
6857 //
6858 // Advance to the next page which is 4-byte-aligned offset after this page.
6859 //
6860 ModeSenseBuffer +=
6861 ((PMODE_DISCONNECT_PAGE) ModeSenseBuffer)->PageLength +
6863
6864 }
6865 }
6866
6867 return result;
6868} // end ClassFindModePage()
_In_ size_t _In_ UCHAR _In_ BOOLEAN Use6Byte
Definition: cdrom.h:1328
_In_ size_t _In_ UCHAR PageMode
Definition: cdrom.h:1326
_In_ ULONG _In_ UCHAR PageCode
Definition: cdrom.h:1317
struct _MODE_PARAMETER_HEADER10 MODE_PARAMETER_HEADER10
struct _MODE_PARAMETER_HEADER10 * PMODE_PARAMETER_HEADER10
struct _MODE_PARAMETER_HEADER * PMODE_PARAMETER_HEADER
GLint limit
Definition: glext.h:10326
GLuint64EXT * result
Definition: glext.h:11304
unsigned char * PUCHAR
Definition: retypes.h:3
#define PCHAR
Definition: match.c:90
#define RTL_SIZEOF_THROUGH_FIELD(type, field)
Definition: ntbasedef.h:672
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
struct _MODE_DISCONNECT_PAGE * PMODE_DISCONNECT_PAGE
UCHAR BlockDescriptorLength[2]
Definition: cdrw_hw.h:2516

Referenced by ClasspWriteCacheProperty(), ClasspZeroQERR(), DetermineDriveType(), DiskGetCacheInformation(), DiskGetInfoExceptionInformation(), DiskGetModePage(), DiskInfoExceptionComplete(), DiskSetCacheInformation(), and FormatMedia().

◆ ClassForwardIrpSynchronous()

SCSIPORT_API NTSTATUS NTAPI ClassForwardIrpSynchronous ( _In_ PCOMMON_DEVICE_EXTENSION  CommonExtension,
_In_ PIRP  Irp 
)

Definition at line 11343 of file class.c.

11347{
11349 return ClassSendIrpSynchronous(CommonExtension->LowerDeviceObject, Irp);
11350} // end ClassForwardIrpSynchronous()
NTSTATUS NTAPI ClassSendIrpSynchronous(_In_ PDEVICE_OBJECT TargetDeviceObject, _In_ PIRP Irp)
Definition: class.c:11373

Referenced by ClassDispatchPnp(), ClasspAccessAlignmentProperty(), ClasspDeviceSeekPenaltyProperty(), ClasspDeviceTrimProcess(), ClasspDeviceTrimProperty(), and ClasspPriorityHint().

◆ ClassGetVpb()

SCSIPORT_API PVPB NTAPI ClassGetVpb ( _In_ PDEVICE_OBJECT  DeviceObject)

Definition at line 11473 of file class.c.

11476{
11477#ifdef _MSC_VER
11478#pragma prefast(suppress:28175)
11479#endif
11480 return DeviceObject->Vpb;
11481} // end ClassGetVpb()

Referenced by ClassInterpretSenseInfo(), ClassMinimalPowerHandler(), and ClasspInterpretGesnData().

◆ ClassInternalIoControl()

SCSIPORT_API NTSTATUS NTAPI ClassInternalIoControl ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

◆ ClassInterpretSenseInfo()

SCSIPORT_API BOOLEAN NTAPI ClassInterpretSenseInfo ( _In_ PDEVICE_OBJECT  DeviceObject,
_In_ PSCSI_REQUEST_BLOCK  Srb,
_In_ UCHAR  MajorFunctionCode,
_In_ ULONG  IoDeviceCode,
_In_ ULONG  RetryCount,
_Out_ NTSTATUS Status,
_Out_opt_ _Deref_out_range_(0, 100) ULONG RetryInterval 
)

Definition at line 4452 of file class.c.

4461{
4462 PFUNCTIONAL_DEVICE_EXTENSION fdoExtension = Fdo->DeviceExtension;
4463 PCLASS_PRIVATE_FDO_DATA fdoData = fdoExtension->PrivateFdoData;
4465 PVOID senseBuffer = SrbGetSenseInfoBuffer(Srb);
4466 BOOLEAN retry = TRUE;
4467 BOOLEAN logError = FALSE;
4468 BOOLEAN unhandledError = FALSE;
4469 BOOLEAN incrementErrorCount = FALSE;
4470
4471 //
4472 // NOTE: This flag must be used only for read/write requests that
4473 // fail with a unexpected retryable error.
4474 //
4475 BOOLEAN logRetryableError = TRUE;
4476
4477 //
4478 // Indicates if we should log this error in our internal log.
4479 //
4480 BOOLEAN logErrorInternal = TRUE;
4481
4482 ULONGLONG badSector = 0;
4483 ULONG uniqueId = 0;
4484
4485 NTSTATUS logStatus;
4486
4487 ULONGLONG readSector;
4488 ULONG index;
4489
4490 ULONG retryInterval = 0;
4491 KIRQL oldIrql;
4492 PCDB cdb = SrbGetCdb(Srb);
4493 UCHAR cdbOpcode = 0;
4494 ULONG cdbLength = SrbGetCdbLength(Srb);
4495
4496#if DBG
4497 BOOLEAN isReservationConflict = FALSE;
4498#endif
4499
4500 if (cdb) {
4501 cdbOpcode = cdb->CDB6GENERIC.OperationCode;
4502 }
4503
4505 logStatus = -1;
4506
4508
4509 //
4510 // Log anything remotely incorrect about paging i/o
4511 //
4512
4513 logError = TRUE;
4514 uniqueId = 301;
4515 logStatus = IO_WARNING_PAGING_FAILURE;
4516 }
4517
4518 //
4519 // Check that request sense buffer is valid.
4520 //
4521
4522 NT_ASSERT(fdoExtension->CommonExtension.IsFdo);
4523
4524
4525 //
4526 // must handle the SRB_STATUS_INTERNAL_ERROR case first,
4527 // as it has all the flags set.
4528 //
4529
4531
4532 TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_GENERAL,
4533 "ClassInterpretSenseInfo: Internal Error code is %x\n",
4535
4536 retry = FALSE;
4538
4540
4541 //
4542 // Need to reserve STATUS_DEVICE_BUSY to convey reservation conflict
4543 // for read/write requests as there are upper level components that
4544 // have built-in assumptions that STATUS_DEVICE_BUSY implies reservation
4545 // conflict.
4546 //
4548 retry = FALSE;
4549 logError = FALSE;
4550#if DBG
4551 isReservationConflict = TRUE;
4552#endif
4553
4554 } else {
4555
4557
4558 if ((Srb->SrbStatus & SRB_STATUS_AUTOSENSE_VALID) && senseBuffer) {
4559
4560 UCHAR errorCode = 0;
4561 UCHAR senseKey = 0;
4562 UCHAR addlSenseCode = 0;
4563 UCHAR addlSenseCodeQual = 0;
4564 BOOLEAN isIncorrectLengthValid = FALSE;
4565 BOOLEAN incorrectLength = FALSE;
4566 BOOLEAN isInformationValid = FALSE;
4568
4569
4570 validSense = ScsiGetSenseKeyAndCodes(senseBuffer,
4573 &senseKey,
4574 &addlSenseCode,
4575 &addlSenseCodeQual);
4576
4577 if (!validSense && !IsSenseDataFormatValueValid(senseBuffer)) {
4578
4580
4581 validSense = ScsiGetFixedSenseKeyAndCodes(senseBuffer,
4583 &senseKey,
4584 &addlSenseCode,
4585 &addlSenseCodeQual);
4586 }
4587
4588 if (!validSense) {
4589 goto __ClassInterpretSenseInfo_ProcessingInvalidSenseBuffer;
4590 }
4591
4592 errorCode = ScsiGetSenseErrorCode(senseBuffer);
4593
4594 TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_GENERAL, "ClassInterpretSenseInfo: Error code is %x\n", errorCode));
4595 TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_GENERAL, "ClassInterpretSenseInfo: Sense key is %x\n", senseKey));
4596 TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_GENERAL, "ClassInterpretSenseInfo: Additional sense code is %x\n", addlSenseCode));
4597 TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_GENERAL, "ClassInterpretSenseInfo: Additional sense code qualifier is %x\n", addlSenseCodeQual));
4598
4599 if (IsDescriptorSenseDataFormat(senseBuffer)) {
4600
4601 //
4602 // Sense data in Descriptor format
4603 //
4604
4605 PVOID startBuffer = NULL;
4606 UCHAR startBufferLength = 0;
4607
4608
4609 if (ScsiGetSenseDescriptor(senseBuffer,
4611 &startBuffer,
4612 &startBufferLength)) {
4613 UCHAR outType;
4615 UCHAR outBufferLength = 0;
4616 BOOLEAN foundBlockCommandType = FALSE;
4617 BOOLEAN foundInformationType = FALSE;
4619
4622
4623 while ((!foundBlockCommandType || !foundInformationType) &&
4624 ScsiGetNextSenseDescriptorByType(startBuffer,
4625 startBufferLength,
4626 typeList,
4627 ARRAYSIZE(typeList),
4628 &outType,
4629 &outBuffer,
4630 &outBufferLength)) {
4631
4633
4634 if (outBufferLength < descriptorLength) {
4635
4636 // Descriptor data is truncated.
4637 // Complete searching descriptors. Exit the loop now.
4638 break;
4639 }
4640
4642
4643 //
4644 // Block Command type
4645 //
4646
4647 if (!foundBlockCommandType) {
4648
4649 foundBlockCommandType = TRUE;
4650
4651 if (ScsiValidateBlockCommandSenseDescriptor(outBuffer, outBufferLength)) {
4652 incorrectLength = ((PSCSI_SENSE_DESCRIPTOR_BLOCK_COMMAND)outBuffer)->IncorrectLength;
4653 isIncorrectLengthValid = TRUE;
4654 }
4655 } else {
4656
4657 //
4658 // A Block Command descriptor is already found earlier.
4659 //
4660 // T10 SPC specification only allows one descriptor for Block Command Descriptor type.
4661 // Assert here to catch devices that violate this rule. Ignore this descriptor.
4662 //
4664 }
4665
4666 } else if (outType == SCSI_SENSE_DESCRIPTOR_TYPE_INFORMATION) {
4667
4668 //
4669 // Information type
4670 //
4671
4672 if (!foundInformationType) {
4673
4674 foundInformationType = TRUE;
4675
4676 if (ScsiValidateInformationSenseDescriptor(outBuffer, outBufferLength)) {
4678 isInformationValid = TRUE;
4679 }
4680 } else {
4681
4682 //
4683 // A Information descriptor is already found earlier.
4684 //
4685 // T10 SPC specification only allows one descriptor for Information Descriptor type.
4686 // Assert here to catch devices that violate this rule. Ignore this descriptor.
4687 //
4689 }
4690
4691 } else {
4692
4693 //
4694 // ScsiGetNextDescriptorByType should only return a type that is specified by us.
4695 //
4697 break;
4698 }
4699
4700 //
4701 // Advance to start address of next descriptor
4702 //
4703 startBuffer = (PUCHAR)outBuffer + descriptorLength;
4704 startBufferLength = outBufferLength - descriptorLength;
4705 }
4706 }
4707 } else {
4708
4709 //
4710 // Sense data in Fixed format
4711 //
4712
4713 incorrectLength = ((PFIXED_SENSE_DATA)(senseBuffer))->IncorrectLength;
4715 isInformationValid = TRUE;
4716 isIncorrectLengthValid = TRUE;
4717 }
4718
4719
4720 switch (senseKey) {
4721
4722 case SCSI_SENSE_NO_SENSE: {
4723
4724 //
4725 // Check other indicators.
4726 //
4727
4728 if (isIncorrectLengthValid && incorrectLength) {
4729
4730 TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL, "ClassInterpretSenseInfo: "
4731 "Incorrect length detected.\n"));
4733 retry = FALSE;
4734
4735 } else {
4736
4737 TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_GENERAL, "ClassInterpretSenseInfo: "
4738 "No specific sense key\n"));
4740 retry = TRUE;
4741 }
4742
4743 break;
4744 } // end SCSI_SENSE_NO_SENSE
4745
4747
4748 TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL, "ClassInterpretSenseInfo: "
4749 "Recovered error\n"));
4751 retry = FALSE;
4752 logError = TRUE;
4753 uniqueId = 258;
4754
4755 switch(addlSenseCode) {
4758 logStatus = IO_ERR_SEEK_ERROR;
4759 break;
4760 }
4761
4764 logStatus = IO_RECOVERED_VIA_ECC;
4765 break;
4766 }
4767
4769
4770 UCHAR wmiEventData[sizeof(ULONG)+sizeof(UCHAR)] = {0};
4771
4772 *((PULONG)wmiEventData) = sizeof(UCHAR);
4773 wmiEventData[sizeof(ULONG)] = addlSenseCodeQual;
4774
4775 //
4776 // Don't log another eventlog if we have already logged once
4777 // NOTE: this should have been interlocked, but the structure
4778 // was publicly defined to use a BOOLEAN (char). Since
4779 // media only reports these errors once per X minutes,
4780 // the potential race condition is nearly non-existant.
4781 // the worst case is duplicate log entries, so ignore.
4782 //
4783
4784 logError = FALSE;
4785 if (fdoExtension->FailurePredicted == 0) {
4786 logError = TRUE;
4787 }
4788 fdoExtension->FailureReason = addlSenseCodeQual;
4789 logStatus = IO_WRN_FAILURE_PREDICTED;
4790
4791 ClassNotifyFailurePredicted(fdoExtension,
4792 (PUCHAR)wmiEventData,
4793 sizeof(wmiEventData),
4794 FALSE, // do not log error
4795 4, // unique error value
4798 SrbGetLun(Srb));
4799
4800 fdoExtension->FailurePredicted = TRUE;
4801 break;
4802 }
4803
4804 default: {
4805 logStatus = IO_ERR_CONTROLLER_ERROR;
4806 break;
4807 }
4808
4809 } // end switch(addlSenseCode)
4810
4811 if (isIncorrectLengthValid && incorrectLength) {
4812
4813 TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL, "ClassInterpretSenseInfo: "
4814 "Incorrect length detected.\n"));
4816 }
4817
4818
4819 break;
4820 } // end SCSI_SENSE_RECOVERED_ERROR
4821
4822 case SCSI_SENSE_NOT_READY: {
4823
4824 TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_GENERAL, "ClassInterpretSenseInfo: "
4825 "Device not ready\n"));
4827
4828 switch (addlSenseCode) {
4829
4831
4832 TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_GENERAL, "ClassInterpretSenseInfo: "
4833 "Lun not ready\n"));
4834
4835 retryInterval = NOT_READY_RETRY_INTERVAL;
4836
4837 switch (addlSenseCodeQual) {
4838
4840 DEVICE_EVENT_BECOMING_READY notReady = {0};
4841
4842 logRetryableError = FALSE;
4843 TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL, "ClassInterpretSenseInfo: "
4844 "In process of becoming ready\n"));
4845
4846 notReady.Version = 1;
4847 notReady.Reason = 1;
4848 notReady.Estimated100msToReady = retryInterval * 10;
4849 ClassSendNotification(fdoExtension,
4850 &GUID_IO_DEVICE_BECOMING_READY,
4852 &notReady);
4853 break;
4854 }
4855
4857 TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL, "ClassInterpretSenseInfo: "
4858 "Manual intervention required\n"));
4860 retry = FALSE;
4861 break;
4862 }
4863
4865 TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL, "ClassInterpretSenseInfo: "
4866 "Format in progress\n"));
4867 retry = FALSE;
4868 break;
4869 }
4870
4872 DEVICE_EVENT_BECOMING_READY notReady = {0};
4873
4874 logRetryableError = FALSE;
4875 TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL, "ClassInterpretSenseInfo: "
4876 "Operation In Progress\n"));
4877
4878 notReady.Version = 1;
4879 notReady.Reason = 2;
4880 notReady.Estimated100msToReady = retryInterval * 10;
4881 ClassSendNotification(fdoExtension,
4882 &GUID_IO_DEVICE_BECOMING_READY,
4884 &notReady);
4885
4886 break;
4887 }
4888
4890 TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_GENERAL, "ClassInterpretSenseInfo: "
4891 "Long write in progress\n"));
4892 //
4893 // This has been seen as a transcient failure on some cdrom
4894 // drives. The cdrom class driver is going to override this
4895 // setting but has no way of dropping the retry interval
4896 //
4897 retry = FALSE;
4898 retryInterval = 1;
4899 break;
4900 }
4901
4903 logRetryableError = FALSE;
4904 TracePrint((TRACE_LEVEL_VERBOSE<