Exception Handling in Device Drivers (Windows CE 5.0)
You should use structured exception handling (SEH) to recover from exceptions, such as alignment, access permissions, and so on when accessing caller buffers. You should use MapCallerPtr to validate nested pointer values; structures containing pointers must have the pointers validated.
Although you can use SEH, also known as __try/__except blocks, to handle exceptions caused by attempts to access caller buffers, nothing can protect the application from itself. If the application passes in a pointer in its own address space, and the driver updates the pointer, the application must use the correct pointer value. Device Manager encloses calls to driver entry points with __try/__except blocks so that unhandled driver crashes do not cause Device Manager to crash. Invalid pointer values might break the driver.
See Also
Accessing Memory from a Driver | GetCurrentProcessId | GetOwnerProcess | Memory Architecture
Send Feedback on this topic to the authors