System.Win32.File

Win32-2.14.0.0: A binding to Windows Win32 API.

Copyright | (c) Alastair Reid 1997-2003
License | BSD-style (see the file libraries/base/LICENSE)
Maintainer | Esa Ilari Vuokko <ei@vuokko.info>
Stability | provisional
Portability | portable
Safe Haskell | Safe
Language | Haskell2010

System.Win32.File

Contents

- Access modes
- Sharing modes
- Creation modes
- File attributes and flags
- Move file flags
- File pointer directions
- Drive types
- Define DOS device flags
- Binary types
- File notification flags
- File types
- Lock modes
- GetFileEx information levels
- Security attributes
- BY_HANDLE file information
- Win32 file attribute data
- Helpers
- File operations
- HANDLE operations
  - Reading/writing
- File notifications
- Directories
- DOS device flags
- File locks

Description

A collection of FFI declarations for interfacing with Win32.

Synopsis

- type AccessMode = UINT
- gENERIC_NONE :: AccessMode
- gENERIC_READ :: AccessMode
- gENERIC_WRITE :: AccessMode
- gENERIC_EXECUTE :: AccessMode
- gENERIC_ALL :: AccessMode
- dELETE :: AccessMode
- rEAD_CONTROL :: AccessMode
- wRITE_DAC :: AccessMode
- wRITE_OWNER :: AccessMode
- sYNCHRONIZE :: AccessMode
- sTANDARD_RIGHTS_REQUIRED :: AccessMode
- sTANDARD_RIGHTS_READ :: AccessMode
- sTANDARD_RIGHTS_WRITE :: AccessMode
- sTANDARD_RIGHTS_EXECUTE :: AccessMode
- sTANDARD_RIGHTS_ALL :: AccessMode
- sPECIFIC_RIGHTS_ALL :: AccessMode
- aCCESS_SYSTEM_SECURITY :: AccessMode
- mAXIMUM_ALLOWED :: AccessMode
- fILE_ADD_FILE :: AccessMode
- fILE_ADD_SUBDIRECTORY :: AccessMode
- fILE_ALL_ACCESS :: AccessMode
- fILE_APPEND_DATA :: AccessMode
- fILE_CREATE_PIPE_INSTANCE :: AccessMode
- fILE_DELETE_CHILD :: AccessMode
- fILE_EXECUTE :: AccessMode
- fILE_LIST_DIRECTORY :: AccessMode
- fILE_READ_ATTRIBUTES :: AccessMode
- fILE_READ_DATA :: AccessMode
- fILE_READ_EA :: AccessMode
- fILE_TRAVERSE :: AccessMode
- fILE_WRITE_ATTRIBUTES :: AccessMode
- fILE_WRITE_DATA :: AccessMode
- fILE_WRITE_EA :: AccessMode
- type ShareMode = UINT
- fILE_SHARE_NONE :: ShareMode
- fILE_SHARE_READ :: ShareMode
- fILE_SHARE_WRITE :: ShareMode
- fILE_SHARE_DELETE :: ShareMode
- type CreateMode = UINT
- cREATE_NEW :: CreateMode
- cREATE_ALWAYS :: CreateMode
- oPEN_EXISTING :: CreateMode
- oPEN_ALWAYS :: CreateMode
- tRUNCATE_EXISTING :: CreateMode
- type FileAttributeOrFlag = UINT
- fILE_ATTRIBUTE_READONLY :: FileAttributeOrFlag
- fILE_ATTRIBUTE_HIDDEN :: FileAttributeOrFlag
- fILE_ATTRIBUTE_SYSTEM :: FileAttributeOrFlag
- fILE_ATTRIBUTE_DIRECTORY :: FileAttributeOrFlag
- fILE_ATTRIBUTE_ARCHIVE :: FileAttributeOrFlag
- fILE_ATTRIBUTE_NORMAL :: FileAttributeOrFlag
- fILE_ATTRIBUTE_TEMPORARY :: FileAttributeOrFlag
- fILE_ATTRIBUTE_COMPRESSED :: FileAttributeOrFlag
- fILE_ATTRIBUTE_REPARSE_POINT :: FileAttributeOrFlag
- fILE_FLAG_WRITE_THROUGH :: FileAttributeOrFlag
- fILE_FLAG_OVERLAPPED :: FileAttributeOrFlag
- fILE_FLAG_NO_BUFFERING :: FileAttributeOrFlag
- fILE_FLAG_RANDOM_ACCESS :: FileAttributeOrFlag
- fILE_FLAG_SEQUENTIAL_SCAN :: FileAttributeOrFlag
- fILE_FLAG_DELETE_ON_CLOSE :: FileAttributeOrFlag
- fILE_FLAG_BACKUP_SEMANTICS :: FileAttributeOrFlag
- fILE_FLAG_POSIX_SEMANTICS :: FileAttributeOrFlag
- sECURITY_ANONYMOUS :: FileAttributeOrFlag
- sECURITY_IDENTIFICATION :: FileAttributeOrFlag
- sECURITY_IMPERSONATION :: FileAttributeOrFlag
- sECURITY_DELEGATION :: FileAttributeOrFlag
- sECURITY_CONTEXT_TRACKING :: FileAttributeOrFlag
- sECURITY_EFFECTIVE_ONLY :: FileAttributeOrFlag
- sECURITY_SQOS_PRESENT :: FileAttributeOrFlag
- sECURITY_VALID_SQOS_FLAGS :: FileAttributeOrFlag
- type MoveFileFlag = DWORD
- mOVEFILE_REPLACE_EXISTING :: MoveFileFlag
- mOVEFILE_COPY_ALLOWED :: MoveFileFlag
- mOVEFILE_DELAY_UNTIL_REBOOT :: MoveFileFlag
- type FilePtrDirection = DWORD
- fILE_BEGIN :: FilePtrDirection
- fILE_CURRENT :: FilePtrDirection
- fILE_END :: FilePtrDirection
- type DriveType = UINT
- dRIVE_UNKNOWN :: DriveType
- dRIVE_NO_ROOT_DIR :: DriveType
- dRIVE_REMOVABLE :: DriveType
- dRIVE_FIXED :: DriveType
- dRIVE_REMOTE :: DriveType
- dRIVE_CDROM :: DriveType
- dRIVE_RAMDISK :: DriveType
- type DefineDosDeviceFlags = DWORD
- dDD_RAW_TARGET_PATH :: DefineDosDeviceFlags
- dDD_REMOVE_DEFINITION :: DefineDosDeviceFlags
- dDD_EXACT_MATCH_ON_REMOVE :: DefineDosDeviceFlags
- type BinaryType = DWORD
- sCS_32BIT_BINARY :: BinaryType
- sCS_DOS_BINARY :: BinaryType
- sCS_WOW_BINARY :: BinaryType
- sCS_PIF_BINARY :: BinaryType
- sCS_POSIX_BINARY :: BinaryType
- sCS_OS216_BINARY :: BinaryType
- type FileNotificationFlag = DWORD
- fILE_NOTIFY_CHANGE_FILE_NAME :: FileNotificationFlag
- fILE_NOTIFY_CHANGE_DIR_NAME :: FileNotificationFlag
- fILE_NOTIFY_CHANGE_ATTRIBUTES :: FileNotificationFlag
- fILE_NOTIFY_CHANGE_SIZE :: FileNotificationFlag
- fILE_NOTIFY_CHANGE_LAST_WRITE :: FileNotificationFlag
- fILE_NOTIFY_CHANGE_SECURITY :: FileNotificationFlag
- type FileType = DWORD
- fILE_TYPE_UNKNOWN :: FileType
- fILE_TYPE_DISK :: FileType
- fILE_TYPE_CHAR :: FileType
- fILE_TYPE_PIPE :: FileType
- fILE_TYPE_REMOTE :: FileType
- type LockMode = DWORD
- lOCKFILE_EXCLUSIVE_LOCK :: LockMode
- lOCKFILE_FAIL_IMMEDIATELY :: LockMode
- data GET_FILEEX_INFO_LEVELS
- getFileExInfoStandard :: GET_FILEEX_INFO_LEVELS
- getFileExMaxInfoLevel :: GET_FILEEX_INFO_LEVELS
- data SECURITY_ATTRIBUTES = SECURITY_ATTRIBUTES {
  - nLength :: !DWORD
  - lpSecurityDescriptor :: !LPVOID
  - bInheritHandle :: !BOOL
  }
