<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2963" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2>Eli, </FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>I'd need a small code sample to reproduce the
problem.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>Regarding your approach, please remember that we strongly
discourage people from using the Packet.dll interface because subject to change.
In your case you are basically modifying the internals of Packet.dll. Again, the
interface that we use to communicate with the kernel driver changes from version
to version of WinPcap (in fact there was a major change sometime between 3.1 and
4.0beta), so if you use your custom version of packet.dll, you are bound to a
specific version of the kernel driver.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>Hope it helps</FONT></DIV>
<DIV><FONT size=2>GV</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=eli.iser@gmail.com href="mailto:eli.iser@gmail.com">Eli Iser</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=winpcap-users@winpcap.org
href="mailto:winpcap-users@winpcap.org">winpcap-users@winpcap.org</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Monday, November 06, 2006 6:51
AM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> [Winpcap-users] WriteFile fails
with ERROR_GEN_FAILURE</DIV>
<DIV><FONT size=2></FONT><BR></DIV>
<DIV>I'm having a problem with using the Packet32 code in my application. When
sending a packet using PacketSendPacket it sometimes failes with GetLastError
returning 31 - ERROR_GEN_FAILURE.</DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV>A little more detail:</DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV>I'm running WinXP SP2 on a P4 with a copy of Packet32 obtained from the
WinPCap site from the 3.1 developer's pack.</DIV>
<DIV>I'm using the code directly in my appliction, and not in a separate
dll.</DIV>
<DIV>Also, I've made several small changes to the code, most of little
concern, but I did change the way to open the adapter to overlapped.
Accordingly, I've modified all of the appropriate function calls that are
affected by overlapped to use the overlapped structure (WriteFile, ReadFile
and DeviveIoCtl). </DIV>
<DIV>I've added three overlapped structures to the ADAPTER struct - one for
reading, one for writing and one for DeviveIoCtl. </DIV>
<DIV>The relavent changes from the overlapped are in the PacketReceivePacket
and the PacketSendPacket:</DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV>The applications basic design is as like a bridge - read a packet from
adapter A and write it to adapter B; read a packet from adapter B and write it
to adapter A. I have two threads that perform the receives - one for each
adapter. </DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV>When sending a packet I first call GetOverlappedResult with
<EM>bWait</EM> being TRUE to make sure no IO is pending, so that I can
send my packet. The I check if the WriteFile returns FALSE, and if so check
the GetLastError(). If it's ERROR_IO_PENDING I return TRUE from the
PacketSendPacket. Else I return FALSE. Here I don't care if the packet was
actually sent already. I want to return to doing my own stuff. </DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV>When receiving a packet I call the ReadFile fucntion, and then call
GetOverlappedResult with <EM>bWait</EM> being TRUE to make sure I get the
packet. I must have the packet, since I have nothing else to do while waiting
for it. </DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV>On quite rare occasions the WriteFile in the PacketSendPacket fails with
GetLastError() returning 31 - ERROR_GEN_FAILURE. After this happens all calls
to function with this adapter's handle fails. Furthermore, because I wait
before sending I get stuck on the GetOverlappedResult (bWait is true - so I'm
stuck until any IO is complete, which obviosly ain't gonna happen...). </DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV>Any suggestions will be welcomed.</DIV>
<DIV>Maybe it's all the overlapped's fault? I found that it gave quite a
performance boost, so I'd rather not return to non-overlapped working. </DIV>
<DIV>Maybe I'm using the overlapped wrong? Something I forgot to do? I'm not
well versed in working with overlapped. </DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV>Thanks much,</DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV>Eli Iser</DIV>
<P>
<HR>
<P></P>_______________________________________________<BR>Winpcap-users
mailing
list<BR>Winpcap-users@winpcap.org<BR>https://www.winpcap.org/mailman/listinfo/winpcap-users<BR></BLOCKQUOTE></BODY></HTML>