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 | Trustworthy |
Language | Haskell2010 |
A collection of FFI declarations for interfacing with Win32.
Synopsis
- type PrimaryLANGID = WORD
- type SubLANGID = WORD
- type SortID = WORD
- type LANGID = WORD
- type LCID = DWORD
- type ErrCode = DWORD
- type MbHMODULE = Maybe HMODULE
- type HMODULE = Ptr ()
- type MbHINSTANCE = Maybe HINSTANCE
- type HINSTANCE = Ptr ()
- type MbHANDLE = Maybe HANDLE
- type PKEY = HANDLE
- type HKEY = ForeignHANDLE
- type ForeignHANDLE = ForeignPtr ()
- type HANDLE = Ptr ()
- type TCHAR = CWchar
- type MbLPCTSTR = Maybe LPCTSTR
- type MbLPCSTR = Maybe LPCSTR
- type MbLPVOID = Maybe LPVOID
- type LPCTSTR_ = LPCTSTR
- type LPCTSTR = LPTSTR
- type LPTSTR = Ptr TCHAR
- type LPCWSTR = LPWSTR
- type LPWSTR = Ptr CWchar
- type LPCSTR = LPSTR
- type LPSTR = Ptr CChar
- type LPDWORD = Ptr DWORD
- type PUCHAR = Ptr UCHAR
- type LPBYTE = Ptr BYTE
- type LPBOOL = Ptr BOOL
- type LPVOID = Ptr ()
- type Addr = Ptr ()
- type HRESULT = LONG
- type MbATOM = Maybe ATOM
- type SIZE_T = ULONG_PTR
- type LRESULT = LONG_PTR
- type LPARAM = LONG_PTR
- type WPARAM = UINT_PTR
- type ATOM = WORD
- type MbINT = Maybe INT
- type MbString = Maybe String
- type DDWORD = Word64
- type HALF_PTR = Ptr INT32
- type DWORD_PTR = ULONG_PTR
- type ULONG_PTR = CUIntPtr
- type LONG_PTR = CIntPtr
- type UINT_PTR = Word
- type ULONG = Word32
- type INT_PTR = Ptr CInt
- type SHORT = Int16
- type ULONG64 = Word64
- type ULONG32 = Word32
- type UINT64 = Word64
- type UINT32 = Word32
- type LONG64 = Int64
- type LONG32 = Int32
- type INT64 = Int64
- type INT32 = Int32
- type DWORD64 = Word64
- type DWORD32 = Word32
- type LARGE_INTEGER = Int64
- type FLOAT = Float
- type LONG = Int32
- type DWORD = Word32
- type WORD = Word16
- type INT = Int32
- type UINT = Word32
- type USHORT = Word16
- type UCHAR = CUChar
- type BYTE = Word8
- type BOOL = Bool
- sUBLANGID :: LANGID -> SubLANGID
- pRIMARYLANGID :: LANGID -> PrimaryLANGID
- mAKELANGID :: PrimaryLANGID -> SubLANGID -> LANGID
- sORTIDFROMLCID :: LCID -> SortID
- lANGIDFROMLCID :: LCID -> LANGID
- mAKELCID :: LANGID -> SortID -> LCID
- castPtrToUINTPtr :: Ptr s -> UINT_PTR
- castUINTPtrToPtr :: UINT_PTR -> Ptr a
- hIWORD :: DWORD -> WORD
- lOWORD :: DWORD -> WORD
- getErrorMessage :: DWORD -> IO LPWSTR
- setLastError :: ErrCode -> IO ()
- getLastError :: IO ErrCode
- localFree :: Ptr a -> IO (Ptr a)
- deleteObjectFinaliser :: FunPtr (Ptr a -> IO ())
- c_maperrno_func :: ErrCode -> IO Errno
- c_get_osfhandle :: CInt -> IO HANDLE
- internal_getUniqueFileInfo :: HANDLE -> Ptr Word64 -> Ptr Word64 -> IO ()
- internal_lockFile :: CUIntPtr -> Word64 -> Word64 -> CInt -> IO CInt
- _open_osfhandle :: CIntPtr -> CInt -> IO CInt
- maybePtr :: Maybe (Ptr a) -> Ptr a
- ptrToMaybe :: Ptr a -> Maybe (Ptr a)
- maybeNum :: Num a => Maybe a -> a
- numToMaybe :: (Eq a, Num a) => a -> Maybe a
- withTString :: String -> (LPTSTR -> IO a) -> IO a
- withFilePath :: FilePath -> (LPTSTR -> IO a) -> IO a
- withTStringLen :: String -> ((LPTSTR, Int) -> IO a) -> IO a
- peekTString :: LPCTSTR -> IO String
- peekTStringLen :: (LPCTSTR, Int) -> IO String
- newTString :: String -> IO LPCTSTR
- useAsCWStringSafe :: FilePath -> (CWString -> IO a) -> IO a
- newForeignHANDLE :: HANDLE -> IO ForeignHANDLE
- handleToWord :: HANDLE -> UINT_PTR
- nullHANDLE :: HANDLE
- nullHINSTANCE :: HINSTANCE
- nullFinalHANDLE :: ForeignPtr a
- iNVALID_HANDLE_VALUE :: HANDLE
- iNVALID_SET_FILE_POINTER :: DWORD
- hANDLEToHandle :: HANDLE -> IO Handle
- withHandleToHANDLE :: Handle -> (HANDLE -> IO a) -> IO a
- withHandleToHANDLENative :: Handle -> (HANDLE -> IO a) -> IO a
- withHandleToHANDLEPosix :: Handle -> (HANDLE -> IO a) -> IO a
- withStablePtr :: a -> (StablePtr a -> IO b) -> IO b
- failIf :: (a -> Bool) -> String -> IO a -> IO a
- failIf_ :: (a -> Bool) -> String -> IO a -> IO ()
- failIfNeg :: (Num a, Ord a) => String -> IO a -> IO a
- failIfNull :: String -> IO (Ptr a) -> IO (Ptr a)
- failIfZero :: (Eq a, Num a) => String -> IO a -> IO a
- failIfFalse_ :: String -> IO Bool -> IO ()
- failUnlessSuccess :: String -> IO ErrCode -> IO ()
- failUnlessSuccessOr :: ErrCode -> String -> IO ErrCode -> IO Bool
- eRROR_INSUFFICIENT_BUFFER :: ErrCode
- eRROR_MOD_NOT_FOUND :: ErrCode
- eRROR_PROC_NOT_FOUND :: ErrCode
- eERROR_ENVVAR_NOT_FOUND :: ErrCode
- errorWin :: String -> IO a
- failWith :: String -> ErrCode -> IO a
- ddwordToDwords :: DDWORD -> (DWORD, DWORD)
- dwordsToDdword :: (DWORD, DWORD) -> DDWORD
- try :: String -> (LPTSTR -> UINT -> IO UINT) -> UINT -> IO String
- nullPtr :: Ptr a
Documentation
type PrimaryLANGID = WORD Source #
type MbHINSTANCE = Maybe HINSTANCE Source #
type HKEY = ForeignHANDLE Source #
type ForeignHANDLE = ForeignPtr () Source #
type LARGE_INTEGER = Int64 Source #
pRIMARYLANGID :: LANGID -> PrimaryLANGID Source #
mAKELANGID :: PrimaryLANGID -> SubLANGID -> LANGID Source #
sORTIDFROMLCID :: LCID -> SortID Source #
lANGIDFROMLCID :: LCID -> LANGID Source #
castPtrToUINTPtr :: Ptr s -> UINT_PTR Source #
castUINTPtrToPtr :: UINT_PTR -> Ptr a Source #
getErrorMessage :: DWORD -> IO LPWSTR Source #
setLastError :: ErrCode -> IO () Source #
getLastError :: IO ErrCode Source #
deleteObjectFinaliser :: FunPtr (Ptr a -> IO ()) Source #
c_maperrno_func :: ErrCode -> IO Errno Source #
c_get_osfhandle :: CInt -> IO HANDLE Source #
internal_getUniqueFileInfo :: HANDLE -> Ptr Word64 -> Ptr Word64 -> IO () Source #
Returns -1 on error. Otherwise writes two values representing the file into the given ptrs.
internal_lockFile :: CUIntPtr -> Word64 -> Word64 -> CInt -> IO CInt Source #
_open_osfhandle :: CIntPtr -> CInt -> IO CInt Source #
ptrToMaybe :: Ptr a -> Maybe (Ptr a) Source #
numToMaybe :: (Eq a, Num a) => a -> Maybe a Source #
withTString :: String -> (LPTSTR -> IO a) -> IO a Source #
withFilePath :: FilePath -> (LPTSTR -> IO a) -> IO a Source #
withTStringLen :: String -> ((LPTSTR, Int) -> IO a) -> IO a Source #
peekTString :: LPCTSTR -> IO String Source #
peekTStringLen :: (LPCTSTR, Int) -> IO String Source #
newTString :: String -> IO LPCTSTR Source #
useAsCWStringSafe :: FilePath -> (CWString -> IO a) -> IO a Source #
Wrapper around useAsCString
, checking the encoded FilePath
for internal NUL codepoints as these are
disallowed in Windows filepaths. See https://gitlab.haskell.org/ghc/ghc/-/issues/13660
newForeignHANDLE :: HANDLE -> IO ForeignHANDLE Source #
handleToWord :: HANDLE -> UINT_PTR Source #
nullHANDLE :: HANDLE Source #
nullFinalHANDLE :: ForeignPtr a Source #
hANDLEToHandle :: HANDLE -> IO Handle Source #
Create a Haskell Handle
from a Windows HANDLE
.
Beware that this function allocates a new file descriptor. A consequence of
this is that calling hANDLEToHandle
on the standard Windows handles will
not give you stdin
, stdout
, or stderr
. For example, if you
run this code:
import Graphics.Win32.Misc
stdoutHANDLE <- getStdHandle sTD_OUTPUT_HANDLE
stdout2 <- hANDLEToHandle
stdoutHANDLE
Then although you can use stdout2
to write to standard output, it is not
the case that
.stdout
== stdout2
withHandleToHANDLE :: Handle -> (HANDLE -> IO a) -> IO a Source #
Extract a Windows HANDLE
from a Haskell Handle
and perform
an action on it.
withHandleToHANDLENative :: Handle -> (HANDLE -> IO a) -> IO a Source #
withHandleToHANDLEPosix :: Handle -> (HANDLE -> IO a) -> IO a Source #
withStablePtr :: a -> (StablePtr a -> IO b) -> IO b Source #
failIfNull :: String -> IO (Ptr a) -> IO (Ptr a) Source #
failIfZero :: (Eq a, Num a) => String -> IO a -> IO a Source #
failIfFalse_ :: String -> IO Bool -> IO () Source #
failUnlessSuccess :: String -> IO ErrCode -> IO () Source #
failUnlessSuccessOr :: ErrCode -> String -> IO ErrCode -> IO Bool Source #