First of all
Indicates that you have a serious misunderstanding. This is illegal. You
cannot simultaneously tell NDIS that the send is complete and is pending.
In any event, the packet is no longer yours after calling this routine. Any
access to it is going to result in failure (like yours).
You only call NdisMSendComplete() when you have *COMPLETED* sending the
packet.
The mere fact that the upper bound protocol gave you a packet to send is an
act of transfer of ownership - the packet is yours, and is ‘pending’ until
you give it back. Once NdisMSendComplete() is called, the packet ownership
is transferred back to the sending protocol (or at least it relinquished by
your driver).
Too bad you don’t have the checked build of NDIS installed. I believe it
would have thrown a nutty when you called NdisMSendComplete(…,
NDIS_STATUS_PENDING).
Good Luck,
Dave Cattley
Consulting Engineer
Systems Software Development
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@gmail.com
Sent: Thursday, March 05, 2009 10:12 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Strange packet size returned by NdisQueryPacket
From additional review of the code it seems that the problem occurs when
postponing the packets handling, i.e:
Store packet in a list:
NdisInterlockedInsertTailList(&adapter->sendWaitList,
(PLIST_ENTRY)&packet->MiniportReserved[0],
&adapter->sendLock);
and call for
NdisMSendComplete(adapter, packet, NDIS_STATUS_PENDING);
Then call for:
pEntry = (PLIST_ENTRY) NdisInterlockedRemoveHeadList(
&adapter->sendWaitList,
&adapter->sendLock);
if (!pEntry)
error;
packet = CONTAINING_RECORD(pEntry, NDIS_PACKET, MiniportReserved);
NdisQueryPacket(packet, NULL, NULL, NULL, &packetLen);
Here the problem occurs.
Also, If I call for NdisQueryPacket(packet, NULL, NULL, NULL, &packetLen)
before storing the
packet in the list, then when I call for it again, it returns the correct
value, but then the following
calls for
NdisQueryPacket(packet, NULL, NULL, ¤tBuf, NULL);
and
NdisQueryBufferSafe(currentBuf, &virtualAddr, ¤tLen,
NormalPagePriority);
fail - the currentLen size holds incorrect value (4718593), as well does
virtualAddr (00000002).
Is here any problem with storing the packets for postponed processing?
Thanks,
S.
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