summaryrefslogtreecommitdiff
path: root/boost/detail/winapi/file_management.hpp
blob: c1d5978ba7346bad5ac3e1a961c9faf2e47367c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
//  thread.hpp  --------------------------------------------------------------//

//  Copyright 2010 Vicente J. Botet Escriba

//  Distributed under the Boost Software License, Version 1.0.
//  See http://www.boost.org/LICENSE_1_0.txt


#ifndef BOOST_DETAIL_WINAPI_FILE_MANAGEMENT_HPP
#define BOOST_DETAIL_WINAPI_FILE_MANAGEMENT_HPP

#include <boost/detail/winapi/basic_types.hpp>
#include <boost/detail/winapi/security.hpp>

#ifdef BOOST_HAS_PRAGMA_ONCE
#pragma once
#endif

namespace boost
{
namespace detail
{
namespace winapi
{
#if defined( BOOST_USE_WINDOWS_H )
    using ::CreateFileA;
    using ::DeleteFileA;
    using ::FindFirstFileA;
    using ::FindNextFileA;
    using ::FindClose;
    using ::GetFileSizeEx;
    using ::MoveFileExA;
    using ::SetFileValidData;
#else
extern "C" {
    typedef struct _OVERLAPPED {
      ULONG_PTR Internal;
      ULONG_PTR InternalHigh;
      union {
        struct {
          DWORD Offset;
          DWORD OffsetHigh;
        } ;
        PVOID  Pointer;
      } ;
      HANDLE    hEvent;
    } OVERLAPPED, *LPOVERLAPPED;

    
    __declspec(dllimport) void * __stdcall 
        CreateFileA (const char *, unsigned long, unsigned long, struct SECURITY_ATTRIBUTES_*, unsigned long, unsigned long, void *);
    __declspec(dllimport) int __stdcall    
        DeleteFileA (const char *);
    __declspec(dllimport) void *__stdcall 
        FindFirstFileA(const char *lpFileName, win32_find_data_t *lpFindFileData);
    __declspec(dllimport) int   __stdcall 
        FindNextFileA(void *hFindFile, win32_find_data_t *lpFindFileData);
    __declspec(dllimport) int   __stdcall 
        FindClose(void *hFindFile);
    __declspec(dllimport) BOOL __stdcall 
        GetFileSizeEx(
            HANDLE_ hFile,
            PLARGE_INTEGER_ lpFileSize
    );
    __declspec(dllimport) int __stdcall    
        MoveFileExA (const char *, const char *, unsigned long);
    __declspec(dllimport) BOOL_ __stdcall 
        SetFileValidData(
            HANDLE_ hFile,
            LONGLONG_ ValidDataLength
    );
    __declspec(dllimport) BOOL_ __stdcall
        SetEndOfFile(
            HANDLE_ hFile
    );
    __declspec(dllimport) BOOL_ __stdcall
        SetFilePointerEx(
            HANDLE_ hFile,
            LARGE_INTEGER_ liDistanceToMove,
            PLARGE_INTEGER_ lpNewFilePointer,
            DWORD_ dwMoveMethod
    );
    __declspec(dllimport) BOOL_ __stdcall
        LockFile(
            HANDLE_ hFile,
            DWORD_ dwFileOffsetLow,
            DWORD_ dwFileOffsetHigh,
            DWORD_ nNumberOfBytesToLockLow,
            DWORD_ nNumberOfBytesToLockHigh
    );
    __declspec(dllimport) BOOL_ __stdcall
        UnlockFile(
            HANDLE_ hFile,
            DWORD_ dwFileOffsetLow,
            DWORD_ dwFileOffsetHigh,
            DWORD_ nNumberOfBytesToUnlockLow,
            DWORD_ nNumberOfBytesToUnlockHigh
    );
    __declspec(dllimport) BOOL_ __stdcall
        LockFileEx(
            HANDLE_ hFile,
            DWORD_ dwFlags,
            DWORD_ dwReserved,
            DWORD_ nNumberOfBytesToLockLow,
            DWORD_ nNumberOfBytesToLockHigh,
            LPOVERLAPPED_ lpOverlapped
    );
    __declspec(dllimport) BOOL_ __stdcall
        UnlockFileEx(
            HANDLE_ hFile,
            DWORD_ dwReserved,
            DWORD_ nNumberOfBytesToUnlockLow,
            DWORD_ nNumberOfBytesToUnlockHigh,
            LPOVERLAPPED_ lpOverlapped
    );
    __declspec(dllimport) BOOL_ __stdcall
        WriteFile(
            HANDLE_ hFile,
            LPCVOID_ lpBuffer,
            DWORD_ nNumberOfBytesToWrite,
            LPDWORD_ lpNumberOfBytesWritten,
            LPOVERLAPPED_ lpOverlapped
    );
}
#endif
}
}
}

#endif // BOOST_DETAIL_WINAPI_THREAD_HPP