Skip to content

Commit 4e7fce3

Browse files
committed
remove comctl32 dependency
1 parent c2f36b3 commit 4e7fce3

File tree

1 file changed

+6
-42
lines changed

1 file changed

+6
-42
lines changed

source/dllmain.cpp

+6-42
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
#include "dllmain.h"
22
#include "exception.hpp"
3-
#include <shellapi.h>
4-
#include <Commctrl.h>
5-
#pragma comment(lib,"Comctl32.lib")
6-
#pragma comment(linker,"\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
73
#include <initguid.h>
84
#include <filesystem>
95
#include <safetyhook.hpp>
@@ -33,18 +29,6 @@ std::vector<std::pair<std::filesystem::path, LARGE_INTEGER>> updateFilenames;
3329
thread_local std::string sCurrentFindFileDirA;
3430
thread_local std::wstring sCurrentFindFileDirW;
3531

36-
HRESULT CALLBACK TaskDialogCallbackProc(HWND hwnd, UINT uNotification, WPARAM wParam, LPARAM lParam, LONG_PTR dwRefData)
37-
{
38-
switch (uNotification)
39-
{
40-
case TDN_HYPERLINK_CLICKED:
41-
ShellExecuteW(hwnd, L"open", (LPCWSTR)lParam, NULL, NULL, SW_SHOW);
42-
break;
43-
}
44-
45-
return S_OK;
46-
}
47-
4832
bool iequals(std::wstring_view s1, std::wstring_view s2)
4933
{
5034
std::wstring str1(std::move(s1));
@@ -676,40 +660,20 @@ void FindFiles(WIN32_FIND_DATAW* fd)
676660
auto e = GetLastError();
677661
if (e != ERROR_DLL_INIT_FAILED && e != ERROR_BAD_EXE_FORMAT) // in case dllmain returns false or IMAGE_MACHINE is not compatible
678662
{
679-
TASKDIALOGCONFIG tdc = { sizeof(TASKDIALOGCONFIG) };
680-
int nClickedBtn;
681-
BOOL bCheckboxChecked;
682-
LPCWSTR szTitle = L"ASI Loader", szHeader = L"", szContent = L"";
683-
TASKDIALOG_BUTTON aCustomButtons[] = { { 1000, L"Continue" } };
684-
685-
std::wstring msg = L"Unable to load " + std::wstring(fd->cFileName) + L". Error: " + std::to_wstring(e);
686-
szHeader = msg.c_str();
687-
663+
std::wstring msg = L"Unable to load " + std::wstring(fd->cFileName) + L". Error: " + std::to_wstring(e) + L".";
688664
if (e == ERROR_MOD_NOT_FOUND)
689665
{
690-
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, " \
691-
L"<a href=\"https://github.com/lucasg/Dependencies/releases/latest\">Dependencies</a>.\n\n" \
692-
L"<a href=\"https://github.com/lucasg/Dependencies\">https://github.com/lucasg/Dependencies</a>";
666+
msg += L" This ASI file requires a dependency that is missing from your system. " \
667+
"To identify the missing dependency, download and run the free, open-source app, " \
668+
"Dependencies at https://github.com/lucasg/Dependencies";
693669
}
694-
695-
tdc.hwndParent = NULL;
696-
tdc.dwFlags = TDF_USE_COMMAND_LINKS | TDF_ENABLE_HYPERLINKS | TDF_SIZE_TO_CONTENT | TDF_CAN_BE_MINIMIZED;
697-
tdc.pButtons = aCustomButtons;
698-
tdc.cButtons = _countof(aCustomButtons);
699-
tdc.pszWindowTitle = szTitle;
700-
tdc.pszMainIcon = TD_ERROR_ICON;
701-
tdc.pszMainInstruction = szHeader;
702-
tdc.pszContent = szContent;
703-
tdc.pfCallback = TaskDialogCallbackProc;
704-
tdc.lpCallbackData = 0;
705-
706-
std::ignore = TaskDialogIndirect(&tdc, &nClickedBtn, NULL, &bCheckboxChecked);
670+
MessageBoxW(0, msg.c_str(), L"ASI Loader", MB_ICONERROR);
707671
}
708672
}
709673
else
710674
{
711675
auto procedure = (void(*)())GetProcAddress(h, "InitializeASI");
712-
676+
713677
if (procedure != NULL)
714678
{
715679
procedure();

0 commit comments

Comments
 (0)