]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - win/inspircd_win32wrapper.h
Add a va_copy define for Windows
[user/henk/code/inspircd.git] / win / inspircd_win32wrapper.h
index d60276b88fb5d3d73ab35c9b0882b24533f2287c..38754d5df4abf0bac8d5741b109ade9c8cf2c6d0 100644 (file)
  */
 
 
+#pragma once
+
 /* Windows Port
    Wrapper Functions/Definitions
    By Burlex */
-
-#ifndef INSPIRCD_WIN32WRAPPER_H
-#define INSPIRCD_WIN32WRAPPER_H
-
 /*
  * Starting with PSAPI version 2 for Windows 7 and Windows Server 2008 R2, this function is defined as K32GetProcessMemoryInfo in Psapi.h and exported
  * in Kernel32.lib and Kernel32.dll. However, you should always call this function as GetProcessMemoryInfo. To ensure correct resolution of symbols
@@ -45,9 +43,6 @@
 #define VC_EXTRALEAN
 #define WIN32_LEAN_AND_MEAN
 
-/* They just have to be *different*, don't they. */
-#define PATH_MAX MAX_PATH
-
 /* Macros for exporting symbols - dependant on what is being compiled */
 
 #ifdef DLL_BUILD
@@ -74,6 +69,9 @@
 #include <direct.h>
 #include <process.h>
 
+/* Windows defines this already. */
+#undef ERROR
+
 /* strcasecmp is not defined on windows by default */
 #define strcasecmp _stricmp
 #define strncasecmp _strnicmp
@@ -92,6 +90,10 @@ CoreExport const char * insp_inet_ntop(int af, const void * src, char * dst, soc
 #define snprintf _snprintf
 #define vsnprintf _vsnprintf
 
+#ifndef va_copy
+#define va_copy(dest, src) (dest = src)
+#endif
+
 /* Unix-style sleep (argument is in seconds) */
 __inline void sleep(int seconds) { Sleep(seconds * 1000); }
 
@@ -186,5 +188,17 @@ void ::operator delete(void * ptr);
 
 #define DISABLE_WRITEV
 
-#endif
+#include <exception>
 
+class CWin32Exception : public std::exception
+{
+public:
+       CWin32Exception();
+       CWin32Exception(const CWin32Exception& other);
+       virtual const char* what() const throw();
+       DWORD GetErrorCode();
+
+private:
+       char szErrorString[500];
+       DWORD dwErrorCode;
+};