129{
133 WCHAR NameBuffer[64];
141
142 DPRINT(
"SpiBuildDeviceMap() called\n");
143
144 if (DeviceExtension ==
NULL)
145 {
146 DPRINT1(
"Invalid parameter\n");
148 }
149
150
152 L"\\Registry\\Machine\\Hardware\\DeviceMap\\Scsi");
156 0,
158 Status = ZwCreateKey(&ScsiKey,
161 0,
166 {
169 }
170
171
172 DPRINT(
"Scsi Port %lu\n", DeviceExtension->PortNumber);
173
176 DeviceExtension->PortNumber);
179 Status = ZwCreateKey(&ScsiPortKey,
182 0,
188 {
191 }
192
193
194
195
196
197
198 UlongData = (
ULONG)!DeviceExtension->PortCapabilities.AdapterUsesPio;
199 DPRINT(
" DMA Enabled = %s\n", UlongData ?
"TRUE" :
"FALSE");
201 Status = ZwSetValueKey(ScsiPortKey,
203 0,
205 &UlongData,
206 sizeof(UlongData));
208 {
209 DPRINT(
"ZwSetValueKey('DMA Enabled') failed (Status %lx)\n",
Status);
212 }
213
214
215 PUNICODE_STRING driverNameU = &DeviceExtension->Common.DeviceObject->DriverObject
216 ->DriverExtension->ServiceKeyName;
217
221 if (!driverName)
222 {
223 DPRINT(
"Failed to allocate driverName!\n");
226 }
227
230
232 Status = ZwSetValueKey(ScsiPortKey,
234 0,
236 driverName,
238
240
242 {
243 DPRINT(
"ZwSetValueKey('Driver') failed (Status %lx)\n",
Status);
246 }
247
248
249 UlongData = (
ULONG)DeviceExtension->PortConfig->BusInterruptLevel;
250 DPRINT(
" Interrupt = %lu\n", UlongData);
252 Status = ZwSetValueKey(ScsiPortKey,
254 0,
256 &UlongData,
257 sizeof(UlongData));
259 {
260 DPRINT(
"ZwSetValueKey('Interrupt') failed (Status %lx)\n",
Status);
263 }
264
265
267 DPRINT(
" IOAddress = %lx\n", UlongData);
269 Status = ZwSetValueKey(ScsiPortKey,
271 0,
273 &UlongData,
274 sizeof(UlongData));
276 {
277 DPRINT(
"ZwSetValueKey('IOAddress') failed (Status %lx)\n",
Status);
280 }
281
282
284 {
285
294 ScsiPortKey,
296 Status = ZwCreateKey(&ScsiBusKey,
299 0,
304 {
306 goto ByeBye;
307 }
308
309
310 DPRINT(
" Initiator Id %lu\n",
311 DeviceExtension->PortConfig->InitiatorBusId[
BusNumber]);
319 ScsiBusKey,
321 Status = ZwCreateKey(&ScsiInitiatorKey,
324 0,
329 {
331 goto ByeBye;
332 }
333
334
335
337 ScsiInitiatorKey =
NULL;
338
339 DeviceExtension->Buses[
BusNumber].RegistryMapKey = ScsiBusKey;
341 }
342
343ByeBye:
344 if (ScsiInitiatorKey !=
NULL)
346
347 if (ScsiBusKey !=
NULL)
349
350 if (ScsiPortKey !=
NULL)
352
353 DPRINT(
"SpiBuildDeviceMap() done\n");
354
356}
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
#define NT_SUCCESS(StatCode)
#define ScsiPortConvertPhysicalAddressToUlong(Address)
#define ExAllocatePoolWithTag(hernya, size, tag)
#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
#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