Win32 2.5.4.0 → 2.5.4.1
raw patch · 12 files changed
+57/−73 lines, 12 filesdep −unbuildablePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies removed: unbuildable
API changes (from Hackage documentation)
- System.Win32.Types: nullHINSTANCE :: HINSTANCE
- Graphics.Win32.Menu: appendMenu :: HMENU -> MenuFlag -> MenuID -> Maybe String -> IO ()
+ Graphics.Win32.Menu: appendMenu :: HMENU -> MenuFlag -> MenuID -> String -> IO ()
- Graphics.Win32.Menu: insertMenu :: HMENU -> MenuItem -> MenuFlag -> MenuID -> Maybe String -> IO ()
+ Graphics.Win32.Menu: insertMenu :: HMENU -> MenuItem -> MenuFlag -> MenuID -> String -> IO ()
- Graphics.Win32.Menu: modifyMenu :: HMENU -> MenuItem -> MenuFlag -> MenuID -> Maybe String -> IO ()
+ Graphics.Win32.Menu: modifyMenu :: HMENU -> MenuItem -> MenuFlag -> MenuID -> String -> IO ()
- Graphics.Win32.Misc: messageBox :: Maybe HWND -> String -> String -> MBStyle -> IO MBStatus
+ Graphics.Win32.Misc: messageBox :: HWND -> String -> String -> MBStyle -> IO MBStatus
- Graphics.Win32.Window: findWindow :: Maybe String -> Maybe String -> IO (Maybe HWND)
+ Graphics.Win32.Window: findWindow :: String -> String -> IO (Maybe HWND)
- Graphics.Win32.Window: findWindowEx :: Maybe HWND -> Maybe HWND -> Maybe String -> Maybe String -> IO (Maybe HWND)
+ Graphics.Win32.Window: findWindowEx :: HWND -> HWND -> String -> String -> IO (Maybe HWND)
- System.Win32.DLL: setDllDirectory :: Maybe String -> IO ()
+ System.Win32.DLL: setDllDirectory :: String -> IO ()
- System.Win32.File: defineDosDevice :: DefineDosDeviceFlags -> String -> Maybe String -> IO ()
+ System.Win32.File: defineDosDevice :: DefineDosDeviceFlags -> String -> String -> IO ()
- System.Win32.File: moveFileEx :: String -> Maybe String -> MoveFileFlag -> IO ()
+ System.Win32.File: moveFileEx :: String -> String -> MoveFileFlag -> IO ()
- System.Win32.File: setVolumeLabel :: Maybe String -> Maybe String -> IO ()
+ System.Win32.File: setVolumeLabel :: String -> String -> IO ()
- System.Win32.Info: searchPath :: Maybe String -> FilePath -> Maybe String -> IO (Maybe FilePath)
+ System.Win32.Info: searchPath :: Maybe String -> FilePath -> String -> IO (Maybe FilePath)
- System.Win32.Registry: regCreateKeyEx :: HKEY -> String -> Maybe String -> RegCreateOptions -> REGSAM -> Maybe LPSECURITY_ATTRIBUTES -> IO (HKEY, Bool)
+ System.Win32.Registry: regCreateKeyEx :: HKEY -> String -> String -> RegCreateOptions -> REGSAM -> Maybe LPSECURITY_ATTRIBUTES -> IO (HKEY, Bool)
- System.Win32.Registry: regQueryValue :: HKEY -> String -> IO String
+ System.Win32.Registry: regQueryValue :: HKEY -> Maybe String -> IO String
- System.Win32.Registry: regQueryValueKey :: HKEY -> String -> IO String
+ System.Win32.Registry: regQueryValueKey :: HKEY -> Maybe String -> IO String
- System.Win32.Registry: regReplaceKey :: HKEY -> Maybe String -> String -> String -> IO ()
+ System.Win32.Registry: regReplaceKey :: HKEY -> String -> String -> String -> IO ()
- System.Win32.Time: getTimeFormat :: LCID -> GetTimeFormatFlags -> Maybe SYSTEMTIME -> Maybe String -> IO String
+ System.Win32.Time: getTimeFormat :: LCID -> GetTimeFormatFlags -> SYSTEMTIME -> String -> IO String
Files
- Graphics/Win32/Menu.hsc +6/−6
- Graphics/Win32/Misc.hsc +2/−2
- Graphics/Win32/Window.hsc +9/−10
- System/Win32/DLL.hsc +3/−4
- System/Win32/File.hsc +7/−7
- System/Win32/HardLink.hs +3/−3
- System/Win32/Info.hsc +3/−3
- System/Win32/Registry.hsc +12/−12
- System/Win32/Time.hsc +3/−4
- System/Win32/Types.hsc +0/−3
- Win32.cabal +7/−14
- changelog.md +2/−5
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 -> Maybe String -> IO ()+appendMenu :: HMENU -> MenuFlag -> MenuID -> String -> IO () appendMenu menu flags id_item name =- maybeWith withTString name $ \ c_name ->+ 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 -> Maybe String -> IO ()+insertMenu :: HMENU -> MenuItem -> MenuFlag -> MenuID -> String -> IO () insertMenu menu item flags id_item name =- maybeWith withTString name $ \ c_name ->+ 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 -> Maybe String -> IO ()+modifyMenu :: HMENU -> MenuItem -> MenuFlag -> MenuID -> String -> IO () modifyMenu menu item flags id_item name =- maybeWith withTString name $ \ c_name ->+ 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 :: Maybe HWND -> String -> String -> MBStyle -> IO MBStatus+messageBox :: HWND -> String -> String -> MBStyle -> IO MBStatus messageBox wnd text caption style = withTString text $ \ c_text -> withTString caption $ \ c_caption ->- failIfZero "MessageBox" $ c_MessageBox (maybePtr wnd) c_text c_caption style+ failIfZero "MessageBox" $ c_MessageBox 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,7 +23,6 @@ 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)@@ -475,24 +474,24 @@ foreign import WINDOWS_CCONV unsafe "windows.h EndDeferWindowPos" c_EndDeferWindowPos :: HDWP -> IO Bool -findWindow :: Maybe String -> Maybe String -> IO (Maybe HWND)+findWindow :: String -> String -> IO (Maybe HWND) findWindow cname wname =- maybeWith withTString cname $ \ c_cname ->- maybeWith withTString wname $ \ c_wname ->+ withTString cname $ \ c_cname ->+ 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 = findWindow Nothing $ Just wname+findWindowByName wname = withTString wname $ \ c_wname ->+ liftM ptrToMaybe $ c_FindWindow nullPtr c_wname foreign import WINDOWS_CCONV unsafe "windows.h FindWindowW" c_FindWindow :: LPCTSTR -> LPCTSTR -> IO HWND -findWindowEx :: Maybe HWND -> Maybe HWND -> Maybe String -> Maybe String -> IO (Maybe HWND)+findWindowEx :: HWND -> HWND -> String -> String -> IO (Maybe HWND) findWindowEx parent after cname wname =- maybeWith withTString cname $ \ c_cname ->- maybeWith withTString wname $ \ c_wname ->- liftM ptrToMaybe $ c_FindWindowEx (maybePtr parent) (maybePtr after) c_cname c_wname+ withTString cname $ \ c_cname ->+ withTString wname $ \ c_wname ->+ liftM ptrToMaybe $ c_FindWindowEx parent 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,7 +23,6 @@ import Foreign import Foreign.C-import Data.Maybe (fromMaybe) ##include "windows_cconv.h" @@ -88,10 +87,10 @@ foreign import WINDOWS_CCONV unsafe "windows.h LoadLibraryExW" c_LoadLibraryEx :: LPCTSTR -> HANDLE -> LoadLibraryFlags -> IO HINSTANCE -setDllDirectory :: Maybe String -> IO ()+setDllDirectory :: String -> IO () setDllDirectory name =- maybeWith withTString name $ \ c_name ->- failIfFalse_ (unwords ["SetDllDirectory", fromMaybe "NULL" name]) $ c_SetDllDirectory c_name+ withTString name $ \ c_name ->+ failIfFalse_ (unwords ["SetDllDirectory", 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 -> Maybe String -> MoveFileFlag -> IO ()+moveFileEx :: String -> String -> MoveFileFlag -> IO () moveFileEx src dest flags = withTString src $ \ c_src ->- maybeWith withTString dest $ \ c_dest ->+ 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 -> Maybe String -> IO ()+defineDosDevice :: DefineDosDeviceFlags -> String -> String -> IO () defineDosDevice flags name path =- maybeWith withTString path $ \ c_path ->+ 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 :: Maybe String -> Maybe String -> IO ()+setVolumeLabel :: String -> String -> IO () setVolumeLabel path name =- maybeWith withTString path $ \ c_path ->- maybeWith withTString name $ \ c_name ->+ withTString path $ \ c_path ->+ 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 :: Maybe String -> IO VolumeInformation +getVolumeInformation :: String -> IO VolumeInformation getVolumeInformation drive = - maybeWith withTString drive $ \c_drive -> - withTStringBufferLen 256 $ \(vnBuf, vnLen) -> + 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, maybeWith)+import Foreign.Marshal.Utils (with) 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 -> Maybe String -> IO (Maybe FilePath)+searchPath :: Maybe String -> FilePath -> String -> IO (Maybe FilePath) searchPath path filename ext = maybe ($ nullPtr) withTString path $ \p_path -> withTString filename $ \p_filename ->- maybeWith withTString ext $ \p_ext ->+ 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 -> Maybe String+ , regCreateKeyEx -- :: HKEY -> String -> 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 -> String -> IO String- , regQueryValueKey -- :: HKEY -> String -> IO String+ , regQueryValue -- :: HKEY -> Maybe String -> IO String+ , regQueryValueKey -- :: HKEY -> Maybe String -> IO String , regQueryValueEx -- :: HKEY -> String -> Addr -> Int -> IO RegValueType- , regReplaceKey -- :: HKEY -> Maybe String -> String -> String -> IO ()+ , regReplaceKey -- :: HKEY -> 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 -> Maybe String -> RegCreateOptions -> REGSAM -> Maybe LPSECURITY_ATTRIBUTES -> IO (HKEY, Bool)+regCreateKeyEx :: HKEY -> String -> 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 ->- maybeWith withTString cls $ \ c_cls ->+ 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 -> String -> IO String+regQueryValueKey :: HKEY -> Maybe String -> IO String regQueryValueKey key mb_subkey = withForeignPtr key $ \ p_key ->- withTString mb_subkey $ \ c_subkey ->+ maybeWith 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 -> String -> IO String+regQueryValue :: HKEY -> Maybe String -> IO String regQueryValue key mb_subkey = withForeignPtr key $ \ p_key ->- withTString mb_subkey $ \ c_subkey ->+ maybeWith 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 -> Maybe String -> String -> String -> IO ()+regReplaceKey :: HKEY -> String -> String -> String -> IO () regReplaceKey key subkey newfile oldfile = withForeignPtr key $ \ p_key ->- maybeWith withTString subkey $ \ c_subkey ->+ withTString subkey $ \ c_subkey -> withTString newfile $ \ c_newfile -> withTString oldfile $ \ c_oldfile -> failUnlessSuccess "RegReplaceKey" $
System/Win32/Time.hsc view
@@ -30,7 +30,6 @@ , with, alloca, allocaBytes, copyArray ) import Foreign.C ( CInt(..), CWchar(..) , peekCWString, withCWStringLen, withCWString )-import Foreign.Marshal.Utils (maybeWith) ##include "windows_cconv.h" #include <windows.h>@@ -306,10 +305,10 @@ foreign import WINDOWS_CCONV "windows.h GetTimeFormatW" c_GetTimeFormat :: LCID -> GetTimeFormatFlags -> Ptr SYSTEMTIME -> LPCTSTR -> LPTSTR -> CInt -> IO CInt-getTimeFormat :: LCID -> GetTimeFormatFlags -> Maybe SYSTEMTIME -> Maybe String -> IO String+getTimeFormat :: LCID -> GetTimeFormatFlags -> SYSTEMTIME -> String -> IO String getTimeFormat locale flags st fmt =- maybeWith with st $ \c_st ->- maybeWith withCWString fmt $ \c_fmt -> do+ with st $ \c_st ->+ 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,9 +209,6 @@ 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.4.0+version: 2.5.4.1 license: BSD3 license-file: LICENSE-author: Alastair Reid, shelarcy, Tamar Christina-copyright: Alastair Reid, 1999-2003; shelarcy, 2012-2013; Tamar Christina, 2016-2017+author: Alastair Reid, shelarcy+copyright: Alastair Reid, 1999-2003; shelarcy, 2012-2013 maintainer: Haskell Libraries <libraries@haskell.org> bug-reports: https://github.com/haskell/win32/issues homepage: https://github.com/haskell/win32@@ -11,23 +11,13 @@ synopsis: A binding to part of the Win32 library description: A binding to part of the Win32 library. build-type: Simple-cabal-version: >=1.10+cabal-version: >=1.6 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@@ -100,6 +90,9 @@ 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,11 +1,8 @@ # Changelog for [`Win32` package](http://hackage.haskell.org/package/Win32) -## Unreleased GIT version+## 2.5.4.0 *April 2017* -* 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)+* Fixed GetWindowLong on 32-bit Windows ## 2.5.3.0 *March 2017*