diff --git a/ExplorerPatcher/dllmain.c b/ExplorerPatcher/dllmain.c index 3c77141..8cdc341 100644 --- a/ExplorerPatcher/dllmain.c +++ b/ExplorerPatcher/dllmain.c @@ -51,7 +51,6 @@ RTL_OSVERSIONINFOW global_rovi; DWORD32 global_ubr; #endif #include -#include "../ep_gui/resources/EPCrashMessageResources.h" #define WINX_ADJUST_X 5 #define WINX_ADJUST_Y 5 @@ -200,6 +199,7 @@ BOOL g_bIsDesktopRaised = FALSE; #include "utility.h" #include "resource.h" +#include "../ep_gui/resources/EPSharedResources.h" #ifdef USE_PRIVATE_INTERFACES #include "ep_private.h" #endif @@ -11183,11 +11183,7 @@ DWORD InformUserAboutCrash(LPVOID unused) CrashCounterSettings cfg; GetCrashCounterSettings(&cfg); - wchar_t epGuiPath[MAX_PATH]; - ZeroMemory(epGuiPath, sizeof(epGuiPath)); - SHGetFolderPathW(NULL, SPECIAL_FOLDER, NULL, SHGFP_TYPE_CURRENT, epGuiPath); - wcscat_s(epGuiPath, MAX_PATH, _T(APP_RELATIVE_PATH) L"\\ep_gui.dll"); - HMODULE hEPGui = LoadLibraryExW(epGuiPath, NULL, LOAD_LIBRARY_AS_DATAFILE); + HMODULE hEPGui = LoadGuiModule(); if (!hEPGui) { return 0; // Can't load the strings, nothing to display diff --git a/ExplorerPatcher/symbols.c b/ExplorerPatcher/symbols.c index ca47cf0..570a7b1 100644 --- a/ExplorerPatcher/symbols.c +++ b/ExplorerPatcher/symbols.c @@ -22,44 +22,18 @@ const char* startui_SN[STARTUI_SB_CNT] = { STARTUI_SB_0 }; -const wchar_t DownloadSymbolsXML[] = -L"\r\n" -L" \r\n" -L" \r\n" -L" \r\n" -L" \r\n" -L" \r\n" -L" \r\n" -L" \r\n" -L" \r\n"; - -const wchar_t DownloadOKXML[] = -L"\r\n" -L" \r\n" -L" \r\n" -L" \r\n" -L" \r\n" -L" \r\n" -L" \r\n" -L" \r\n" -L" \r\n"; - -const wchar_t InstallOK[] = -L"\r\n" -L" \r\n" -L" \r\n" -L" \r\n" -L" \r\n" -L" \r\n" -L" \r\n" -L" \r\n" -L" \r\n"; +const wchar_t DownloadNotificationXML[] = + L"\r\n" + L" \r\n" + L" \r\n" + L" \r\n" + L" \r\n" + L" \r\n" + L" \r\n" + L" \r\n" + L" \r\n"; extern INT VnDownloadSymbols(HMODULE hModule, char* dllName, char* szLibPath, UINT sizeLibPath); extern INT VnGetSymbols(const char* pdb_file, DWORD* addresses, char** symbols, DWORD numOfSymbols); @@ -349,15 +323,14 @@ DWORD DownloadSymbols(DownloadSymbolsParams* params) printf("[Symbols] Started \"Download symbols\" thread.\n"); + HMODULE hEPGui = LoadGuiModule(); + RTL_OSVERSIONINFOW rovi; DWORD32 ubr = VnGetOSVersionAndUBR(&rovi); - TCHAR szReportedVersion[MAX_PATH + 1]; - ZeroMemory( - szReportedVersion, - sizeof(szReportedVersion) - ); - wsprintf( + wchar_t szReportedVersion[32]; + swprintf_s( szReportedVersion, + ARRAYSIZE(szReportedVersion), L"%d.%d.%d.%d", rovi.dwMajorVersion, rovi.dwMinorVersion, @@ -365,18 +338,50 @@ DWORD DownloadSymbols(DownloadSymbolsParams* params) ubr ); - TCHAR buffer[1000]; - ZeroMemory( - buffer, - 1000 + wchar_t title[100]; + wchar_t body[200]; + wchar_t titleFormat[100]; + wchar_t buffer[1000]; + title[0] = 0; body[0] = 0; titleFormat[0] = 0; buffer[0] = 0; + + // Don't annoy the user with "Downloading symbols" notification if the symbols aren't available in MS' servers + HKEY hKey = NULL; + DWORD dwDisposition; + RegCreateKeyExW( + HKEY_CURRENT_USER, + TEXT(REGPATH), + 0, + NULL, + REG_OPTION_NON_VOLATILE, + KEY_READ, + NULL, + &hKey, + &dwDisposition ); - wsprintf( - buffer, - DownloadSymbolsXML, - szReportedVersion + wchar_t szLastNotifiedBuild[32]; + szLastNotifiedBuild[0] = 0; + DWORD dwSize = sizeof(szLastNotifiedBuild); + RegQueryValueExW( + hKey, + TEXT("SymbolsLastNotifiedOSBuild"), + 0, + NULL, + szLastNotifiedBuild, + &dwSize ); - if (params->bVerbose) + + BOOL bNewBuild = wcscmp(szLastNotifiedBuild, szReportedVersion) != 0; + if (bNewBuild) { + if (LoadStringW(hEPGui, IDS_SYM_DL_T, titleFormat, ARRAYSIZE(titleFormat))) + { + swprintf_s(title, ARRAYSIZE(title), titleFormat, szReportedVersion); + } + + LoadStringW(hEPGui, IDS_SYM_DL_B, body, ARRAYSIZE(body)); + + swprintf_s(buffer, ARRAYSIZE(buffer), DownloadNotificationXML, L"https://github.com/valinet/ExplorerPatcher/wiki/Symbols", L"short", title, body); + HRESULT hr = S_OK; __x_ABI_CWindows_CData_CXml_CDom_CIXmlDocument* inputXml = NULL; hr = String2IXMLDocument( @@ -392,14 +397,26 @@ DWORD DownloadSymbols(DownloadSymbolsParams* params) hr = ShowToastMessage( inputXml, APPID, - sizeof(APPID) / sizeof(TCHAR) - 1, + sizeof(APPID) / sizeof(wchar_t) - 1, #ifdef DEBUG stdout #else NULL #endif ); + + RegSetValueExW( + hKey, + TEXT("SymbolsLastNotifiedOSBuild"), + 0, + REG_SZ, + szReportedVersion, + wcslen(szReportedVersion) * sizeof(wchar_t) + ); } + + RegCloseKey(hKey); + wprintf( L"[Symbols] " L"Attempting to download symbols for OS version %s.\n", @@ -433,80 +450,85 @@ DWORD DownloadSymbols(DownloadSymbolsParams* params) symbols_addr symbols_PTRS; ZeroMemory(&symbols_PTRS, sizeof(symbols_addr)); - BOOL bDownloaded = FALSE; + BOOL bAnySuccess = FALSE, bAllSuccess = TRUE; if (params->loadResult.bNeedToDownloadTwinuiPcshellSymbols) { - bDownloaded |= ProcessTwinuiPcshellSymbols(szSettingsPath, symbols_PTRS.twinui_pcshell_PTRS); + BOOL bSuccess = ProcessTwinuiPcshellSymbols(szSettingsPath, symbols_PTRS.twinui_pcshell_PTRS); + bAnySuccess |= bSuccess; + bAllSuccess &= bSuccess; } if (params->loadResult.bNeedToDownloadStartDockedSymbols && IsWindows11()) { - bDownloaded |= ProcessStartDockedSymbols(szSettingsPath, symbols_PTRS.startdocked_PTRS); + BOOL bSuccess = ProcessStartDockedSymbols(szSettingsPath, symbols_PTRS.startdocked_PTRS); + bAnySuccess |= bSuccess; + bAllSuccess &= bSuccess; } if (params->loadResult.bNeedToDownloadStartUISymbols && rovi.dwBuildNumber >= 18362) { - bDownloaded |= ProcessStartUISymbols(szSettingsPath, symbols_PTRS.startui_PTRS); + BOOL bSuccess = ProcessStartUISymbols(szSettingsPath, symbols_PTRS.startui_PTRS); + bAnySuccess |= bSuccess; + bAllSuccess &= bSuccess; } printf("[Symbols] Finished gathering symbol data.\n"); - if (bDownloaded) + title[0] = 0; body[0] = 0; + BOOL bNotify = TRUE; + if (bAllSuccess) { - if (params->bVerbose) + if (LoadStringW(hEPGui, IDS_SYM_SUCCESS_T, titleFormat, ARRAYSIZE(titleFormat))) { - __x_ABI_CWindows_CData_CXml_CDom_CIXmlDocument* inputXml = NULL; - HRESULT hr = String2IXMLDocument( - InstallOK, - wcslen(InstallOK), - &inputXml, -#ifdef DEBUG - stdout -#else - NULL -#endif - ); - hr = ShowToastMessage( - inputXml, - APPID, - sizeof(APPID) / sizeof(TCHAR) - 1, -#ifdef DEBUG - stdout -#else - NULL -#endif - ); - Sleep(4000); - exit(0); - } - else - { - wsprintf( - buffer, - DownloadOKXML, - szReportedVersion - ); - __x_ABI_CWindows_CData_CXml_CDom_CIXmlDocument* inputXml2 = NULL; - HRESULT hr = String2IXMLDocument( - buffer, - wcslen(buffer), - &inputXml2, -#ifdef DEBUG - stdout -#else - NULL -#endif - ); - hr = ShowToastMessage( - inputXml2, - APPID, - sizeof(APPID) / sizeof(TCHAR) - 1, -#ifdef DEBUG - stdout -#else - NULL -#endif - ); + swprintf_s(title, ARRAYSIZE(title), titleFormat, szReportedVersion); } + LoadStringW(hEPGui, IDS_SYM_SUCCESS_B, body, ARRAYSIZE(body)); + swprintf_s(buffer, ARRAYSIZE(buffer), DownloadNotificationXML, L"https://github.com/valinet/ExplorerPatcher/wiki/Symbols", L"long", title, body); } + else if (bAnySuccess) + { + if (LoadStringW(hEPGui, IDS_SYM_FAILEDSOME_T, titleFormat, ARRAYSIZE(titleFormat))) + { + swprintf_s(title, ARRAYSIZE(title), titleFormat, szReportedVersion); + } + LoadStringW(hEPGui, IDS_SYM_FAILEDSOME_B, body, ARRAYSIZE(body)); + swprintf_s(buffer, ARRAYSIZE(buffer), DownloadNotificationXML, L"https://github.com/valinet/ExplorerPatcher/wiki/Symbols", L"short", title, body); + } + else + { + if (LoadStringW(hEPGui, IDS_SYM_FAILEDALL_T, titleFormat, ARRAYSIZE(titleFormat))) + { + swprintf_s(title, ARRAYSIZE(title), titleFormat, szReportedVersion); + } + LoadStringW(hEPGui, IDS_SYM_FAILEDALL_B, body, ARRAYSIZE(body)); + swprintf_s(buffer, ARRAYSIZE(buffer), DownloadNotificationXML, L"https://github.com/valinet/ExplorerPatcher/wiki/Symbols", L"short", title, body); + bNotify = bNewBuild; + } + + if (bNotify) + { + __x_ABI_CWindows_CData_CXml_CDom_CIXmlDocument* inputXml2 = NULL; + HRESULT hr = String2IXMLDocument( + buffer, + wcslen(buffer), + &inputXml2, +#ifdef DEBUG + stdout +#else + NULL +#endif + ); + hr = ShowToastMessage( + inputXml2, + APPID, + sizeof(APPID) / sizeof(wchar_t) - 1, +#ifdef DEBUG + stdout +#else + NULL +#endif + ); + } + + FreeLibrary(hEPGui); printf("[Symbols] Finished \"Download symbols\" thread.\n"); return 0; @@ -528,7 +550,7 @@ LoadSymbolsResult LoadSymbols(symbols_addr* symbols_PTRS) CHAR szStoredHash[33]; ZeroMemory(szHash, sizeof(szHash)); ZeroMemory(szStoredHash, sizeof(szStoredHash)); - TCHAR wszPath[MAX_PATH]; + wchar_t wszPath[MAX_PATH]; BOOL bOffsetsValid; // Load twinui.pcshell.dll offsets diff --git a/ExplorerPatcher/symbols.h b/ExplorerPatcher/symbols.h index 9f2326f..0742365 100644 --- a/ExplorerPatcher/symbols.h +++ b/ExplorerPatcher/symbols.h @@ -6,6 +6,7 @@ #include #include #include "utility.h" +#include "../ep_gui/resources/EPSharedResources.h" #define EXIT_CODE_EXPLORER 1 diff --git a/ExplorerPatcher/updates.c b/ExplorerPatcher/updates.c index 50574dd..c6c0bdc 100644 --- a/ExplorerPatcher/updates.c +++ b/ExplorerPatcher/updates.c @@ -862,6 +862,8 @@ BOOL ShowUpdateSuccessNotification( __x_ABI_CWindows_CUI_CNotifications_CIToastNotification** toast ) { + HMODULE hEPGui = LoadGuiModule(); + wchar_t buf[TOAST_BUFSIZ]; DWORD dwLeftMost = 0; DWORD dwSecondLeft = 0; @@ -869,20 +871,32 @@ BOOL ShowUpdateSuccessNotification( DWORD dwRightMost = 0; QueryVersionInfo(hModule, VS_VERSION_INFO, &dwLeftMost, &dwSecondLeft, &dwSecondRight, &dwRightMost); - __x_ABI_CWindows_CData_CXml_CDom_CIXmlDocument* inputXml = NULL; const wchar_t text[] = - L"\r\n" + L"\r\n" L" \r\n" L" \r\n" - L" \r\n" - L" \r\n" + L" \r\n" + L" \r\n" L" \r\n" L" \r\n" L" \r\n" L" \r\n"; - swprintf_s(buf, TOAST_BUFSIZ, text, dwLeftMost, dwSecondLeft, dwSecondRight, dwRightMost); + wchar_t title[100]; + wchar_t body[200]; + title[0] = 0; body[0] = 0; + + LoadStringW(hEPGui, IDS_UPDATES_SUCCESS_T, title, ARRAYSIZE(title)); + + wchar_t bodyFormat[200]; + ZeroMemory(bodyFormat, sizeof(bodyFormat)); + if (LoadStringW(hEPGui, IDS_UPDATES_INSTALLEDVER, bodyFormat, ARRAYSIZE(bodyFormat))) + { + swprintf_s(body, ARRAYSIZE(body), bodyFormat, dwLeftMost, dwSecondLeft, dwSecondRight, dwRightMost); + } + + swprintf_s(buf, TOAST_BUFSIZ, text, _T(UPDATES_RELEASE_INFO_URL), L"short", title, body); + __x_ABI_CWindows_CData_CXml_CDom_CIXmlDocument* inputXml = NULL; String2IXMLDocument( buf, wcslen(buf), @@ -910,8 +924,13 @@ BOOL ShowUpdateSuccessNotification( { inputXml->lpVtbl->Release(inputXml); } - + if (hEPGui) + { + FreeLibrary(hEPGui); + } SwitchToThread(); + + return TRUE; } BOOL InstallUpdatesIfAvailable( @@ -924,6 +943,8 @@ BOOL InstallUpdatesIfAvailable( DWORD dwUpdatePolicy ) { + HMODULE hEPGui = LoadGuiModule(); + wchar_t wszInfoURL[MAX_PATH]; ZeroMemory(wszInfoURL, MAX_PATH * sizeof(wchar_t)); wcscat_s(wszInfoURL, MAX_PATH, _T(UPDATES_RELEASE_INFO_URL_STABLE)); @@ -958,52 +979,47 @@ BOOL InstallUpdatesIfAvailable( } } - __x_ABI_CWindows_CData_CXml_CDom_CIXmlDocument* inputXml = NULL; + const wchar_t text[] = + L"\r\n" + L" \r\n" + L" \r\n" + L" \r\n" + L" \r\n" + L" \r\n" + L" \r\n" + L" \r\n" + L" \r\n"; + wchar_t title[100]; + wchar_t body[200]; + title[0] = 0; body[0] = 0; + if (dwOperation == UPDATES_OP_INSTALL) { - const wchar_t text[] = - L"\r\n" - L" \r\n" - L" \r\n" - L" \r\n" - L" \r\n" - L" \r\n" - L" \r\n" - L" \r\n" - L" \r\n"; - swprintf_s(buf, TOAST_BUFSIZ, text, dwLeftMost, dwSecondLeft, dwSecondRight, dwRightMost); - String2IXMLDocument( - buf, - wcslen(buf), - &inputXml, - NULL - ); + LoadStringW(hEPGui, IDS_UPDATES_DOWNLOADING_T, title, ARRAYSIZE(title)); } else if (dwOperation == UPDATES_OP_CHECK) { - const wchar_t text[] = - L"\r\n" - L" \r\n" - L" \r\n" - L" \r\n" - L" \r\n" - L" \r\n" - L" \r\n" - L" \r\n" - L" \r\n"; - swprintf_s(buf, TOAST_BUFSIZ, text, dwLeftMost, dwSecondLeft, dwSecondRight, dwRightMost); - String2IXMLDocument( - buf, - wcslen(buf), - &inputXml, - NULL - ); + LoadStringW(hEPGui, IDS_UPDATES_CHECKING_T, title, ARRAYSIZE(title)); } + wchar_t bodyFormat[200]; + ZeroMemory(bodyFormat, sizeof(bodyFormat)); + if (LoadStringW(hEPGui, IDS_UPDATES_INSTALLEDVER, bodyFormat, ARRAYSIZE(bodyFormat))) + { + swprintf_s(body, ARRAYSIZE(body), bodyFormat, dwLeftMost, dwSecondLeft, dwSecondRight, dwRightMost); + } + + swprintf_s(buf, TOAST_BUFSIZ, text, _T(UPDATES_RELEASE_INFO_URL), L"long", title, body); + + __x_ABI_CWindows_CData_CXml_CDom_CIXmlDocument* inputXml = NULL; + String2IXMLDocument( + buf, + wcslen(buf), + &inputXml, + NULL + ); + if (dwOperation == UPDATES_OP_CHECK || dwOperation == UPDATES_OP_INSTALL) { if (*toast) @@ -1037,7 +1053,7 @@ BOOL InstallUpdatesIfAvailable( ZeroMemory(hash, 100 * sizeof(CHAR)); ComputeFileHash2(hModule, dllName, hash, 100); - BOOL bFail = FALSE; + BOOL bFail = FALSE, bReturnValue = FALSE; dwLeftMost = 0; dwSecondLeft = 0; dwSecondRight = 0; dwRightMost = 0; if (IsUpdateAvailable(_T(REGPATH), hash, &bFail, wszInfoURL, MAX_PATH, hModule, &dwLeftMost, &dwSecondLeft, &dwSecondRight, &dwRightMost)) { @@ -1050,18 +1066,12 @@ BOOL InstallUpdatesIfAvailable( { if (dwOperation == UPDATES_OP_INSTALL) { - const wchar_t text[] = - L"\r\n" - L" \r\n" - L" \r\n" - L" \r\n" - L" \r\n" - L" \r\n" - L" \r\n" - L" \r\n" - L" \r\n"; + title[0] = 0; body[0] = 0; + LoadStringW(hEPGui, IDS_UPDATES_DLFAILED_T, title, ARRAYSIZE(title)); + LoadStringW(hEPGui, IDS_UPDATES_DLFAILED_B, body, ARRAYSIZE(body)); + + swprintf_s(buf, TOAST_BUFSIZ, text, _T(UPDATES_RELEASE_INFO_URL), L"short", title, body); + String2IXMLDocument( text, wcslen(text), @@ -1097,28 +1107,25 @@ BOOL InstallUpdatesIfAvailable( } else if ((dwOperation == UPDATES_OP_DEFAULT && dwUpdatePolicy == UPDATE_POLICY_NOTIFY) || (dwOperation == UPDATES_OP_CHECK)) { - const wchar_t text[] = - L"\r\n" - L" \r\n" - L" \r\n" - L" \r\n" - L" \r\n" - L" \r\n" - L" \r\n" - L" \r\n" - L" \r\n"; + title[0] = 0; body[0] = 0; + if (!dwLeftMost) { - swprintf_s(buf, TOAST_BUFSIZ, text, wszInfoURL, L"New version"); + LoadStringW(hEPGui, IDS_UPDATES_AVAILABLE_T_U, title, ARRAYSIZE(title)); } else { - WCHAR wszVersionInfo[100]; - swprintf_s(wszVersionInfo, 100, L"Version %d.%d.%d.%d is", dwLeftMost, dwSecondLeft, dwSecondRight, dwRightMost); - swprintf_s(buf, TOAST_BUFSIZ, text, wszInfoURL, wszVersionInfo); + WCHAR titleFormat[100]; + if (LoadStringW(hEPGui, IDS_UPDATES_AVAILABLE_T, titleFormat, ARRAYSIZE(titleFormat))) + { + swprintf_s(title, ARRAYSIZE(title), titleFormat, dwLeftMost, dwSecondLeft, dwSecondRight, dwRightMost); + } } + + LoadStringW(hEPGui, IDS_UPDATES_AVAILABLE_B, body, ARRAYSIZE(body)); + + swprintf_s(buf, TOAST_BUFSIZ, text, wszInfoURL, L"long", title, body); + __x_ABI_CWindows_CData_CXml_CDom_CIXmlDocument* inputXml = NULL; String2IXMLDocument( buf, @@ -1148,8 +1155,7 @@ BOOL InstallUpdatesIfAvailable( inputXml->lpVtbl->Release(inputXml); } } - - return TRUE; + bReturnValue = TRUE; } else { @@ -1163,34 +1169,24 @@ BOOL InstallUpdatesIfAvailable( } if (dwOperation == UPDATES_OP_CHECK || dwOperation == UPDATES_OP_INSTALL) { - const wchar_t text[] = - L"\r\n" - L" \r\n" - L" \r\n" - L" \r\n" - L" \r\n" - L" \r\n" - L" \r\n" - L" \r\n" - L" \r\n"; - const wchar_t text2[] = - L"\r\n" - L" \r\n" - L" \r\n" - L" \r\n" - L" \r\n" - L" \r\n" - L" \r\n" - L" \r\n" - L" \r\n"; + title[0] = 0; body[0] = 0; + if (bFail) + { + LoadStringW(hEPGui, IDS_UPDATES_CHECKFAILED_T, title, ARRAYSIZE(title)); + LoadStringW(hEPGui, IDS_UPDATES_CHECKFAILED_B, body, ARRAYSIZE(body)); + } + else + { + LoadStringW(hEPGui, IDS_UPDATES_ISLATEST_T, title, ARRAYSIZE(title)); + LoadStringW(hEPGui, IDS_UPDATES_ISLATEST_B, body, ARRAYSIZE(body)); + } + + swprintf_s(buf, TOAST_BUFSIZ, text, _T(UPDATES_RELEASE_INFO_URL), L"short", title, body); + __x_ABI_CWindows_CData_CXml_CDom_CIXmlDocument* inputXml = NULL; String2IXMLDocument( - bFail ? text2 : text, - wcslen(bFail ? text2 : text), + buf, + wcslen(buf), &inputXml, NULL ); @@ -1216,6 +1212,13 @@ BOOL InstallUpdatesIfAvailable( inputXml->lpVtbl->Release(inputXml); } } - return FALSE; + bReturnValue = FALSE; } + + if (hEPGui) + { + FreeLibrary(hEPGui); + } + + return bReturnValue; } \ No newline at end of file diff --git a/ExplorerPatcher/updates.h b/ExplorerPatcher/updates.h index a226079..40509f9 100644 --- a/ExplorerPatcher/updates.h +++ b/ExplorerPatcher/updates.h @@ -6,6 +6,7 @@ #pragma comment(lib, "Wininet.lib") #include #include "utility.h" +#include "../ep_gui/resources/EPSharedResources.h" extern HMODULE hModule; diff --git a/ExplorerPatcher/utility.c b/ExplorerPatcher/utility.c index 10c14eb..1f68560 100644 --- a/ExplorerPatcher/utility.c +++ b/ExplorerPatcher/utility.c @@ -203,6 +203,7 @@ __declspec(dllexport) int CALLBACK ZZTestBalloon(HWND hWnd, HINSTANCE hInstance, return 0; } +#ifdef _DEBUG const wchar_t TestToastXML[] = L"\r\n" @@ -256,6 +257,7 @@ __declspec(dllexport) int CALLBACK ZZTestToast(HWND hWnd, HINSTANCE hInstance, L free(lpwszCmdLine); return 0; } +#endif __declspec(dllexport) int CALLBACK ZZLaunchExplorer(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow) { diff --git a/ExplorerPatcher/utility.h b/ExplorerPatcher/utility.h index 3cf5663..9bb8153 100644 --- a/ExplorerPatcher/utility.h +++ b/ExplorerPatcher/utility.h @@ -254,7 +254,9 @@ LRESULT CALLBACK BalloonWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara __declspec(dllexport) int CALLBACK ZZTestBalloon(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow); +#ifdef _DEBUG __declspec(dllexport) int CALLBACK ZZTestToast(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow); +#endif __declspec(dllexport) int CALLBACK ZZLaunchExplorer(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow); @@ -818,6 +820,15 @@ inline PVOID FindPattern(PVOID pBase, SIZE_T dwSize, LPCSTR lpPattern, LPCSTR lp return NULL; } + +inline HMODULE LoadGuiModule() +{ + wchar_t epGuiPath[MAX_PATH]; + ZeroMemory(epGuiPath, sizeof(epGuiPath)); + SHGetFolderPathW(NULL, SPECIAL_FOLDER, NULL, SHGFP_TYPE_CURRENT, epGuiPath); + wcscat_s(epGuiPath, MAX_PATH, _T(APP_RELATIVE_PATH) L"\\ep_gui.dll"); + return LoadLibraryExW(epGuiPath, NULL, LOAD_LIBRARY_AS_DATAFILE); +} #endif #ifdef __cplusplus diff --git a/ep_gui/ep_gui.vcxproj b/ep_gui/ep_gui.vcxproj index 67482d0..04af69d 100644 --- a/ep_gui/ep_gui.vcxproj +++ b/ep_gui/ep_gui.vcxproj @@ -95,13 +95,13 @@ - + - + diff --git a/ep_gui/resources/EPCrashMessageResources.h b/ep_gui/resources/EPCrashMessageResources.h deleted file mode 100644 index 49dc246..0000000 --- a/ep_gui/resources/EPCrashMessageResources.h +++ /dev/null @@ -1,9 +0,0 @@ -#pragma once - -// 401-500 - -#define IDS_CRASH_TITLE 401 -#define IDS_CRASH_BODY 402 -#define IDS_CRASH_ONCE 403 -#define IDS_CRASH_MULTIPLE 404 -#define IDS_CRASH_DISMISS 405 diff --git a/ep_gui/resources/EPSharedResources.h b/ep_gui/resources/EPSharedResources.h new file mode 100644 index 0000000..7c229a3 --- /dev/null +++ b/ep_gui/resources/EPSharedResources.h @@ -0,0 +1,36 @@ +#pragma once + +// 301-350 + +#define IDS_UPDATES_CHECKING_T 301 +#define IDS_UPDATES_AVAILABLE_T 302 +#define IDS_UPDATES_AVAILABLE_T_U 303 +#define IDS_UPDATES_AVAILABLE_B 304 +#define IDS_UPDATES_ISLATEST_T 305 +#define IDS_UPDATES_ISLATEST_B 306 +#define IDS_UPDATES_CHECKFAILED_T 307 +#define IDS_UPDATES_CHECKFAILED_B 308 +#define IDS_UPDATES_DOWNLOADING_T 309 +#define IDS_UPDATES_SUCCESS_T 310 +#define IDS_UPDATES_DLFAILED_T 311 +#define IDS_UPDATES_DLFAILED_B 312 +#define IDS_UPDATES_INSTALLEDVER 313 + +// 351-400 + +#define IDS_SYM_DL_T 351 +#define IDS_SYM_DL_B 352 +#define IDS_SYM_SUCCESS_T 353 +#define IDS_SYM_SUCCESS_B 354 +#define IDS_SYM_FAILEDSOME_T 355 +#define IDS_SYM_FAILEDSOME_B 356 +#define IDS_SYM_FAILEDALL_T 357 +#define IDS_SYM_FAILEDALL_B 358 + +// 401-500 + +#define IDS_CRASH_TITLE 401 +#define IDS_CRASH_BODY 402 +#define IDS_CRASH_ONCE 403 +#define IDS_CRASH_MULTIPLE 404 +#define IDS_CRASH_DISMISS 405 diff --git a/ep_gui/resources/ep_gui.rc b/ep_gui/resources/ep_gui.rc index 9ea1170..2449930 100644 --- a/ep_gui/resources/ep_gui.rc +++ b/ep_gui/resources/ep_gui.rc @@ -71,9 +71,9 @@ BEGIN VALUE "CompanyName", "VALINET Solutions SRL" VALUE "FileDescription", "ExplorerPatcher Settings" VER_FILE_STRING - VALUE "InternalName", "ep_gui.exe" + VALUE "InternalName", "ep_gui.dll" VALUE "LegalCopyright", "Copyright (C) 2006-2023 VALINET Solutions SRL. All rights reserved." - VALUE "OriginalFilename", "ep_gui.exe" + VALUE "OriginalFilename", "ep_gui.dll" VALUE "ProductName", "ExplorerPatcher" VER_PRODUCT_STRING END diff --git a/ep_gui/resources/lang/ep_gui.en-US.rc b/ep_gui/resources/lang/ep_gui.en-US.rc index 7bd0468..d03293f 100644 --- a/ep_gui/resources/lang/ep_gui.en-US.rc +++ b/ep_gui/resources/lang/ep_gui.en-US.rc @@ -5,6 +5,29 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US STRINGTABLE BEGIN + IDS_UPDATES_CHECKING_T "Checking for updates…" + IDS_UPDATES_AVAILABLE_T "Version %d.%d.%d.%d is available" + IDS_UPDATES_AVAILABLE_T_U "New version available" + IDS_UPDATES_AVAILABLE_B "You can update by right clicking the taskbar, choosing ""Properties"", then ""Updates"". Click here to learn more about this update." + IDS_UPDATES_ISLATEST_T "No updates are available" + IDS_UPDATES_ISLATEST_B "Please check back later." + IDS_UPDATES_CHECKFAILED_T "Unable to check for updates" + IDS_UPDATES_CHECKFAILED_B "Make sure that you are connected to the Internet and that the remote server is online." + IDS_UPDATES_DOWNLOADING_T "Downloading and installing updates…" + IDS_UPDATES_SUCCESS_T "Update successful" + IDS_UPDATES_DLFAILED_T "Update failed" + IDS_UPDATES_DLFAILED_B "The request was declined or an error has occured when attempting to install this update." + IDS_UPDATES_INSTALLEDVER "Installed version: %d.%d.%d.%d" + + IDS_SYM_DL_T "Downloading symbols for OS build %s, please wait…" + IDS_SYM_DL_B "This may take several minutes. For now, ExplorerPatcher may have limited and/or broken functionality. Click here to learn more about symbols." + IDS_SYM_SUCCESS_T "Successfully downloaded symbols for OS build %s" + IDS_SYM_SUCCESS_B "Please restart File Explorer to restore proper functionality." + IDS_SYM_FAILEDSOME_T "Downloaded some symbols for OS build %s" + IDS_SYM_FAILEDSOME_B "Some other symbols could not be downloaded. This may be due to the current OS build being too recent or the Internet connection being unstable." + IDS_SYM_FAILEDALL_T "Failed to download symbols for OS build %s" + IDS_SYM_FAILEDALL_B "No symbols could be downloaded for this build. This may be due to the current OS build being too recent or the Internet connection being unavailable or unstable." + IDS_CRASH_TITLE "Unfortunately, File Explorer is crashing :(" IDS_CRASH_BODY "It seems that File Explorer closed unexpectedly %1$s in less than %2$d seconds each time when starting up. This might indicate a problem caused by ExplorerPatcher, which might be unaware of recent changes in Windows, for example when running on a new OS build.\nHere are a few recommendations:\n• If an updated version is available, you can update ExplorerPatcher and restart File Explorer.\n• On GitHub, you can view releases, check the current status, discuss or review the latest issues.\n• If you suspect this is not caused by ExplorerPatcher, please uninstall any recently installed shell extensions or similar utilities.\n• If no fix is available for the time being, you can uninstall ExplorerPatcher, and then later reinstall it when a fix is published on GitHub. Rest assured, even if you uninstall, your program configuration will be preserved.\n\nI am sorry for the inconvenience this might cause; I am doing my best to try to keep this program updated and working.\n\nExplorerPatcher is disabled until the next File Explorer restart, in order to allow you to perform maintenance tasks and take the necessary actions." IDS_CRASH_ONCE "once" diff --git a/ep_gui/resources/resource.h b/ep_gui/resources/resource.h index e1b818e..7a40ccb 100644 --- a/ep_gui/resources/resource.h +++ b/ep_gui/resources/resource.h @@ -6,8 +6,8 @@ #define IDR_REGISTRY2 102 #define IDS_PRODUCTNAME 201 -// 401-500 -#include "EPCrashMessageResources.h" +// 301-500 +#include "EPSharedResources.h" // 1001-2200 #include "EPSettingsResources.h"