zodiacon/WindowsInternals

Windows Kernel Error

zer0cat opened this issue · 2 comments

Hello,
I writing simple driver for your book, and have error with

DriverObject->MajorFunction[IRP_MJ_CREATE] = PriorityBoosterCreateClose;

Visual Studio2019 says, that NTSTATUS no equal PDRIVER_DISPATCH

Why?

I write
DriverObject->MajorFunction[IRP_MJ_CREATE] = (PDRIVER_DISPATCH)PriorityBoosterCreateClose;

But is it right way?

The cast is not needed, you must make sure your function is declared with the required prototype:
NTSTATUS PriorityBoosterCreateClose(PDEVICE_OBJECT, PIRP);

Sorry. I wrote PDRIVER_OBJECT instead of PDEVICE_OBJECT. I am stupid.
Thank you for the answer and for the book!