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: [email protected] 
  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;

  struct timeval BufStartTime;

  LARGE_INTEGER StartTicks, CurTicks, TargetTicks, TimeFreq;

  int nCt = 0, nCount = 0;

  TRACE_ENTER("PacketSendPackets");

  #ifdef HAVE_WANPACKET_API

  if(AdapterObject->Flags == INFO_FLAG_NDISWAN_ADAPTER)

  {

  TRACE_PRINT("PacketSendPackets: packet sending not allowed on wan adapters");

  TRACE_EXIT("PacketSendPackets");

  return 0;

  }

  #endif // HAVE_WANPACKET_API

  #ifdef HAVE_NPFIM_API

  if(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 HAVE_AIRPCAP_API

  if(AdapterObject->Flags == INFO_FLAG_AIRPCAP_CARD)

  {

  TRACE_PRINT("PacketSendPackets: packet sending not allowed on airpcap 
adapters");

  TRACE_EXIT("PacketSendPackets");

  return 0;

  }

  #endif // HAVE_AIRPCAP_API

  if (AdapterObject->Flags == INFO_FLAG_NDIS_ADAPTER)

  {

  // Obtain starting timestamp of the buffer

  BufStartTime.tv_sec = ((struct timeval*)(PacketBuff))->tv_sec;

  BufStartTime.tv_usec = ((struct timeval*)(PacketBuff))->tv_usec;

  // Retrieve the reference time counters

  QueryPerformanceCounter(&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 error

  if(TotBytesTransfered >= Size || Res != TRUE)

  break;

  // calculate the time interval to wait before sending the next packet

  TargetTicks.QuadPart = StartTicks.QuadPart +

  (LONGLONG)

  ((((struct timeval*)((PCHAR)PacketBuff + TotBytesTransfered))->tv_sec - 
BufStartTime.tv_sec) * 1000000 +

  (((struct timeval*)((PCHAR)PacketBuff + TotBytesTransfered))->tv_usec - 
BufStartTime.tv_usec)) *

  (TimeFreq.QuadPart) / 1000000;




  }

  // Wait until the time interval has elapsed

  while( CurTicks.QuadPart <= TargetTicks.QuadPart )

  QueryPerformanceCounter(&CurTicks);

  }

  while(TRUE);

  }

  else

  {

  TRACE_PRINT1("Request to write on an unknown device type (%u)", 
AdapterObject->Flags);

  TotBytesTransfered = 0;

  }

  TRACE_EXIT("PacketSendPackets");

  return TotBytesTransfered;

  }





------------------------------------------------------------------------------


  _______________________________________________
  Winpcap-users mailing list
  [email protected]
  https://www.winpcap.org/mailman/listinfo/winpcap-users
_______________________________________________
Winpcap-users mailing list
[email protected]
https://www.winpcap.org/mailman/listinfo/winpcap-users

Reply via email to