This is a piece of code from the ProtocolReceiveComplete function in
my NDIS IM driver (which exposes a WAN upper edge) :
…
if(Link->NdisLinkContext) {
// — Indicates the new packet to the upper layer
NdisMWanIndicateReceive(&Status,
Adapter->MiniportHandle,
Link->NdisLinkContext,
NdisWanBuffer,
NdisWanBufferLength);
if(Status == NDIS_STATUS_SUCCESS) {
NdisMWanIndicateReceiveComplete(Adapter->MiniportHandle,
Link->NdisLinkContext);
}
}
…
where Link->NdisLinkContext is the NdisLinkContext from the
NDIS_MAC_LINE_UP struct after I call NdisMIndicateStatus with a status
of NDIS_STATUS_MAC_LINE_UP (this field was zero before the call).
Although this code works fine under Windows XP, Windows 2K and Windows
98, it crashes in Windows NT 4 SP6 on the first packet receive with a
status of IRQL_NOT_LESS_OR_EQUAL.
The NdisLinkContext is clearly not null, but I suspect the value
returned by NDIS is somehow invalid (in my test system this handle is
always 0xabb00001). In Windows XP, NDIS sets the value to 0x00000001 and
in the subsequent calls, it increments the value.
How can I validate the handle returned by NDIS ? And, if it is
correct, what could be causing the crash ?
Regards,
Buiatte.