This is the mail archive of the
cygwin-apps
mailing list for the Cygwin project.
Re: [RFC] setup: allow building with i686-w64-mingw32
- From: "Yaakov (Cygwin/X)" <yselkowitz at users dot sourceforge dot net>
- To: cygwin-apps <cygwin-apps at cygwin dot com>
- Cc: mingw-w64-public at lists dot sourceforge dot net
- Date: Wed, 29 Aug 2012 20:57:29 -0500
- Subject: Re: [RFC] setup: allow building with i686-w64-mingw32
- References: <4FC87306.2080405@users.sourceforge.net>
On Fri, 2012-06-01 at 02:45 -0500, Yaakov (Cygwin/X) wrote:
> The attached draft patch fixes most of the issues with the build. (I
> just added the necessary mingw64-i686-* libraries to Ports.) ntdll.h
> needs some more work though; perhaps JonY could provide some input?
Revised patches for mingw-w64-headers SVN HEAD attached.
Yaakov
2012-08-29 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* stdio.h (_mingw_ovr): Use GCC form for both C and C++.
* wchar.h (_mingw_ovr): Ditto.
Index: crt/stdio.h
===================================================================
--- crt/stdio.h (revision 5375)
+++ crt/stdio.h (working copy)
@@ -624,10 +624,10 @@
int __cdecl __mingw_vsnwprintf (wchar_t * __restrict__ , size_t, const wchar_t * __restrict__ , va_list);
#undef __mingw_ovr
-#ifdef __cplusplus
-#define __mingw_ovr inline __cdecl
-#elif defined (__GNUC__)
+#if defined (__GNUC__)
#define __mingw_ovr static __attribute__ ((__unused__)) __inline__ __cdecl
+#elif defined(__cplusplus)
+#define __mingw_ovr inline __cdecl
#else
#define __mingw_ovr static __cdecl
#endif
Index: crt/wchar.h
===================================================================
--- crt/wchar.h (revision 5375)
+++ crt/wchar.h (working copy)
@@ -450,10 +450,10 @@
int __cdecl __mingw_vsnwprintf (wchar_t * __restrict__ , size_t, const wchar_t * __restrict__ , va_list);
#undef __mingw_ovr
-#ifdef __cplusplus
-#define __mingw_ovr inline __cdecl
-#elif defined (__GNUC__)
+#if defined (__GNUC__)
#define __mingw_ovr static __attribute__ ((__unused__)) __inline__ __cdecl
+#elif defined(__cplusplus)
+#define __mingw_ovr inline __cdecl
#else
#define __mingw_ovr static __cdecl
#endif
2012-08-29 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* ntdef.h (_OBJECT_ATTRIBUTES): Guard against duplicate declaration.
* winnt.h (DECLSPEC_IMPORT): Do not redefine.
(FILE_SUPERSEDE...FILE_MAXIMUM_DISPOSITION): Copy from ntdef.h.
(FILE_DIRECTORY_FILE...FILE_OPEN_FOR_FREE_SPACE_QUERY): Ditto.
(FILE_SHARE_VALID_FLAGS): Ditto.
* winternl.h (_UNICODE_STRING): Guard against duplicate declaration.
(_STRING): Ditto.
(_OBJECT_ATTRIBUTES): Ditto.
(_FILE_LINK_INFORMATION): Copy from ddk/ntifs.h.
Index: include/ntdef.h
===================================================================
--- include/ntdef.h (revision 5375)
+++ include/ntdef.h (working copy)
@@ -509,6 +509,8 @@
/* Object Attributes */
+#ifndef __OBJECT_ATTRIBUTES_DEFINED
+#define __OBJECT_ATTRIBUTES_DEFINED
typedef struct _OBJECT_ATTRIBUTES {
ULONG Length;
HANDLE RootDirectory;
@@ -517,6 +519,7 @@
PVOID SecurityDescriptor;
PVOID SecurityQualityOfService;
} OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES;
+#endif
typedef CONST OBJECT_ATTRIBUTES *PCOBJECT_ATTRIBUTES;
/* Values for the Attributes member */
Index: include/winnt.h
===================================================================
--- include/winnt.h (revision 5375)
+++ include/winnt.h (working copy)
@@ -88,11 +88,13 @@
#include <basetsd.h>
+#ifndef DECLSPEC_IMPORT
#if defined(_X86_) || defined(__ia64__) || defined(__x86_64)
#define DECLSPEC_IMPORT __declspec(dllimport)
#else
#define DECLSPEC_IMPORT
#endif
+#endif
#ifndef DECLSPEC_NORETURN
#define DECLSPEC_NORETURN __declspec(noreturn)
@@ -3813,9 +3815,43 @@
#define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | FILE_APPEND_DATA | SYNCHRONIZE)
#define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE | FILE_READ_ATTRIBUTES | FILE_EXECUTE | SYNCHRONIZE)
+#define FILE_SUPERSEDE 0x00000000
+#define FILE_OPEN 0x00000001
+#define FILE_CREATE 0x00000002
+#define FILE_OPEN_IF 0x00000003
+#define FILE_OVERWRITE 0x00000004
+#define FILE_OVERWRITE_IF 0x00000005
+#define FILE_MAXIMUM_DISPOSITION 0x00000005
+
+#define FILE_DIRECTORY_FILE 0x00000001
+#define FILE_WRITE_THROUGH 0x00000002
+#define FILE_SEQUENTIAL_ONLY 0x00000004
+#define FILE_NO_INTERMEDIATE_BUFFERING 0x00000008
+#define FILE_SYNCHRONOUS_IO_ALERT 0x00000010
+#define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020
+#define FILE_NON_DIRECTORY_FILE 0x00000040
+#define FILE_CREATE_TREE_CONNECTION 0x00000080
+#define FILE_COMPLETE_IF_OPLOCKED 0x00000100
+#define FILE_NO_EA_KNOWLEDGE 0x00000200
+#define FILE_OPEN_REMOTE_INSTANCE 0x00000400
+#define FILE_RANDOM_ACCESS 0x00000800
+#define FILE_DELETE_ON_CLOSE 0x00001000
+#define FILE_OPEN_BY_FILE_ID 0x00002000
+#define FILE_OPEN_FOR_BACKUP_INTENT 0x00004000
+#define FILE_NO_COMPRESSION 0x00008000
+#if (NTDDI_VERSION >= NTDDI_WIN7)
+#define FILE_OPEN_REQUIRING_OPLOCK 0x00010000
+#define FILE_DISALLOW_EXCLUSIVE 0x00020000
+#endif /* (NTDDI_VERSION >= NTDDI_WIN7) */
+#define FILE_RESERVE_OPFILTER 0x00100000
+#define FILE_OPEN_REPARSE_POINT 0x00200000
+#define FILE_OPEN_NO_RECALL 0x00400000
+#define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000
+
#define FILE_SHARE_READ 0x00000001
#define FILE_SHARE_WRITE 0x00000002
#define FILE_SHARE_DELETE 0x00000004
+#define FILE_SHARE_VALID_FLAGS 0x00000007
#define FILE_ATTRIBUTE_READONLY 0x00000001
#define FILE_ATTRIBUTE_HIDDEN 0x00000002
#define FILE_ATTRIBUTE_SYSTEM 0x00000004
Index: include/winternl.h
===================================================================
--- include/winternl.h (revision 5375)
+++ include/winternl.h (working copy)
@@ -16,11 +16,14 @@
extern "C" {
#endif
+#ifndef __UNICODE_STRING_DEFINED
+#define __UNICODE_STRING_DEFINED
typedef struct _UNICODE_STRING {
USHORT Length;
USHORT MaximumLength;
PWSTR Buffer;
} UNICODE_STRING;
+#endif
typedef struct _PEB_LDR_DATA {
BYTE Reserved1[8];
@@ -85,11 +88,14 @@
typedef LONG NTSTATUS;
typedef CONST char *PCSZ;
+#ifndef __STRING_DEFINED
+#define __STRING_DEFINED
typedef struct _STRING {
USHORT Length;
USHORT MaximumLength;
PCHAR Buffer;
} STRING;
+#endif
typedef STRING *PSTRING;
typedef STRING ANSI_STRING;
@@ -102,6 +108,8 @@
typedef UNICODE_STRING *PUNICODE_STRING;
typedef const UNICODE_STRING *PCUNICODE_STRING;
+#ifndef __OBJECT_ATTRIBUTES_DEFINED
+#define __OBJECT_ATTRIBUTES_DEFINED
typedef struct _OBJECT_ATTRIBUTES {
ULONG Length;
#ifdef _WIN64
@@ -116,6 +124,7 @@
PVOID SecurityDescriptor;
PVOID SecurityQualityOfService;
} OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES;
+#endif
/* Values for the Attributes member */
#define OBJ_INHERIT 0x00000002
@@ -348,6 +357,13 @@
ACCESS_MASK AccessFlags;
} FILE_ACCESS_INFORMATION, *PFILE_ACCESS_INFORMATION;
+ typedef struct _FILE_LINK_INFORMATION {
+ BOOLEAN ReplaceIfExists;
+ HANDLE RootDirectory;
+ ULONG FileNameLength;
+ WCHAR FileName[1];
+ } FILE_LINK_INFORMATION, *PFILE_LINK_INFORMATION;
+
typedef struct _FILE_NAME_INFORMATION {
ULONG FileNameLength;
WCHAR FileName[1];
2012-08-29 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* winternl.h (_FILE_RENAME_INFORMATION): Fix member names per MSDN.
(NtQueryInformationFile): Change type of len to ULONG per MSDN.
Index: include/winternl.h
===================================================================
--- include/winternl.h (revision 5375)
+++ include/winternl.h (working copy)
@@ -370,8 +370,8 @@
} FILE_NAME_INFORMATION, *PFILE_NAME_INFORMATION;
typedef struct _FILE_RENAME_INFORMATION {
- BOOLEAN Replace;
- HANDLE RootDir;
+ BOOLEAN ReplaceIfExists;
+ HANDLE RootDirectory;
ULONG FileNameLength;
WCHAR FileName[1];
} FILE_RENAME_INFORMATION, *PFILE_RENAME_INFORMATION;
@@ -856,7 +856,7 @@
ULONG WINAPI RtlNtStatusToDosError (NTSTATUS Status);
NTSTATUS WINAPI NtQueryInformationProcess(HANDLE ProcessHandle,PROCESSINFOCLASS ProcessInformationClass,PVOID ProcessInformation,ULONG ProcessInformationLength,PULONG ReturnLength);
NTSTATUS WINAPI NtQueryInformationThread(HANDLE ThreadHandle,THREADINFOCLASS ThreadInformationClass,PVOID ThreadInformation,ULONG ThreadInformationLength,PULONG ReturnLength);
- NTSTATUS WINAPI NtQueryInformationFile(HANDLE hFile,PIO_STATUS_BLOCK io,PVOID ptr,LONG len,FILE_INFORMATION_CLASS FileInformationClass);
+ NTSTATUS WINAPI NtQueryInformationFile(HANDLE hFile,PIO_STATUS_BLOCK io,PVOID ptr,ULONG len,FILE_INFORMATION_CLASS FileInformationClass);
NTSTATUS WINAPI NtQueryObject(HANDLE Handle,OBJECT_INFORMATION_CLASS ObjectInformationClass,PVOID ObjectInformation,ULONG ObjectInformationLength,PULONG ReturnLength);
NTSTATUS WINAPI NtQuerySystemInformation(SYSTEM_INFORMATION_CLASS SystemInformationClass,PVOID SystemInformation,ULONG SystemInformationLength,PULONG ReturnLength);
NTSTATUS WINAPI NtQuerySystemTime(PLARGE_INTEGER SystemTime);