- type PSECURITY_ATTRIBUTES = Ptr SECURITY_ATTRIBUTES
- type LPSECURITY_ATTRIBUTES = Ptr SECURITY_ATTRIBUTES
- type MbLPSECURITY_ATTRIBUTES = Maybe LPSECURITY_ATTRIBUTES
- data BY_HANDLE_FILE_INFORMATION = BY_HANDLE_FILE_INFORMATION {
  - bhfiFileAttributes :: FileAttributeOrFlag
  - bhfiCreationTime :: FILETIME
  - bhfiLastAccessTime :: FILETIME
  - bhfiLastWriteTime :: FILETIME
  - bhfiVolumeSerialNumber :: DWORD
  - bhfiSize :: DDWORD
  - bhfiNumberOfLinks :: DWORD
  - bhfiFileIndex :: DDWORD
  }
- data WIN32_FILE_ATTRIBUTE_DATA = WIN32_FILE_ATTRIBUTE_DATA {
  - fadFileAttributes :: DWORD
  - fadCreationTime :: FILETIME
  - fadLastAccessTime :: FILETIME
  - fadLastWriteTime :: FILETIME
  - fadFileSize :: DDWORD
  }
- failIfWithRetry :: (a -> Bool) -> String -> IO a -> IO a
- failIfWithRetry_ :: (a -> Bool) -> String -> IO a -> IO ()
- failIfFalseWithRetry_ :: String -> IO Bool -> IO ()
- deleteFile :: String -> IO ()
- copyFile :: String -> String -> Bool -> IO ()
- moveFile :: String -> String -> IO ()
- moveFileEx :: String -> Maybe String -> MoveFileFlag -> IO ()
- setCurrentDirectory :: String -> IO ()
- createDirectory :: String -> Maybe LPSECURITY_ATTRIBUTES -> IO ()
- createDirectoryEx :: String -> String -> Maybe LPSECURITY_ATTRIBUTES -> IO ()
- removeDirectory :: String -> IO ()
- getBinaryType :: String -> IO BinaryType
- createFile :: String -> AccessMode -> ShareMode -> Maybe LPSECURITY_ATTRIBUTES -> CreateMode -> FileAttributeOrFlag -> Maybe HANDLE -> IO HANDLE
- createFile_NoRetry :: String -> AccessMode -> ShareMode -> Maybe LPSECURITY_ATTRIBUTES -> CreateMode -> FileAttributeOrFlag -> Maybe HANDLE -> IO HANDLE
- closeHandle :: HANDLE -> IO ()
- getFileType :: HANDLE -> IO FileType
- flushFileBuffers :: HANDLE -> IO ()
- setEndOfFile :: HANDLE -> IO ()
- setFileAttributes :: String -> FileAttributeOrFlag -> IO ()
- getFileAttributes :: String -> IO FileAttributeOrFlag
- getFileAttributesExStandard :: String -> IO WIN32_FILE_ATTRIBUTE_DATA
- getFileInformationByHandle :: HANDLE -> IO BY_HANDLE_FILE_INFORMATION
- data OVERLAPPED = OVERLAPPED {
  - ovl_internal :: ULONG_PTR
  - ovl_internalHigh :: ULONG_PTR
  - ovl_offset :: DWORD
  - ovl_offsetHigh :: DWORD
  - ovl_hEvent :: HANDLE
  }
