Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is it "Bad" to Build Drivers with Visual Studio?

Microsoft Visual Studio's linker has a /DRIVER flag specifically for building drivers:

Use the /DRIVER linker option to build a Windows NT kernel mode driver.

However, Microsoft says:

You must not build drivers by using the compiler or linker that Microsoft Visual Studio provides.

which begs the question:

Why should I not compile/link drivers with Visual Studio?

Is the output generated by the DDK/WDK tools different from that generated by Visual Studio?
If so, how is it different?


Edit:

Notice that I'm talking about using Visual Studio's compiler and linker, not libraries!

I use the WDK headers and libraries with VS's compilers and linkers, but Microsoft specifically says that I need to avoid this:

You must not build drivers by using the compiler or linker that Microsoft Visual Studio provides.

They didn't even mention headers and libraries, so of course that's not my question.

Why?

like image 598
user541686 Avatar asked Jun 05 '11 09:06

user541686


People also ask

How do I create a Visual Studio driver?

Create and build a driver. Open Microsoft Visual Studio. On the File menu, choose New > Project. In the Create a new project dialog box, select C++ in the left dropdown, choose Windows in the middle dropdown, and choose Driver in the right dropdown.

What is EWDK?

Enterprise WDK (EWDK) The EWDK is a standalone, self-contained command-line environment for building drivers. It includes Visual Studio Build Tools, the SDK, and the WDK. The latest public version of the EWDK contains Visual Studio 2022 Build Tools 17.1.


1 Answers

This article put me on the right track, I think. That's because the DDK tools use different runtime libraries than Visual Studio.

Visual Studio will link the driver with the runtime libraries it provides (or optionally, the latest version of the runtime installed on the system), but a driver should arguably be linked with the exact same runtime used to build the operating system itself.

like image 136
Frédéric Hamidi Avatar answered Oct 06 '22 01:10

Frédéric Hamidi