воскресенье, 24 февраля 2013 г.

HW_INITIALIZATION_DATA in scsiport driver extensions

Function ScsiPortInitialize has struct HW_INITIALIZATION_DATA as third args, but where this structure is stored ?
Run wincheck.exe -alldrv -dext -f dext.log and see dext.log for scsiport.sys driver extensions:
Driver \Driver\viamraid extensions:
 8658FAC0 Key F7415F74 \WINDOWS\system32\DRIVERS\SCSIPORT.SYS
Structure HW_INITIALIZATION_DATA defined in wdk\inc\ddk\storport.h as

typedef struct _HW_INITIALIZATION_DATA {

    ULONG HwInitializationDataSize;

    //
    // Adapter interface type:
    //
    // Internal
    // Isa
    // Eisa
    // MicroChannel
    // TurboChannel
    // PCIBus
    // VMEBus
    // NuBus
    // PCMCIABus
    // CBus
    // MPIBus
    // MPSABus
    //

    INTERFACE_TYPE  AdapterInterfaceType;

    //
    // Miniport driver routines
    //

    PHW_INITIALIZE HwInitialize;
    PHW_STARTIO HwStartIo;
    PHW_INTERRUPT HwInterrupt;
    PHW_FIND_ADAPTER HwFindAdapter;
    PHW_RESET_BUS HwResetBus;
    PHW_DMA_STARTED HwDmaStarted;
    PHW_ADAPTER_STATE HwAdapterState;

    //
    // Miniport driver resources
    //

    ULONG DeviceExtensionSize;

    ULONG SpecificLuExtensionSize;
    ULONG SrbExtensionSize;
    ULONG NumberOfAccessRanges;
    PVOID Reserved;

    //
    // Data buffers must be mapped into virtual address space.
    //

    UCHAR MapBuffers;

    //
    // The driver will need to tranlate virtual to physical addresses.
    //

    BOOLEAN NeedPhysicalAddresses;

    //
    // Supports tagged queuing
    //

    BOOLEAN TaggedQueuing;

    //
    // Supports auto request sense.
    //

    BOOLEAN AutoRequestSense;

    //
    // Supports multiple requests per logical unit.
    //

    BOOLEAN MultipleRequestPerLu;

    //
    // Support receive event function.
    //

    BOOLEAN ReceiveEvent;

    //
    // Vendor identification length
    //

    USHORT VendorIdLength;

    //
    // Vendor identification
    //

    PVOID VendorId;

    //
    // Pad for alignment and future use.
    //

    union {

        USHORT ReservedUshort;

        //
        // Flags to indicate supported features
        //
        USHORT PortVersionFlags;
    };

    //
    // Device identification length
    //

    USHORT DeviceIdLength;

    //
    // Device identification
    //

    PVOID DeviceId;

    //
    // Stop adapter routine.
    //

    PHW_ADAPTER_CONTROL HwAdapterControl;

    //
    // Initialize to the Build IO routine if one is supported, otherwise
    // should be NULL.
    //

    PHW_BUILDIO HwBuildIo;                      // STORPORT New

} HW_INITIALIZATION_DATA, *PHW_INITIALIZATION_DATA;


Check address 8658FAC0 in windbg:
lkd> !pool 8658FAC0 2
Pool page 8658fac0 region is Unknown
*8658fab0 size:   50 previous size:   98  (Allocated) *Driv
        Pooltag Driv : Driver objects
lkd> dp 8658FAC0
8658fac0  865c74d8 007a0078 e1362748 865e30a0
8658fad0  00000001 00000008 00000000 00000001
8658fae0  00000001 865aa300 00000000 00000000
8658faf0  00000000 00000000 00000005 0000000d
8658fb00  1a0a000a 85b4f6e8 00000007 00000000
8658fb10  00000000 861663a8 861216b8 00000000
8658fb20  00000000 00000000 00000000 00000000
8658fb30  00000000 00000000 00000000 00000000
lkd> !pool 865e30a0 2
Pool page 865e30a0 region is Unknown
*865e3098 size:   60 previous size:    8  (Allocated) *ScPI
        Pooltag ScPI : Init data chain
lkd> dp 865e30a0
865e30a0  00000050 00000005 f742dec0 f7426184
865e30b0  f74344f8 f742e856 f742e22a 00000000
865e30c0  00000000 00046530 00000004 00000000
865e30d0  00000006 00000000 00000101 00040000
865e30e0  f743c86c 00040000 f743c864 f74361b8
865e30f0  00000000 865cd5a0 0a23000c e9766544
865e3100  e100d598 00100010 e100b960 00000001
865e3110  00000002 00000000 865b23b0 12000010

lkd> u f742dec0
viamraid+0xbec0:
f742dec0 8bff            mov     edi,edi
f742dec2 55              push    ebp
f742dec3 8bec            mov     ebp,esp
f742dec5 ff7508          push    dword ptr [ebp+8]
f742dec8 e82b74ffff      call    viamraid+0x32f8 (f74252f8)
lkd> u f7426184
viamraid+0x4184:
f7426184 8bff            mov     edi,edi
f7426186 55              push    ebp
f7426187 8bec            mov     ebp,esp
f7426189 53              push    ebx
f742618a 8b5d0c          mov     ebx,dword ptr [ebp+0Ch]
f742618d 807b0217        cmp     byte ptr [ebx+2],17h
 

It seems that 865e30a0 contains valid HW_INITIALIZATION_DATA with INTERFACE_TYPE 5 (PCIBus) and handlers from viamraid.sys

Комментариев нет:

Отправить комментарий