
2 Nov
2007
2 Nov
'07
9:55 p.m.
David Deakins wrote:
I ran across a case this morning where the FormatMessage Win32 call in boost::system_error_category::message() fails (the error message table did not have an entry for the error code that was passed).
Grrr... That's what I get for taking some Microsoft example code at face value.
Unfortunately, when this happens lpMsgBuf is not initialized to anything and trying to use it can result in an access violation. The attached patch adds checks to catch situations where FormatMessage fails.
Thanks! Much appreciated! Before apply the patch, I'll try to figure out a a test case or two. Out of curiosity, what was the code that failed? Was it actually a valid code? --Beman