Thursday 13 November 2008

Calling Kernel IO Controls (OEMIoControl) from user space in Windows Embedded CE 6.0

Due to the architecture change of Windows Embedded CE 6.0, Kernel IO Control call go through a kernel mode component called oalioctl.dll. The source code for this component can be found at %_WINCEROOT%\PUBLIC\COMMON\OAK\OALIOCTL. By default, it has a list of 5 user-accessible Kernel IOCTL codes in a switch case statement: IOCTL_HAL_GET_CACHE_INFO, IOCTL_HAL_GET_DEVICE_INFO, IOCTL_HAL_GET_DEVICEID, IOCTL_HAL_GET_UUID and IOCTL_PROCESSOR_INFORMATION, even though IOCTL_HAL_GET_DEVICEID and IOCTL_HAL_GET_UUID are deprecated and there functionality can now be accessed via new SPI_* codes in IOCTL_HAL_GET_DEVICE_INFO. If your user mode application or driver now calls one of the IOCTLs listed in OALIOCTL, the call will be forwarded to the OAL code, for all other IOCTLs the call will be rejected. But remember this is only true for user mode processes and not for kernel mode driver.

Now why am I telling you this you might ask? Well you can clone the OALIOCT component to your Platform and add any Kernel IOCTL to the switch case statement that you would like to allow from user space. Therefore you just need to make sure that the component compiles as oalioctl.dll in your Platform. No .bib or .reg entries are necessary.

Have fun!

No comments: