packages feed

Win32 2.3.0.1 → 2.3.0.2

raw patch · 9 files changed

+139/−48 lines, 9 filesdep ~base

Dependency ranges changed: base

Files

Graphics/Win32/Control.hsc view
@@ -17,13 +17,15 @@  module Graphics.Win32.Control where -import Graphics.Win32.GDI.Types-import Graphics.Win32.Window-import System.Win32.Types-import Graphics.Win32.Message--import Foreign-import System.IO.Unsafe+import Data.Bits ((.|.))+import Graphics.Win32.GDI.Types (HMENU, HWND)+import Graphics.Win32.Message (WindowMessage)+import Graphics.Win32.Window (ClassName, Pos, WindowStyle, maybePos)+import Graphics.Win32.Window (c_CreateWindowEx)+import System.IO.Unsafe (unsafePerformIO)+import System.Win32.Types (HANDLE, UINT, maybePtr, newTString, withTString)+import System.Win32.Types (failIfFalse_, failIfNull, failIfZero)+import Foreign.Ptr (nullPtr)  ##include "windows_cconv.h" 
Graphics/Win32/Key.hsc view
@@ -17,10 +17,9 @@  module Graphics.Win32.Key where -import Graphics.Win32.GDI.Types-import System.Win32.Types- import Control.Monad (liftM)+import Graphics.Win32.GDI.Types (HWND)+import System.Win32.Types (DWORD, UINT, WORD, ptrToMaybe)  ##include "windows_cconv.h" 
Graphics/Win32/Window.hsc view
@@ -18,14 +18,24 @@  module Graphics.Win32.Window where -import System.Win32.Types-import Graphics.Win32.GDI.Types-import Graphics.Win32.Message--import Control.Monad-import Data.Maybe-import Foreign-import System.IO.Unsafe+import Control.Monad (liftM)+import Data.Maybe (fromMaybe)+import Data.Word (Word32)+import Foreign.ForeignPtr (withForeignPtr)+import Foreign.Marshal.Alloc (allocaBytes)+import Foreign.Ptr (FunPtr, Ptr, castFunPtrToPtr, castPtr, nullPtr)+import Foreign.Storable (pokeByteOff)+import Graphics.Win32.GDI.Types (HBITMAP, HCURSOR, HDC, HDWP, HRGN, HWND, PRGN)+import Graphics.Win32.GDI.Types (HBRUSH, HICON, HMENU, prim_ChildWindowFromPoint)+import Graphics.Win32.GDI.Types (LPRECT, RECT, allocaRECT, peekRECT, withRECT)+import Graphics.Win32.GDI.Types (POINT, allocaPOINT, peekPOINT, withPOINT)+import Graphics.Win32.GDI.Types (prim_ChildWindowFromPointEx)+import Graphics.Win32.Message (WindowMessage)+import System.IO.Unsafe (unsafePerformIO)+import System.Win32.Types (ATOM, maybePtr, newTString, ptrToMaybe, numToMaybe)+import System.Win32.Types (Addr, BOOL, DWORD, INT, LONG, LRESULT, UINT, WPARAM)+import System.Win32.Types (HINSTANCE, LPARAM, LPCTSTR, LPVOID, withTString)+import System.Win32.Types (failIf, failIf_, failIfFalse_, failIfNull, maybeNum)  ##include "windows_cconv.h" 
System/Win32/File.hsc view
@@ -74,6 +74,7 @@ #{enum ShareMode,  , fILE_SHARE_READ      = FILE_SHARE_READ  , fILE_SHARE_WRITE     = FILE_SHARE_WRITE+ , fILE_SHARE_DELETE    = FILE_SHARE_DELETE  }  ----------------------------------------------------------------@@ -207,6 +208,16 @@  ---------------------------------------------------------------- +newtype GET_FILEEX_INFO_LEVELS = GET_FILEEX_INFO_LEVELS (#type GET_FILEEX_INFO_LEVELS)+    deriving (Eq, Ord)++#{enum GET_FILEEX_INFO_LEVELS, GET_FILEEX_INFO_LEVELS+ , getFileExInfoStandard = GetFileExInfoStandard+ , getFileExMaxInfoLevel = GetFileExMaxInfoLevel+ }++----------------------------------------------------------------+ type LPSECURITY_ATTRIBUTES = Ptr () type MbLPSECURITY_ATTRIBUTES = Maybe LPSECURITY_ATTRIBUTES @@ -256,6 +267,37 @@             (dwordsToDdword (fshi,fslo)) link (dwordsToDdword (idhi,idlo))  ----------------------------------------------------------------++data WIN32_FILE_ATTRIBUTE_DATA = WIN32_FILE_ATTRIBUTE_DATA+    { fadFileAttributes :: DWORD+    , fadCreationTime , fadLastAccessTime , fadLastWriteTime :: FILETIME+    , fadFileSize :: DDWORD+    } deriving (Show)++instance Storable WIN32_FILE_ATTRIBUTE_DATA where+    sizeOf = const (#size WIN32_FILE_ATTRIBUTE_DATA)+    alignment = sizeOf+    poke buf ad = do+        (#poke WIN32_FILE_ATTRIBUTE_DATA, dwFileAttributes) buf (fadFileAttributes ad)+        (#poke WIN32_FILE_ATTRIBUTE_DATA, ftCreationTime)   buf (fadCreationTime ad)+        (#poke WIN32_FILE_ATTRIBUTE_DATA, ftLastAccessTime) buf (fadLastAccessTime ad)+        (#poke WIN32_FILE_ATTRIBUTE_DATA, ftLastWriteTime)  buf (fadLastWriteTime ad)+        (#poke WIN32_FILE_ATTRIBUTE_DATA, nFileSizeHigh)    buf sizeHi+        (#poke WIN32_FILE_ATTRIBUTE_DATA, nFileSizeLow)     buf sizeLo+        where+            (sizeHi,sizeLo) = ddwordToDwords $ fadFileSize ad++    peek buf = do+        attr <- (#peek WIN32_FILE_ATTRIBUTE_DATA, dwFileAttributes) buf+        ctim <- (#peek WIN32_FILE_ATTRIBUTE_DATA, ftCreationTime)   buf+        lati <- (#peek WIN32_FILE_ATTRIBUTE_DATA, ftLastAccessTime) buf+        lwti <- (#peek WIN32_FILE_ATTRIBUTE_DATA, ftLastWriteTime)  buf+        fshi <- (#peek WIN32_FILE_ATTRIBUTE_DATA, nFileSizeHigh)    buf+        fslo <- (#peek WIN32_FILE_ATTRIBUTE_DATA, nFileSizeLow)     buf+        return $ WIN32_FILE_ATTRIBUTE_DATA attr ctim lati lwti+            (dwordsToDdword (fshi,fslo))++---------------------------------------------------------------- -- File operations ---------------------------------------------------------------- @@ -420,6 +462,15 @@     c_GetFileAttributes c_name foreign import WINDOWS_CCONV unsafe "windows.h GetFileAttributesW"   c_GetFileAttributes :: LPCTSTR -> IO FileAttributeOrFlag++getFileAttributesExStandard :: String -> IO WIN32_FILE_ATTRIBUTE_DATA+getFileAttributesExStandard name =  alloca $ \res -> do+  withTString name $ \ c_name ->+    failIfFalseWithRetry_ "getFileAttributesExStandard" $+      c_GetFileAttributesEx c_name getFileExInfoStandard res+  peek res+foreign import WINDOWS_CCONV unsafe "windows.h GetFileAttributesExW"+  c_GetFileAttributesEx :: LPCTSTR -> GET_FILEEX_INFO_LEVELS -> Ptr a -> IO BOOL  getFileInformationByHandle :: HANDLE -> IO BY_HANDLE_FILE_INFORMATION getFileInformationByHandle h = alloca $ \res -> do
System/Win32/Info.hsc view
@@ -17,13 +17,18 @@  module System.Win32.Info where -import System.Win32.Types- import Control.Exception (catch)-import System.IO.Error-import Foreign      ( Storable(sizeOf, alignment, peekByteOff, pokeByteOff,-                               peek, poke)-                    , Ptr, alloca, allocaArray )+import Foreign.Marshal.Alloc (alloca)+import Foreign.Marshal.Array (allocaArray)+import Foreign.Ptr (Ptr, nullPtr)+import Foreign.Storable (Storable(..))+import System.IO.Error (isDoesNotExistError)+import System.Win32.Types (DWORD, LPCTSTR, LPTSTR, LPVOID, UINT, WORD)+import System.Win32.Types (failIfZero, peekTStringLen, withTString)++#if !MIN_VERSION_base(4,6,0)+import Prelude hiding (catch)+#endif  ##include "windows_cconv.h" 
System/Win32/Process.hsc view
@@ -105,16 +105,16 @@  peekProcessEntry32 :: Ptr ProcessEntry32 -> IO ProcessEntry32 peekProcessEntry32 buf = liftM5 (,,,,)-    ((#peek PROCESSENTRY32, th32ProcessID) buf)-    ((#peek PROCESSENTRY32, cntThreads) buf)-    ((#peek PROCESSENTRY32, th32ParentProcessID) buf)-    ((#peek PROCESSENTRY32, pcPriClassBase) buf)-    (peekTString $ (#ptr PROCESSENTRY32, szExeFile) buf)+    ((#peek PROCESSENTRY32W, th32ProcessID) buf)+    ((#peek PROCESSENTRY32W, cntThreads) buf)+    ((#peek PROCESSENTRY32W, th32ParentProcessID) buf)+    ((#peek PROCESSENTRY32W, pcPriClassBase) buf)+    (peekTString $ (#ptr PROCESSENTRY32W, szExeFile) buf)  -- | Enumerate processes using Process32First and Process32Next th32SnapEnumProcesses :: Th32SnapHandle -> IO [ProcessEntry32]-th32SnapEnumProcesses h = allocaBytes (#size PROCESSENTRY32) $ \pe -> do-    (#poke PROCESSENTRY32, dwSize) pe ((#size PROCESSENTRY32)::DWORD)+th32SnapEnumProcesses h = allocaBytes (#size PROCESSENTRY32W) $ \pe -> do+    (#poke PROCESSENTRY32W, dwSize) pe ((#size PROCESSENTRY32W)::DWORD)     ok <- c_Process32First h pe     readAndNext ok pe []     where
System/Win32/Registry.hsc view
@@ -60,12 +60,20 @@  -} -import System.Win32.Time-import System.Win32.Types-import System.Win32.File--import System.IO.Unsafe-import Foreign+import Data.Word (Word32)+import Foreign.ForeignPtr (withForeignPtr)+import Foreign.Marshal.Alloc (alloca, allocaBytes, free, mallocBytes)+import Foreign.Marshal.Array (allocaArray0)+import Foreign.Marshal.Utils (maybeWith, with)+import Foreign.Ptr (Ptr, castPtr, nullPtr)+import Foreign.Storable (peek, peekByteOff, peekElemOff, sizeOf)+import System.IO.Unsafe (unsafePerformIO)+import System.Win32.File (LPSECURITY_ATTRIBUTES)+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 (castUINTPtrToPtr, failUnlessSuccessOr, maybePtr)  ##include "windows_cconv.h" 
System/Win32/Types.hs view
@@ -20,15 +20,31 @@ 	, nullPtr 	) where -import Data.Maybe-import Foreign-import Foreign.C-import Control.Exception-import System.IO.Error-import System.IO.Unsafe-import Data.Char+import Control.Exception (throwIO)+import Data.Bits (shiftL, shiftR, (.|.), (.&.))+import Data.Char (isSpace)+import Data.Int (Int32, Int64)+import Data.Maybe (fromMaybe)+import Data.Word (Word, Word8, Word16, Word32, Word64)+import Foreign.C.Error (getErrno, errnoToIOError)+import Foreign.C.String (newCWString, withCWStringLen)+import Foreign.C.String (peekCWString, peekCWStringLen, withCWString)+import Foreign.C.Types (CChar, CUChar, CWchar)+import Foreign.ForeignPtr (ForeignPtr, newForeignPtr, newForeignPtr_)+import Foreign.Ptr (FunPtr, Ptr, nullPtr) import Numeric (showHex)+import System.IO.Error (ioeSetErrorString)+import System.IO.Unsafe (unsafePerformIO) +#if MIN_VERSION_base(4,7,0)+import Data.Bits (finiteBitSize)+#else+import Data.Bits (Bits, bitSize)++finiteBitSize :: (Bits a) => a -> Int+finiteBitSize = bitSize+#endif+ #include "windows_cconv.h"  ----------------------------------------------------------------@@ -226,7 +242,7 @@   let msg' = reverse $ dropWhile isSpace $ reverse msg -- drop trailing \n       ioerror = errnoToIOError fn_name errno Nothing Nothing                   `ioeSetErrorString` msg'-  throw ioerror+  throwIO ioerror   foreign import ccall unsafe "maperrno" -- in base/cbits/Win32Utils.c
Win32.cabal view
@@ -1,10 +1,10 @@ name:		Win32-version:	2.3.0.1+version:	2.3.0.2 license:	BSD3 license-file:	LICENSE author:		Alastair Reid copyright:	Alastair Reid, 1999-2003-maintainer:	Bryan O'Sullivan <bos@serpentine.com>+maintainer:	Haskell Libraries <libraries@haskell.org> bug-reports:    https://github.com/haskell/win32/issues homepage:       https://github.com/haskell/win32 category:	System, Graphics@@ -17,7 +17,7 @@ 	include/Win32Aux.h include/win32debug.h include/windows_cconv.h  Library-    build-depends:	base >= 4.7 && < 5, bytestring+    build-depends:	base >= 4.5 && < 5, bytestring     ghc-options:    -Wall -fno-warn-name-shadowing     cc-options:     -fno-strict-aliasing     exposed-modules: