System.Win32.Types

Win32-2.6.1.0: A binding to part of the Win32 library

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

System.Win32.Types

Description

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 ULONG_PTR = CUIntPtr
- type LONG_PTR = CIntPtr
- type UINT_PTR = Word
- type ULONG = Word32
- type INT_PTR = Ptr CInt
- type DWORD_PTR = Ptr DWORD32
- 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
- _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
- withTStringLen :: String -> ((LPTSTR, Int) -> IO a) -> IO a
- peekTString :: LPCTSTR -> IO String
- peekTStringLen :: (LPCTSTR, Int) -> IO String
- newTString :: String -> IO LPCTSTR
- newForeignHANDLE :: HANDLE -> IO ForeignHANDLE
- handleToWord :: HANDLE -> UINT_PTR
- nullHANDLE :: HANDLE
- nullHINSTANCE :: HINSTANCE
- nullFinalHANDLE :: ForeignPtr a
- iNVALID_HANDLE_VALUE :: HANDLE
- hANDLEToHandle :: HANDLE -> IO Handle
- withHandleToHANDLE :: 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
- 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 #

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 ULONG_PTR = CUIntPtr #

type LONG_PTR = CIntPtr #

type UINT_PTR = Word #

type ULONG = Word32 #

type INT_PTR = Ptr CInt #

type DWORD_PTR = Ptr DWORD32 #

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 #

_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 #

withTStringLen :: String -> ((LPTSTR, Int) -> IO a) -> IO a #

peekTString :: LPCTSTR -> IO String #

peekTStringLen :: (LPCTSTR, Int) -> IO String #

newTString :: String -> IO LPCTSTR #

newForeignHANDLE :: HANDLE -> IO ForeignHANDLE #

handleToWord :: HANDLE -> UINT_PTR #

nullHANDLE :: HANDLE #

nullHINSTANCE :: HINSTANCE #

nullFinalHANDLE :: ForeignPtr a #

iNVALID_HANDLE_VALUE :: HANDLE #

hANDLEToHandle :: HANDLE -> IO Handle #

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 #

Extract a Windows `HANDLE` from a Haskell `Handle` and perform an action on it.

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 #

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 Source #

The constant `nullPtr` contains a distinguished value of `Ptr` that is not associated with a valid memory location.