From 33d00cf0e4043d7b1cc169a7e448bcc381d75e97 Mon Sep 17 00:00:00 2001 From: nhmall Date: Wed, 30 Oct 2019 18:48:28 -0400 Subject: [PATCH] attempt to get mingw building correctly after recent changes make typedef of boolean match mingw header files link with shell32 and ole32 as Makefile.msc now had to do kludge some stuff missing from mingw headers in sys/winnt/windmain.c --- include/global.h | 5 +++-- sys/winnt/Makefile.gcc | 6 +++--- sys/winnt/windmain.c | 17 +++++++++++++++++ 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/include/global.h b/include/global.h index 6e0f96ebf..feb9f75fb 100644 --- a/include/global.h +++ b/include/global.h @@ -70,9 +70,10 @@ * since otherwise comparisons with signed quantities are done incorrectly */ typedef schar xchar; -#if defined(__GNUC__) && defined(WIN32) && defined(__cplusplus) + +#ifdef __MINGW32__ /* Resolve conflict with Qt 5 and MinGW-w32 */ -typedef uchar boolean; /* 0 or 1 */ +typedef unsigned char boolean; /* 0 or 1 */ #else #ifndef SKIP_BOOLEAN typedef xchar boolean; /* 0 or 1 */ diff --git a/sys/winnt/Makefile.gcc b/sys/winnt/Makefile.gcc index 358965369..e8123334f 100644 --- a/sys/winnt/Makefile.gcc +++ b/sys/winnt/Makefile.gcc @@ -510,9 +510,9 @@ endif CFLAGSBASE = -c $(cflags) $(WINPINC) $(cdebug) $(CURSESDEF) #LFLAGSBASEC = $(linkdebug) #LFLAGSBASEG = $(linkdebug) -mwindows - -conlibs = -lgdi32 -lwinmm $(BCRYPT) -guilibs = -lcomctl32 -lwinmm +baselibs = -lwinmm -lshell32 -lole32 +conlibs = -lgdi32 $(baselibs) $(BCRYPT) +guilibs = -lcomctl32 $(baselibs) ifeq "$(WANT_WIN_QT4)" "Y" # Might be either Qt 4 or Qt 5 ifeq "$(HAVE_QT5)" "Y" diff --git a/sys/winnt/windmain.c b/sys/winnt/windmain.c index 14734900b..1e140b0d6 100644 --- a/sys/winnt/windmain.c +++ b/sys/winnt/windmain.c @@ -11,9 +11,26 @@ #include #include #include +#ifndef __MINGW32__ #include +#endif #include +#ifdef __MINGW32__ +extern LONG GetCurrentPackageFullName(UINT32 *packageFullNameLength, + PWSTR packageFullName); +extern HRESULT SHGetKnownFolderPath(REFKNOWNFOLDERID rfid, + DWORD dwFlags, HANDLE hToken, PWSTR *ppszPath); +#ifdef INITGUID +#define DEFINE_KNOWN_FOLDER(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) const GUID DECLSPEC_SELECTANY name = { l, w1, w2,{ b1, b2, b3, b4, b5, b6, b7, b8 } } +#else +#define DEFINE_KNOWN_FOLDER(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) const GUID name +#endif +DEFINE_KNOWN_FOLDER (FOLDERID_ProgramData, 0x62ab5d82, 0xfdc1, 0x4dc3, 0xa9, 0xdd, 0x07, 0x0d, 0x1d, 0x49, 0x5d, 0x97); +DEFINE_KNOWN_FOLDER (FOLDERID_LocalAppData, 0xf1b32785, 0x6fba, 0x4fcf, 0x9d, 0x55, 0x7b, 0x8e, 0x7f, 0x15, 0x70, 0x91); +DEFINE_KNOWN_FOLDER (FOLDERID_Profile, 0x5e6c858f, 0x0e22, 0x4760, 0x9a, 0xfe, 0xea, 0x33, 0x17, 0xb6, 0x71, 0x73); +#endif + #if 0 #include "wintty.h" #endif -- 2.49.0