]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - win/inspircd_win32wrapper.cpp
Merge pull request #461 from SaberUK/master+header-cleanup
[user/henk/code/inspircd.git] / win / inspircd_win32wrapper.cpp
index a451dd0df362908f2c8f607ec60a218ef53fd9b1..7a07868f90907fe3f545901731163445e72d9dd1 100644 (file)
@@ -22,6 +22,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+
 #include "inspircd_win32wrapper.h"
 #include "inspircd.h"
 #include "configreader.h"
@@ -180,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<Link>;
 template class reference<Autoconnect>;
 template class reference<ssl_cert>;