Skip to content

Commit

Permalink
Drop ntdll dependency (#79)
Browse files Browse the repository at this point in the history
* Drop ntdll

* Expand changelog.

* Make this a release.

* Correct version.
  • Loading branch information
Mistuke authored Mar 18, 2017
1 parent 4cde0a4 commit 67c5cc5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
13 changes: 9 additions & 4 deletions System/Win32/MinTTY.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Win32.cabal
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -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*

Expand Down

2 comments on commit 67c5cc5

@Mistuke
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TeamCity Win32 Bindings for Haskell :: Win32 Continuous builds Build 34 is now running

@Mistuke
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TeamCity Win32 Bindings for Haskell :: Win32 Continuous builds Build 34 outcome was SUCCESS
Summary: Running Build time: 00:07:55

Please sign in to comment.