wmi at miniport

I have encountered an access violation at the scsi portdriver / hal as a
result of adding wmi code to
a scsi miniport driver . The wmi activity is triggered at the
HwScsiFindAdapter() routine as needed .
The initialization of the SCSI_WMILIB_CONTEXT is done ok with no problem
, The SCSI_WMILIB_CONTEXT is
allocated at the miniport Device Extension .But when the
HwScsiWmiQueryReginfo has
to be called an access violation happens ,before it is called , at the
scsi portdriver .
The !analyze -v info is attacged partly . BugCheck is 0 (zero ?!) Any
idea ?

STACK_TEXT:
bf9aca40 bff065ba 00000000 00001f86 bf9acae8
hal!HalAllocateCommonBuffer+0x1b
bf9acb10 bff0635e 813f4030 00000008 bf9acb68
SCSIPORT!SpWmiPassToMiniPort+0xfe
bf9acb4c bff06207 813f4030 bf9acb00 813f4030
SCSIPORT!SpWmiIrpRegisterRequest+0xaa
bf9acb78 bfef8390 813f4030 812c1968 812c1968
SCSIPORT!ScsiPortSystemControlIrp+0xad
bf9acb88 8041f79f 813f4030 812c1968 c00000bb
SCSIPORT!ScsiPortGlobalDispatch+0x1a
bf9acb9c 80516bed c0000001 812b9000 812c1ab0 nt!IopfCallDriver+0x35
bf9acbc4 8051660d 814970e8 813f4030 00000008 nt!WmipForwardWmiIrp+0x19e
bf9acc0c 8041f79f 81497001 812c1968 812c1968 nt!WmipIoControl+0xd9
bf9acc20 80499e0f 812b9008 00000000 812c1968 nt!IopfCallDriver+0x35
bf9acc34 8049a0ed 81497030 812c1968 812bba88
nt!IopSynchronousServiceTail+0x60
bf9acd00 80497df9 000005f4 000005f8 00000000 nt!IopXxxControlFile+0x5e4
bf9acd34 80465091 000005f4 000005f8 00000000 nt!NtDeviceIoControlFile+0x28
bf9acd34 77f83c6a 000005f4 000005f8 00000000 nt!KiSystemService+0xc4
0127d9f4 77e9089f 000005f4 000005f8 00000000
ntdll!ZwDeviceIoControlFile+0xb
0127da58 76752a4f 000005f4 00228020 012b1d68 KERNEL32!DeviceIoControl+0x93
0127daa4 76752903 000005f4 012b1d68 00000000 wmicore!WmipGetKmRegInfo+0x66
0127fef0 76752898 000005f4 012b1d68 012986a4 wmicore!WmipRegisterKm+0x35
0127ff34 7675255b 00000015 76750000 767590d0
wmicore!WmipInitializeKM+0x108
0127ff44 767524ff 7675921c 76750000 77e89b18
wmicore!WmipCoreInitialize+0x4d
0127ff58 767522ce 76750000 77e89b18 000d09d8
wmicore!WmiInitializeService+0x164
0127ff6c 010072f8 00000001 000d09e0 010164e0 wmicore!ServiceEntry+0x70
0127ff8c 010072a4 010096d4 00000001 000d09e0
services!SvcLoadDllAndStartSvc+0x55
0127ffa4 77db243e 00000001 000d09e0 006af9c4 services!SvcServiceEntry+0x4b
0127ffb4 77e887dd 000d09d8 00000000 006af9c4 ADVAPI32!ScSvcctrlThreadW+0xe
0127ffec 00000000 77db2430 000d09d8 00000000 KERNEL32!BaseThreadStart+0x52

