diff --git a/Graphics/Win32.hs b/Graphics/Win32.hs
--- a/Graphics/Win32.hs
+++ b/Graphics/Win32.hs
@@ -21,18 +21,18 @@
 -----------------------------------------------------------------------------
 
 module Graphics.Win32 (
-	module System.Win32.Types,
-	module Graphics.Win32.Control,
-	module Graphics.Win32.Dialogue,
-	module Graphics.Win32.GDI,
-	module Graphics.Win32.Icon,
-	module Graphics.Win32.Key,
-	module Graphics.Win32.Menu,
-	module Graphics.Win32.Message,
-	module Graphics.Win32.Misc,
-	module Graphics.Win32.Resource,
-	module Graphics.Win32.Window
-	) where
+        module System.Win32.Types,
+        module Graphics.Win32.Control,
+        module Graphics.Win32.Dialogue,
+        module Graphics.Win32.GDI,
+        module Graphics.Win32.Icon,
+        module Graphics.Win32.Key,
+        module Graphics.Win32.Menu,
+        module Graphics.Win32.Message,
+        module Graphics.Win32.Misc,
+        module Graphics.Win32.Resource,
+        module Graphics.Win32.Window
+        ) where
 
 import System.Win32.Types
 import Graphics.Win32.Control
diff --git a/Graphics/Win32/Dialogue.hsc b/Graphics/Win32/Dialogue.hsc
--- a/Graphics/Win32/Dialogue.hsc
+++ b/Graphics/Win32/Dialogue.hsc
@@ -96,7 +96,7 @@
       (Either ResourceID String)  -- class
       (Either ResourceID String)  -- caption
       (Either ResourceID String)  -- fontname
-      Int	 		  -- font height
+      Int                         -- font height
       [DialogControl]
 
 data DialogControl
@@ -106,72 +106,72 @@
       (Either ResourceID String) -- classname
       WindowStyle
       DWORD
-      Int			 -- dia_id
+      Int                        -- dia_id
 
 mkDialogFromTemplate :: DialogTemplate -> IO DTemplateMem
 mkDialogFromTemplate (DialogTemplate x y cx cy
-				     wstyle extstyle
-				     mb_menu mb_class caption
-				     font font_height
-				     controls) = do
+                                     wstyle extstyle
+                                     mb_menu mb_class caption
+                                     font font_height
+                                     controls) = do
   prim_hmenu    <- marshall_res mb_menu
   prim_class    <- marshall_res mb_class
   prim_caption  <- marshall_res caption
   prim_font     <- marshall_res font
   dtemp <- mkDiaTemplate 0 x y cx cy wstyle extstyle
-  			 prim_hmenu prim_class
-			 prim_caption prim_font
-			 font_height
+                         prim_hmenu prim_class
+                         prim_caption prim_font
+                         font_height
   mapM_ (addControl dtemp) controls
   getFinalDialog dtemp
 
 pushButtonControl :: Int -> Int -> Int -> Int
-		  -> DWORD -> DWORD -> Int
-		  -> String
-		  -> DialogControl
+                  -> DWORD -> DWORD -> Int
+                  -> String
+                  -> DialogControl
 pushButtonControl x y cx cy style estyle dia_id lab =
   DialogControl x y cx cy (Left 0x0080) (Right lab)
-  		(style + bS_DEFPUSHBUTTON) estyle dia_id
+                (style + bS_DEFPUSHBUTTON) estyle dia_id
 
 labelControl :: Int -> Int -> Int -> Int
-	     -> DWORD -> DWORD -> Int
-	     -> String
+             -> DWORD -> DWORD -> Int
+             -> String
              -> DialogControl
 labelControl x y cx cy style estyle dia_id lab =
   DialogControl x y cx cy (Left 0x0082) (Right lab)
-  		(style + sS_LEFT) estyle dia_id
+                (style + sS_LEFT) estyle dia_id
 
 listBoxControl :: Int -> Int -> Int -> Int
-	       -> DWORD -> DWORD -> Int
-	       -> String
+               -> DWORD -> DWORD -> Int
+               -> String
                -> DialogControl
 listBoxControl x y cx cy style estyle dia_id lab =
   DialogControl x y cx cy (Left 0x0083) (Right lab)
-  		(style) estyle dia_id
+                (style) estyle dia_id
 
 comboBoxControl :: Int -> Int -> Int -> Int
-	       -> DWORD -> DWORD -> Int
-	       -> String
+               -> DWORD -> DWORD -> Int
+               -> String
                -> DialogControl
 comboBoxControl x y cx cy style estyle dia_id lab =
   DialogControl x y cx cy (Left 0x0085) (Right lab)
