1
0
mirror of https://github.com/valinet/ExplorerPatcher.git synced 2024-11-23 23:21:08 +01:00

L10N: Localized Updates and Symbols notifications

This commit is contained in:
Amrsatrio 2023-11-12 04:11:41 +07:00
parent a74f27b42d
commit b5b0b21443
13 changed files with 324 additions and 238 deletions

View File

@ -51,7 +51,6 @@ RTL_OSVERSIONINFOW global_rovi;
DWORD32 global_ubr;
#endif
#include <featurestagingapi.h>
#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

View File

@ -22,44 +22,18 @@ const char* startui_SN[STARTUI_SB_CNT] = {
STARTUI_SB_0
};
const wchar_t DownloadSymbolsXML[] =
L"<toast scenario=\"reminder\" "
L"activationType=\"protocol\" launch=\"https://github.com/valinet/ExplorerPatcher\" duration=\"short\">\r\n"
L" <visual>\r\n"
L" <binding template=\"ToastGeneric\">\r\n"
L" <text><![CDATA[Unable to find symbols for OS build %s]]></text>\r\n"
L" <text><![CDATA[Downloading and applying symbol information, please wait...]]></text>\r\n"
L" <text placement=\"attribution\"><![CDATA[ExplorerPatcher]]></text>\r\n"
L" </binding>\r\n"
L" </visual>\r\n"
L" <audio src=\"ms-winsoundevent:Notification.Default\" loop=\"false\" silent=\"false\"/>\r\n"
L"</toast>\r\n";
const wchar_t DownloadOKXML[] =
L"<toast scenario=\"reminder\" "
L"activationType=\"protocol\" launch=\"https://github.com/valinet/ExplorerPatcher\" duration=\"long\">\r\n"
L" <visual>\r\n"
L" <binding template=\"ToastGeneric\">\r\n"
L" <text><![CDATA[Successfully downloaded symbols for OS build %s]]></text>\r\n"
L" <text><![CDATA[Please restart File Explorer to apply the changes and enable additional functionality.]]></text>\r\n"
L" <text placement=\"attribution\"><![CDATA[ExplorerPatcher]]></text>\r\n"
L" </binding>\r\n"
L" </visual>\r\n"
L" <audio src=\"ms-winsoundevent:Notification.Default\" loop=\"false\" silent=\"false\"/>\r\n"
L"</toast>\r\n";
const wchar_t InstallOK[] =
L"<toast scenario=\"reminder\" "
L"activationType=\"protocol\" launch=\"https://github.com/valinet/ExplorerPatcher\" duration=\"long\">\r\n"
L" <visual>\r\n"
L" <binding template=\"ToastGeneric\">\r\n"
L" <text><![CDATA[Installation succeeded!]]></text>\r\n"
L" <text><![CDATA[This notification will not show again until the next OS build update.]]></text>\r\n"
L" <text placement=\"attribution\"><![CDATA[ExplorerPatcher]]></text>\r\n"
L" </binding>\r\n"
L" </visual>\r\n"
L" <audio src=\"ms-winsoundevent:Notification.Default\" loop=\"false\" silent=\"false\"/>\r\n"
L"</toast>\r\n";
const wchar_t DownloadNotificationXML[] =
L"<toast scenario=\"reminder\" "
L"activationType=\"protocol\" launch=\"%s\" duration=\"%s\">\r\n"
L" <visual>\r\n"
L" <binding template=\"ToastGeneric\">\r\n"
L" <text><![CDATA[%s]]></text>\r\n"
L" <text><![CDATA[%s]]></text>\r\n"
L" <text placement=\"attribution\"><![CDATA[ExplorerPatcher]]></text>\r\n"
L" </binding>\r\n"
L" </visual>\r\n"
L" <audio src=\"ms-winsoundevent:Notification.Default\" loop=\"false\" silent=\"false\"/>\r\n"
L"</toast>\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

View File

@ -6,6 +6,7 @@
#include <valinet/utility/osversion.h>
#include <roapi.h>
#include "utility.h"
#include "../ep_gui/resources/EPSharedResources.h"
#define EXIT_CODE_EXPLORER 1

View File

