C provides unusual support, but there are still some exceptions in general C can't be captured. For example, floating point abnormality (divided), access exception (memory address illegal access), etc. If this exception occurs, it will cause the entire process to crash by default.
However, Windows also implements an exception mechanism to capture these issues. This abnormality is called SEH (Structure Exception Handle) exception. SEH is essentially a chain registration exception, and each function is registered to the system. When an exception occurs, the system queries the registered exception handle handle, find the corresponding, otherwise use the default exception handler handle.
Now I am using the VS.2005 CTP version to automatically implement this function in C , only need to be in the compiler option.
Project Properties-> C / C -> Code Generation-> Enable C Exceptions, select Yes (/ EHSC) Start SEH exception support
This allows you to use the SEH as a normal C anomaly in the program.
However, it should be noted that the type of SEH is only one, that is, the number of the long type, indicating the number of exceptions of SEH.
Such as
0x00000005 indicates access violations.