Programming => Operating Systems => Other => Topic started by: Gizmo on November 06, 2015, 01:39:27 pm

Title: Creating an ATA Disk Driver
Post by: Gizmo on November 06, 2015, 01:39:27 pm

I need a more native way for my program to "talk" to hard disks (partly for the reasons in thsi linked thread, amongst others :,29987.msg190306.html#msg190306). i.e. instead of using WinAPI calls like CreateFileW and so on, that rely on what the OS understands of the hardware, I actually need to ask the disks ATA controller questions and get the answers directly. This means I need to write (or find) a disk driver that I can distribute with my program.

Other than this ( and a few articles about existing keyboard, mouse and video card driver units, info seems to be a little slim. I have a copy of the 2005 ATA specifications, but working out how the various flags in that specification correspond to writing of a driver with FPC, I have no idea.

Does anyone have any links to either projects that teach you the basics of writing hardware drivers, existing disk drivers with accompanying API (not sure if I could use this: or any general advice on achieving this.

Yes : I know it will not be easy. Yes, I know it will mean bit level values and so on. Yes, I know it's not a task for someone who has never done it before. But we have to start somewhere. Thus my question.

Title: Re: Creating an ATA Disk Driver
Post by: engkin on November 06, 2015, 02:26:21 pm
DDDK 0.0.4 (
Title: Re: Creating an ATA Disk Driver
Post by: Gizmo on November 06, 2015, 03:43:37 pm
Thanks Engkin...a useful link.

The documentation is a bit "limited" though. It seems like it's an overall kit for developing drivers for anything using Delphi. But working out how you use it to create a specific driver for a disk, or a printer, or a video card, or whatever, will take some working out.

It's also quite old now - 5 years since release.

I'd have hoped in this day and age there might be a more active project, with more instructive guidance?
Title: Re: Creating an ATA Disk Driver
Post by: PascalDragon on November 13, 2015, 03:34:12 pm
For what you want to do writing a driver is way overkill (see my answer in your other thread), especially since you need to tell Windows to load your driver for the ATA controller. If you only have one controller then you'd need your driver to be good enough to successfully boot Windows. Not a good idea...
For writing Windows drivers in FPC the NativeNT target is indeed the right choice (though right now it only supports 32-bit x86). Regarding tutorials I'd suggest you to look at C tutorials since most NT drivers are written in C. The more modern frameworks (like the Kernel Mode Driver Framework) might be a bit more complicated, I've only tested to write a simple, legacy style HelloWorld driver in FPC.

TinyPortal © 2005-2018