I am trying to run a simple driver for windows, but am getting the following error:
C1189 #error: "No Target Architecture" C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared\ntdef.h
My code:
#include <sdkddkver.h>
#include <ntddk.h>
#include <wdf.h>
DRIVER_INITIALIZE DriverEntry;
EVT_WDF_DRIVER_DEVICE_ADD KmdfHelloWorldEvtDeviceAdd;
_Use_decl_annotations_
VOID
DriverUnload(
)
{
KdPrint(("This is driver Exit \r\n"));
}
NTSTATUS
DriverEntry(
_In_ PDRIVER_OBJECT DriverObject,
_In_ PUNICODE_STRING RegistryPath
)
{
UNREFERENCED_PARAMETER(DriverObject);
UNREFERENCED_PARAMETER(RegistryPath);
// NTSTATUS variable to record success or failure
NTSTATUS status = STATUS_SUCCESS;
KdPrint(("This is driver entry \r\n"));
return status;
}
ntddk.h
includes ntdef.h
which is where the error happens:
#if defined(_AMD64_) || defined(_X86_)
#define PROBE_ALIGNMENT( _s ) TYPE_ALIGNMENT( ULONG )
#elif defined(_IA64_) || defined(_ARM_) || defined(_ARM64_)
#define PROBE_ALIGNMENT( _s ) TYPE_ALIGNMENT( ULONG )
#elif !defined(RC_INVOKED)
#error "No Target Architecture" // error
#endif
I have tried multiple other sample programs and always end up getting this error.