]> FriiDump Source - friidump.git/blob - libfriidump/win32compat.h
Harden GCC-4243N A102 HLDS E7 profile
[friidump.git] / libfriidump / win32compat.h
1 /***************************************************************************
2  *   Copyright (C) 2007 by Arep                                            *
3  *   Support is provided through the forums at                             *
4  *   http://www.console-tribe.com                                          *
5  *                                                                         *
6  *   This program is free software; you can redistribute it and/or modify  *
7  *   it under the terms of the GNU General Public License as published by  *
8  *   the Free Software Foundation; either version 2 of the License, or     *
9  *   (at your option) any later version.                                   *
10  *                                                                         *
11  *   This program is distributed in the hope that it will be useful,       *
12  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
13  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
14  *   GNU General Public License for more details.                          *
15  *                                                                         *
16  *   You should have received a copy of the GNU General Public License     *
17  *   along with this program; if not, write to the                         *
18  *   Free Software Foundation, Inc.,                                       *
19  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
20  ***************************************************************************/
21
22
23 /*** WINDOWS COMPATIBILITY STUFF ***/
24
25 #ifdef WIN32
26 #include <windows.h>
27 #include <time.h>
28
29 /* Stuff to export library symbols */
30 #ifdef FRIIDUMPLIB_BUILD_DLL
31 #ifdef FRIIDUMPLIB_EXPORTS
32 #define FRIIDUMPLIB_EXPORT __declspec(dllexport)  /* Building the lib */
33 #else
34 #define FRIIDUMPLIB_EXPORT __declspec(dllimport)  /* Building user code */
35 #endif
36 #else
37 #define FRIIDUMPLIB_EXPORT
38 #endif
39
40 /* Definition of the types we use for Windows */
41 #define u_int8_t BYTE
42 #define u_int16_t WORD
43 #define int32_t INT32
44 #define u_int32_t DWORD
45 #define int64_t INT64
46 #define u_int64_t ULONGLONG
47 typedef long suseconds_t;
48
49 /* Modern MSVC/UCRT provides snprintf; do not macro-alias it. */
50 #define strdup _strdup
51 #define strcasecmp lstrcmpi
52 #ifndef va_copy
53 #define va_copy(ap1, ap2) ((ap1) = (ap2))               /* MSVC compatibility */
54 #endif
55
56 /* Some functions do not exist (export them for applications, too) */
57 FRIIDUMPLIB_EXPORT char *strndup (const char *src, int c);
58 FRIIDUMPLIB_EXPORT int ftruncate (int fd, __int64 size);
59 FRIIDUMPLIB_EXPORT int gettimeofday(struct timeval *tv, struct timezone *tz);
60
61 /* Windows does have a different localtime() */
62 #define localtime_r(x, y) !localtime_s (y, x)
63
64 #else
65
66 #define FRIIDUMPLIB_EXPORT
67
68 #endif
69 /******/