FreeRDP
winpr/include/winpr/file.h File Reference
#include <winpr/winpr.h>
#include <winpr/wtypes.h>
#include <winpr/nt.h>
#include <winpr/io.h>
#include <winpr/error.h>
This graph shows which files directly or indirectly include this file:

Data Structures

union  PFILE_SEGMENT_ELEMENT
 
struct  LPWIN32_FIND_DATAA
 
struct  LPWIN32_FIND_DATAW
 
struct  LPWIN32_FILE_ATTRIBUTE_DATA
 
struct  LPHANDLE_CREATOR
 

Macros

#define MAX_PATH   260
 
#define INVALID_HANDLE_VALUE   ((HANDLE) (LONG_PTR) - 1)
 
#define INVALID_FILE_SIZE   ((DWORD) 0xFFFFFFFF)
 
#define INVALID_SET_FILE_POINTER   ((DWORD) - 1)
 
#define INVALID_FILE_ATTRIBUTES   ((DWORD) - 1)
 
#define FILE_ATTRIBUTE_READONLY   0x00000001
 
#define FILE_ATTRIBUTE_HIDDEN   0x00000002
 
#define FILE_ATTRIBUTE_SYSTEM   0x00000004
 
#define FILE_ATTRIBUTE_DIRECTORY   0x00000010
 
#define FILE_ATTRIBUTE_ARCHIVE   0x00000020
 
#define FILE_ATTRIBUTE_DEVICE   0x00000040
 
#define FILE_ATTRIBUTE_NORMAL   0x00000080
 
#define FILE_ATTRIBUTE_TEMPORARY   0x00000100
 
#define FILE_ATTRIBUTE_SPARSE_FILE   0x00000200
 
#define FILE_ATTRIBUTE_REPARSE_POINT   0x00000400
 
#define FILE_ATTRIBUTE_COMPRESSED   0x00000800
 
#define FILE_ATTRIBUTE_OFFLINE   0x00001000
 
#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED   0x00002000
 
#define FILE_ATTRIBUTE_ENCRYPTED   0x00004000
 
#define FILE_ATTRIBUTE_VIRTUAL   0x00010000
 
#define FILE_NOTIFY_CHANGE_FILE_NAME   0x00000001
 
#define FILE_NOTIFY_CHANGE_DIR_NAME   0x00000002
 
#define FILE_NOTIFY_CHANGE_ATTRIBUTES   0x00000004
 
#define FILE_NOTIFY_CHANGE_SIZE   0x00000008
 
#define FILE_NOTIFY_CHANGE_LAST_WRITE   0x00000010
 
#define FILE_NOTIFY_CHANGE_LAST_ACCESS   0x00000020
 
#define FILE_NOTIFY_CHANGE_CREATION   0x00000040
 
#define FILE_NOTIFY_CHANGE_SECURITY   0x00000100
 
#define FILE_ACTION_ADDED   0x00000001
 
#define FILE_ACTION_REMOVED   0x00000002
 
#define FILE_ACTION_MODIFIED   0x00000003
 
#define FILE_ACTION_RENAMED_OLD_NAME   0x00000004
 
#define FILE_ACTION_RENAMED_NEW_NAME   0x00000005
 
#define FILE_CASE_SENSITIVE_SEARCH   0x00000001
 
#define FILE_CASE_PRESERVED_NAMES   0x00000002
 
#define FILE_UNICODE_ON_DISK   0x00000004
 
#define FILE_PERSISTENT_ACLS   0x00000008
 
#define FILE_FILE_COMPRESSION   0x00000010
 
#define FILE_VOLUME_QUOTAS   0x00000020
 
#define FILE_SUPPORTS_SPARSE_FILES   0x00000040
 
#define FILE_SUPPORTS_REPARSE_POINTS   0x00000080
 
#define FILE_SUPPORTS_REMOTE_STORAGE   0x00000100
 
#define FILE_VOLUME_IS_COMPRESSED   0x00008000
 
#define FILE_SUPPORTS_OBJECT_IDS   0x00010000
 
#define FILE_SUPPORTS_ENCRYPTION   0x00020000
 
#define FILE_NAMED_STREAMS   0x00040000
 
#define FILE_READ_ONLY_VOLUME   0x00080000
 
#define FILE_SEQUENTIAL_WRITE_ONCE   0x00100000
 
#define FILE_SUPPORTS_TRANSACTIONS   0x00200000
 
#define FILE_SUPPORTS_HARD_LINKS   0x00400000
 
#define FILE_SUPPORTS_EXTENDED_ATTRIBUTES   0x00800000
 
#define FILE_SUPPORTS_OPEN_BY_FILE_ID   0x01000000
 
#define FILE_SUPPORTS_USN_JOURNAL   0x02000000
 
#define FILE_FLAG_WRITE_THROUGH   0x80000000
 
#define FILE_FLAG_OVERLAPPED   0x40000000
 
#define FILE_FLAG_NO_BUFFERING   0x20000000
 
#define FILE_FLAG_RANDOM_ACCESS   0x10000000
 
#define FILE_FLAG_SEQUENTIAL_SCAN   0x08000000
 
#define FILE_FLAG_DELETE_ON_CLOSE   0x04000000
 
#define FILE_FLAG_BACKUP_SEMANTICS   0x02000000
 
#define FILE_FLAG_POSIX_SEMANTICS   0x01000000
 
#define FILE_FLAG_OPEN_REPARSE_POINT   0x00200000
 
#define FILE_FLAG_OPEN_NO_RECALL   0x00100000
 
#define FILE_FLAG_FIRST_PIPE_INSTANCE   0x00080000
 
