Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2007-11-02 17:55:37


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


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk