]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - win/inspircd_win32wrapper.cpp
m_ident Invalidate cache after changing User::ident
[user/henk/code/inspircd.git] / win / inspircd_win32wrapper.cpp
index 26d1548986b7745399c607f24fe8fb92ec7e0d61..ebc49852934409eb55d04c2e4303effa0c6fa201 100644 (file)
 #include "inspircd_win32wrapper.h"
 #include "inspircd.h"
 #include "configreader.h"
-#include "colors.h"
 #include <string>
 #include <errno.h>
 #include <assert.h>
-#include <mmsystem.h>
-#pragma comment(lib, "Winmm.lib")
 
 CoreExport const char *insp_inet_ntop(int af, const void *src, char *dst, socklen_t cnt)
 {
@@ -183,6 +180,28 @@ int getopt_long(int ___argc, char *const *___argv, const char *__shortopts, cons
        return 1;
 }
 
+CWin32Exception::CWin32Exception() : exception()
+{
+       dwErrorCode = GetLastError();
+       if( FormatMessageA( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, dwErrorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)szErrorString, _countof(szErrorString), NULL) == 0 )
+               sprintf_s(szErrorString, _countof(szErrorString), "Error code: %u", dwErrorCode);
+}
+
+CWin32Exception::CWin32Exception(const CWin32Exception& other)
+{
+       strcpy_s(szErrorString, _countof(szErrorString), other.szErrorString);
+}
+
+const char* CWin32Exception::what() const throw()
+{
+       return szErrorString;
+}
+
+DWORD CWin32Exception::GetErrorCode()
+{
+       return dwErrorCode;
+}
+
 #include "../src/modules/m_spanningtree/link.h"
 #include "../src/modules/ssl.h"
 template class reference<Link>;