[Winpcap-users] Anyone have current Packet32 source?
Dennis Drew
drewcrewof2 at yahoo.com
Thu Aug 13 11:59:56 PDT 2009
Hmmm... the "find" function cannot detect that embedded within () I guess. Thanks GV...
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...
Thanks,
Dennis
________________________________
From: Gianluca Varenni <gianluca.varenni at cacetech.com>
To: winpcap-users at winpcap.org
Sent: Thursday, August 13, 2009 11:35:04 AM
Subject: Re: [Winpcap-users] Anyone have current Packet32 source?
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).
The code you sent actually makes use of the Sync flag, here
Res = (BOOLEAN)DeviceIoControl(AdapterObject->hFile,
(Sync)?BIOCSENDPACKETSSYNC:BIOCSENDPACKETSNOSYNC,
(PCHAR)PacketBuff + TotBytesTransfered,
Size - TotBytesTransfered,
NULL,
0,
Have a nice day
GV
----- Original Message -----
>From: Dennis Drew
>To: winpcap-users at winpcap.org
>Sent: Thursday, August 13, 2009 11:03 AM
>Subject: [Winpcap-users] Anyone have current Packet32 source?
>
>
>Anyone have current Packet32 source?
>
>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 "do{" must be broken.
>
>Any help on pointing me to a fully functional packet dll will be appreciated.
>
>Thnaks,
>Dennis (The other Dennis!)
>
>INT PacketSendPackets( EMCallBack CB, LPADAPTER AdapterObject, PVOID PacketBuff, ULONG Size, BOOLEAN Sync)
>{
>BOOLEAN Res;
>DWORD BytesTransfered, TotBytesTransfered=0;
>LARGE_INTEGER StartTicks, CurTicks, TargetTicks, TimeFreq;
>TRACE_ENTER(structtimeval BufStartTime;intnCt = 0, nCount = 0;"PacketSendPackets");#ifdef
>{
>TRACE_PRINT(
>TRACE_EXIT(
>}HAVE_WANPACKET_APIif(AdapterObject->Flags == INFO_FLAG_NDISWAN_ADAPTER)"PacketSendPackets: packet sending not allowed on wan adapters");"PacketSendPackets");return0;#endif// HAVE_WANPACKET_API#ifdefHAVE_NPFIM_APIif(AdapterObject->Flags == INFO_FLAG_NPFIM_DEVICE)
>{
>TRACE_PRINT("PacketSendPackets: packet sending not allowed on npfim adapters");
>TRACE_EXIT("PacketSendPackets");
>return 0;
>}#endif// HAVE_NPFIM_API#ifdef
>{
>TRACE_PRINT(
>TRACE_EXIT(
>}HAVE_AIRPCAP_APIif(AdapterObject->Flags == INFO_FLAG_AIRPCAP_CARD)"PacketSendPackets: packet sending not allowed on airpcap adapters");"PacketSendPackets");return0;#endif// HAVE_AIRPCAP_API{if(AdapterObject->Flags == INFO_FLAG_NDIS_ADAPTER)// Obtain starting timestamp of the bufferBufStartTime.tv_sec = ((
>BufStartTime.tv_usec = ((structtimeval*)(PacketBuff))->tv_sec;structtimeval*)(PacketBuff))->tv_usec;// Retrieve the reference time countersQueryPerformanceCounter(&StartTicks);
>QueryPerformanceFrequency(&TimeFreq);
>CurTicks.QuadPart = StartTicks.QuadPart;do{// Send the data to the driver//TODO Res is NEVER checked, this is REALLY bad.Res = (BOOLEAN)DeviceIoControl(AdapterObject->hFile,
>(Sync)?BIOCSENDPACKETSSYNC:BIOCSENDPACKETSNOSYNC,
>(PCHAR)PacketBuff + TotBytesTransfered,
>Size - TotBytesTransfered,
>NULL,
>0,
>&BytesTransfered,
>NULL);
>TotBytesTransfered += BytesTransfered;// Exit from the loop on termination or errorif(TotBytesTransfered >= Size || Res != TRUE)break;// calculate the time interval to wait before sending the next packetTargetTicks.QuadPart = StartTicks.QuadPart +
>(LONGLONG)
>((((
>(((
>(TimeFreq.QuadPart) / 1000000;
>}structtimeval*)((PCHAR)PacketBuff + TotBytesTransfered))->tv_sec - BufStartTime.tv_sec) * 1000000 +structtimeval*)((PCHAR)PacketBuff + TotBytesTransfered))->tv_usec - BufStartTime.tv_usec)) * // Wait until the time interval has elapsedQueryPerformanceCounter(&CurTicks);
>}
>}while( CurTicks.QuadPart <= TargetTicks.QuadPart )while(TRUE);else{
>TRACE_PRINT1(
>TotBytesTransfered = 0;
>}
>TRACE_EXIT(
>}"Request to write on an unknown device type (%u)", AdapterObject->Flags);"PacketSendPackets");returnTotBytesTransfered;
________________________________
_______________________________________________
>Winpcap-users mailing list
>Winpcap-users at winpcap.org
>https://www.winpcap.org/mailman/listinfo/winpcap-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winpcap.org/pipermail/winpcap-users/attachments/20090813/ff1f4caf/attachment.htm
More information about the Winpcap-users
mailing list