You can add IOCTLs to the stream project when generated by the CEDriverWiz Wizard. The Simple IOCTLs option just adds five successive IOCTLs from a base value. Advanced IOCTLs add five IOCTL values that are unique for the OS using the CTL_CODE macro. The IOCTLs are defined in the driver’s header file and deduced in the XXX_IOControl function in the driver when a call is made to it. That function takes as a parameter an IOCTL value, and if the value is found in the switch statement, it returns true. Otherwise it returns false. To use the stream IOCTL interface, an application needs to include the stream header file. The IOCTL test application sends ten IOCTL values starting from the first so that five succeed and the next five fail.
1. Create a driver with Simple IOCTLs.
2. Build the driver and run the OS.
3. Run the TestIOCTls application.
4. Note that five pass and five fail.
5. Repeat 1 to 4 for Advanced IOCTls.
6. Note the values generated.