다음을 통해 공유


Exception Handling in Device Drivers (Windows Embedded CE 6.0)

1/6/2010

You should use structured exception handling (SEH) to recover from exceptions, such as alignment, access permissions, and so on when accessing caller buffers.

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.**

You should use CeOpenCallerBuffer and CeCloseCallerBuffer to verify that the caller has access to the memory that is pointed to by nested pointers; structures containing pointers must have the pointers validated.**

See Also

Concepts

Device Driver Development Concepts
Accessing Memory from a Driver

Other Resources

GetCurrentProcessId
GetOwnerProcess
Memory Architecture