<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<STYLE type=text/css>DIV {
        MARGIN: 0px
}
</STYLE>
<META content="MSHTML 6.00.2900.5726" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff>
<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> </DIV>
<DIV><FONT size=2>The code you sent actually makes use of the Sync flag,
here</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2> </FONT>
<P>Res = (BOOLEAN)DeviceIoControl(AdapterObject->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> </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; font-color: black"><B>From:</B>
<A title=drewcrewof2@yahoo.com href="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">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> </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> </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> </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> </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->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->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->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->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))->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))->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(&StartTicks);</P>
<P>QueryPerformanceFrequency(&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->hFile,</P>
<P>(Sync)?BIOCSENDPACKETSSYNC:BIOCSENDPACKETSNOSYNC,</P>
<P>(PCHAR)PacketBuff + TotBytesTransfered,</P>
<P>Size - TotBytesTransfered,</P>
<P>NULL,</P>
<P>0,</P>
<P>&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 >= 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))->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))->tv_usec - BufStartTime.tv_usec)) *</P>
<P>(TimeFreq.QuadPart) / 1000000;</P>
<P></P>
<P></FONT><FONT size=2><FONT face="Courier New"></FONT> </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 <=
TargetTicks.QuadPart )</P>
<P>QueryPerformanceCounter(&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->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> </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></BODY></HTML>