// This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2008 University of California
//
// 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.
//
// BOINC is distributed in the hope that it will be useful,
// 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.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC. If not, see .
// 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
#ifndef BOINC_BOINC_WIN_H
#define BOINC_BOINC_WIN_H
#ifdef _MSC_VER
#pragma warning(disable: 4996) // deprecated function names
#pragma warning(disable: 4127) // constant conditional expression
#pragma warning(disable: 4244) // conversion from int to char
#define chdir _chdir
#define finite _finite
#define getpid _getpid
#define getcwd _getcwd
#define strdate _strdate
#define strdup _strdup
#define stricmp _stricmp
#define strtime _strtime
#define unlink _unlink
#define snprintf_s _snprintf_s
#if _MSC_VER < 1900
#define snprintf _snprintf
#endif
#endif
#ifdef __MINGW32__
#define strdate _strdate
#define strtime _strtime
#define getcwd _getcwd
#define finite _finite
#endif
#ifndef HAVE_CONFIG_H
// Windows C Runtime Library
// These are Visual Studio version dependent.
// If you aren't using VS, you'll probably need
// to edit this file or create a config.h
// For MINGW32 and MINGW64, it's best to run autoconf if possible.
#ifndef HAVE_STD_MAX
#define HAVE_STD_MAX 1
#endif
#ifndef HAVE_STD_MIN
#define HAVE_STD_MIN 1
#endif
#ifndef HAVE_STD_TRANSFORM
#define HAVE_STD_TRANSFORM 1
#endif
#ifndef HAVE_ALLOCA
#define HAVE_ALLOCA 1
#endif
#ifdef __MINGW32__
#define HAVE_STRCASECMP 1
#endif
/*
* WINSOCK vs WINSOCK2 could be an issue in compiles because we include multiple
* packages that have the same choice. The wx currently packed with BOINC
* uses WINSOCK, so we have to not include WINSOCK2 by undefining
* 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.
*/
#define USE_WINSOCK 1
#undef HAVE_WINSOCK2_H
#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
#define HAVE_INTRIN_H 1
#define HAVE_FCNTL_H 1
#define HAVE_CRTDBG_H 1
#define HAVE_DECL_FPRESET 1
#define HAVE_DECL__FPRESET 1
#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
#else
// Under any system that can run configure we need to include config.h first.
#include "config.h"
#endif
// Windows System Libraries
//
// 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
#ifndef _CRT_SECURE_NO_DEPRECATE
#define _CRT_SECURE_NO_DEPRECATE
#endif
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#endif
// Target Windows XP or better with Internet Explorer 5.01 or better
#ifndef WINVER
#define WINVER 0x0501
#endif
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#endif
#ifndef _WIN32_WINDOWS
#define _WIN32_WINDOWS 0x0501
#endif
#ifndef _WIN32_IE
#define _WIN32_IE 0x0501
#endif
#ifndef SECURITY_WIN32
#define SECURITY_WIN32
#endif
#if !defined(__CYGWIN32__) || defined(USE_WINSOCK)
/* If we're not running under CYGWIN use windows networking */
#undef USE_WINSOCK
#define USE_WINSOCK 1
/* wxWidgets doesn't do winsock 2, so ignore it for now */
#ifdef HAVE_WINSOCK2_H
#include
#elif defined(HAVE_WINSOCK_H)
#include
#endif
#ifndef HAVE_SOCKLEN_T
typedef size_t socklen_t;
#endif
#else
/* Under cygwin, curl was probably compiled to use */
#include
#include
#include
#include
#include
#include
#include
#define _WINSOCK_H
#define _WINSOCKAPI_
#define _WINSOCK2_H
#define _WININET_H
#define _WININETAPI_
#endif
#include
#ifdef HAVE_WINTERNL_H
#include
#endif
#include
#include
#include
#ifdef HAVE_WINHTTP_H
#include
#endif
#include
#include
#include
#include
#include
#if defined(__MINGW32__) || defined(__CYGWIN32__)
#include
#endif
#include
#include
#if defined(__MINGW32__)
#include
#ifdef HAVE_SECURITY_H
#include
#endif
#ifdef HAVE_DBGHELP_H
#include
#endif
#include
#else
#include
#include
#endif
#include
#include
#if !defined(__CYGWIN32__)
#include
#endif
#if !defined(__CYGWIN32__)
#include
#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
#endif
// All projects should be using std::min and std::max instead of the Windows
// version of the symbols.
#undef min
#undef max
// Standard Libraries
//
// C headers
#include
#include
#ifdef HAVE_FCNTL_H
#include
#endif
#include
#ifdef HAVE_CRTDBG_H
#include
#endif
#if defined(HAVE_DELAYIMP_H)
#include
#endif
#if defined(__MINGW32__) && !defined(HAVE_WINTERNL_H)
#ifdef HAVE_NTAPI_H
#include
#elif defined(HAVE_DDK_NTAPI_H)
#include
#endif
#endif
#ifdef __cplusplus
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#else
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#endif
// C++ headers
//
#ifdef __cplusplus
#include
#include
#include
#include
#include
#include
#include
#include
#include