40 DPRINT(
"Unable to open driver's registry key %wZ, status 0x%08x\n",
42 ConfigInfo->ServiceKey =
NULL;
46 if (ConfigInfo->ServiceKey !=
NULL)
52 ConfigInfo->ServiceKey,
62 ZwClose(ConfigInfo->ServiceKey);
63 ConfigInfo->ServiceKey = ConfigInfo->DeviceKey;
64 ConfigInfo->DeviceKey =
NULL;
68 if (ConfigInfo->ServiceKey !=
NULL)
75 ConfigInfo->ServiceKey,
88 ConfigInfo->ServiceKey,
133 WCHAR NameBuffer[64];
142 DPRINT(
"SpiBuildDeviceMap() called\n");
144 if (DeviceExtension ==
NULL)
146 DPRINT1(
"Invalid parameter\n");
152 L"\\Registry\\Machine\\Hardware\\DeviceMap\\Scsi");
158 Status = ZwCreateKey(&ScsiKey,
172 DPRINT(
"Scsi Port %lu\n", DeviceExtension->PortNumber);
176 DeviceExtension->PortNumber);
179 Status = ZwCreateKey(&ScsiPortKey,
198 UlongData = (
ULONG)!DeviceExtension->PortCapabilities.AdapterUsesPio;
199 DPRINT(
" DMA Enabled = %s\n", UlongData ?
"TRUE" :
"FALSE");
201 Status = ZwSetValueKey(ScsiPortKey,
209 DPRINT(
"ZwSetValueKey('DMA Enabled') failed (Status %lx)\n",
Status);
215 PUNICODE_STRING driverNameU = &DeviceExtension->Common.DeviceObject->DriverObject
216 ->DriverExtension->ServiceKeyName;
223 DPRINT(
"Failed to allocate driverName!\n");
232 Status = ZwSetValueKey(ScsiPortKey,
243 DPRINT(
"ZwSetValueKey('Driver') failed (Status %lx)\n",
Status);
249 UlongData = (
ULONG)DeviceExtension->PortConfig->BusInterruptLevel;
250 DPRINT(
" Interrupt = %lu\n", UlongData);
252 Status = ZwSetValueKey(ScsiPortKey,
260 DPRINT(
"ZwSetValueKey('Interrupt') failed (Status %lx)\n",
Status);
267 DPRINT(
" IOAddress = %lx\n", UlongData);
269 Status = ZwSetValueKey(ScsiPortKey,
277 DPRINT(
"ZwSetValueKey('IOAddress') failed (Status %lx)\n",
Status);
296 Status = ZwCreateKey(&ScsiBusKey,
310 DPRINT(
" Initiator Id %lu\n",
311 DeviceExtension->PortConfig->InitiatorBusId[
BusNumber]);
321 Status = ZwCreateKey(&ScsiInitiatorKey,
337 ScsiInitiatorKey =
NULL;
339 DeviceExtension->Buses[
BusNumber].RegistryMapKey = ScsiBusKey;
344 if (ScsiInitiatorKey !=
NULL)
347 if (ScsiBusKey !=
NULL)
350 if (ScsiPortKey !=
NULL)
353 DPRINT(
"SpiBuildDeviceMap() done\n");
362 WCHAR nameBuffer[64];
371 HANDLE busKey = portExt->Buses[LunExtension->PathId].RegistryMapKey;
374 swprintf(nameBuffer,
L"Target Id %lu", LunExtension->TargetId);
377 status = ZwCreateKey(&targetKey,
391 swprintf(nameBuffer,
L"Logical Unit Id %lu", LunExtension->Lun);
394 status = ZwCreateKey(&LunExtension->RegistryMapKey,
410 LunExtension->InquiryData.VendorId,
411 LunExtension->InquiryData.ProductId,
412 LunExtension->InquiryData.ProductRevisionLevel);
414 status = ZwSetValueKey(LunExtension->RegistryMapKey,
422 DPRINT(
"ZwSetValueKey('Identifier') failed (Status %lx)\n",
status);
428 DPRINT(
" Type = '%S'\n", typeName);
430 status = ZwSetValueKey(LunExtension->RegistryMapKey,
438 DPRINT(
"ZwSetValueKey('Type') failed (Status %lx)\n",
status);
444 status = ZwSetValueKey(LunExtension->RegistryMapKey,
448 &LunExtension->InquiryData,
452 DPRINT(
"ZwSetValueKey('InquiryData') failed (Status %lx)\n",
status);
459 ZwClose(LunExtension->RegistryMapKey);
#define INQUIRYDATABUFFERSIZE
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
#define NT_SUCCESS(StatCode)
#define ScsiPortConvertPhysicalAddressToUlong(Address)
VOID SpiInitOpenKeys(_Inout_ PCONFIGURATION_INFO ConfigInfo, _In_ PSCSI_PORT_DRIVER_EXTENSION DriverExtension)
NTSTATUS RegistryInitAdapterKey(_Inout_ PSCSI_PORT_DEVICE_EXTENSION DeviceExtension)
NTSTATUS RegistryInitLunKey(_Inout_ PSCSI_PORT_LUN_EXTENSION LunExtension)
#define ExAllocatePoolWithTag(hernya, size, tag)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define OBJ_KERNEL_HANDLE
#define OBJ_CASE_INSENSITIVE
#define ExFreePoolWithTag(_P, _T)
#define InitializeObjectAttributes(p, n, a, r, s)
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define REG_OPTION_VOLATILE
PPCI_DRIVER_EXTENSION DriverExtension
FORCEINLINE PCWSTR GetPeripheralTypeW(_In_ PINQUIRYDATA InquiryData)
#define RtlCopyMemory(Destination, Source, Length)
#define STATUS_INVALID_PARAMETER
#define STATUS_INSUFFICIENT_RESOURCES
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING ValueName
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber