Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6370249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:54:20+00:00 2026-05-25T00:54:20+00:00

I’m developing a simple packet sender/receiver for some purpose (in Dev c++)..wanna add more

  • 0

I’m developing a simple packet sender/receiver for some purpose (in Dev c++)..wanna add more features to it. But I’m stuck at a point where I’m getting a strange error “Too many arguments to function”..My code is

#include <iostream>
#include <windows.h>

using namespace std;

int main(int argc, char *argv[])
{
 HINSTANCE dllhandle = LoadLibrary("wpcap.dll");
 FARPROC sendpacket = NULL, iface_handle = NULL;
 iface_handle = GetProcAddress(dllhandle, "pcap_open");
 char* iface_name = "\\Device\\NPF_{EADB4C21-B0AF-4EF2-86AB-80A37F399D1C}";
 char *errbuf[256];
 int iface = iface_handle(iface_name, 1000, 1, 500, NULL, errbuf);  // The Error is here
 system("pause");
 return 0;
}

Can anyone tell me where I am going wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T00:54:21+00:00Added an answer on May 25, 2026 at 12:54 am

    First, refer to the official documentation for pcap_open():

    pcap_t* pcap_open  ( const char *  source,  
      int  snaplen,  
      int  flags,  
      int  read_timeout,  
      struct pcap_rmtauth *  auth,  
      char *  errbuf   
     ) 
    

    Then look at the definition of FARPROC in windef.h:

    typedef INT_PTR (FAR WINAPI *FARPROC)();
    

    You’re attempting to call pcap_open() using a completely wrong function signature. That’s why the compiler is complaining that there’s too many arguments. If you even manage to make this compile, you’re almost certainly going to screw up the stack.


    And why are you dynamically loading the WinPcap dll using LoadLibrary()? Why not use the method outlined in the official documentation?

    To create an application that uses wpcap.dll with Microsoft Visual
    C++, follow these steps:

    Include the file pcap.h at the beginning of every source file that
    uses the functions exported by library.

    If your program uses Win32 specific functions of WinPcap, remember
    to include WPCAP among the preprocessor definitions.

    If your program uses the remote capture capabilities of WinPcap, add
    *HAVE_REMOTE* among the preprocessor definitions. Do not include
    remote-ext.h directly in your source files.

    Set the options of the linker to include the wpcap.lib library file
    specific for your target (x86 or x64). wpcap.lib for x86 can be found
    in the \lib folder of the WinPcap developer’s pack, wpcap.lib for x64
    can be found in the \lib\x64 folder.

    You’re using Dev C++, which probably doesn’t have the VC++ compiler. You still need to declare the proper function signature. One possible way is through a typedef:

    #include <iostream>
    #include <windows.h>
    
    struct pcap_t;
    struct pcap_rmtauth;
    typedef pcap_t* (*pcap_open_func_ptr)(const char *source,
        int snaplen, int flags, int read_timeout,
        pcap_rmtauth *auth, char *errbuf);
    
    int main(int argc, char *argv[])
    {
        HINSTANCE dllhandle = LoadLibrary("wpcap.dll");
        pcap_open_func_ptr iface_handle =
            reinterpret_cast<pcap_open_func_ptr>(
                GetProcAddress(dllhandle, "pcap_open"));
        char *errbuf[256];
        pcap_t* iface = iface_handle(iface_name, 1000, 1, 500, NULL, errbuf);
        // ...
        return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
Seemingly simple, but I cannot find anything relevant on the web. What is the
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
I want to construct a data frame in an Rcpp function, but when I
I'm parsing an XML file, the creators of it stuck in a bunch social

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.