Export (0) Print
Expand All

Structured Exception Handling in Windows CE (Windows CE 5.0)

Windows CE 5.0
Send Feedback

When a fault occurs in thread processing, the OS raises an exception. The normal flow of control in the current thread is interrupted, the context is saved, and control is transferred to the exception-handling support code.

This support code marshals the exception information and then enters a section of the support code called the exception dispatcher. The exception dispatcher searches for exception handlers and invokes them in the proper sequence.

When the dispatcher invokes an exception handler, it calls the handler as a procedure with arguments that describe the following:

  • The nature of the exception
  • The environment that the exception was raised in
  • The environment that the handler was established in

When the handler is called, the exception is said to be delivered to the handler.

The handler responds to the exception in several ways, including various combinations of the following:

  • Performs an action that affects the context of the thread (possibly correcting the circumstances that led to the exception being raised).
  • Modifies or augments the description of the exception.
  • Raises a nested exception, causing another exception to occur in the context of the exception handler or in a procedure called directly or indirectly by the handler.

When an exception handler finishes processing an exception, it must indicate this in one of the following ways:

  • By indicating that the exception-handling support code should re-raise the exception and resume the search for another handler.
  • By indicating that the exception-handling support code should continue execution of the interrupted thread at the location indicated by the saved exception program counter.
  • By unwinding, which causes the exception-handling support code to resume execution of the thread at a point different than the point at which it was interrupted
  • By terminating execution of the thread.

All exceptions are handled with the same interfaces, data structures, and algorithms. That is, there is unified exception handling for all kinds of exceptions, regardless of their origination.

Each exception has an exception value that identifies the exception, such as subscript range violation, or memory access control violation.

Exceptions can also have one or more exception qualifiers associated with them, such as the name of an array and the subscript that was out of range, or an address associated with a memory access control violation.

See Also

Differences Between RISC and x86 Exception Handling | SEH in x86 Environments | SEH in RISC Environments


Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.


Show:
© 2014 Microsoft