1 // basic_types.hpp --------------------------------------------------------------// 2 3 // Copyright 2010 Vicente J. Botet Escriba 4 // Copyright 2015 Andrey Semashev 5 6 // Distributed under the Boost Software License, Version 1.0. 7 // See http://www.boost.org/LICENSE_1_0.txt 8 9 #ifndef BOOST_DETAIL_WINAPI_BASIC_TYPES_HPP 10 #define BOOST_DETAIL_WINAPI_BASIC_TYPES_HPP 11 12 #include <cstdarg> 13 #include <boost/cstdint.hpp> 14 #include <boost/detail/winapi/config.hpp> 15 16 #ifdef BOOST_HAS_PRAGMA_ONCE 17 #pragma once 18 #endif 19 20 #if defined( BOOST_USE_WINDOWS_H ) 21 # include <windows.h> 22 #elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined(__CYGWIN__) 23 # include <winerror.h> 24 # ifdef UNDER_CE 25 # ifndef WINAPI 26 # ifndef _WIN32_WCE_EMULATION 27 # define WINAPI __cdecl // Note this doesn't match the desktop definition 28 # else 29 # define WINAPI __stdcall 30 # endif 31 # endif 32 // Windows CE defines a few functions as inline functions in kfuncs.h 33 typedef int BOOL; 34 typedef unsigned long DWORD; 35 typedef void* HANDLE; 36 # include <kfuncs.h> 37 # else 38 # ifndef WINAPI 39 # define WINAPI __stdcall 40 # endif 41 # endif 42 # ifndef NTAPI 43 # define NTAPI __stdcall 44 # endif 45 #else 46 # error "Win32 functions not available" 47 #endif 48 49 #ifndef NO_STRICT 50 #ifndef STRICT 51 #define STRICT 1 52 #endif 53 #endif 54 55 #if defined(STRICT) 56 #define BOOST_DETAIL_WINAPI_DECLARE_HANDLE(x) struct x##__; typedef struct x##__ *x 57 #else 58 #define BOOST_DETAIL_WINAPI_DECLARE_HANDLE(x) typedef void* x 59 #endif 60 61 #if !defined( BOOST_USE_WINDOWS_H ) 62 extern "C" { 63 union _LARGE_INTEGER; 64 struct _SECURITY_ATTRIBUTES; 65 BOOST_DETAIL_WINAPI_DECLARE_HANDLE(HINSTANCE); 66 typedef HINSTANCE HMODULE; 67 } 68 #endif 69 70 #if defined(__GNUC__) 71 #define BOOST_DETAIL_WINAPI_MAY_ALIAS __attribute__ ((__may_alias__)) 72 #else 73 #define BOOST_DETAIL_WINAPI_MAY_ALIAS 74 #endif 75 76 // MinGW64 gcc 4.8.2 fails to compile function declarations with boost::detail::winapi::VOID_ arguments even though 77 // the typedef expands to void. In Windows SDK, VOID is a macro which unfolds to void. We use our own macro in such cases. 78 #define BOOST_DETAIL_WINAPI_VOID void 79 80 namespace boost { 81 namespace detail { 82 namespace winapi { 83 #if defined( BOOST_USE_WINDOWS_H ) 84 85 typedef ::BOOL BOOL_; 86 typedef ::PBOOL PBOOL_; 87 typedef ::LPBOOL LPBOOL_; 88 typedef ::BOOLEAN BOOLEAN_; 89 typedef ::PBOOLEAN PBOOLEAN_; 90 typedef ::BYTE BYTE_; 91 typedef ::PBYTE PBYTE_; 92 typedef ::LPBYTE LPBYTE_; 93 typedef ::WORD WORD_; 94 typedef ::PWORD PWORD_; 95 typedef ::LPWORD LPWORD_; 96 typedef ::DWORD DWORD_; 97 typedef ::PDWORD PDWORD_; 98 typedef ::LPDWORD LPDWORD_; 99 typedef ::HANDLE HANDLE_; 100 typedef ::PHANDLE PHANDLE_; 101 typedef ::SHORT SHORT_; 102 typedef ::PSHORT PSHORT_; 103 typedef ::USHORT USHORT_; 104 typedef ::PUSHORT PUSHORT_; 105 typedef ::INT INT_; 106 typedef ::PINT PINT_; 107 typedef ::LPINT LPINT_; 108 typedef ::UINT UINT_; 109 typedef ::PUINT PUINT_; 110 typedef ::LONG LONG_; 111 typedef ::PLONG PLONG_; 112 typedef ::LPLONG LPLONG_; 113 typedef ::ULONG ULONG_; 114 typedef ::PULONG PULONG_; 115 typedef ::LONGLONG LONGLONG_; 116 typedef ::ULONGLONG ULONGLONG_; 117 typedef ::INT_PTR INT_PTR_; 118 typedef ::UINT_PTR UINT_PTR_; 119 typedef ::LONG_PTR LONG_PTR_; 120 typedef ::ULONG_PTR ULONG_PTR_; 121 typedef ::DWORD_PTR DWORD_PTR_; 122 typedef ::PDWORD_PTR PDWORD_PTR_; 123 typedef ::SIZE_T SIZE_T_; 124 typedef ::PSIZE_T PSIZE_T_; 125 typedef ::SSIZE_T SSIZE_T_; 126 typedef ::PSSIZE_T PSSIZE_T_; 127 typedef VOID VOID_; // VOID is a macro 128 typedef ::PVOID PVOID_; 129 typedef ::LPVOID LPVOID_; 130 typedef ::LPCVOID LPCVOID_; 131 typedef ::CHAR CHAR_; 132 typedef ::LPSTR LPSTR_; 133 typedef ::LPCSTR LPCSTR_; 134 typedef ::WCHAR WCHAR_; 135 typedef ::LPWSTR LPWSTR_; 136 typedef ::LPCWSTR LPCWSTR_; 137 138 #else // defined( BOOST_USE_WINDOWS_H ) 139 140 typedef int BOOL_; 141 typedef BOOL_* PBOOL_; 142 typedef BOOL_* LPBOOL_; 143 typedef unsigned char BYTE_; 144 typedef BYTE_* PBYTE_; 145 typedef BYTE_* LPBYTE_; 146 typedef BYTE_ BOOLEAN_; 147 typedef BOOLEAN_* PBOOLEAN_; 148 typedef unsigned short WORD_; 149 typedef WORD_* PWORD_; 150 typedef WORD_* LPWORD_; 151 typedef unsigned long DWORD_; 152 typedef DWORD_* PDWORD_; 153 typedef DWORD_* LPDWORD_; 154 typedef void* HANDLE_; 155 typedef void** PHANDLE_; 156 157 typedef short SHORT_; 158 typedef SHORT_* PSHORT_; 159 typedef unsigned short USHORT_; 160 typedef USHORT_* PUSHORT_; 161 typedef int INT_; 162 typedef INT_* PINT_; 163 typedef INT_* LPINT_; 164 typedef unsigned int UINT_; 165 typedef UINT_* PUINT_; 166 typedef long LONG_; 167 typedef LONG_* PLONG_; 168 typedef LONG_* LPLONG_; 169 typedef unsigned long ULONG_; 170 typedef ULONG_* PULONG_; 171 172 typedef boost::int64_t LONGLONG_; 173 typedef boost::uint64_t ULONGLONG_; 174 175 # ifdef _WIN64 176 # if defined(__CYGWIN__) 177 typedef long INT_PTR_; 178 typedef unsigned long UINT_PTR_; 179 typedef long LONG_PTR_; 180 typedef unsigned long ULONG_PTR_; 181 # else 182 typedef __int64 INT_PTR_; 183 typedef unsigned __int64 UINT_PTR_; 184 typedef __int64 LONG_PTR_; 185 typedef unsigned __int64 ULONG_PTR_; 186 # endif 187 # else 188 typedef int INT_PTR_; 189 typedef unsigned int UINT_PTR_; 190 typedef long LONG_PTR_; 191 typedef unsigned long ULONG_PTR_; 192 # endif 193 194 typedef ULONG_PTR_ DWORD_PTR_, *PDWORD_PTR_; 195 typedef ULONG_PTR_ SIZE_T_, *PSIZE_T_; 196 typedef LONG_PTR_ SSIZE_T_, *PSSIZE_T_; 197 198 typedef void VOID_; 199 typedef void *PVOID_; 200 typedef void *LPVOID_; 201 typedef const void *LPCVOID_; 202 203 typedef char CHAR_; 204 typedef CHAR_ *LPSTR_; 205 typedef const CHAR_ *LPCSTR_; 206 207 typedef wchar_t WCHAR_; 208 typedef WCHAR_ *LPWSTR_; 209 typedef const WCHAR_ *LPCWSTR_; 210 211 #endif // defined( BOOST_USE_WINDOWS_H ) 212 213 typedef ::HMODULE HMODULE_; 214 215 typedef union BOOST_DETAIL_WINAPI_MAY_ALIAS _LARGE_INTEGER { 216 struct { 217 DWORD_ LowPart; 218 LONG_ HighPart; 219 } u; 220 LONGLONG_ QuadPart; 221 } LARGE_INTEGER_, *PLARGE_INTEGER_; 222 223 typedef struct BOOST_DETAIL_WINAPI_MAY_ALIAS _SECURITY_ATTRIBUTES { 224 DWORD_ nLength; 225 LPVOID_ lpSecurityDescriptor; 226 BOOL_ bInheritHandle; 227 } SECURITY_ATTRIBUTES_, *PSECURITY_ATTRIBUTES_, *LPSECURITY_ATTRIBUTES_; 228 229 } 230 } 231 } 232 233 #endif // BOOST_DETAIL_WINAPI_BASIC_TYPES_HPP 234