Cannot properly include wdm header files, etc. using a KMDF driver toaster template

Hello,

When I have used the KMDF toaster sample bus driver along with the co-installer project, including wdm.h in the driver source code causes such identifiers as DRIVER_ADD_DEVICE and DRIVER_STARTIO to be undefined, along with many other identifiers. The same code compiled successfully on VS 2015 on a separate computer prior to installing VS 2017 Professional on a new Windows 10 system. I have checked and it appears wdm.h is included in the system directory under the Visual Studio installation includes directory, however the directory relevant to WDM does not seem to be included in the VS (global or item) macro path variables with the VS installation. Additionally, this code uses the stdarg.h and stdio.h headers. I would need to be able to develop the kernel driver code under WDM using a KMDF sample. Once the project is loaded with VS 2017, the external dependencies directory contents include header files that are only relevant to wdf.

Regards,
Earl

green wrote:

When I have used the KMDF toaster sample bus driver along with the co-installer project, including wdm.h in the driver source code causes such identifiers as DRIVER_ADD_DEVICE and DRIVER_STARTIO to be undefined, along with many other identifiers.

That doesn’t make sense.  DRIVER_ADD_DEVICE is in wdm.h.

I have checked and it appears wdm.h is included in the system directory under the Visual Studio installation includes directory,

Which directory, exactly?  Between VS and the SDK and the WDK, there are
many, many directories involved.

however the directory relevant to WDM does not seem to be included in the VS (global or item) macro path variables with the VS installation.

Right.  The WDK is not included with Visual Studio.  It is a separate
installation.  Further, you have to fetch a version that matches your VS
version, and install it after VS so that the include paths can be
updated.  VS 2017 requires WDK 1809.  Did you install the 1809 WDK after
VS2017?

Additionally, this code uses the stdarg.h and stdio.h headers. I would need to be able to develop the kernel driver code under WDM using a KMDF sample. Once the project is loaded with VS 2017, the external dependencies directory contents include header files that are only relevant to wdf.

There are kernel-appropriate versions of <stdarg.h> and <stdio.h> in the
WDK.</stdio.h></stdarg.h>