-  		(style) estyle dia_id
+                (style) estyle dia_id
 
 editControl :: Int -> Int -> Int -> Int
-	       -> DWORD -> DWORD -> Int
-	       -> String
+               -> DWORD -> DWORD -> Int
+               -> String
                -> DialogControl
 editControl x y cx cy style estyle dia_id lab =
   DialogControl x y cx cy (Left 0x0081) (Right lab)
-  		(style + eS_LEFT) estyle dia_id
+                (style + eS_LEFT) estyle dia_id
 
 scrollBarControl :: Int -> Int -> Int -> Int
-	       -> DWORD -> DWORD -> Int
-	       -> String
+               -> DWORD -> DWORD -> Int
+               -> String
                -> DialogControl
 scrollBarControl x y cx cy style estyle dia_id lab =
   DialogControl x y cx cy (Left 0x0084) (Right lab)
-  		(style) estyle dia_id
+                (style) estyle dia_id
 
 foreign import ccall unsafe "diatemp.h getFinalDialog"
   getFinalDialog :: Ptr DIA_TEMPLATE -> IO DTemplateMem
@@ -182,12 +182,12 @@
 
 addControl :: Ptr DIA_TEMPLATE -> DialogControl -> IO ()
 addControl dtemp (DialogControl x y cx cy mb_text mb_class
-				style exstyle
-				dia_id) = do
+                                style exstyle
+                                dia_id) = do
    prim_text  <- marshall_res mb_text
    prim_class <- marshall_res mb_class
    _ <- addDiaControl dtemp prim_text dia_id prim_class style
-  		 x y cx cy exstyle
+                 x y cx cy exstyle
    return ()
 
 foreign import ccall unsafe "diatemp.h addDiaControl"
diff --git a/Graphics/Win32/GDI.hs b/Graphics/Win32/GDI.hs
--- a/Graphics/Win32/GDI.hs
+++ b/Graphics/Win32/GDI.hs
@@ -25,18 +25,18 @@
 -- for details
 
 module Graphics.Win32.GDI (
-	module Graphics.Win32.GDI.Bitmap,
-	module Graphics.Win32.GDI.Brush,
-	module Graphics.Win32.GDI.Clip,
-	module Graphics.Win32.GDI.Font,
-	module Graphics.Win32.GDI.Graphics2D,
-	module Graphics.Win32.GDI.HDC,
-	module Graphics.Win32.GDI.Palette,
-	module Graphics.Win32.GDI.Path,
-	module Graphics.Win32.GDI.Pen,
-	module Graphics.Win32.GDI.Region,
-	module Graphics.Win32.GDI.Types
-	) where
+        module Graphics.Win32.GDI.Bitmap,
+        module Graphics.Win32.GDI.Brush,
+        module Graphics.Win32.GDI.Clip,
+        module Graphics.Win32.GDI.Font,
+        module Graphics.Win32.GDI.Graphics2D,
+        module Graphics.Win32.GDI.HDC,
+        module Graphics.Win32.GDI.Palette,
+        module Graphics.Win32.GDI.Path,
+        module Graphics.Win32.GDI.Pen,
+        module Graphics.Win32.GDI.Region,
+        module Graphics.Win32.GDI.Types
+        ) where
 
 import Graphics.Win32.GDI.Bitmap
 import Graphics.Win32.GDI.Brush
