Share via


Choose Kernel Mode or User Mode (Compact 7)

3/12/2014

Kernel-mode drivers are loaded by device.dll inside the kernel and have full access to kernel APIs without having to go through the user-mode driver reflector. Kernel-mode drivers are faster than user-mode drivers because they do not have to switch user processes, so they are well suited to read or write to hardware registers. However, instability in the driver, such as incorrect or invalid memory use, can cause the kernel to stop functioning.

User-mode drivers are loaded via udevice.exe. They improve system stability by isolating driver failures to udevice.exe. The trade-off is performance. For user-mode drivers, the VirtualCopy function only works for physical addresses that you declare in the registry. You must use the user-mode driver reflector to forward I/O requests from the device manager. For more information about the reflector and how it works, see User Mode Driver Framework. For information about how to port a driver to Windows Embedded CE 6.0, see the video Microsoft Showcase: Porting Drivers to Windows Embedded CE 6.0.

Kernel Mode

To make your driver run in kernel mode, in the FLAGS registry key for the driver, clear the flag DEVFLAGS_LOAD_AS_USERPROC (0x10) and then add the K flag to the binary image builder (.bib) file entry, as shown in the following example:

gpio.dll        $(_FLATRELEASEDIR)\gpio.dll                NK SHK

User Mode

To make your driver run in user mode, in the FLAGS registry key for the driver, set the flag DEVFLAGS_LOAD_AS_USERPROC (0x10) and delete the K flag from the .bib file entry, as shown in the following example:

decodeCombo.dll $(_FLATRELEASEDIR)\decodeCombo.dll        NK    SH 

See Also

Concepts

Required Changes