- type LPOVERLAPPED = Ptr OVERLAPPED
- type MbLPOVERLAPPED = Maybe LPOVERLAPPED
- win32_ReadFile :: HANDLE -> Ptr a -> DWORD -> Maybe LPOVERLAPPED -> IO DWORD
- win32_WriteFile :: HANDLE -> Ptr a -> DWORD -> Maybe LPOVERLAPPED -> IO DWORD
- setFilePointerEx :: HANDLE -> LARGE_INTEGER -> FilePtrDirection -> IO LARGE_INTEGER
- findFirstChangeNotification :: String -> Bool -> FileNotificationFlag -> IO HANDLE
- findNextChangeNotification :: HANDLE -> IO ()
- findCloseChangeNotification :: HANDLE -> IO ()
- data FindData
- getFindDataFileName :: FindData -> IO FilePath
- findFirstFile :: String -> IO (HANDLE, FindData)
- findNextFile :: HANDLE -> FindData -> IO Bool
- findClose :: HANDLE -> IO ()
- defineDosDevice :: DefineDosDeviceFlags -> String -> Maybe String -> IO ()
- areFileApisANSI :: IO Bool
- setFileApisToOEM :: IO ()
- setFileApisToANSI :: IO ()
- setHandleCount :: UINT -> IO UINT
- getLogicalDrives :: IO DWORD
- getDiskFreeSpace :: Maybe String -> IO (DWORD, DWORD, DWORD, DWORD)
- setVolumeLabel :: Maybe String -> Maybe String -> IO ()
- lockFile :: HANDLE -> LockMode -> DWORD64 -> DWORD64 -> IO BOOL
- unlockFile :: HANDLE -> DWORD64 -> DWORD64 -> IO BOOL

