diff options
author | Tamar Christina <tamar@zhox.com> | 2019-06-16 21:30:14 +0100 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2020-07-15 16:41:01 -0400 |
commit | 4bf542bf1cdf2fa468457fc0af21333478293476 (patch) | |
tree | 8378f0fa182d8e829e15fc5d102ba01aa8bd038e /libraries/base/cbits/Win32Utils.c | |
parent | 050da6dd42d0cb293c7fce4a5ccdeb5abe1aadb4 (diff) | |
download | haskell-4bf542bf1cdf2fa468457fc0af21333478293476.tar.gz |
winio: Multiple refactorings and support changes.
Diffstat (limited to 'libraries/base/cbits/Win32Utils.c')
-rw-r--r-- | libraries/base/cbits/Win32Utils.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/libraries/base/cbits/Win32Utils.c b/libraries/base/cbits/Win32Utils.c index 886c277b5c..7b9c9cd244 100644 --- a/libraries/base/cbits/Win32Utils.c +++ b/libraries/base/cbits/Win32Utils.c @@ -5,14 +5,17 @@ ------------------------------------------------------------------------- */ #if defined(_WIN32) +/* Use Mingw's C99 print functions. */ +#define __USE_MINGW_ANSI_STDIO 1 +/* Using Secure APIs */ +#define MINGW_HAS_SECURE_API 1 #include "HsBase.h" #include <stdbool.h> #include <stdint.h> -/* Using Secure APIs */ -#define MINGW_HAS_SECURE_API 1 #include <wchar.h> #include <windows.h> +#include <io.h> /* This is the error table that defines the mapping between OS error codes and errno values */ @@ -131,9 +134,8 @@ LPWSTR base_getErrorMessage(DWORD err) return what; } -int get_unique_file_info(int fd, HsWord64 *dev, HsWord64 *ino) +int get_unique_file_info_hwnd(HANDLE h, HsWord64 *dev, HsWord64 *ino) { - HANDLE h = (HANDLE)_get_osfhandle(fd); BY_HANDLE_FILE_INFORMATION info; if (GetFileInformationByHandle(h, &info)) @@ -148,6 +150,12 @@ int get_unique_file_info(int fd, HsWord64 *dev, HsWord64 *ino) return -1; } +int get_unique_file_info(int fd, HsWord64 *dev, HsWord64 *ino) +{ + HANDLE h = (HANDLE)_get_osfhandle(fd); + return get_unique_file_info_hwnd (h, dev, ino); +} + BOOL file_exists(LPCTSTR path) { DWORD r = GetFileAttributes(path); |