diff options
author | ChrisTX <chris@rev-crew.info> | 2013-03-23 23:52:51 +0100 |
---|---|---|
committer | attilamolnar <attilamolnar@hush.com> | 2013-03-25 14:57:05 +0100 |
commit | 25aa23067133fa80df009c2245742b3b7749c2e5 (patch) | |
tree | 50e9e6603d8a9322f28efb2a5115911d0d3e2b1d /win/inspircd_win32wrapper.cpp | |
parent | f2a5fa58edb13ad70764ecd8c5d52041b8b6eed0 (diff) |
Win32: Rewrite the service wrapper
Edited original commit to pass MAX_PATH as nSize to GetModuleFileNameA() instead of 101 after approval from author @ChrisTX (Attila Molnar)
Fixes #404 reported by @crchauffe
Diffstat (limited to 'win/inspircd_win32wrapper.cpp')
-rw-r--r-- | win/inspircd_win32wrapper.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/win/inspircd_win32wrapper.cpp b/win/inspircd_win32wrapper.cpp index a451dd0df..ebc498529 100644 --- a/win/inspircd_win32wrapper.cpp +++ b/win/inspircd_win32wrapper.cpp @@ -180,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>; |