# Access modes

type AccessMode = UINT Source #

gENERIC_NONE :: AccessMode Source #

gENERIC_READ :: AccessMode Source #

gENERIC_WRITE :: AccessMode Source #

gENERIC_EXECUTE :: AccessMode Source #

gENERIC_ALL :: AccessMode Source #

dELETE :: AccessMode Source #

rEAD_CONTROL :: AccessMode Source #

wRITE_DAC :: AccessMode Source #

wRITE_OWNER :: AccessMode Source #

sYNCHRONIZE :: AccessMode Source #

sTANDARD_RIGHTS_REQUIRED :: AccessMode Source #

sTANDARD_RIGHTS_READ :: AccessMode Source #

sTANDARD_RIGHTS_WRITE :: AccessMode Source #

sTANDARD_RIGHTS_EXECUTE :: AccessMode Source #

sTANDARD_RIGHTS_ALL :: AccessMode Source #

sPECIFIC_RIGHTS_ALL :: AccessMode Source #

aCCESS_SYSTEM_SECURITY :: AccessMode Source #

mAXIMUM_ALLOWED :: AccessMode Source #

fILE_ADD_FILE :: AccessMode Source #

fILE_ADD_SUBDIRECTORY :: AccessMode Source #

fILE_ALL_ACCESS :: AccessMode Source #

fILE_APPEND_DATA :: AccessMode Source #

fILE_CREATE_PIPE_INSTANCE :: AccessMode Source #

fILE_DELETE_CHILD :: AccessMode Source #

fILE_EXECUTE :: AccessMode Source #

fILE_LIST_DIRECTORY :: AccessMode Source #

fILE_READ_ATTRIBUTES :: AccessMode Source #

fILE_READ_DATA :: AccessMode Source #

fILE_READ_EA :: AccessMode Source #

fILE_TRAVERSE :: AccessMode Source #

fILE_WRITE_ATTRIBUTES :: AccessMode Source #

fILE_WRITE_DATA :: AccessMode Source #

fILE_WRITE_EA :: AccessMode Source #

# Sharing modes

type ShareMode = UINT Source #

fILE_SHARE_NONE :: ShareMode Source #

fILE_SHARE_READ :: ShareMode Source #

fILE_SHARE_WRITE :: ShareMode Source #

fILE_SHARE_DELETE :: ShareMode Source #

# Creation modes

type CreateMode = UINT Source #

cREATE_NEW :: CreateMode Source #

cREATE_ALWAYS :: CreateMode Source #

oPEN_EXISTING :: CreateMode Source #

oPEN_ALWAYS :: CreateMode Source #

tRUNCATE_EXISTING :: CreateMode Source #

# File attributes and flags

type FileAttributeOrFlag = UINT Source #

fILE_ATTRIBUTE_READONLY :: FileAttributeOrFlag Source #

fILE_ATTRIBUTE_HIDDEN :: FileAttributeOrFlag Source #

fILE_ATTRIBUTE_SYSTEM :: FileAttributeOrFlag Source #

fILE_ATTRIBUTE_DIRECTORY :: FileAttributeOrFlag Source #

fILE_ATTRIBUTE_ARCHIVE :: FileAttributeOrFlag Source #

fILE_ATTRIBUTE_NORMAL :: FileAttributeOrFlag Source #

fILE_ATTRIBUTE_TEMPORARY :: FileAttributeOrFlag Source #

fILE_ATTRIBUTE_COMPRESSED :: FileAttributeOrFlag Source #

fILE_ATTRIBUTE_REPARSE_POINT :: FileAttributeOrFlag Source #

fILE_FLAG_WRITE_THROUGH :: FileAttributeOrFlag Source #

fILE_FLAG_OVERLAPPED :: FileAttributeOrFlag Source #

fILE_FLAG_NO_BUFFERING :: FileAttributeOrFlag Source #

fILE_FLAG_RANDOM_ACCESS :: FileAttributeOrFlag Source #

