packages feed

Win32 2.5.3.0 → 2.5.4.0

raw patch · 13 files changed

+80/−55 lines, 13 filesdep +unbuildablePVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependencies added: unbuildable

API changes (from Hackage documentation)

+ System.Win32.Types: nullHINSTANCE :: HINSTANCE
- Graphics.Win32.Menu: appendMenu :: HMENU -> MenuFlag -> MenuID -> String -> IO ()
+ Graphics.Win32.Menu: appendMenu :: HMENU -> MenuFlag -> MenuID -> Maybe String -> IO ()
- Graphics.Win32.Menu: insertMenu :: HMENU -> MenuItem -> MenuFlag -> MenuID -> String -> IO ()
+ Graphics.Win32.Menu: insertMenu :: HMENU -> MenuItem -> MenuFlag -> MenuID -> Maybe String -> IO ()
- Graphics.Win32.Menu: modifyMenu :: HMENU -> MenuItem -> MenuFlag -> MenuID -> String -> IO ()
+ Graphics.Win32.Menu: modifyMenu :: HMENU -> MenuItem -> MenuFlag -> MenuID -> Maybe String -> IO ()
- Graphics.Win32.Misc: messageBox :: HWND -> String -> String -> MBStyle -> IO MBStatus
+ Graphics.Win32.Misc: messageBox :: Maybe HWND -> String -> String -> MBStyle -> IO MBStatus
- Graphics.Win32.Window: findWindow :: String -> String -> IO (Maybe HWND)
+ Graphics.Win32.Window: findWindow :: Maybe String -> Maybe String -> IO (Maybe HWND)
- Graphics.Win32.Window: findWindowEx :: HWND -> HWND -> String -> String -> IO (Maybe HWND)
+ Graphics.Win32.Window: findWindowEx :: Maybe HWND -> Maybe HWND -> Maybe String -> Maybe String -> IO (Maybe HWND)
- System.Win32.DLL: setDllDirectory :: String -> IO ()
+ System.Win32.DLL: setDllDirectory :: Maybe String -> IO ()
- System.Win32.File: defineDosDevice :: DefineDosDeviceFlags -> String -> String -> IO ()
+ System.Win32.File: defineDosDevice :: DefineDosDeviceFlags -> String -> Maybe String -> IO ()
- System.Win32.File: moveFileEx :: String -> String -> MoveFileFlag -> IO ()
+ System.Win32.File: moveFileEx :: String -> Maybe String -> MoveFileFlag -> IO ()
- System.Win32.File: setVolumeLabel :: String -> String -> IO ()
+ System.Win32.File: setVolumeLabel :: Maybe String -> Maybe String -> IO ()
- System.Win32.Info: searchPath :: Maybe String -> FilePath -> String -> IO (Maybe FilePath)
+ System.Win32.Info: searchPath :: Maybe String -> FilePath -> Maybe String -> IO (Maybe FilePath)
- System.Win32.Registry: regCreateKeyEx :: HKEY -> String -> String -> RegCreateOptions -> REGSAM -> Maybe LPSECURITY_ATTRIBUTES -> IO (HKEY, Bool)
+ System.Win32.Registry: regCreateKeyEx :: HKEY -> String -> Maybe String -> RegCreateOptions -> REGSAM -> Maybe LPSECURITY_ATTRIBUTES -> IO (HKEY, Bool)
- System.Win32.Registry: regQueryValue :: HKEY -> Maybe String -> IO String
+ System.Win32.Registry: regQueryValue :: HKEY -> String -> IO String
- System.Win32.Registry: regQueryValueKey :: HKEY -> Maybe String -> IO String
+ System.Win32.Registry: regQueryValueKey :: HKEY -> String -> IO String
- System.Win32.Registry: regReplaceKey :: HKEY -> String -> String -> String -> IO ()
+ System.Win32.Registry: regReplaceKey :: HKEY -> Maybe String -> String -> String -> IO ()
- System.Win32.Time: getTimeFormat :: LCID -> GetTimeFormatFlags -> SYSTEMTIME -> String -> IO String
+ System.Win32.Time: getTimeFormat :: LCID -> GetTimeFormatFlags -> Maybe SYSTEMTIME -> Maybe String -> IO String

