Mercurial > minori
changeset 267:09c5bd74fe93
win32: make builds work again
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Thu, 11 Apr 2024 23:39:18 -0400 |
parents | 1a6a5d3a94cd |
children | 3efac0541151 |
files | Makefile.am configure.ac dep/animone/include/animone/fd/win32.h dep/animone/include/animone/util/win32.h dep/animone/src/fd/win32.cc dep/animone/src/win/win32.cc m4/m4_ax_have_qt.m4 |
diffstat | 7 files changed, 30 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile.am Thu Apr 11 22:05:41 2024 -0400 +++ b/Makefile.am Thu Apr 11 23:39:18 2024 -0400 @@ -99,7 +99,7 @@ ldflags_win = -mwindows # Add dark stylesheet to resources -qtrc_win = $(top_srcdir)/rc/win32/dark/dark.qrc +minori_qtrc_win = $(top_srcdir)/rc/sys/win32/dark/dark.qrc if BUILD_WINDRES @@ -232,6 +232,7 @@ $(files_windres) \ $(minori_locale_ts) \ $(minori_qtrc) \ + $(minori_qtrc_win) \ $(minori_locale_qm) \ $(minori_moc_sources) \ $(minori_utf8proc_sources) \ @@ -257,8 +258,8 @@ # Build only one qrc, otherwise we get a ton of # weird linking errors -rc/final_qrc.cc: $(minori_qtrc) - $(QT_RCC) -o $@ $(minori_qtrc) +rc/final_qrc.cc: $(minori_qtrc) $(minori_qtrc_win) + $(QT_RCC) -o $@ $(minori_qtrc) $(minori_qtrc_win) .h_moc.cc: $(MKDIR_P) -- $$(dirname $@)
--- a/configure.ac Thu Apr 11 22:05:41 2024 -0400 +++ b/configure.ac Thu Apr 11 23:39:18 2024 -0400 @@ -71,6 +71,8 @@ fi fi +AC_DEFINE([UTF8PROC_STATIC]) + AM_CONDITIONAL([BUILD_WIN], [test "x$build_windows" = "xyes"]) AM_CONDITIONAL([BUILD_OSX], [test "x$build_osx" = "xyes"]) AM_CONDITIONAL([BUILD_GLIB], [test "x$build_glib" = "xyes"])
--- a/dep/animone/include/animone/fd/win32.h Thu Apr 11 22:05:41 2024 -0400 +++ b/dep/animone/include/animone/fd/win32.h Thu Apr 11 23:39:18 2024 -0400 @@ -4,13 +4,12 @@ #include <set> #include <string> -#include <windows.h> - #include "animone/fd.h" #include "animone/types.h" namespace animone::internal::win32 { +bool GetProcessName(pid_t pid, std::string& name); bool EnumerateOpenProcesses(process_proc_t process_proc); bool EnumerateOpenFiles(const std::set<pid_t>& pids, open_file_proc_t open_file_proc);
--- a/dep/animone/include/animone/util/win32.h Thu Apr 11 22:05:41 2024 -0400 +++ b/dep/animone/include/animone/util/win32.h Thu Apr 11 23:39:18 2024 -0400 @@ -1,8 +1,9 @@ #ifndef ANIMONE_ANIMONE_UTIL_WIN32_H_ #define ANIMONE_ANIMONE_UTIL_WIN32_H_ +#include <windef.h> #include <subauth.h> -#include <windows.h> +#include <handleapi.h> #include <memory> #include <string> @@ -22,6 +23,7 @@ std::string ToUtf8String(const UNICODE_STRING& string); std::wstring ToWstring(const std::string& string); +std::wstring GetProcessPath(DWORD process_id); std::wstring GetFileNameFromPath(const std::wstring& path); std::wstring GetFileNameWithoutExtension(const std::wstring& filename);
--- a/dep/animone/src/fd/win32.cc Thu Apr 11 22:05:41 2024 -0400 +++ b/dep/animone/src/fd/win32.cc Thu Apr 11 23:39:18 2024 -0400 @@ -34,7 +34,6 @@ * TODO: implement SystemHandleInformation for systems older than XP */ static constexpr SYSTEM_INFORMATION_CLASS SystemExtendedHandleInformation = static_cast<SYSTEM_INFORMATION_CLASS>(0x40); -static constexpr SYSTEM_INFORMATION_CLASS SystemHandleInformation = static_cast<SYSTEM_INFORMATION_CLASS>(0x10); static constexpr NTSTATUS STATUS_INFO_LENGTH_MISMATCH = 0xC0000004UL; /* this is filled in at runtime because it's not guaranteed to be (and isn't) @@ -70,7 +69,9 @@ } NTSTATUS QuerySystemInformation(SYSTEM_INFORMATION_CLASS cls, PVOID sysinfo, ULONG len, - PULONG retlen){return nt_query_system_information(cls, sysinfo, len, retlen)} + PULONG retlen){ + return nt_query_system_information(cls, sysinfo, len, retlen); + } NTSTATUS QueryObject(HANDLE handle, OBJECT_INFORMATION_CLASS cls, PVOID objinf, ULONG objinflen, PULONG retlen) { return nt_query_object(handle, cls, objinf, objinflen, retlen); @@ -80,8 +81,7 @@ HMODULE ntdll; decltype(::NtQuerySystemInformation)* nt_query_system_information; decltype(::NtQueryObject)* nt_query_object; - -} +}; Ntdll ntdll; @@ -96,10 +96,10 @@ /* we should really put a cap on this */ ULONG cb = 1 << 19; NTSTATUS status = STATUS_NO_MEMORY; - std::unique_ptr<SYSTEM_HANDLE_INFORMATION_EX> info(malloc(cb)); + std::unique_ptr<SYSTEM_HANDLE_INFORMATION_EX> info; do { - info.reset(malloc(cb *= 2)); + info.reset(reinterpret_cast<SYSTEM_HANDLE_INFORMATION_EX*>(malloc(cb *= 2))); if (!info) continue; @@ -179,11 +179,12 @@ } bool GetProcessName(pid_t pid, std::string& name) { - std::wstring wname = GetProcessPath(); + std::wstring wname = GetProcessPath(pid); if (wname.empty()) return false; - return ToUtf8String(GetFileNameWithoutExtension(GetFileNameFromPath(wname))); + name = ToUtf8String(GetFileNameWithoutExtension(GetFileNameFromPath(wname))); + return true; } bool EnumerateOpenProcesses(process_proc_t process_proc) {
--- a/dep/animone/src/win/win32.cc Thu Apr 11 22:05:41 2024 -0400 +++ b/dep/animone/src/win/win32.cc Thu Apr 11 23:39:18 2024 -0400 @@ -9,6 +9,7 @@ #include "animone.h" #include "animone/util/win32.h" #include "animone/win.h" +#include "animone/fd.h" #include <set> #include <string> @@ -120,9 +121,9 @@ Process process; process.pid = GetWindowProcessId(hwnd); - process.name = fd::GetProcessName(process.pid) + GetProcessName(process.pid, process.name); - auto& window_proc = *reinterpret_cast<window_proc_t*>(param); + auto& window_proc = *reinterpret_cast<window_proc_t*>(param); if (!window_proc(process, window)) return FALSE;
--- a/m4/m4_ax_have_qt.m4 Thu Apr 11 22:05:41 2024 -0400 +++ b/m4/m4_ax_have_qt.m4 Thu Apr 11 23:39:18 2024 -0400 @@ -88,6 +88,7 @@ CONFIG -= debug_and_release CONFIG += release } +QMAKE_PROJECT_DEPTH = 0 qtHaveModule(core): QT += core qtHaveModule(gui): QT += gui qtHaveModule(widgets): QT += widgets @@ -105,7 +106,7 @@ $QMAKE $am_have_qt_pro -o $am_have_qt_makefile QT_CXXFLAGS=`cd $am_have_qt_dir; make -s -f $am_have_qt_makefile_vars CXXFLAGS` QT_LIBS=`cd $am_have_qt_dir; make -s -f $am_have_qt_makefile_vars LIBS` - rm $am_have_qt_pro $am_have_qt_stash $am_have_qt_makefile + rm $am_have_qt_pro $am_have_qt_stash $am_have_qt_makefile $am_have_qt_makefile_vars rmdir $am_have_qt_dir # Look for specific tools in $PATH @@ -171,7 +172,7 @@ }; EOF - cat > ax_qt_main.$ac_ext << EOF + cat > ax_qt_main.cc << EOF #include "ax_qt_test.h" #include <qapplication.h> int main( int argc, char **argv ) @@ -183,26 +184,26 @@ EOF ax_cv_qt_test_result="failure" - ax_try_1="$QT_MOC ax_qt_test.h -o moc_ax_qt_test.$ac_ext >/dev/null 2>/dev/null" + ax_try_1="$QT_MOC ax_qt_test.h -o moc_ax_qt_test.cc >/dev/null 2>/dev/null" AC_TRY_EVAL(ax_try_1) if test x"$ac_status" != x0; then echo "$ax_err_1" >&AS_MESSAGE_LOG_FD echo "configure: could not run $QT_MOC on:" >&AS_MESSAGE_LOG_FD cat ax_qt_test.h >&AS_MESSAGE_LOG_FD else - ax_try_2="$CXX $QT_CXXFLAGS -c $CXXFLAGS -o moc_ax_qt_test.o moc_ax_qt_test.$ac_ext >/dev/null 2>/dev/null" + ax_try_2="$CXX $QT_CXXFLAGS -c $CXXFLAGS -o moc_ax_qt_test.o moc_ax_qt_test.cc >/dev/null 2>/dev/null" AC_TRY_EVAL(ax_try_2) if test x"$ac_status" != x0; then echo "$ax_err_2" >&AS_MESSAGE_LOG_FD echo "configure: could not compile:" >&AS_MESSAGE_LOG_FD - cat moc_ax_qt_test.$ac_ext >&AS_MESSAGE_LOG_FD + cat moc_ax_qt_test.cc >&AS_MESSAGE_LOG_FD else - ax_try_3="$CXX $QT_CXXFLAGS -c $CXXFLAGS -o ax_qt_main.o ax_qt_main.$ac_ext >/dev/null 2>/dev/null" + ax_try_3="$CXX $QT_CXXFLAGS -c $CXXFLAGS -o ax_qt_main.o ax_qt_main.cc >/dev/null 2>/dev/null" AC_TRY_EVAL(ax_try_3) if test x"$ac_status" != x0; then echo "$ax_err_3" >&AS_MESSAGE_LOG_FD echo "configure: could not compile:" >&AS_MESSAGE_LOG_FD - cat ax_qt_main.$ac_ext >&AS_MESSAGE_LOG_FD + cat ax_qt_main.cc >&AS_MESSAGE_LOG_FD else ax_try_4="$CXX -o ax_qt_main ax_qt_main.o moc_ax_qt_test.o $QT_LIBS $LIBS >/dev/null 2>/dev/null" AC_TRY_EVAL(ax_try_4)