I have Windows kernel-mode driver and user-mode DLL as an interlayer between driver and GUI application.
I send IRP_MJ_DEVICE_CONTROL requests from user-mode DLL to driver using DeviceIoControl function and it works well.
But I'd like to send IRP_MJ_SYSTEM_CONTROL requests from user-mode as well. I have pnp.c module in my driver source code with implementing DispatchSystemControl routine that handles such IRPs as IRP_MN_START_DEVICE, IRP_MN_START_DEVICE, IRP_MN_REMOVE_DEVICE and some other.
I can see that this handlers works well for example IRP_MN_REMOVE_DEVICE handler is called any time when I remove my device.
But I'd like to know is there any way to send IRP_MJ_SYSTEM_CONTROL requests from user-mode using some function for example in the same way as I send IRP_MJ_DEVICE_CONTROL using DeviceIoControl