packages feed

Win32 2.2.1.0 → 2.2.2.0

raw patch · 39 files changed

+176/−29 lines, 39 filesdep ~basePVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: base

API changes (from Hackage documentation)

+ System.Win32.File: failIfFalseWithRetry_ :: String -> IO Bool -> IO ()
+ System.Win32.File: failIfWithRetry :: (a -> Bool) -> String -> IO a -> IO a
+ System.Win32.File: failIfWithRetry_ :: (a -> Bool) -> String -> IO a -> IO ()
- System.Win32.Types: failIfZero :: Num a => String -> IO a -> IO a
+ System.Win32.Types: failIfZero :: (Eq a, Num a) => String -> IO a -> IO a
- System.Win32.Types: numToMaybe :: Num a => a -> Maybe a
+ System.Win32.Types: numToMaybe :: (Eq a, Num a) => a -> Maybe a

Files

Graphics/Win32.hs view
@@ -1,3 +1,6 @@+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- | -- Module      :  Graphics.Win32
Graphics/Win32/Control.hsc view
@@ -1,3 +1,6 @@+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- | -- Module      :  Graphics.Win32.Control
Graphics/Win32/Dialogue.hsc view
@@ -1,3 +1,6 @@+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- | -- Module      :  Graphics.Win32.Dialogue
Graphics/Win32/GDI.hs view
@@ -1,3 +1,6 @@+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- | -- Module      :  Graphics.Win32.GDI
Graphics/Win32/GDI/Bitmap.hsc view
@@ -1,3 +1,6 @@+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- | -- Module      :  Graphics.Win32.GDI.Bitmap
Graphics/Win32/GDI/Brush.hsc view
@@ -1,3 +1,6 @@+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- | -- Module      :  Graphics.Win32.GDI.Brush
Graphics/Win32/GDI/Clip.hsc view
@@ -1,3 +1,6 @@+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- | -- Module      :  Graphics.Win32.GDI.Clip
Graphics/Win32/GDI/Font.hsc view
@@ -1,3 +1,6 @@+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- | -- Module      :  Graphics.Win32.GDI.Font
Graphics/Win32/GDI/Graphics2D.hs view
@@ -1,3 +1,6 @@+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- | -- Module      :  Graphics.Win32.GDI.Graphics2D
Graphics/Win32/GDI/HDC.hs view
@@ -1,3 +1,6 @@+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- | -- Module      :  Graphics.Win32.GDI.HDC
Graphics/Win32/GDI/Palette.hsc view
@@ -1,3 +1,6 @@+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- | -- Module      :  Graphics.Win32.GDI.Palette
Graphics/Win32/GDI/Path.hs view
@@ -1,3 +1,6 @@+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- | -- Module      :  Graphics.Win32.GDI.Path
Graphics/Win32/GDI/Pen.hsc view
@@ -1,3 +1,6 @@+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- | -- Module      :  Graphics.Win32.GDI.Pen
Graphics/Win32/GDI/Region.hs view
@@ -1,3 +1,6 @@+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- | -- Module      :  Graphics.Win32.GDI.Region
Graphics/Win32/GDI/Types.hsc view
@@ -1,3 +1,6 @@+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- | -- Module      :  Graphics.Win32.GDI.Types
Graphics/Win32/Icon.hs view
@@ -1,3 +1,6 @@+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- | -- Module      :  Graphics.Win32.Icon
Graphics/Win32/Key.hsc view
@@ -1,3 +1,6 @@+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- | -- Module      :  Graphics.Win32.Key
Graphics/Win32/Menu.hsc view
@@ -1,3 +1,6 @@+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- | -- Module      :  Graphics.Win32.Menu
Graphics/Win32/Message.hsc view
@@ -1,3 +1,6 @@+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- | -- Module      :  Graphics.Win32.Message
Graphics/Win32/Misc.hsc view
@@ -1,3 +1,6 @@+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- | -- Module      :  Graphics.Win32.Misc
Graphics/Win32/Resource.hsc view
@@ -1,3 +1,6 @@+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- | -- Module      :  Graphics.Win32.Resource
Graphics/Win32/Window.hsc view
@@ -1,3 +1,6 @@+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- | -- Module      :  Graphics.Win32.Window
System/Win32.hs view
@@ -1,3 +1,6 @@+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- | -- Module      :  System.Win32
System/Win32/Console.hsc view
@@ -1,3 +1,6 @@+#if __GLASGOW_HASKELL__ >= 701
+{-# LANGUAGE Trustworthy #-}
+#endif
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  System.Win32.Console
System/Win32/DLL.hsc view
@@ -1,3 +1,6 @@+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- | -- Module      :  System.Win32.DLL
System/Win32/DebugApi.hsc view
@@ -1,3 +1,6 @@+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- | -- Module      :  System.Win32.DebugApi
System/Win32/File.hsc view
@@ -1,3 +1,6 @@+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- | -- Module      :  System.Win32.File@@ -24,7 +27,9 @@ import System.Win32.Types import System.Win32.Time -import Foreign+import Foreign hiding (void)+import Control.Monad+import Control.Concurrent  #include <windows.h> @@ -252,11 +257,41 @@ -- File operations ---------------------------------------------------------------- +-- | like failIfFalse_, but retried on sharing violations.+-- This is necessary for many file operations; see+--   http://support.microsoft.com/kb/316609+--+failIfWithRetry :: (a -> Bool) -> String -> IO a -> IO a+failIfWithRetry cond msg action = retryOrFail retries+  where+    delay   = 100*1000 -- in ms, we use threadDelay+    retries = 20 :: Int+      -- KB article recommends 250/5++    -- retryOrFail :: Int -> IO a+    retryOrFail times+      | times <= 0 = errorWin msg+      | otherwise  = do+         ret <- action+         if not (cond ret)+            then return ret+            else do+              err_code <- getLastError+              if err_code == (# const ERROR_SHARING_VIOLATION)+                then do threadDelay delay; retryOrFail (times - 1)+                else errorWin msg++failIfWithRetry_ :: (a -> Bool) -> String -> IO a -> IO ()+failIfWithRetry_ cond msg action = void $ failIfWithRetry cond msg action++failIfFalseWithRetry_ :: String -> IO Bool -> IO ()+failIfFalseWithRetry_ = failIfWithRetry_ not+ deleteFile :: String -> IO () deleteFile name =   withTString name $ \ c_name ->-  failIfFalse_ (unwords ["DeleteFile",show name]) $-    c_DeleteFile c_name+    failIfFalseWithRetry_ (unwords ["DeleteFile",show name]) $+      c_DeleteFile c_name foreign import stdcall unsafe "windows.h DeleteFileW"   c_DeleteFile :: LPCTSTR -> IO Bool @@ -264,7 +299,7 @@ copyFile src dest over =   withTString src $ \ c_src ->   withTString dest $ \ c_dest ->-  failIfFalse_ (unwords ["CopyFile",show src,show dest]) $+  failIfFalseWithRetry_ (unwords ["CopyFile",show src,show dest]) $     c_CopyFile c_src c_dest over foreign import stdcall unsafe "windows.h CopyFileW"   c_CopyFile :: LPCTSTR -> LPCTSTR -> Bool -> IO Bool@@ -273,7 +308,7 @@ moveFile src dest =   withTString src $ \ c_src ->   withTString dest $ \ c_dest ->-  failIfFalse_ (unwords ["MoveFile",show src,show dest]) $+  failIfFalseWithRetry_ (unwords ["MoveFile",show src,show dest]) $     c_MoveFile c_src c_dest foreign import stdcall unsafe "windows.h MoveFileW"   c_MoveFile :: LPCTSTR -> LPCTSTR -> IO Bool@@ -282,7 +317,7 @@ moveFileEx src dest flags =   withTString src $ \ c_src ->   withTString dest $ \ c_dest ->-  failIfFalse_ (unwords ["MoveFileEx",show src,show dest]) $+  failIfFalseWithRetry_ (unwords ["MoveFileEx",show src,show dest]) $     c_MoveFileEx c_src c_dest flags foreign import stdcall unsafe "windows.h MoveFileExW"   c_MoveFileEx :: LPCTSTR -> LPCTSTR -> MoveFileFlag -> IO Bool@@ -298,7 +333,7 @@ createDirectory :: String -> Maybe LPSECURITY_ATTRIBUTES -> IO () createDirectory name mb_attr =   withTString name $ \ c_name ->-  failIfFalse_ (unwords ["CreateDirectory",show name]) $+  failIfFalseWithRetry_ (unwords ["CreateDirectory",show name]) $     c_CreateDirectory c_name (maybePtr mb_attr) foreign import stdcall unsafe "windows.h CreateDirectoryW"   c_CreateDirectory :: LPCTSTR -> LPSECURITY_ATTRIBUTES -> IO Bool@@ -307,7 +342,7 @@ createDirectoryEx template name mb_attr =   withTString template $ \ c_template ->   withTString name $ \ c_name ->-  failIfFalse_ (unwords ["CreateDirectoryEx",show template,show name]) $+  failIfFalseWithRetry_ (unwords ["CreateDirectoryEx",show template,show name]) $     c_CreateDirectoryEx c_template c_name (maybePtr mb_attr) foreign import stdcall unsafe "windows.h CreateDirectoryExW"   c_CreateDirectoryEx :: LPCTSTR -> LPCTSTR -> LPSECURITY_ATTRIBUTES -> IO Bool@@ -315,7 +350,7 @@ removeDirectory :: String -> IO () removeDirectory name =   withTString name $ \ c_name ->-  failIfFalse_ (unwords ["RemoveDirectory",show name]) $+  failIfFalseWithRetry_ (unwords ["RemoveDirectory",show name]) $     c_RemoveDirectory c_name foreign import stdcall unsafe "windows.h RemoveDirectoryW"   c_RemoveDirectory :: LPCTSTR -> IO Bool@@ -337,7 +372,7 @@ createFile :: String -> AccessMode -> ShareMode -> Maybe LPSECURITY_ATTRIBUTES -> CreateMode -> FileAttributeOrFlag -> Maybe HANDLE -> IO HANDLE createFile name access share mb_attr mode flag mb_h =   withTString name $ \ c_name ->-  failIf (==iNVALID_HANDLE_VALUE) (unwords ["CreateFile",show name]) $+  failIfWithRetry (==iNVALID_HANDLE_VALUE) (unwords ["CreateFile",show name]) $     c_CreateFile c_name access share (maybePtr mb_attr) mode flag (maybePtr mb_h) foreign import stdcall unsafe "windows.h CreateFileW"   c_CreateFile :: LPCTSTR -> AccessMode -> ShareMode -> LPSECURITY_ATTRIBUTES -> CreateMode -> FileAttributeOrFlag -> HANDLE -> IO HANDLE@@ -371,7 +406,7 @@ setFileAttributes :: String -> FileAttributeOrFlag -> IO () setFileAttributes name attr =   withTString name $ \ c_name ->-  failIfFalse_ (unwords ["SetFileAttributes",show name])+  failIfFalseWithRetry_ (unwords ["SetFileAttributes",show name])     $ c_SetFileAttributes c_name attr foreign import stdcall unsafe "windows.h SetFileAttributesW"   c_SetFileAttributes :: LPCTSTR -> FileAttributeOrFlag -> IO Bool@@ -379,14 +414,14 @@ getFileAttributes :: String -> IO FileAttributeOrFlag getFileAttributes name =   withTString name $ \ c_name ->-  failIf (== 0xFFFFFFFF) (unwords ["GetFileAttributes",show name]) $+  failIfWithRetry (== 0xFFFFFFFF) (unwords ["GetFileAttributes",show name]) $     c_GetFileAttributes c_name foreign import stdcall unsafe "windows.h GetFileAttributesW"   c_GetFileAttributes :: LPCTSTR -> IO FileAttributeOrFlag  getFileInformationByHandle :: HANDLE -> IO BY_HANDLE_FILE_INFORMATION getFileInformationByHandle h = alloca $ \res -> do-    failIfFalse_ "GetFileInformationByHandle" $ c_GetFileInformationByHandle h res+    failIfFalseWithRetry_ "GetFileInformationByHandle" $ c_GetFileInformationByHandle h res     peek res foreign import stdcall unsafe "windows.h GetFileInformationByHandle"     c_GetFileInformationByHandle :: HANDLE -> Ptr BY_HANDLE_FILE_INFORMATION -> IO BOOL
System/Win32/FileMapping.hsc view
@@ -1,3 +1,6 @@+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- | -- Module      :  System.Win32.FileMapping
System/Win32/Info.hsc view
@@ -1,3 +1,6 @@+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- | -- Module      :  System.Win32.Info
System/Win32/Mem.hsc view
@@ -1,3 +1,6 @@+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- | -- Module      :  System.Win32.Mem
System/Win32/NLS.hsc view
@@ -1,3 +1,6 @@+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- | -- Module      :  System.Win32.NLS
System/Win32/Process.hsc view
@@ -1,3 +1,6 @@+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- | -- Module      :  System.Win32.Process
System/Win32/Registry.hsc view
@@ -1,3 +1,6 @@+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- | -- Module      :  System.Win32.Registry
System/Win32/Security.hsc view
@@ -1,3 +1,13 @@+{-# OPTIONS_GHC -w #-}+-- The above warning supression flag is a temporary kludge.+-- While working on this module you are encouraged to remove it and fix+-- any warnings in the module. See+--     http://hackage.haskell.org/trac/ghc/wiki/WorkingConventions#Warnings+-- for details++#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- | -- Module      :  System.Win32.Security@@ -11,13 +21,6 @@ -- FFI-bindings to interact with Win32 Security -- -------------------------------------------------------------------------------{-# OPTIONS_GHC -w #-}--- The above warning supression flag is a temporary kludge.--- While working on this module you are encouraged to remove it and fix--- any warnings in the module. See---     http://hackage.haskell.org/trac/ghc/wiki/WorkingConventions#Warnings--- for details  module System.Win32.Security (          -- * Types
System/Win32/Shell.hsc view
@@ -1,3 +1,6 @@+#if __GLASGOW_HASKELL__ >= 701
+{-# LANGUAGE Trustworthy #-}
+#endif
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  System.Win32.Shell
System/Win32/SimpleMAPI.hsc view
@@ -1,3 +1,6 @@+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- | -- Module      :  System.Win32.SimpleMAPI
System/Win32/Time.hsc view
@@ -1,3 +1,6 @@+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- | -- Module      :  System.Win32.Time@@ -23,7 +26,7 @@                                    pokeByteOff, poke)                         , Ptr, nullPtr, castPtr, plusPtr, advancePtr                         , with, alloca, allocaBytes, copyArray )-import Foreign.C        ( CInt, CWchar+import Foreign.C        ( CInt(..), CWchar(..)                         , peekCWString, withCWStringLen, withCWString )  #include "windows.h"
System/Win32/Types.hs view
@@ -1,3 +1,6 @@+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Trustworthy #-}+#endif ----------------------------------------------------------------------------- -- | -- Module      :  System.Win32.Types@@ -94,7 +97,7 @@ maybeNum :: Num a => Maybe a -> a maybeNum = fromMaybe 0 -numToMaybe :: Num a => a -> Maybe a+numToMaybe :: (Eq a, Num a) => a -> Maybe a numToMaybe n = if n == 0 then Nothing else Just n  type MbLPVOID      = Maybe LPVOID@@ -180,7 +183,7 @@ failIfNull :: String -> IO (Ptr a) -> IO (Ptr a) failIfNull = failIf (== nullPtr) -failIfZero :: Num a => String -> IO a -> IO a+failIfZero :: (Eq a, Num a) => String -> IO a -> IO a failIfZero = failIf (== 0)  failIfFalse_ :: String -> IO Bool -> IO ()
Win32.cabal view
@@ -1,13 +1,15 @@ name:		Win32-version:	2.2.1.0+version:	2.2.2.0 license:	BSD3 license-file:	LICENSE author:		Alastair Reid copyright:	Alastair Reid, 1999-2003-maintainer:	Esa Ilari Vuokko <ei@vuokko.info>-bug-reports: http://hackage.haskell.org/trac/ghc/newticket?component=libraries%20%28other%29+maintainer:	Bryan O'Sullivan <bos@serpentine.com>+bug-reports:    https://github.com/haskell/win32/issues+homepage:       https://github.com/haskell/win32 category:	System, Graphics synopsis:	A binding to part of the Win32 library+description:	A binding to part of the Win32 library. build-type:     Simple cabal-version:  >=1.6 extra-source-files:@@ -57,7 +59,7 @@         System.Win32.Security         System.Win32.Types         System.Win32.Shell-    extensions: ForeignFunctionInterface+    extensions: ForeignFunctionInterface, CPP     if impl(ghc >= 7.1)         extensions: NondecreasingIndentation     extra-libraries:@@ -76,5 +78,4 @@  source-repository head     type:     git-    location: http://darcs.haskell.org/packages/Win32.git/-+    location: git://github.com/haskell/win32