erreur : C1083: Cannot open include file: 'wdm.h': No such file or directory

Oumaya picture Oumaya · Sep 28, 2012 · Viewed 11.2k times · Source

I am trying to build this code with qtcreator, my point is to create a new device using RtlInitUnicodeString and IoCreateDevice

#define _WIN32_WINNT 0x0501

#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <tchar.h>
#include <stdio.h>
#include <qdebug.h>

#include <wdm.h>
#include <Ntifs.h>
#include <windows.h>

#define BUFSIZE MAX_PATH

int main(  )
{
    BOOL bFlag;
    TCHAR Buf[BUFSIZE];     // temporary buffer for volume name


    //create a new device

    NTSTATUS    ntStatus = STATUS_SUCCESS;
    UNICODE_STRING      deviceNameUnicodeString;
    UNICODE_STRING      deviceLINKNameUnicodeString;
    int i;

    RtlInitUnicodeString(&deviceNameUnicodeString, L"\\Device\\Harddisk0\\Partition3");
    RtlInitUnicodeString(&deviceLINKNameUnicodeString, L"\\DosDevices\\I:");


    ntStatus = IoCreateDevice ( theDriverObject,
                                0, // For driver extension
                                &deviceNameUnicodeString,
                                FILE_DEVICE_UNKNOWN,
                                FILE_DEVICE_SECURE_OPEN,
                                FALSE,
                                &g_MyDeviceI);


    IoCreateSymbolicLink (&deviceLINKNameUnicodeString, &deviceNameUnicodeString);

I get this error:

erreur : C1083: Cannot open include file: 'wdm.h': No such file or directory

and here is my .pro file

SOURCES += \
    main.cpp \
    VolumeCreationWind.cpp \
    ChangePassWd.cpp \
    PasswordMountWind.cpp \
    MainWindow.cpp \
    DeviceInfos.cpp

HEADERS += \
    VolumeCreationWind.h \
    PasswordMountWind.h \
    ChangePassWd.h \
    MainWindow.h \
    DeviceInfos.h \


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

1) How can I fix the error of include path

2) can any one explain for me the use of IoCreateDevice and how create theDriverObject

Any help please!!!! Thanks in advance.

Answer