@@ -196,7 +196,7 @@ HalpQueryDeviceRelations(IN PDEVICE_OBJECT DeviceObject,
196
196
FdoRelations = ExAllocatePoolWithTag (PagedPool ,
197
197
FIELD_OFFSET (DEVICE_RELATIONS ,
198
198
Objects ) +
199
- 4 * PdoCount ,
199
+ sizeof ( PDEVICE_OBJECT ) * PdoCount ,
200
200
' laH' );
201
201
if (!FdoRelations ) return STATUS_INSUFFICIENT_RESOURCES ;
202
202
@@ -220,7 +220,7 @@ HalpQueryDeviceRelations(IN PDEVICE_OBJECT DeviceObject,
220
220
}
221
221
222
222
/* Free existing structure */
223
- ExFreePoolWithTag (* DeviceRelations , 0 );
223
+ ExFreePool (* DeviceRelations );
224
224
}
225
225
226
226
/* Now check if we have a PDO list */
@@ -359,7 +359,7 @@ HalpQueryResources(IN PDEVICE_OBJECT DeviceObject,
359
359
{
360
360
/* Fail, no memory */
361
361
Status = STATUS_INSUFFICIENT_RESOURCES ;
362
- ExFreePoolWithTag (RequirementsList , 0 );
362
+ ExFreePoolWithTag (RequirementsList , ' laH' );
363
363
return Status ;
364
364
}
365
365
@@ -372,43 +372,40 @@ HalpQueryResources(IN PDEVICE_OBJECT DeviceObject,
372
372
ResourceList -> List [0 ].InterfaceType = PNPBus ;
373
373
ResourceList -> List [0 ].PartialResourceList .Version = 1 ;
374
374
ResourceList -> List [0 ].PartialResourceList .Revision = 1 ;
375
- ResourceList -> List [0 ].PartialResourceList .Count = 1 ;
375
+ ResourceList -> List [0 ].PartialResourceList .Count = 0 ;
376
376
377
377
/* Setup the first descriptor */
378
378
PartialDesc = ResourceList -> List [0 ].PartialResourceList .PartialDescriptors ;
379
- PartialDesc -> Type = CmResourceTypeInterrupt ;
380
379
381
380
/* Find the requirement descriptor for the SCI */
382
381
for (i = 0 ; i < RequirementsList -> List [0 ].Count ; i ++ )
383
382
{
384
383
/* Get this descriptor */
385
384
Descriptor = & RequirementsList -> List [0 ].Descriptors [i ];
386
- if (Descriptor -> Type == CmResourceTypeInterrupt ) break ;
387
- Descriptor = NULL ;
388
- }
389
-
390
- /* Make sure we found the descriptor */
391
- if (Descriptor )
392
- {
393
- /* Copy requirements descriptor into resource descriptor */
394
- PartialDesc -> ShareDisposition = Descriptor -> ShareDisposition ;
395
- PartialDesc -> Flags = Descriptor -> Flags ;
396
- ASSERT (Descriptor -> u .Interrupt .MinimumVector ==
397
- Descriptor -> u .Interrupt .MaximumVector );
398
- PartialDesc -> u .Interrupt .Vector = Descriptor -> u .Interrupt .MinimumVector ;
399
- PartialDesc -> u .Interrupt .Level = Descriptor -> u .Interrupt .MinimumVector ;
400
- PartialDesc -> u .Interrupt .Affinity = 0xFFFFFFFF ;
401
-
402
- /* Return resources and success */
403
- * Resources = ResourceList ;
404
- ExFreePoolWithTag (RequirementsList , 0 );
405
- return STATUS_SUCCESS ;
385
+ if (Descriptor -> Type == CmResourceTypeInterrupt )
386
+ {
387
+ /* Copy requirements descriptor into resource descriptor */
388
+ PartialDesc -> Type = CmResourceTypeInterrupt ;
389
+ PartialDesc -> ShareDisposition = Descriptor -> ShareDisposition ;
390
+ PartialDesc -> Flags = Descriptor -> Flags ;
391
+ ASSERT (Descriptor -> u .Interrupt .MinimumVector ==
392
+ Descriptor -> u .Interrupt .MaximumVector );
393
+ PartialDesc -> u .Interrupt .Vector = Descriptor -> u .Interrupt .MinimumVector ;
394
+ PartialDesc -> u .Interrupt .Level = Descriptor -> u .Interrupt .MinimumVector ;
395
+ PartialDesc -> u .Interrupt .Affinity = 0xFFFFFFFF ;
396
+
397
+ ResourceList -> List [0 ].PartialResourceList .Count ++ ;
398
+
399
+ break ;
400
+ }
406
401
}
407
-
408
- /* Free memory and fail */
409
- ExFreePoolWithTag (RequirementsList , 0 );
410
- ExFreePoolWithTag (ResourceList , 0 );
411
- Status = STATUS_NOT_FOUND ;
402
+
403
+ /* Return resources and success */
404
+ * Resources = ResourceList ;
405
+
406
+ ExFreePoolWithTag (RequirementsList , ' laH' );
407
+
408
+ return STATUS_SUCCESS ;
412
409
}
413
410
else if (DeviceExtension -> PdoType == WdPdo )
414
411
{
@@ -420,9 +417,6 @@ HalpQueryResources(IN PDEVICE_OBJECT DeviceObject,
420
417
/* This shouldn't happen */
421
418
return STATUS_UNSUCCESSFUL ;
422
419
}
423
-
424
- /* Return the status */
425
- return Status ;
426
420
}
427
421
428
422
NTSTATUS
@@ -450,9 +444,6 @@ HalpQueryResourceRequirements(IN PDEVICE_OBJECT DeviceObject,
450
444
/* This shouldn't happen */
451
445
return STATUS_UNSUCCESSFUL ;
452
446
}
453
-
454
- /* Return the status */
455
- return Status ;
456
447
}
457
448
458
449
NTSTATUS
0 commit comments