diff --git a/Graphics/Win32/GDI/Bitmap.hsc b/Graphics/Win32/GDI/Bitmap.hsc
--- a/Graphics/Win32/GDI/Bitmap.hsc
+++ b/Graphics/Win32/GDI/Bitmap.hsc
@@ -18,68 +18,68 @@
 -----------------------------------------------------------------------------
 
 module Graphics.Win32.GDI.Bitmap(
-	RasterOp3,
-	RasterOp4,
-	sRCCOPY,
-	sRCPAINT,
-	sRCAND,
-	sRCINVERT,
-	sRCERASE,
-	nOTSRCCOPY,
-	nOTSRCERASE,
-	mERGECOPY,
-	mERGEPAINT,
-	pATCOPY,
-	pATPAINT,
-	pATINVERT,
-	dSTINVERT,
-	bLACKNESS,
-	wHITENESS,
+        RasterOp3,
+        RasterOp4,
+        sRCCOPY,
+        sRCPAINT,
+        sRCAND,
+        sRCINVERT,
+        sRCERASE,
+        nOTSRCCOPY,
+        nOTSRCERASE,
+        mERGECOPY,
+        mERGEPAINT,
+        pATCOPY,
+        pATPAINT,
+        pATINVERT,
+        dSTINVERT,
+        bLACKNESS,
+        wHITENESS,
 
-	mAKEROP4,
+        mAKEROP4,
 
-	BITMAP,
-	LPBITMAP,
-	setBITMAP,
-	deleteBitmap,
-	createCompatibleBitmap,
-	createBitmap,
-	createBitmapIndirect,
-	createDIBPatternBrushPt,
-	getBitmapDimensionEx,
-	setBitmapDimensionEx,
-	getBitmapInfo,
+        BITMAP,
+        LPBITMAP,
+        setBITMAP,
+        deleteBitmap,
+        createCompatibleBitmap,
+        createBitmap,
+        createBitmapIndirect,
+        createDIBPatternBrushPt,
+        getBitmapDimensionEx,
+        setBitmapDimensionEx,
+        getBitmapInfo,
 
-	BitmapCompression,
-	bI_RGB,
-	bI_RLE8,
-	bI_RLE4,
-	bI_BITFIELDS,
+        BitmapCompression,
+        bI_RGB,
+        bI_RLE8,
+        bI_RLE4,
+        bI_BITFIELDS,
 
-	ColorFormat,
-	dIB_PAL_COLORS,
-	dIB_RGB_COLORS,
+        ColorFormat,
+        dIB_PAL_COLORS,
+        dIB_RGB_COLORS,
 
-	LPBITMAPINFO,
-	BITMAPINFOHEADER,
-	LPBITMAPINFOHEADER,
-	getBITMAPINFOHEADER_,
+        LPBITMAPINFO,
+        BITMAPINFOHEADER,
+        LPBITMAPINFOHEADER,
+        getBITMAPINFOHEADER_,
 
-	BITMAPFILEHEADER,
-	LPBITMAPFILEHEADER,
-	getBITMAPFILEHEADER,
+        BITMAPFILEHEADER,
+        LPBITMAPFILEHEADER,
+        getBITMAPFILEHEADER,
 
-	sizeofBITMAP,
-	sizeofBITMAPINFO,
-	sizeofBITMAPINFOHEADER,
-	sizeofBITMAPFILEHEADER,
-	sizeofLPBITMAPFILEHEADER,
+        sizeofBITMAP,
+        sizeofBITMAPINFO,
+        sizeofBITMAPINFOHEADER,
+        sizeofBITMAPFILEHEADER,
+        sizeofLPBITMAPFILEHEADER,
 
-	createBMPFile,
-	cBM_INIT,
-	getDIBits,
-	setDIBits,
-	createDIBitmap
+        createBMPFile,
+        cBM_INIT,
+        getDIBits,
+        setDIBits,
+        createDIBitmap
 
         ) where
 
diff --git a/Graphics/Win32/GDI/Font.hsc b/Graphics/Win32/GDI/Font.hsc
--- a/Graphics/Win32/GDI/Font.hsc
+++ b/Graphics/Win32/GDI/Font.hsc
@@ -19,21 +19,21 @@
 
 module Graphics.Win32.GDI.Font
 {-
-	( CharSet
-	, PitchAndFamily
-	, OutPrecision
-	, ClipPrecision
-	, FontQuality
-	, FontWeight
+        ( CharSet
+        , PitchAndFamily
+        , OutPrecision
+        , ClipPrecision
+        , FontQuality
+        , FontWeight
 
-	, createFont, deleteFont
+        , createFont, deleteFont
 
-	, StockFont, getStockFont
-	, oEM_FIXED_FONT, aNSI_FIXED_FONT, aNSI_VAR_FONT, sYSTEM_FONT
-	, dEVICE_DEFAULT_FONT, sYSTEM_FIXED_FONT
-	) where
+        , StockFont, getStockFont
+        , oEM_FIXED_FONT, aNSI_FIXED_FONT, aNSI_VAR_FONT, sYSTEM_FONT
+        , dEVICE_DEFAULT_FONT, sYSTEM_FIXED_FONT
+        ) where
 -}
-	where
+        where
 
 import System.Win32.Types
 import Graphics.Win32.GDI.Types
@@ -168,19 +168,19 @@
 --
 -- createFont_adr (width, height) escapement bold italic family =
 --  createFont height width
