我正在运行全新安装的 Windows。除了 VC 和 SDK 没有安装其他程序
包括目录
C:\WinSDK10\Include\10.0.10586.0\shared;
C:\WinSDK10\Include\10.0.10586.0\km;
C:\WinSDK10\Include\10.0.10586.0\km\crt;
C:\WinSDK10\Include\wdf\kmdf\1.11目标操作系统版本
视窗 8.1
目标平台
桌面
运行 Wpp 跟踪
不
启用最小重建
不
资源:
#include <ntddk.h>
#include <wdf.h>
DRIVER_INITIALIZE DriverEntry;
EVT_WDF_DRIVER_DEVICE_ADD KmdfHelloWorldEvtDeviceAdd;
NTSTATUS DriverEntry(_In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_STRING RegistryPath)
{
NTSTATUS status;
WDF_DRIVER_CONFIG config;
KdPrintEx((DPFLTR_IHVDRIVER_ID, DPFLTR_INFO_LEVEL, "KmdfHelloWorld: DriverEntry\n"));
WDF_DRIVER_CONFIG_INIT(&config, KmdfHelloWorldEvtDeviceAdd);
status = WdfDriverCreate(DriverObject, RegistryPath, WDF_NO_OBJECT_ATTRIBUTES, &config, WDF_NO_HANDLE);
return status;
}
NTSTATUS KmdfHelloWorldEvtDeviceAdd(_In_ WDFDRIVER Driver, _Inout_ PWDFDEVICE_INIT DeviceInit)
{
NTSTATUS status;
WDFDEVICE hDevice;
UNREFERENCED_PARAMETER(Driver);
KdPrintEx((DPFLTR_IHVDRIVER_ID, DPFLTR_INFO_LEVEL, "KmdfHelloWorld: KmdfHelloWorldEvtDeviceAdd\n"));
status = WdfDeviceCreate(&DeviceInit, WDF_NO_OBJECT_ATTRIBUTES, &hDevice);
return status;
}
Severity Code Description Project File Line Suppression State
Error C2146 syntax error: missing ')' before identifier 'InformationClass' Test1 C:\WinSDK10\Include\10.0.10586.0\km\wdm.h 31789
Error C2146 syntax error: missing ')' before identifier 'InformationClass' Test1 C:\WinSDK10\Include\10.0.10586.0\km\wdm.h 31789
Error C2061 syntax error: identifier 'InformationClass' Test1 C:\WinSDK10\Include\10.0.10586.0\km\wdm.h 31789
Error C2061 syntax error: identifier 'InformationClass' Test1 C:\WinSDK10\Include\10.0.10586.0\km\wdm.h 31789
Error C2059 syntax error: ';' Test1 C:\WinSDK10\Include\10.0.10586.0\km\wdm.h 31789
Error C2059 syntax error: ';' Test1 C:\WinSDK10\Include\10.0.10586.0\km\wdm.h 31789
Error C2059 syntax error: ',' Test1 C:\WinSDK10\Include\10.0.10586.0\km\wdm.h 31789
Error C2059 syntax error: ',' Test1 C:\WinSDK10\Include\10.0.10586.0\km\wdm.h 31789
Error C2059 syntax error: ')' Test1 C:\WinSDK10\Include\10.0.10586.0\km\wdm.h 31792
Error C2059 syntax error: ')' Test1 C:\WinSDK10\Include\10.0.10586.0\km\wdm.h 31792
Error C2081 'EVENT_INFO_CLASS': name in formal parameter list illegal Test1 C:\WinSDK10\Include\10.0.10586.0\km\wdm.h 31789
Error C2081 'EVENT_INFO_CLASS': name in formal parameter list illegal Test1 C:\WinSDK10\Include\10.0.10586.0\km\wdm.h 31789
哈克:如果我编辑wdm.h
和删除驱动程序会成功构建#define _ETW_KM_
wdm.h
#ifndef _ETW_KM_
#define _ETW_KM_
#endif
#include <evntprov.h>
//
// Optional callback function that users provide.
//
typedef
_IRQL_requires_max_(PASSIVE_LEVEL)
_IRQL_requires_same_
VOID
NTAPI
ETWENABLECALLBACK (
_In_ LPCGUID SourceId,
_In_ ULONG ControlCode,
_In_ UCHAR Level,
_In_ ULONGLONG MatchAnyKeyword,
_In_ ULONGLONG MatchAllKeyword,
_In_opt_ PEVENT_FILTER_DESCRIPTOR FilterData,
_Inout_opt_ PVOID CallbackContext
);
typedef ETWENABLECALLBACK *PETWENABLECALLBACK;
抱歉这篇文章太长了!!我很确定在遵循此MSDN 驱动程序示例链接
时我做错了,但我不知道是什么。
谢谢你的时间,
克里斯