Reputation: 123
I am running a fresh installation of Windows. No other programs installed except VC and SDK's
Include Directories
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
Target OS Version
Windows 8.1
Target Platform
Desktop
Run Wpp Tracing
No
Enable minimal rebuild
No
#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
Hack: The driver builds successfully if I edit wdm.h
and remove #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;
Sorry for the length of this post!!
I'm pretty sure I am doing something wrong while following this MSDN Driver Example Link but I can't figure out what.
Thanks for your time,
Kris
Upvotes: 3
Views: 4582
Reputation: 61
Encountered similar problem with next version of WDK (10.0.14393). Looks like in both cases the problem is different versions of Win SDK and WDK. Solved by installing the corresponding version of Win SDK. More detail in this answer.
Upvotes: 3
Reputation: 148
The error indicates the definition for EVENT_INFO_CLASS (Defined in evntprov.h) was not found. Another interesting thing is you are getting this for line number 31789 for method EtwSetInformation. This method needs to be imported only for (NTDDI_VERSION >= NTDDI_THRESHOLD) and you are targeting Win8.1. Something is wrong here. Please share the diagnostic msbuild log. It would be helpful to analyze.
Upvotes: 0
Reputation: 23218
Looks like an undefined identifier or macro...
The first of your error messages ( syntax error: missing ')' before identifier
) is probably the best key to understanding the issue.
The rest likely are a consequence of that one, which may be complaining that _IRQL_requires_same_
, (or one of the other identifiers) is not defined.
As suggested in the error message, look in the file C:\WinSDK10\Include\10.0.10586.0\km\wdm.h
for a clue as to what is not defined before InformationClass. Then include the header file that provides definition.
(Currently, There is no information in your post tying the line number 31789 listed in the error message to the exact corresponding line in your source code.)
This link has information on driver annotations (Microsoft Source Code Annotation Language (SAL)).
Upvotes: 0