--- 		     (round (escapement * 1800/pi))
--- 		     0                     -- orientation
--- 		     weight
--- 		     italic False False    -- italic, underline, strikeout
--- 		     aNSI_CHARSET
--- 		     oUT_DEFAULT_PRECIS
--- 		     cLIP_DEFAULT_PRECIS
--- 		     dEFAULT_QUALITY
--- 		     dEFAULT_PITCH
--- 		     family
+--                   (round (escapement * 1800/pi))
+--                   0                     -- orientation
+--                   weight
+--                   italic False False    -- italic, underline, strikeout
+--                   aNSI_CHARSET
+--                   oUT_DEFAULT_PRECIS
+--                   cLIP_DEFAULT_PRECIS
+--                   dEFAULT_QUALITY
+--                   dEFAULT_PITCH
+--                   family
 --  where
 --   weight | bold      = fW_BOLD
--- 	    | otherwise = fW_NORMAL
+--          | otherwise = fW_NORMAL
 
 
 -- missing CreateFontIndirect from WinFonts.ss; GSL ???
diff --git a/Graphics/Win32/GDI/Graphics2D.hs b/Graphics/Win32/GDI/Graphics2D.hs
--- a/Graphics/Win32/GDI/Graphics2D.hs
+++ b/Graphics/Win32/GDI/Graphics2D.hs
@@ -18,7 +18,7 @@
 -----------------------------------------------------------------------------
 
 module Graphics.Win32.GDI.Graphics2D
-	where
+        where
 
 import System.Win32.Types
 import Graphics.Win32.GDI.Types
diff --git a/Graphics/Win32/GDI/HDC.hs b/Graphics/Win32/GDI/HDC.hs
--- a/Graphics/Win32/GDI/HDC.hs
+++ b/Graphics/Win32/GDI/HDC.hs
@@ -18,8 +18,8 @@
 -----------------------------------------------------------------------------
 
 module Graphics.Win32.GDI.HDC
-	( module Graphics.Win32.GDI.HDC
-	) where
+        ( module Graphics.Win32.GDI.HDC
+        ) where
 
 import System.Win32.Types
 import Graphics.Win32.GDI.Types
diff --git a/Graphics/Win32/GDI/Path.hs b/Graphics/Win32/GDI/Path.hs
--- a/Graphics/Win32/GDI/Path.hs
+++ b/Graphics/Win32/GDI/Path.hs
@@ -18,9 +18,9 @@
 -----------------------------------------------------------------------------
 
 module Graphics.Win32.GDI.Path
-	( beginPath, closeFigure, endPath, fillPath, flattenPath
-	, pathToRegion, strokeAndFillPath, strokePath, widenPath
-	) where
+        ( beginPath, closeFigure, endPath, fillPath, flattenPath
+        , pathToRegion, strokeAndFillPath, strokePath, widenPath
+        ) where
 
 import Graphics.Win32.GDI.Types
 import System.Win32.Types
diff --git a/Graphics/Win32/GDI/Types.hsc b/Graphics/Win32/GDI/Types.hsc
--- a/Graphics/Win32/GDI/Types.hsc
+++ b/Graphics/Win32/GDI/Types.hsc
@@ -17,42 +17,42 @@
 
 module Graphics.Win32.GDI.Types
 {-  -- still incomplete
-	( POINT,        marshall_point, unmarshall_point
-	, ListPOINT,    marshall_ListPOINT_
-	, ListLenPOINT, marshall_ListLenPOINT_
-	, RECT,         marshall_rect, unmarshall_rect
-	, SIZE,         marshall_size, unmarshall_size
-	, nullPtr
-	, HBITMAP	, MbHBITMAP
-	, HFONT		, MbHFONT
-	, HCURSOR	, MbHCURSOR
-	, HICON		, MbHICON
-	, HRGN		, MbHRGN
-	, PRGN
-	, HPALETTE	, MbHPALETTE
-	, HBRUSH	, MbHBRUSH
-	, HPEN		, MbHPEN
-	, HACCEL	--, MbHACCEL
-	, HDC		, MbHDC
-	, HDWP          , MbHDWP
-	, HWND		, MbHWND
-	, HMENU		, MbHMENU
-	, PolyFillMode
-	, ArcDirection
-	, MbArcDirection
-	, GraphicsMode
-	, MbGraphicsMode
-	, BackgroundMode
-	, HatchStyle
-	, StretchBltMode
-	, COLORREF
-	, TextAlignment
-	, ClippingMode
-	, RegionType
-	, gDI_ERROR
-	)
+        ( POINT,        marshall_point, unmarshall_point
+        , ListPOINT,    marshall_ListPOINT_
+        , ListLenPOINT, marshall_ListLenPOINT_
+        , RECT,         marshall_rect, unmarshall_rect
+        , SIZE,         marshall_size, unmarshall_size
+        , nullPtr
+        , HBITMAP       , MbHBITMAP
+        , HFONT         , MbHFONT
+        , HCURSOR       , MbHCURSOR
+        , HICON         , MbHICON
+        , HRGN          , MbHRGN
+        , PRGN
+        , HPALETTE      , MbHPALETTE
+        , HBRUSH        , MbHBRUSH
+        , HPEN          , MbHPEN
+        , HACCEL        --, MbHACCEL
+        , HDC           , MbHDC
+        , HDWP          , MbHDWP
+        , HWND          , MbHWND
+        , HMENU         , MbHMENU
+        , PolyFillMode
+        , ArcDirection
+        , MbArcDirection
+        , GraphicsMode
+        , MbGraphicsMode
+        , BackgroundMode
+        , HatchStyle
+        , StretchBltMode
+        , COLORREF
+        , TextAlignment
+        , ClippingMode
+        , RegionType
+        , gDI_ERROR
+        )
 -}
