List of operations that the driver support
These two functions esentially do the samething. Approve request.
Matter of taste. WriteFile for me.
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = PriorityBoosterControl;
When the client calls DeviceIoControl
and pass in databuffer. The DeviceIOcontrol reaches the driver by invoking the IRP_MJ_DEVICE_CONTROL
Major functionsroutine
CTL_CODE
#define PRIORITY_BOOSTER_DEVICE 0x8000
#define IOCTL_PRIORITY_BOOSTER_SET_PRIORITY CTL_CODE(PRIORITY_BOOSTER_DEVICE, \\
0x800, METHOD_NEITHER, FILE_ANY_ACCESS)
This I/O code is passed to the driver and makes it executes different
routines based on the different IOCTLs that are passed to it through the
DeviceIoControl
API. Essentially, the dispatch routine at index IRP_MJ_DEVICE_CONTROL
will, at some point in its code, act like this switch case:
switch(IOCTL)
{
case 0xDEADBEEF:
DoThis();
break;
case 0xC0FFEE;
DoThat();
break;
case 0x600DBABE;
DoElse();
break;
}
needed to create a UNICODE_STRING to hold the internal device name;