#define PAGE_NOACCESS   0x00000001
 
#define PAGE_READONLY   0x00000002
 
#define PAGE_READWRITE   0x00000004
 
#define PAGE_WRITECOPY   0x00000008
 
#define PAGE_EXECUTE   0x00000010
 
#define PAGE_EXECUTE_READ   0x00000020
 
#define PAGE_EXECUTE_READWRITE   0x00000040
 
#define PAGE_EXECUTE_WRITECOPY   0x00000080
 
#define PAGE_GUARD   0x00000100
 
#define PAGE_NOCACHE   0x00000200
 
#define PAGE_WRITECOMBINE   0x00000400
 
#define MEM_COMMIT   0x00001000
 
#define MEM_RESERVE   0x00002000
 
#define MEM_DECOMMIT   0x00004000
 
#define MEM_RELEASE   0x00008000
 
#define MEM_FREE   0x00010000
 
#define MEM_PRIVATE   0x00020000
 
#define MEM_MAPPED   0x00040000
 
#define MEM_RESET   0x00080000
 
#define MEM_TOP_DOWN   0x00100000
 
#define MEM_WRITE_WATCH   0x00200000
 
#define MEM_PHYSICAL   0x00400000
 
#define MEM_4MB_PAGES   0x80000000
 
#define MEM_IMAGE   SEC_IMAGE
 
#define SEC_NO_CHANGE   0x00400000
 
#define SEC_FILE   0x00800000
 
#define SEC_IMAGE   0x01000000
 
#define SEC_VLM   0x02000000
 
#define SEC_RESERVE   0x04000000
 
#define SEC_COMMIT   0x08000000
 
#define SEC_NOCACHE   0x10000000
 
#define SEC_WRITECOMBINE   0x40000000
 
#define SEC_LARGE_PAGES   0x80000000
 
#define SECTION_MAP_EXECUTE_EXPLICIT   0x00020
 
#define SECTION_EXTEND_SIZE   0x00010
 
#define SECTION_MAP_READ   0x00004
 
#define SECTION_MAP_WRITE   0x00002
 
#define SECTION_QUERY   0x00001
 
#define SECTION_MAP_EXECUTE   0x00008
 
#define SECTION_ALL_ACCESS   0xF001F
 
#define FILE_MAP_COPY   SECTION_QUERY
 
#define FILE_MAP_WRITE   SECTION_MAP_WRITE
 
#define FILE_MAP_READ   SECTION_MAP_READ
 
#define FILE_MAP_ALL_ACCESS   SECTION_ALL_ACCESS
 
#define FILE_MAP_EXECUTE   SECTION_MAP_EXECUTE_EXPLICIT
 
#define CREATE_NEW   1
 
#define CREATE_ALWAYS   2
 
#define OPEN_EXISTING   3
 
#define OPEN_ALWAYS   4
 
#define TRUNCATE_EXISTING   5
 
#define FIND_FIRST_EX_CASE_SENSITIVE   0x1
 
#define FIND_FIRST_EX_LARGE_FETCH   0x2
 
#define STD_INPUT_HANDLE   (DWORD)-10
 
#define STD_OUTPUT_HANDLE   (DWORD)-11
 
#define STD_ERROR_HANDLE   (DWORD)-12
 
#define FILE_BEGIN   0
 
#define FILE_CURRENT   1
 
#define FILE_END   2
 
#define LOCKFILE_FAIL_IMMEDIATELY   1
 
#define LOCKFILE_EXCLUSIVE_LOCK   2
 
#define MOVEFILE_REPLACE_EXISTING   0x1
 
#define MOVEFILE_COPY_ALLOWED   0x2
 
#define MOVEFILE_DELAY_UNTIL_REBOOT   0x4
 
#define MOVEFILE_WRITE_THROUGH   0x8
 
#define MOVEFILE_CREATE_HARDLINK   0x10
 
#define MOVEFILE_FAIL_IF_NOT_TRACKABLE   0x20
 
#define WIN32_FIND_DATA   WIN32_FIND_DATAA
 
#define PWIN32_FIND_DATA   PWIN32_FIND_DATAA
 
#define LPWIN32_FIND_DATA   LPWIN32_FIND_DATAA
 
#define CreateFile   CreateFileA
 
#define DeleteFile   DeleteFileA
 
#define FindFirstFile   FindFirstFileA
 
#define FindFirstFileEx   FindFirstFileExA
 
#define FindNextFile   FindNextFileA
 
#define CreateDirectory   CreateDirectoryA
 
#define RemoveDirectory   RemoveDirectoryA
 
#define GetFileAttributesEx   GetFileAttributesExA
 
#define GetFileAttributes   GetFileAttributesA
 
#define SetFileAttributes   SetFileAttributesA
 
#define GetDiskFreeSpace   GetDiskFreeSpaceA
 
#define MoveFileEx   MoveFileExA
 
#define MoveFile   MoveFileA
 
#define WILDCARD_STAR   0x00000001
 
#define WILDCARD_QM   0x00000002
 
#define WILDCARD_DOS   0x00000100
 
#define WILDCARD_DOS_STAR   0x00000110
 
#define WILDCARD_DOS_QM   0x00000120
 
#define WILDCARD_DOS_DOT   0x00000140
 

Typedefs

typedef VOID(* LPOVERLAPPED_COMPLETION_ROUTINE) (DWORD dwErrorCode, DWORD dwNumberOfBytesTransfered, LPOVERLAPPED lpOverlapped)
 
typedef BOOL(* pcIsFileHandled) (LPCSTR lpFileName)
 
