some changes in code is causing BSOD.

Hi All,

While playing with passthru, I got a BSOD (IRQL_NOT_LESS_OR_EQUAL). Here i
am trying to change the part of the code to send my own packets. I am
printing the messages in all the parts of the code. Using debugview I found
that BSOD is coming after my MiniPortSend function is executed. That means,
it doesn’t occure in my code, but I must be doing something which is causing
BSOD in the kernel. Can anybody please have a look at it.

I am following the logic:
MiniPortSend()
{
if (Meets The Criteria)
{
// allocate packet contents, buffer and packet
// in reservd part of packet store TRUE
// initialize/copy the contents of packet
NdisSend (&status, , NewPacket);
if (status == NDIS_STATUS_PENDING)
{
// don’t free the resources. We will free them in PtSendComplete
}
else
{
// free the resources allocated
}
}
else
{
// in reserved part of the packet store FALSE
}
}

PtSendComplete (, Packet, )
{
// get the reserved part of the packet
if (value set is TRUE)
{
// free the resources: buffer contents, buffer
}
// free the packet
}

And I am getting following BSOD:

kd> !analyze -v
****************************************************************************
***
*
*
* Bugcheck Analysis
*
*
*
****************************************************************************
***

DRIVER_IRQL_NOT_LESS_OR_EQUAL (d1)
An attempt was made to access a pagable (or completely invalid) address at
an
interrupt request level (IRQL) that is too high. This is usually
caused by drivers using improper addresses.
If kernel debugger is available get stack backtrace.
Arguments:
Arg1: 4d4f433a, memory referenced
Arg2: 00000002, IRQL
Arg3: 00000000, value 0 = read operation, 1 = write operation
Arg4: fd512c48, address which referenced memory

Debugging Details:

READ_ADDRESS: 4d4f433a
CURRENT_IRQL: 2

FAULTING_IP:
NDIS!NdisMWanSendComplete+3e6
fd512c48 8b4304 mov eax,[ebx+0x4]

DEFAULT_BUCKET_ID: DRIVER_FAULT
BUGCHECK_STR: 0xD1
LAST_CONTROL_TRANSFER: from 8042bcb9 to 80452e70

STACK_TEXT:
f7c3e3e8 8042bcb9 00000003 f7c3e430 4d4f433a
nt!RtlpBreakWithStatusInstruction
f7c3e418 8042c068 00000003 4d4f433a fd512c48 nt!KiBugCheckDebugBreak+0x31
f7c3e7a0 80464b1f 00000000 4d4f433a 00000002 nt!KeBugCheckEx+0x37b
f7c3e7a0 fd512c48 00000000 4d4f433a 00000002 nt!KiTrap0E+0x27c
WARNING: Stack unwind information not available. Following frames may be
wrong.
f7c3e848 fd4fc8b0 fd7bd730 fd7fe588 fd7c045a NDIS!NdisMWanSendComplete+0x3e6
f7c3e868 fb218218 00000000 fd7fe588 fd753968 NDIS!NdisCancelTimer+0x101
f7c3e890 fb218099 fd753968 fd7fe588 fd6741c8 tcpip!IPTransmit+0xdb1
f7c3e8c0 fb219232 fd753900 f7c3e802 00000001 tcpip!IPTransmit+0xc32
f7c3e8ec fb217b5b fd6b2d88 14c8c8c8 fd7fe588 tcpip!IPTransmit+0x1dcb
f7c3e9f4 fb2109cd fb2405e0 fd712c28 fd63aa48 tcpip!IPTransmit+0x6f4
f7c3ea5c fb210359 14c8c8c8 0fc8c8c8 00000008 tcpip!tcpxsum+0x3f7b
f7c3eb10 fb242676 ff061408 000003e8 ff05d014 tcpip!tcpxsum+0x3907
f7c3eb70 fb2425b6 ff05d000 00001ff8 ff061408 tcpip!SendICMPErr+0x9d95
f7c3eb94 fb242101 fd74daa8 fd74db18 fd810410 tcpip!SendICMPErr+0x9cd5
f7c3ebb0 fb24237a fd74daa8 fd74db18 fd810410 tcpip!SendICMPErr+0x9820
f7c3ec0c 8041f54b fd810410 fd74daa8 fd74daa8 tcpip!SendICMPErr+0x9a99
f7c3ec1c 80062f00 804ba5e8 ff05eff8 00000000 nt!IopfCallDriver+0x35
f7c3ec34 804ac5de fd810410 fd74daa8 fd732a88 hal!KfLowerIrql
f7c3ed00 804a8f1e 0000005c 00000064 00000000 nt!IopXxxControlFile+0x5e4
f7c3ed34 80461691 0000005c 00000064 00000000 nt!NtDeviceIoControlFile+0x28
f7c3ed34 77f96be2 0000005c 00000064 00000000 nt!KiSystemService+0xc4
0006feec 01001f47 0000005c 00000000 00000000 ntdll+0x16be2
0006ff70 010022af 00072f68 00079410 00672990 ping+0x1f47
0006ffc0 77e87903 77ea13fd 0012f88f 7ffdf000 ping+0x22af
0006fff0 00000000 010021b0 00000000 000000c8
KERNEL32!SetUnhandledExceptionFilter+0x5c

FOLLOWUP_IP:
tcpip!IPTransmit+db1
fb218218 3d03010000 cmp eax,0x103

FOLLOWUP_NAME: MachineOwner
SYMBOL_NAME: tcpip!IPTransmit+db1
MODULE_NAME: tcpip
IMAGE_NAME: tcpip.sys
DEBUG_FLR_IMAGE_TIMESTAMP: 38437f02
STACK_COMMAND: kb
BUCKET_ID: 0xD1_tcpip!IPTransmit+db1
Followup: MachineOwner

Thanks for your time.
Amit Manocha