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
- _open_osfhandle :: CIntPtr -> CInt -> IO CInt
- c_get_osfhandle :: CInt -> IO HANDLE
- c_maperrno_func :: ErrCode -> IO Errno
- castPtrToUINTPtr :: Ptr s -> UINT_PTR
- castUINTPtrToPtr :: UINT_PTR -> Ptr a
- ddwordToDwords :: DDWORD -> (DWORD, DWORD)
- deleteObjectFinaliser :: FunPtr (Ptr a -> IO ())
- dwordsToDdword :: (DWORD, DWORD) -> DDWORD
- eERROR_ENVVAR_NOT_FOUND :: ErrCode
- eRROR_INSUFFICIENT_BUFFER :: ErrCode
- eRROR_MOD_NOT_FOUND :: ErrCode
- eRROR_PROC_NOT_FOUND :: ErrCode
- errorWin :: String -> IO a
- failIf :: (a -> Bool) -> String -> IO a -> IO a
- failIfFalse_ :: String -> IO Bool -> 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
- failIf_ :: (a -> Bool) -> String -> IO a -> IO ()
- failUnlessSuccess :: String -> IO ErrCode -> IO ()
- failUnlessSuccessOr :: ErrCode -> String -> IO ErrCode -> IO Bool
- failWith :: String -> ErrCode -> IO a
- getErrorMessage :: DWORD -> IO LPWSTR
- getLastError :: IO ErrCode
- hANDLEToHandle :: HANDLE -> IO Handle
- hIWORD :: DWORD -> WORD
- handleToWord :: HANDLE -> UINT_PTR
- iNVALID_HANDLE_VALUE :: HANDLE
- iNVALID_SET_FILE_POINTER :: DWORD
- internal_getUniqueFileInfo :: HANDLE -> Ptr Word64 -> Ptr Word64 -> IO ()
- internal_lockFile :: CUIntPtr -> Word64 -> Word64 -> CInt -> IO CInt
- lANGIDFROMLCID :: LCID -> LANGID
- lOWORD :: DWORD -> WORD
- localFree :: Ptr a -> IO (Ptr a)
- mAKELANGID :: PrimaryLANGID -> SubLANGID -> LANGID
- mAKELCID :: LANGID -> SortID -> LCID
- maybeNum :: Num a => Maybe a -> a
- maybePtr :: Maybe (Ptr a) -> Ptr a
- newForeignHANDLE :: HANDLE -> IO ForeignHANDLE
- newTString :: String -> IO LPCTSTR
- nullFinalHANDLE :: ForeignPtr a
- nullHANDLE :: HANDLE
- nullHINSTANCE :: HINSTANCE
- numToMaybe :: (Eq a, Num a) => a -> Maybe a
- pRIMARYLANGID :: LANGID -> PrimaryLANGID
- peekTString :: LPCTSTR -> IO String
- peekTStringLen :: (LPCTSTR, Int) -> IO String
- ptrToMaybe :: Ptr a -> Maybe (Ptr a)
- sORTIDFROMLCID :: LCID -> SortID
- sUBLANGID :: LANGID -> SubLANGID
- setLastError :: ErrCode -> IO ()
- try :: String -> (LPTSTR -> UINT -> IO UINT) -> UINT -> IO String
- useAsCWStringSafe :: FilePath -> (CWString -> IO a) -> IO a
- withFilePath :: FilePath -> (LPTSTR -> IO a) -> IO a
- 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
- withTString :: String -> (LPTSTR -> IO a) -> IO a
- withTStringLen :: String -> ((LPTSTR, Int) -> IO a) -> IO a
- type ATOM = WORD
- type Addr = Ptr ()
- type BOOL = Bool
- type BYTE = Word8
- type DDWORD = Word64
- type DWORD = Word32
- type DWORD32 = Word32
- type DWORD64 = Word64
- type DWORD_PTR = ULONG_PTR
- type ErrCode = DWORD
- type FLOAT = Float
- type ForeignHANDLE = ForeignPtr ()
- type HALF_PTR = Ptr INT32
- type HANDLE = Ptr ()
- type HINSTANCE = Ptr ()
- type HKEY = ForeignHANDLE
- type HMODULE = Ptr ()
- type HRESULT = LONG
- type INT = Int32
- type INT32 = Int32
- type INT64 = Int64
- type INT_PTR = Ptr CInt
- type LANGID = WORD
- type LARGE_INTEGER = Int64
- type LCID = DWORD
- type LONG = Int32
- type LONG32 = Int32
- type LONG64 = Int64
- type LONG_PTR = CIntPtr
- type LPARAM = LONG_PTR
- type LPBOOL = Ptr BOOL
- type LPBYTE = Ptr BYTE
- type LPCSTR = LPSTR
- type LPCTSTR = LPTSTR
- type LPCTSTR_ = LPCTSTR
- type LPCWSTR = LPWSTR
- type LPDWORD = Ptr DWORD
- type LPSTR = Ptr CChar
- type LPTSTR = Ptr TCHAR
- type LPVOID = Ptr ()
- type LPWSTR = Ptr CWchar
- type LRESULT = LONG_PTR
- type MbATOM = Maybe ATOM
- type MbHANDLE = Maybe HANDLE
- type MbHINSTANCE = Maybe HINSTANCE
- type MbHMODULE = Maybe HMODULE
- type MbINT = Maybe INT
- type MbLPCSTR = Maybe LPCSTR
- type MbLPCTSTR = Maybe LPCTSTR
- type MbLPVOID = Maybe LPVOID
- type MbString = Maybe String
- type PKEY = HANDLE
- type PUCHAR = Ptr UCHAR
- type PrimaryLANGID = WORD
- type SHORT = Int16
- type SIZE_T = ULONG_PTR
- type SortID = WORD
- type SubLANGID = WORD
- type TCHAR = CWchar
- type UCHAR = CUChar
- type UINT = Word32
- type UINT32 = Word32
- type UINT64 = Word64
- type UINT_PTR = Word
- type ULONG = Word32
- type ULONG32 = Word32
- type ULONG64 = Word64
- type ULONG_PTR = CUIntPtr
- type USHORT = Word16
- type WORD = Word16
- type WPARAM = UINT_PTR
- nullPtr :: Ptr a
Documentation
castPtrToUINTPtr :: Ptr s -> UINT_PTR Source #
castUINTPtrToPtr :: UINT_PTR -> Ptr a Source #
getLastError :: IO ErrCode 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
handleToWord :: HANDLE -> UINT_PTR 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.
lANGIDFROMLCID :: LCID -> LANGID Source #
mAKELANGID :: PrimaryLANGID -> SubLANGID -> LANGID Source #
newForeignHANDLE :: HANDLE -> IO ForeignHANDLE Source #
nullFinalHANDLE :: ForeignPtr a Source #
nullHANDLE :: HANDLE Source #
pRIMARYLANGID :: LANGID -> PrimaryLANGID Source #
sORTIDFROMLCID :: LCID -> SortID Source #
setLastError :: ErrCode -> IO () 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
type ForeignHANDLE = ForeignPtr () Source #
type HKEY = ForeignHANDLE Source #
type LARGE_INTEGER = Int64 Source #
type MbHINSTANCE = Maybe HINSTANCE Source #
type PrimaryLANGID = WORD Source #