PREfast Warning 251 (Windows CE 5.0)
251 - InitializeCriticalSection indicates failure by raising an asynchronous exception.
Additional Information: Not protected by local exception handling.
Recommended Fix: Consider using an exception handler.
This warning indicates that a call to InitializeCriticalSection was detected outside of local exception handling.
In low memory situations, InitializeCriticalSection can raise a STATUS_NO_MEMORY exception. Most code does not protect against this possibility.
Example
Defective Source
InitializeCriticalSection(&Cs);
Corrected Source
__try {
InitializeCriticalSection(&Cs);
} __except(1) {
return; // initialization failed
}
Send Feedback on this topic to the authors