Hello,
about most of all Storport routines ddk says:
IN PVOID HwDeviceExtension -
A pointer to the hardware device extension. This is a per HBA storage area that the port driver allocates and initializes on behalf of the miniport driver. … This area is available to the miniport driver in the DeviceExtension->HwDeviceExtension member of the device object for the HBA immediately after the miniport driver calls StorPortInitialize.
DriverEntry(…)
{
…
StorPortInitialize(…);
How to access HwDeviceExtension here, inside DriverEntry?
}
Thanks in advance
Why do you access HwDeviceExtension in DriverEntry? Normally it’s
initialized on FindAdapter()
On Wed, Feb 1, 2012 at 5:32 PM, wrote:
> Hello,
>
> about most of all Storport routines ddk says:
>
> IN PVOID HwDeviceExtension -
>
> A pointer to the hardware device extension. This is a per HBA storage area
> that the port driver allocates and initializes on behalf of the miniport
> driver. … This area is available to the miniport driver in the
> DeviceExtension->HwDeviceExtension member of the device object for the HBA
> immediately after the miniport driver calls StorPortInitialize.
>
>
> DriverEntry(…)
> {
>
> …
>
> StorPortInitialize(…);
>
>
> How to access HwDeviceExtension here, inside DriverEntry?
>
> }
>
> Thanks in advance
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
I want to do some initialization work inside DriverEntry and save results in HwDeviceExtension.
Now I do work in FindAdapter but I prefer DriverEntry for some reasons, I suppose HwDeviceExtension allocated inside StorPortInitialize and could be accessed…
HwDeviceExtension is allocated per adapter instance. Every call to HwFindAdapter gets its own DeviceExtension. Thus, there can be multiple HwDeviceExtension.
HWFindAdapter is called in context of IRP_MN_START_DEVICE handler.
DriverEntry is called only once after the driver is loaded. There is no adapter instance created at that time, and HwFindAdapter was not called yet. StorPortInitialize doesn’t know what adapter instances to create. It just does DRIVER_OBJECT initialization.
So every now and then driver global data is a reasonable solution.
On Wednesday, February 1, 2012, wrote:
> I want to do some initialization work inside DriverEntry and save results
in HwDeviceExtension.
> Now I do work in FindAdapter but I prefer DriverEntry for some reasons, I
suppose HwDeviceExtension allocated inside StorPortInitialize and could be
accessed…
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
>
–
Mark Roddy
> How to access HwDeviceExtension here, inside DriverEntry?
Impossible, it is not allocated yet.
DriverEntry in the miniport can only access global data.
–
Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com
>I want to do some initialization work inside DriverEntry
What initialization can you do if there is no adapter instances discovered yet?
–
Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com