Win32-extras-0.2.0.0: System/Win32/Error.hsc
{-# LANGUAGE CPP #-}
{- |
Module : System.Win32.Error
Copyright : 2013 shelarcy
License : BSD-style
Maintainer : shelarcy@gmail.com
Stability : Provisional
Portability : Non-portable (Win32 API)
Error handling for foreign calls to the Win32 API.
This module
* reorganize Win32 package's error handling functions.
* supports to show non-UTF MutiByte error message without using GHC 7.8.1.
-}
module System.Win32.Error
( failIf, failIf_, failIfNull
, failIfZero, failIfZero_, failIfFalse_
, failUnlessSuccess, failUnlessSuccessOr
, failIfWithRetry, failIfWithRetry_, failIfFalseWithRetry_
, errorWin, getLastError, failWith
, eRROR_INSUFFICIENT_BUFFER
, eRROR_MOD_NOT_FOUND
, eRROR_PROC_NOT_FOUND
) where
#if __GLASGOW_HASKELL__ >= 707
import System.Win32.File ( failIfWithRetry, failIfWithRetry_, failIfFalseWithRetry_ )
import System.Win32.Types
#else
import System.Win32.Error.MultiByte
import System.Win32.Types ( getLastError, ErrCode )
#endif
#include <windows.h>
failIfZero_ :: (Eq a, Num a) => String -> IO a -> IO ()
failIfZero_ = failIf_ (== 0)
eRROR_INSUFFICIENT_BUFFER :: ErrCode
eRROR_INSUFFICIENT_BUFFER = #const ERROR_INSUFFICIENT_BUFFER
eRROR_MOD_NOT_FOUND :: ErrCode
eRROR_MOD_NOT_FOUND = #const ERROR_MOD_NOT_FOUND
eRROR_PROC_NOT_FOUND :: ErrCode
eRROR_PROC_NOT_FOUND = #const ERROR_PROC_NOT_FOUND