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
[email protected]
https://www.winpcap.org/mailman/listinfo/winpcap-users