Win32 2.5.2.0 → 2.5.3.0
raw patch · 5 files changed
+31/−9 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Graphics.Win32.GDI.HDC: c_GetPixel :: HDC -> Int -> Int -> IO COLORREF
+ Graphics.Win32.GDI.HDC: getPixel :: HDC -> Int -> Int -> IO COLORREF
Files
- Graphics/Win32/GDI/HDC.hs +11/−0
- System/Win32/MinTTY.hsc +9/−4
- System/Win32/Registry.hsc +3/−3
- Win32.cabal +2/−2
- changelog.md +6/−0
Graphics/Win32/GDI/HDC.hs view
@@ -43,6 +43,17 @@ simply want the same representational value. -} +----------------------+-- Implement GetPixel+----------------------++getPixel :: HDC -> Int -> Int -> IO COLORREF+getPixel dc x y = c_GetPixel dc x y+foreign import WINDOWS_CCONV unsafe "windows.h GetPixel"+ c_GetPixel :: HDC -> Int -> Int -> IO COLORREF++----------------------+ setArcDirection :: HDC -> ArcDirection -> IO ArcDirection setArcDirection dc dir = failIfZero "SetArcDirection" $ c_SetArcDirection dc dir
System/Win32/MinTTY.hsc view
@@ -134,6 +134,9 @@ bufSize = sizeOfONI + mAX_PATH * sizeOfTCHAR allocaBytes bufSize $ \buf -> alloca $ \p_len -> do+ hwnd <- getModuleHandle (Just "ntdll.exe")+ addr <- getProcAddress hwnd "NtQueryObject"+ let c_NtQueryObject = mk_NtQueryObject (castPtrToFunPtr addr) _ <- failIfNeg "NtQueryObject" $ c_NtQueryObject h objectNameInformation buf (fromIntegral bufSize) p_len oni <- peek buf@@ -148,6 +151,12 @@ objectNameInformation :: CInt objectNameInformation = #const ObjectNameInformation +type F_NtQueryObject = HANDLE -> CInt -> Ptr OBJECT_NAME_INFORMATION+ -> ULONG -> Ptr ULONG -> IO NTSTATUS+ +foreign import WINDOWS_CCONV "dynamic"+ mk_NtQueryObject :: FunPtr F_NtQueryObject -> F_NtQueryObject+ type F_GetFileInformationByHandleEx = HANDLE -> CInt -> Ptr FILE_NAME_INFO -> DWORD -> IO BOOL @@ -178,10 +187,6 @@ { fniFileNameLength = vfniFileNameLength , fniFileName = vfniFileName }--foreign import WINDOWS_CCONV "winternl.h NtQueryObject"- c_NtQueryObject :: HANDLE -> CInt -> Ptr OBJECT_NAME_INFORMATION- -> ULONG -> Ptr ULONG -> IO NTSTATUS type NTSTATUS = #type NTSTATUS
System/Win32/Registry.hsc view
@@ -72,7 +72,7 @@ import System.Win32.Time (FILETIME) import System.Win32.Types (DWORD, ErrCode, HKEY, LPCTSTR, PKEY, withTString) import System.Win32.Types (HANDLE, LONG, LPBYTE, newForeignHANDLE, peekTString)-import System.Win32.Types (LPTSTR, TCHAR, failUnlessSuccess, withTStringLen)+import System.Win32.Types (LPTSTR, TCHAR, failUnlessSuccess) import System.Win32.Types (castUINTPtrToPtr, failUnlessSuccessOr, maybePtr) ##include "windows_cconv.h"@@ -477,9 +477,9 @@ regSetValue key subkey value = withForeignPtr key $ \ p_key -> withTString subkey $ \ c_subkey ->- withTStringLen value $ \ (c_value, value_len) ->+ withTString value $ \ c_value -> failUnlessSuccess "RegSetValue" $- c_RegSetValue p_key c_subkey rEG_SZ c_value value_len+ c_RegSetValue p_key c_subkey rEG_SZ c_value 0 -- cbData is ignored, value needs to be null terminated. foreign import WINDOWS_CCONV unsafe "windows.h RegSetValueW" c_RegSetValue :: PKEY -> LPCTSTR -> DWORD -> LPCTSTR -> Int -> IO ErrCode
Win32.cabal view
@@ -1,5 +1,5 @@ name: Win32-version: 2.5.2.0+version: 2.5.3.0 license: BSD3 license-file: LICENSE author: Alastair Reid, shelarcy@@ -94,7 +94,7 @@ if impl(ghc >= 7.1) extensions: NondecreasingIndentation extra-libraries:- "user32", "gdi32", "winmm", "advapi32", "shell32", "shfolder", "shlwapi", "msimg32", "imm32", "ntdll"+ "user32", "gdi32", "winmm", "advapi32", "shell32", "shfolder", "shlwapi", "msimg32", "imm32" ghc-options: -Wall include-dirs: include includes: "alphablend.h", "diatemp.h", "dumpBMP.h", "ellipse.h", "errors.h", "HsGDI.h", "HsWin32.h", "Win32Aux.h", "win32debug.h", "windows_cconv.h", "WndProc.h", "alignment.h"
changelog.md view
@@ -1,5 +1,11 @@ # Changelog for [`Win32` package](http://hackage.haskell.org/package/Win32) +## 2.5.3.0 *March 2017*++* Fix buffer overflow in `regSetValue`. (See #39)+* Added `getPixel`. (See #37)+* Drop dependency on `ntdll` because of incorrect import library on x86. (See #79)+ ## 2.5.2.0 *March 2017* * Fix constant underflows with (-1) and unsigned numbers.