-	where
+        where
 
 import System.Win32.Types
 
diff --git a/System/Win32.hs b/System/Win32.hs
--- a/System/Win32.hs
+++ b/System/Win32.hs
@@ -18,20 +18,20 @@
 -----------------------------------------------------------------------------
 
 module System.Win32
-	( module System.Win32.DLL
-	, module System.Win32.File
-	, module System.Win32.FileMapping
-	, module System.Win32.Info
-	, module System.Win32.Mem
-	, module System.Win32.NLS
-	, module System.Win32.Process
-	, module System.Win32.Registry
-	, module System.Win32.Time
-	, module System.Win32.Console
-	, module System.Win32.Security
-	, module System.Win32.Types
-	, module System.Win32.Shell
-	) where
+        ( module System.Win32.DLL
+        , module System.Win32.File
+        , module System.Win32.FileMapping
+        , module System.Win32.Info
+        , module System.Win32.Mem
+        , module System.Win32.NLS
+        , module System.Win32.Process
+        , module System.Win32.Registry
+        , module System.Win32.Time
+        , module System.Win32.Console
+        , module System.Win32.Security
+        , module System.Win32.Types
+        , module System.Win32.Shell
+        ) where
 
 import System.Win32.DLL
 import System.Win32.File
diff --git a/System/Win32/Console.hsc b/System/Win32/Console.hsc
--- a/System/Win32/Console.hsc
+++ b/System/Win32/Console.hsc
@@ -18,14 +18,14 @@
 -----------------------------------------------------------------------------
 
 module System.Win32.Console (
-	-- * Console code pages
-	getConsoleCP,
-	setConsoleCP,
-	getConsoleOutputCP,
-	setConsoleOutputCP,
-	-- * Ctrl events
-	CtrlEvent, cTRL_C_EVENT, cTRL_BREAK_EVENT,
-	generateConsoleCtrlEvent
+        -- * Console code pages
+        getConsoleCP,
+        setConsoleCP,
+        getConsoleOutputCP,
+        setConsoleOutputCP,
+        -- * Ctrl events
+        CtrlEvent, cTRL_C_EVENT, cTRL_BREAK_EVENT,
+        generateConsoleCtrlEvent
   ) where
 
 ##include "windows_cconv.h"
@@ -33,16 +33,16 @@
 import System.Win32.Types
 
 foreign import WINDOWS_CCONV unsafe "windows.h GetConsoleCP"
-	getConsoleCP :: IO UINT
+        getConsoleCP :: IO UINT
 
 foreign import WINDOWS_CCONV unsafe "windows.h SetConsoleCP"
-	setConsoleCP :: UINT -> IO ()
+        setConsoleCP :: UINT -> IO ()
 
 foreign import WINDOWS_CCONV unsafe "windows.h GetConsoleOutputCP"
-	getConsoleOutputCP :: IO UINT
+        getConsoleOutputCP :: IO UINT
 
 foreign import WINDOWS_CCONV unsafe "windows.h SetConsoleOutputCP"
-	setConsoleOutputCP :: UINT -> IO ()
+        setConsoleOutputCP :: UINT -> IO ()
 
 type CtrlEvent = DWORD
 #{enum CtrlEvent,
