Author Topic: How do I program Kernel Driver in NASM?  (Read 10556 times)

Offline ben321

  • Full Member
  • **
  • Posts: 185
How do I program Kernel Driver in NASM?
« on: January 26, 2019, 09:01:22 PM »
My target OS is not any of the newer ones, as these require driver signing (by MS, not self-signed) for any driver installation (even when only testing). My target OSes are Windows 2000 (no signing required, you just get a warning that the driver is unsigned when you install it), and Windows XP (signing is normally required but you can disable this requirement with a certain system configuration for driver testing, or via a self-signed driver with a self-signed certificate).

I'm not wanting to support plug and play devices (it will need to be installed manually, rather than when Windows detects a device). I want my driver to be a virtual device, not a real one, as I only need it to experiment with kernel mode, not control a specific piece of hardware.

What I already know is that NASM can set the subsystem flag of a Windows executable to NATIVE, meaning that it should allow compiling of a driver. What I need to know is 2 things.
1: How do I get Windows itself to install/recognize the driver? Do I need to make an INF file, and if so what is the correct syntax for a driver INF file?
2: How do I call the driver's function from my main program that will access the driver? Do I just import functions like from a DLL, and then call those? Or do I need to do something else?

Offline debs3759

  • Global Moderator
  • Full Member
  • *****
  • Posts: 224
  • Country: gb
    • GPUZoo
Re: How do I program Kernel Driver in NASM?
« Reply #1 on: January 27, 2019, 09:49:35 PM »
It sounds like you need to download a copy of the ddk for that era and read the documentation with that, or find a Windows programming group. I don't mean to put you off, but I doubt you will find a Windows expert here.
My graphics card database: www.gpuzoo.com

Offline ben321

  • Full Member
  • **
  • Posts: 185
Re: How do I program Kernel Driver in NASM?
« Reply #2 on: January 28, 2019, 05:16:56 AM »
It sounds like you need to download a copy of the ddk for that era and read the documentation with that, or find a Windows programming group. I don't mean to put you off, but I doubt you will find a Windows expert here.

DDK is meant for C or C++. It's basically a collection of a bunch of header and library files for writing a driver, and not really well written documentation with it either. It was certainly never meant to help ASM programmers. I'd need to figure out how to translate all their sample C or C++ code into ASM, and then reverse engineer it until I discovered the very basics of writing a driver via ASM.

If you are going to write a driver for Windows via ASM, DDK will not help you, nor will most Windows programmers (as you suggested I should talk to). I came here to ask about this, because I know that ASM programmers are very familiar with the nitty-gritty of how computers work (basically ASM programmers are hackers), and could maybe shed some light on making a Windows driver from scratch via ASM..