[Winpcap-users] resource of ReadFile

Steffen Röttig steff_privat at t-online.de
Wed Nov 8 14:57:05 GMT 2006


Hi,

I have a little question.
With an adapter i open a handle to a named pipe. So that i can read with "ReadFile()" in the function "PacketReceivePacket" from the pipe.
The implementation of the packet.dll is by the same way, so that i assumed this is correct. But i don't know from which resource reads the packet.dll on an npf-adapter.

My problem...
My: If it is nothing in the pipe (ulBytesReceived = 0), the return value from "ReadFile" is 0 and i get from "GetLastError" 109 = ERROR_BROKEN_PIPE (The pipe has been ended). Unfortunately "PacketReceivePacket" returns 0 (fails) and the sniffer calls an error with "Error failed Packet".
Npf-adapter: if it is nothing in the resource (ulBytesReceived = 0), the return value from "ReadFile" is 1 and so "PacketReceivePacket" returns 1 and the functions succeeds.

Can anybody tell me how i can initialise the named pipe so that "ReadFile" don't returns 0 on an empty Pipe?
Or can anybody tell me how i create a resource, so that i can write with "WriteFile" and read with "ReadFile"?

How do the packet.dll on an npf-adapter? Does reads the function direct on a port? Or creates the npf.sys (driver) an file? How?

Regards
Steff



More information about the Winpcap-users mailing list