diff --git a/Bundled/Posix.hsc b/Bundled/Posix.hsc
--- a/Bundled/Posix.hsc
+++ b/Bundled/Posix.hsc
@@ -10,7 +10,6 @@
 import Data.ByteString.Unsafe( unsafeUseAsCString )
 import Foreign.Marshal.Alloc ( allocaBytes )
 import Foreign.C.Error ( throwErrno, getErrno, eNOENT )
-import Foreign.C.String ( withCString )
 import Foreign.C.Types ( CTime, CInt )
 import Foreign.Ptr ( Ptr )
 
@@ -20,6 +19,12 @@
 
 import System.Posix.Types ( Fd(..), CMode, EpochTime )
 
+#if mingw32_HOST_OS && __GLASGOW_HASKELL__ >= 612
+import Foreign.C.String( withCWString )
+#else
+import Foreign.C.String ( withCString )
+#endif
+
 #if mingw32_HOST_OS
 import Data.Int ( Int64 )
 
@@ -30,6 +35,14 @@
 import System.Posix.Internals( lstat )
 #endif
 
+#if mingw32_HOST_OS && __GLASGOW_HASKELL__ >= 612
+bsToPath s f = withCWString (BS.unpack s) f
+strToPath = withCWString
+#else
+bsToPath = unsafeUseAsCString
+strToPath = withCString
+#endif
+
 data FileStatus = FileStatus {
     fst_exists :: !Bool,
     fst_mode :: !CMode,
@@ -78,15 +91,15 @@
 getSymbolicLinkStatus = getFileStatus
 ##else
 getSymbolicLinkStatus fp =
-  do_stat (\p -> (fp `withCString` (`lstat` p)))
+  do_stat (\p -> (fp `strToPath` (`lstat` p)))
 ##endif
 
 getFileStatus :: FilePath -> IO FileStatus
 getFileStatus fp =
-  do_stat (\p -> (fp `withCString` (`lstat` p)))
+  do_stat (\p -> (fp `strToPath` (`lstat` p)))
 
 -- | Requires NULL-terminated bytestring -> unsafe! Use with care.
 getFileStatusBS :: BS.ByteString -> IO FileStatus
 getFileStatusBS fp =
-  do_stat (\p -> (fp `unsafeUseAsCString` (`lstat` p)))
+  do_stat (\p -> (fp `bsToPath` (`lstat` p)))
 {-# INLINE getFileStatusBS #-}
diff --git a/hashed-storage.cabal b/hashed-storage.cabal
--- a/hashed-storage.cabal
+++ b/hashed-storage.cabal
@@ -1,5 +1,5 @@
 name:          hashed-storage
-version:       0.4.12
+version:       0.4.13
 synopsis:      Hashed file storage support code.
 
 description:   Support code for reading and manipulating hashed file storage
