How is my C ++ driver application call interface?

I have the driver source code and understand it. I am writing an application in user mode. I want to call driver functions. How should I do it?

some driver header code:

...
BYTE ReadRegister(DEVICE_CONTEXT *pDevice, BYTE SlavAddr, BYTE SlavMode, WORD RegAddr, BYTE* pData, BYTE DataCont);

BYTE WriteRegister(DEVICE_CONTEXT *pDevice, BYTE SlavAddr, BYTE SlavMode, WORD RegAddr, BYTE* pData, BYTE DataCont);
...

snippets of cpp driver code:

BYTE ReadRegister(DEVICE_CONTEXT *pDevice, BYTE SlavAddr, BYTE SlavMode, WORD RegAddr, BYTE* pData, BYTE DataCont)
{
.....
}

//-----------------------------------------------------------------------------
BYTE WriteRegister(DEVICE_CONTEXT *pDevice, BYTE SlavAddr, BYTE SlavMode, WORD RegAddr, BYTE* pData, BYTE DataCont)
{
....
}
+5
source share
1 answer

You cannot directly call the kernel driver API function. You must use the IOCTL API .

A typical workflow script is similar to this :

  • A user-mode application sends an IOCTL request, passing information about the called function, as well as a pointer to its argument stack.
  • , , IOCTL.
  • IOCTL DLL.
+7

All Articles