/mordor/predef.h

http://github.com/mozy/mordor · C Header · 91 lines · 62 code · 15 blank · 14 comment · 0 complexity · c43bcd16d4c3ca94fe6be0be4df0b461 MD5 · raw file

  1. #ifndef __MORDOR_PREDEF_H__
  2. #define __MORDOR_PREDEF_H__
  3. #include "version.h"
  4. #ifdef WINDOWS
  5. // Get Win7+ APIs
  6. #ifndef _WIN32_WINNT
  7. #define _WIN32_WINNT 0x0601
  8. #endif
  9. // Don't include tons of crap from windows.h
  10. #define WIN32_LEAN_AND_MEAN
  11. // Define this so security.h works
  12. #define SECURITY_WIN32
  13. // Shut up, CRT
  14. #ifndef _CRT_SECURE_NO_WARNINGS
  15. #define _CRT_SECURE_NO_WARNINGS
  16. #endif
  17. #ifndef _CRT_NONSTDC_NO_WARNINGS
  18. #define _CRT_NONSTDC_NO_WARNINGS
  19. #endif
  20. #ifndef _SCL_SECURE_NO_WARNINGS
  21. #define _SCL_SECURE_NO_WARNINGS
  22. #endif
  23. // Use more common names for functions
  24. // (cross-platform 64-bit, strip the underscores)
  25. #define atoll _atoi64
  26. #define strtoll _strtoi64
  27. #define strtoull _strtoui64
  28. #if !defined(strnicmp)
  29. #define strnicmp _strnicmp
  30. #endif
  31. #define mkdir _mkdir
  32. #define snprintf _snprintf
  33. #include <ntstatus.h>
  34. #define WIN32_NO_STATUS
  35. #include <windows.h>
  36. // define the PSAPI_VERSION to 1 so that we can still run on old XP systems
  37. // The specific function that was failing fo kalypso was GetModuleName
  38. /* http://msdn.microsoft.com/en-us/library/windows/desktop/ms683196(v=vs.85).aspx */
  39. #define PSAPI_VERSION (1)
  40. // 'inet_addr' is deprecated but will break xp machines if we replace it.
  41. // Use inet_pton() or InetPton() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings
  42. #define _WINSOCK_DEPRECATED_NO_WARNINGS
  43. #include <ws2tcpip.h>
  44. // Take things out of the preprocessor, and put into the global namespace
  45. // From WinGDI.h: #define ERROR 0
  46. #ifdef ERROR
  47. #undef ERROR
  48. enum {
  49. ERROR = 0
  50. };
  51. #endif
  52. // From WinNT.h: #define DELETE (0x00010000L)
  53. #ifdef DELETE
  54. #undef DELETE
  55. enum {
  56. DELETE = (0x00010000L)
  57. };
  58. #endif
  59. #else
  60. #ifdef LINUX
  61. #include <sys/sysmacros.h>
  62. #ifdef major
  63. #undef major
  64. #endif
  65. #ifdef minor
  66. #undef minor
  67. #endif
  68. #endif
  69. #ifndef stricmp
  70. #define stricmp(a,b) strcasecmp(a,b)
  71. #endif
  72. #ifndef strnicmp
  73. #define strnicmp(a,b,c) strncasecmp(a,b,c)
  74. #endif
  75. #endif
  76. #endif