Create and deploy a basic WDF kernel-mode driver.

I need to create problems that are easiest to deal with. I’m developing new drivers so I try to keep it simple, but I get an error when I try to include things like wdf.h. It seems odd to me that it doesn’t complain about these ntddk.h includes, even though they are in the same include folder. Usually I would appreciate any help.

I get a user error:
1>c:\testdrv\pathtest\test.c(1): error C1083: Could not delete included file: ‘wdf.h’: No archive or directory of this type

Here is my device file:

What version of WDF do I need to install Windows 10?

For Windows Vista, Windows 7, or Windows 8, use WDF 1.11 or earlier. For Windows 8.1, use KMDF 1.13 or earlier, UMDF 1.x, or UMDF 2.0. To register Windows 10 1507, use KMDF 1.15 or earlier or even UMDF 1.x or UMDF 2.15 or even earlier.

I’m building this code in conjunction with qtcreator, my goal is to create any new device with RtlInitUnicodeString in addition to IoCreateDevice

to create

Can’t open a WDF file?

Can’t even open the .wdf file? When customers double-click a file to open it, Windows checks the filename extension. When Windows recognizes a filename extension, the problem opens the file in the service associated with that filename extension only. If Windows does not fully understand the filename extension, you will receive the following message:

#define _WIN32_WINNT 0x0501




    BOOL flag flag;
    TCHAR Buf[BUFSIZE] ; // Temporary buffer as for volume name

    // create a new important device

    UNICODE_STRING DeviceNameUnicodeString;
    UNICODE_STRING deviceLINKNameUnicodeString;
    int I;

    RtlInitUnicodeString(&DeviceNameUnicodeString, L"\\Device\\Disk0\\Partition3");
    RtlInitUnicodeString(&deviceLINKNameUnicodeString, L"\\DosDevices\\I:");

    ntStatus = IoCreateDevice( theDriverObject,
                                0, // For extension
 Driver and DeviceNameUnicodeString,
                                &g_My DeviceI);

    IoCreateSymbolicLink(&deviceLINKNameUnicodeString, &deviceNameUnicodeString);

Error C1083: Could not open include image: 'wdm.h': No such directory or document

    Main Window.h\

CONFIG += release
INCLUDAPATH += C:\WinDDK\7600.16385.1\inc\ddk
INCLUDAPATH += C:\WinDDK\7600.16385.1\inc\wdf\kmdf\1.9

What is the difference between wdffileobjectwdmgetfileobject and wdfgetdriver?

The WdfFileObjectWdmGetFileObject method returns a Windows Driver Model (WDM) file object that is unmistakably associated with the specified computer file object structure. The WdfGetDriver method returns a handle to the structure driver target that represents the calling driver.

2) can anyoneexplain to me the new use of IoCreateDevice and how theDriverObject

is developed

I installed WDK On 10 on my computer, then tried to create a friendly driver (code below) and got an error:
An SDK that exactly matches the WDK version “8.1” has not been found at all. Please install the SDK before compiling. I downloaded and installed the Windows 10 SDK and then tried to build it another time. This time I got a lot of syntax errors, the following code

External "C"
#ifdef Alloc_text(INIT, alloc_pragma
#end if
NTSTATUS driver entry (IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath)

Indicates saving with errors: fatal
Error C1083: Could not open included computer file: 'ntddk.h': No such file or even directory
and several IntelliSense errors.

When compiling the custom WDF driver, I used the VisualDDK+VS2008 system environment, and there were many problems with the system environment.

1. During actual compilation, a compilation error similar to the following occurred:

C:\Program Files\Microsoft Visual Studio 9.0\VC\include\crtdefs.Error h(550): C2143: ErrorFormat box: ‘{‘ previously missing ‘const’

I can see the definition of the variable in the IDE, on the contrary, the variable cannot open wdf h be recognized because the IDE is compiling. The method is as follows:


Copy C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\sal.h and at this point overwrite C:\WinDDK\7600.16385.1\inc\api\sal.h.< /p >

2. After difficulty 1 is solved, the wounds follow:

Fatal error C1083: Could not open included file: ‘codeanalysis\sourceannotations.h’: directory for files of this type does not exist


  • Download source files – 5.19 KB File
  • Presentation

    In late December 2005, Microsoft launched the Windows Driver Foundation. It’s a huge new framework for building Windows application drivers. It is much more complex than the Windows Driver Model (WDM) and hence the situation is easier to learn and much less time consuming to develop tracking device drivers. This article will show your organization how to code, build, and use a kernel-mode WDF device driver framework. This article does not mention all the low-level concepts of driver development. To find out moreFor more on each of the core concepts, see the Related Documents section of this article.

    Typically, this article does not include a demonstration of the tablet driver application. It’s because he hasn’t started doing anything yet. The only thing the client needs is the DebugView utility.


    For those of you who don’t know what WDF is, this is the most important invention since sliced ​​bread. Until recently, when you needed a device owner, you often had to use the Windows Driver Model (WDM). WDM provides another low-level structure for creating component drivers. In this environment, your employees had to take PNP, power, and I/O requests and figure out what to do with them, depending on the status of each driver.

    There are several simple state maps that depict the transitions between and between the normally different states of the PNP, and between these different states of power, as well as the specific events that lead to the various transitions of government. At first glance, this seems simple enough. There are only half a dozen PNP states in System 6and electromechanical states, so it shouldn’t be hard, right?

    When you start writing your driver, you will find that the more you learn about WDM, the more confused you become. Implementing PNP is possible if you know you can use other people’s failover IRP queues. Otherwise, you will have to write them yourself. In fact, I’d say horror happens when you try to implement power management. Typically, your valuable device driver should manage the system power state policy at the same time, in addition to the device policy IRP. This is almost certainly quite tricky, and according to my documentation, you should never perform any blocking action while processing these IRPs. This means you have to embed it in a complex state machine tied to performance routines.