Solved

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

Posted on 1998-08-15
2
449 Views
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 ?

Regards.
0
Comment
Question by:b2s2
2 Comments
 
LVL 22

Expert Comment

by:nietod
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.  
0
 
LVL 4

Accepted Solution

by:
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.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

863 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now