Building NT drivers




Easy Code version 1.06.0.0001 and later add the new Classic NT driver (sys) project type, which allows you to get into 32-bit driver programming. When you choose a Classic NT driver (sys) project type, a basic structure is created and the minimum required files are also added (ntddk.inc, ntoskrnl.inc and ntoskrnl.lib). This driver default code can be built without errors, but it just does nothing.

In addtiion to the usual .inc files located at \Masm32\Include, driver programming requires some extra .inc files which can be found in the \EasyCode.Ms\Include folder. So, in order to avoid errors when programming a driver, please take into account the following considerations:

WARNING: The ntddk.inc file is ALWAYS included by Easy Code in driver projects, even if it is removed from the Project Explorer.


Although Easy Code gives the necessary support, driver programming is not an easy task, specially for being debugged, and most programming errors go into a blue screen (BSOD). If you like to get into driver programming, you can find a good tutorial for beginners at Kernel Mode Drivers website.

Also, you can find a simple 32-bit driver example (ECPDriver), which gets all processes running in the system, and a little application to test it (ECPDrvTest). Both have been programmed by Héctor A. Medina and are located in the \EasyCode.Ms\Examples folder. You can get more 32-bit driver examples by clicking the following link:

More driver examples coded for Masm


Since the default driver project created by Easy Code uses the TextAddrW macro, the Easy Code macros option (in the Project properties) must be checked for the project to be built with no errors.


REMARKS: The Easy Code driver project type only supports 32-bit NT driver programming (.sys) for Windows NT and later, so there is no support for Windows 95/98/ME drivers (.vxd). However, you can design and build NT drivers on Windows 95/98/ME, although you will not be able to test them because they do not work on none of those three operating systems.

SPECIAL THANKS: Héctor Antonio Medina who has worked very hard to make possible that Easy Code can include the necessary support for driver programming.

VERY IMPORTANT: The ntoskrnl.lib library coming with previous versions of MASM32 v11, references all its functions to ntoskrnl.dll instead of ntoskrnl.exe (ntoskrnl.dll does not exist in the system). As a result, driver projects built with that library never work. To solve this problem, just click the link below to download the modified ntoskrnl.lib library working fine and move it to the \Masm32\Lib folder overwriting the existing one (no other project will be affected by this change). However, this replacement WILL NOT be necessary if you are using MASM32 v11 or later.

Download the fixed ntoskrnl.lib library for versions previous to MASM32 v11