@ -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"<toast scenario=\"reminder\" "
L"activationType=\"protocol\" launch=\"" _T(UPDATES_RELEASE_INFO_URL) L"\" duration=\"short\">\r\n"
L"<toast scenario=\"reminder\" activationType=\"protocol\" launch=\"%s\" duration=\"%s\">\r\n"
L" <visual>\r\n"
L" <binding template=\"ToastGeneric\">\r\n"
L" <text><![CDATA[Update successful]]></text>\r\n"
L" <text><![CDATA[Installed version: %d.%d.%d.%d]]></text>\r\n"
L" <text><![CDATA[%s]]></text>\r\n"
L" <text><![CDATA[%s]]></text>\r\n"
L" <text placement=\"attribution\"><![CDATA[ExplorerPatcher]]></text>\r\n"
L" </binding>\r\n"
L" </visual>\r\n"
L" <audio src=\"ms-winsoundevent:Notification.Default\" loop=\"false\" silent=\"false\"/>\r\n"
L"</toast>\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"<toast scenario=\"reminder\" activationType=\"protocol\" launch=\"%s\" duration=\"%s\">\r\n"
L" <visual>\r\n"
L" <binding template=\"ToastGeneric\">\r\n"
L" <text><![CDATA[%s]]></text>\r\n"
L" <text><![CDATA[%s]]></text>\r\n"
L" <text placement=\"attribution\"><![CDATA[ExplorerPatcher]]></text>\r\n"
L" </binding>\r\n"
L" </visual>\r\n"
L" <audio src=\"ms-winsoundevent:Notification.Default\" loop=\"false\" silent=\"false\"/>\r\n"
L"</toast>\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"<toast scenario=\"reminder\" "
L"activationType=\"protocol\" launch=\"" _T(UPDATES_RELEASE_INFO_URL) L"\" duration=\"long\">\r\n"
L" <visual>\r\n"
L" <binding template=\"ToastGeneric\">\r\n"
L" <text><![CDATA[Downloading and installing updates]]></text>\r\n"
L" <text><![CDATA[Installed version: %d.%d.%d.%d]]></text>\r\n"
L" <text placement=\"attribution\"><![CDATA[ExplorerPatcher]]></text>\r\n"
L" </binding>\r\n"
L" </visual>\r\n"
L" <audio src=\"ms-winsoundevent:Notification.Default\" loop=\"false\" silent=\"false\"/>\r\n"
L"</toast>\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"<toast scenario=\"reminder\" "
L"activationType=\"protocol\" launch=\"" _T(UPDATES_RELEASE_INFO_URL) L"\" duration=\"long\">\r\n"
L" <visual>\r\n"
L" <binding template=\"ToastGeneric\">\r\n"
L" <text><![CDATA[Checking for updates]]></text>\r\n"
L" <text><![CDATA[Installed version: %d.%d.%d.%d]]></text>\r\n"
L" <text placement=\"attribution\"><![CDATA[ExplorerPatcher]]></text>\r\n"
L" </binding>\r\n"
L" </visual>\r\n"
L" <audio src=\"ms-winsoundevent:Notification.Default\" loop=\"false\" silent=\"false\"/>\r\n"
L"</toast>\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"<toast scenario=\"reminder\" "
L"activationType=\"protocol\" launch=\"" _T(UPDATES_RELEASE_INFO_URL) L"\" duration=\"short\">\r\n"
L" <visual>\r\n"
L" <binding template=\"ToastGeneric\">\r\n"
L" <text><![CDATA[Update failed]]></text>\r\n"
L" <text><![CDATA[The request was declined or an error has occured when attempting to install this update.]]></text>\r\n"
L" <text placement=\"attribution\"><![CDATA[ExplorerPatcher]]></text>\r\n"
L" </binding>\r\n"
L" </visual>\r\n"
L" <audio src=\"ms-winsoundevent:Notification.Default\" loop=\"false\" silent=\"false\"/>\r\n"
L"</toast>\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"<toast scenario=\"reminder\" "
L"activationType=\"protocol\" launch=\"%s\" duration=\"long\">\r\n"
L" <visual>\r\n"
L" <binding template=\"ToastGeneric\">\r\n"
L" <text><![CDATA[%s available]]></text>\r\n"
L" <text><![CDATA[You can update by right clicking the taskbar, choosing \"Properties\", then \"Updates\". Click here to learn more about this update.]]></text>\r\n"
L" <text placement=\"attribution\"><![CDATA[ExplorerPatcher]]></text>\r\n"
L" </binding>\r\n"
L" </visual>\r\n"
L" <audio src=\"ms-winsoundevent:Notification.Default\" loop=\"false\" silent=\"false\"/>\r\n"
L"</toast>\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"<toast scenario=\"reminder\" "
L"activationType=\"protocol\" launch=\"" _T(UPDATES_RELEASE_INFO_URL) L"\" duration=\"short\">\r\n"
L" <visual>\r\n"
L" <binding template=\"ToastGeneric\">\r\n"
L" <text><![CDATA[No updates are available]]></text>\r\n"
L" <text><![CDATA[Please check back later.]]></text>\r\n"
L" <text placement=\"attribution\"><![CDATA[ExplorerPatcher]]></text>\r\n"
L" </binding>\r\n"
L" </visual>\r\n"
L" <audio src=\"ms-winsoundevent:Notification.Default\" loop=\"false\" silent=\"false\"/>\r\n"
L"</toast>\r\n";
const wchar_t text2[] =
L"<toast scenario=\"reminder\" "
L"activationType=\"protocol\" launch=\"" _T(UPDATES_RELEASE_INFO_URL) L"\" duration=\"short\">\r\n"
L" <visual>\r\n"
L" <binding template=\"ToastGeneric\">\r\n"
L" <text><![CDATA[Unable to check for updates]]></text>\r\n"
L" <text><![CDATA[Make sure that you are connected to the Internet and that the remote server is online.]]></text>\r\n"
L" <text placement=\"attribution\"><![CDATA[ExplorerPatcher]]></text>\r\n"
L" </binding>\r\n"
L" </visual>\r\n"
L" <audio src=\"ms-winsoundevent:Notification.Default\" loop=\"false\" silent=\"false\"/>\r\n"
L"</toast>\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;
}

