<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial, helvetica, sans-serif;font-size:12pt"><DIV>Hmmm... the "find" function cannot detect that embedded within () I guess. Thanks GV...</DIV>
<DIV>&nbsp;</DIV>
<DIV>So do you have any idea how at this low level I could determine the packet count so I could display it on my application screen? There is a byte count but that is not the same...</DIV>
<DIV>&nbsp;</DIV>
<DIV>Thanks,</DIV>
<DIV>Dennis<BR></DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: arial, helvetica, sans-serif"><BR>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"><FONT face=Tahoma size=2>
<HR SIZE=1>
<B><SPAN style="FONT-WEIGHT: bold">From:</SPAN></B> Gianluca Varenni &lt;gianluca.varenni@cacetech.com&gt;<BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> winpcap-users@winpcap.org<BR><B><SPAN style="FONT-WEIGHT: bold">Sent:</SPAN></B> Thursday, August 13, 2009 11:35:04 AM<BR><B><SPAN style="FONT-WEIGHT: bold">Subject:</SPAN></B> Re: [Winpcap-users] Anyone have current Packet32 source?<BR></FONT><BR>
<STYLE type=text/css>DIV {
MARGIN:0px;}
</STYLE>

<DIV><FONT size=2>The code in the compiled DLL is the same as the one that we ship as a source package (I'm the person who builds the packages). Remember that the same sources generate different binaries, depending on the build configuration you use (NT4, NT5x, NT6x). </FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>The code you sent actually makes use of the Sync flag, here</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>&nbsp;</FONT> 
<P>Res = (BOOLEAN)DeviceIoControl(AdapterObject-&gt;hFile,</P>
<P>(Sync)?BIOCSENDPACKETSSYNC:BIOCSENDPACKETSNOSYNC,</P>
<P>(PCHAR)PacketBuff + TotBytesTransfered,</P>
<P>Size - TotBytesTransfered,</P>
<P>NULL,</P>
<P>0,</P>
<P><FONT size=2></FONT>&nbsp;</P>
<P><FONT size=2>Have a nice day<BR>GV</FONT></P></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"><B>From:</B> <A title=drewcrewof2@yahoo.com href="mailto:drewcrewof2@yahoo.com" target=_blank rel=nofollow ymailto="mailto:drewcrewof2@yahoo.com">Dennis Drew</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=winpcap-users@winpcap.org href="mailto:winpcap-users@winpcap.org" target=_blank rel=nofollow ymailto="mailto:winpcap-users@winpcap.org">winpcap-users@winpcap.org</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Thursday, August 13, 2009 11:03 AM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> [Winpcap-users] Anyone have current Packet32 source?</DIV>
<DIV><FONT size=2></FONT><FONT size=2></FONT><FONT size=2></FONT><BR></DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: arial, helvetica, sans-serif">
<DIV>Anyone have current Packet32 source?</DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV>The code I see in the packetNtx download is not the same as the code supplied as a compiled .dll. This code section does not repond the the Sync flag and it also runs VERY, very slow... like one packet per second so the loop at "<FONT size=2><FONT color=#0000ff>do</FONT>{" must be broken.</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>Any help on pointing me to a fully functional packet dll will be appreciated.</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>Thnaks,</FONT></DIV>
<DIV><FONT size=2>Dennis (The other Dennis!)</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>
<P>INT PacketSendPackets( EMCallBack CB, LPADAPTER AdapterObject, PVOID PacketBuff, ULONG Size, BOOLEAN Sync)</P>
<P>{</P>
<P>BOOLEAN Res;</P>
<P>DWORD BytesTransfered, TotBytesTransfered=0;</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>struct</FONT></FONT><FONT size=2> timeval BufStartTime;</P>
<P>LARGE_INTEGER StartTicks, CurTicks, TargetTicks, TimeFreq;</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>int</FONT></FONT><FONT size=2> nCt = 0, nCount = 0;</P>
<P>TRACE_ENTER(</FONT><FONT color=#a31515 size=2><FONT color=#a31515 size=2>"PacketSendPackets"</FONT></FONT><FONT size=2>);</P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>
<P>#ifdef</FONT></FONT><FONT size=2> HAVE_WANPACKET_API</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>if</FONT></FONT><FONT size=2>(AdapterObject-&gt;Flags == INFO_FLAG_NDISWAN_ADAPTER)</P>
<P>{</P>
<P>TRACE_PRINT(</FONT><FONT color=#a31515 size=2><FONT color=#a31515 size=2>"PacketSendPackets: packet sending not allowed on wan adapters"</FONT></FONT><FONT size=2>);</P>
<P>TRACE_EXIT(</FONT><FONT color=#a31515 size=2><FONT color=#a31515 size=2>"PacketSendPackets"</FONT></FONT><FONT size=2>);</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>return</FONT></FONT><FONT size=2> 0;</P>
<P>}</P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>
<P>#endif</FONT></FONT><FONT size=2> </FONT><FONT color=#008000 size=2><FONT color=#008000 size=2>// HAVE_WANPACKET_API</P></FONT></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>
<P>#ifdef</FONT></FONT><FONT size=2> HAVE_NPFIM_API</P></FONT><FONT color=#808080 size=2><FONT color=#808080 size=2>
<P>if(AdapterObject-&gt;Flags == INFO_FLAG_NPFIM_DEVICE)</P>
<P>{</P>
<P>TRACE_PRINT("PacketSendPackets: packet sending not allowed on npfim adapters");</P>
<P>TRACE_EXIT("PacketSendPackets");</P>
<P>return 0;</P>
<P>}</P></FONT></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>
<P>#endif</FONT></FONT><FONT size=2> </FONT><FONT color=#008000 size=2><FONT color=#008000 size=2>// HAVE_NPFIM_API</P></FONT></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>
<P>#ifdef</FONT></FONT><FONT size=2> HAVE_AIRPCAP_API</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>if</FONT></FONT><FONT size=2>(AdapterObject-&gt;Flags == INFO_FLAG_AIRPCAP_CARD)</P>
<P>{</P>
<P>TRACE_PRINT(</FONT><FONT color=#a31515 size=2><FONT color=#a31515 size=2>"PacketSendPackets: packet sending not allowed on airpcap adapters"</FONT></FONT><FONT size=2>);</P>
<P>TRACE_EXIT(</FONT><FONT color=#a31515 size=2><FONT color=#a31515 size=2>"PacketSendPackets"</FONT></FONT><FONT size=2>);</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>return</FONT></FONT><FONT size=2> 0;</P>
<P>}</P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>
<P>#endif</FONT></FONT><FONT size=2> </FONT><FONT color=#008000 size=2><FONT color=#008000 size=2>// HAVE_AIRPCAP_API</P></FONT></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>if</FONT></FONT><FONT size=2> (AdapterObject-&gt;Flags == INFO_FLAG_NDIS_ADAPTER)</P>
<P>{</P>
<P></FONT><FONT color=#008000 size=2><FONT color=#008000 size=2>// Obtain starting timestamp of the buffer</P></FONT></FONT><FONT size=2>
<P>BufStartTime.tv_sec = ((</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>struct</FONT></FONT><FONT size=2> timeval*)(PacketBuff))-&gt;tv_sec;</P>
<P>BufStartTime.tv_usec = ((</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>struct</FONT></FONT><FONT size=2> timeval*)(PacketBuff))-&gt;tv_usec;</P>
<P></FONT><FONT color=#008000 size=2><FONT color=#008000 size=2>// Retrieve the reference time counters</P></FONT></FONT><FONT size=2>
<P>QueryPerformanceCounter(&amp;StartTicks);</P>
<P>QueryPerformanceFrequency(&amp;TimeFreq);</P>
<P>CurTicks.QuadPart = StartTicks.QuadPart;</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>do</FONT></FONT><FONT size=2>{</P>
<P></FONT><FONT color=#008000 size=2><FONT color=#008000 size=2>// Send the data to the driver</P></FONT></FONT><FONT size=2>
<P></FONT><FONT color=#008000 size=2><FONT color=#008000 size=2>//TODO Res is NEVER checked, this is REALLY bad.</P></FONT></FONT><FONT size=2>
<P>Res = (BOOLEAN)DeviceIoControl(AdapterObject-&gt;hFile,</P>
<P>(Sync)?BIOCSENDPACKETSSYNC:BIOCSENDPACKETSNOSYNC,</P>
<P>(PCHAR)PacketBuff + TotBytesTransfered,</P>
<P>Size - TotBytesTransfered,</P>
<P>NULL,</P>
<P>0,</P>
<P>&amp;BytesTransfered,</P>
<P>NULL);</P>
<P>TotBytesTransfered += BytesTransfered;</P>
<P></FONT><FONT color=#008000 size=2><FONT color=#008000 size=2>// Exit from the loop on termination or error</P></FONT></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>if</FONT></FONT><FONT size=2>(TotBytesTransfered &gt;= Size || Res != TRUE)</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>break</FONT></FONT><FONT size=2>;</P>
<P></FONT><FONT color=#008000 size=2><FONT color=#008000 size=2>// calculate the time interval to wait before sending the next packet</P></FONT></FONT><FONT size=2>
<P>TargetTicks.QuadPart = StartTicks.QuadPart +</P>
<P>(LONGLONG)</P>
<P>((((</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>struct</FONT></FONT><FONT size=2> timeval*)((PCHAR)PacketBuff + TotBytesTransfered))-&gt;tv_sec - BufStartTime.tv_sec) * 1000000 +</P>
<P>(((</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>struct</FONT></FONT><FONT size=2> timeval*)((PCHAR)PacketBuff + TotBytesTransfered))-&gt;tv_usec - BufStartTime.tv_usec)) *</P>
<P>(TimeFreq.QuadPart) / 1000000;</P>
<P></P>
<P></FONT><FONT size=2><FONT face="Courier New"></FONT>&nbsp;</P>
<P>}</P>
<P></FONT><FONT color=#008000 size=2><FONT color=#008000 size=2>// Wait until the time interval has elapsed</P></FONT></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>while</FONT></FONT><FONT size=2>( CurTicks.QuadPart &lt;= TargetTicks.QuadPart )</P>
<P>QueryPerformanceCounter(&amp;CurTicks);</P>
<P>}</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>while</FONT></FONT><FONT size=2>(TRUE);</P>
<P>}</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>else</P></FONT></FONT><FONT size=2>
<P>{</P>
<P>TRACE_PRINT1(</FONT><FONT color=#a31515 size=2><FONT color=#a31515 size=2>"Request to write on an unknown device type (%u)"</FONT></FONT><FONT size=2>, AdapterObject-&gt;Flags);</P>
<P>TotBytesTransfered = 0;</P>
<P>}</P>
<P>TRACE_EXIT(</FONT><FONT color=#a31515 size=2><FONT color=#a31515 size=2>"PacketSendPackets"</FONT></FONT><FONT size=2>);</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>return</FONT></FONT><FONT size=2> TotBytesTransfered;</P>
<P>}</P></FONT><FONT color=#008000 size=2><FONT color=#008000 size=2>
<P>&nbsp;</P></FONT></FONT></DIV></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></DIV></DIV></div></body></html>