I have a driver source code, and understand it.
I write a app under user mode. I want to call functions of driver.
How should I do?
some driver headers 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);
...
driver cpp code pieces:
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)
{
....
}
You could not call directly kernel-mode driver API function. You shall use IOCTL API instead.
Usual workflow scenario is like this:
information about the function to be called, as well as a pointer to its
argument stack.
its own stack, calls the function, and passes the results back to the caller in
the IOCTL output buffer.
would after a normal DLL function call.