[commit: packages/Win32] depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2: Drop ntdll dependency (#79) (67c5cc5)

git at git.haskell.org git at git.haskell.org
Mon Apr 17 21:28:46 UTC 2017


Repository : ssh://git@git.haskell.org/Win32

On branches: depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2
Link       : http://git.haskell.org/packages/Win32.git/commitdiff/67c5cc56f0faeacc553471c8a7d9b9b95e011731

>---------------------------------------------------------------

commit 67c5cc56f0faeacc553471c8a7d9b9b95e011731
Author: Tamar Christina <Mistuke at users.noreply.github.com>
Date:   Sat Mar 18 09:23:44 2017 +0000

    Drop ntdll dependency (#79)
    
    * Drop ntdll
    
    * Expand changelog.
    
    * Make this a release.
    
    * Correct version.


>---------------------------------------------------------------

67c5cc56f0faeacc553471c8a7d9b9b95e011731
 System/Win32/MinTTY.hsc | 13 +++++++++----
 Win32.cabal             |  4 ++--
 changelog.md            |  3 ++-
 3 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/System/Win32/MinTTY.hsc b/System/Win32/MinTTY.hsc
index 7b1f41a..aff29d8 100644
--- a/System/Win32/MinTTY.hsc
+++ b/System/Win32/MinTTY.hsc
@@ -134,6 +134,9 @@ ntQueryObjectNameInformation h = do
       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 @@ mAX_PATH = #const MAX_PATH
 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
 
@@ -179,10 +188,6 @@ instance Storable FILE_NAME_INFO where
           , 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
 
 newtype OBJECT_NAME_INFORMATION = OBJECT_NAME_INFORMATION
diff --git a/Win32.cabal b/Win32.cabal
index 8cbd3cb..5e144cc 100644
--- a/Win32.cabal
+++ b/Win32.cabal
@@ -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 @@ Library
     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"
diff --git a/changelog.md b/changelog.md
index f8106bd..222bd0d 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,9 +1,10 @@
 # Changelog for [`Win32` package](http://hackage.haskell.org/package/Win32)
 
-## Unreleased GIT Version
+## 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*
 



More information about the ghc-commits mailing list