X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Fwindows%2Fsystemerror.cpp;fp=source%2Fcore%2Fwindows%2Fsystemerror.cpp;h=98eb9ed221a3817052de50ffc7babb5797378ba8;hb=609c9a508cfdc7b42c46c4f21d17639204165a00;hp=0000000000000000000000000000000000000000;hpb=b4806214e905752617691f851717033fd3f266c2;p=libs%2Fcore.git diff --git a/source/core/windows/systemerror.cpp b/source/core/windows/systemerror.cpp new file mode 100644 index 0000000..98eb9ed --- /dev/null +++ b/source/core/windows/systemerror.cpp @@ -0,0 +1,20 @@ +#include +#include +#include "systemerror.h" + +using namespace std; + +namespace Msp { +string system_error::get_message(int c) +{ + if(c==-1) + c = GetLastError(); + + char msg[1024]; + if(FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, 0, c, 0, msg, sizeof(msg), 0)) + return msg; + else + return lexical_cast(c, Fmt().hex()); +} + +} // namespace Msp