Files

Graphics/Win32/LayeredWindow.hsc view
@@ -52,8 +52,13 @@ foreign import WINDOWS_CCONV unsafe "windows.h UpdateLayeredWindow"
   c_UpdateLayeredWindow :: HANDLE -> HDC -> Ptr POINT -> Ptr SIZE ->  HDC -> Ptr POINT -> COLORREF -> Ptr BLENDFUNCTION -> DWORD -> IO BOOL
 
+#if defined(x86_64_HOST_ARCH)
 foreign import WINDOWS_CCONV "windows.h GetWindowLongPtrW"
   c_GetWindowLongPtr :: HANDLE -> INT -> IO LONG_PTR
+#else
+foreign import WINDOWS_CCONV "windows.h GetWindowLongW"
+  c_GetWindowLongPtr :: HANDLE -> INT -> IO LONG_PTR
+#endif
 
 #{enum DWORD,
  , uLW_ALPHA    = ULW_ALPHA
Graphics/Win32/Menu.hsc view
@@ -446,23 +446,23 @@ -- Note: these 3 assume the flags don't include MF_BITMAP or MF_OWNERDRAW -- (which are hidden by this interface) -appendMenu :: HMENU -> MenuFlag -> MenuID -> String -> IO ()+appendMenu :: HMENU -> MenuFlag -> MenuID -> Maybe String -> IO () appendMenu menu flags id_item name =-  withTString name $ \ c_name ->+  maybeWith withTString name $ \ c_name ->   failIfFalse_ "AppendMenu" $ c_AppendMenu menu flags id_item c_name foreign import WINDOWS_CCONV unsafe "windows.h AppendMenuW"   c_AppendMenu :: HMENU -> UINT -> MenuID -> LPCTSTR -> IO Bool -insertMenu :: HMENU -> MenuItem -> MenuFlag -> MenuID -> String -> IO ()+insertMenu :: HMENU -> MenuItem -> MenuFlag -> MenuID -> Maybe String -> IO () insertMenu menu item flags id_item name =-  withTString name $ \ c_name ->+  maybeWith withTString name $ \ c_name ->   failIfFalse_ "InsertMenu" $ c_InsertMenu menu item flags id_item c_name foreign import WINDOWS_CCONV unsafe "windows.h InsertMenuW"   c_InsertMenu :: HMENU -> UINT -> UINT -> MenuID -> LPCTSTR -> IO Bool -modifyMenu :: HMENU -> MenuItem -> MenuFlag -> MenuID -> String -> IO ()+modifyMenu :: HMENU -> MenuItem -> MenuFlag -> MenuID -> Maybe String -> IO () modifyMenu menu item flags id_item name =-  withTString name $ \ c_name ->+  maybeWith withTString name $ \ c_name ->   failIfFalse_ "ModifyMenu" $ c_ModifyMenu menu item flags id_item c_name foreign import WINDOWS_CCONV unsafe "windows.h ModifyMenuW"   c_ModifyMenu :: HMENU -> UINT -> UINT -> MenuID -> LPCTSTR -> IO Bool
Graphics/Win32/Misc.hsc view
@@ -128,11 +128,11 @@  -- Note: if the error is ever raised, we're in a very sad way! -messageBox :: HWND -> String -> String -> MBStyle -> IO MBStatus+messageBox :: Maybe HWND -> String -> String -> MBStyle -> IO MBStatus messageBox wnd text caption style =   withTString text $ \ c_text ->   withTString caption $ \ c_caption ->-  failIfZero "MessageBox" $ c_MessageBox wnd c_text c_caption style+  failIfZero "MessageBox" $ c_MessageBox (maybePtr wnd) c_text c_caption style foreign import WINDOWS_CCONV safe "windows.h MessageBoxW"   c_MessageBox :: HWND -> LPCTSTR -> LPCTSTR -> MBStyle -> IO MBStatus 
Graphics/Win32/Window.hsc view
@@ -23,6 +23,7 @@ import Data.Maybe (fromMaybe) import Data.Int (Int32) import Foreign.ForeignPtr (withForeignPtr)+import Foreign.Marshal.Utils (maybeWith) import Foreign.Marshal.Alloc (allocaBytes) import Foreign.Ptr (FunPtr, Ptr, castFunPtrToPtr, castPtr, nullPtr) import Foreign.Storable (pokeByteOff)@@ -474,24 +475,24 @@ foreign import WINDOWS_CCONV unsafe "windows.h EndDeferWindowPos"   c_EndDeferWindowPos :: HDWP -> IO Bool -findWindow :: String -> String -> IO (Maybe HWND)+findWindow :: Maybe String -> Maybe String -> IO (Maybe HWND) findWindow cname wname =-  withTString cname $ \ c_cname ->-  withTString wname $ \ c_wname ->+  maybeWith withTString cname $ \ c_cname ->+  maybeWith withTString wname $ \ c_wname ->   liftM ptrToMaybe $ c_FindWindow c_cname c_wname +{-# DEPRECATED findWindowByName "Use 'findWindow Nothing' instead." #-} findWindowByName :: String -> IO (Maybe HWND)-findWindowByName wname = withTString wname $ \ c_wname ->-  liftM ptrToMaybe $ c_FindWindow nullPtr c_wname+findWindowByName wname = findWindow Nothing $ Just wname  foreign import WINDOWS_CCONV unsafe "windows.h FindWindowW"   c_FindWindow :: LPCTSTR -> LPCTSTR -> IO HWND -findWindowEx :: HWND -> HWND -> String -> String -> IO (Maybe HWND)+findWindowEx :: Maybe HWND -> Maybe HWND -> Maybe String -> Maybe String -> IO (Maybe HWND) findWindowEx parent after cname wname =-  withTString cname $ \ c_cname ->-  withTString wname $ \ c_wname ->-  liftM ptrToMaybe $ c_FindWindowEx parent after c_cname c_wname+  maybeWith withTString cname $ \ c_cname ->+  maybeWith withTString wname $ \ c_wname ->+  liftM ptrToMaybe $ c_FindWindowEx (maybePtr parent) (maybePtr after) c_cname c_wname foreign import WINDOWS_CCONV unsafe "windows.h FindWindowExW"   c_FindWindowEx :: HWND -> HWND -> LPCTSTR -> LPCTSTR -> IO HWND 
System/Win32/DLL.hsc view
@@ -23,6 +23,7 @@  import Foreign import Foreign.C+import Data.Maybe (fromMaybe)  ##include "windows_cconv.h" @@ -87,10 +88,10 @@ foreign import WINDOWS_CCONV unsafe "windows.h LoadLibraryExW"   c_LoadLibraryEx :: LPCTSTR -> HANDLE -> LoadLibraryFlags -> IO HINSTANCE -setDllDirectory :: String -> IO ()+setDllDirectory :: Maybe String -> IO () setDllDirectory name =-  withTString name $ \ c_name ->-  failIfFalse_ (unwords ["SetDllDirectory", name]) $ c_SetDllDirectory c_name+  maybeWith withTString name $ \ c_name ->+  failIfFalse_ (unwords ["SetDllDirectory", fromMaybe "NULL" name]) $ c_SetDllDirectory c_name  foreign import WINDOWS_CCONV unsafe "windows.h SetDllDirectoryW"   c_SetDllDirectory :: LPTSTR -> IO BOOL
System/Win32/File.hsc view
@@ -376,10 +376,10 @@ foreign import WINDOWS_CCONV unsafe "windows.h MoveFileW"   c_MoveFile :: LPCTSTR -> LPCTSTR -> IO Bool -moveFileEx :: String -> String -> MoveFileFlag -> IO ()+moveFileEx :: String -> Maybe String -> MoveFileFlag -> IO () moveFileEx src dest flags =   withTString src $ \ c_src ->-  withTString dest $ \ c_dest ->+  maybeWith withTString dest $ \ c_dest ->   failIfFalseWithRetry_ (unwords ["MoveFileEx",show src,show dest]) $     c_MoveFileEx c_src c_dest flags foreign import WINDOWS_CCONV unsafe "windows.h MoveFileExW"@@ -609,9 +609,9 @@ -- DOS Device flags ---------------------------------------------------------------- -defineDosDevice :: DefineDosDeviceFlags -> String -> String -> IO ()+defineDosDevice :: DefineDosDeviceFlags -> String -> Maybe String -> IO () defineDosDevice flags name path =-  withTString path $ \ c_path ->+  maybeWith withTString path $ \ c_path ->   withTString name $ \ c_name ->   failIfFalse_ "DefineDosDevice" $ c_DefineDosDevice flags c_name c_path foreign import WINDOWS_CCONV unsafe "windows.h DefineDosDeviceW"@@ -661,10 +661,10 @@ foreign import WINDOWS_CCONV unsafe "windows.h GetDiskFreeSpaceW"   c_GetDiskFreeSpace :: LPCTSTR -> Ptr DWORD -> Ptr DWORD -> Ptr DWORD -> Ptr DWORD -> IO Bool -setVolumeLabel :: String -> String -> IO ()+setVolumeLabel :: Maybe String -> Maybe String -> IO () setVolumeLabel path name =-  withTString path $ \ c_path ->-  withTString name $ \ c_name ->+  maybeWith withTString path $ \ c_path ->+  maybeWith withTString name $ \ c_name ->   failIfFalse_ "SetVolumeLabel" $ c_SetVolumeLabel c_path c_name foreign import WINDOWS_CCONV unsafe "windows.h SetVolumeLabelW"   c_SetVolumeLabel :: LPCTSTR -> LPCTSTR -> IO Bool
System/Win32/HardLink.hs view
@@ -60,10 +60,10 @@       , fileSystemName     :: String
       } deriving Show
 