fILE_FLAG_SEQUENTIAL_SCAN :: FileAttributeOrFlag Source #

fILE_FLAG_DELETE_ON_CLOSE :: FileAttributeOrFlag Source #

fILE_FLAG_BACKUP_SEMANTICS :: FileAttributeOrFlag Source #

fILE_FLAG_POSIX_SEMANTICS :: FileAttributeOrFlag Source #

sECURITY_ANONYMOUS :: FileAttributeOrFlag Source #

sECURITY_IDENTIFICATION :: FileAttributeOrFlag Source #

sECURITY_IMPERSONATION :: FileAttributeOrFlag Source #

sECURITY_DELEGATION :: FileAttributeOrFlag Source #

sECURITY_CONTEXT_TRACKING :: FileAttributeOrFlag Source #

sECURITY_EFFECTIVE_ONLY :: FileAttributeOrFlag Source #

sECURITY_SQOS_PRESENT :: FileAttributeOrFlag Source #

sECURITY_VALID_SQOS_FLAGS :: FileAttributeOrFlag Source #

# Move file flags

type MoveFileFlag = DWORD Source #

mOVEFILE_REPLACE_EXISTING :: MoveFileFlag Source #

mOVEFILE_COPY_ALLOWED :: MoveFileFlag Source #

mOVEFILE_DELAY_UNTIL_REBOOT :: MoveFileFlag Source #

# File pointer directions

type FilePtrDirection = DWORD Source #

fILE_BEGIN :: FilePtrDirection Source #

fILE_CURRENT :: FilePtrDirection Source #

fILE_END :: FilePtrDirection Source #

# Drive types

type DriveType = UINT Source #

dRIVE_UNKNOWN :: DriveType Source #

dRIVE_NO_ROOT_DIR :: DriveType Source #

dRIVE_REMOVABLE :: DriveType Source #

dRIVE_FIXED :: DriveType Source #

dRIVE_REMOTE :: DriveType Source #

dRIVE_CDROM :: DriveType Source #

dRIVE_RAMDISK :: DriveType Source #

# Define DOS device flags

type DefineDosDeviceFlags = DWORD Source #

dDD_RAW_TARGET_PATH :: DefineDosDeviceFlags Source #

dDD_REMOVE_DEFINITION :: DefineDosDeviceFlags Source #

dDD_EXACT_MATCH_ON_REMOVE :: DefineDosDeviceFlags Source #

# Binary types

type BinaryType = DWORD Source #

sCS_32BIT_BINARY :: BinaryType Source #

sCS_DOS_BINARY :: BinaryType Source #

sCS_WOW_BINARY :: BinaryType Source #

sCS_PIF_BINARY :: BinaryType Source #

sCS_POSIX_BINARY :: BinaryType Source #

sCS_OS216_BINARY :: BinaryType Source #

# File notification flags

type FileNotificationFlag = DWORD Source #

fILE_NOTIFY_CHANGE_FILE_NAME :: FileNotificationFlag Source #

fILE_NOTIFY_CHANGE_DIR_NAME :: FileNotificationFlag Source #

fILE_NOTIFY_CHANGE_ATTRIBUTES :: FileNotificationFlag Source #

fILE_NOTIFY_CHANGE_SIZE :: FileNotificationFlag Source #

fILE_NOTIFY_CHANGE_LAST_WRITE :: FileNotificationFlag Source #

fILE_NOTIFY_CHANGE_SECURITY :: FileNotificationFlag Source #

# File types

type FileType = DWORD Source #

fILE_TYPE_UNKNOWN :: FileType Source #

fILE_TYPE_DISK :: FileType Source #

fILE_TYPE_CHAR :: FileType Source #

fILE_TYPE_PIPE :: FileType Source #

fILE_TYPE_REMOTE :: FileType Source #

# Lock modes

type LockMode = DWORD Source #

lOCKFILE_EXCLUSIVE_LOCK :: LockMode Source #

lOCKFILE_FAIL_IMMEDIATELY :: LockMode Source #

# GetFileEx information levels

data GET_FILEEX_INFO_LEVELS Source #

#### Instances

Instances details

