From 2bc656465098b40e5535d4bc661f349b372b358e Mon Sep 17 00:00:00 2001 From: ThirteenAG Date: Fri, 31 May 2024 22:14:29 +0800 Subject: [PATCH] remove comctl32 dependency --- source/dllmain.cpp | 47 +++++----------------------------------------- 1 file changed, 5 insertions(+), 42 deletions(-) diff --git a/source/dllmain.cpp b/source/dllmain.cpp index 381b732..b2fae78 100644 --- a/source/dllmain.cpp +++ b/source/dllmain.cpp @@ -1,9 +1,5 @@ #include "dllmain.h" #include "exception.hpp" -#include -#include -#pragma comment(lib,"Comctl32.lib") -#pragma comment(linker,"\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") #include #include #include @@ -33,18 +29,6 @@ std::vector> updateFilenames; thread_local std::string sCurrentFindFileDirA; thread_local std::wstring sCurrentFindFileDirW; -HRESULT CALLBACK TaskDialogCallbackProc(HWND hwnd, UINT uNotification, WPARAM wParam, LPARAM lParam, LONG_PTR dwRefData) -{ - switch (uNotification) - { - case TDN_HYPERLINK_CLICKED: - ShellExecuteW(hwnd, L"open", (LPCWSTR)lParam, NULL, NULL, SW_SHOW); - break; - } - - return S_OK; -} - bool iequals(std::wstring_view s1, std::wstring_view s2) { std::wstring str1(std::move(s1)); @@ -676,40 +660,19 @@ void FindFiles(WIN32_FIND_DATAW* fd) auto e = GetLastError(); if (e != ERROR_DLL_INIT_FAILED && e != ERROR_BAD_EXE_FORMAT) // in case dllmain returns false or IMAGE_MACHINE is not compatible { - TASKDIALOGCONFIG tdc = { sizeof(TASKDIALOGCONFIG) }; - int nClickedBtn; - BOOL bCheckboxChecked; - LPCWSTR szTitle = L"ASI Loader", szHeader = L"", szContent = L""; - TASKDIALOG_BUTTON aCustomButtons[] = { { 1000, L"Continue" } }; - - std::wstring msg = L"Unable to load " + std::wstring(fd->cFileName) + L". Error: " + std::to_wstring(e); - szHeader = msg.c_str(); - + std::wstring msg = L"Unable to load " + std::wstring(fd->cFileName) + L". Error: " + std::to_wstring(e) + L"."; if (e == ERROR_MOD_NOT_FOUND) { - szContent = L"This ASI file requires a dependency that is missing from your system. To identify the missing dependency, download and run the free, open-source app, " \ - L"Dependencies.\n\n" \ - L"https://github.com/lucasg/Dependencies"; + msg += L" This ASI file requires a dependency that is missing from your system. " \ + "To identify the missing dependency, download and run the free, open-source app, " \ + "Dependencies at https://github.com/lucasg/Dependencies"; } - - tdc.hwndParent = NULL; - tdc.dwFlags = TDF_USE_COMMAND_LINKS | TDF_ENABLE_HYPERLINKS | TDF_SIZE_TO_CONTENT | TDF_CAN_BE_MINIMIZED; - tdc.pButtons = aCustomButtons; - tdc.cButtons = _countof(aCustomButtons); - tdc.pszWindowTitle = szTitle; - tdc.pszMainIcon = TD_ERROR_ICON; - tdc.pszMainInstruction = szHeader; - tdc.pszContent = szContent; - tdc.pfCallback = TaskDialogCallbackProc; - tdc.lpCallbackData = 0; - - std::ignore = TaskDialogIndirect(&tdc, &nClickedBtn, NULL, &bCheckboxChecked); + MessageBoxW(0, msg.c_str(), L"ASI Loader", MB_ICONERROR); } } else { auto procedure = (void(*)())GetProcAddress(h, "InitializeASI"); - if (procedure != NULL) { procedure();