Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:02:27

0001 /*
0002  * Copyright 2010 Vicente J. Botet Escriba
0003  * Copyright 2015 Andrey Semashev
0004  * Copyright 2016 Jorge Lodos
0005  * Copyright 2017 James E. King, III
0006  *
0007  * Distributed under the Boost Software License, Version 1.0.
0008  * See http://www.boost.org/LICENSE_1_0.txt
0009  */
0010 
0011 #ifndef BOOST_WINAPI_FILE_MANAGEMENT_HPP_INCLUDED_
0012 #define BOOST_WINAPI_FILE_MANAGEMENT_HPP_INCLUDED_
0013 
0014 #include <boost/winapi/basic_types.hpp>
0015 #include <boost/winapi/limits.hpp>
0016 #include <boost/winapi/time.hpp>
0017 #include <boost/winapi/overlapped.hpp>
0018 #include <boost/winapi/detail/header.hpp>
0019 
0020 #ifdef BOOST_HAS_PRAGMA_ONCE
0021 #pragma once
0022 #endif
0023 
0024 /*
0025  * UWP:
0026  * API                         SDK 8     SDK 10            _WIN32_WINNT
0027  * AreFileApisANSI             DESKTOP - DESKTOP | SYSTEM
0028  * CreateFile                  DESKTOP - DESKTOP | SYSTEM
0029  * DeleteFile                  APP     - APP     | SYSTEM
0030  * FindClose                   APP     - APP     | SYSTEM
0031  * FindFirstFile               DESKTOP > APP     | SYSTEM
0032  * FindNextFile                DESKTOP > APP     | SYSTEM
0033  * GetFileAttributes           DESKTOP > APP     | SYSTEM
0034  * GetFileInformationByHandle  DESKTOP - DESKTOP | SYSTEM
0035  * GetFileSizeEx               DESKTOP > APP     | SYSTEM
0036  * LockFile                    DESKTOP - DESKTOP | SYSTEM
0037  * MoveFileEx                  APP     - APP     | SYSTEM
0038  * ReadFile                    APP     - APP     | SYSTEM
0039  * SetEndOfFile                APP     - APP     | SYSTEM
0040  * SetFilePointer              DESKTOP > APP     | SYSTEM
0041  * SetFileValidData            DESKTOP - DESKTOP | SYSTEM  >= 0x0501
0042  * UnlockFile                  DESKTOP - DESKTOP | SYSTEM
0043  * WriteFile                   APP     - APP     | SYSTEM
0044  */
0045 
0046 #if !defined( BOOST_USE_WINDOWS_H )
0047 extern "C" {
0048 
0049 #if BOOST_WINAPI_PARTITION_DESKTOP || BOOST_WINAPI_PARTITION_SYSTEM
0050 #if !defined( BOOST_NO_ANSI_APIS )
0051 BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC
0052 AreFileApisANSI(BOOST_WINAPI_DETAIL_VOID);
0053 
0054 BOOST_WINAPI_IMPORT boost::winapi::HANDLE_ BOOST_WINAPI_WINAPI_CC
0055 CreateFileA(
0056     boost::winapi::LPCSTR_ lpFileName,
0057     boost::winapi::DWORD_ dwDesiredAccess,
0058     boost::winapi::DWORD_ dwShareMode,
0059     ::_SECURITY_ATTRIBUTES* lpSecurityAttributes,
0060     boost::winapi::DWORD_ dwCreationDisposition,
0061     boost::winapi::DWORD_ dwFlagsAndAttributes,
0062     boost::winapi::HANDLE_ hTemplateFile);
0063 
0064 struct _WIN32_FIND_DATAA;
0065 BOOST_WINAPI_IMPORT boost::winapi::HANDLE_ BOOST_WINAPI_WINAPI_CC
0066 FindFirstFileA(boost::winapi::LPCSTR_ lpFileName, ::_WIN32_FIND_DATAA* lpFindFileData);
0067 
0068 BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC
0069 FindNextFileA(boost::winapi::HANDLE_ hFindFile, ::_WIN32_FIND_DATAA* lpFindFileData);
0070 #endif
0071 
0072 BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::HANDLE_ BOOST_WINAPI_WINAPI_CC
0073 CreateFileW(
0074     boost::winapi::LPCWSTR_ lpFileName,
0075     boost::winapi::DWORD_ dwDesiredAccess,
0076     boost::winapi::DWORD_ dwShareMode,
0077     ::_SECURITY_ATTRIBUTES* lpSecurityAttributes,
0078     boost::winapi::DWORD_ dwCreationDisposition,
0079     boost::winapi::DWORD_ dwFlagsAndAttributes,
0080     boost::winapi::HANDLE_ hTemplateFile);
0081 
0082 struct _WIN32_FIND_DATAW;
0083 BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::HANDLE_ BOOST_WINAPI_WINAPI_CC
0084 FindFirstFileW(boost::winapi::LPCWSTR_ lpFileName, ::_WIN32_FIND_DATAW* lpFindFileData);
0085 
0086 BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC
0087 FindNextFileW(boost::winapi::HANDLE_ hFindFile, ::_WIN32_FIND_DATAW* lpFindFileData);
0088 
0089 struct _BY_HANDLE_FILE_INFORMATION;
0090 BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC
0091 GetFileInformationByHandle(
0092     boost::winapi::HANDLE_ hFile,
0093     ::_BY_HANDLE_FILE_INFORMATION* lpFileInformation);
0094 
0095 BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC
0096 LockFile(
0097     boost::winapi::HANDLE_ hFile,
0098     boost::winapi::DWORD_ dwFileOffsetLow,
0099     boost::winapi::DWORD_ dwFileOffsetHigh,
0100     boost::winapi::DWORD_ nNumberOfBytesToLockLow,
0101     boost::winapi::DWORD_ nNumberOfBytesToLockHigh);
0102 
0103 BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC
0104 LockFileEx(
0105     boost::winapi::HANDLE_ hFile,
0106     boost::winapi::DWORD_ dwFlags,
0107     boost::winapi::DWORD_ dwReserved,
0108     boost::winapi::DWORD_ nNumberOfBytesToLockLow,
0109     boost::winapi::DWORD_ nNumberOfBytesToLockHigh,
0110     ::_OVERLAPPED* lpOverlapped);
0111 
0112 #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WINXP
0113 BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC
0114 SetFileValidData(
0115     boost::winapi::HANDLE_ hFile, 
0116     boost::winapi::LONGLONG_ ValidDataLength);
0117 #endif
0118 
0119 BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC
0120 UnlockFile(
0121     boost::winapi::HANDLE_ hFile,
0122     boost::winapi::DWORD_ dwFileOffsetLow,
0123     boost::winapi::DWORD_ dwFileOffsetHigh,
0124     boost::winapi::DWORD_ nNumberOfBytesToUnlockLow,
0125     boost::winapi::DWORD_ nNumberOfBytesToUnlockHigh);
0126 
0127 BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC
0128 UnlockFileEx(
0129     boost::winapi::HANDLE_ hFile,
0130     boost::winapi::DWORD_ dwReserved,
0131     boost::winapi::DWORD_ nNumberOfBytesToUnlockLow,
0132     boost::winapi::DWORD_ nNumberOfBytesToUnlockHigh,
0133     ::_OVERLAPPED* lpOverlapped);
0134 #endif
0135 
0136 #if BOOST_WINAPI_PARTITION_APP || BOOST_WINAPI_PARTITION_SYSTEM
0137 #if !defined( BOOST_NO_ANSI_APIS )
0138 BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC
0139 DeleteFileA(boost::winapi::LPCSTR_ lpFileName);
0140 
0141 BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC
0142 MoveFileExA(
0143     boost::winapi::LPCSTR_ lpExistingFileName,
0144     boost::winapi::LPCSTR_ lpNewFileName,
0145     boost::winapi::DWORD_ dwFlags);
0146 #endif
0147 
0148 BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC
0149 DeleteFileW(boost::winapi::LPCWSTR_ lpFileName);
0150 
0151 BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC
0152 FindClose(boost::winapi::HANDLE_ hFindFile);
0153 
0154 BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC
0155 MoveFileExW(
0156     boost::winapi::LPCWSTR_ lpExistingFileName,
0157     boost::winapi::LPCWSTR_ lpNewFileName,
0158     boost::winapi::DWORD_ dwFlags);
0159 
0160 BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC
0161 ReadFile(
0162     boost::winapi::HANDLE_ hFile,
0163     boost::winapi::LPVOID_ lpBuffer,
0164     boost::winapi::DWORD_ nNumberOfBytesToRead,
0165     boost::winapi::LPDWORD_ lpNumberOfBytesRead,
0166     ::_OVERLAPPED* lpOverlapped);
0167 
0168 BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC
0169 SetEndOfFile(boost::winapi::HANDLE_ hFile);
0170 
0171 BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC
0172 WriteFile(
0173     boost::winapi::HANDLE_ hFile,
0174     boost::winapi::LPCVOID_ lpBuffer,
0175     boost::winapi::DWORD_ nNumberOfBytesToWrite,
0176     boost::winapi::LPDWORD_ lpNumberOfBytesWritten,
0177     ::_OVERLAPPED* lpOverlapped);
0178 #endif // BOOST_WINAPI_PARTITION_APP || BOOST_WINAPI_PARTITION_SYSTEM
0179 
0180 #if BOOST_WINAPI_PARTITION_APP_SYSTEM
0181 #if !defined( BOOST_NO_ANSI_APIS )
0182 BOOST_WINAPI_IMPORT boost::winapi::DWORD_ BOOST_WINAPI_WINAPI_CC
0183 GetFileAttributesA(boost::winapi::LPCSTR_ lpFileName);
0184 #endif
0185 
0186 BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::DWORD_ BOOST_WINAPI_WINAPI_CC
0187 GetFileAttributesW(boost::winapi::LPCWSTR_ lpFileName);
0188 
0189 BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC
0190 GetFileSizeEx(boost::winapi::HANDLE_ hFile, ::_LARGE_INTEGER* lpFileSize);
0191 
0192 BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::DWORD_ BOOST_WINAPI_WINAPI_CC
0193 SetFilePointer(
0194     boost::winapi::HANDLE_ hFile,
0195     boost::winapi::LONG_ lpDistanceToMove,
0196     boost::winapi::PLONG_ lpDistanceToMoveHigh,
0197     boost::winapi::DWORD_ dwMoveMethod);
0198 #endif // BOOST_WINAPI_PARTITION_APP_SYSTEM
0199 
0200 } // extern "C"
0201 #endif // !defined(BOOST_USE_WINDOWS_H)
0202 
0203 namespace boost {
0204 namespace winapi {
0205 
0206 #if defined( BOOST_USE_WINDOWS_H )
0207 
0208 BOOST_CONSTEXPR_OR_CONST DWORD_ INVALID_FILE_SIZE_ = INVALID_FILE_SIZE;
0209 BOOST_CONSTEXPR_OR_CONST DWORD_ INVALID_SET_FILE_POINTER_ = INVALID_SET_FILE_POINTER;
0210 BOOST_CONSTEXPR_OR_CONST DWORD_ INVALID_FILE_ATTRIBUTES_ = INVALID_FILE_ATTRIBUTES;
0211 
0212 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_READONLY_ = FILE_ATTRIBUTE_READONLY;
0213 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_HIDDEN_ = FILE_ATTRIBUTE_HIDDEN;
0214 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_SYSTEM_ = FILE_ATTRIBUTE_SYSTEM;
0215 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_DIRECTORY_ = FILE_ATTRIBUTE_DIRECTORY;
0216 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_ARCHIVE_ = FILE_ATTRIBUTE_ARCHIVE;
0217 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_DEVICE_ = FILE_ATTRIBUTE_DEVICE;
0218 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_NORMAL_ = FILE_ATTRIBUTE_NORMAL;
0219 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_TEMPORARY_ = FILE_ATTRIBUTE_TEMPORARY;
0220 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_SPARSE_FILE_ = FILE_ATTRIBUTE_SPARSE_FILE;
0221 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_REPARSE_POINT_ = FILE_ATTRIBUTE_REPARSE_POINT;
0222 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_COMPRESSED_ = FILE_ATTRIBUTE_COMPRESSED;
0223 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_OFFLINE_ = FILE_ATTRIBUTE_OFFLINE;
0224 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_NOT_CONTENT_INDEXED_ = FILE_ATTRIBUTE_NOT_CONTENT_INDEXED;
0225 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_ENCRYPTED_ = FILE_ATTRIBUTE_ENCRYPTED;
0226 
0227 BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_NEW_ = CREATE_NEW;
0228 BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_ALWAYS_ = CREATE_ALWAYS;
0229 BOOST_CONSTEXPR_OR_CONST DWORD_ OPEN_EXISTING_ = OPEN_EXISTING;
0230 BOOST_CONSTEXPR_OR_CONST DWORD_ OPEN_ALWAYS_ = OPEN_ALWAYS;
0231 BOOST_CONSTEXPR_OR_CONST DWORD_ TRUNCATE_EXISTING_ = TRUNCATE_EXISTING;
0232 
0233 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_SHARE_READ_ = FILE_SHARE_READ;
0234 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_SHARE_WRITE_ = FILE_SHARE_WRITE;
0235 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_SHARE_DELETE_ = FILE_SHARE_DELETE;
0236 
0237 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_BEGIN_ = FILE_BEGIN;
0238 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_CURRENT_ = FILE_CURRENT;
0239 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_END_ = FILE_END;
0240 
0241 #else // defined( BOOST_USE_WINDOWS_H )
0242 
0243 BOOST_CONSTEXPR_OR_CONST DWORD_ INVALID_FILE_SIZE_ = ((DWORD_)0xFFFFFFFF);
0244 BOOST_CONSTEXPR_OR_CONST DWORD_ INVALID_SET_FILE_POINTER_ = ((DWORD_)-1);
0245 BOOST_CONSTEXPR_OR_CONST DWORD_ INVALID_FILE_ATTRIBUTES_ = ((DWORD_)-1);
0246 
0247 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_READONLY_ = 0x00000001;
0248 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_HIDDEN_ = 0x00000002;
0249 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_SYSTEM_ = 0x00000004;
0250 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_DIRECTORY_ = 0x00000010;
0251 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_ARCHIVE_ = 0x00000020;
0252 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_DEVICE_ = 0x00000040;
0253 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_NORMAL_ = 0x00000080;
0254 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_TEMPORARY_ = 0x00000100;
0255 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_SPARSE_FILE_ = 0x00000200;
0256 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_REPARSE_POINT_ = 0x00000400;
0257 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_COMPRESSED_ = 0x00000800;
0258 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_OFFLINE_ = 0x00001000;
0259 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_NOT_CONTENT_INDEXED_ = 0x00002000;
0260 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_ENCRYPTED_ = 0x00004000;
0261 
0262 BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_NEW_ = 1;
0263 BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_ALWAYS_ = 2;
0264 BOOST_CONSTEXPR_OR_CONST DWORD_ OPEN_EXISTING_ = 3;
0265 BOOST_CONSTEXPR_OR_CONST DWORD_ OPEN_ALWAYS_ = 4;
0266 BOOST_CONSTEXPR_OR_CONST DWORD_ TRUNCATE_EXISTING_ = 5;
0267 
0268 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_SHARE_READ_ = 0x00000001;
0269 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_SHARE_WRITE_ = 0x00000002;
0270 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_SHARE_DELETE_ = 0x00000004;
0271 
0272 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_BEGIN_ = 0;
0273 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_CURRENT_ = 1;
0274 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_END_ = 2;
0275 
0276 #endif // defined( BOOST_USE_WINDOWS_H )
0277 
0278 // Some of these constants are not defined by Windows SDK in MinGW or older MSVC
0279 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_FLAG_WRITE_THROUGH_ = 0x80000000;
0280 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_FLAG_OVERLAPPED_ = 0x40000000;
0281 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_FLAG_NO_BUFFERING_ = 0x20000000;
0282 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_FLAG_RANDOM_ACCESS_ = 0x10000000;
0283 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_FLAG_SEQUENTIAL_SCAN_ = 0x08000000;
0284 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_FLAG_DELETE_ON_CLOSE_ = 0x04000000;
0285 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_FLAG_BACKUP_SEMANTICS_ = 0x02000000;
0286 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_FLAG_POSIX_SEMANTICS_ = 0x01000000;
0287 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_FLAG_SESSION_AWARE_ = 0x00800000;
0288 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_FLAG_OPEN_REPARSE_POINT_ = 0x00200000;
0289 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_FLAG_OPEN_NO_RECALL_ = 0x00100000;
0290 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_FLAG_FIRST_PIPE_INSTANCE_ = 0x00080000;
0291 
0292 #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN8
0293 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_FLAG_OPEN_REQUIRING_OPLOCK_ = 0x00040000;
0294 #endif
0295 
0296 // This constant is not defined in Windows SDK up until 6.0A
0297 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_VIRTUAL_ = 0x00010000;
0298 
0299 // These constants are not defined in Windows SDK up until 8.0 and MinGW/MinGW-w64 (as of 2016-02-14).
0300 // They are documented to be supported only since Windows 8/Windows Server 2012
0301 // but defined unconditionally.
0302 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_INTEGRITY_STREAM_ = 0x00008000;
0303 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_NO_SCRUB_DATA_ = 0x00020000;
0304 // Undocumented
0305 BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_EA_ = 0x00040000;
0306 
0307 #if BOOST_WINAPI_PARTITION_DESKTOP || BOOST_WINAPI_PARTITION_SYSTEM
0308 #if !defined( BOOST_NO_ANSI_APIS )
0309 using ::AreFileApisANSI;
0310 
0311 BOOST_FORCEINLINE HANDLE_ CreateFileA(
0312     LPCSTR_ lpFileName,
0313     DWORD_ dwDesiredAccess,
0314     DWORD_ dwShareMode,
0315     SECURITY_ATTRIBUTES_* lpSecurityAttributes,
0316     DWORD_ dwCreationDisposition,
0317     DWORD_ dwFlagsAndAttributes,
0318     HANDLE_ hTemplateFile)
0319 {
0320     return ::CreateFileA(
0321         lpFileName,
0322         dwDesiredAccess,
0323         dwShareMode,
0324         reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpSecurityAttributes),
0325         dwCreationDisposition,
0326         dwFlagsAndAttributes,
0327         hTemplateFile);
0328 }
0329 
0330 BOOST_FORCEINLINE HANDLE_ create_file(
0331     LPCSTR_ lpFileName,
0332     DWORD_ dwDesiredAccess,
0333     DWORD_ dwShareMode,
0334     SECURITY_ATTRIBUTES_* lpSecurityAttributes,
0335     DWORD_ dwCreationDisposition,
0336     DWORD_ dwFlagsAndAttributes,
0337     HANDLE_ hTemplateFile)
0338 {
0339     return ::CreateFileA(
0340         lpFileName,
0341         dwDesiredAccess,
0342         dwShareMode,
0343         reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpSecurityAttributes),
0344         dwCreationDisposition,
0345         dwFlagsAndAttributes,
0346         hTemplateFile);
0347 }
0348 
0349 typedef struct BOOST_MAY_ALIAS _WIN32_FIND_DATAA {
0350     DWORD_ dwFileAttributes;
0351     FILETIME_ ftCreationTime;
0352     FILETIME_ ftLastAccessTime;
0353     FILETIME_ ftLastWriteTime;
0354     DWORD_ nFileSizeHigh;
0355     DWORD_ nFileSizeLow;
0356     DWORD_ dwReserved0;
0357     DWORD_ dwReserved1;
0358     CHAR_   cFileName[MAX_PATH_];
0359     CHAR_   cAlternateFileName[14];
0360 #ifdef _MAC
0361     DWORD_ dwFileType;
0362     DWORD_ dwCreatorType;
0363     WORD_  wFinderFlags;
0364 #endif
0365 } WIN32_FIND_DATAA_, *PWIN32_FIND_DATAA_, *LPWIN32_FIND_DATAA_;
0366 
0367 BOOST_FORCEINLINE HANDLE_ FindFirstFileA(LPCSTR_ lpFileName, WIN32_FIND_DATAA_* lpFindFileData)
0368 {
0369     return ::FindFirstFileA(lpFileName, reinterpret_cast< ::_WIN32_FIND_DATAA* >(lpFindFileData));
0370 }
0371 
0372 BOOST_FORCEINLINE HANDLE_ find_first_file(LPCSTR_ lpFileName, WIN32_FIND_DATAA_* lpFindFileData)
0373 {
0374     return ::FindFirstFileA(lpFileName, reinterpret_cast< ::_WIN32_FIND_DATAA* >(lpFindFileData));
0375 }
0376 
0377 BOOST_FORCEINLINE BOOL_ FindNextFileA(HANDLE_ hFindFile, WIN32_FIND_DATAA_* lpFindFileData)
0378 {
0379     return ::FindNextFileA(hFindFile, reinterpret_cast< ::_WIN32_FIND_DATAA* >(lpFindFileData));
0380 }
0381 
0382 BOOST_FORCEINLINE BOOL_ find_next_file(HANDLE_ hFindFile, WIN32_FIND_DATAA_* lpFindFileData)
0383 {
0384     return ::FindNextFileA(hFindFile, reinterpret_cast< ::_WIN32_FIND_DATAA* >(lpFindFileData));
0385 }
0386 
0387 #endif // !defined( BOOST_NO_ANSI_APIS )
0388 
0389 BOOST_FORCEINLINE HANDLE_ CreateFileW(
0390     LPCWSTR_ lpFileName,
0391     DWORD_ dwDesiredAccess,
0392     DWORD_ dwShareMode,
0393     SECURITY_ATTRIBUTES_* lpSecurityAttributes,
0394     DWORD_ dwCreationDisposition,
0395     DWORD_ dwFlagsAndAttributes,
0396     HANDLE_ hTemplateFile)
0397 {
0398     return ::CreateFileW(
0399         lpFileName,
0400         dwDesiredAccess,
0401         dwShareMode,
0402         reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpSecurityAttributes),
0403         dwCreationDisposition,
0404         dwFlagsAndAttributes,
0405         hTemplateFile);
0406 }
0407 
0408 BOOST_FORCEINLINE HANDLE_ create_file(
0409     LPCWSTR_ lpFileName,
0410     DWORD_ dwDesiredAccess,
0411     DWORD_ dwShareMode,
0412     SECURITY_ATTRIBUTES_* lpSecurityAttributes,
0413     DWORD_ dwCreationDisposition,
0414     DWORD_ dwFlagsAndAttributes,
0415     HANDLE_ hTemplateFile)
0416 {
0417     return ::CreateFileW(
0418         lpFileName,
0419         dwDesiredAccess,
0420         dwShareMode,
0421         reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpSecurityAttributes),
0422         dwCreationDisposition,
0423         dwFlagsAndAttributes,
0424         hTemplateFile);
0425 }
0426 
0427 typedef struct BOOST_MAY_ALIAS _WIN32_FIND_DATAW {
0428     DWORD_ dwFileAttributes;
0429     FILETIME_ ftCreationTime;
0430     FILETIME_ ftLastAccessTime;
0431     FILETIME_ ftLastWriteTime;
0432     DWORD_ nFileSizeHigh;
0433     DWORD_ nFileSizeLow;
0434     DWORD_ dwReserved0;
0435     DWORD_ dwReserved1;
0436     WCHAR_  cFileName[MAX_PATH_];
0437     WCHAR_  cAlternateFileName[14];
0438 #ifdef _MAC
0439     DWORD_ dwFileType;
0440     DWORD_ dwCreatorType;
0441     WORD_  wFinderFlags;
0442 #endif
0443 } WIN32_FIND_DATAW_, *PWIN32_FIND_DATAW_, *LPWIN32_FIND_DATAW_;
0444 
0445 typedef struct BOOST_MAY_ALIAS _BY_HANDLE_FILE_INFORMATION {
0446     DWORD_ dwFileAttributes;
0447     FILETIME_ ftCreationTime;
0448     FILETIME_ ftLastAccessTime;
0449     FILETIME_ ftLastWriteTime;
0450     DWORD_ dwVolumeSerialNumber;
0451     DWORD_ nFileSizeHigh;
0452     DWORD_ nFileSizeLow;
0453     DWORD_ nNumberOfLinks;
0454     DWORD_ nFileIndexHigh;
0455     DWORD_ nFileIndexLow;
0456 } BY_HANDLE_FILE_INFORMATION_, *PBY_HANDLE_FILE_INFORMATION_, *LPBY_HANDLE_FILE_INFORMATION_;
0457 
0458 BOOST_FORCEINLINE HANDLE_ FindFirstFileW(LPCWSTR_ lpFileName, WIN32_FIND_DATAW_* lpFindFileData)
0459 {
0460     return ::FindFirstFileW(lpFileName, reinterpret_cast< ::_WIN32_FIND_DATAW* >(lpFindFileData));
0461 }
0462 
0463 BOOST_FORCEINLINE HANDLE_ find_first_file(LPCWSTR_ lpFileName, WIN32_FIND_DATAW_* lpFindFileData)
0464 {
0465     return ::FindFirstFileW(lpFileName, reinterpret_cast< ::_WIN32_FIND_DATAW* >(lpFindFileData));
0466 }
0467 
0468 BOOST_FORCEINLINE BOOL_ FindNextFileW(HANDLE_ hFindFile, WIN32_FIND_DATAW_* lpFindFileData)
0469 {
0470     return ::FindNextFileW(hFindFile, reinterpret_cast< ::_WIN32_FIND_DATAW* >(lpFindFileData));
0471 }
0472 
0473 BOOST_FORCEINLINE BOOL_ find_next_file(HANDLE_ hFindFile, WIN32_FIND_DATAW_* lpFindFileData)
0474 {
0475     return ::FindNextFileW(hFindFile, reinterpret_cast< ::_WIN32_FIND_DATAW* >(lpFindFileData));
0476 }
0477 
0478 BOOST_FORCEINLINE BOOL_ GetFileInformationByHandle(HANDLE_ h, BY_HANDLE_FILE_INFORMATION_* info)
0479 {
0480     return ::GetFileInformationByHandle(h, reinterpret_cast< ::_BY_HANDLE_FILE_INFORMATION* >(info));
0481 }
0482 
0483 using ::LockFile;
0484 
0485 BOOST_FORCEINLINE BOOL_ LockFileEx(
0486     HANDLE_ hFile,
0487     DWORD_ dwFlags,
0488     DWORD_ dwReserved,
0489     DWORD_ nNumberOfBytesToLockLow,
0490     DWORD_ nNumberOfBytesToLockHigh,
0491     OVERLAPPED_* lpOverlapped)
0492 {
0493     return ::LockFileEx(hFile, dwFlags, dwReserved, nNumberOfBytesToLockLow, nNumberOfBytesToLockHigh, reinterpret_cast< ::_OVERLAPPED* >(lpOverlapped));
0494 }
0495 
0496 #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WINXP
0497 using ::SetFileValidData;
0498 #endif
0499 
0500 using ::UnlockFile;
0501 
0502 BOOST_FORCEINLINE BOOL_ UnlockFileEx(
0503     HANDLE_ hFile,
0504     DWORD_ dwReserved,
0505     DWORD_ nNumberOfBytesToUnlockLow,
0506     DWORD_ nNumberOfBytesToUnlockHigh,
0507     OVERLAPPED_* lpOverlapped)
0508 {
0509     return ::UnlockFileEx(hFile, dwReserved, nNumberOfBytesToUnlockLow, nNumberOfBytesToUnlockHigh, reinterpret_cast< ::_OVERLAPPED* >(lpOverlapped));
0510 }
0511 #endif // BOOST_WINAPI_PARTITION_DESKTOP || BOOST_WINAPI_PARTITION_SYSTEM
0512 
0513 #if BOOST_WINAPI_PARTITION_APP || BOOST_WINAPI_PARTITION_SYSTEM
0514 #if !defined( BOOST_NO_ANSI_APIS )
0515 using ::DeleteFileA;
0516 
0517 BOOST_FORCEINLINE BOOL_ delete_file(LPCSTR_ lpFileName)
0518 {
0519     return ::DeleteFileA(lpFileName);
0520 }
0521 
0522 using ::MoveFileExA;
0523 
0524 BOOST_FORCEINLINE BOOL_ move_file(LPCSTR_ lpExistingFileName, LPCSTR_ lpNewFileName, DWORD_ dwFlags)
0525 {
0526     return ::MoveFileExA(lpExistingFileName, lpNewFileName, dwFlags);
0527 }
0528 
0529 #endif
0530 using ::DeleteFileW;
0531 
0532 BOOST_FORCEINLINE BOOL_ delete_file(LPCWSTR_ lpFileName)
0533 {
0534     return ::DeleteFileW(lpFileName);
0535 }
0536 
0537 using ::FindClose;
0538 using ::MoveFileExW;
0539 
0540 BOOST_FORCEINLINE BOOL_ move_file(LPCWSTR_ lpExistingFileName, LPCWSTR_ lpNewFileName, DWORD_ dwFlags)
0541 {
0542     return ::MoveFileExW(lpExistingFileName, lpNewFileName, dwFlags);
0543 }
0544 
0545 BOOST_FORCEINLINE BOOL_ ReadFile(
0546     HANDLE_ hFile,
0547     LPVOID_ lpBuffer,
0548     DWORD_ nNumberOfBytesToWrite,
0549     LPDWORD_ lpNumberOfBytesWritten,
0550     OVERLAPPED_* lpOverlapped)
0551 {
0552     return ::ReadFile(hFile, lpBuffer, nNumberOfBytesToWrite, lpNumberOfBytesWritten, reinterpret_cast< ::_OVERLAPPED* >(lpOverlapped));
0553 }
0554 
0555 using ::SetEndOfFile;
0556 
0557 BOOST_FORCEINLINE BOOL_ WriteFile(
0558     HANDLE_ hFile,
0559     LPCVOID_ lpBuffer,
0560     DWORD_ nNumberOfBytesToWrite,
0561     LPDWORD_ lpNumberOfBytesWritten,
0562     OVERLAPPED_* lpOverlapped)
0563 {
0564     return ::WriteFile(hFile, lpBuffer, nNumberOfBytesToWrite, lpNumberOfBytesWritten, reinterpret_cast< ::_OVERLAPPED* >(lpOverlapped));
0565 }
0566 #endif // BOOST_WINAPI_PARTITION_APP || BOOST_WINAPI_PARTITION_SYSTEM
0567 
0568 #if BOOST_WINAPI_PARTITION_APP_SYSTEM
0569 #if !defined( BOOST_NO_ANSI_APIS )
0570 using ::GetFileAttributesA;
0571 
0572 BOOST_FORCEINLINE DWORD_ get_file_attributes(LPCSTR_ lpFileName)
0573 {
0574     return ::GetFileAttributesA(lpFileName);
0575 }
0576 #endif
0577 using ::GetFileAttributesW;
0578 
0579 BOOST_FORCEINLINE DWORD_ get_file_attributes(LPCWSTR_ lpFileName)
0580 {
0581     return ::GetFileAttributesW(lpFileName);
0582 }
0583 
0584 BOOST_FORCEINLINE BOOL_ GetFileSizeEx(HANDLE_ hFile, LARGE_INTEGER_* lpFileSize)
0585 {
0586     return ::GetFileSizeEx(hFile, reinterpret_cast< ::_LARGE_INTEGER* >(lpFileSize));
0587 }
0588 
0589 using ::SetFilePointer;
0590 #endif // BOOST_WINAPI_PARTITION_APP_SYSTEM
0591 
0592 }
0593 }
0594 
0595 #include <boost/winapi/detail/footer.hpp>
0596 
0597 #endif // BOOST_WINAPI_FILE_MANAGEMENT_HPP_INCLUDED_