So now the code is:
unsigned char echo_reply = “\xfb\xa1\x3d\xd3\x08\x00\x45\x00\xe6\xdc\xd8\xef\x39\x68\xc0\xa8\x05\x00\x61\x62\x63\x64\x65\x66\x6f\x70\x71\x72\x73\x74\x75\x76\x68\x69”;
NdisAllocatePacket(&Status, &MyPacket,Adapter->RecvPacketPoolHandle);
NdisAllocateBuffer(&Status, &MyContent,Adapter->SendBufferPoolHandle, &HighAddress, NIC_BUFFER_SIZE);
NDIS_SET_PACKET_HEADER_SIZE(MyPacket,14);
NDIS_SET_PACKET_MEDIA_SPECIFIC_INFO(MyPacket, NULL, 0 );
NDIS_SET_PACKET_STATUS(MyPacket,NDIS_STATUS_RESOURCES);
memset(&MyContent,0,NIC_BUFFER_SIZE);
memcpy(&MyContent,&echo_reply,sizeof(echo_reply));
NdisChainBufferAtBack(MyPacket,MyContent);
NdisMIndicateReceivePacket(Adapter->AdapterHandle, &MyPacket,1);
echo_reply is an sample packet received over network, for testing my driver…
My system freezes after 2-3 seconds or the application that generates the ioctl freezes.
Where is the error?!? ![:frowning: :frowning:](/images/emoji/twitter/frowning.png?v=12)
Calvin Guan wrote:
Allocating Ndis_PACKET and NDIS_BUFFER on the fly is not a good idea in terms of performance, but that’s ok.
Do NOT indicate packet until the packet is ready (content is valid). Once you indicated the packet(s), all bounded protocols will receive and may process the packet(s).
Once you indicate packet(s), you don’t own the packets(s). Do NOT touch them until you regain ownership of the packet(s). By regaining ownership, I mean either:
1) The packet was returned through your MiniportReturnPacket callback
2) You indicate the packet(s) with NDIS_STATUS_RESOURCES, and NdisMIndicateReceivePacket has returned. (MiniportReturnPacket won’t get called in this case).
Post the !analyze -v output, please.
-
Calvin Guan Software Engineer
ATI Technologies Inc. www.ati.com
> -----Original Message-----
> From: Bruce Raynold [mailto:xxxxx@yahoo.com]
> Sent: February 23, 2005 10:18 AM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] virtual network adapter receive packet simulation
>
>
>
> Hi all!
>
> I have the following problem:
>
> I have modified the vnetmini ddk sample. I have an
> application who generates an ip packet and pushes it
> to the vnetmini driver via ioctl. So now the vnetmini
> driver
> have to simulate a receive packet, so as it arrives
> from network.
>
> Short:
>
> 1. App generates IP Packet
> 2. App pushes it to vnetmini driver
> 3. Vnetmini driver simulate an receive packet
> (push to tcp ip stack)
>
>
> so here is my code, it crashes after 2-3 sec.
>
>
> NdisAllocatePacket(&Status,&MyPacket,Adapter->RecvPacketPoolHandle);
> NdisAllocateBuffer(&Status,&MyContent,Adapter-
> >SendBufferPoolHandle,&HighAddress,
> NIC_BUFFER_SIZE);
> NDIS_SET_PACKET_HEADER_SIZE(MyPacket,14);
> NDIS_SET_PACKET_MEDIA_SPECIFIC_INFO(MyPacket, NULL,
> 0); NdisChainBufferAtBack(MyPacket,MyContent);
> NdisMIndicateReceivePacket(Adapter->AdapterHandle,&MyPacket,1);
>
> MyPacket has no content. Later I will fill it with the
> ether header,ip header, content… etc
>
>
>
>
>
>
> ___________________________________________________________
> Gesendet von Yahoo! Mail - Jetzt mit 250MB Speicher kostenlos - Hier
> anmelden: http://mail.yahoo.de
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@ati.com
> To unsubscribe send a blank email to %%email.unsub%%
—
Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com
---------------------------------
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.