-getVolumeInformation :: String -> IO VolumeInformation
+getVolumeInformation :: Maybe String -> IO VolumeInformation
 getVolumeInformation drive =
-   withTString drive        $ \c_drive ->
-   withTStringBufferLen 256 $ \(vnBuf, vnLen) ->
+   maybeWith withTString drive $ \c_drive ->
+   withTStringBufferLen 256    $ \(vnBuf, vnLen) ->
    alloca $ \serialNum ->
    alloca $ \maxLen ->
    alloca $ \fsFlags ->
System/Win32/Info.hsc view
@@ -21,7 +21,7 @@  import Control.Exception (catch) import Foreign.Marshal.Alloc (alloca)-import Foreign.Marshal.Utils (with)+import Foreign.Marshal.Utils (with, maybeWith) import Foreign.Marshal.Array (allocaArray) import Foreign.Ptr (Ptr, nullPtr) import Foreign.Storable (Storable(..))@@ -132,11 +132,11 @@     try "getShortPathName"       (c_GetShortPathName c_name) 512 -searchPath :: Maybe String -> FilePath -> String -> IO (Maybe FilePath)+searchPath :: Maybe String -> FilePath -> Maybe String -> IO (Maybe FilePath) searchPath path filename ext =   maybe ($ nullPtr) withTString path $ \p_path ->   withTString filename $ \p_filename ->-  withTString ext      $ \p_ext ->+  maybeWith withTString ext      $ \p_ext ->   alloca $ \ppFilePart -> (do     s <- try "searchPath" (\buf len -> c_SearchPath p_path p_filename p_ext                           len buf ppFilePart) 512
System/Win32/Registry.hsc view
@@ -23,7 +23,7 @@           regCloseKey        -- :: HKEY -> IO ()         , regConnectRegistry -- :: Maybe String -> HKEY -> IO HKEY         , regCreateKey       -- :: HKEY -> String -> IO HKEY-        , regCreateKeyEx     -- :: HKEY -> String -> String+        , regCreateKeyEx     -- :: HKEY -> String -> Maybe String                              -- -> RegCreateOptions -> REGSAM                              -- -> Maybe LPSECURITY_ATTRIBUTES                              -- -> IO (HKEY, Bool)@@ -39,10 +39,10 @@         , 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+        , regQueryValue      -- :: HKEY -> String -> IO String+        , regQueryValueKey   -- :: HKEY -> String -> IO String         , regQueryValueEx    -- :: HKEY -> String -> Addr -> Int -> IO RegValueType-        , regReplaceKey      -- :: HKEY -> String -> String -> String -> IO ()+        , regReplaceKey      -- :: HKEY -> Maybe String -> String -> String -> IO ()         , regRestoreKey      -- :: HKEY -> String -> RegRestoreFlags -> IO ()         , regSaveKey         -- :: HKEY -> String -> Maybe LPSECURITY_ATTRIBUTES -> IO ()         , regSetValue        -- :: HKEY -> String -> String -> IO ()@@ -144,11 +144,11 @@  , kEY_WRITE            = KEY_WRITE  } -regCreateKeyEx :: HKEY -> String -> String -> RegCreateOptions -> REGSAM -> Maybe LPSECURITY_ATTRIBUTES -> IO (HKEY, Bool)+regCreateKeyEx :: HKEY -> String -> Maybe String -> RegCreateOptions -> REGSAM -> Maybe LPSECURITY_ATTRIBUTES -> IO (HKEY, Bool) regCreateKeyEx key subkey cls opts sam mb_attr =   withForeignPtr key $ \ p_key ->   withTString subkey $ \ c_subkey ->-  withTString cls $ \ c_cls ->+  maybeWith withTString cls $ \ c_cls ->   alloca $ \ p_res ->   alloca $ \ p_disp -> do   failUnlessSuccess "RegCreateKeyEx" $@@ -387,10 +387,10 @@ -- (and better!) version of it. If you want RegQueryValue()s -- behaviour, use regQueryValueKey. -regQueryValueKey :: HKEY -> Maybe String -> IO String+regQueryValueKey :: HKEY -> String -> IO String regQueryValueKey key mb_subkey =   withForeignPtr key $ \ p_key ->-  maybeWith withTString mb_subkey $ \ c_subkey ->+  withTString mb_subkey $ \ c_subkey ->   alloca $ \ p_value_len -> do   failUnlessSuccess "RegQueryValue" $     c_RegQueryValue p_key c_subkey nullPtr p_value_len@@ -402,10 +402,10 @@ foreign import WINDOWS_CCONV unsafe "windows.h RegQueryValueW"   c_RegQueryValue :: PKEY -> LPCTSTR -> LPTSTR -> Ptr LONG -> IO ErrCode -regQueryValue :: HKEY -> Maybe String -> IO String+regQueryValue :: HKEY -> String -> IO String regQueryValue key mb_subkey =   withForeignPtr key $ \ p_key ->-  maybeWith withTString mb_subkey $ \ c_subkey ->+  withTString mb_subkey $ \ c_subkey ->   alloca $ \ p_ty ->   alloca $ \ p_value_len -> do   failUnlessSuccess "RegQueryValue" $@@ -430,10 +430,10 @@ foreign import WINDOWS_CCONV unsafe "windows.h RegQueryValueExW"   c_RegQueryValueEx :: PKEY -> LPCTSTR -> Ptr DWORD -> Ptr DWORD -> LPBYTE -> Ptr DWORD -> IO ErrCode -regReplaceKey :: HKEY -> String -> String -> String -> IO ()+regReplaceKey :: HKEY -> Maybe String -> String -> String -> IO () regReplaceKey key subkey newfile oldfile =   withForeignPtr key $ \ p_key ->-  withTString subkey $ \ c_subkey ->+  maybeWith withTString subkey $ \ c_subkey ->   withTString newfile $ \ c_newfile ->   withTString oldfile $ \ c_oldfile ->   failUnlessSuccess "RegReplaceKey" $
System/Win32/Time.hsc view
@@ -30,6 +30,7 @@                         , with, alloca, allocaBytes, copyArray ) import Foreign.C        ( CInt(..), CWchar(..)                         , peekCWString, withCWStringLen, withCWString )+import Foreign.Marshal.Utils (maybeWith)  ##include "windows_cconv.h" #include <windows.h>@@ -305,10 +306,10 @@  foreign import WINDOWS_CCONV "windows.h GetTimeFormatW"     c_GetTimeFormat :: LCID -> GetTimeFormatFlags -> Ptr SYSTEMTIME -> LPCTSTR -> LPTSTR -> CInt -> IO CInt-getTimeFormat :: LCID -> GetTimeFormatFlags -> SYSTEMTIME -> String -> IO String+getTimeFormat :: LCID -> GetTimeFormatFlags -> Maybe SYSTEMTIME -> Maybe String -> IO String getTimeFormat locale flags st fmt =-    with st $ \c_st ->-    withCWString fmt $ \c_fmt -> do+    maybeWith with st $ \c_st ->+    maybeWith withCWString fmt $ \c_fmt -> do         size <- c_GetTimeFormat locale flags c_st c_fmt nullPtr 0         allocaBytes ((fromIntegral size) * (sizeOf (undefined::CWchar))) $ \out -> do             size' <- failIf (==0) "getTimeFormat: GetTimeFormat" $
System/Win32/Types.hsc view
@@ -209,6 +209,9 @@  type MbHANDLE      = Maybe HANDLE +nullHINSTANCE :: HINSTANCE+nullHINSTANCE = nullPtr+ type   HINSTANCE   = Ptr () type MbHINSTANCE   = Maybe HINSTANCE 
Win32.cabal view
@@ -1,9 +1,9 @@ name:		Win32-version:	2.5.3.0+version:	2.5.4.0 license:	BSD3 license-file:	LICENSE-author:		Alastair Reid, shelarcy-copyright:	Alastair Reid, 1999-2003; shelarcy, 2012-2013+author:		Alastair Reid, shelarcy, Tamar Christina+copyright:	Alastair Reid, 1999-2003; shelarcy, 2012-2013; Tamar Christina, 2016-2017 maintainer:	Haskell Libraries <libraries@haskell.org> bug-reports:    https://github.com/haskell/win32/issues homepage:       https://github.com/haskell/win32@@ -11,13 +11,23 @@ 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+cabal-version:  >=1.10 extra-source-files: 	include/diatemp.h include/dumpBMP.h include/ellipse.h include/errors.h 	include/Win32Aux.h include/win32debug.h include/alignment.h         changelog.md  Library+    default-language: Haskell2010+    default-extensions: ForeignFunctionInterface, CPP+    if impl(ghc >= 7.1)+        default-extensions: NondecreasingIndentation++    if !os(windows)+        -- This package requires Windows to build+        build-depends: unbuildable<0+        buildable: False+     build-depends:	base >= 4.5 && < 5, bytestring, filepath     ghc-options:    -Wall -fno-warn-name-shadowing     cc-options:     -fno-strict-aliasing@@ -90,9 +100,6 @@         System.Win32.Utils         System.Win32.Word -    extensions:    ForeignFunctionInterface, CPP-    if impl(ghc >= 7.1)-        extensions: NondecreasingIndentation     extra-libraries:         "user32", "gdi32", "winmm", "advapi32", "shell32", "shfolder", "shlwapi", "msimg32", "imm32"     ghc-options:      -Wall
changelog.md view
@@ -1,5 +1,12 @@ # Changelog for [`Win32` package](http://hackage.haskell.org/package/Win32) +## Unreleased GIT version++* Make cabal error out on compilation on non-Windows OSes. (See #80)+* Update cabal format to 1.10 and set language +  default to Haskell2010. (See #81)+* Use `Maybe` in wrappers for functions with nullable pointer parameters (See #83)+ ## 2.5.3.0 *March 2017*  * Fix buffer overflow in `regSetValue`. (See #39)