Do you set-up your adapter as not supporting bus-mastering by setting BusMaster = FALSE in your FindAdapter routine? If yes, then probably the crash is due to a bug in scsiport.sys. I had wasted a lot of time on this issue before I discovered this, later MS released a hotfix for this (KB ID 839635 http://support.microsoft.com/?id=839635).

Alternatively you can turn on BusMaster = TRUE, though it doesn’t make sense and can cause performance bottlenecks especially with large writes, it is a work around and this way atleast you can confirm if the problem is actually the one I am suspecting.

There were a number of issues that we discovered when implementing a virtual SCSI Miniport and enabling WMI support in the same. I suggest you get the latest hotfix from MS for scsiport (The latest I have is KB839635).

Hope that helps.
-Bandeep

“Zvi Dubitzky” wrote in message news:xxxxx@ntdev…

I have encountered an access violation at the scsi portdriver / hal as a result of adding wmi code to
a scsi miniport driver . The wmi activity is triggered at the HwScsiFindAdapter() routine as needed .
The initialization of the SCSI_WMILIB_CONTEXT is done ok with no problem , The SCSI_WMILIB_CONTEXT is
allocated at the miniport Device Extension .But when the HwScsiWmiQueryReginfo has
to be called an access violation happens ,before it is called , at the scsi portdriver .
The !analyze -v info is attacged partly . BugCheck is 0 (zero ?!) Any idea ?

STACK_TEXT:
bf9aca40 bff065ba 00000000 00001f86 bf9acae8 hal!HalAllocateCommonBuffer+0x1b
bf9acb10 bff0635e 813f4030 00000008 bf9acb68 SCSIPORT!SpWmiPassToMiniPort+0xfe
bf9acb4c bff06207 813f4030 bf9acb00 813f4030 SCSIPORT!SpWmiIrpRegisterRequest+0xaa
bf9acb78 bfef8390 813f4030 812c1968 812c1968 SCSIPORT!ScsiPortSystemControlIrp+0xad
bf9acb88 8041f79f 813f4030 812c1968 c00000bb SCSIPORT!ScsiPortGlobalDispatch+0x1a
bf9acb9c 80516bed c0000001 812b9000 812c1ab0 nt!IopfCallDriver+0x35
bf9acbc4 8051660d 814970e8 813f4030 00000008 nt!WmipForwardWmiIrp+0x19e
bf9acc0c 8041f79f 81497001 812c1968 812c1968 nt!WmipIoControl+0xd9
bf9acc20 80499e0f 812b9008 00000000 812c1968 nt!IopfCallDriver+0x35
bf9acc34 8049a0ed 81497030 812c1968 812bba88 nt!IopSynchronousServiceTail+0x60
bf9acd00 80497df9 000005f4 000005f8 00000000 nt!IopXxxControlFile+0x5e4
bf9acd34 80465091 000005f4 000005f8 00000000 nt!NtDeviceIoControlFile+0x28
bf9acd34 77f83c6a 000005f4 000005f8 00000000 nt!KiSystemService+0xc4
0127d9f4 77e9089f 000005f4 000005f8 00000000 ntdll!ZwDeviceIoControlFile+0xb
0127da58 76752a4f 000005f4 00228020 012b1d68 KERNEL32!DeviceIoControl+0x93
0127daa4 76752903 000005f4 012b1d68 00000000 wmicore!WmipGetKmRegInfo+0x66
0127fef0 76752898 000005f4 012b1d68 012986a4 wmicore!WmipRegisterKm+0x35
0127ff34 7675255b 00000015 76750000 767590d0 wmicore!WmipInitializeKM+0x108
0127ff44 767524ff 7675921c 76750000 77e89b18 wmicore!WmipCoreInitialize+0x4d
0127ff58 767522ce 76750000 77e89b18 000d09d8 wmicore!WmiInitializeService+0x164
0127ff6c 010072f8 00000001 000d09e0 010164e0 wmicore!ServiceEntry+0x70
0127ff8c 010072a4 010096d4 00000001 000d09e0 services!SvcLoadDllAndStartSvc+0x55
0127ffa4 77db243e 00000001 000d09e0 006af9c4 services!SvcServiceEntry+0x4b
0127ffb4 77e887dd 000d09d8 00000000 006af9c4 ADVAPI32!ScSvcctrlThreadW+0xe
0127ffec 00000000 77db2430 000d09d8 00000000 KERNEL32!BaseThreadStart+0x52

Hi,

Did you set WMILibContext->WmiFunctionControl to zero?
I did not implement this function call back and got a blue screen looks very much like yours. The function is very simple, but not documented every where. Let me know if I can provide more help.

Vu
“Zvi Dubitzky” wrote in message news:xxxxx@ntdev…

I have encountered an access violation at the scsi portdriver / hal as a result of adding wmi code to
a scsi miniport driver . The wmi activity is triggered at the HwScsiFindAdapter() routine as needed .
The initialization of the SCSI_WMILIB_CONTEXT is done ok with no problem , The SCSI_WMILIB_CONTEXT is
allocated at the miniport Device Extension .But when the HwScsiWmiQueryReginfo has
to be called an access violation happens ,before it is called , at the scsi portdriver .
The !analyze -v info is attacged partly . BugCheck is 0 (zero ?!) Any idea ?

STACK_TEXT:
bf9aca40 bff065ba 00000000 00001f86 bf9acae8 hal!HalAllocateCommonBuffer+0x1b
bf9acb10 bff0635e 813f4030 00000008 bf9acb68 SCSIPORT!SpWmiPassToMiniPort+0xfe
bf9acb4c bff06207 813f4030 bf9acb00 813f4030 SCSIPORT!SpWmiIrpRegisterRequest+0xaa
bf9acb78 bfef8390 813f4030 812c1968 812c1968 SCSIPORT!ScsiPortSystemControlIrp+0xad
bf9acb88 8041f79f 813f4030 812c1968 c00000bb SCSIPORT!ScsiPortGlobalDispatch+0x1a
bf9acb9c 80516bed c0000001 812b9000 812c1ab0 nt!IopfCallDriver+0x35
bf9acbc4 8051660d 814970e8 813f4030 00000008 nt!WmipForwardWmiIrp+0x19e
bf9acc0c 8041f79f 81497001 812c1968 812c1968 nt!WmipIoControl+0xd9
bf9acc20 80499e0f 812b9008 00000000 812c1968 nt!IopfCallDriver+0x35
bf9acc34 8049a0ed 81497030 812c1968 812bba88 nt!IopSynchronousServiceTail+0x60
bf9acd00 80497df9 000005f4 000005f8 00000000 nt!IopXxxControlFile+0x5e4
bf9acd34 80465091 000005f4 000005f8 00000000 nt!NtDeviceIoControlFile+0x28
bf9acd34 77f83c6a 000005f4 000005f8 00000000 nt!KiSystemService+0xc4
0127d9f4 77e9089f 000005f4 000005f8 00000000 ntdll!ZwDeviceIoControlFile+0xb
0127da58 76752a4f 000005f4 00228020 012b1d68 KERNEL32!DeviceIoControl+0x93
0127daa4 76752903 000005f4 012b1d68 00000000 wmicore!WmipGetKmRegInfo+0x66
0127fef0 76752898 000005f4 012b1d68 012986a4 wmicore!WmipRegisterKm+0x35
0127ff34 7675255b 00000015 76750000 767590d0 wmicore!WmipInitializeKM+0x108
0127ff44 767524ff 7675921c 76750000 77e89b18 wmicore!WmipCoreInitialize+0x4d
0127ff58 767522ce 76750000 77e89b18 000d09d8 wmicore!WmiInitializeService+0x164
0127ff6c 010072f8 00000001 000d09e0 010164e0 wmicore!ServiceEntry+0x70
0127ff8c 010072a4 010096d4 00000001 000d09e0 services!SvcLoadDllAndStartSvc+0x55
0127ffa4 77db243e 00000001 000d09e0 006af9c4 services!SvcServiceEntry+0x4b
0127ffb4 77e887dd 000d09d8 00000000 006af9c4 ADVAPI32!ScSvcctrlThreadW+0xe
0127ffec 00000000 77db2430 000d09d8 00000000 KERNEL32!BaseThreadStart+0x52