How I can use NT DDK PACKET driver with VC++ ?

Posted on 1998-08-15
Last Modified: 2012-08-13
I've built the packet driver from ddk/network/packet directory, I've
got a packet32.dll, packet32.lib etc..., the testapp.c works fine. But
when I build my project in VC++ (with MFC) I get "unresolved external
symbol _PacketOpenAdapter" (obviusly for all packet functions), but
I've linked the library packet32.lib and I've put the 'extern "C"' in
all function prototypes in packet32.h, but it still don't work.

Anybody can help me ? How I can use packet32.lib under VC++ 4.2 ?

I've used packet driver that come with MSDN of August 1996, I don't
know if newer version works, anyone knows ?

Question by:b2s2
LVL 22

Expert Comment

ID: 1170387
I'm not familiar with this.  But I guess what is happening is that this is C code and you are trying to call it from C++ by adding the extern "C", is that right?

The problem might be calling convention.  In C++ the standard call calling convention.  As well as the extern "C", you might need to add a declaration that indicates the calling convention as well.  An incorrect calling convetions will obviously cause run-time errors, but it can cause link errors as well, because the standard call (VC's default) calling convention  decorates the name by adding an underscrore to the start and appending a "@XX to the end where the XX is the byte size fo the parameters.  

Accepted Solution

agreen earned 100 total points
ID: 1170388
Let me suggest you a very simple way to build your project. The BUILD utility makes the build.log file per project. You can find this file in the Driver,DLL and TESTAPP directories.

Carefully copy the compiler switches and preprocessor definitions to the Project/Settings/ C/C++, linker switches to the Project/Settings/Link, put the <ddk path>\inc and <ddk path>\src\network\inc directories to the Tools/Options/Directories and your project's ready.

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

775 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question