Win32 2.13.0.0 → 2.13.1.0
raw patch · 4 files changed
+32/−11 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- System/Win32/MinTTY.hsc +13/−9
- Win32.cabal +1/−1
- changelog.md +6/−0
- include/tlhelp32_compat.h +12/−1
System/Win32/MinTTY.hsc view
@@ -31,10 +31,9 @@ #if MIN_VERSION_base(4,6,0) import Control.Exception (catch) #endif-import Data.List (isPrefixOf, isInfixOf, isSuffixOf)+import Data.List (isInfixOf) import Foreign import Foreign.C.Types-import System.FilePath (takeFileName) #if __GLASGOW_HASKELL__ < 711 #let alignment t = "%lu", (unsigned long)offsetof(struct {char x__; t (y__); }, y__)@@ -91,11 +90,8 @@ return False cygwinMSYSCheck :: String -> Bool-cygwinMSYSCheck fn = ("cygwin-" `isPrefixOf` fn' || "msys-" `isPrefixOf` fn') &&- "-pty" `isInfixOf` fn' &&- "-master" `isSuffixOf` fn'- where- fn' = takeFileName fn+cygwinMSYSCheck fn = ("cygwin-" `isInfixOf` fn || "msys-" `isInfixOf` fn) &&+ "-pty" `isInfixOf` fn -- Note that GetFileInformationByHandleEx might return a filepath like: -- -- \msys-dd50a72ab4668b33-pty1-to-master@@ -105,8 +101,16 @@ -- \Device\NamedPipe\msys-dd50a72ab4668b33-pty1-to-master -- -- This means we can't rely on "\cygwin-" or "\msys-" being at the very start--- of the filepath. Therefore, we must take care to first call takeFileName--- before checking for "cygwin" or "msys" at the start using `isPrefixOf`.+-- of the filepath. As a result, we use `isPrefixOf` to check for "cygwin" and+-- "msys".+--+-- It's unclear if "-master" will always appear in the filepath name. Recent+-- versions of MinTTY have been known to give filepaths like this (#186):+--+-- \msys-dd50a72ab4668b33-pty0-to-master-nat+--+-- Just in case MinTTY ever changes this convention, we don't bother checking+-- for the presence of "-master" in the filepath name at all. getFileNameByHandle :: HANDLE -> IO String getFileNameByHandle h = do
Win32.cabal view
@@ -1,5 +1,5 @@ name: Win32-version: 2.13.0.0+version: 2.13.1.0 license: BSD3 license-file: LICENSE author: Alastair Reid, shelarcy, Tamar Christina
changelog.md view
@@ -1,5 +1,11 @@ # Changelog for [`Win32` package](http://hackage.haskell.org/package/Win32) +## 2.13.1.0 November 2021++* Fix a bug in which `System.Win32.MinTTY.isMinTTY` would incorrectly return+ `False` on recent versions of MinTTY. (See #187)+* Add all flags for CreateToolhelp32Snapshot. (See #185)+ ## 2.13.0.0 August 2021 * Fix type of c_SetWindowLongPtr. See #180
include/tlhelp32_compat.h view
@@ -6,10 +6,21 @@ */ #if __GLASGOW_HASKELL__ > 708 #else-// Some declarations from tlhelp32.h that we need in Win32+// Declarations from tlhelp32.h that Win32 requires #include <windows.h> +// CreateToolhelp32Snapshot Flags+// https://docs.microsoft.com/en-us/windows/win32/api/tlhelp32/nf-tlhelp32-createtoolhelp32snapshot++#define TH32CS_INHERIT 0x80000000++#define TH32CS_SNAPHEAPLIST 0x00000001+#define TH32CS_SNAPPROCESS 0x00000002+#define TH32CS_SNAPTHREAD 0x00000004+#define TH32CS_SNAPMODULE 0x00000008 #define TH32CS_SNAPMODULE32 0x00000010++#define TH32CS_SNAPALL (TH32CS_SNAPHEAPLIST|TH32CS_SNAPPROCESS|TH32CS_SNAPTHREAD|TH32CS_SNAPMODULE) #endif #endif /* TLHELP32_COMPAT_H */