Search code examples
c#c++driverdriverskmdf

How execute driver function in user-mode application?


I'm developing an app which communicates with a device driver. How do I call a function like this

VOID TchBklSetIntensity(BKL_CONTEXT* BklContext,ULONG Intensity)

in C# user-mode application?


Solution

  • A driver is isolated from user land space and those functions of the device driver exists within the realm of the kernel.

    However, there is usually, an accompanying libary that talks to the driver, via opening a specially designated filename, like this: XXXXX in which the library writes a certain byte sequence to that file, to talk to the driver. That API code would be then accessible by user land space, high level code such as, in this case, C#.

    For an example, reserved filenames such as, classi one is NUL which is a reserved filename (can be nul), in which redirecting to it is equivalent to Unix/Linux /dev/null.