2004-06-10 07:49:50 +00:00
|
|
|
// The contents of this file are subject to the BOINC Public License
|
|
|
|
// Version 1.0 (the "License"); you may not use this file except in
|
|
|
|
// compliance with the License. You may obtain a copy of the License at
|
|
|
|
// http://boinc.berkeley.edu/license_1.0.txt
|
2004-07-13 13:54:09 +00:00
|
|
|
//
|
2004-06-10 07:49:50 +00:00
|
|
|
// Software distributed under the License is distributed on an "AS IS"
|
|
|
|
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
|
|
|
// License for the specific language governing rights and limitations
|
2004-07-13 13:54:09 +00:00
|
|
|
// under the License.
|
|
|
|
//
|
|
|
|
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
|
|
|
//
|
2004-06-10 07:49:50 +00:00
|
|
|
// The Initial Developer of the Original Code is the SETI@home project.
|
|
|
|
// Portions created by the SETI@home project are Copyright (C) 2002
|
2004-07-13 13:54:09 +00:00
|
|
|
// University of California at Berkeley. All Rights Reserved.
|
|
|
|
//
|
2004-06-10 07:49:50 +00:00
|
|
|
// Contributor(s):
|
|
|
|
//
|
|
|
|
|
2004-06-17 00:05:18 +00:00
|
|
|
// boinc_win.h : include file for standard system include files,
|
2004-03-04 11:41:43 +00:00
|
|
|
// or project specific include files that are used frequently,
|
|
|
|
// but are changed infrequently
|
|
|
|
|
2004-06-17 00:05:18 +00:00
|
|
|
#ifndef _BOINC_WIN_
|
|
|
|
#define _BOINC_WIN_
|
2004-03-04 11:41:43 +00:00
|
|
|
|
|
|
|
// Windows System Libraries
|
|
|
|
//
|
|
|
|
|
|
|
|
// Modify the following defines if you have to target a platform prior to the ones specified below.
|
|
|
|
// Refer to MSDN for the latest info on corresponding values for different platforms.
|
|
|
|
#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later.
|
2004-03-05 06:06:01 +00:00
|
|
|
#define WINVER 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
|
2004-03-04 11:41:43 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later.
|
2004-03-05 06:06:01 +00:00
|
|
|
#define _WIN32_WINNT 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
|
2004-07-13 13:54:09 +00:00
|
|
|
#endif
|
2004-03-04 11:41:43 +00:00
|
|
|
|
|
|
|
#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
|
2004-03-05 06:06:01 +00:00
|
|
|
#define _WIN32_WINDOWS 0x0400 // Change this to the appropriate value to target Windows Me or later.
|
2004-03-04 11:41:43 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later.
|
|
|
|
#define _WIN32_IE 0x0500 // Change this to the appropriate value to target IE 5.0 or later.
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// BOINC Windows GUI Applications use MFC libraries and the like.
|
2004-08-11 23:52:22 +00:00
|
|
|
#if !defined(_CONSOLE) && !defined(WXDEBUG) && !defined(WXNDEBUG)
|
2004-03-04 11:41:43 +00:00
|
|
|
|
2004-03-05 04:37:53 +00:00
|
|
|
#ifndef VC_EXTRALEAN
|
|
|
|
#define VC_EXTRALEAN
|
|
|
|
#endif
|
2004-03-04 11:41:43 +00:00
|
|
|
|
|
|
|
#include <afxwin.h> // MFC core and standard components
|
|
|
|
#include <afxcmn.h> // MFC support for Windows Common Controls
|
|
|
|
#include <afxtempl.h>
|
|
|
|
#include <afxcoll.h>
|
|
|
|
#include <afxext.h> // MFC extensions
|
|
|
|
|
|
|
|
#endif //_CONSOLE
|
|
|
|
|
|
|
|
#define WIN32_LEAN_AND_MEAN // This trims down the windows libraries.
|
|
|
|
#define WIN32_EXTRA_LEAN // Trims even farther.
|
|
|
|
|
|
|
|
#include <windows.h>
|
|
|
|
#include <winsock.h>
|
|
|
|
#include <wininet.h>
|
|
|
|
#include <process.h>
|
|
|
|
#include <commctrl.h>
|
|
|
|
#include <raserror.h>
|
2004-03-06 09:45:25 +00:00
|
|
|
#include <mmsystem.h>
|
2004-03-08 18:54:55 +00:00
|
|
|
#include <direct.h>
|
|
|
|
#include <io.h>
|
|
|
|
#include <crtdbg.h>
|
|
|
|
#include <tchar.h>
|
2004-03-23 07:34:34 +00:00
|
|
|
#include <crtdbg.h>
|
|
|
|
#include <delayimp.h>
|
2004-03-04 11:41:43 +00:00
|
|
|
|
2004-03-24 07:39:24 +00:00
|
|
|
#include "stackwalker_win.h"
|
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>
|
2004-03-04 11:41:43 +00:00
|
|
|
#include <cassert>
|
|
|
|
#include <cctype>
|
2004-07-13 13:54:09 +00:00
|
|
|
#include <cerrno>
|
|
|
|
#include <cerrno>
|
2004-03-04 11:41:43 +00:00
|
|
|
#include <cmath>
|
2004-07-13 13:54:09 +00:00
|
|
|
#include <csetjmp>
|
|
|
|
#include <cstdarg>
|
2004-03-04 11:41:43 +00:00
|
|
|
#include <cstdio>
|
|
|
|
#include <cstdlib>
|
|
|
|
#include <cstring>
|
2004-07-13 13:54:09 +00:00
|
|
|
#include <ctime>
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
|
|
|
// C++ headers
|
|
|
|
#include <algorithm>
|
2004-03-04 11:41:43 +00:00
|
|
|
#include <string>
|
|
|
|
#include <iostream>
|
|
|
|
#include <fstream>
|
|
|
|
#include <sstream>
|
|
|
|
#include <vector>
|
2004-06-17 04:49:34 +00:00
|
|
|
#include <list>
|
2004-06-13 23:17:33 +00:00
|
|
|
#include <locale>
|
2004-03-04 11:41:43 +00:00
|
|
|
|
|
|
|
|
2004-03-08 18:54:55 +00:00
|
|
|
#define vsnprintf _vsnprintf
|
2004-03-24 21:21:25 +00:00
|
|
|
#define snprintf _snprintf
|
2004-03-08 18:54:55 +00:00
|
|
|
#define fdopen _fdopen
|
|
|
|
#define dup _dup
|
|
|
|
#define unlink _unlink
|
|
|
|
#define strdup _strdup
|
|
|
|
#define read _read
|
|
|
|
#define stat _stat
|
|
|
|
|
|
|
|
|
2004-03-23 07:34:34 +00:00
|
|
|
// On the Win32 platform include file and line number information for each
|
|
|
|
// memory allocation/deallocation
|
2004-06-17 00:05:18 +00:00
|
|
|
#if !defined(__AFX_H__)
|
2004-03-23 07:34:34 +00:00
|
|
|
|
|
|
|
#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-03-24 07:39:24 +00:00
|
|
|
#define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
|
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-03-24 07:39:24 +00:00
|
|
|
#define DEBUG_NEW new
|
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
|
|
|
|
|
2004-06-17 00:05:18 +00:00
|
|
|
#endif
|
2004-03-23 07:34:34 +00:00
|
|
|
|
2004-06-30 18:17:21 +00:00
|
|
|
#endif //_BOINC_WIN_
|