diff --git a/System/Win32/File.hsc b/System/Win32/File.hsc
--- a/System/Win32/File.hsc
+++ b/System/Win32/File.hsc
@@ -19,10 +19,10 @@
 
 module System.Win32.File
 {-
-	( AccessMode, ShareMode, CreateMode, FileAttributeOrFlag
-	, CreateFile, CloseHandle, DeleteFile, CopyFile
-	, MoveFileFlag, MoveFile, MoveFileEx,
-	)
+        ( AccessMode, ShareMode, CreateMode, FileAttributeOrFlag
+        , CreateFile, CloseHandle, DeleteFile, CopyFile
+        , MoveFileFlag, MoveFile, MoveFileEx,
+        )
 -}
 where
 
@@ -131,9 +131,9 @@
 type MoveFileFlag   = DWORD
 
 #{enum MoveFileFlag,
- , mOVEFILE_REPLACE_EXISTING	= MOVEFILE_REPLACE_EXISTING
- , mOVEFILE_COPY_ALLOWED	= MOVEFILE_COPY_ALLOWED
- , mOVEFILE_DELAY_UNTIL_REBOOT	= MOVEFILE_DELAY_UNTIL_REBOOT
+ , mOVEFILE_REPLACE_EXISTING    = MOVEFILE_REPLACE_EXISTING
+ , mOVEFILE_COPY_ALLOWED        = MOVEFILE_COPY_ALLOWED
+ , mOVEFILE_DELAY_UNTIL_REBOOT  = MOVEFILE_DELAY_UNTIL_REBOOT
  }
 
 ----------------------------------------------------------------
@@ -554,8 +554,8 @@
 newtype FindData = FindData (ForeignPtr WIN32_FIND_DATA)
 
 getFindDataFileName :: FindData -> IO FilePath
