Winpcap and DeviceIoControl - Error code 1 on Win7
I'm trying to use Winpcap PacketRequest() function (located in packet32.h) in order to send OID to a network adapter. It works on XP32, doesn't work on Win7 32 and Win7 64 (in Win7 64 I get last error code 1, in 32 I don't know - I don't have access to a 32-bit at the moment). I looked at the source of the PacketRequest() function - It calls DeviceIoControl(), and this is the开发者_运维知识库 function that fails and therefore fails PacketRequest().
Am I working with the wrong Winpcap libraries? (I have installed WinPcap_4_1_2.exe)
Why isn't it working on Win7?
Thanks in advance.
may i see your startup code. it sounds like your loading the dll and trying to call some internal methonds,
you should stick with the api untill you know exacaly how winpcap works internaly.
to write a raw packet to the network card you should use the api function
int pcap_sendpacket ( pcap_t * p,
u_char * buf,
int size )
http://www.winpcap.org/docs/docs_41b5/html/group__wpcapfunc.html#g51dbda0f1ab9da2cfe49d657486d50b2
before you can do that tho you have to open a network adaptor with
pcap_t* pcap_open_live ( const char * device,
int snaplen,
int promisc,
int to_ms,
char * ebuf)
http://www.winpcap.org/docs/docs_41b5/html/group__wpcapfunc.html#gae6abe06e15c87b803f69773822beca8
without seeing your code i can't be of much help. i've written one app which uses winpcap, it works on xp(32/64), vista(32/64), win7(32/64) without problems.
精彩评论