Eq GET_FILEEX_INFO_LEVELS Source # |
Instance details Defined in System.Win32.File.Internal Methods (==) :: GET_FILEEX_INFO_LEVELS -> GET_FILEEX_INFO_LEVELS -> Bool # (/=) :: GET_FILEEX_INFO_LEVELS -> GET_FILEEX_INFO_LEVELS -> Bool #
Ord GET_FILEEX_INFO_LEVELS Source # |
Instance details Defined in System.Win32.File.Internal Methods compare :: GET_FILEEX_INFO_LEVELS -> GET_FILEEX_INFO_LEVELS -> Ordering # (<) :: GET_FILEEX_INFO_LEVELS -> GET_FILEEX_INFO_LEVELS -> Bool # (<=) :: GET_FILEEX_INFO_LEVELS -> GET_FILEEX_INFO_LEVELS -> Bool # (>) :: GET_FILEEX_INFO_LEVELS -> GET_FILEEX_INFO_LEVELS -> Bool # (>=) :: GET_FILEEX_INFO_LEVELS -> GET_FILEEX_INFO_LEVELS -> Bool # max :: GET_FILEEX_INFO_LEVELS -> GET_FILEEX_INFO_LEVELS -> GET_FILEEX_INFO_LEVELS # min :: GET_FILEEX_INFO_LEVELS -> GET_FILEEX_INFO_LEVELS -> GET_FILEEX_INFO_LEVELS #

getFileExInfoStandard :: GET_FILEEX_INFO_LEVELS Source #

getFileExMaxInfoLevel :: GET_FILEEX_INFO_LEVELS Source #

# Security attributes

data SECURITY_ATTRIBUTES Source #

Constructors

SECURITY_ATTRIBUTES |
Fields nLength :: !DWORD lpSecurityDescriptor :: !LPVOID bInheritHandle :: !BOOL

#### Instances

Instances details

Storable SECURITY_ATTRIBUTES Source # |
Instance details Defined in System.Win32.File.Internal Methods sizeOf :: SECURITY_ATTRIBUTES -> Int # alignment :: SECURITY_ATTRIBUTES -> Int # peekElemOff :: Ptr SECURITY_ATTRIBUTES -> Int -> IO SECURITY_ATTRIBUTES # pokeElemOff :: Ptr SECURITY_ATTRIBUTES -> Int -> SECURITY_ATTRIBUTES -> IO () # peekByteOff :: Ptr b -> Int -> IO SECURITY_ATTRIBUTES # pokeByteOff :: Ptr b -> Int -> SECURITY_ATTRIBUTES -> IO () # peek :: Ptr SECURITY_ATTRIBUTES -> IO SECURITY_ATTRIBUTES # poke :: Ptr SECURITY_ATTRIBUTES -> SECURITY_ATTRIBUTES -> IO () #
Show SECURITY_ATTRIBUTES Source # |
Instance details Defined in System.Win32.File.Internal Methods showsPrec :: Int -> SECURITY_ATTRIBUTES -> ShowS # show :: SECURITY_ATTRIBUTES -> String # showList :: [SECURITY_ATTRIBUTES] -> ShowS #

type PSECURITY_ATTRIBUTES = Ptr SECURITY_ATTRIBUTES Source #

type LPSECURITY_ATTRIBUTES = Ptr SECURITY_ATTRIBUTES Source #

type MbLPSECURITY_ATTRIBUTES = Maybe LPSECURITY_ATTRIBUTES Source #

# BY_HANDLE file information

data BY_HANDLE_FILE_INFORMATION Source #

Constructors

BY_HANDLE_FILE_INFORMATION |
Fields bhfiFileAttributes :: FileAttributeOrFlag bhfiCreationTime :: FILETIME bhfiLastAccessTime :: FILETIME bhfiLastWriteTime :: FILETIME bhfiVolumeSerialNumber :: DWORD bhfiSize :: DDWORD bhfiNumberOfLinks :: DWORD bhfiFileIndex :: DDWORD

#### Instances

Instances details

