Blame winpr/include/winpr/file.h

Packit 1fb8d4
/**
Packit 1fb8d4
 * WinPR: Windows Portable Runtime
Packit 1fb8d4
 * File Functions
Packit 1fb8d4
 *
Packit 1fb8d4
 * Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
Packit 1fb8d4
 * Copyright 2016 David PHAM-VAN <d.phamvan@inuvika.com>
Packit 1fb8d4
 *
Packit 1fb8d4
 * Licensed under the Apache License, Version 2.0 (the "License");
Packit 1fb8d4
 * you may not use this file except in compliance with the License.
Packit 1fb8d4
 * You may obtain a copy of the License at
Packit 1fb8d4
 *
Packit 1fb8d4
 *     http://www.apache.org/licenses/LICENSE-2.0
Packit 1fb8d4
 *
Packit 1fb8d4
 * Unless required by applicable law or agreed to in writing, software
Packit 1fb8d4
 * distributed under the License is distributed on an "AS IS" BASIS,
Packit 1fb8d4
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Packit 1fb8d4
 * See the License for the specific language governing permissions and
Packit 1fb8d4
 * limitations under the License.
Packit 1fb8d4
 */
Packit 1fb8d4
Packit 1fb8d4
#ifndef WINPR_FILE_H
Packit 1fb8d4
#define WINPR_FILE_H
Packit 1fb8d4
Packit 1fb8d4
#include <winpr/winpr.h>
Packit 1fb8d4
#include <winpr/wtypes.h>
Packit 1fb8d4
Packit 1fb8d4
#include <winpr/nt.h>
Packit 1fb8d4
#include <winpr/io.h>
Packit 1fb8d4
#include <winpr/error.h>
Packit 1fb8d4
Packit 1fb8d4
#ifndef _WIN32
Packit 1fb8d4
Packit 1fb8d4
#ifndef MAX_PATH
Packit Service 5a9772
#define MAX_PATH 260
Packit 1fb8d4
#endif
Packit 1fb8d4
Packit Service 5a9772
#define INVALID_HANDLE_VALUE ((HANDLE)(LONG_PTR)-1)
Packit Service 5a9772
#define INVALID_FILE_SIZE ((DWORD)0xFFFFFFFF)
Packit Service 5a9772
#define INVALID_SET_FILE_POINTER ((DWORD)-1)
Packit Service 5a9772
#define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
Packit Service 5a9772
Packit Service 5a9772
#define FILE_ATTRIBUTE_READONLY 0x00000001
Packit Service 5a9772
#define FILE_ATTRIBUTE_HIDDEN 0x00000002
Packit Service 5a9772
#define FILE_ATTRIBUTE_SYSTEM 0x00000004
Packit Service 5a9772
#define FILE_ATTRIBUTE_DIRECTORY 0x00000010
Packit Service 5a9772
#define FILE_ATTRIBUTE_ARCHIVE 0x00000020
Packit Service 5a9772
#define FILE_ATTRIBUTE_DEVICE 0x00000040
Packit Service 5a9772
#define FILE_ATTRIBUTE_NORMAL 0x00000080
Packit Service 5a9772
#define FILE_ATTRIBUTE_TEMPORARY 0x00000100
Packit Service 5a9772
#define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
Packit Service 5a9772
#define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
Packit Service 5a9772
#define FILE_ATTRIBUTE_COMPRESSED 0x00000800
Packit Service 5a9772
#define FILE_ATTRIBUTE_OFFLINE 0x00001000
Packit Service 5a9772
#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
Packit Service 5a9772
#define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
Packit Service 5a9772
#define FILE_ATTRIBUTE_VIRTUAL 0x00010000
Packit Service 5a9772
Packit Service 5a9772
#define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
Packit Service 5a9772
#define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
Packit Service 5a9772
#define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
Packit Service 5a9772
#define FILE_NOTIFY_CHANGE_SIZE 0x00000008
Packit Service 5a9772
#define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
Packit Service 5a9772
#define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020
Packit Service 5a9772
#define FILE_NOTIFY_CHANGE_CREATION 0x00000040
Packit Service 5a9772
#define FILE_NOTIFY_CHANGE_SECURITY 0x00000100
Packit Service 5a9772
Packit Service 5a9772
#define FILE_ACTION_ADDED 0x00000001
Packit Service 5a9772
#define FILE_ACTION_REMOVED 0x00000002
Packit Service 5a9772
#define FILE_ACTION_MODIFIED 0x00000003
Packit Service 5a9772
#define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
Packit Service 5a9772
#define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
Packit Service 5a9772
Packit Service 5a9772
#define FILE_CASE_SENSITIVE_SEARCH 0x00000001
Packit Service 5a9772
#define FILE_CASE_PRESERVED_NAMES 0x00000002
Packit Service 5a9772
#define FILE_UNICODE_ON_DISK 0x00000004
Packit Service 5a9772
#define FILE_PERSISTENT_ACLS 0x00000008
Packit Service 5a9772
#define FILE_FILE_COMPRESSION 0x00000010
Packit Service 5a9772
#define FILE_VOLUME_QUOTAS 0x00000020
Packit Service 5a9772
#define FILE_SUPPORTS_SPARSE_FILES 0x00000040
Packit Service 5a9772
#define FILE_SUPPORTS_REPARSE_POINTS 0x00000080
Packit Service 5a9772
#define FILE_SUPPORTS_REMOTE_STORAGE 0x00000100
Packit Service 5a9772
#define FILE_VOLUME_IS_COMPRESSED 0x00008000
Packit Service 5a9772
#define FILE_SUPPORTS_OBJECT_IDS 0x00010000
Packit Service 5a9772
#define FILE_SUPPORTS_ENCRYPTION 0x00020000
Packit Service 5a9772
#define FILE_NAMED_STREAMS 0x00040000
Packit Service 5a9772
#define FILE_READ_ONLY_VOLUME 0x00080000
Packit Service 5a9772
#define FILE_SEQUENTIAL_WRITE_ONCE 0x00100000
Packit Service 5a9772
#define FILE_SUPPORTS_TRANSACTIONS 0x00200000
Packit Service 5a9772
#define FILE_SUPPORTS_HARD_LINKS 0x00400000
Packit Service 5a9772
#define FILE_SUPPORTS_EXTENDED_ATTRIBUTES 0x00800000
Packit Service 5a9772
#define FILE_SUPPORTS_OPEN_BY_FILE_ID 0x01000000
Packit Service 5a9772
#define FILE_SUPPORTS_USN_JOURNAL 0x02000000
Packit Service 5a9772
Packit Service 5a9772
#define FILE_FLAG_WRITE_THROUGH 0x80000000
Packit Service 5a9772
#define FILE_FLAG_OVERLAPPED 0x40000000
Packit Service 5a9772
#define FILE_FLAG_NO_BUFFERING 0x20000000
Packit Service 5a9772
#define FILE_FLAG_RANDOM_ACCESS 0x10000000
Packit Service 5a9772
#define FILE_FLAG_SEQUENTIAL_SCAN 0x08000000
Packit Service 5a9772
#define FILE_FLAG_DELETE_ON_CLOSE 0x04000000
Packit Service 5a9772
#define FILE_FLAG_BACKUP_SEMANTICS 0x02000000
Packit Service 5a9772
#define FILE_FLAG_POSIX_SEMANTICS 0x01000000
Packit Service 5a9772
#define FILE_FLAG_OPEN_REPARSE_POINT 0x00200000
Packit Service 5a9772
#define FILE_FLAG_OPEN_NO_RECALL 0x00100000
Packit Service 5a9772
#define FILE_FLAG_FIRST_PIPE_INSTANCE 0x00080000
Packit Service 5a9772
Packit Service 5a9772
#define PAGE_NOACCESS 0x00000001
Packit Service 5a9772
#define PAGE_READONLY 0x00000002
Packit Service 5a9772
#define PAGE_READWRITE 0x00000004
Packit Service 5a9772
#define PAGE_WRITECOPY 0x00000008
Packit Service 5a9772
#define PAGE_EXECUTE 0x00000010
Packit Service 5a9772
#define PAGE_EXECUTE_READ 0x00000020
Packit Service 5a9772
#define PAGE_EXECUTE_READWRITE 0x00000040
Packit Service 5a9772
#define PAGE_EXECUTE_WRITECOPY 0x00000080
Packit Service 5a9772
#define PAGE_GUARD 0x00000100
Packit Service 5a9772
#define PAGE_NOCACHE 0x00000200
Packit Service 5a9772
#define PAGE_WRITECOMBINE 0x00000400
Packit Service 5a9772
Packit Service 5a9772
#define MEM_COMMIT 0x00001000
Packit Service 5a9772
#define MEM_RESERVE 0x00002000
Packit Service 5a9772
#define MEM_DECOMMIT 0x00004000
Packit Service 5a9772
#define MEM_RELEASE 0x00008000
Packit Service 5a9772
#define MEM_FREE 0x00010000
Packit Service 5a9772
#define MEM_PRIVATE 0x00020000
Packit Service 5a9772
#define MEM_MAPPED 0x00040000
Packit Service 5a9772
#define MEM_RESET 0x00080000
Packit Service 5a9772
#define MEM_TOP_DOWN 0x00100000
Packit Service 5a9772
#define MEM_WRITE_WATCH 0x00200000
Packit Service 5a9772
#define MEM_PHYSICAL 0x00400000
Packit Service 5a9772
#define MEM_4MB_PAGES 0x80000000
Packit Service 5a9772
#define MEM_IMAGE SEC_IMAGE
Packit Service 5a9772
Packit Service 5a9772
#define SEC_NO_CHANGE 0x00400000
Packit Service 5a9772
#define SEC_FILE 0x00800000
Packit Service 5a9772
#define SEC_IMAGE 0x01000000
Packit Service 5a9772
#define SEC_VLM 0x02000000
Packit Service 5a9772
#define SEC_RESERVE 0x04000000
Packit Service 5a9772
#define SEC_COMMIT 0x08000000
Packit Service 5a9772
#define SEC_NOCACHE 0x10000000
Packit Service 5a9772
#define SEC_WRITECOMBINE 0x40000000
Packit Service 5a9772
#define SEC_LARGE_PAGES 0x80000000
Packit Service 5a9772
Packit Service 5a9772
#define SECTION_MAP_EXECUTE_EXPLICIT 0x00020
Packit Service 5a9772
#define SECTION_EXTEND_SIZE 0x00010
Packit Service 5a9772
#define SECTION_MAP_READ 0x00004
Packit Service 5a9772
#define SECTION_MAP_WRITE 0x00002
Packit Service 5a9772
#define SECTION_QUERY 0x00001
Packit Service 5a9772
#define SECTION_MAP_EXECUTE 0x00008
Packit Service 5a9772
#define SECTION_ALL_ACCESS 0xF001F
Packit Service 5a9772
Packit Service 5a9772
#define FILE_MAP_COPY SECTION_QUERY
Packit Service 5a9772
#define FILE_MAP_WRITE SECTION_MAP_WRITE
Packit Service 5a9772
#define FILE_MAP_READ SECTION_MAP_READ
Packit Service 5a9772
#define FILE_MAP_ALL_ACCESS SECTION_ALL_ACCESS
Packit Service 5a9772
#define FILE_MAP_EXECUTE SECTION_MAP_EXECUTE_EXPLICIT
Packit Service 5a9772
Packit Service 5a9772
#define CREATE_NEW 1
Packit Service 5a9772
#define CREATE_ALWAYS 2
Packit Service 5a9772
#define OPEN_EXISTING 3
Packit Service 5a9772
#define OPEN_ALWAYS 4
Packit Service 5a9772
#define TRUNCATE_EXISTING 5
Packit Service 5a9772
Packit Service 5a9772
#define FIND_FIRST_EX_CASE_SENSITIVE 0x1
Packit Service 5a9772
#define FIND_FIRST_EX_LARGE_FETCH 0x2
Packit Service 5a9772
Packit Service 5a9772
#define STD_INPUT_HANDLE (DWORD) - 10
Packit Service 5a9772
#define STD_OUTPUT_HANDLE (DWORD) - 11
Packit Service 5a9772
#define STD_ERROR_HANDLE (DWORD) - 12
Packit Service 5a9772
Packit Service 5a9772
#define FILE_BEGIN 0
Packit 1fb8d4
#define FILE_CURRENT 1
Packit Service 5a9772
#define FILE_END 2
Packit 1fb8d4
Packit 1fb8d4
#define LOCKFILE_FAIL_IMMEDIATELY 1
Packit Service 5a9772
#define LOCKFILE_EXCLUSIVE_LOCK 2
Packit 1fb8d4
Packit 1fb8d4
#define MOVEFILE_REPLACE_EXISTING 0x1
Packit 1fb8d4
#define MOVEFILE_COPY_ALLOWED 0x2
Packit 1fb8d4
#define MOVEFILE_DELAY_UNTIL_REBOOT 0x4
Packit 1fb8d4
#define MOVEFILE_WRITE_THROUGH 0x8
Packit 1fb8d4
#define MOVEFILE_CREATE_HARDLINK 0x10
Packit 1fb8d4
#define MOVEFILE_FAIL_IF_NOT_TRACKABLE 0x20
Packit 1fb8d4
Packit Service 5a9772
typedef union _FILE_SEGMENT_ELEMENT {
Packit 1fb8d4
	PVOID64 Buffer;
Packit 1fb8d4
	ULONGLONG Alignment;
Packit 1fb8d4
} FILE_SEGMENT_ELEMENT, *PFILE_SEGMENT_ELEMENT;
Packit 1fb8d4
Packit 1fb8d4
typedef struct _WIN32_FIND_DATAA
Packit 1fb8d4
{
Packit 1fb8d4
	DWORD dwFileAttributes;
Packit 1fb8d4
	FILETIME ftCreationTime;
Packit 1fb8d4
	FILETIME ftLastAccessTime;
Packit 1fb8d4
	FILETIME ftLastWriteTime;
Packit 1fb8d4
	DWORD nFileSizeHigh;
Packit 1fb8d4
	DWORD nFileSizeLow;
Packit 1fb8d4
	DWORD dwReserved0;
Packit 1fb8d4
	DWORD dwReserved1;
Packit 1fb8d4
	CHAR cFileName[MAX_PATH];
Packit 1fb8d4
	CHAR cAlternateFileName[14];
Packit 1fb8d4
} WIN32_FIND_DATAA, *PWIN32_FIND_DATAA, *LPWIN32_FIND_DATAA;
Packit 1fb8d4
Packit 1fb8d4
typedef struct _WIN32_FIND_DATAW
Packit 1fb8d4
{
Packit 1fb8d4
	DWORD dwFileAttributes;
Packit 1fb8d4
	FILETIME ftCreationTime;
Packit 1fb8d4
	FILETIME ftLastAccessTime;
Packit 1fb8d4
	FILETIME ftLastWriteTime;
Packit 1fb8d4
	DWORD nFileSizeHigh;
Packit 1fb8d4
	DWORD nFileSizeLow;
Packit 1fb8d4
	DWORD dwReserved0;
Packit 1fb8d4
	DWORD dwReserved1;
Packit 1fb8d4
	WCHAR cFileName[MAX_PATH];
Packit 1fb8d4
	WCHAR cAlternateFileName[14];
Packit 1fb8d4
} WIN32_FIND_DATAW, *PWIN32_FIND_DATAW, *LPWIN32_FIND_DATAW;
Packit 1fb8d4
Packit 1fb8d4
typedef enum _FINDEX_INFO_LEVELS
Packit 1fb8d4
{
Packit 1fb8d4
	FindExInfoStandard,
Packit 1fb8d4
	FindExInfoMaxInfoLevel
Packit 1fb8d4
} FINDEX_INFO_LEVELS;
Packit 1fb8d4
Packit 1fb8d4
typedef enum _FINDEX_SEARCH_OPS
Packit 1fb8d4
{
Packit 1fb8d4
	FindExSearchNameMatch,
Packit 1fb8d4
	FindExSearchLimitToDirectories,
Packit 1fb8d4
	FindExSearchLimitToDevices,
Packit 1fb8d4
	FindExSearchMaxSearchOp
Packit 1fb8d4
} FINDEX_SEARCH_OPS;
Packit 1fb8d4
Packit Service 5a9772
typedef VOID (*LPOVERLAPPED_COMPLETION_ROUTINE)(DWORD dwErrorCode, DWORD dwNumberOfBytesTransfered,
Packit Service 5a9772
                                                LPOVERLAPPED lpOverlapped);
