2a74a5f71ed9fa3f1983e0479ba7ba3d7d5dae24
[packages/base.git] / GHC / Windows.hs
1 {-# LANGUAGE NoImplicitPrelude, ForeignFunctionInterface #-}
2 -----------------------------------------------------------------------------
3 -- |
4 -- Module : GHC.Windows
5 -- Copyright : (c) The University of Glasgow, 2009
6 -- License : see libraries/base/LICENSE
7 --
8 -- Maintainer : libraries@haskell.org
9 -- Stability : internal
10 -- Portability : non-portable
11 --
12 -- Windows functionality used by several modules.
13 --
14 -- ToDo: this just duplicates part of System.Win32.Types, which isn't
15 -- available yet. We should move some Win32 functionality down here,
16 -- maybe as part of the grand reorganisation of the base package...
17 --
18 -----------------------------------------------------------------------------
19
20 module GHC.Windows where
21
22 import GHC.Base
23 import GHC.Ptr
24
25 import Data.Word
26
27 import Foreign.C.Error (throwErrno)
28 import Foreign.C.Types
29
30
31 type HANDLE = Ptr ()
32 type DWORD = Word32
33
34 type LPTSTR = Ptr CWchar
35
36 iNFINITE :: DWORD
37 iNFINITE = 0xFFFFFFFF -- urgh
38
39 throwGetLastError :: String -> IO a
40 throwGetLastError where_from = c_maperrno >> throwErrno where_from
41
42 foreign import ccall unsafe "maperrno" -- in Win32Utils.c
43 c_maperrno :: IO ()
44