-1

I want to check if I could successfully load the dll's for WinPCAP and want to do it by writing a simple C/C++ console application. However I do not have neither experience nor an idea about how to do it. What I know is according to its def file:

LIBRARY Packet32

EXPORTS
    PacketOpenAdapter
    PacketSendPacket
    PacketAllocatePacket
    PacketInitPacket
    PacketFreePacket
    PacketResetAdapter
    PacketReceivePacket
    PacketCloseAdapter
    PacketSetHwFilter
    PacketGetAdapterNames
    PacketRequest
    PacketSetBuff
    PacketSetBpf
    PacketGetNetType
    PacketSetReadTimeout
    PacketSetNumWrites
    PacketGetNetInfo
    PacketSetMinToCopy
    PacketSetMaxLookahead
    PacketCancelPacket
    PacketLoadDriver
    PacketUnloadDriver

I must be checking these things. But how? Could you please help me?

Best Regards

Xentius
  • 459
  • 1
  • 10
  • 21
  • what do you mean by "test" ? check the integrity ? or check the functions ? – Raptor May 02 '13 at 06:41
  • You need to include the WinPCAP header files (`.h`)in your application to compile against. Then you need to link against the import library (`.lib`). http://stackoverflow.com/questions/2762752/why-winpcap-requires-both-lib-and-dll-to-run – Jonathon Reinhart May 02 '13 at 06:42
  • [The Internet](https://www.google.com/search?q=winpcap+example+code) is your friend, by the way. – Jonathon Reinhart May 02 '13 at 06:43
  • @ShivanRaptor I need to check integrity I guess? For example, I need to check if PacketSendPacket works successfully. – Xentius May 02 '13 at 06:50
  • @JonathonReinhart I have seen those codes but could not be sure about them. I feel like I need a console application that checks PacketOpenAdapter, PacketSendPacket, PacketAllocatePacket etc. if they are successfully loaded? – Xentius May 02 '13 at 06:56
  • Then can you show the codes? – Raptor May 02 '13 at 07:01
  • What do you mean "successfully loaded?" It's a DLL, you have two options: 1) Link your executable against an import library (`.lib`), and the loader will fix everything up for you. 2) You call `LoadLibrary` and `GetProcAddress` to do your own "late-binding", and call the functions via function pointers. – Jonathon Reinhart May 02 '13 at 07:05
  • @JonathonReinhart First, I am sorry for the inconvenience caused by my ignorance. :/ What I want to do is basically like in this link: http://www.winpcap.org/pipermail/winpcap-users/2011-December/004549.html I want to write a code that uses PacketSetReadTimeout, PacketSetBuff etc. and see how they work. – Xentius May 02 '13 at 07:13

1 Answers1

0

Those are functions in the packet32 library, not in the WinPcap library. Packet32 is a library of routines that provide access to the lower-level packet capture mechanism that WinPcap uses, in a fashion that hides from WinPcap the differences between "Windows OT" (95, 98, Me) and Windows NT (modern versions of Windows, up to and including Windows 8); it's not intended to be used by users. See the page about packet32 in the WinPcap documentation.

You don't need a console application that checks any of the packet32 routines. What you need is a console application that checks the WinPcap routines; if packet32 isn't working, those routines won't work, either. So you should look at some of the sample programs on the Internet for libpcap/WinPcap.

  • I am going to implement another driver depends on packet32.dll and only packet32.dll seems to be enough for me. I do not need wpcap.dll and hence do not want to install it. My current problem is that at at first system loads Packet32.dll but just after a few seconds it gets unloaded. Do you have an idea about it? – Xentius May 03 '13 at 08:16