2008-08-06 18:36:30 +00:00
|
|
|
// This file is part of BOINC.
|
2005-01-20 23:22:22 +00:00
|
|
|
// http://boinc.berkeley.edu
|
2008-08-06 18:36:30 +00:00
|
|
|
// Copyright (C) 2008 University of California
|
2004-11-14 08:29:32 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// BOINC is free software; you can redistribute it and/or modify it
|
|
|
|
// under the terms of the GNU Lesser General Public License
|
|
|
|
// as published by the Free Software Foundation,
|
|
|
|
// either version 3 of the License, or (at your option) any later version.
|
2004-07-13 13:54:09 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// BOINC is distributed in the hope that it will be useful,
|
2005-01-20 23:22:22 +00:00
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU Lesser General Public License for more details.
|
2004-06-10 07:49:50 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
2004-06-10 07:49:50 +00:00
|
|
|
|
2017-01-27 04:59:11 +00:00
|
|
|
// boinc_win.h : include file for Windows builds.
|
|
|
|
// Includes standard system include files,
|
|
|
|
// and aliases function names like getpid -> _getpid
|
|
|
|
//
|
|
|
|
// ?? Is this only for Visual Studio, or for MINGW too?
|
|
|
|
// comments below are contradictory
|
2004-03-04 11:41:43 +00:00
|
|
|
|
2017-04-08 06:54:49 +00:00
|
|
|
#ifndef BOINC_BOINC_WIN_H
|
|
|
|
#define BOINC_BOINC_WIN_H
|
2004-03-04 11:41:43 +00:00
|
|
|
|
2017-01-27 04:59:11 +00:00
|
|
|
#ifdef _MSC_VER
|
2017-01-27 09:27:32 +00:00
|
|
|
#pragma warning(disable: 4996) // deprecated function names
|
2023-03-22 21:23:14 +00:00
|
|
|
//#pragma warning(disable: 4127) // constant conditional expression
|
2017-01-27 09:27:32 +00:00
|
|
|
#pragma warning(disable: 4244) // conversion from int to char
|
2019-11-20 18:53:15 +00:00
|
|
|
#define chdir _chdir
|
2020-08-31 20:56:15 +00:00
|
|
|
#define finite _finite
|
2019-11-20 18:53:15 +00:00
|
|
|
#define getpid _getpid
|
2017-01-27 04:59:11 +00:00
|
|
|
#define getcwd _getcwd
|
|
|
|
#define strdate _strdate
|
2019-11-20 18:53:15 +00:00
|
|
|
#define strdup _strdup
|
2017-01-27 04:59:11 +00:00
|
|
|
#define stricmp _stricmp
|
|
|
|
#define strtime _strtime
|
2020-08-31 20:56:15 +00:00
|
|
|
#define unlink _unlink
|
2017-01-27 04:59:11 +00:00
|
|
|
#endif
|
|
|
|
|
2017-02-16 05:01:55 +00:00
|
|
|
#ifdef __MINGW32__
|
|
|
|
#define strdate _strdate
|
|
|
|
#define strtime _strtime
|
2020-08-31 20:56:15 +00:00
|
|
|
#define getcwd _getcwd
|
|
|
|
#define finite _finite
|
2017-02-16 05:01:55 +00:00
|
|
|
#endif
|
|
|
|
|
2014-04-29 14:50:33 +00:00
|
|
|
#ifndef HAVE_CONFIG_H
|
2010-03-16 18:53:55 +00:00
|
|
|
|
|
|
|
// Windows C Runtime Library
|
2017-01-27 04:59:11 +00:00
|
|
|
// These are Visual Studio version dependent.
|
|
|
|
// If you aren't using VS, you'll probably need
|
2014-05-02 22:40:59 +00:00
|
|
|
// to edit this file or create a config.h
|
|
|
|
// For MINGW32 and MINGW64, it's best to run autoconf if possible.
|
2010-03-16 18:53:55 +00:00
|
|
|
|
|
|
|
#ifndef HAVE_STD_MAX
|
|
|
|
#define HAVE_STD_MAX 1
|
2023-05-05 18:05:20 +00:00
|
|
|
#endif
|
2010-03-16 18:53:55 +00:00
|
|
|
|
|
|
|
#ifndef HAVE_STD_MIN
|
|
|
|
#define HAVE_STD_MIN 1
|
2023-05-05 18:05:20 +00:00
|
|
|
#endif
|
2010-03-16 18:53:55 +00:00
|
|
|
|
|
|
|
#ifndef HAVE_STD_TRANSFORM
|
|
|
|
#define HAVE_STD_TRANSFORM 1
|
2023-05-05 18:05:20 +00:00
|
|
|
#endif
|
2010-03-16 18:53:55 +00:00
|
|
|
|
|
|
|
#ifndef HAVE_ALLOCA
|
|
|
|
#define HAVE_ALLOCA 1
|
2023-05-05 18:05:20 +00:00
|
|
|
#endif
|
2010-03-16 18:53:55 +00:00
|
|
|
|
2011-06-02 16:25:30 +00:00
|
|
|
#ifdef __MINGW32__
|
|
|
|
#define HAVE_STRCASECMP 1
|
|
|
|
#endif
|
|
|
|
|
2023-05-05 18:05:20 +00:00
|
|
|
/*
|
2014-05-08 21:17:03 +00:00
|
|
|
* WINSOCK vs WINSOCK2 could be an issue in compiles because we include multiple
|
2023-05-05 18:05:20 +00:00
|
|
|
* packages that have the same choice. The wx currently packed with BOINC
|
|
|
|
* uses WINSOCK, so we have to not include WINSOCK2 by undefining
|
2014-05-08 21:17:03 +00:00
|
|
|
* HAVE_WINSOCK2_H. That limits what CURL in its header file as well. We might
|
|
|
|
* need something more complicated if CURL and wxWidgets decide to go in
|
|
|
|
* opposite directions.
|
|
|
|
*/
|
2014-05-02 22:40:59 +00:00
|
|
|
#define USE_WINSOCK 1
|
2014-05-08 20:46:26 +00:00
|
|
|
#undef HAVE_WINSOCK2_H
|
2014-05-02 22:40:59 +00:00
|
|
|
#define HAVE_WINSOCK_H 1
|
|
|
|
#define HAVE_WINDOWS_H 1
|
|
|
|
#define HAVE_WS2TCPIP_H 1
|
|
|
|
#define HAVE_WINHTTP_H 1
|
|
|
|
#define HAVE_WINTERNL_H 1
|
|
|
|
#define HAVE_DELAYIMP_H 1
|
2014-06-20 14:48:31 +00:00
|
|
|
#define HAVE_INTRIN_H 1
|
2014-05-02 22:40:59 +00:00
|
|
|
#define HAVE_FCNTL_H 1
|
|
|
|
#define HAVE_CRTDBG_H 1
|
|
|
|
#define HAVE_DECL_FPRESET 1
|
|
|
|
#define HAVE_DECL__FPRESET 1
|
2014-06-20 14:48:31 +00:00
|
|
|
#define HAVE_DECL___CPUID 1
|
|
|
|
#define HAVE_MSVCRT 1
|
|
|
|
#define HAVE__CONFIGTHREADLOCALE 1
|
|
|
|
#define HAVE_DECL___CPUID 1
|
|
|
|
|
|
|
|
#if ( _MSC_FULL_VER >= 160040219 )
|
|
|
|
#define HAVE_DECL__XGETBV 1
|
|
|
|
#else
|
|
|
|
#define HAVE_DECL__XGETBV 0
|
|
|
|
#endif
|
|
|
|
|
2010-03-16 18:53:55 +00:00
|
|
|
#else
|
|
|
|
|
2014-04-29 14:50:33 +00:00
|
|
|
// Under any system that can run configure we need to include config.h first.
|
2005-12-16 03:35:15 +00:00
|
|
|
#include "config.h"
|
2010-03-16 18:53:55 +00:00
|
|
|
|
2005-12-16 03:35:15 +00:00
|
|
|
#endif
|
|
|
|
|
2004-03-04 11:41:43 +00:00
|
|
|
// Windows System Libraries
|
|
|
|
//
|
|
|
|
|
2005-07-06 09:14:43 +00:00
|
|
|
// Visual Studio 2005 has extended the C Run-Time Library by including "secure"
|
|
|
|
// runtime functions and deprecating the previous function prototypes. Since
|
|
|
|
// we need to use the previous prototypes to maintain compatibility with other
|
|
|
|
// platforms we are going to disable the deprecation warnings if we are compiling
|
|
|
|
// on Visual Studio 2005
|
|
|
|
#if _MSC_VER >= 1400
|
2016-02-16 13:48:08 +00:00
|
|
|
#ifndef _CRT_SECURE_NO_DEPRECATE
|
|
|
|
#define _CRT_SECURE_NO_DEPRECATE
|
|
|
|
#endif
|
|
|
|
#ifndef _CRT_SECURE_NO_WARNINGS
|
|
|
|
#define _CRT_SECURE_NO_WARNINGS
|
|
|
|
#endif
|
2006-04-18 04:26:56 +00:00
|
|
|
#endif
|
2005-07-06 09:14:43 +00:00
|
|
|
|
2014-03-06 23:27:54 +00:00
|
|
|
// Target Windows XP or better with Internet Explorer 5.01 or better
|
2009-07-29 23:50:00 +00:00
|
|
|
#ifndef WINVER
|
2014-03-06 23:27:54 +00:00
|
|
|
#define WINVER 0x0501
|
2004-03-04 11:41:43 +00:00
|
|
|
#endif
|
2009-07-29 23:50:00 +00:00
|
|
|
#ifndef _WIN32_WINNT
|
2014-03-06 23:27:54 +00:00
|
|
|
#define _WIN32_WINNT 0x0501
|
2004-03-04 11:41:43 +00:00
|
|
|
#endif
|
2009-07-29 23:50:00 +00:00
|
|
|
#ifndef _WIN32_WINDOWS
|
2014-03-06 23:27:54 +00:00
|
|
|
#define _WIN32_WINDOWS 0x0501
|
2004-03-04 11:41:43 +00:00
|
|
|
#endif
|
2009-07-29 23:50:00 +00:00
|
|
|
#ifndef _WIN32_IE
|
2009-11-13 21:23:15 +00:00
|
|
|
#define _WIN32_IE 0x0501
|
2006-06-09 19:57:36 +00:00
|
|
|
#endif
|
2013-11-15 04:26:06 +00:00
|
|
|
#ifndef SECURITY_WIN32
|
|
|
|
#define SECURITY_WIN32
|
|
|
|
#endif
|
2004-03-04 11:41:43 +00:00
|
|
|
|
2005-12-16 03:35:15 +00:00
|
|
|
#if !defined(__CYGWIN32__) || defined(USE_WINSOCK)
|
2006-04-14 03:09:24 +00:00
|
|
|
|
2005-12-16 03:35:15 +00:00
|
|
|
/* If we're not running under CYGWIN use windows networking */
|
|
|
|
#undef USE_WINSOCK
|
|
|
|
#define USE_WINSOCK 1
|
2014-06-20 14:48:31 +00:00
|
|
|
/* wxWidgets doesn't do winsock 2, so ignore it for now */
|
2014-04-29 14:50:33 +00:00
|
|
|
#ifdef HAVE_WINSOCK2_H
|
|
|
|
#include <winsock2.h>
|
2014-05-02 22:40:59 +00:00
|
|
|
#elif defined(HAVE_WINSOCK_H)
|
2004-03-04 11:41:43 +00:00
|
|
|
#include <winsock.h>
|
2014-04-29 14:50:33 +00:00
|
|
|
#endif
|
2005-12-16 03:35:15 +00:00
|
|
|
|
2014-05-02 00:44:34 +00:00
|
|
|
#ifndef HAVE_SOCKLEN_T
|
2007-11-13 17:25:23 +00:00
|
|
|
typedef size_t socklen_t;
|
2014-05-02 00:44:34 +00:00
|
|
|
#endif
|
2007-11-13 17:25:23 +00:00
|
|
|
|
2023-05-05 18:05:20 +00:00
|
|
|
#else
|
2006-04-14 03:09:24 +00:00
|
|
|
|
2005-12-16 03:35:15 +00:00
|
|
|
/* Under cygwin, curl was probably compiled to use <sys/socket.h> */
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#include <netinet/tcp.h>
|
|
|
|
#include <arpa/inet.h>
|
|
|
|
#include <netdb.h>
|
|
|
|
#define _WINSOCK_H
|
|
|
|
#define _WINSOCKAPI_
|
|
|
|
#define _WINSOCK2_H
|
|
|
|
#define _WININET_H
|
|
|
|
#define _WININETAPI_
|
2006-04-14 03:09:24 +00:00
|
|
|
|
2005-12-16 03:35:15 +00:00
|
|
|
#endif
|
|
|
|
|
2014-04-29 14:50:33 +00:00
|
|
|
#include <windows.h>
|
2014-05-02 22:40:59 +00:00
|
|
|
#ifdef HAVE_WINTERNL_H
|
2014-04-29 14:50:33 +00:00
|
|
|
#include <winternl.h>
|
2014-05-02 22:40:59 +00:00
|
|
|
#endif
|
2014-04-29 14:50:33 +00:00
|
|
|
#include <share.h>
|
|
|
|
#include <shlobj.h>
|
|
|
|
#include <userenv.h>
|
2018-12-13 22:24:05 +00:00
|
|
|
#ifdef HAVE_WINHTTP_H
|
|
|
|
#include <winhttp.h>
|
|
|
|
#endif
|
2014-04-29 14:50:33 +00:00
|
|
|
#include <aclapi.h>
|
|
|
|
#include <psapi.h>
|
|
|
|
#include <iphlpapi.h>
|
|
|
|
#include <wtsapi32.h>
|
|
|
|
|
2004-03-04 11:41:43 +00:00
|
|
|
#include <process.h>
|
2005-12-16 03:35:15 +00:00
|
|
|
#if defined(__MINGW32__) || defined(__CYGWIN32__)
|
2005-12-01 00:25:21 +00:00
|
|
|
#include <pbt.h>
|
|
|
|
#endif
|
|
|
|
|
2004-03-04 11:41:43 +00:00
|
|
|
#include <commctrl.h>
|
|
|
|
#include <raserror.h>
|
2010-05-14 16:22:57 +00:00
|
|
|
#if defined(__MINGW32__)
|
2009-11-16 13:13:42 +00:00
|
|
|
#include <stdint.h>
|
2014-05-02 00:44:34 +00:00
|
|
|
#ifdef HAVE_SECURITY_H
|
|
|
|
#include <security.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_DBGHELP_H
|
|
|
|
#include <dbghelp.h>
|
|
|
|
#endif
|
2009-10-07 19:17:52 +00:00
|
|
|
#include <imagehlp.h>
|
|
|
|
#else
|
2014-01-31 07:15:03 +00:00
|
|
|
#include <security.h>
|
2006-05-01 21:36:38 +00:00
|
|
|
#include <dbghelp.h>
|
2009-10-07 19:17:52 +00:00
|
|
|
#endif
|
2006-05-01 21:36:38 +00:00
|
|
|
#include <tlhelp32.h>
|
|
|
|
|
2014-05-02 00:44:34 +00:00
|
|
|
|
2006-05-17 07:44:54 +00:00
|
|
|
#include <io.h>
|
2005-12-16 03:35:15 +00:00
|
|
|
#if !defined(__CYGWIN32__)
|
2004-03-08 18:54:55 +00:00
|
|
|
#include <direct.h>
|
2005-12-16 03:35:15 +00:00
|
|
|
#endif
|
2006-04-14 03:09:24 +00:00
|
|
|
|
2005-12-16 03:35:15 +00:00
|
|
|
#if !defined(__CYGWIN32__)
|
2004-03-08 18:54:55 +00:00
|
|
|
#include <tchar.h>
|
2006-04-14 03:09:24 +00:00
|
|
|
#else
|
|
|
|
#ifndef _TCHAR_DEFINED
|
|
|
|
typedef char TCHAR, *PTCHAR;
|
|
|
|
typedef unsigned char TBYTE , *PTBYTE ;
|
|
|
|
#define _TCHAR_DEFINED
|
|
|
|
#endif /* !_TCHAR_DEFINED */
|
|
|
|
typedef LPSTR LPTCH, PTCH;
|
|
|
|
typedef LPSTR PTSTR, LPTSTR, PUTSTR, LPUTSTR;
|
|
|
|
typedef LPCSTR PCTSTR, LPCTSTR, PCUTSTR, LPCUTSTR;
|
|
|
|
#define __TEXT(quote) quote
|
2005-12-01 00:25:21 +00:00
|
|
|
#endif
|
2006-05-01 21:36:38 +00:00
|
|
|
|
2004-12-06 23:02:47 +00:00
|
|
|
// All projects should be using std::min and std::max instead of the Windows
|
|
|
|
// version of the symbols.
|
|
|
|
#undef min
|
|
|
|
#undef max
|
|
|
|
|
2004-03-04 11:41:43 +00:00
|
|
|
// Standard Libraries
|
|
|
|
//
|
|
|
|
|
2004-07-13 13:54:09 +00:00
|
|
|
// C headers
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <sys/types.h>
|
2014-05-02 22:40:59 +00:00
|
|
|
#ifdef HAVE_FCNTL_H
|
2004-12-07 23:04:12 +00:00
|
|
|
#include <fcntl.h>
|
2009-10-07 19:17:52 +00:00
|
|
|
#endif
|
2006-05-11 23:19:04 +00:00
|
|
|
#include <malloc.h>
|
2004-12-07 23:04:12 +00:00
|
|
|
|
2014-05-02 22:40:59 +00:00
|
|
|
#ifdef HAVE_CRTDBG_H
|
2006-05-17 07:44:54 +00:00
|
|
|
#include <crtdbg.h>
|
2014-04-29 14:59:06 +00:00
|
|
|
#endif
|
|
|
|
|
2023-05-05 18:05:20 +00:00
|
|
|
#if defined(HAVE_DELAYIMP_H)
|
2006-05-17 07:44:54 +00:00
|
|
|
#include <delayimp.h>
|
|
|
|
#endif
|
|
|
|
|
2014-05-02 22:40:59 +00:00
|
|
|
#if defined(__MINGW32__) && !defined(HAVE_WINTERNL_H)
|
|
|
|
#ifdef HAVE_NTAPI_H
|
|
|
|
#include <ntapi.h>
|
|
|
|
#elif defined(HAVE_DDK_NTAPI_H)
|
|
|
|
#include <ddk/ntapi.h>
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2014-04-29 14:59:06 +00:00
|
|
|
|
2004-12-08 07:53:30 +00:00
|
|
|
#ifdef __cplusplus
|
2010-05-11 19:10:29 +00:00
|
|
|
#include <algorithm>
|
2004-03-04 11:41:43 +00:00
|
|
|
#include <cassert>
|
|
|
|
#include <cctype>
|
2004-07-13 13:54:09 +00:00
|
|
|
#include <cerrno>
|
2004-03-04 11:41:43 +00:00
|
|
|
#include <cmath>
|
2004-07-13 13:54:09 +00:00
|
|
|
#include <csetjmp>
|
2006-05-11 23:19:04 +00:00
|
|
|
#include <csignal>
|
2004-07-13 13:54:09 +00:00
|
|
|
#include <cstdarg>
|
2004-03-04 11:41:43 +00:00
|
|
|
#include <cstdlib>
|
2005-12-01 00:25:21 +00:00
|
|
|
#include <cstdio>
|
2004-03-04 11:41:43 +00:00
|
|
|
#include <cstring>
|
2004-07-13 13:54:09 +00:00
|
|
|
#include <ctime>
|
2005-07-09 05:23:40 +00:00
|
|
|
#include <cfloat>
|
2005-02-04 10:14:03 +00:00
|
|
|
#include <locale>
|
2004-12-07 23:04:12 +00:00
|
|
|
#else
|
|
|
|
#include <assert.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <math.h>
|
|
|
|
#include <setjmp.h>
|
2006-05-11 23:19:04 +00:00
|
|
|
#include <signal.h>
|
2004-12-07 23:04:12 +00:00
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <time.h>
|
2005-07-09 05:23:40 +00:00
|
|
|
#include <float.h>
|
2005-02-04 10:14:03 +00:00
|
|
|
#include <locale.h>
|
2004-12-07 23:04:12 +00:00
|
|
|
#endif
|
|
|
|
|
2004-07-13 13:54:09 +00:00
|
|
|
// C++ headers
|
2004-12-08 07:38:22 +00:00
|
|
|
//
|
2004-12-08 07:53:30 +00:00
|
|
|
#ifdef __cplusplus
|
2004-07-13 13:54:09 +00:00
|
|
|
#include <algorithm>
|
2004-03-04 11:41:43 +00:00
|
|
|
#include <string>
|
|
|
|
#include <iostream>
|
|
|
|
#include <fstream>
|
|
|
|
#include <sstream>
|
|
|
|
#include <vector>
|
2004-09-30 21:41:09 +00:00
|
|
|
#include <deque>
|
2004-06-17 04:49:34 +00:00
|
|
|
#include <list>
|
2005-04-13 18:38:55 +00:00
|
|
|
#include <map>
|
|
|
|
#include <set>
|
2009-11-11 20:33:12 +00:00
|
|
|
#include <stdexcept>
|
2004-12-07 23:04:12 +00:00
|
|
|
#endif
|
2004-03-04 11:41:43 +00:00
|
|
|
|
2009-04-23 03:40:49 +00:00
|
|
|
// Define a generic string type that can be a Unicode string on
|
|
|
|
// Unicode builds and an ANSI string on ANSI builds
|
|
|
|
//
|
|
|
|
#ifdef _UNICODE
|
|
|
|
#define tstring std::wstring
|
|
|
|
#else
|
|
|
|
#define tstring std::string
|
|
|
|
#endif
|
2006-05-11 23:19:04 +00:00
|
|
|
|
|
|
|
#ifndef SIGRTMAX
|
|
|
|
#if defined(_SIGRTMAX)
|
|
|
|
#define SIGRTMAX _SIGRTMAX
|
|
|
|
#elif defined(NSIG)
|
|
|
|
#define SIGRTMAX (NSIG-1)
|
|
|
|
#else
|
|
|
|
#define SIGRTMAX 32
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2007-03-20 01:42:36 +00:00
|
|
|
#ifndef __GNUC__
|
|
|
|
#define __attribute__(x)
|
2005-12-16 03:35:15 +00:00
|
|
|
#endif
|
2004-03-08 18:54:55 +00:00
|
|
|
|
2011-10-24 23:38:19 +00:00
|
|
|
#if defined(__MINGW32__)
|
2011-06-02 16:25:30 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2014-04-29 14:50:33 +00:00
|
|
|
#ifndef __MINGW_NOTHROW
|
|
|
|
#define __MINGW_NOTHROW
|
|
|
|
#endif
|
2014-05-02 22:40:59 +00:00
|
|
|
#if !HAVE_DECL__FPRESET
|
2014-04-29 14:50:33 +00:00
|
|
|
void __cdecl __MINGW_NOTHROW _fpreset (void);
|
|
|
|
#endif
|
2014-05-02 22:40:59 +00:00
|
|
|
#if !HAVE_DECL_FPRESET
|
2014-04-29 14:50:33 +00:00
|
|
|
void __cdecl __MINGW_NOTHROW fpreset (void);
|
|
|
|
#endif
|
2011-06-02 16:25:30 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif //cplusplus
|
2011-10-24 23:38:19 +00:00
|
|
|
#endif //MINGW32
|
|
|
|
|
|
|
|
#if defined(__MINGW32__) && (__GNUC__ < 4)
|
|
|
|
// breaks build on MinGW gcc-4
|
2008-01-31 18:34:51 +00:00
|
|
|
#define SetClassLongPtr SetClassLong
|
|
|
|
#define GCLP_HICON GCL_HICON
|
|
|
|
#define GCLP_HICONSM GCL_HICONSM
|
2011-03-26 02:19:21 +00:00
|
|
|
#endif //MINGW32 && GNUC < 4
|
2006-05-15 17:14:15 +00:00
|
|
|
|
2004-03-23 07:34:34 +00:00
|
|
|
// On the Win32 platform include file and line number information for each
|
|
|
|
// memory allocation/deallocation
|
|
|
|
#ifdef _DEBUG
|
|
|
|
|
2004-03-24 07:39:24 +00:00
|
|
|
#define malloc(s) _malloc_dbg(s, _NORMAL_BLOCK, __FILE__, __LINE__)
|
|
|
|
#define calloc(c, s) _calloc_dbg(c, s, _NORMAL_BLOCK, __FILE__, __LINE__)
|
|
|
|
#define realloc(p, s) _realloc_dbg(p, s, _NORMAL_BLOCK, __FILE__, __LINE__)
|
|
|
|
#define _expand(p, s) _expand_dbg(p, s, _NORMAL_BLOCK, __FILE__, __LINE__)
|
|
|
|
#define free(p) _free_dbg(p, _NORMAL_BLOCK)
|
|
|
|
#define _msize(p) _msize_dbg(p, _NORMAL_BLOCK)
|
|
|
|
#define _aligned_malloc(s, a) _aligned_malloc_dbg(s, a, __FILE__, __LINE__)
|
|
|
|
#define _aligned_realloc(p, s, a) _aligned_realloc_dbg(p, s, a, __FILE__, __LINE__)
|
|
|
|
#define _aligned_offset_malloc(s, a, o) _aligned_offset_malloc_dbg(s, a, o, __FILE__, __LINE__)
|
|
|
|
#define _aligned_offset_realloc(p, s, a, o) _aligned_offset_realloc_dbg(p, s, a, o, __FILE__, __LINE__)
|
|
|
|
#define _aligned_free(p) _aligned_free_dbg(p)
|
2004-03-23 07:34:34 +00:00
|
|
|
|
2004-12-06 23:02:47 +00:00
|
|
|
#ifndef DEBUG_NEW
|
2004-03-24 07:39:24 +00:00
|
|
|
#define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
|
2004-12-06 23:02:47 +00:00
|
|
|
#endif
|
2004-03-23 07:34:34 +00:00
|
|
|
|
2004-07-13 13:54:09 +00:00
|
|
|
// The following macros set and clear, respectively, given bits
|
|
|
|
// of the C runtime library debug flag, as specified by a bitmask.
|
|
|
|
#define SET_CRT_DEBUG_FIELD(a) _CrtSetDbgFlag((a) | _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG))
|
|
|
|
#define CLEAR_CRT_DEBUG_FIELD(a) _CrtSetDbgFlag(~(a) & _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG))
|
2004-03-23 07:34:34 +00:00
|
|
|
|
2004-03-24 07:39:24 +00:00
|
|
|
#else //_DEBUG
|
2004-03-23 07:34:34 +00:00
|
|
|
|
2004-12-06 23:02:47 +00:00
|
|
|
#ifndef DEBUG_NEW
|
2004-03-24 07:39:24 +00:00
|
|
|
#define DEBUG_NEW new
|
2004-12-06 23:02:47 +00:00
|
|
|
#endif
|
2004-03-23 07:34:34 +00:00
|
|
|
|
2004-07-13 13:54:09 +00:00
|
|
|
#define SET_CRT_DEBUG_FIELD(a) ((void) 0)
|
|
|
|
#define CLEAR_CRT_DEBUG_FIELD(a) ((void) 0)
|
2004-03-23 07:34:34 +00:00
|
|
|
|
|
|
|
#endif //_DEBUG
|
|
|
|
|
|
|
|
#define new DEBUG_NEW
|
|
|
|
|
2017-04-08 06:54:49 +00:00
|
|
|
#endif //BOINC_BOINC_WIN_H
|