diff -rub boost_1_53_0.org/libs/random/src/random_device.cpp boost_1_53_0/libs/random/src/random_device.cpp --- boost_1_53_0.org/libs/random/src/random_device.cpp Tue Apr 5 21:27:52 2011 +++ boost_1_53_0/libs/random/src/random_device.cpp Wed Apr 10 12:33:51 2013 @@ -104,18 +110,22 @@ private: void error(const std::string & msg) { char buf[80]; + DWORD error_code (GetLastError()); DWORD num = FormatMessageA( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, - GetLastError(), + error_code, 0, buf, sizeof(buf), NULL); + char hex_error[9]; + hex_error[8] = 0; + _snprintf (hex_error, sizeof (hex_error), "%08x", error_code); throw std::invalid_argument("boost::random_device: " + msg + - " Cryptopraphic Service Provider " + provider + - ": " + std::string(&buf[0], &buf[0] + num)); + ": " + hex_error + " " + std::string(&buf[0], &buf[0] + num) + + " (Cryptographic Service Provider: " + provider + ")"); } const std::string provider; HCRYPTPROV hProv;