diff --git a/System/Win32/MinTTY.hsc b/System/Win32/MinTTY.hsc index 7b1f41a1..aff29d88 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 8cbd3cb3..5e144cc2 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 f8106bd3..222bd0de 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*