View File

@ -6,6 +6,7 @@
#pragma comment(lib, "Wininet.lib")
#include <shlobj_core.h>
#include "utility.h"
#include "../ep_gui/resources/EPSharedResources.h"
extern HMODULE hModule;

View File

@ -203,6 +203,7 @@ __declspec(dllexport) int CALLBACK ZZTestBalloon(HWND hWnd, HINSTANCE hInstance,
return 0;
}
#ifdef _DEBUG
const wchar_t TestToastXML[] =
L"<toast scenario=\"reminder\" "
L"activationType=\"protocol\" launch=\"https://github.com/valinet/ExplorerPatcher\" duration=\"%s\">\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)
{

View File

@ -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

View File

@ -95,13 +95,13 @@
<ClInclude Include="GUI.h" />
<!--<ClInclude Include="GUI2.h" />-->
<ClInclude Include="pch.h" />
<ClInclude Include="resources\EPCrashMessageResources.h" />
<ClInclude Include="resources\EPSettingsResources.h" />
<ClInclude Include="resources\EPSharedResources.h" />
<ClInclude Include="resources\resource.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="resources\ep_gui.rc" />
<ResourceCompile Include="resources\lang\ep_gui.en-US.rc" />
<ResourceCompile Include="resources\lang\ep_gui.*.rc" />
<ResourceCompile Include="..\ExplorerPatcher-L10N\resources\lang\ep_gui.*.rc" Condition="Exists('..\ExplorerPatcher-L10N\resources\lang')" />
</ItemGroup>
<ItemGroup>

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 <A HREF=""%3$s"">update ExplorerPatcher and restart File Explorer</A>.\n• On GitHub, you can <A HREF=""%4$s"">view releases</A>, <A HREF=""%5$s"">check the current status</A>, <A HREF=""%6$s"">discuss</A> or <A HREF=""%7$s"">review the latest issues</A>.\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 <A HREF=""%8$s"">uninstall ExplorerPatcher</A>, 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"

View File

@ -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"