Storable BY_HANDLE_FILE_INFORMATION Source # |
Instance details Defined in System.Win32.File.Internal Methods sizeOf :: BY_HANDLE_FILE_INFORMATION -> Int # alignment :: BY_HANDLE_FILE_INFORMATION -> Int # peekElemOff :: Ptr BY_HANDLE_FILE_INFORMATION -> Int -> IO BY_HANDLE_FILE_INFORMATION # pokeElemOff :: Ptr BY_HANDLE_FILE_INFORMATION -> Int -> BY_HANDLE_FILE_INFORMATION -> IO () # peekByteOff :: Ptr b -> Int -> IO BY_HANDLE_FILE_INFORMATION # pokeByteOff :: Ptr b -> Int -> BY_HANDLE_FILE_INFORMATION -> IO () # peek :: Ptr BY_HANDLE_FILE_INFORMATION -> IO BY_HANDLE_FILE_INFORMATION # poke :: Ptr BY_HANDLE_FILE_INFORMATION -> BY_HANDLE_FILE_INFORMATION -> IO () #
Show BY_HANDLE_FILE_INFORMATION Source # |
Instance details Defined in System.Win32.File.Internal Methods showsPrec :: Int -> BY_HANDLE_FILE_INFORMATION -> ShowS # show :: BY_HANDLE_FILE_INFORMATION -> String # showList :: [BY_HANDLE_FILE_INFORMATION] -> ShowS #

# Win32 file attribute data

data WIN32_FILE_ATTRIBUTE_DATA Source #

Constructors

WIN32_FILE_ATTRIBUTE_DATA |
Fields fadFileAttributes :: DWORD fadCreationTime :: FILETIME fadLastAccessTime :: FILETIME fadLastWriteTime :: FILETIME fadFileSize :: DDWORD

#### Instances

Instances details

Storable WIN32_FILE_ATTRIBUTE_DATA Source # |
Instance details Defined in System.Win32.File.Internal Methods sizeOf :: WIN32_FILE_ATTRIBUTE_DATA -> Int # alignment :: WIN32_FILE_ATTRIBUTE_DATA -> Int # peekElemOff :: Ptr WIN32_FILE_ATTRIBUTE_DATA -> Int -> IO WIN32_FILE_ATTRIBUTE_DATA # pokeElemOff :: Ptr WIN32_FILE_ATTRIBUTE_DATA -> Int -> WIN32_FILE_ATTRIBUTE_DATA -> IO () # peekByteOff :: Ptr b -> Int -> IO WIN32_FILE_ATTRIBUTE_DATA # pokeByteOff :: Ptr b -> Int -> WIN32_FILE_ATTRIBUTE_DATA -> IO () # peek :: Ptr WIN32_FILE_ATTRIBUTE_DATA -> IO WIN32_FILE_ATTRIBUTE_DATA # poke :: Ptr WIN32_FILE_ATTRIBUTE_DATA -> WIN32_FILE_ATTRIBUTE_DATA -> IO () #
Show WIN32_FILE_ATTRIBUTE_DATA Source # |
Instance details Defined in System.Win32.File.Internal Methods showsPrec :: Int -> WIN32_FILE_ATTRIBUTE_DATA -> ShowS # show :: WIN32_FILE_ATTRIBUTE_DATA -> String # showList :: [WIN32_FILE_ATTRIBUTE_DATA] -> ShowS #

# Helpers

failIfWithRetry :: (a -> Bool) -> String -> IO a -> IO a Source #

like failIf, but retried on sharing violations. This is necessary for many file operations; see https://www.betaarchive.com/wiki/index.php/Microsoft_KB_Archive/316609

failIfWithRetry_ :: (a -> Bool) -> String -> IO a -> IO () Source #

failIfFalseWithRetry_ :: String -> IO Bool -> IO () Source #

# File operations

deleteFile :: String -> IO () Source #

copyFile :: String -> String -> Bool -> IO () Source #

moveFile :: String -> String -> IO () Source #

moveFileEx :: String -> Maybe String -> MoveFileFlag -> IO () Source #

setCurrentDirectory :: String -> IO () Source #

createDirectory :: String -> Maybe LPSECURITY_ATTRIBUTES -> IO () Source #

createDirectoryEx :: String -> String -> Maybe LPSECURITY_ATTRIBUTES -> IO () Source #

removeDirectory :: String -> IO () Source #

getBinaryType :: String -> IO BinaryType Source #

# HANDLE operations

createFile :: String -> AccessMode -> ShareMode -> Maybe LPSECURITY_ATTRIBUTES -> CreateMode -> FileAttributeOrFlag -> Maybe HANDLE -> IO HANDLE Source #

createFile_NoRetry :: String -> AccessMode -> ShareMode -> Maybe LPSECURITY_ATTRIBUTES -> CreateMode -> FileAttributeOrFlag -> Maybe HANDLE -> IO HANDLE Source #

Like createFile, but does not use failIfWithRetry. If another process has the same file open, this will fail.

closeHandle :: HANDLE -> IO () Source #

