]> git.tdb.fi Git - libs/core.git/blobdiff - source/core/except.cpp
Remove an obsolete Makefile
[libs/core.git] / source / core / except.cpp
index 4b6e4657a4b89833a373f506ec5782e1fcd24728..ddd2cb5167d57f0e3f5df614a8caf3ad3b68dc50 100644 (file)
@@ -4,7 +4,12 @@ This file is part of libmspcore
 Copyright © 2006-2007 Mikko Rasa, Mikkosoft Productions
 Distributed under the LGPL
 */
+
 #include <sstream>
+#include <cstring>
+#ifdef WIN32
+#include <windows.h>
+#endif
 #include "except.h"
 
 using namespace std;
@@ -34,7 +39,11 @@ string SystemError::build_what(const string &w, int e)
        ostringstream buf;
        buf<<w<<": ";
 #ifdef WIN32
-       buf<<e;
+       char msg[1024];
+       if(FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0, e, 0, msg, sizeof(msg), 0))
+               buf<<msg;
+       else
+               buf<<e;
 #else
        buf<<strerror(e);
 #endif