Win32-2.2.0.2: A binding to part of the Win32 librarySource codeContentsIndex
System.Win32.FileMapping
Portabilityportable
Stabilityprovisional
MaintainerEsa Ilari Vuokko <ei@vuokko.info>
Description
A collection of FFI declarations for interfacing with Win32 mapped files.
Synopsis
mapFile :: FilePath -> IO (ForeignPtr a, Int)
mapFileBs :: FilePath -> IO ByteString
data MappedObject = MappedObject HANDLE HANDLE FileMapAccess
withMappedFile :: FilePath -> Bool -> Maybe Bool -> (Integer -> MappedObject -> IO a) -> IO a
withMappedArea :: MappedObject -> Integer -> Int -> (Ptr a -> IO b) -> IO b
type ProtectSectionFlags = DWORD
sEC_COMMIT :: ProtectSectionFlags
sEC_IMAGE :: ProtectSectionFlags
sEC_NOCACHE :: ProtectSectionFlags
type FileMapAccess = DWORD
sEC_RESERVE :: ProtectSectionFlags
fILE_MAP_ALL_ACCESS :: FileMapAccess
fILE_MAP_COPY :: FileMapAccess
fILE_MAP_READ :: FileMapAccess
fILE_MAP_WRITE :: FileMapAccess
createFileMapping :: Maybe HANDLE -> ProtectFlags -> DDWORD -> Maybe String -> IO HANDLE
openFileMapping :: FileMapAccess -> BOOL -> Maybe String -> IO HANDLE
mapViewOfFileEx :: HANDLE -> FileMapAccess -> DDWORD -> SIZE_T -> Ptr a -> IO (Ptr b)
mapViewOfFile :: HANDLE -> FileMapAccess -> DDWORD -> SIZE_T -> IO (Ptr a)
unmapViewOfFile :: Ptr a -> IO ()
c_OpenFileMapping :: DWORD -> BOOL -> LPCTSTR -> IO HANDLE
c_CreateFileMapping :: HANDLE -> Ptr () -> DWORD -> DWORD -> DWORD -> LPCTSTR -> IO HANDLE
c_MapViewOfFileEx :: HANDLE -> DWORD -> DWORD -> DWORD -> SIZE_T -> Ptr a -> IO (Ptr b)
c_UnmapViewOfFile :: Ptr a -> IO BOOL
c_UnmapViewOfFileFinaliser :: FunPtr (Ptr a -> IO ())
Documentation
mapFile :: FilePath -> IO (ForeignPtr a, Int)Source
Maps file fully and returns ForeignPtr and length of the mapped area. The mapped file is opened read-only and shared reading.
mapFileBs :: FilePath -> IO ByteStringSource
As mapFile, but returns ByteString
data MappedObject Source
Constructors
MappedObject HANDLE HANDLE FileMapAccess
withMappedFileSource
:: FilePathPath
-> BoolWrite? (False = read-only)
-> Maybe BoolSharing mode, no sharing, share read, share read+write
-> Integer -> MappedObject -> IO aAction
-> IO a
Opens an existing file and creates mapping object to it.
withMappedAreaSource
:: MappedObjectMapped object, from withMappedFile
-> IntegerPosition in file
-> IntSize of mapped area
-> Ptr a -> IO bAction
-> IO b
Maps area into memory.
type ProtectSectionFlags = DWORDSource
sEC_COMMIT :: ProtectSectionFlagsSource
sEC_IMAGE :: ProtectSectionFlagsSource
sEC_NOCACHE :: ProtectSectionFlagsSource
type FileMapAccess = DWORDSource
sEC_RESERVE :: ProtectSectionFlagsSource
fILE_MAP_ALL_ACCESS :: FileMapAccessSource
fILE_MAP_COPY :: FileMapAccessSource
fILE_MAP_READ :: FileMapAccessSource
fILE_MAP_WRITE :: FileMapAccessSource
createFileMapping :: Maybe HANDLE -> ProtectFlags -> DDWORD -> Maybe String -> IO HANDLESource
openFileMapping :: FileMapAccess -> BOOL -> Maybe String -> IO HANDLESource
mapViewOfFileEx :: HANDLE -> FileMapAccess -> DDWORD -> SIZE_T -> Ptr a -> IO (Ptr b)Source
mapViewOfFile :: HANDLE -> FileMapAccess -> DDWORD -> SIZE_T -> IO (Ptr a)Source
unmapViewOfFile :: Ptr a -> IO ()Source
c_OpenFileMapping :: DWORD -> BOOL -> LPCTSTR -> IO HANDLESource
c_CreateFileMapping :: HANDLE -> Ptr () -> DWORD -> DWORD -> DWORD -> LPCTSTR -> IO HANDLESource
c_MapViewOfFileEx :: HANDLE -> DWORD -> DWORD -> DWORD -> SIZE_T -> Ptr a -> IO (Ptr b)Source
c_UnmapViewOfFile :: Ptr a -> IO BOOLSource
c_UnmapViewOfFileFinaliser :: FunPtr (Ptr a -> IO ())Source
Produced by Haddock version 2.6.1