Packit 1fb8d4
Packit 1fb8d4
#ifdef UNICODE
Packit Service 5a9772
#define WIN32_FIND_DATA WIN32_FIND_DATAW
Packit Service 5a9772
#define PWIN32_FIND_DATA PWIN32_FIND_DATAW
Packit Service 5a9772
#define LPWIN32_FIND_DATA LPWIN32_FIND_DATAW
Packit 1fb8d4
#else
Packit Service 5a9772
#define WIN32_FIND_DATA WIN32_FIND_DATAA
Packit Service 5a9772
#define PWIN32_FIND_DATA PWIN32_FIND_DATAA
Packit Service 5a9772
#define LPWIN32_FIND_DATA LPWIN32_FIND_DATAA
Packit 1fb8d4
#endif
Packit 1fb8d4
Packit 1fb8d4
#ifdef __cplusplus
Packit Service 5a9772
extern "C"
Packit Service 5a9772
{
Packit 1fb8d4
#endif
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
Packit Service 5a9772
	                             LPSECURITY_ATTRIBUTES lpSecurityAttributes,
Packit Service 5a9772
	                             DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes,
Packit Service 5a9772
	                             HANDLE hTemplateFile);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API HANDLE CreateFileW(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
Packit Service 5a9772
	                             LPSECURITY_ATTRIBUTES lpSecurityAttributes,
Packit Service 5a9772
	                             DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes,
Packit Service 5a9772
	                             HANDLE hTemplateFile);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API BOOL DeleteFileA(LPCSTR lpFileName);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API BOOL DeleteFileW(LPCWSTR lpFileName);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API BOOL ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead,