typedef HANDLE(* pcCreateFileA) (LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)
 

Enumerations

enum  FINDEX_INFO_LEVELS { FindExInfoStandard, FindExInfoMaxInfoLevel }
 
enum  FINDEX_SEARCH_OPS { FindExSearchNameMatch, FindExSearchLimitToDirectories, FindExSearchLimitToDevices, FindExSearchMaxSearchOp }
 
enum  GET_FILEEX_INFO_LEVELS { GetFileExInfoStandard, GetFileExMaxInfoLevel }
 

Functions

WINPR_API HANDLE CreateFileA (LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)
 
WINPR_API HANDLE CreateFileW (LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)
 
WINPR_API BOOL DeleteFileA (LPCSTR lpFileName)
 
WINPR_API BOOL DeleteFileW (LPCWSTR lpFileName)
 
WINPR_API BOOL ReadFile (HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped)
 
WINPR_API BOOL ReadFileEx (HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPOVERLAPPED lpOverlapped, LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
 
WINPR_API BOOL ReadFileScatter (HANDLE hFile, FILE_SEGMENT_ELEMENT aSegmentArray[], DWORD nNumberOfBytesToRead, LPDWORD lpReserved, LPOVERLAPPED lpOverlapped)
 
WINPR_API BOOL WriteFile (HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped)
 
WINPR_API BOOL WriteFileEx (HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPOVERLAPPED lpOverlapped, LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
 
WINPR_API BOOL WriteFileGather (HANDLE hFile, FILE_SEGMENT_ELEMENT aSegmentArray[], DWORD nNumberOfBytesToWrite, LPDWORD lpReserved, LPOVERLAPPED lpOverlapped)
 
WINPR_API BOOL FlushFileBuffers (HANDLE hFile)
 
WINPR_API BOOL GetFileAttributesExA (LPCSTR lpFileName, GET_FILEEX_INFO_LEVELS fInfoLevelId, LPVOID lpFileInformation)
 
WINPR_API DWORD GetFileAttributesA (LPCSTR lpFileName)
 
WINPR_API BOOL GetFileAttributesExW (LPCWSTR lpFileName, GET_FILEEX_INFO_LEVELS fInfoLevelId, LPVOID lpFileInformation)
 
WINPR_API DWORD GetFileAttributesW (LPCWSTR lpFileName)
 
WINPR_API BOOL SetFileAttributesA (LPCSTR lpFileName, DWORD dwFileAttributes)
 
WINPR_API BOOL SetFileAttributesW (LPCWSTR lpFileName, DWORD dwFileAttributes)
 
WINPR_API BOOL SetEndOfFile (HANDLE hFile)
 
WINPR_API DWORD WINAPI GetFileSize (HANDLE hFile, LPDWORD lpFileSizeHigh)
 
WINPR_API DWORD SetFilePointer (HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh, DWORD dwMoveMethod)
 
WINPR_API BOOL SetFilePointerEx (HANDLE hFile, LARGE_INTEGER liDistanceToMove, PLARGE_INTEGER lpNewFilePointer, DWORD dwMoveMethod)
 
WINPR_API BOOL LockFile (HANDLE hFile, DWORD dwFileOffsetLow, DWORD dwFileOffsetHigh, DWORD nNumberOfBytesToLockLow, DWORD nNumberOfBytesToLockHigh)
 
WINPR_API BOOL LockFileEx (HANDLE hFile, DWORD dwFlags, DWORD dwReserved, DWORD nNumberOfBytesToLockLow, DWORD nNumberOfBytesToLockHigh, LPOVERLAPPED lpOverlapped)
 
WINPR_API BOOL UnlockFile (HANDLE hFile, DWORD dwFileOffsetLow, DWORD dwFileOffsetHigh, DWORD nNumberOfBytesToUnlockLow, DWORD nNumberOfBytesToUnlockHigh)
 
WINPR_API BOOL UnlockFileEx (HANDLE hFile, DWORD dwReserved, DWORD nNumberOfBytesToUnlockLow, DWORD nNumberOfBytesToUnlockHigh, LPOVERLAPPED lpOverlapped)
 
WINPR_API BOOL SetFileTime (HANDLE hFile, const FILETIME *lpCreationTime, const FILETIME *lpLastAccessTime, const FILETIME *lpLastWriteTime)
 
WINPR_API HANDLE FindFirstFileA (LPCSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData)
 
WINPR_API HANDLE FindFirstFileW (LPCWSTR lpFileName, LPWIN32_FIND_DATAW lpFindFileData)
 
WINPR_API HANDLE FindFirstFileExA (LPCSTR lpFileName, FINDEX_INFO_LEVELS fInfoLevelId, LPVOID lpFindFileData, FINDEX_SEARCH_OPS fSearchOp, LPVOID lpSearchFilter, DWORD dwAdditionalFlags)
 
WINPR_API HANDLE FindFirstFileExW (LPCWSTR lpFileName, FINDEX_INFO_LEVELS fInfoLevelId, LPVOID lpFindFileData, FINDEX_SEARCH_OPS fSearchOp, LPVOID lpSearchFilter, DWORD dwAdditionalFlags)
 
WINPR_API BOOL FindNextFileA (HANDLE hFindFile, LPWIN32_FIND_DATAA lpFindFileData)
 
WINPR_API BOOL FindNextFileW (HANDLE hFindFile, LPWIN32_FIND_DATAW lpFindFileData)
 
WINPR_API BOOL FindClose (HANDLE hFindFile)
 
WINPR_API BOOL CreateDirectoryA (LPCSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes)
 
WINPR_API BOOL CreateDirectoryW (LPCWSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes)
 
WINPR_API BOOL RemoveDirectoryA (LPCSTR lpPathName)
 
WINPR_API BOOL RemoveDirectoryW (LPCWSTR lpPathName)
 
WINPR_API HANDLE GetStdHandle (DWORD nStdHandle)
 
WINPR_API BOOL SetStdHandle (DWORD nStdHandle, HANDLE hHandle)
 
WINPR_API BOOL SetStdHandleEx (DWORD dwStdHandle, HANDLE hNewHandle, HANDLE *phOldHandle)
 
WINPR_API BOOL GetDiskFreeSpaceA (LPCSTR lpRootPathName, LPDWORD lpSectorsPerCluster, LPDWORD lpBytesPerSector, LPDWORD lpNumberOfFreeClusters, LPDWORD lpTotalNumberOfClusters)
 
WINPR_API BOOL GetDiskFreeSpaceW (LPCWSTR lpRootPathName, LPDWORD lpSectorsPerCluster, LPDWORD lpBytesPerSector, LPDWORD lpNumberOfFreeClusters, LPDWORD lpTotalNumberOfClusters)
 
WINPR_API BOOL MoveFileExA (LPCSTR lpExistingFileName, LPCSTR lpNewFileName, DWORD dwFlags)
 
WINPR_API BOOL MoveFileExW (LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName, DWORD dwFlags)
 
WINPR_API BOOL MoveFileA (LPCSTR lpExistingFileName, LPCSTR lpNewFileName)
 
WINPR_API BOOL MoveFileW (LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName)
 
WINPR_API BOOL ValidFileNameComponent (LPCWSTR lpFileName)
 
WINPR_API BOOL FilePatternMatchA (LPCSTR lpFileName, LPCSTR lpPattern)
 
WINPR_API LPSTR FilePatternFindNextWildcardA (LPCSTR lpPattern, DWORD *pFlags)
 
WINPR_API int UnixChangeFileMode (const char *filename, int flags)
 
WINPR_API BOOL IsNamedPipeFileNameA (LPCSTR lpName)
 
WINPR_API char * GetNamedPipeNameWithoutPrefixA (LPCSTR lpName)
 
WINPR_API char * GetNamedPipeUnixDomainSocketBaseFilePathA (void)
 
WINPR_API char * GetNamedPipeUnixDomainSocketFilePathA (LPCSTR lpName)
 
WINPR_API int GetNamePipeFileDescriptor (HANDLE hNamedPipe)
 
WINPR_API HANDLE GetFileHandleForFileDescriptor (int fd)
 

Macro Definition Documentation

#define CREATE_ALWAYS   2
#define CREATE_NEW   1
#define CreateDirectory   CreateDirectoryA
#define CreateFile   CreateFileA
#define DeleteFile   DeleteFileA
#define FILE_ACTION_ADDED   0x00000001
#define FILE_ACTION_MODIFIED   0x00000003
#define FILE_ACTION_REMOVED   0x00000002
#define FILE_ACTION_RENAMED_NEW_NAME   0x00000005
#define FILE_ACTION_RENAMED_OLD_NAME   0x00000004
#define FILE_ATTRIBUTE_ARCHIVE   0x00000020
#define FILE_ATTRIBUTE_COMPRESSED   0x00000800
#define FILE_ATTRIBUTE_DEVICE   0x00000040
#define FILE_ATTRIBUTE_DIRECTORY   0x00000010
#define FILE_ATTRIBUTE_ENCRYPTED   0x00004000
#define FILE_ATTRIBUTE_HIDDEN   0x00000002
#define FILE_ATTRIBUTE_NORMAL   0x00000080
#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED   0x00002000
#define FILE_ATTRIBUTE_OFFLINE   0x00001000
#define FILE_ATTRIBUTE_READONLY   0x00000001
#define FILE_ATTRIBUTE_REPARSE_POINT   0x00000400
#define FILE_ATTRIBUTE_SPARSE_FILE   0x00000200
#define FILE_ATTRIBUTE_SYSTEM   0x00000004
#define FILE_ATTRIBUTE_TEMPORARY   0x00000100
#define FILE_ATTRIBUTE_VIRTUAL   0x00010000
#define FILE_BEGIN   0
#define FILE_CASE_PRESERVED_NAMES   0x00000002
#define FILE_CASE_SENSITIVE_SEARCH   0x00000001
#define FILE_CURRENT   1
#define FILE_END   2
#define FILE_FILE_COMPRESSION   0x00000010
#define FILE_FLAG_BACKUP_SEMANTICS   0x02000000
#define FILE_FLAG_DELETE_ON_CLOSE   0x04000000
#define FILE_FLAG_FIRST_PIPE_INSTANCE   0x00080000
#define FILE_FLAG_NO_BUFFERING   0x20000000
#define FILE_FLAG_OPEN_NO_RECALL   0x00100000
#define FILE_FLAG_OPEN_REPARSE_POINT   0x00200000
#define FILE_FLAG_OVERLAPPED   0x40000000
#define FILE_FLAG_POSIX_SEMANTICS   0x01000000
#define FILE_FLAG_RANDOM_ACCESS   0x10000000
#define FILE_FLAG_SEQUENTIAL_SCAN   0x08000000
#define FILE_FLAG_WRITE_THROUGH   0x80000000
#define FILE_MAP_ALL_ACCESS   SECTION_ALL_ACCESS
#define FILE_MAP_COPY   SECTION_QUERY
#define FILE_MAP_EXECUTE   SECTION_MAP_EXECUTE_EXPLICIT
#define FILE_MAP_READ   SECTION_MAP_READ
#define FILE_MAP_WRITE   SECTION_MAP_WRITE
#define FILE_NAMED_STREAMS   0x00040000
#define FILE_NOTIFY_CHANGE_ATTRIBUTES   0x00000004
#define FILE_NOTIFY_CHANGE_CREATION   0x00000040
#define FILE_NOTIFY_CHANGE_DIR_NAME   0x00000002
#define FILE_NOTIFY_CHANGE_FILE_NAME   0x00000001
#define FILE_NOTIFY_CHANGE_LAST_ACCESS   0x00000020
#define FILE_NOTIFY_CHANGE_LAST_WRITE   0x00000010
#define FILE_NOTIFY_CHANGE_SECURITY   0x00000100
#define FILE_NOTIFY_CHANGE_SIZE   0x00000008
#define FILE_PERSISTENT_ACLS   0x00000008
#define FILE_READ_ONLY_VOLUME   0x00080000
#define FILE_SEQUENTIAL_WRITE_ONCE   0x00100000
#define FILE_SUPPORTS_ENCRYPTION   0x00020000
#define FILE_SUPPORTS_EXTENDED_ATTRIBUTES   0x00800000
#define FILE_SUPPORTS_HARD_LINKS   0x00400000
#define FILE_SUPPORTS_OBJECT_IDS   0x00010000
#define FILE_SUPPORTS_OPEN_BY_FILE_ID   0x01000000
#define FILE_SUPPORTS_REMOTE_STORAGE   0x00000100
#define FILE_SUPPORTS_REPARSE_POINTS   0x00000080
#define FILE_SUPPORTS_SPARSE_FILES   0x00000040
#define FILE_SUPPORTS_TRANSACTIONS   0x00200000
#define FILE_SUPPORTS_USN_JOURNAL   0x02000000
#define FILE_UNICODE_ON_DISK   0x00000004
#define FILE_VOLUME_IS_COMPRESSED   0x00008000
#define FILE_VOLUME_QUOTAS   0x00000020
#define FIND_FIRST_EX_CASE_SENSITIVE   0x1
#define FIND_FIRST_EX_LARGE_FETCH   0x2
#define FindFirstFile   FindFirstFileA
#define FindFirstFileEx   FindFirstFileExA
#define FindNextFile   FindNextFileA
#define GetDiskFreeSpace   GetDiskFreeSpaceA
#define GetFileAttributes   GetFileAttributesA
#define GetFileAttributesEx   GetFileAttributesExA
#define INVALID_FILE_ATTRIBUTES   ((DWORD) - 1)
#define INVALID_FILE_SIZE   ((DWORD) 0xFFFFFFFF)
#define INVALID_HANDLE_VALUE   ((HANDLE) (LONG_PTR) - 1)
#define INVALID_SET_FILE_POINTER   ((DWORD) - 1)
#define LOCKFILE_EXCLUSIVE_LOCK   2
#define LOCKFILE_FAIL_IMMEDIATELY   1
#define LPWIN32_FIND_DATA   LPWIN32_FIND_DATAA
#define MAX_PATH   260

WinPR: Windows Portable Runtime File Functions

Copyright 2012 Marc-Andre Moreau marca.nosp@m.ndre.nosp@m..more.nosp@m.au@g.nosp@m.mail..nosp@m.com Copyright 2016 David PHAM-VAN d.pha.nosp@m.mvan.nosp@m.@inuv.nosp@m.ika..nosp@m.com

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

#define MEM_4MB_PAGES   0x80000000
#define MEM_COMMIT   0x00001000
#define MEM_DECOMMIT   0x00004000
#define MEM_FREE   0x00010000
#define MEM_IMAGE   SEC_IMAGE
#define MEM_MAPPED   0x00040000
#define MEM_PHYSICAL   0x00400000
#define MEM_PRIVATE   0x00020000
#define MEM_RELEASE   0x00008000
#define MEM_RESERVE   0x00002000
#define MEM_RESET   0x00080000
#define MEM_TOP_DOWN   0x00100000
#define MEM_WRITE_WATCH   0x00200000
#define MoveFile   MoveFileA
#define MOVEFILE_COPY_ALLOWED   0x2
#define MOVEFILE_CREATE_HARDLINK   0x10
#define MOVEFILE_DELAY_UNTIL_REBOOT   0x4
#define MOVEFILE_FAIL_IF_NOT_TRACKABLE   0x20
#define MOVEFILE_REPLACE_EXISTING   0x1
#define MOVEFILE_WRITE_THROUGH   0x8
#define MoveFileEx   MoveFileExA
#define OPEN_ALWAYS   4
#define OPEN_EXISTING   3
#define PAGE_EXECUTE   0x00000010
#define PAGE_EXECUTE_READ   0x00000020
#define PAGE_EXECUTE_READWRITE   0x00000040
#define PAGE_EXECUTE_WRITECOPY   0x00000080
#define PAGE_GUARD   0x00000100
#define PAGE_NOACCESS   0x00000001
#define PAGE_NOCACHE   0x00000200
#define PAGE_READONLY   0x00000002
#define PAGE_READWRITE   0x00000004
#define PAGE_WRITECOMBINE   0x00000400
#define PAGE_WRITECOPY   0x00000008
#define PWIN32_FIND_DATA   PWIN32_FIND_DATAA
#define RemoveDirectory   RemoveDirectoryA
#define SEC_COMMIT   0x08000000
#define SEC_FILE   0x00800000
#define SEC_IMAGE   0x01000000
#define SEC_LARGE_PAGES   0x80000000
#define SEC_NO_CHANGE   0x00400000
#define SEC_NOCACHE   0x10000000
#define SEC_RESERVE   0x04000000
#define SEC_VLM   0x02000000
#define SEC_WRITECOMBINE   0x40000000
#define SECTION_ALL_ACCESS   0xF001F
#define SECTION_EXTEND_SIZE   0x00010
#define SECTION_MAP_EXECUTE   0x00008
#define SECTION_MAP_EXECUTE_EXPLICIT   0x00020
#define SECTION_MAP_READ   0x00004
#define SECTION_MAP_WRITE   0x00002
#define SECTION_QUERY   0x00001
#define SetFileAttributes   SetFileAttributesA
#define STD_ERROR_HANDLE   (DWORD)-12
#define STD_INPUT_HANDLE   (DWORD)-10
#define STD_OUTPUT_HANDLE   (DWORD)-11
#define TRUNCATE_EXISTING   5
#define WILDCARD_DOS   0x00000100
#define WILDCARD_DOS_DOT   0x00000140
#define WILDCARD_DOS_QM   0x00000120
#define WILDCARD_DOS_STAR   0x00000110
#define WILDCARD_QM   0x00000002
#define WILDCARD_STAR   0x00000001
#define WIN32_FIND_DATA   WIN32_FIND_DATAA

Typedef Documentation

typedef VOID(* LPOVERLAPPED_COMPLETION_ROUTINE) (DWORD dwErrorCode, DWORD dwNumberOfBytesTransfered, LPOVERLAPPED lpOverlapped)
typedef HANDLE(* pcCreateFileA) (LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)
typedef BOOL(* pcIsFileHandled) (LPCSTR lpFileName)

Enumeration Type Documentation

Enumerator
FindExInfoStandard 
FindExInfoMaxInfoLevel 
Enumerator
FindExSearchNameMatch 
FindExSearchLimitToDirectories 
FindExSearchLimitToDevices 
FindExSearchMaxSearchOp 
Enumerator
GetFileExInfoStandard 
GetFileExMaxInfoLevel 

Function Documentation

WINPR_API BOOL CreateDirectoryA ( LPCSTR  lpPathName,
LPSECURITY_ATTRIBUTES  lpSecurityAttributes 
)

Here is the caller graph for this function:

WINPR_API BOOL CreateDirectoryW ( LPCWSTR  lpPathName,
LPSECURITY_ATTRIBUTES  lpSecurityAttributes 
)

Here is the call graph for this function:

Here is the caller graph for this function:

WINPR_API HANDLE CreateFileA ( LPCSTR  lpFileName,
DWORD  dwDesiredAccess,
DWORD  dwShareMode,
LPSECURITY_ATTRIBUTES  lpSecurityAttributes,
DWORD  dwCreationDisposition,
DWORD  dwFlagsAndAttributes,
HANDLE  hTemplateFile 
)

Here is the call graph for this function:

Here is the caller graph for this function:

WINPR_API HANDLE CreateFileW ( LPCWSTR  lpFileName,
DWORD  dwDesiredAccess,
DWORD  dwShareMode,
LPSECURITY_ATTRIBUTES  lpSecurityAttributes,
DWORD  dwCreationDisposition,
DWORD  dwFlagsAndAttributes,
HANDLE  hTemplateFile 
)

Here is the call graph for this function:

Here is the caller graph for this function:

WINPR_API BOOL DeleteFileA ( LPCSTR  lpFileName)

Here is the caller graph for this function:

WINPR_API BOOL DeleteFileW ( LPCWSTR  lpFileName)

Here is the call graph for this function:

Here is the caller graph for this function:

WINPR_API LPSTR FilePatternFindNextWildcardA ( LPCSTR  lpPattern,
DWORD *  pFlags 
)

File System Behavior in the Microsoft Windows Environment: http://download.microsoft.com/download/4/3/8/43889780-8d45-4b2e-9d3a-c696a890309f/File%20System%20Behavior%20Overview.pdf

Here is the caller graph for this function:

WINPR_API BOOL FilePatternMatchA ( LPCSTR  lpFileName,
LPCSTR  lpPattern 
)

Wild Card Matching

'*' matches 0 or more characters '?' matches exactly one character

'~*' DOS_STAR - matches 0 or more characters until encountering and matching final '.'

'~?' DOS_QM - matches any single character, or upon encountering a period or end of name string, advances the expresssion to the end of the set of contiguous DOS_QMs.

'~.' DOS_DOT - matches either a '.' or zero characters beyond name string.

First and foremost the file system starts off name matching with the expression “*”. If the expression contains a single wild card character ‘*’ all matches are satisfied immediately. This is the most common wild card character used in Windows and expression evaluation is optimized by looking for this character first.

Subsequently evaluation of the “*X” expression is performed. This is a case where the expression starts off with a wild card character and contains some non-wild card characters towards the tail end of the name. This is evaluated by making sure the expression starts off with the character ‘*’ and does not contain any wildcards in the latter part of the expression. The tail part of the expression beyond the first character ‘*’ is matched against the file name at the end uppercasing each character if necessary during the comparison.

The remaining expressions are evaluated in a non deterministic finite order as listed below, where:

'S' is any single character 'S-.' is any single character except the final '.' 'e' is a null character transition 'EOF' is the end of the name string

                       S
                    <-----<
                 X  |     |  e       Y

X * Y == (0)--—>-(1)->--—(2)--—(3)

                      S-.
                    <-----<
                 X  |     |  e       Y

X ~* Y == (0)--—>-(1)->--—(2)--—(3)

                X     S     S     Y

X ?? Y == (0)—(1)—(2)—(3)—(4)

                X     S-.     S-.     Y

X ~?~? == (0)—(1)--—(2)--—(3)—(4) | |_______| | ^ | |_______________| ^EOF of .^

Here is the call graph for this function:

Here is the caller graph for this function:

WINPR_API BOOL FindClose ( HANDLE  hFindFile)

Here is the caller graph for this function:

WINPR_API HANDLE FindFirstFileA ( LPCSTR  lpFileName,
LPWIN32_FIND_DATAA  lpFindFileData 
)

Here is the call graph for this function:

Here is the caller graph for this function:

WINPR_API HANDLE FindFirstFileExA ( LPCSTR  lpFileName,
FINDEX_INFO_LEVELS  fInfoLevelId,
LPVOID  lpFindFileData,
FINDEX_SEARCH_OPS  fSearchOp,
LPVOID  lpSearchFilter,
DWORD  dwAdditionalFlags 
)

Here is the caller graph for this function:

WINPR_API HANDLE FindFirstFileExW ( LPCWSTR  lpFileName,
FINDEX_INFO_LEVELS  fInfoLevelId,
LPVOID  lpFindFileData,
FINDEX_SEARCH_OPS  fSearchOp,
LPVOID  lpSearchFilter,
DWORD  dwAdditionalFlags 
)

Here is the caller graph for this function:

WINPR_API HANDLE FindFirstFileW ( LPCWSTR  lpFileName,
LPWIN32_FIND_DATAW  lpFindFileData 
)

Here is the call graph for this function:

Here is the caller graph for this function:

WINPR_API BOOL FindNextFileA ( HANDLE  hFindFile,
LPWIN32_FIND_DATAA  lpFindFileData 
)

Here is the call graph for this function:

Here is the caller graph for this function:

WINPR_API BOOL FindNextFileW ( HANDLE  hFindFile,
LPWIN32_FIND_DATAW  lpFindFileData 
)

Here is the call graph for this function:

Here is the caller graph for this function:

WINPR_API BOOL FlushFileBuffers ( HANDLE  hFile)

Here is the call graph for this function:

WINPR_API BOOL GetDiskFreeSpaceA ( LPCSTR  lpRootPathName,
LPDWORD  lpSectorsPerCluster,
LPDWORD  lpBytesPerSector,
LPDWORD  lpNumberOfFreeClusters,
LPDWORD  lpTotalNumberOfClusters 
)

Here is the caller graph for this function:

WINPR_API BOOL GetDiskFreeSpaceW ( LPCWSTR  lpRootPathName,
LPDWORD  lpSectorsPerCluster,
LPDWORD  lpBytesPerSector,
LPDWORD  lpNumberOfFreeClusters,
LPDWORD  lpTotalNumberOfClusters 
)

Here is the call graph for this function:

Here is the caller graph for this function:

WINPR_API DWORD GetFileAttributesA ( LPCSTR  lpFileName)

Here is the call graph for this function:

Here is the caller graph for this function:

WINPR_API BOOL GetFileAttributesExA ( LPCSTR  lpFileName,
GET_FILEEX_INFO_LEVELS  fInfoLevelId,
LPVOID  lpFileInformation 
)

Here is the call graph for this function:

Here is the caller graph for this function:

WINPR_API BOOL GetFileAttributesExW ( LPCWSTR  lpFileName,
GET_FILEEX_INFO_LEVELS  fInfoLevelId,
LPVOID  lpFileInformation 
)

Here is the call graph for this function:

Here is the caller graph for this function:

WINPR_API DWORD GetFileAttributesW ( LPCWSTR  lpFileName)

Here is the call graph for this function:

Here is the caller graph for this function:

WINPR_API HANDLE GetFileHandleForFileDescriptor ( int  fd)

Here is the call graph for this function:

WINPR_API DWORD WINAPI GetFileSize ( HANDLE  hFile,
LPDWORD  lpFileSizeHigh 
)

Here is the call graph for this function:

Here is the caller graph for this function:

WINPR_API char* GetNamedPipeNameWithoutPrefixA ( LPCSTR  lpName)

Here is the call graph for this function:

Here is the caller graph for this function:

WINPR_API char* GetNamedPipeUnixDomainSocketBaseFilePathA ( void  )

Here is the call graph for this function:

Here is the caller graph for this function:

WINPR_API char* GetNamedPipeUnixDomainSocketFilePathA ( LPCSTR  lpName)

Here is the call graph for this function:

Here is the caller graph for this function:

WINPR_API int GetNamePipeFileDescriptor ( HANDLE  hNamedPipe)

Here is the call graph for this function:

WINPR_API HANDLE GetStdHandle ( DWORD  nStdHandle)

Here is the call graph for this function:

Here is the caller graph for this function:

WINPR_API BOOL IsNamedPipeFileNameA ( LPCSTR  lpName)

Here is the caller graph for this function:

WINPR_API BOOL LockFile ( HANDLE  hFile,
DWORD  dwFileOffsetLow,
DWORD  dwFileOffsetHigh,
DWORD  nNumberOfBytesToLockLow,
DWORD  nNumberOfBytesToLockHigh 
)

Here is the call graph for this function:

WINPR_API BOOL LockFileEx ( HANDLE  hFile,
DWORD  dwFlags,
DWORD  dwReserved,
DWORD  nNumberOfBytesToLockLow,
DWORD  nNumberOfBytesToLockHigh,
LPOVERLAPPED  lpOverlapped 
)

Here is the call graph for this function:

WINPR_API BOOL MoveFileA ( LPCSTR  lpExistingFileName,
LPCSTR  lpNewFileName 
)

Here is the call graph for this function:

WINPR_API BOOL MoveFileExA ( LPCSTR  lpExistingFileName,
LPCSTR  lpNewFileName,
DWORD  dwFlags 
)

Here is the call graph for this function:

Here is the caller graph for this function:

WINPR_API BOOL MoveFileExW ( LPCWSTR  lpExistingFileName,
LPCWSTR  lpNewFileName,
DWORD  dwFlags 
)

Here is the call graph for this function:

Here is the caller graph for this function:

WINPR_API BOOL MoveFileW ( LPCWSTR  lpExistingFileName,
LPCWSTR  lpNewFileName 
)

Here is the call graph for this function:

WINPR_API BOOL ReadFile ( HANDLE  hFile,
LPVOID  lpBuffer,
DWORD  nNumberOfBytesToRead,
LPDWORD  lpNumberOfBytesRead,
LPOVERLAPPED  lpOverlapped 
)

Here is the call graph for this function:

Here is the caller graph for this function:

WINPR_API BOOL ReadFileEx ( HANDLE  hFile,
LPVOID  lpBuffer,
DWORD  nNumberOfBytesToRead,
LPOVERLAPPED  lpOverlapped,
LPOVERLAPPED_COMPLETION_ROUTINE  lpCompletionRoutine 
)

Here is the call graph for this function:

WINPR_API BOOL ReadFileScatter ( HANDLE  hFile,
FILE_SEGMENT_ELEMENT  aSegmentArray[],
DWORD  nNumberOfBytesToRead,
LPDWORD  lpReserved,
LPOVERLAPPED  lpOverlapped 
)

Here is the call graph for this function:

WINPR_API BOOL RemoveDirectoryA ( LPCSTR  lpPathName)

Here is the call graph for this function:

Here is the caller graph for this function:

WINPR_API BOOL RemoveDirectoryW ( LPCWSTR  lpPathName)

Here is the call graph for this function:

Here is the caller graph for this function:

WINPR_API BOOL SetEndOfFile ( HANDLE  hFile)

Here is the call graph for this function:

Here is the caller graph for this function:

WINPR_API BOOL SetFileAttributesA ( LPCSTR  lpFileName,
DWORD  dwFileAttributes 
)

Here is the caller graph for this function:

WINPR_API BOOL SetFileAttributesW ( LPCWSTR  lpFileName,
DWORD  dwFileAttributes 
)

Here is the call graph for this function:

Here is the caller graph for this function:

WINPR_API DWORD SetFilePointer ( HANDLE  hFile,
LONG  lDistanceToMove,
PLONG  lpDistanceToMoveHigh,
DWORD  dwMoveMethod 
)

Here is the call graph for this function:

Here is the caller graph for this function:

WINPR_API BOOL SetFilePointerEx ( HANDLE  hFile,
LARGE_INTEGER  liDistanceToMove,
PLARGE_INTEGER  lpNewFilePointer,
DWORD  dwMoveMethod 
)

Here is the call graph for this function:

Here is the caller graph for this function:

WINPR_API BOOL SetFileTime ( HANDLE  hFile,
const FILETIME *  lpCreationTime,
const FILETIME *  lpLastAccessTime,
const FILETIME *  lpLastWriteTime 
)

Here is the call graph for this function:

Here is the caller graph for this function:

WINPR_API BOOL SetStdHandle ( DWORD  nStdHandle,
HANDLE  hHandle 
)
WINPR_API BOOL SetStdHandleEx ( DWORD  dwStdHandle,
HANDLE  hNewHandle,
HANDLE *  phOldHandle 
)
WINPR_API int UnixChangeFileMode ( const char *  filename,
int  flags 
)

Here is the call graph for this function:

Here is the caller graph for this function:

WINPR_API BOOL UnlockFile ( HANDLE  hFile,
DWORD  dwFileOffsetLow,
DWORD  dwFileOffsetHigh,
DWORD  nNumberOfBytesToUnlockLow,
DWORD  nNumberOfBytesToUnlockHigh 
)

Here is the call graph for this function:

WINPR_API BOOL UnlockFileEx ( HANDLE  hFile,
DWORD  dwReserved,
DWORD  nNumberOfBytesToUnlockLow,
DWORD  nNumberOfBytesToUnlockHigh,
LPOVERLAPPED  lpOverlapped 
)

Here is the call graph for this function:

WINPR_API BOOL ValidFileNameComponent ( LPCWSTR  lpFileName)

Check if a file name component is valid.

Some file names are not valid on Windows. See "Naming Files, Paths, and Namespaces": https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx

Here is the call graph for this function:

Here is the caller graph for this function:

WINPR_API BOOL WriteFile ( HANDLE  hFile,
LPCVOID  lpBuffer,
DWORD  nNumberOfBytesToWrite,
LPDWORD  lpNumberOfBytesWritten,
LPOVERLAPPED  lpOverlapped 
)

Here is the call graph for this function:

Here is the caller graph for this function:

WINPR_API BOOL WriteFileEx ( HANDLE  hFile,
LPCVOID  lpBuffer,
DWORD  nNumberOfBytesToWrite,
LPOVERLAPPED  lpOverlapped,
LPOVERLAPPED_COMPLETION_ROUTINE  lpCompletionRoutine 
)

Here is the call graph for this function:

WINPR_API BOOL WriteFileGather ( HANDLE  hFile,
FILE_SEGMENT_ELEMENT  aSegmentArray[],
DWORD  nNumberOfBytesToWrite,
LPDWORD  lpReserved,
LPOVERLAPPED  lpOverlapped 
)

Here is the call graph for this function: