diff --git a/System/Win32/Types.hs b/System/Win32/Types.hs
--- a/System/Win32/Types.hs
+++ b/System/Win32/Types.hs
@@ -23,6 +23,7 @@
 import Control.Exception
 import System.IO.Error
 import Data.Char
+import Numeric (showHex)
 
 ----------------------------------------------------------------
 -- Platform specific definitions
@@ -204,9 +205,12 @@
 failWith :: String -> ErrCode -> IO a
 failWith fn_name err_code = do
   c_msg <- getErrorMessage err_code
-  msg <- peekTString c_msg
-  -- We ignore failure of freeing c_msg, given we're already failing
-  _ <- localFree c_msg
+  msg <- if c_msg == nullPtr
+           then return $ "Error 0x" ++ Numeric.showHex err_code ""
+           else do msg <- peekTString c_msg
+                   -- We ignore failure of freeing c_msg, given we're already failing
+                   _ <- localFree c_msg
+                   return msg
   c_maperrno -- turn GetLastError() into errno, which errnoToIOError knows
              -- how to convert to an IOException we can throw.
              -- XXX we should really do this directly.
@@ -215,6 +219,7 @@
       ioerror = errnoToIOError fn_name errno Nothing Nothing
                   `ioeSetErrorString` msg'
   throw ioerror
+
 
 foreign import ccall unsafe "maperrno" -- in base/cbits/Win32Utils.c
    c_maperrno :: IO ()
diff --git a/Win32.cabal b/Win32.cabal
--- a/Win32.cabal
+++ b/Win32.cabal
@@ -1,5 +1,5 @@
 name:		Win32
-version:	2.2.0.1
+version:	2.2.0.2
 license:	BSD3
 license-file:	LICENSE
 author:		Alastair Reid