Packit Service 5a9772
	                        LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API BOOL ReadFileEx(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead,
Packit Service 5a9772
	                          LPOVERLAPPED lpOverlapped,
Packit Service 5a9772
	                          LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API BOOL ReadFileScatter(HANDLE hFile, FILE_SEGMENT_ELEMENT aSegmentArray[],
Packit Service 5a9772
	                               DWORD nNumberOfBytesToRead, LPDWORD lpReserved,
Packit Service 5a9772
	                               LPOVERLAPPED lpOverlapped);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API BOOL WriteFile(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite,
Packit Service 5a9772
	                         LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API BOOL WriteFileEx(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite,
Packit Service 5a9772
	                           LPOVERLAPPED lpOverlapped,
Packit Service 5a9772
	                           LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API BOOL WriteFileGather(HANDLE hFile, FILE_SEGMENT_ELEMENT aSegmentArray[],
Packit Service 5a9772
	                               DWORD nNumberOfBytesToWrite, LPDWORD lpReserved,
Packit Service 5a9772
	                               LPOVERLAPPED lpOverlapped);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API BOOL FlushFileBuffers(HANDLE hFile);
Packit 1fb8d4
Packit Service 5a9772
	typedef struct _WIN32_FILE_ATTRIBUTE_DATA
Packit Service 5a9772
	{
Packit Service 5a9772
		DWORD dwFileAttributes;
Packit Service 5a9772
		FILETIME ftCreationTime;
Packit Service 5a9772
		FILETIME ftLastAccessTime;
Packit Service 5a9772
		FILETIME ftLastWriteTime;
Packit Service 5a9772
		DWORD nFileSizeHigh;
Packit Service 5a9772
		DWORD nFileSizeLow;
Packit Service 5a9772
	} WIN32_FILE_ATTRIBUTE_DATA, *LPWIN32_FILE_ATTRIBUTE_DATA;
Packit 1fb8d4
Packit Service 5a9772
	typedef enum _GET_FILEEX_INFO_LEVELS
Packit Service 5a9772
	{
Packit Service 5a9772
		GetFileExInfoStandard,
Packit Service 5a9772
		GetFileExMaxInfoLevel
Packit Service 5a9772
	} GET_FILEEX_INFO_LEVELS;
Packit Service 5a9772
Packit Service 5a9772
	WINPR_API BOOL GetFileAttributesExA(LPCSTR lpFileName, GET_FILEEX_INFO_LEVELS fInfoLevelId,
Packit Service 5a9772
	                                    LPVOID lpFileInformation);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API DWORD GetFileAttributesA(LPCSTR lpFileName);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API BOOL GetFileAttributesExW(LPCWSTR lpFileName, GET_FILEEX_INFO_LEVELS fInfoLevelId,
Packit Service 5a9772
	                                    LPVOID lpFileInformation);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API DWORD GetFileAttributesW(LPCWSTR lpFileName);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API BOOL SetFileAttributesA(LPCSTR lpFileName, DWORD dwFileAttributes);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API BOOL SetFileAttributesW(LPCWSTR lpFileName, DWORD dwFileAttributes);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API BOOL SetEndOfFile(HANDLE hFile);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API DWORD SetFilePointer(HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh,
Packit Service 5a9772
	                               DWORD dwMoveMethod);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API BOOL SetFilePointerEx(HANDLE hFile, LARGE_INTEGER liDistanceToMove,
Packit Service 5a9772
	                                PLARGE_INTEGER lpNewFilePointer, DWORD dwMoveMethod);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API BOOL LockFile(HANDLE hFile, DWORD dwFileOffsetLow, DWORD dwFileOffsetHigh,
Packit Service 5a9772
	                        DWORD nNumberOfBytesToLockLow, DWORD nNumberOfBytesToLockHigh);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API BOOL LockFileEx(HANDLE hFile, DWORD dwFlags, DWORD dwReserved,
Packit Service 5a9772
	                          DWORD nNumberOfBytesToLockLow, DWORD nNumberOfBytesToLockHigh,
Packit Service 5a9772
	                          LPOVERLAPPED lpOverlapped);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API BOOL UnlockFile(HANDLE hFile, DWORD dwFileOffsetLow, DWORD dwFileOffsetHigh,
Packit Service 5a9772
	                          DWORD nNumberOfBytesToUnlockLow, DWORD nNumberOfBytesToUnlockHigh);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API BOOL UnlockFileEx(HANDLE hFile, DWORD dwReserved, DWORD nNumberOfBytesToUnlockLow,
Packit Service 5a9772
	                            DWORD nNumberOfBytesToUnlockHigh, LPOVERLAPPED lpOverlapped);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API BOOL SetFileTime(HANDLE hFile, const FILETIME* lpCreationTime,
Packit Service 5a9772
	                           const FILETIME* lpLastAccessTime, const FILETIME* lpLastWriteTime);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API HANDLE FindFirstFileA(LPCSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData);
Packit Service 5a9772
	WINPR_API HANDLE FindFirstFileW(LPCWSTR lpFileName, LPWIN32_FIND_DATAW lpFindFileData);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API HANDLE FindFirstFileExA(LPCSTR lpFileName, FINDEX_INFO_LEVELS fInfoLevelId,
Packit Service 5a9772
	                                  LPVOID lpFindFileData, FINDEX_SEARCH_OPS fSearchOp,
Packit Service 5a9772
	                                  LPVOID lpSearchFilter, DWORD dwAdditionalFlags);
Packit Service 5a9772
	WINPR_API HANDLE FindFirstFileExW(LPCWSTR lpFileName, FINDEX_INFO_LEVELS fInfoLevelId,
Packit Service 5a9772
	                                  LPVOID lpFindFileData, FINDEX_SEARCH_OPS fSearchOp,
Packit Service 5a9772
	                                  LPVOID lpSearchFilter, DWORD dwAdditionalFlags);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API BOOL FindNextFileA(HANDLE hFindFile, LPWIN32_FIND_DATAA lpFindFileData);
Packit Service 5a9772
	WINPR_API BOOL FindNextFileW(HANDLE hFindFile, LPWIN32_FIND_DATAW lpFindFileData);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API BOOL FindClose(HANDLE hFindFile);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API BOOL CreateDirectoryA(LPCSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes);
Packit Service 5a9772
	WINPR_API BOOL CreateDirectoryW(LPCWSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API BOOL RemoveDirectoryA(LPCSTR lpPathName);
Packit Service 5a9772
	WINPR_API BOOL RemoveDirectoryW(LPCWSTR lpPathName);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API HANDLE GetStdHandle(DWORD nStdHandle);
Packit Service 5a9772
	WINPR_API BOOL SetStdHandle(DWORD nStdHandle, HANDLE hHandle);
Packit Service 5a9772
	WINPR_API BOOL SetStdHandleEx(DWORD dwStdHandle, HANDLE hNewHandle, HANDLE* phOldHandle);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API BOOL GetDiskFreeSpaceA(LPCSTR lpRootPathName, LPDWORD lpSectorsPerCluster,
Packit Service 5a9772
	                                 LPDWORD lpBytesPerSector, LPDWORD lpNumberOfFreeClusters,
Packit Service 5a9772
	                                 LPDWORD lpTotalNumberOfClusters);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API BOOL GetDiskFreeSpaceW(LPCWSTR lpRootPathName, LPDWORD lpSectorsPerCluster,
Packit Service 5a9772
	                                 LPDWORD lpBytesPerSector, LPDWORD lpNumberOfFreeClusters,
Packit Service 5a9772
	                                 LPDWORD lpTotalNumberOfClusters);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API BOOL MoveFileExA(LPCSTR lpExistingFileName, LPCSTR lpNewFileName, DWORD dwFlags);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API BOOL MoveFileExW(LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName, DWORD dwFlags);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API BOOL MoveFileA(LPCSTR lpExistingFileName, LPCSTR lpNewFileName);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API BOOL MoveFileW(LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName);
Packit 1fb8d4
Packit 1fb8d4
#ifdef __cplusplus
Packit 1fb8d4
}
Packit 1fb8d4
#endif
Packit 1fb8d4
Packit 1fb8d4
#ifdef UNICODE
Packit Service 5a9772
#define CreateFile CreateFileW
Packit Service 5a9772
#define DeleteFile DeleteFileW
Packit Service 5a9772
#define FindFirstFile FindFirstFileW
Packit Service 5a9772
#define FindFirstFileEx FindFirstFileExW
Packit Service 5a9772
#define FindNextFile FindNextFileW
Packit Service 5a9772
#define CreateDirectory CreateDirectoryW
Packit Service 5a9772
#define RemoveDirectory RemoveDirectoryW
Packit Service 5a9772
#define GetFileAttributesEx GetFileAttributesExW
Packit Service 5a9772
#define GetFileAttributes GetFileAttributesW
Packit Service 5a9772
#define SetFileAttributes SetFileAttributesW
Packit Service 5a9772
#define GetDiskFreeSpace GetDiskFreeSpaceW
Packit Service 5a9772
#define MoveFileEx MoveFileExW
Packit Service 5a9772
#define MoveFile MoveFileW
Packit 1fb8d4
#else
Packit Service 5a9772
#define CreateFile CreateFileA
Packit Service 5a9772
#define DeleteFile DeleteFileA
Packit Service 5a9772
#define FindFirstFile FindFirstFileA
Packit Service 5a9772
#define FindFirstFileEx FindFirstFileExA
Packit Service 5a9772
#define FindNextFile FindNextFileA
Packit Service 5a9772
#define CreateDirectory CreateDirectoryA
Packit Service 5a9772
#define RemoveDirectory RemoveDirectoryA
Packit Service 5a9772
#define GetFileAttributesEx GetFileAttributesExA
Packit Service 5a9772
#define GetFileAttributes GetFileAttributesA
Packit Service 5a9772
#define SetFileAttributes SetFileAttributesA
Packit Service 5a9772
#define GetDiskFreeSpace GetDiskFreeSpaceA
Packit Service 5a9772
#define MoveFileEx MoveFileExA
Packit Service 5a9772
#define MoveFile MoveFileA
Packit 1fb8d4
#endif
Packit 1fb8d4
Packit 1fb8d4
/* Extra Functions */
Packit 1fb8d4
Packit 1fb8d4
typedef BOOL (*pcIsFileHandled)(LPCSTR lpFileName);
Packit Service 5a9772
typedef HANDLE (*pcCreateFileA)(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
Packit Service 5a9772
                                LPSECURITY_ATTRIBUTES lpSecurityAttributes,
Packit Service 5a9772
                                DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes,
Packit Service 5a9772
                                HANDLE hTemplateFile);
Packit 1fb8d4
Packit 1fb8d4
typedef struct _HANDLE_CREATOR
Packit 1fb8d4
{
Packit 1fb8d4
	pcIsFileHandled IsHandled;
Packit 1fb8d4
	pcCreateFileA CreateFileA;
Packit 1fb8d4
} HANDLE_CREATOR, *PHANDLE_CREATOR, *LPHANDLE_CREATOR;
Packit 1fb8d4
Packit 1fb8d4
WINPR_API BOOL ValidFileNameComponent(LPCWSTR lpFileName);
Packit 1fb8d4
Packit 1fb8d4
#endif /* _WIN32 */
Packit 1fb8d4
Packit 1fb8d4
#ifdef _UWP
Packit 1fb8d4
Packit 1fb8d4
#ifdef __cplusplus
Packit Service 5a9772
extern "C"
Packit Service 5a9772
{
Packit 1fb8d4
#endif
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
Packit Service 5a9772
	                             LPSECURITY_ATTRIBUTES lpSecurityAttributes,
Packit Service 5a9772
	                             DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes,
Packit Service 5a9772
	                             HANDLE hTemplateFile);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API HANDLE CreateFileW(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
Packit Service 5a9772
	                             LPSECURITY_ATTRIBUTES lpSecurityAttributes,
Packit Service 5a9772
	                             DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes,
Packit Service 5a9772
	                             HANDLE hTemplateFile);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API DWORD SetFilePointer(HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh,
Packit Service 5a9772
	                               DWORD dwMoveMethod);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API HANDLE FindFirstFileA(LPCSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData);
Packit Service 5a9772
	WINPR_API HANDLE FindFirstFileW(LPCWSTR lpFileName, LPWIN32_FIND_DATAW lpFindFileData);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API DWORD GetFullPathNameA(LPCSTR lpFileName, DWORD nBufferLength, LPSTR lpBuffer,
Packit Service 5a9772
	                                 LPSTR* lpFilePart);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API BOOL GetDiskFreeSpaceA(LPCSTR lpRootPathName, LPDWORD lpSectorsPerCluster,
Packit Service 5a9772
	                                 LPDWORD lpBytesPerSector, LPDWORD lpNumberOfFreeClusters,
Packit Service 5a9772
	                                 LPDWORD lpTotalNumberOfClusters);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API BOOL GetDiskFreeSpaceW(LPCWSTR lpRootPathName, LPDWORD lpSectorsPerCluster,
Packit Service 5a9772
	                                 LPDWORD lpBytesPerSector, LPDWORD lpNumberOfFreeClusters,
Packit Service 5a9772
	                                 LPDWORD lpTotalNumberOfClusters);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API DWORD GetLogicalDriveStringsA(DWORD nBufferLength, LPSTR lpBuffer);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API DWORD GetLogicalDriveStringsW(DWORD nBufferLength, LPWSTR lpBuffer);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API BOOL PathIsDirectoryEmptyA(LPCSTR pszPath);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API UINT GetACP(void);
Packit 1fb8d4
Packit 1fb8d4
#ifdef UNICODE
Packit Service 5a9772
#define CreateFile CreateFileW
Packit Service 5a9772
#define FindFirstFile FindFirstFileW
Packit 1fb8d4
#else
Packit Service 5a9772
#define CreateFile CreateFileA
Packit Service 5a9772
#define FindFirstFile FindFirstFileA
Packit 1fb8d4
#endif
Packit 1fb8d4
Packit 1fb8d4
#ifdef __cplusplus
Packit 1fb8d4
}
Packit 1fb8d4
#endif
Packit 1fb8d4
Packit 1fb8d4
#ifdef UNICODE
Packit Service 5a9772
#define FindFirstFile FindFirstFileW
Packit 1fb8d4
#else
Packit Service 5a9772
#define FindFirstFile FindFirstFileA
Packit 1fb8d4
#endif
Packit 1fb8d4
Packit 1fb8d4
#endif
Packit 1fb8d4
Packit Service 5a9772
#define WILDCARD_STAR 0x00000001
Packit Service 5a9772
#define WILDCARD_QM 0x00000002
Packit Service 5a9772
#define WILDCARD_DOS 0x00000100
Packit Service 5a9772
#define WILDCARD_DOS_STAR 0x00000110
Packit Service 5a9772
#define WILDCARD_DOS_QM 0x00000120
Packit Service 5a9772
#define WILDCARD_DOS_DOT 0x00000140
Packit 1fb8d4
Packit 1fb8d4
#ifdef __cplusplus
Packit Service 5a9772
extern "C"
Packit Service 5a9772
{
Packit 1fb8d4
#endif
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API BOOL FilePatternMatchA(LPCSTR lpFileName, LPCSTR lpPattern);
Packit Service 5a9772
	WINPR_API LPSTR FilePatternFindNextWildcardA(LPCSTR lpPattern, DWORD* pFlags);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API int UnixChangeFileMode(const char* filename, int flags);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API BOOL IsNamedPipeFileNameA(LPCSTR lpName);
Packit Service 5a9772
	WINPR_API char* GetNamedPipeNameWithoutPrefixA(LPCSTR lpName);
Packit Service 5a9772
	WINPR_API char* GetNamedPipeUnixDomainSocketBaseFilePathA(void);
Packit Service 5a9772
	WINPR_API char* GetNamedPipeUnixDomainSocketFilePathA(LPCSTR lpName);
Packit 1fb8d4
Packit Service 5a9772
	WINPR_API int GetNamePipeFileDescriptor(HANDLE hNamedPipe);
Packit Service 5a9772
	WINPR_API HANDLE GetFileHandleForFileDescriptor(int fd);
Packit 1fb8d4
Packit 1fb8d4
#ifdef __cplusplus
Packit 1fb8d4
}
Packit 1fb8d4
#endif
Packit 1fb8d4
Packit 1fb8d4
#endif /* WINPR_FILE_H */