40DeviceInitAllocateBuffers(
46DeviceRetrieveScsiAddress(
53DeviceRetrieveDescriptorsAndTransferLength(
59DeviceScanSpecialDevices(
71DeviceGetMmcSupportInfo(
76#if (NTDDI_VERSION >= NTDDI_WIN8)
88#pragma alloc_text(PAGE, DeviceClaimRelease)
89#pragma alloc_text(PAGE, DeviceEvtSelfManagedIoInit)
91#pragma alloc_text(PAGE, DeviceInitReleaseQueueContext)
92#pragma alloc_text(PAGE, DeviceInitAllocateBuffers)
93#pragma alloc_text(PAGE, DeviceInitPowerContext)
94#pragma alloc_text(PAGE, DeviceCreateWellKnownName)
95#pragma alloc_text(PAGE, DeviceRetrieveScsiAddress)
96#pragma alloc_text(PAGE, DeviceRetrieveDescriptorsAndTransferLength)
97#pragma alloc_text(PAGE, DeviceInitializeHotplugInfo)
98#pragma alloc_text(PAGE, DeviceScanSpecialDevices)
99#pragma alloc_text(PAGE, DeviceGetTimeOutValueFromRegistry)
100#pragma alloc_text(PAGE, DeviceGetMmcSupportInfo)
101#pragma alloc_text(PAGE, DeviceRetrieveDescriptor)
102#pragma alloc_text(PAGE, DeviceRetrieveHackFlagsFromRegistry)
103#pragma alloc_text(PAGE, DeviceScanForSpecial)
104#pragma alloc_text(PAGE, DeviceHackFlagsScan)
105#pragma alloc_text(PAGE, DeviceInitMmcContext)
106#pragma alloc_text(PAGE, ScanForSpecialHandler)
107#pragma alloc_text(PAGE, DeviceSetRawReadInfo)
108#pragma alloc_text(PAGE, DeviceInitializeDvd)
109#pragma alloc_text(PAGE, DeviceCacheDeviceInquiryData)
111#if (NTDDI_VERSION >= NTDDI_WIN8)
112#pragma alloc_text(PAGE, DeviceIsPortable)
118#pragma warning(disable:4152)
119#pragma warning(disable:26000)
159 status = WdfRequestCreate(&attributes,
160 DeviceExtension->IoTarget,
180 status = WdfIoTargetSendInternalIoctlOthersSynchronously(DeviceExtension->IoTarget,
197 "DeviceClaimRelease: Failed to %s device, status: 0x%X\n",
205 "DeviceClaimRelease: Failed to create request, status: 0x%X\n",
249 "DeviceEvtSelfManagedIoInit: WDFDEVICE %p is being started.\n",
252 deviceExtension = DeviceGetExtension(
Device);
258 (
VOID) DeviceRetrieveScsiAddress(deviceExtension, &deviceExtension->
ScsiAddress);
263 status = DeviceRetrieveDescriptorsAndTransferLength(deviceExtension);
270 status = DeviceInitAllocateBuffers(deviceExtension);
282 DeviceGetParameter(deviceExtension,
295 DeviceRetrieveHackFlagsFromRegistry(deviceExtension);
297 DeviceScanForSpecial(deviceExtension,
CdRomBadItems, DeviceHackFlagsScan);
299 DeviceScanSpecialDevices(deviceExtension);
306 status = DeviceInitializeHotplugInfo(deviceExtension);
312 status = DeviceCacheDeviceInquiryData(deviceExtension);
316 "Failed to cache the device's inquiry data, failng %!STATUS!\n",
325 status = DeviceInitializeMediaChangeDetection(deviceExtension);
329 status = DeviceInitMmcContext(deviceExtension);
333 status = DeviceInitializeZPODD(deviceExtension);
383 DeviceEnableMainTimer(deviceExtension);
387#if (NTDDI_VERSION >= NTDDI_WIN8)
398 status = DeviceIsPortable(deviceExtension, &isPortable);
409 &DEVPKEY_Storage_Portable,
422 &DEVPKEY_Storage_Removable_Media,
440 &DEVPKEY_Storage_System_Critical,
457DeviceInitReleaseQueueContext(
485 status = WdfRequestCreate(&attributes,
486 DeviceExtension->IoTarget,
487 &(DeviceExtension->ReleaseQueueRequest));
491 TracePrint((
TRACE_LEVEL_ERROR, TRACE_FLAG_PNP,
"Cannot create the release queue request\n"));
498 attributes.
ParentObject = DeviceExtension->ReleaseQueueRequest;
500 status = WdfMemoryCreatePreallocated(&attributes,
501 &DeviceExtension->ReleaseQueueSrb,
503 &DeviceExtension->ReleaseQueueInputMemory);
506 TracePrint((
TRACE_LEVEL_ERROR, TRACE_FLAG_PNP,
"Failed to allocate ReleaseQueueSrb.\n"));
515 status = WdfIoTargetFormatRequestForInternalIoctlOthers(DeviceExtension->IoTarget,
516 DeviceExtension->ReleaseQueueRequest,
518 DeviceExtension->ReleaseQueueInputMemory,
529 WdfRequestSetCompletionRoutine(DeviceExtension->ReleaseQueueRequest,
531 DeviceExtension->Device);
538 status = WdfSpinLockCreate(&attributes,
539 &(DeviceExtension->ReleaseQueueSpinLock));
544 "DeviceInitReleaseQueueContext: Cannot create the release queue spinlock\n"));
550 DeviceExtension->ReleaseQueueNeeded =
FALSE;
551 DeviceExtension->ReleaseQueueInProgress =
FALSE;
559DeviceInitPowerContext(
589 status = WdfRequestCreate(&attributes,
590 DeviceExtension->IoTarget,
591 &(DeviceExtension->PowerContext.PowerRequest) );
595 TracePrint((
TRACE_LEVEL_ERROR, TRACE_FLAG_PNP,
"Cannot create the power request object.\n"));
602 status = WdfIoTargetFormatRequestForInternalIoctlOthers(DeviceExtension->IoTarget,
603 DeviceExtension->PowerContext.PowerRequest,
613DeviceCreateWellKnownName(
638 WCHAR wideLinkName[64] = {0};
641 LONG cdromNumber = DeviceExtension->DeviceNumber;
646 if (DeviceExtension->DeviceAdditionalData.WellKnownName.Buffer !=
NULL)
650 "DeviceCreateWellKnownName: link already exists %p\n",
651 DeviceExtension->DeviceAdditionalData.WellKnownName.Buffer));
664 L"\\DosDevices\\CdRom%d",
669 "DeviceCreateWellKnownName: Format symbolic link failed with error: 0x%X\n",
status));
675 status = WdfDeviceCreateSymbolicLink(DeviceExtension->Device,
686 "DeviceCreateWellKnownName: Error %lx linking %wZ to "
690 &(DeviceExtension->DeviceName)));
695 "DeviceCreateWellKnownName: successfully linked %wZ "
698 &(DeviceExtension->DeviceName)));
706 if (savedName ==
NULL)
711 "DeviceCreateWellKnownName: unable to allocate memory.\n"));
728DeviceRetrieveScsiAddress(
754 if ((DeviceExtension ==
NULL) ||
755 (ScsiAddress ==
NULL))
765 status = WdfIoTargetSendIoctlSynchronously(DeviceExtension->IoTarget,
776 "DeviceRetrieveScsiAddress: Get Address failed %lx\n",
782 "GetAddress: Port %x, Path %x, Target %x, Lun %x\n",
783 ScsiAddress->PortNumber,
785 ScsiAddress->TargetId,
794DeviceInitAllocateBuffers(
820 if (DeviceExtension->PrivateFdoData ==
NULL)
827 if (DeviceExtension->PrivateFdoData ==
NULL)
842 if (senseData ==
NULL)
850 DeviceExtension->SenseData = senseData;
856 if (!ScratchBuffer_Allocate(DeviceExtension))
860 "Failed to allocate scratch buffer, failing %!STATUS!\n",
870DeviceRetrieveDescriptorsAndTransferLength(
900 status = DeviceRetrieveDescriptor(DeviceExtension->Device,
909 status = DeviceRetrieveDescriptor(DeviceExtension->Device,
919 (
void) DeviceRetrieveDescriptor(DeviceExtension->Device,
930 ULONG maxAlignedTransfer = DeviceExtension->AdapterDescriptor->MaximumPhysicalPages;
931 ULONG maxUnalignedTransfer = DeviceExtension->AdapterDescriptor->MaximumPhysicalPages;
935 if (maxUnalignedTransfer > 1)
937 maxUnalignedTransfer--;
944 maxAlignedTransfer = (
ULONG)-1;
953 maxUnalignedTransfer = (
ULONG)-1;
962 maxAlignedTransfer =
min(maxAlignedTransfer, DeviceExtension->AdapterDescriptor->MaximumTransferLength);
963 maxUnalignedTransfer =
min(maxUnalignedTransfer, DeviceExtension->AdapterDescriptor->MaximumTransferLength);
966 maxAlignedTransfer =
max(maxAlignedTransfer,
PAGE_SIZE);
967 maxUnalignedTransfer =
max(maxUnalignedTransfer,
PAGE_SIZE);
970 "Device %p Max aligned/unaligned transfer size is %x/%x\n",
971 DeviceExtension->Device,
975 DeviceExtension->DeviceAdditionalData.MaxPageAlignedTransferBytes = maxAlignedTransfer;
976 DeviceExtension->DeviceAdditionalData.MaxUnalignedTransferBytes = maxUnalignedTransfer;
980 TracePrint((
TRACE_LEVEL_ERROR, TRACE_FLAG_PNP,
"DeviceRetrieveDescriptorsAndTransferLength failed %lx\n",
status));
989DeviceRetrieveDescriptor(
1043 status = WdfIoTargetSendIoctlSynchronously(deviceExtension->
IoTarget,
1053 TracePrint((
TRACE_LEVEL_ERROR, TRACE_FLAG_INIT,
"DeviceRetrieveDescriptor: error %lx trying to "
1054 "query properties #1\n",
status));
1061 TracePrint((
TRACE_LEVEL_ERROR, TRACE_FLAG_INIT,
"DeviceRetrieveDescriptor: size returned was zero?! (status "
1076 TracePrint((
TRACE_LEVEL_ERROR, TRACE_FLAG_INIT,
"DeviceRetrieveDescriptor: unable to memory for descriptor "
1095 status = WdfIoTargetSendIoctlSynchronously(deviceExtension->
IoTarget,
1105 TracePrint((
TRACE_LEVEL_ERROR, TRACE_FLAG_INIT,
"DeviceRetrieveDescriptor: error %lx trying to "
1106 "query properties #1\n",
status));
1120DeviceRetrieveHackFlagsFromRegistry(
1141 WDFKEY hardwareKey =
NULL;
1142 WDFKEY subKey =
NULL;
1143 ULONG deviceHacks = 0;
1150 status = WdfDeviceOpenRegistryKey(DeviceExtension->Device,
1157 status = WdfRegistryOpenKey(hardwareKey,
1165 status = WdfRegistryQueryULong(subKey,
1172 SET_FLAG(DeviceExtension->PrivateFdoData->HackFlags, deviceHacks);
1175 WdfRegistryClose(subKey);
1178 WdfRegistryClose(hardwareKey);
1204VOID DeviceScanForSpecial(
1230 UCHAR nullString[] =
"";
1245 deviceDescriptor = DeviceExtension->DeviceDescriptor;
1248 if (deviceDescriptor->VendorIdOffset != 0 &&
1249 deviceDescriptor->VendorIdOffset != -1)
1251 vendorId = ((
PUCHAR)deviceDescriptor);
1252 vendorId += deviceDescriptor->VendorIdOffset;
1256 vendorId = nullString;
1259 if (deviceDescriptor->ProductIdOffset != 0 &&
1260 deviceDescriptor->ProductIdOffset != -1)
1262 productId = ((
PUCHAR)deviceDescriptor);
1263 productId += deviceDescriptor->ProductIdOffset;
1267 productId = nullString;
1270 if (deviceDescriptor->ProductRevisionOffset != 0 &&
1271 deviceDescriptor->ProductRevisionOffset != -1)
1273 productRevision = ((
PUCHAR)deviceDescriptor);
1274 productRevision += deviceDescriptor->ProductRevisionOffset;
1278 productRevision = nullString;
1288 StringsAreMatched(
DeviceList->ProductRevision, (
LPSTR)productRevision)
1293 "controller Ven: %s Prod: %s Rev: %s\n",
1303 "completed callback\n"));
1311 DeviceExtension->DeviceObject));
1327 SET_FLAG(DeviceExtension->PrivateFdoData->HackFlags,
Data);
1335DeviceInitializeHotplugInfo(
1359 ULONG resultLength = 0;
1360 ULONG writeCacheOverride;
1371 if (DeviceExtension->DeviceDescriptor->RemovableMedia)
1398 status = WdfDeviceQueryProperty(DeviceExtension->Device,
1401 (
PVOID)&deviceRemovalPolicy,
1423 DeviceGetParameter(DeviceExtension,
1426 (
PULONG)&userRemovalPolicy);
1433 deviceRemovalPolicy = userRemovalPolicy;
1453 writeCacheOverride =
FALSE;
1454 DeviceGetParameter(DeviceExtension,
1457 &writeCacheOverride);
1459 if (writeCacheOverride)
1480DeviceInitMmcContext(
1507 DeviceExtension->DeviceAdditionalData.Mmc.IsMmc =
FALSE;
1508 DeviceExtension->DeviceAdditionalData.Mmc.IsAACS =
FALSE;
1509 DeviceExtension->DeviceAdditionalData.Mmc.IsWriter =
FALSE;
1510 DeviceExtension->DeviceAdditionalData.Mmc.WriteAllowed =
FALSE;
1511 DeviceExtension->DeviceAdditionalData.Mmc.IsCssDvd =
FALSE;
1517 status = DeviceGetMmcSupportInfo(DeviceExtension,
1518 &DeviceExtension->DeviceAdditionalData.Mmc.IsMmc);
1525 "DeviceInitMmcContext: Failed to get the support info for GET CONFIGURATION "
1526 "command, failng %!STATUS!\n",
status
1529 DeviceExtension->DeviceAdditionalData.Mmc.IsMmc =
FALSE;
1540 status = DeviceAllocateMmcResources(DeviceExtension->Device);
1547 ULONG blockingFactor;
1550 "DeviceInitMmcContext: FDO %p GET CONFIGURATION buffer %p\n",
1551 DeviceExtension->Device,
1552 DeviceExtension->DeviceAdditionalData.Mmc.CapabilitiesBuffer
1558 DevicePrintAllFeaturePages(DeviceExtension->DeviceAdditionalData.Mmc.CapabilitiesBuffer,
1559 DeviceExtension->DeviceAdditionalData.Mmc.CapabilitiesBufferSize);
1562 header = DeviceFindFeaturePage(DeviceExtension->DeviceAdditionalData.Mmc.CapabilitiesBuffer,
1563 DeviceExtension->DeviceAdditionalData.Mmc.CapabilitiesBufferSize,
1568 "DeviceInitMmcContext: Reporting AACS support for device due to "
1569 "GET CONFIGURATION showing support\n"
1571 DeviceExtension->DeviceAdditionalData.Mmc.IsAACS =
TRUE;
1574#ifdef ENABLE_AACS_TESTING
1575 DeviceExtension->DeviceAdditionalData.Mmc.IsAACS =
TRUE;
1579 header = DeviceFindFeaturePage(DeviceExtension->DeviceAdditionalData.Mmc.CapabilitiesBuffer,
1580 DeviceExtension->DeviceAdditionalData.Mmc.CapabilitiesBufferSize,
1584 DeviceExtension->DeviceAdditionalData.DriveDeviceType =
FILE_DEVICE_DVD;
1588 DeviceUpdateMmcWriteCapability(DeviceExtension->DeviceAdditionalData.Mmc.CapabilitiesBuffer,
1589 DeviceExtension->DeviceAdditionalData.Mmc.CapabilitiesBufferSize,
1591 (
PBOOLEAN)&(DeviceExtension->DeviceAdditionalData.Mmc.IsWriter),
1596 header = DeviceFindFeaturePage(DeviceExtension->DeviceAdditionalData.Mmc.CapabilitiesBuffer,
1597 DeviceExtension->DeviceAdditionalData.Mmc.CapabilitiesBufferSize,
1600 DeviceExtension->DeviceAdditionalData.Mmc.IsCssDvd = (
header !=
NULL) && (
header->Current);
1610 DeviceSetRawReadInfo(DeviceExtension);
1614 if (!(DeviceExtension->DeviceAdditionalData.Mmc.IsMmc))
1616 ULONG deviceCharacteristics = WdfDeviceGetCharacteristics(DeviceExtension->Device);
1620 WdfDeviceSetCharacteristics(DeviceExtension->Device, deviceCharacteristics);
1623 "DeviceInitMmcContext: FDO %p Device is not an MMC compliant device, so setting "
1624 "to read-only (legacy) mode",
1625 DeviceExtension->Device
1630 if (DeviceExtension->DeviceAdditionalData.DriveDeviceType ==
FILE_DEVICE_DVD)
1633 "DeviceInitMmcContext: DVD Devices require START UNIT\n"));
1637 else if ((DeviceExtension->DeviceDescriptor->BusType !=
BusTypeScsi) &&
1638 (DeviceExtension->DeviceDescriptor->BusType !=
BusTypeAtapi) &&
1644 "DeviceInitMmcContext: Devices for newer buses require START UNIT\n"));
1654DeviceGetTimeOutValueFromRegistry()
1672 WDFKEY registryKey =
NULL;
1673 ULONG timeOutValue = 0;
1687 status = WdfRegistryQueryULong(registryKey,
1691 WdfRegistryClose(registryKey);
1699 return timeOutValue;
1706DeviceScanSpecialDevices(
1730 DeviceScanForSpecial(DeviceExtension,
CdromHackItems, ScanForSpecialHandler);
1752 "DeviceScanSpecialDevices: Found Toshiba SD-W1101 DVD-RAM "
1753 "-- This drive will *NOT* support DVD-ROM playback.\n"));
1758 "DeviceScanSpecialDevices: Found Hitachi GD-2000\n"));
1776 DeviceExtension->TimeOutValue = 20;
1786 "DeviceScanSpecialDevices: Found DEC RRD.\n"));
1788 DeviceExtension->DeviceAdditionalData.IsDecRrd =
TRUE;
1802 if (modeParameters ==
NULL)
1828 status = DeviceSendSrbSynchronously(DeviceExtension->Device,
1838 "DeviceScanSpecialDevices: Setting DEC RRD to 2K block"
1839 "size failed [%x]\n",
status));
1850ScanForSpecialHandler(
1859 DeviceExtension->DeviceAdditionalData.HackFlags =
HackFlags;
1867DeviceCacheDeviceInquiryData(
1902 static const UCHAR minInquiryAdditionalLength =
1914 if (DeviceExtension->DeviceAdditionalData.CachedInquiryData !=
NULL)
1916 NT_ASSERT(DeviceExtension->DeviceAdditionalData.CachedInquiryDataByteCount != 0);
1924 requestedInquiryTransferBytes,
1926 if (tmpInquiry ==
NULL)
1936 cdb->
AsByte[3] = (
UCHAR)( requestedInquiryTransferBytes >> (8*1) );
1937 cdb->
AsByte[4] = (
UCHAR)( requestedInquiryTransferBytes >> (8*0) );
1939 status = DeviceSendSrbSynchronously(DeviceExtension->Device,
1942 requestedInquiryTransferBytes,
1955 needResendCommand =
FALSE;
1963 portDriverHack =
TRUE;
1966 requestedInquiryTransferBytes =
1972 needResendCommand =
TRUE;
1976 needResendCommand =
FALSE;
1992 requestedInquiryTransferBytes,
1994 if (tmpInquiry ==
NULL)
2005 cdb->
AsByte[3] = (
UCHAR)( requestedInquiryTransferBytes >> (8*1) );
2006 cdb->
AsByte[4] = (
UCHAR)( requestedInquiryTransferBytes >> (8*0) );
2008 status = DeviceSendSrbSynchronously( DeviceExtension->Device,
2011 requestedInquiryTransferBytes,
2030 requestedInquiryTransferBytes,
2032 if (tmpInquiry ==
NULL)
2040 cdb->
AsByte[3] = (
UCHAR)( requestedInquiryTransferBytes >> (8*1) );
2041 cdb->
AsByte[4] = (
UCHAR)( requestedInquiryTransferBytes >> (8*0) );
2043 status = DeviceSendSrbSynchronously(DeviceExtension->Device,
2046 requestedInquiryTransferBytes,
2075 for ( ;
i != 0;
i--)
2095 DeviceExtension->DeviceAdditionalData.CachedInquiryData = tmpInquiry;
2096 DeviceExtension->DeviceAdditionalData.CachedInquiryDataByteCount = requestedInquiryTransferBytes;
2108DeviceGetMmcSupportInfo(
2131 ULONG previouslyFailed;
2135 *IsMmcDevice =
FALSE;
2139 previouslyFailed =
FALSE;
2140 DeviceGetParameter(DeviceExtension,
2145 if (previouslyFailed)
2151 previouslyFailed =
FALSE;
2152 DeviceGetParameter(DeviceExtension,
2157 if (previouslyFailed)
2169 status = DeviceGetConfiguration(DeviceExtension->Device,
2182 "GetConfiguration Failed (%x), device %p not mmc-compliant\n",
2183 status, DeviceExtension->DeviceObject
2186 previouslyFailed =
TRUE;
2187 DeviceSetParameter( DeviceExtension,
2197 "GetConfiguration Failed, status %x -- defaulting to -ROM\n",
2205 "GetConfiguration Failed, returned only %x bytes!\n", usable));
2206 previouslyFailed =
TRUE;
2207 DeviceSetParameter( DeviceExtension,
2224 "GetConfiguration Failed, claims MMC support but doesn't "
2225 "correctly return config length! (%x)\n",
2228 previouslyFailed =
TRUE;
2229 DeviceSetParameter( DeviceExtension,
2236 else if ((
size % 4) != 0)
2238 if ((
size % 2) != 0)
2241 "GetConfiguration Failed, returned odd number of bytes %x!\n",
2244 previouslyFailed =
TRUE;
2245 DeviceSetParameter( DeviceExtension,
2261 "GetConfiguration returned a size that is not per spec (%x bytes), this is probably because of a vendor specific data header with a size not divisible by 4.\n",
2264 previouslyFailed =
TRUE;
2265 DeviceSetParameter(DeviceExtension,
2276 *IsMmcDevice =
TRUE;
2292 if (configBuffer ==
NULL)
2299 previouslyFailed =
FALSE;
2300 DeviceGetParameter( DeviceExtension,
2305 if (previouslyFailed)
2313 status = DeviceGetConfiguration(DeviceExtension->Device,
2323 "Type One GetConfiguration Failed. Usable buffer size: %d\n", usable));
2324 previouslyFailed =
TRUE;
2329 ULONG totalAvailableBytes = 0;
2330 ULONG expectedAvailableBytes = 0;
2340 if (totalAvailableBytes > expectedAvailableBytes)
2346 "Type One GetConfiguration Failed. "
2347 "Device returned %d bytes instead of %d bytes\n",
2348 size, featureSize));
2350 previouslyFailed =
TRUE;
2356 if (previouslyFailed ==
TRUE)
2358 DeviceSetParameter( DeviceExtension,
2373DeviceSetRawReadInfo(
2409 cdReadHeader = DeviceFindFeaturePage(DeviceExtension->DeviceAdditionalData.Mmc.CapabilitiesBuffer,
2410 DeviceExtension->DeviceAdditionalData.Mmc.CapabilitiesBufferSize,
2413 if ((cdReadHeader !=
NULL) &&
2419 "DeviceSetRawReadInfo: FDO %p GET_CONFIG shows ability to read C2 error bits\n",
2420 DeviceExtension->DeviceObject
2422 DeviceExtension->DeviceAdditionalData.Mmc.ReadCdC2Pointers =
TRUE;
2471 "DeviceSetRawReadInfo: cannot allocate "
2472 "buffer, so not setting raw read info for FDO %p\n",
2473 DeviceExtension->DeviceObject
2481 status = DeviceSendSrbSynchronously(DeviceExtension->Device,
2500 (
p->BlockDescriptorLength[0] * 256) +
2501 p->BlockDescriptorLength[1]);
2508 p->BlockDescriptorLength);
2512 "DeviceSetRawReadInfo: FDO %p CDVD Capabilities buffer %p\n",
2513 DeviceExtension->DeviceObject,
2522 "DeviceSetRawReadInfo: FDO %p supports C2 error bits in READ_CD command\n",
2523 DeviceExtension->DeviceObject
2525 DeviceExtension->DeviceAdditionalData.Mmc.ReadCdC2Pointers =
TRUE;
2531 "DeviceSetRawReadInfo: FDO %p supports raw subcode in READ_CD command\n",
2532 DeviceExtension->DeviceObject
2534 DeviceExtension->DeviceAdditionalData.Mmc.ReadCdSubCode =
TRUE;
2542 "DeviceSetRawReadInfo: FDO %p failed %x byte mode sense, status %x\n",
2543 DeviceExtension->DeviceObject,
2544 (((
count/3) == 0) ? 10 : 6),
2554 "DeviceSetRawReadInfo: FDO %p couldn't get mode sense data\n",
2555 DeviceExtension->DeviceObject
2597 ULONG bufferLen = 0;
2598 size_t bytesReturned;
2602 deviceExtension = DeviceGetExtension(
Device);
2616 if (copyProtectKey ==
NULL)
2627 status = DvdStartSessionReadKey(deviceExtension,
2644 "DVD Initialize (%p): must choose DVD region\n",
2651 DevicePickDvdRegion(
Device);
2663#if (NTDDI_VERSION >= NTDDI_WIN8)
2696 *IsPortable =
FALSE;
2699 status = IoGetDevicePropertyData(DeviceExtension->LowerPdo,
2700 &DEVPKEY_Device_InLocalMachineContainer,
2725 if (DeviceExtension->DeviceDescriptor->BusType ==
BusTypeFibre ||
2726 DeviceExtension->DeviceDescriptor->BusType ==
BusTypeiScsi ||
2727 DeviceExtension->DeviceDescriptor->BusType ==
BusTypeRAID)
2732 *IsPortable = isPortable;
VOID DeviceSetMediaChangeStateEx(_In_ PCDROM_DEVICE_EXTENSION DeviceExtension, _In_ MEDIA_CHANGE_DETECTION_STATE NewState, _Inout_opt_ PMEDIA_CHANGE_DETECTION_STATE OldState)
NTSTATUS DeviceErrorHandlerForMmc(_In_ PCDROM_DEVICE_EXTENSION DeviceExtension, _In_ PSCSI_REQUEST_BLOCK Srb, _Inout_ PNTSTATUS Status, _Inout_ PBOOLEAN Retry)
#define DEV_SAFE_START_UNIT
VOID(* PCDROM_SCAN_FOR_SPECIAL_HANDLER)(_In_ PCDROM_DEVICE_EXTENSION DeviceExtension, _In_ ULONG_PTR Data)
#define CDROM_HACK_INVALID_FLAGS
#define FREE_POOL(_PoolPtr)
#define CDROM_HACK_BAD_TYPE_ONE_GET_CONFIG
#define CdromMmcUpdateRequired
#define CDROM_TAG_GET_CONFIG
#define CDROM_HACK_BAD_GET_CONFIG_SUPPORT
#define CDROM_TYPE_ONE_GET_CONFIG_NAME
_In_ PSTORAGE_PROPERTY_ID PropertyId
#define CDROM_HACK_HITACHI_GD_2000
#define CDROM_HACK_TOSHIBA_SD_W1101
#define CDROM_HACK_FUJITSU_FMCD_10x
#define CDROM_HACK_DEC_RRD
CDROM_SCAN_FOR_SPECIAL_INFO CdromHackItems[]
#define CDROM_HACK_BAD_VENDOR_PROFILES
EVT_WDF_DEVICE_SELF_MANAGED_IO_INIT DeviceEvtSelfManagedIoInit
#define DVD_TAG_RPC2_CHECK
_In_ ULONG _In_opt_ WDFREQUEST _In_opt_ PVOID _In_ size_t _In_ PVOID _In_ size_t _Out_ size_t * DataLength
_In_ CDROM_SCAN_FOR_SPECIAL_INFO _In_ PCDROM_SCAN_FOR_SPECIAL_HANDLER Function
EVT_WDF_REQUEST_COMPLETION_ROUTINE DeviceReleaseQueueCompletion
#define CDROM_TAG_INQUIRY
#define CDROM_NON_MMC_DRIVE_NAME
#define CDROM_TAG_MODE_DATA
#define TEST_FLAG(Flags, Bit)
#define CLEAR_FLAG(Flags, Bit)
#define SCSI_CDROM_OPC_TIMEOUT
#define CDROM_NON_MMC_VENDOR_SPECIFIC_PROFILE
#define HITACHI_MODE_DATA_SIZE
#define SET_FLAG(Flags, Bit)
#define CDROM_SUBKEY_NAME
#define CDROM_TAG_STRINGS
#define CDROM_TAG_DESCRIPTOR
NTSTATUS DeviceErrorHandlerForHitachiGD2000(_In_ PCDROM_DEVICE_EXTENSION DeviceExtension, _In_ PSCSI_REQUEST_BLOCK Srb, _Inout_ PNTSTATUS Status, _Inout_ PBOOLEAN Retry)
#define CDROM_TAG_SENSE_INFO
#define CLASS_PERF_RESTORE_MINIMUM
#define CLASSP_REG_HACK_VALUE_NAME
#define CLASSP_REG_PERF_RESTORE_VALUE_NAME
#define CDROM_TAG_PRIVATE_DATA
#define CLASSP_REG_WRITE_CACHE_VALUE_NAME
#define FDO_HACK_INVALID_FLAGS
CDROM_SCAN_FOR_SPECIAL_INFO CdRomBadItems[]
#define FDO_HACK_CANNOT_LOCK_MEDIA
#define CLASSP_REG_REMOVAL_POLICY_VALUE_NAME
#define CLASSP_REG_SUBKEY_NAME
#define IOCTL_SCSI_EXECUTE_IN
#define SCSIOP_MODE_SENSE10
struct _MODE_PARAMETER_HEADER10 * PMODE_PARAMETER_HEADER10
#define IOCTL_SCSI_EXECUTE_NONE
#define SENSE_BUFFER_SIZE
#define SCSIOP_MODE_SENSE
struct _MODE_PARAMETER_BLOCK MODE_PARAMETER_BLOCK
struct _MODE_PARAMETER_HEADER * PMODE_PARAMETER_HEADER
#define SCSIOP_MODE_SELECT
#define MODE_PAGE_CAPABILITIES
#define IOCTL_DVD_READ_KEY
#define DVD_RPC_KEY_LENGTH
#define DEVPROP_TYPE_EMPTY
#define DEVPROP_TYPE_BOOLEAN
#define NT_SUCCESS(StatCode)
static const WCHAR Cleanup[]
struct _DVD_RPC_KEY * PDVD_RPC_KEY
struct _SCSI_REQUEST_BLOCK SCSI_REQUEST_BLOCK
#define SRB_FUNCTION_RELEASE_DEVICE
#define SRB_FUNCTION_CLAIM_DEVICE
#define SRB_FLAGS_FREE_SENSE_BUFFER
#define SRB_STATUS_DATA_OVERRUN
#define _IRQL_requires_max_(irql)
#define ExAllocatePoolWithTag(hernya, size, tag)
#define DO_SYSTEM_BOOT_PARTITION
GLuint GLuint GLsizei GLenum type
GLuint GLuint GLsizei count
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
#define FILE_PORTABLE_DEVICE
PCONFIGURATION_INFORMATION NTAPI IoGetConfigurationInformation(VOID)
Returns a pointer to the I/O manager's global configuration information structure.
struct _STORAGE_HOTPLUG_INFO STORAGE_HOTPLUG_INFO
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define FILE_READ_ONLY_DEVICE
#define FILE_REMOVABLE_MEDIA
#define RTL_SIZEOF_THROUGH_FIELD(type, field)
#define MINIMUM_CDROM_INQUIRY_SIZE
struct _FEATURE_HEADER * PFEATURE_HEADER
#define SCSI_GET_CONFIGURATION_REQUEST_TYPE_ONE
#define SCSI_GET_CONFIGURATION_REQUEST_TYPE_ALL
enum _FEATURE_NUMBER FEATURE_NUMBER
struct _GET_CONFIGURATION_HEADER GET_CONFIGURATION_HEADER
struct _FEATURE_DATA_CD_READ FEATURE_DATA_CD_READ
#define IOCTL_STORAGE_QUERY_PROPERTY
* PSTORAGE_DESCRIPTOR_HEADER
enum _STORAGE_PROPERTY_ID STORAGE_PROPERTY_ID
* PSTORAGE_DEVICE_DESCRIPTOR
@ StorageDevicePowerProperty
enum _STORAGE_PROPERTY_ID * PSTORAGE_PROPERTY_ID
#define STATUS_DEVICE_PROTOCOL_ERROR
#define STATUS_OBJECT_NAME_EXISTS
_Null_terminated_ wchar_t * NTSTRSAFE_PWSTR
NTSTRSAFEVAPI RtlStringCchPrintfW(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,...)
struct _DVD_COPY_PROTECT_KEY * PDVD_COPY_PROTECT_KEY
#define FILE_DEVICE_CD_ROM
#define IOCTL_SCSI_GET_ADDRESS
struct _CDVD_CAPABILITIES_PAGE * PCDVD_CAPABILITIES_PAGE
#define REVERSE_BYTES(Destination, Source)
struct _CDVD_CAPABILITIES_PAGE CDVD_CAPABILITIES_PAGE
#define STATUS_BUFFER_OVERFLOW
#define TRACE_LEVEL_WARNING
#define TRACE_LEVEL_FATAL
#define TRACE_LEVEL_ERROR
#define TRACE_LEVEL_INFORMATION
DEVICE_TYPE DriveDeviceType
PDEVICE_OBJECT DeviceObject
PCDROM_PRIVATE_FDO_DATA PrivateFdoData
UNICODE_STRING MountedDeviceInterfaceName
CDROM_DATA DeviceAdditionalData
struct _CDROM_PRIVATE_FDO_DATA::@1056 Perf
STORAGE_HOTPLUG_INFO HotplugInfo
MODE_PARAMETER_HEADER ParameterListHeader
MODE_PARAMETER_BLOCK ParameterListBlock
BOOLEAN WriteCacheEnableOverride
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
#define STATUS_IO_DEVICE_ERROR
#define STATUS_INVALID_DEVICE_REQUEST
#define STATUS_DATA_OVERRUN
#define STATUS_INVALID_PARAMETER
#define STATUS_IO_TIMEOUT
#define STATUS_UNSUCCESSFUL
#define STATUS_NO_MEDIA_IN_DEVICE
#define STATUS_OBJECT_NAME_COLLISION
#define STATUS_INSUFFICIENT_RESOURCES
struct _CDB::_MODE_SELECT MODE_SELECT
struct _CDB::_MODE_SENSE10 MODE_SENSE10
struct _CDB::_MODE_SENSE MODE_SENSE
_Must_inspect_result_ _In_ WDFDEVICE Device
#define DECLARE_CONST_UNICODE_STRING(_variablename, _string)
FORCEINLINE WDFDRIVER WdfGetDriver(VOID)
_In_opt_ PVOID _In_ ULONG bufferLength
FORCEINLINE VOID WDF_MEMORY_DESCRIPTOR_INIT_BUFFER(_Out_ PWDF_MEMORY_DESCRIPTOR Descriptor, _In_ PVOID Buffer, _In_ ULONG BufferLength)
FORCEINLINE VOID WDF_OBJECT_ATTRIBUTES_INIT(_Out_ PWDF_OBJECT_ATTRIBUTES Attributes)
#define WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(_attributes, _contexttype)
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
#define WDF_NO_OBJECT_ATTRIBUTES
#define PLUGPLAY_REGKEY_DEVICE
enum _DEVICE_REMOVAL_POLICY DEVICE_REMOVAL_POLICY
#define DO_SYSTEM_CRITICAL_PARTITION
@ DevicePropertyRemovalPolicy
#define DO_SYSTEM_SYSTEM_PARTITION
@ RemovalPolicyExpectSurpriseRemoval
@ RemovalPolicyExpectOrderlyRemoval