X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=win%2Finspircd_win32wrapper.cpp;h=7a07868f90907fe3f545901731163445e72d9dd1;hb=debedfeb0abb398443fa33452f486c6cc80bb832;hp=26d1548986b7745399c607f24fe8fb92ec7e0d61;hpb=5b9682275e384635a1fd9f7320cf4d9a604a43b4;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/win/inspircd_win32wrapper.cpp b/win/inspircd_win32wrapper.cpp index 26d154898..7a07868f9 100644 --- a/win/inspircd_win32wrapper.cpp +++ b/win/inspircd_win32wrapper.cpp @@ -22,15 +22,13 @@ * along with this program. If not, see . */ + #include "inspircd_win32wrapper.h" #include "inspircd.h" #include "configreader.h" -#include "colors.h" #include #include #include -#include -#pragma comment(lib, "Winmm.lib") CoreExport const char *insp_inet_ntop(int af, const void *src, char *dst, socklen_t cnt) { @@ -183,8 +181,30 @@ 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" +#include "modules/ssl.h" template class reference; template class reference; template class reference;