Windows Driver Development Fundamentals (iv) driver compilation debugging and Installation

Source: Internet
Author: User

Windows Driver Development Foundation, reprint marked Source: http://blog.csdn.net/ikerpeng/article/details/38793995


Let's talk about how to compile the driver after it's developed. Generally there are several ways to do this:

1. Create makefile file, compile and link with NMAKE tool;

2. Build makefile,sources, dirs file, compile with build tool.

3. Compile the link with the integrated development environment.


I used the third way to configure the Windows Driver development environment through VS2010+WDK. Address: http://blog.csdn.net/ikerpeng/article/details/38761441


But the next thing to say is part of the reason for that configuration:

There are 4 calling conventions in the process of compiling a function: C language calling convention: function is decorated with _cdecl; standard calling convention: function is decorated with _stdcall; fast calling convention: function is decorated with _fastcall; C + + class member function calling convention: function is decorated with thiscall.

The first two of them are often used. In the C language calling convention, a symbol is produced in the target file in place of the function: Underscore + function name, while the standard calling convention is in the form of an underscore + the name +@x, and X is returned. where x represents the number needed to clean up the stack. For example:

The Windows driver needs to use the standard calling convention, and for the DriverEntry function, the system will look for [email protected] as the driver's entry, but the VS2010 default is the C language calling convention. So there is only _driverentry, so the call will go wrong. So you set the call in C + + to the _stdcall adornment.


Tips:

1. Many of the C/C + + usage techniques are used with caution, and even the malloc function in the language and the new operation in the + C are not used. Because in kernel mode, the program cannot invoke the following API in user mode.


2. Finally an debug driver can be used: DbgView, install the driver can use Drivermonitor.


The end of this section.


Reference books:


A detailed description of the Windows Driver Development technology


Windows Driver Development Fundamentals (iv) driver compilation debugging and Installation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.