ADDING AN IOCTL TO THE OAL
In this activity, you add a new IOCTL and its handler inside the OAL of a cloned Virtual PC BSP. It’s best to use a cloned BSP because this activity can modify the BSP’s source code.
The OAL IOCTLs that an application can call is limited because it runs in user mode. User mode threads have limited access to kernel functionality. To test the new IOCTL, add a simple stream driver that loads at startup in kernel mode. This driver can call the kernel in its XXX_Init function.
To add a new IOCTL to the BSP’s OAL you need to:
1. Define the IOCTL index in the list of the BSPs’ OALs.
2. Specify the function that handles the IOCTL.
3. Associate the IOCTL and its handler function.
4. Implement the IOCTL handler.
5. Rebuild the OAL.
6. Remake the OS image.
Clone the Compact 7 Virtual PC BSP as in Chapter 6 but for the VPC BSP. Only complete the section “Clone an Existing BSP.” None of the other sections in that chapter are relevant here. Create, build, and test a Debug build of the OS with the cloned BSP.
Defining a New IOCTL
A new IOCTL
is to be defined. Defining a new IOCTL for an OAL requires three new entries the BSP source code.
1. In Solution Explorer navigate to the $(_WINCEROOT)\PLATFORM\<Your cloned BSP>\src\inc folder.
2. Open vpc_ioctl.h.
Define the IOCTL enum
The first entry is its enum definition in the header file:
3. Find the IOCTL enums:
- From the top do a Quick Search for enum. (There is only one in ...