Commit 0b59fe4d authored by Konstantin Pavlov's avatar Konstantin Pavlov

Merge branch 'gcc-mingw' into 'master'

Gcc mingw



See merge request !12
parents bcc236a1 8b57621c
......@@ -13,7 +13,7 @@ ENV MINGW_PREFIX=$TOOLCHAIN_PREFIX/$TARGET_TUPLE
ENV PATH=$TOOLCHAIN_PREFIX/bin:$PATH
COPY missing-snprintf.patch .
COPY mingw-w64-windows10.patch .
COPY winstorecompat.patch .
RUN mkdir /build && cd /build && \
mkdir $TOOLCHAIN_PREFIX && \
......@@ -30,7 +30,6 @@ RUN mkdir /build && cd /build && \
../configure --prefix=$TOOLCHAIN_PREFIX --target=$TARGET_TUPLE \
--disable-werror --disable-multilib && make -j4 && make install && \
cd /build/mingw-w64/mingw-w64-headers && mkdir build && cd build && \
git am /mingw-w64-windows10.patch && \
../configure --prefix=$MINGW_PREFIX \
--host=$TARGET_TUPLE && make install && \
cd /build && \
......@@ -53,6 +52,7 @@ RUN mkdir /build && cd /build && \
make install-gcc && \
cd /build/mingw-w64/mingw-w64-crt && \
git am ../../../missing-snprintf.patch && \
git am ../../../winstorecompat.patch && \
mkdir build && cd build && \
../configure --prefix=$MINGW_PREFIX \
--host=$TARGET_TUPLE && \
......
From 42bba439de33271418f117ca546a08516827d598 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= <hugo@beauzee.fr>
Date: Thu, 16 Jun 2016 15:56:54 +0200
Subject: [PATCH] headers: Adjust header guards for Windows 10
---
mingw-w64-headers/include/iphlpapi.h | 11 ++++++++---
mingw-w64-headers/include/iprtrmib.h | 5 +++++
mingw-w64-headers/include/mprapi.h | 6 ++++++
mingw-w64-headers/include/nldef.h | 2 +-
4 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/mingw-w64-headers/include/iphlpapi.h b/mingw-w64-headers/include/iphlpapi.h
index 03aed33..c85fc84 100644
--- a/mingw-w64-headers/include/iphlpapi.h
+++ b/mingw-w64-headers/include/iphlpapi.h
@@ -8,8 +8,6 @@
#include <winapifamily.h>
-#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -19,6 +17,10 @@ extern "C" {
#include <iptypes.h>
#include <tcpestats.h>
+#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP) || _WIN32_WINNT >= 0x0A00
+
+#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
+
DWORD WINAPI GetNumberOfInterfaces (PDWORD pdwNumIf);
DWORD WINAPI GetIfEntry (PMIB_IFROW pIfRow);
DWORD WINAPI GetIfTable (PMIB_IFTABLE pIfTable, PULONG pdwSize, WINBOOL bOrder);
@@ -94,6 +96,8 @@ extern "C" {
ULONG WINAPI GetAdaptersInfo (PIP_ADAPTER_INFO AdapterInfo, PULONG SizePointer);
PIP_ADAPTER_ORDER_MAP WINAPI GetAdapterOrderMap (VOID);
+#endif
+
#ifdef _WINSOCK2API_
ULONG WINAPI GetAdaptersAddresses (ULONG Family, ULONG Flags, PVOID Reserved, PIP_ADAPTER_ADDRESSES AdapterAddresses, PULONG SizePointer);
#endif
@@ -170,9 +174,10 @@ extern "C" {
#include <netioapi.h>
#endif
+#endif
+
#ifdef __cplusplus
}
#endif
#endif
-#endif
diff --git a/mingw-w64-headers/include/iprtrmib.h b/mingw-w64-headers/include/iprtrmib.h
index 93e0cad..65ca264 100644
--- a/mingw-w64-headers/include/iprtrmib.h
+++ b/mingw-w64-headers/include/iprtrmib.h
@@ -6,6 +6,9 @@
#ifndef __ROUTING_IPRTRMIB_H__
#define __ROUTING_IPRTRMIB_H__
+#include <winapifamily.h>
+#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
+
#include <mprapi.h>
#include <ipmib.h>
#include <ipifcons.h>
@@ -772,4 +775,6 @@ typedef enum _TCPIP_OWNER_MODULE_INFO_CLASS {
#define CAST_MIB_INFO(X,Y,Z) Z = (Y)(X->rgbyData)
+#endif /*WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)*/
+
#endif /* __ROUTING_IPRTRMIB_H__ */
diff --git a/mingw-w64-headers/include/mprapi.h b/mingw-w64-headers/include/mprapi.h
index 2103c2b..7bbc1d7 100644
--- a/mingw-w64-headers/include/mprapi.h
+++ b/mingw-w64-headers/include/mprapi.h
@@ -9,6 +9,10 @@
#include <lmcons.h>
#include <ras.h>
+#include <winapifamily.h>
+
+#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -991,4 +995,6 @@ DWORD APIENTRY MprAdminServerSetInfoEx(
}
#endif
+#endif /* WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP) */
+
#endif /* __ROUTING_MPRADMIN_H__ */
diff --git a/mingw-w64-headers/include/nldef.h b/mingw-w64-headers/include/nldef.h
index 5a6a767..e61f104 100644
--- a/mingw-w64-headers/include/nldef.h
+++ b/mingw-w64-headers/include/nldef.h
@@ -7,7 +7,7 @@
#define _NLDEF_
#include <winapifamily.h>
-#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
+#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP) || _WIN32_WINNT >= 0x0A00
typedef enum {
NldsInvalid,
--
2.8.1
From fac8ad8364470439dc4a726c01fc2a6f7272e97f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= <hugo@beauzee.fr>
Date: Mon, 20 Jun 2016 19:32:12 +0200
Subject: [PATCH] winstorecompat: Provide a GetFileInformationByHandle
replacement
---
mingw-w64-headers/include/fileapi.h | 6 +--
mingw-w64-libraries/winstorecompat/Makefile.am | 1 +
.../src/GetFileInformationByHandle.c | 57 ++++++++++++++++++++++
3 files changed, 61 insertions(+), 3 deletions(-)
create mode 100644 mingw-w64-libraries/winstorecompat/src/GetFileInformationByHandle.c
diff --git a/mingw-w64-headers/include/fileapi.h b/mingw-w64-headers/include/fileapi.h
index eb7ccc9..ab348f6 100755
--- a/mingw-w64-headers/include/fileapi.h
+++ b/mingw-w64-headers/include/fileapi.h
@@ -33,8 +33,6 @@ WINBASEAPI DWORD WINAPI GetFileAttributesW (LPCWSTR lpFileName);
#define GetFileAttributes __MINGW_NAME_AW(GetFileAttributes)
WINBASEAPI DWORD WINAPI GetFileSize (HANDLE hFile, LPDWORD lpFileSizeHigh);
WINBASEAPI DWORD WINAPI SetFilePointer (HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh, DWORD dwMoveMethod);
-#endif
-#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
typedef struct _BY_HANDLE_FILE_INFORMATION {
DWORD dwFileAttributes;
FILETIME ftCreationTime;
@@ -48,6 +46,9 @@ WINBASEAPI DWORD WINAPI SetFilePointer (HANDLE hFile, LONG lDistanceToMove, PLON
DWORD nFileIndexLow;
} BY_HANDLE_FILE_INFORMATION, *PBY_HANDLE_FILE_INFORMATION,
*LPBY_HANDLE_FILE_INFORMATION;
+WINBASEAPI WINBOOL WINAPI GetFileInformationByHandle (HANDLE hFile, LPBY_HANDLE_FILE_INFORMATION lpFileInformation);
+#endif
+#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
WINBASEAPI LONG WINAPI CompareFileTime (CONST FILETIME *lpFileTime1, CONST FILETIME *lpFileTime2);
WINBASEAPI HANDLE WINAPI CreateFileA (LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile);
@@ -68,7 +69,6 @@ WINBASEAPI DWORD WINAPI SetFilePointer (HANDLE hFile, LONG lDistanceToMove, PLON
WINBASEAPI UINT WINAPI GetDriveTypeA (LPCSTR lpRootPathName);
WINBASEAPI UINT WINAPI GetDriveTypeW (LPCWSTR lpRootPathName);
WINBASEAPI DWORD WINAPI GetFileAttributesA (LPCSTR lpFileName);
- WINBASEAPI WINBOOL WINAPI GetFileInformationByHandle (HANDLE hFile, LPBY_HANDLE_FILE_INFORMATION lpFileInformation);
WINBASEAPI WINBOOL WINAPI GetFileSizeEx (HANDLE hFile, PLARGE_INTEGER lpFileSize);
WINBASEAPI WINBOOL WINAPI GetFileTime (HANDLE hFile, LPFILETIME lpCreationTime, LPFILETIME lpLastAccessTime, LPFILETIME lpLastWriteTime);
WINBASEAPI DWORD WINAPI GetFileType (HANDLE hFile);
diff --git a/mingw-w64-libraries/winstorecompat/Makefile.am b/mingw-w64-libraries/winstorecompat/Makefile.am
index 332cae5..66de268 100644
--- a/mingw-w64-libraries/winstorecompat/Makefile.am
+++ b/mingw-w64-libraries/winstorecompat/Makefile.am
@@ -36,4 +36,5 @@ libwinstorecompat_a_SOURCES = \
src/SHGetFolderPathW.c \
src/QueueTimer.c \
src/Crypto.c \
+ src/GetFileInformationByHandle.c \
$(NULL)
diff --git a/mingw-w64-libraries/winstorecompat/src/GetFileInformationByHandle.c b/mingw-w64-libraries/winstorecompat/src/GetFileInformationByHandle.c
new file mode 100644
index 0000000..89f8256
--- /dev/null
+++ b/mingw-w64-libraries/winstorecompat/src/GetFileInformationByHandle.c
@@ -0,0 +1,57 @@
+/*
+ Copyright (c) 2016 mingw-w64 project
+
+ Contributing authors: Hugo Beauzée-Luyssen
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+*/
+
+#define _WIN32_WINNT 0x0A00
+
+#define GetFileInformationByHandle __GetFileInformationByHandle
+#include <windows.h>
+
+#undef GetFileInformationByHandle
+
+BOOL WINAPI GetFileInformationByHandle(HANDLE hFile, LPBY_HANDLE_FILE_INFORMATION lpFileInformation)
+{
+ FILE_BASIC_INFO basicInfo;
+ if (!GetFileInformationByHandleEx(hFile, FileBasicInfo, &basicInfo, sizeof(basicInfo)))
+ return FALSE;
+ lpFileInformation->dwFileAttributes = basicInfo.FileAttributes;
+ lpFileInformation->ftCreationTime.dwLowDateTime = basicInfo.CreationTime.LowPart;
+ lpFileInformation->ftCreationTime.dwHighDateTime = basicInfo.CreationTime.HighPart;
+ lpFileInformation->ftLastAccessTime.dwLowDateTime = basicInfo.LastAccessTime.LowPart;
+ lpFileInformation->ftLastAccessTime.dwHighDateTime = basicInfo.LastAccessTime.HighPart;
+ lpFileInformation->ftLastWriteTime.dwLowDateTime = basicInfo.ChangeTime.LowPart;
+ lpFileInformation->ftLastWriteTime.dwHighDateTime = basicInfo.ChangeTime.HighPart;
+
+ FILE_STANDARD_INFO standardInfo;
+ if (!GetFileInformationByHandleEx(hFile, FileStandardInfo, &standardInfo, sizeof(standardInfo)))
+ return FALSE;
+ lpFileInformation->nNumberOfLinks = standardInfo.NumberOfLinks;
+ lpFileInformation->nFileSizeLow = standardInfo.AllocationSize.LowPart;
+ lpFileInformation->nFileSizeHigh = standardInfo.AllocationSize.HighPart;
+
+ // Missing FileID & volume serial number
+ lpFileInformation->dwVolumeSerialNumber = 0;
+ lpFileInformation->nFileIndexHigh = 0;
+ lpFileInformation->nFileIndexLow = 0;
+ return TRUE;
+}
--
2.8.1
......@@ -14,7 +14,7 @@ ENV PATH=$TOOLCHAIN_PREFIX/bin:$PATH
COPY no-rtl-func.patch .
COPY missing-snprintf.patch .
COPY mingw-w64-windows10.patch .
COPY winstorecompat.patch .
RUN mkdir /build && cd /build && \
mkdir $TOOLCHAIN_PREFIX && \
......@@ -27,7 +27,7 @@ RUN mkdir /build && cd /build && \
git clone --depth=1 git://git.code.sf.net/p/mingw-w64/mingw-w64 && \
cd mingw-w64 && git am ../../no-rtl-func.patch && \
git am ../../missing-snprintf.patch && \
git am ../../mingw-w64-windows10.patch && \
git am ../../winstorecompat.patch && \
cd .. && \
tar xf gcc-5.3.0.tar.bz2 && \
tar xf binutils-2.26.tar.bz2 && \
......
From 504e345b25603ca2f8896db82a4293351ba7cc4f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= <hugo@beauzee.fr>
Date: Thu, 16 Jun 2016 15:56:54 +0200
Subject: [PATCH] headers: Adjust header guards for Windows 10
---
mingw-w64-headers/include/iphlpapi.h | 8 ++++++--
mingw-w64-headers/include/iprtrmib.h | 5 +++++
mingw-w64-headers/include/mprapi.h | 6 ++++++
mingw-w64-headers/include/nldef.h | 2 +-
4 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/mingw-w64-headers/include/iphlpapi.h b/mingw-w64-headers/include/iphlpapi.h
index 03aed33..5523f81 100644
--- a/mingw-w64-headers/include/iphlpapi.h
+++ b/mingw-w64-headers/include/iphlpapi.h
@@ -8,8 +8,6 @@
#include <winapifamily.h>
-#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -19,6 +17,10 @@ extern "C" {
#include <iptypes.h>
#include <tcpestats.h>
+#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP) || _WIN32_WINNT >= 0x0A00
+
+#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
+
DWORD WINAPI GetNumberOfInterfaces (PDWORD pdwNumIf);
DWORD WINAPI GetIfEntry (PMIB_IFROW pIfRow);
DWORD WINAPI GetIfTable (PMIB_IFTABLE pIfTable, PULONG pdwSize, WINBOOL bOrder);
@@ -94,6 +96,8 @@ extern "C" {
ULONG WINAPI GetAdaptersInfo (PIP_ADAPTER_INFO AdapterInfo, PULONG SizePointer);
PIP_ADAPTER_ORDER_MAP WINAPI GetAdapterOrderMap (VOID);
+#endif
+
#ifdef _WINSOCK2API_
ULONG WINAPI GetAdaptersAddresses (ULONG Family, ULONG Flags, PVOID Reserved, PIP_ADAPTER_ADDRESSES AdapterAddresses, PULONG SizePointer);
#endif
diff --git a/mingw-w64-headers/include/iprtrmib.h b/mingw-w64-headers/include/iprtrmib.h
index 93e0cad..65ca264 100644
--- a/mingw-w64-headers/include/iprtrmib.h
+++ b/mingw-w64-headers/include/iprtrmib.h
@@ -6,6 +6,9 @@
#ifndef __ROUTING_IPRTRMIB_H__
#define __ROUTING_IPRTRMIB_H__
+#include <winapifamily.h>
+#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
+
#include <mprapi.h>
#include <ipmib.h>
#include <ipifcons.h>
@@ -772,4 +775,6 @@ typedef enum _TCPIP_OWNER_MODULE_INFO_CLASS {
#define CAST_MIB_INFO(X,Y,Z) Z = (Y)(X->rgbyData)
+#endif /*WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)*/
+
#endif /* __ROUTING_IPRTRMIB_H__ */
diff --git a/mingw-w64-headers/include/mprapi.h b/mingw-w64-headers/include/mprapi.h
index 2103c2b..7bbc1d7 100644
--- a/mingw-w64-headers/include/mprapi.h
+++ b/mingw-w64-headers/include/mprapi.h
@@ -9,6 +9,10 @@
#include <lmcons.h>
#include <ras.h>
+#include <winapifamily.h>
+
+#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -991,4 +995,6 @@ DWORD APIENTRY MprAdminServerSetInfoEx(
}
#endif
+#endif /* WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP) */
+
#endif /* __ROUTING_MPRADMIN_H__ */
diff --git a/mingw-w64-headers/include/nldef.h b/mingw-w64-headers/include/nldef.h
index 5a6a767..e61f104 100644
--- a/mingw-w64-headers/include/nldef.h
+++ b/mingw-w64-headers/include/nldef.h
@@ -7,7 +7,7 @@
#define _NLDEF_
#include <winapifamily.h>
-#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
+#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP) || _WIN32_WINNT >= 0x0A00
typedef enum {
NldsInvalid,
--
2.8.1
From fac8ad8364470439dc4a726c01fc2a6f7272e97f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= <hugo@beauzee.fr>
Date: Mon, 20 Jun 2016 19:32:12 +0200
Subject: [PATCH] winstorecompat: Provide a GetFileInformationByHandle
replacement
---
mingw-w64-headers/include/fileapi.h | 6 +--
mingw-w64-libraries/winstorecompat/Makefile.am | 1 +
.../src/GetFileInformationByHandle.c | 57 ++++++++++++++++++++++
3 files changed, 61 insertions(+), 3 deletions(-)
create mode 100644 mingw-w64-libraries/winstorecompat/src/GetFileInformationByHandle.c
diff --git a/mingw-w64-headers/include/fileapi.h b/mingw-w64-headers/include/fileapi.h
index eb7ccc9..ab348f6 100755
--- a/mingw-w64-headers/include/fileapi.h
+++ b/mingw-w64-headers/include/fileapi.h
@@ -33,8 +33,6 @@ WINBASEAPI DWORD WINAPI GetFileAttributesW (LPCWSTR lpFileName);
#define GetFileAttributes __MINGW_NAME_AW(GetFileAttributes)
WINBASEAPI DWORD WINAPI GetFileSize (HANDLE hFile, LPDWORD lpFileSizeHigh);
WINBASEAPI DWORD WINAPI SetFilePointer (HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh, DWORD dwMoveMethod);
-#endif
-#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
typedef struct _BY_HANDLE_FILE_INFORMATION {
DWORD dwFileAttributes;
FILETIME ftCreationTime;
@@ -48,6 +46,9 @@ WINBASEAPI DWORD WINAPI SetFilePointer (HANDLE hFile, LONG lDistanceToMove, PLON
DWORD nFileIndexLow;
} BY_HANDLE_FILE_INFORMATION, *PBY_HANDLE_FILE_INFORMATION,
*LPBY_HANDLE_FILE_INFORMATION;
+WINBASEAPI WINBOOL WINAPI GetFileInformationByHandle (HANDLE hFile, LPBY_HANDLE_FILE_INFORMATION lpFileInformation);
+#endif
+#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
WINBASEAPI LONG WINAPI CompareFileTime (CONST FILETIME *lpFileTime1, CONST FILETIME *lpFileTime2);
WINBASEAPI HANDLE WINAPI CreateFileA (LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile);
@@ -68,7 +69,6 @@ WINBASEAPI DWORD WINAPI SetFilePointer (HANDLE hFile, LONG lDistanceToMove, PLON
WINBASEAPI UINT WINAPI GetDriveTypeA (LPCSTR lpRootPathName);
WINBASEAPI UINT WINAPI GetDriveTypeW (LPCWSTR lpRootPathName);
WINBASEAPI DWORD WINAPI GetFileAttributesA (LPCSTR lpFileName);
- WINBASEAPI WINBOOL WINAPI GetFileInformationByHandle (HANDLE hFile, LPBY_HANDLE_FILE_INFORMATION lpFileInformation);
WINBASEAPI WINBOOL WINAPI GetFileSizeEx (HANDLE hFile, PLARGE_INTEGER lpFileSize);
WINBASEAPI WINBOOL WINAPI GetFileTime (HANDLE hFile, LPFILETIME lpCreationTime, LPFILETIME lpLastAccessTime, LPFILETIME lpLastWriteTime);
WINBASEAPI DWORD WINAPI GetFileType (HANDLE hFile);
diff --git a/mingw-w64-libraries/winstorecompat/Makefile.am b/mingw-w64-libraries/winstorecompat/Makefile.am
index 332cae5..66de268 100644
--- a/mingw-w64-libraries/winstorecompat/Makefile.am
+++ b/mingw-w64-libraries/winstorecompat/Makefile.am
@@ -36,4 +36,5 @@ libwinstorecompat_a_SOURCES = \
src/SHGetFolderPathW.c \
src/QueueTimer.c \
src/Crypto.c \
+ src/GetFileInformationByHandle.c \
$(NULL)
diff --git a/mingw-w64-libraries/winstorecompat/src/GetFileInformationByHandle.c b/mingw-w64-libraries/winstorecompat/src/GetFileInformationByHandle.c
new file mode 100644
index 0000000..89f8256
--- /dev/null
+++ b/mingw-w64-libraries/winstorecompat/src/GetFileInformationByHandle.c
@@ -0,0 +1,57 @@
+/*
+ Copyright (c) 2016 mingw-w64 project
+
+ Contributing authors: Hugo Beauzée-Luyssen
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+*/
+
+#define _WIN32_WINNT 0x0A00
+
+#define GetFileInformationByHandle __GetFileInformationByHandle
+#include <windows.h>
+
+#undef GetFileInformationByHandle
+
+BOOL WINAPI GetFileInformationByHandle(HANDLE hFile, LPBY_HANDLE_FILE_INFORMATION lpFileInformation)
+{
+ FILE_BASIC_INFO basicInfo;
+ if (!GetFileInformationByHandleEx(hFile, FileBasicInfo, &basicInfo, sizeof(basicInfo)))
+ return FALSE;
+ lpFileInformation->dwFileAttributes = basicInfo.FileAttributes;
+ lpFileInformation->ftCreationTime.dwLowDateTime = basicInfo.CreationTime.LowPart;
+ lpFileInformation->ftCreationTime.dwHighDateTime = basicInfo.CreationTime.HighPart;
+ lpFileInformation->ftLastAccessTime.dwLowDateTime = basicInfo.LastAccessTime.LowPart;
+ lpFileInformation->ftLastAccessTime.dwHighDateTime = basicInfo.LastAccessTime.HighPart;
+ lpFileInformation->ftLastWriteTime.dwLowDateTime = basicInfo.ChangeTime.LowPart;
+ lpFileInformation->ftLastWriteTime.dwHighDateTime = basicInfo.ChangeTime.HighPart;
+
+ FILE_STANDARD_INFO standardInfo;
+ if (!GetFileInformationByHandleEx(hFile, FileStandardInfo, &standardInfo, sizeof(standardInfo)))
+ return FALSE;
+ lpFileInformation->nNumberOfLinks = standardInfo.NumberOfLinks;
+ lpFileInformation->nFileSizeLow = standardInfo.AllocationSize.LowPart;
+ lpFileInformation->nFileSizeHigh = standardInfo.AllocationSize.HighPart;
+
+ // Missing FileID & volume serial number
+ lpFileInformation->dwVolumeSerialNumber = 0;
+ lpFileInformation->nFileIndexHigh = 0;
+ lpFileInformation->nFileIndexLow = 0;
+ return TRUE;
+}
--
2.8.1
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment