PageRenderTime 343ms CodeModel.GetById 221ms app.highlight 2ms RepoModel.GetById 119ms app.codeStats 0ms

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