Winpcap 和 DeviceIoControl - Win7 上的错误代码 1

发布于 2024-11-26 03:22:07 字数 334 浏览 7 评论 0原文

我正在尝试使用 Winpcap PacketRequest() 函数(位于 packet32.h 中)将 OID 发送到网络适配器。 它适用于 XP32,不适用于 Win7 32 和 Win7 64(在 Win7 64 中我得到最后一个错误代码 1,在 32 中我不知道 - 我目前无法访问 32 位)。 我查看了 PacketRequest() 函数的源代码 - 它调用 DeviceIoControl(),这是失败的函数,因此 PacketRequest() 失败。

我是否使用了错误的 Winpcap 库? (我已经安装了WinPcap_4_1_2.exe)

为什么在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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

a√萤火虫的光℡ 2024-12-03 03:22:07

我可以看看你的启动代码吗?
听起来你正在加载 dll 并尝试调用一些内部方法,

你应该坚持使用 api,直到你完全了解 winpcap 内部是如何工作的。

要将原始数据包写入网卡,您应该使用 api 函数

int pcap_sendpacket  ( pcap_t *  p,  
                       u_char *  buf,  
                       int  size ) 

http://www.winpcap.org/docs/docs_41b5/html/group__wpcapfunc.html#g51dbda0f1ab9da2cfe49d657486d50b2

之前,您必须使用

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

没有看到你的代码我无法提供太多帮助。
我写了一个使用 winpcap 的应用程序,
它可以在 xp(32/64)、vista(32/64)、win7(32/64) 上正常运行。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文