我正在尝试使用 qtcreator 构建此代码,我的意思是使用RtlInitUnicodeString
和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);
我收到此错误:
erreur : C1083: Cannot open include file: 'wdm.h': No such file or directory
这是我的 .pro 文件
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)如何修复包含路径的错误
2)任何人都可以为我解释使用IoCreateDevice
和如何创建theDriverObject
请任何帮助!!!!提前致谢。