File indexing completed on 2025-01-30 10:02:27
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_WINAPI_FILE_MAPPING_HPP_INCLUDED_
0012 #define BOOST_WINAPI_FILE_MAPPING_HPP_INCLUDED_
0013
0014 #include <boost/winapi/basic_types.hpp>
0015 #include <boost/winapi/detail/header.hpp>
0016
0017 #ifdef BOOST_HAS_PRAGMA_ONCE
0018 #pragma once
0019 #endif
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032 #if !defined( BOOST_USE_WINDOWS_H )
0033 extern "C" {
0034
0035 #if BOOST_WINAPI_PARTITION_DESKTOP
0036 #if !defined( BOOST_NO_ANSI_APIS )
0037 BOOST_WINAPI_IMPORT boost::winapi::HANDLE_ BOOST_WINAPI_WINAPI_CC
0038 CreateFileMappingA(
0039 boost::winapi::HANDLE_ hFile,
0040 ::_SECURITY_ATTRIBUTES* lpFileMappingAttributes,
0041 boost::winapi::DWORD_ flProtect,
0042 boost::winapi::DWORD_ dwMaximumSizeHigh,
0043 boost::winapi::DWORD_ dwMaximumSizeLow,
0044 boost::winapi::LPCSTR_ lpName);
0045
0046 BOOST_WINAPI_IMPORT boost::winapi::HANDLE_ BOOST_WINAPI_WINAPI_CC
0047 OpenFileMappingA(
0048 boost::winapi::DWORD_ dwDesiredAccess,
0049 boost::winapi::BOOL_ bInheritHandle,
0050 boost::winapi::LPCSTR_ lpName);
0051 #endif
0052 #endif
0053
0054 #if BOOST_WINAPI_PARTITION_DESKTOP || BOOST_WINAPI_PARTITION_SYSTEM
0055 BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::HANDLE_ BOOST_WINAPI_WINAPI_CC
0056 CreateFileMappingW(
0057 boost::winapi::HANDLE_ hFile,
0058 ::_SECURITY_ATTRIBUTES* lpFileMappingAttributes,
0059 boost::winapi::DWORD_ flProtect,
0060 boost::winapi::DWORD_ dwMaximumSizeHigh,
0061 boost::winapi::DWORD_ dwMaximumSizeLow,
0062 boost::winapi::LPCWSTR_ lpName);
0063
0064 BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::LPVOID_ BOOST_WINAPI_WINAPI_CC
0065 MapViewOfFile(
0066 boost::winapi::HANDLE_ hFileMappingObject,
0067 boost::winapi::DWORD_ dwDesiredAccess,
0068 boost::winapi::DWORD_ dwFileOffsetHigh,
0069 boost::winapi::DWORD_ dwFileOffsetLow,
0070 boost::winapi::SIZE_T_ dwNumberOfBytesToMap);
0071
0072 BOOST_WINAPI_IMPORT boost::winapi::LPVOID_ BOOST_WINAPI_WINAPI_CC
0073 MapViewOfFileEx(
0074 boost::winapi::HANDLE_ hFileMappingObject,
0075 boost::winapi::DWORD_ dwDesiredAccess,
0076 boost::winapi::DWORD_ dwFileOffsetHigh,
0077 boost::winapi::DWORD_ dwFileOffsetLow,
0078 boost::winapi::SIZE_T_ dwNumberOfBytesToMap,
0079 boost::winapi::LPVOID_ lpBaseAddress);
0080
0081 BOOST_WINAPI_IMPORT boost::winapi::HANDLE_ BOOST_WINAPI_WINAPI_CC
0082 OpenFileMappingW(
0083 boost::winapi::DWORD_ dwDesiredAccess,
0084 boost::winapi::BOOL_ bInheritHandle,
0085 boost::winapi::LPCWSTR_ lpName);
0086 #endif
0087
0088 #if BOOST_WINAPI_PARTITION_APP || BOOST_WINAPI_PARTITION_SYSTEM
0089 BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC
0090 FlushViewOfFile(
0091 boost::winapi::LPCVOID_ lpBaseAddress,
0092 boost::winapi::SIZE_T_ dwNumberOfBytesToFlush);
0093
0094 BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC
0095 UnmapViewOfFile(boost::winapi::LPCVOID_ lpBaseAddress);
0096 #endif
0097
0098 }
0099 #endif
0100
0101 namespace boost {
0102 namespace winapi {
0103
0104 #if defined( BOOST_USE_WINDOWS_H )
0105
0106 BOOST_CONSTEXPR_OR_CONST DWORD_ SEC_FILE_ = SEC_FILE;
0107 BOOST_CONSTEXPR_OR_CONST DWORD_ SEC_IMAGE_ = SEC_IMAGE;
0108 BOOST_CONSTEXPR_OR_CONST DWORD_ SEC_RESERVE_ = SEC_RESERVE;
0109 BOOST_CONSTEXPR_OR_CONST DWORD_ SEC_COMMIT_ = SEC_COMMIT;
0110 BOOST_CONSTEXPR_OR_CONST DWORD_ SEC_NOCACHE_ = SEC_NOCACHE;
0111
0112
0113
0114
0115 BOOST_CONSTEXPR_OR_CONST DWORD_ SECTION_QUERY_ = SECTION_QUERY;
0116 BOOST_CONSTEXPR_OR_CONST DWORD_ SECTION_MAP_WRITE_ = SECTION_MAP_WRITE;
0117 BOOST_CONSTEXPR_OR_CONST DWORD_ SECTION_MAP_READ_ = SECTION_MAP_READ;
0118 BOOST_CONSTEXPR_OR_CONST DWORD_ SECTION_MAP_EXECUTE_ = SECTION_MAP_EXECUTE;
0119 BOOST_CONSTEXPR_OR_CONST DWORD_ SECTION_EXTEND_SIZE_ = SECTION_EXTEND_SIZE;
0120 BOOST_CONSTEXPR_OR_CONST DWORD_ SECTION_ALL_ACCESS_ = SECTION_ALL_ACCESS;
0121
0122 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_MAP_COPY_ = FILE_MAP_COPY;
0123 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_MAP_WRITE_ = FILE_MAP_WRITE;
0124 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_MAP_READ_ = FILE_MAP_READ;
0125 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_MAP_ALL_ACCESS_ = FILE_MAP_ALL_ACCESS;
0126
0127 #else
0128
0129 BOOST_CONSTEXPR_OR_CONST DWORD_ SEC_FILE_ = 0x800000;
0130 BOOST_CONSTEXPR_OR_CONST DWORD_ SEC_IMAGE_ = 0x1000000;
0131 BOOST_CONSTEXPR_OR_CONST DWORD_ SEC_RESERVE_ = 0x4000000;
0132 BOOST_CONSTEXPR_OR_CONST DWORD_ SEC_COMMIT_ = 0x8000000;
0133 BOOST_CONSTEXPR_OR_CONST DWORD_ SEC_NOCACHE_ = 0x10000000;
0134
0135
0136
0137
0138 BOOST_CONSTEXPR_OR_CONST DWORD_ SECTION_QUERY_ = 0x00000001;
0139 BOOST_CONSTEXPR_OR_CONST DWORD_ SECTION_MAP_WRITE_ = 0x00000002;
0140 BOOST_CONSTEXPR_OR_CONST DWORD_ SECTION_MAP_READ_ = 0x00000004;
0141 BOOST_CONSTEXPR_OR_CONST DWORD_ SECTION_MAP_EXECUTE_ = 0x00000008;
0142 BOOST_CONSTEXPR_OR_CONST DWORD_ SECTION_EXTEND_SIZE_ = 0x00000010;
0143 BOOST_CONSTEXPR_OR_CONST DWORD_ SECTION_ALL_ACCESS_ = 0x000F001F;
0144
0145 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_MAP_COPY_ = SECTION_QUERY_;
0146 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_MAP_WRITE_ = SECTION_MAP_WRITE_;
0147 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_MAP_READ_ = SECTION_MAP_READ_;
0148 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_MAP_ALL_ACCESS_ = SECTION_ALL_ACCESS_;
0149
0150 #endif
0151
0152
0153 BOOST_CONSTEXPR_OR_CONST DWORD_ SECTION_MAP_EXECUTE_EXPLICIT_ = 0x00000020;
0154 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_MAP_EXECUTE_ = SECTION_MAP_EXECUTE_EXPLICIT_;
0155
0156
0157 BOOST_CONSTEXPR_OR_CONST DWORD_ SEC_PROTECTED_IMAGE_ = 0x2000000;
0158 BOOST_CONSTEXPR_OR_CONST DWORD_ SEC_WRITECOMBINE_ = 0x40000000;
0159 BOOST_CONSTEXPR_OR_CONST DWORD_ SEC_LARGE_PAGES_ = 0x80000000;
0160 BOOST_CONSTEXPR_OR_CONST DWORD_ SEC_IMAGE_NO_EXECUTE_ = (SEC_IMAGE_ | SEC_NOCACHE_);
0161
0162 #if BOOST_WINAPI_PARTITION_DESKTOP
0163 #if !defined( BOOST_NO_ANSI_APIS )
0164 BOOST_FORCEINLINE HANDLE_ CreateFileMappingA(
0165 HANDLE_ hFile,
0166 SECURITY_ATTRIBUTES_* lpFileMappingAttributes,
0167 DWORD_ flProtect,
0168 DWORD_ dwMaximumSizeHigh,
0169 DWORD_ dwMaximumSizeLow,
0170 LPCSTR_ lpName)
0171 {
0172 return ::CreateFileMappingA(
0173 hFile,
0174 reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpFileMappingAttributes),
0175 flProtect,
0176 dwMaximumSizeHigh,
0177 dwMaximumSizeLow,
0178 lpName);
0179 }
0180
0181 BOOST_FORCEINLINE HANDLE_ create_file_mapping(
0182 HANDLE_ hFile,
0183 SECURITY_ATTRIBUTES_* lpFileMappingAttributes,
0184 DWORD_ flProtect,
0185 DWORD_ dwMaximumSizeHigh,
0186 DWORD_ dwMaximumSizeLow,
0187 LPCSTR_ lpName)
0188 {
0189 return ::CreateFileMappingA(
0190 hFile,
0191 reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpFileMappingAttributes),
0192 flProtect,
0193 dwMaximumSizeHigh,
0194 dwMaximumSizeLow,
0195 lpName);
0196 }
0197
0198 using ::OpenFileMappingA;
0199
0200 BOOST_FORCEINLINE HANDLE_ open_file_mapping(DWORD_ dwDesiredAccess, BOOL_ bInheritHandle, LPCSTR_ lpName)
0201 {
0202 return ::OpenFileMappingA(dwDesiredAccess, bInheritHandle, lpName);
0203 }
0204 #endif
0205 #endif
0206
0207 #if BOOST_WINAPI_PARTITION_DESKTOP || BOOST_WINAPI_PARTITION_SYSTEM
0208 BOOST_FORCEINLINE HANDLE_ CreateFileMappingW(
0209 HANDLE_ hFile,
0210 SECURITY_ATTRIBUTES_* lpFileMappingAttributes,
0211 DWORD_ flProtect,
0212 DWORD_ dwMaximumSizeHigh,
0213 DWORD_ dwMaximumSizeLow,
0214 LPCWSTR_ lpName)
0215 {
0216 return ::CreateFileMappingW(
0217 hFile,
0218 reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpFileMappingAttributes),
0219 flProtect,
0220 dwMaximumSizeHigh,
0221 dwMaximumSizeLow,
0222 lpName);
0223 }
0224
0225 BOOST_FORCEINLINE HANDLE_ create_file_mapping(
0226 HANDLE_ hFile,
0227 SECURITY_ATTRIBUTES_* lpFileMappingAttributes,
0228 DWORD_ flProtect,
0229 DWORD_ dwMaximumSizeHigh,
0230 DWORD_ dwMaximumSizeLow,
0231 LPCWSTR_ lpName)
0232 {
0233 return ::CreateFileMappingW(
0234 hFile,
0235 reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpFileMappingAttributes),
0236 flProtect,
0237 dwMaximumSizeHigh,
0238 dwMaximumSizeLow,
0239 lpName);
0240 }
0241
0242 using ::MapViewOfFile;
0243 using ::MapViewOfFileEx;
0244 using ::OpenFileMappingW;
0245
0246 BOOST_FORCEINLINE HANDLE_ open_file_mapping(DWORD_ dwDesiredAccess, BOOL_ bInheritHandle, LPCWSTR_ lpName)
0247 {
0248 return ::OpenFileMappingW(dwDesiredAccess, bInheritHandle, lpName);
0249 }
0250 #endif
0251
0252 #if BOOST_WINAPI_PARTITION_APP || BOOST_WINAPI_PARTITION_SYSTEM
0253 using ::FlushViewOfFile;
0254 using ::UnmapViewOfFile;
0255 #endif
0256
0257 }
0258 }
0259
0260 #include <boost/winapi/detail/footer.hpp>
0261
0262 #endif