-getFindDataFileName (FindData fp) = 
-  withForeignPtr fp $ \p -> 
+getFindDataFileName (FindData fp) =
+  withForeignPtr fp $ \p ->
     peekTString ((# ptr WIN32_FIND_DATAW, cFileName ) p)
 
 findFirstFile :: String -> IO (HANDLE, FindData)
@@ -563,7 +563,7 @@
   fp_finddata <- mallocForeignPtrBytes (# const sizeof(WIN32_FIND_DATAW) )
   withForeignPtr fp_finddata $ \p_finddata -> do
     handle <- withTString str $ \tstr -> do
-                failIf (== iNVALID_HANDLE_VALUE) "findFirstFile" $ 
+                failIf (== iNVALID_HANDLE_VALUE) "findFirstFile" $
                   c_FindFirstFile tstr p_finddata
     return (handle, FindData fp_finddata)
 foreign import WINDOWS_CCONV unsafe "windows.h FindFirstFileW"
diff --git a/System/Win32/Info.hsc b/System/Win32/Info.hsc
--- a/System/Win32/Info.hsc
+++ b/System/Win32/Info.hsc
@@ -137,13 +137,13 @@
 try :: String -> (LPTSTR -> UINT -> IO UINT) -> UINT -> IO String
 try loc f n = do
    e <- allocaArray (fromIntegral n) $ \lptstr -> do
-	  r <- failIfZero loc $ f lptstr n
-	  if (r > n) then return (Left r) else do
-	    str <- peekTStringLen (lptstr, fromIntegral r)
-	    return (Right str)
+          r <- failIfZero loc $ f lptstr n
+          if (r > n) then return (Left r) else do
+            str <- peekTStringLen (lptstr, fromIntegral r)
+            return (Right str)
    case e of
-	Left n    -> try loc f n   
-	Right str -> return str
+        Left n    -> try loc f n
+        Right str -> return str
 
 foreign import WINDOWS_CCONV unsafe "GetWindowsDirectoryW"
   c_getWindowsDirectory :: LPTSTR -> UINT -> IO UINT
diff --git a/System/Win32/Mem.hsc b/System/Win32/Mem.hsc
--- a/System/Win32/Mem.hsc
+++ b/System/Win32/Mem.hsc
@@ -170,9 +170,9 @@
 type HeapAllocFlags = DWORD
 
 #{enum HeapAllocFlags,
- , hEAP_GENERATE_EXCEPTIONS	= HEAP_GENERATE_EXCEPTIONS
- , hEAP_NO_SERIALIZE		= HEAP_NO_SERIALIZE
- , hEAP_ZERO_MEMORY		= HEAP_ZERO_MEMORY
+ , hEAP_GENERATE_EXCEPTIONS     = HEAP_GENERATE_EXCEPTIONS
+ , hEAP_NO_SERIALIZE            = HEAP_NO_SERIALIZE
+ , hEAP_ZERO_MEMORY             = HEAP_ZERO_MEMORY
  }
 
 heapAlloc :: HANDLE -> HeapAllocFlags -> DWORD -> IO Addr
diff --git a/System/Win32/NLS.hsc b/System/Win32/NLS.hsc
--- a/System/Win32/NLS.hsc
+++ b/System/Win32/NLS.hsc
@@ -16,13 +16,13 @@
 -----------------------------------------------------------------------------
 
 module System.Win32.NLS  (
-	module System.Win32.NLS,
+        module System.Win32.NLS,
 
-	-- defined in System.Win32.Types
-	LCID, LANGID, SortID, SubLANGID, PrimaryLANGID,
-	mAKELCID, lANGIDFROMLCID, sORTIDFROMLCID,
-	mAKELANGID, pRIMARYLANGID, sUBLANGID
-	) where
+        -- defined in System.Win32.Types
+        LCID, LANGID, SortID, SubLANGID, PrimaryLANGID,
+        mAKELCID, lANGIDFROMLCID, sORTIDFROMLCID,
+        mAKELANGID, pRIMARYLANGID, sUBLANGID
+        ) where
 
 import System.Win32.Types
 
@@ -347,7 +347,7 @@
 
 -- | The `System.IO` input functions (e.g. `getLine`) don't
 -- automatically convert to Unicode, so this function is provided to
--- make the conversion from a multibyte string in the given code page 
+-- make the conversion from a multibyte string in the given code page
 -- to a proper Unicode string.  To get the code page for the console,
 -- use `getConsoleCP`.
 
@@ -356,7 +356,7 @@
      -- MultiByteToWideChar doesn't handle empty strings (#1929)
 stringToUnicode cp mbstr =
   withCAStringLen mbstr $ \(cstr,len) -> do
-    wchars <- failIfZero "MultiByteToWideChar" $ multiByteToWideChar 
+    wchars <- failIfZero "MultiByteToWideChar" $ multiByteToWideChar
                 cp
                 0
                 cstr
@@ -364,7 +364,7 @@
                 nullPtr 0
     -- wchars is the length of buffer required
     allocaArray (fromIntegral wchars) $ \cwstr -> do
-      wchars <- failIfZero "MultiByteToWideChar" $ multiByteToWideChar 
+      wchars <- failIfZero "MultiByteToWideChar" $ multiByteToWideChar
                 cp
                 0
                 cstr
diff --git a/System/Win32/Registry.hsc b/System/Win32/Registry.hsc
--- a/System/Win32/Registry.hsc
+++ b/System/Win32/Registry.hsc
@@ -16,40 +16,40 @@
 -----------------------------------------------------------------------------
 
 module System.Win32.Registry
-		( module System.Win32.Registry
-		) where
+                ( module System.Win32.Registry
+                ) where
 {- What's really on offer:
-	(
-	  regCloseKey        -- :: HKEY -> IO ()
-	, regConnectRegistry -- :: Maybe String -> HKEY -> IO HKEY
-	, regCreateKey       -- :: HKEY -> String -> IO HKEY
-	, regCreateKeyEx     -- :: HKEY -> String -> String
-	                     -- -> RegCreateOptions -> REGSAM
-			     -- -> Maybe LPSECURITY_ATTRIBUTES
-			     -- -> IO (HKEY, Bool)
+        (
+          regCloseKey        -- :: HKEY -> IO ()
+        , regConnectRegistry -- :: Maybe String -> HKEY -> IO HKEY
+        , regCreateKey       -- :: HKEY -> String -> IO HKEY
+        , regCreateKeyEx     -- :: HKEY -> String -> String
+                             -- -> RegCreateOptions -> REGSAM
+                             -- -> Maybe LPSECURITY_ATTRIBUTES
+                             -- -> IO (HKEY, Bool)
         , regDeleteKey       -- :: HKEY -> String -> IO ()
-	, regDeleteValue     -- :: HKEY -> String -> IO ()
-	, regEnumKeys	     -- :: HKEY -> IO [String]
-	, regEnumKey 	     -- :: HKEY -> DWORD -> Addr -> DWORD -> IO String
-	, regEnumKeyValue    -- :: HKEY -> DWORD -> Addr -> DWORD -> Addr -> DWORD -> IO String
-	, regFlushKey        -- :: HKEY -> IO ()
-	, regLoadKey         -- :: HKEY -> String -> String -> IO ()
-	, regNotifyChangeKeyValue -- :: HKEY -> Bool -> RegNotifyOptions
-				  -- -> HANDLE -> Bool -> IO ()
-	, regOpenKey         -- :: HKEY -> String -> IO HKEY
-	, regOpenKeyEx 	     -- :: HKEY -> String -> REGSAM -> IO HKEY
-	, regQueryInfoKey    -- :: HKEY -> IO RegInfoKey
-	, regQueryValue      -- :: HKEY -> Maybe String -> IO String
-	, regQueryValueKey   -- :: HKEY -> Maybe String -> IO String
-	, regQueryValueEx    -- :: HKEY -> String -> Addr -> Int -> IO RegValueType
-	, regReplaceKey      -- :: HKEY -> String -> String -> String -> IO ()
-	, regRestoreKey      -- :: HKEY -> String -> RegRestoreFlags -> IO ()
-	, regSaveKey         -- :: HKEY -> String -> Maybe LPSECURITY_ATTRIBUTES -> IO ()
-	, regSetValue        -- :: HKEY -> String -> String -> IO ()
-	, regSetValueEx      -- :: HKEY -> String -> RegValueType -> LPTSTR -> Int -> IO ()
-	, regSetStringValue  -- :: HKEY -> String -> String -> IO ()
-	, regUnloadKey       -- :: HKEY -> String -> IO ()
-	) where
+        , regDeleteValue     -- :: HKEY -> String -> IO ()
+        , regEnumKeys        -- :: HKEY -> IO [String]
+        , regEnumKey         -- :: HKEY -> DWORD -> Addr -> DWORD -> IO String
+        , regEnumKeyValue    -- :: HKEY -> DWORD -> Addr -> DWORD -> Addr -> DWORD -> IO String
+        , regFlushKey        -- :: HKEY -> IO ()
+        , regLoadKey         -- :: HKEY -> String -> String -> IO ()
+        , regNotifyChangeKeyValue -- :: HKEY -> Bool -> RegNotifyOptions
+                                  -- -> HANDLE -> Bool -> IO ()
+        , regOpenKey         -- :: HKEY -> String -> IO HKEY
+        , regOpenKeyEx       -- :: HKEY -> String -> REGSAM -> IO HKEY
+        , regQueryInfoKey    -- :: HKEY -> IO RegInfoKey
+        , regQueryValue      -- :: HKEY -> Maybe String -> IO String
+        , regQueryValueKey   -- :: HKEY -> Maybe String -> IO String
+        , regQueryValueEx    -- :: HKEY -> String -> Addr -> Int -> IO RegValueType
+        , regReplaceKey      -- :: HKEY -> String -> String -> String -> IO ()
+        , regRestoreKey      -- :: HKEY -> String -> RegRestoreFlags -> IO ()
+        , regSaveKey         -- :: HKEY -> String -> Maybe LPSECURITY_ATTRIBUTES -> IO ()
+        , regSetValue        -- :: HKEY -> String -> String -> IO ()
+        , regSetValueEx      -- :: HKEY -> String -> RegValueType -> LPTSTR -> Int -> IO ()
+        , regSetStringValue  -- :: HKEY -> String -> String -> IO ()
+        , regUnloadKey       -- :: HKEY -> String -> IO ()
+        ) where
 -}
 
 {-
@@ -217,10 +217,10 @@
        else do
 
         val <-
-	   case ty of
-	     x | x == rEG_SZ    -> peekTString (castPtr valbuf)
-	       | x == rEG_DWORD -> peekElemOff (castPtr valbuf) 0 >>= \ v -> return (show (v :: DWORD))
-	       | otherwise      -> return "<<unknown>>"
+           case ty of
+             x | x == rEG_SZ    -> peekTString (castPtr valbuf)
+               | x == rEG_DWORD -> peekElemOff (castPtr valbuf) 0 >>= \ v -> return (show (v :: DWORD))
+               | otherwise      -> return "<<unknown>>"
 
         vs <- go (n+1) nmbuf nmlen valbuf vallen
         return ((nm,val,ty):vs)
diff --git a/System/Win32/Types.hs b/System/Win32/Types.hs
--- a/System/Win32/Types.hs
+++ b/System/Win32/Types.hs
@@ -16,9 +16,9 @@
 -----------------------------------------------------------------------------
 
 module System.Win32.Types
-	( module System.Win32.Types
-	, nullPtr
-	) where
+        ( module System.Win32.Types
+        , nullPtr
+        ) where
 
 import Control.Exception (throwIO)
 import Data.Bits (shiftL, shiftR, (.|.), (.&.))
diff --git a/Win32.cabal b/Win32.cabal
--- a/Win32.cabal
+++ b/Win32.cabal
@@ -1,5 +1,5 @@
 name:		Win32
-version:	2.3.1.0
+version:	2.3.1.1
 license:	BSD3
 license-file:	LICENSE
 author:		Alastair Reid