getFileType :: HANDLE -> IO FileType Source #

flushFileBuffers :: HANDLE -> IO () Source #

setEndOfFile :: HANDLE -> IO () Source #

setFileAttributes :: String -> FileAttributeOrFlag -> IO () Source #

getFileAttributes :: String -> IO FileAttributeOrFlag Source #

getFileAttributesExStandard :: String -> IO WIN32_FILE_ATTRIBUTE_DATA Source #

getFileInformationByHandle :: HANDLE -> IO BY_HANDLE_FILE_INFORMATION Source #

## Reading/writing

Some operations below bear the `win32_` prefix to avoid shadowing operations from Prelude.

data OVERLAPPED Source #

Constructors

OVERLAPPED |
Fields ovl_internal :: ULONG_PTR ovl_internalHigh :: ULONG_PTR ovl_offset :: DWORD ovl_offsetHigh :: DWORD ovl_hEvent :: HANDLE

#### Instances

Instances details

Storable OVERLAPPED Source # |
Instance details Defined in System.Win32.File.Internal Methods sizeOf :: OVERLAPPED -> Int # alignment :: OVERLAPPED -> Int # peekElemOff :: Ptr OVERLAPPED -> Int -> IO OVERLAPPED # pokeElemOff :: Ptr OVERLAPPED -> Int -> OVERLAPPED -> IO () # peekByteOff :: Ptr b -> Int -> IO OVERLAPPED # pokeByteOff :: Ptr b -> Int -> OVERLAPPED -> IO () # peek :: Ptr OVERLAPPED -> IO OVERLAPPED # poke :: Ptr OVERLAPPED -> OVERLAPPED -> IO () #
Show OVERLAPPED Source # |
Instance details Defined in System.Win32.File.Internal Methods showsPrec :: Int -> OVERLAPPED -> ShowS # show :: OVERLAPPED -> String # showList :: [OVERLAPPED] -> ShowS #

type LPOVERLAPPED = Ptr OVERLAPPED Source #

type MbLPOVERLAPPED = Maybe LPOVERLAPPED Source #

win32_ReadFile :: HANDLE -> Ptr a -> DWORD -> Maybe LPOVERLAPPED -> IO DWORD Source #

win32_WriteFile :: HANDLE -> Ptr a -> DWORD -> Maybe LPOVERLAPPED -> IO DWORD Source #

setFilePointerEx :: HANDLE -> LARGE_INTEGER -> FilePtrDirection -> IO LARGE_INTEGER Source #

# File notifications

findFirstChangeNotification :: String -> Bool -> FileNotificationFlag -> IO HANDLE Source #

findNextChangeNotification :: HANDLE -> IO () Source #

findCloseChangeNotification :: HANDLE -> IO () Source #

# Directories

data FindData Source #

getFindDataFileName :: FindData -> IO FilePath Source #

findFirstFile :: String -> IO (HANDLE, FindData) Source #

findNextFile :: HANDLE -> FindData -> IO Bool Source #

findClose :: HANDLE -> IO () Source #

# DOS device flags

defineDosDevice :: DefineDosDeviceFlags -> String -> Maybe String -> IO () Source #

areFileApisANSI :: IO Bool Source #

setFileApisToOEM :: IO () Source #

setFileApisToANSI :: IO () Source #

setHandleCount :: UINT -> IO UINT Source #

getLogicalDrives :: IO DWORD Source #

getDiskFreeSpace :: Maybe String -> IO (DWORD, DWORD, DWORD, DWORD) Source #

setVolumeLabel :: Maybe String -> Maybe String -> IO () Source #

# File locks

lockFile Source #

Arguments

:: HANDLE | CreateFile handle
-> LockMode | Locking mode
-> DWORD64 | Size of region to lock
-> DWORD64 | Beginning offset of file to lock
-> IO BOOL | Indicates if locking was successful, if not query getLastError.

Locks a given range in a file handle, To lock an entire file use 0xFFFFFFFFFFFFFFFF for size and 0 for offset.

unlockFile Source #

Arguments

:: HANDLE | CreateFile handle
-> DWORD64 | Size of region to unlock
-> DWORD64 | Beginning offset of file to unlock
-> IO BOOL | Indicates if unlocking was successful, if not query getLastError.

Unlocks a given range in a file handle, To unlock an entire file use 0xFFFFFFFFFFFFFFFF for size and 0 for offset.