@@ -137,8 +137,7 @@ USBSTOR_PdoHandleQueryDeviceText(
137
137
IoStack = IoGetCurrentIrpStackLocation (Irp );
138
138
139
139
DeviceExtension = (PPDO_DEVICE_EXTENSION )DeviceObject -> DeviceExtension ;
140
- ASSERT (DeviceExtension -> InquiryData );
141
- InquiryData = DeviceExtension -> InquiryData ;
140
+ InquiryData = (PINQUIRYDATA )& DeviceExtension -> InquiryData ;
142
141
143
142
switch (IoStack -> Parameters .QueryDeviceText .DeviceTextType )
144
143
{
@@ -191,8 +190,7 @@ USBSTOR_PdoHandleQueryDeviceId(
191
190
UNICODE_STRING DeviceId ;
192
191
193
192
DeviceExtension = (PPDO_DEVICE_EXTENSION )DeviceObject -> DeviceExtension ;
194
- ASSERT (DeviceExtension -> InquiryData );
195
- InquiryData = DeviceExtension -> InquiryData ;
193
+ InquiryData = (PINQUIRYDATA )& DeviceExtension -> InquiryData ;
196
194
197
195
DeviceType = USBSTOR_GetDeviceType (InquiryData );
198
196
@@ -282,7 +280,7 @@ USBSTOR_PdoHandleQueryHardwareId(
282
280
PDODeviceExtension = (PPDO_DEVICE_EXTENSION )DeviceObject -> DeviceExtension ;
283
281
FDODeviceExtension = (PFDO_DEVICE_EXTENSION )PDODeviceExtension -> LowerDeviceObject -> DeviceExtension ;
284
282
ASSERT (FDODeviceExtension -> DeviceDescriptor );
285
- InquiryData = PDODeviceExtension -> InquiryData ;
283
+ InquiryData = ( PINQUIRYDATA ) & PDODeviceExtension -> InquiryData ;
286
284
287
285
DeviceType = USBSTOR_GetDeviceType (InquiryData );
288
286
GenericType = USBSTOR_GetGenericType (InquiryData );
@@ -404,7 +402,7 @@ USBSTOR_PdoHandleQueryCompatibleId(
404
402
PDODeviceExtension = (PPDO_DEVICE_EXTENSION )DeviceObject -> DeviceExtension ;
405
403
FDODeviceExtension = (PFDO_DEVICE_EXTENSION )PDODeviceExtension -> LowerDeviceObject -> DeviceExtension ;
406
404
ASSERT (FDODeviceExtension -> DeviceDescriptor );
407
- DeviceType = USBSTOR_GetDeviceType (PDODeviceExtension -> InquiryData );
405
+ DeviceType = USBSTOR_GetDeviceType (( PINQUIRYDATA ) & PDODeviceExtension -> InquiryData );
408
406
409
407
// format instance id
410
408
Length = sprintf (Buffer , "USBSTOR\\%s" , DeviceType ) + 1 ;
@@ -573,10 +571,6 @@ USBSTOR_PdoHandlePnp(
573
571
bDelete = FALSE;
574
572
}
575
573
576
- // clean up the device extension
577
- ASSERT (DeviceExtension -> InquiryData );
578
- ExFreePoolWithTag (DeviceExtension -> InquiryData , USB_STOR_TAG );
579
-
580
574
Irp -> IoStatus .Status = STATUS_SUCCESS ;
581
575
IoCompleteRequest (Irp , IO_NO_INCREMENT );
582
576
@@ -804,19 +798,10 @@ USBSTOR_FillInquiryData(
804
798
IN PDEVICE_OBJECT PDODeviceObject )
805
799
{
806
800
NTSTATUS Status = STATUS_INSUFFICIENT_RESOURCES ;
807
- PPDO_DEVICE_EXTENSION PDODeviceExtension ;
801
+ PPDO_DEVICE_EXTENSION PDODeviceExtension = ( PPDO_DEVICE_EXTENSION ) PDODeviceObject -> DeviceExtension ;
808
802
CDB Cdb ;
809
803
ULONG DataTransferLength = INQUIRYDATABUFFERSIZE ;
810
- PINQUIRYDATA InquiryData ;
811
-
812
- PDODeviceExtension = (PPDO_DEVICE_EXTENSION )PDODeviceObject -> DeviceExtension ;
813
- InquiryData = ExAllocatePoolWithTag (NonPagedPool , INQUIRYDATABUFFERSIZE , USB_STOR_TAG );
814
-
815
- if (!InquiryData )
816
- {
817
- DPRINT1 ("USBSTOR_FillInquiryData failed with %x\n" , Status );
818
- return Status ;
819
- }
804
+ PINQUIRYDATA InquiryData = (PINQUIRYDATA )& PDODeviceExtension -> InquiryData ;
820
805
821
806
RtlZeroMemory (& Cdb , sizeof (Cdb ));
822
807
Cdb .CDB6INQUIRY .OperationCode = SCSIOP_INQUIRY ;
@@ -827,7 +812,6 @@ USBSTOR_FillInquiryData(
827
812
if (!NT_SUCCESS (Status ))
828
813
{
829
814
DPRINT1 ("USBSTOR_FillInquiryData failed with %x\n" , Status );
830
- ExFreePoolWithTag (InquiryData , USB_STOR_TAG );
831
815
return Status ;
832
816
}
833
817
@@ -846,7 +830,6 @@ USBSTOR_FillInquiryData(
846
830
847
831
DPRINT ("Revision %c%c%c%c\n" , InquiryData -> ProductRevisionLevel [0 ], InquiryData -> ProductRevisionLevel [1 ], InquiryData -> ProductRevisionLevel [2 ], InquiryData -> ProductRevisionLevel [3 ]);
848
832
849
- PDODeviceExtension -> InquiryData = InquiryData ;
850
833
return Status ;
851
834
}
852
835
@@ -859,6 +842,7 @@ USBSTOR_CreatePDO(
859
842
NTSTATUS Status ;
860
843
PPDO_DEVICE_EXTENSION PDODeviceExtension ;
861
844
PFDO_DEVICE_EXTENSION FDODeviceExtension ;
845
+ PINQUIRYDATA InquiryData ;
862
846
863
847
FDODeviceExtension = (PFDO_DEVICE_EXTENSION )DeviceObject -> DeviceExtension ;
864
848
@@ -874,6 +858,7 @@ USBSTOR_CreatePDO(
874
858
PDO -> StackSize = DeviceObject -> StackSize ;
875
859
876
860
PDODeviceExtension = (PPDO_DEVICE_EXTENSION )PDO -> DeviceExtension ;
861
+ InquiryData = (PINQUIRYDATA )& PDODeviceExtension -> InquiryData ;
877
862
878
863
// initialize device extension
879
864
RtlZeroMemory (PDODeviceExtension , sizeof (PDO_DEVICE_EXTENSION ));
@@ -899,8 +884,8 @@ USBSTOR_CreatePDO(
899
884
return Status ;
900
885
}
901
886
902
- if (PDODeviceExtension -> InquiryData -> DeviceType != DIRECT_ACCESS_DEVICE &&
903
- PDODeviceExtension -> InquiryData -> DeviceType != READ_ONLY_DIRECT_ACCESS_DEVICE )
887
+ if (InquiryData -> DeviceType != DIRECT_ACCESS_DEVICE &&
888
+ InquiryData -> DeviceType != READ_ONLY_DIRECT_ACCESS_DEVICE )
904
889
{
905
890
return STATUS_NOT_SUPPORTED ;
906
891
}
0 commit comments