Browse Source

L10N: Localized Updates and Symbols notifications

pull/2488/head
Amrsatrio 2 years ago
parent
commit
b5b0b21443
  1. 8
      ExplorerPatcher/dllmain.c
  2. 188
      ExplorerPatcher/symbols.c
  3. 1
      ExplorerPatcher/symbols.h
  4. 189
      ExplorerPatcher/updates.c
  5. 1
      ExplorerPatcher/updates.h
  6. 2
      ExplorerPatcher/utility.c
  7. 11
      ExplorerPatcher/utility.h
  8. 4
      ep_gui/ep_gui.vcxproj
  9. 9
      ep_gui/resources/EPCrashMessageResources.h
  10. 36
      ep_gui/resources/EPSharedResources.h
  11. 4
      ep_gui/resources/ep_gui.rc
  12. 23
      ep_gui/resources/lang/ep_gui.en-US.rc
  13. 4
      ep_gui/resources/resource.h

8
ExplorerPatcher/dllmain.c

@ -51,7 +51,6 @@ RTL_OSVERSIONINFOW global_rovi;
DWORD32 global_ubr; DWORD32 global_ubr;
#endif #endif
#include <featurestagingapi.h> #include <featurestagingapi.h>
#include "../ep_gui/resources/EPCrashMessageResources.h"
#define WINX_ADJUST_X 5 #define WINX_ADJUST_X 5
#define WINX_ADJUST_Y 5 #define WINX_ADJUST_Y 5
@ -200,6 +199,7 @@ BOOL g_bIsDesktopRaised = FALSE;
#include "utility.h" #include "utility.h"
#include "resource.h" #include "resource.h"
#include "../ep_gui/resources/EPSharedResources.h"
#ifdef USE_PRIVATE_INTERFACES #ifdef USE_PRIVATE_INTERFACES
#include "ep_private.h" #include "ep_private.h"
#endif #endif
@ -11183,11 +11183,7 @@ DWORD InformUserAboutCrash(LPVOID unused)
CrashCounterSettings cfg; CrashCounterSettings cfg;
GetCrashCounterSettings(&cfg); GetCrashCounterSettings(&cfg);
wchar_t epGuiPath[MAX_PATH]; HMODULE hEPGui = LoadGuiModule();
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);
if (!hEPGui) if (!hEPGui)
{ {
return 0; // Can't load the strings, nothing to display return 0; // Can't load the strings, nothing to display

188
ExplorerPatcher/symbols.c

@ -22,39 +22,13 @@ const char* startui_SN[STARTUI_SB_CNT] = {
STARTUI_SB_0 STARTUI_SB_0
}; };
const wchar_t DownloadSymbolsXML[] = const wchar_t DownloadNotificationXML[] =
L"<toast scenario=\"reminder\" " L"<toast scenario=\"reminder\" "
L"activationType=\"protocol\" launch=\"https://github.com/valinet/ExplorerPatcher\" duration=\"short\">\r\n" L"activationType=\"protocol\" launch=\"%s\" duration=\"%s\">\r\n"
L" <visual>\r\n" L" <visual>\r\n"
L" <binding template=\"ToastGeneric\">\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[%s]]></text>\r\n"
L" <text><![CDATA[Downloading and applying symbol information, please wait...]]></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";
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" <text placement=\"attribution\"><![CDATA[ExplorerPatcher]]></text>\r\n"
L" </binding>\r\n" L" </binding>\r\n"
L" </visual>\r\n" L" </visual>\r\n"
@ -349,15 +323,14 @@ DWORD DownloadSymbols(DownloadSymbolsParams* params)
printf("[Symbols] Started \"Download symbols\" thread.\n"); printf("[Symbols] Started \"Download symbols\" thread.\n");
HMODULE hEPGui = LoadGuiModule();
RTL_OSVERSIONINFOW rovi; RTL_OSVERSIONINFOW rovi;
DWORD32 ubr = VnGetOSVersionAndUBR(&rovi); DWORD32 ubr = VnGetOSVersionAndUBR(&rovi);
TCHAR szReportedVersion[MAX_PATH + 1]; wchar_t szReportedVersion[32];
ZeroMemory( swprintf_s(
szReportedVersion,
sizeof(szReportedVersion)
);
wsprintf(
szReportedVersion, szReportedVersion,
ARRAYSIZE(szReportedVersion),
L"%d.%d.%d.%d", L"%d.%d.%d.%d",
rovi.dwMajorVersion, rovi.dwMajorVersion,
rovi.dwMinorVersion, rovi.dwMinorVersion,
@ -365,18 +338,50 @@ DWORD DownloadSymbols(DownloadSymbolsParams* params)
ubr ubr
); );
TCHAR buffer[1000]; wchar_t title[100];
ZeroMemory( wchar_t body[200];
buffer, wchar_t titleFormat[100];
1000 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( wchar_t szLastNotifiedBuild[32];
buffer, szLastNotifiedBuild[0] = 0;
DownloadSymbolsXML, DWORD dwSize = sizeof(szLastNotifiedBuild);
szReportedVersion 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; HRESULT hr = S_OK;
__x_ABI_CWindows_CData_CXml_CDom_CIXmlDocument* inputXml = NULL; __x_ABI_CWindows_CData_CXml_CDom_CIXmlDocument* inputXml = NULL;
hr = String2IXMLDocument( hr = String2IXMLDocument(
@ -392,14 +397,26 @@ DWORD DownloadSymbols(DownloadSymbolsParams* params)
hr = ShowToastMessage( hr = ShowToastMessage(
inputXml, inputXml,
APPID, APPID,
sizeof(APPID) / sizeof(TCHAR) - 1, sizeof(APPID) / sizeof(wchar_t) - 1,
#ifdef DEBUG #ifdef DEBUG
stdout stdout
#else #else
NULL NULL
#endif #endif
); );
RegSetValueExW(
hKey,
TEXT("SymbolsLastNotifiedOSBuild"),
0,
REG_SZ,
szReportedVersion,
wcslen(szReportedVersion) * sizeof(wchar_t)
);
} }
RegCloseKey(hKey);
wprintf( wprintf(
L"[Symbols] " L"[Symbols] "
L"Attempting to download symbols for OS version %s.\n", L"Attempting to download symbols for OS version %s.\n",
@ -433,57 +450,61 @@ DWORD DownloadSymbols(DownloadSymbolsParams* params)
symbols_addr symbols_PTRS; symbols_addr symbols_PTRS;
ZeroMemory(&symbols_PTRS, sizeof(symbols_addr)); ZeroMemory(&symbols_PTRS, sizeof(symbols_addr));
BOOL bDownloaded = FALSE; BOOL bAnySuccess = FALSE, bAllSuccess = TRUE;
if (params->loadResult.bNeedToDownloadTwinuiPcshellSymbols) 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()) 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) 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"); 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; swprintf_s(title, ARRAYSIZE(title), titleFormat, szReportedVersion);
HRESULT hr = String2IXMLDocument( }
InstallOK, LoadStringW(hEPGui, IDS_SYM_SUCCESS_B, body, ARRAYSIZE(body));
wcslen(InstallOK), swprintf_s(buffer, ARRAYSIZE(buffer), DownloadNotificationXML, L"https://github.com/valinet/ExplorerPatcher/wiki/Symbols", L"long", title, body);
&inputXml, }
#ifdef DEBUG else if (bAnySuccess)
stdout {
#else if (LoadStringW(hEPGui, IDS_SYM_FAILEDSOME_T, titleFormat, ARRAYSIZE(titleFormat)))
NULL {
#endif swprintf_s(title, ARRAYSIZE(title), titleFormat, szReportedVersion);
); }
hr = ShowToastMessage( LoadStringW(hEPGui, IDS_SYM_FAILEDSOME_B, body, ARRAYSIZE(body));
inputXml, swprintf_s(buffer, ARRAYSIZE(buffer), DownloadNotificationXML, L"https://github.com/valinet/ExplorerPatcher/wiki/Symbols", L"short", title, body);
APPID,
sizeof(APPID) / sizeof(TCHAR) - 1,
#ifdef DEBUG
stdout
#else
NULL
#endif
);
Sleep(4000);
exit(0);
} }
else else
{ {
wsprintf( if (LoadStringW(hEPGui, IDS_SYM_FAILEDALL_T, titleFormat, ARRAYSIZE(titleFormat)))
buffer, {
DownloadOKXML, swprintf_s(title, ARRAYSIZE(title), titleFormat, szReportedVersion);
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; __x_ABI_CWindows_CData_CXml_CDom_CIXmlDocument* inputXml2 = NULL;
HRESULT hr = String2IXMLDocument( HRESULT hr = String2IXMLDocument(
buffer, buffer,
@ -498,7 +519,7 @@ DWORD DownloadSymbols(DownloadSymbolsParams* params)
hr = ShowToastMessage( hr = ShowToastMessage(
inputXml2, inputXml2,
APPID, APPID,
sizeof(APPID) / sizeof(TCHAR) - 1, sizeof(APPID) / sizeof(wchar_t) - 1,
#ifdef DEBUG #ifdef DEBUG
stdout stdout
#else #else
@ -506,7 +527,8 @@ DWORD DownloadSymbols(DownloadSymbolsParams* params)
#endif #endif
); );
} }
}
FreeLibrary(hEPGui);
printf("[Symbols] Finished \"Download symbols\" thread.\n"); printf("[Symbols] Finished \"Download symbols\" thread.\n");
return 0; return 0;
@ -528,7 +550,7 @@ LoadSymbolsResult LoadSymbols(symbols_addr* symbols_PTRS)
CHAR szStoredHash[33]; CHAR szStoredHash[33];
ZeroMemory(szHash, sizeof(szHash)); ZeroMemory(szHash, sizeof(szHash));
ZeroMemory(szStoredHash, sizeof(szStoredHash)); ZeroMemory(szStoredHash, sizeof(szStoredHash));
TCHAR wszPath[MAX_PATH]; wchar_t wszPath[MAX_PATH];
BOOL bOffsetsValid; BOOL bOffsetsValid;
// Load twinui.pcshell.dll offsets // Load twinui.pcshell.dll offsets

1
ExplorerPatcher/symbols.h

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

189
ExplorerPatcher/updates.c

@ -862,6 +862,8 @@ BOOL ShowUpdateSuccessNotification(
__x_ABI_CWindows_CUI_CNotifications_CIToastNotification** toast __x_ABI_CWindows_CUI_CNotifications_CIToastNotification** toast
) )
{ {
HMODULE hEPGui = LoadGuiModule();
wchar_t buf[TOAST_BUFSIZ]; wchar_t buf[TOAST_BUFSIZ];
DWORD dwLeftMost = 0; DWORD dwLeftMost = 0;
DWORD dwSecondLeft = 0; DWORD dwSecondLeft = 0;
@ -869,20 +871,32 @@ BOOL ShowUpdateSuccessNotification(
DWORD dwRightMost = 0; DWORD dwRightMost = 0;
QueryVersionInfo(hModule, VS_VERSION_INFO, &dwLeftMost, &dwSecondLeft, &dwSecondRight, &dwRightMost); QueryVersionInfo(hModule, VS_VERSION_INFO, &dwLeftMost, &dwSecondLeft, &dwSecondRight, &dwRightMost);
__x_ABI_CWindows_CData_CXml_CDom_CIXmlDocument* inputXml = NULL;
const wchar_t text[] = const wchar_t text[] =
L"<toast scenario=\"reminder\" " L"<toast scenario=\"reminder\" activationType=\"protocol\" launch=\"%s\" duration=\"%s\">\r\n"
L"activationType=\"protocol\" launch=\"" _T(UPDATES_RELEASE_INFO_URL) L"\" duration=\"short\">\r\n"
L" <visual>\r\n" L" <visual>\r\n"
L" <binding template=\"ToastGeneric\">\r\n" L" <binding template=\"ToastGeneric\">\r\n"
L" <text><![CDATA[Update successful]]></text>\r\n" L" <text><![CDATA[%s]]></text>\r\n"
L" <text><![CDATA[Installed version: %d.%d.%d.%d]]></text>\r\n" L" <text><![CDATA[%s]]></text>\r\n"
L" <text placement=\"attribution\"><![CDATA[ExplorerPatcher]]></text>\r\n" L" <text placement=\"attribution\"><![CDATA[ExplorerPatcher]]></text>\r\n"
L" </binding>\r\n" L" </binding>\r\n"
L" </visual>\r\n" L" </visual>\r\n"
L" <audio src=\"ms-winsoundevent:Notification.Default\" loop=\"false\" silent=\"false\"/>\r\n" L" <audio src=\"ms-winsoundevent:Notification.Default\" loop=\"false\" silent=\"false\"/>\r\n"
L"</toast>\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( String2IXMLDocument(
buf, buf,
wcslen(buf), wcslen(buf),
@ -910,8 +924,13 @@ BOOL ShowUpdateSuccessNotification(
{ {
inputXml->lpVtbl->Release(inputXml); inputXml->lpVtbl->Release(inputXml);
} }
if (hEPGui)
{
FreeLibrary(hEPGui);
}
SwitchToThread(); SwitchToThread();
return TRUE;
} }
BOOL InstallUpdatesIfAvailable( BOOL InstallUpdatesIfAvailable(
@ -924,6 +943,8 @@ BOOL InstallUpdatesIfAvailable(
DWORD dwUpdatePolicy DWORD dwUpdatePolicy
) )
{ {
HMODULE hEPGui = LoadGuiModule();
wchar_t wszInfoURL[MAX_PATH]; wchar_t wszInfoURL[MAX_PATH];
ZeroMemory(wszInfoURL, MAX_PATH * sizeof(wchar_t)); ZeroMemory(wszInfoURL, MAX_PATH * sizeof(wchar_t));
wcscat_s(wszInfoURL, MAX_PATH, _T(UPDATES_RELEASE_INFO_URL_STABLE)); wcscat_s(wszInfoURL, MAX_PATH, _T(UPDATES_RELEASE_INFO_URL_STABLE));
@ -958,51 +979,46 @@ BOOL InstallUpdatesIfAvailable(
} }
} }
__x_ABI_CWindows_CData_CXml_CDom_CIXmlDocument* inputXml = NULL;
if (dwOperation == UPDATES_OP_INSTALL)
{
const wchar_t text[] = const wchar_t text[] =
L"<toast scenario=\"reminder\" " L"<toast scenario=\"reminder\" activationType=\"protocol\" launch=\"%s\" duration=\"%s\">\r\n"
L"activationType=\"protocol\" launch=\"" _T(UPDATES_RELEASE_INFO_URL) L"\" duration=\"long\">\r\n"
L" <visual>\r\n" L" <visual>\r\n"
L" <binding template=\"ToastGeneric\">\r\n" L" <binding template=\"ToastGeneric\">\r\n"
L" <text><![CDATA[Downloading and installing updates]]></text>\r\n" L" <text><![CDATA[%s]]></text>\r\n"
L" <text><![CDATA[Installed version: %d.%d.%d.%d]]></text>\r\n" L" <text><![CDATA[%s]]></text>\r\n"
L" <text placement=\"attribution\"><![CDATA[ExplorerPatcher]]></text>\r\n" L" <text placement=\"attribution\"><![CDATA[ExplorerPatcher]]></text>\r\n"
L" </binding>\r\n" L" </binding>\r\n"
L" </visual>\r\n" L" </visual>\r\n"
L" <audio src=\"ms-winsoundevent:Notification.Default\" loop=\"false\" silent=\"false\"/>\r\n" L" <audio src=\"ms-winsoundevent:Notification.Default\" loop=\"false\" silent=\"false\"/>\r\n"
L"</toast>\r\n"; L"</toast>\r\n";
swprintf_s(buf, TOAST_BUFSIZ, text, dwLeftMost, dwSecondLeft, dwSecondRight, dwRightMost); wchar_t title[100];
String2IXMLDocument( wchar_t body[200];
buf, title[0] = 0; body[0] = 0;
wcslen(buf),
&inputXml, if (dwOperation == UPDATES_OP_INSTALL)
NULL {
); LoadStringW(hEPGui, IDS_UPDATES_DOWNLOADING_T, title, ARRAYSIZE(title));
} }
else if (dwOperation == UPDATES_OP_CHECK) else if (dwOperation == UPDATES_OP_CHECK)
{ {
const wchar_t text[] = LoadStringW(hEPGui, IDS_UPDATES_CHECKING_T, title, ARRAYSIZE(title));
L"<toast scenario=\"reminder\" " }
L"activationType=\"protocol\" launch=\"" _T(UPDATES_RELEASE_INFO_URL) L"\" duration=\"long\">\r\n"
L" <visual>\r\n" wchar_t bodyFormat[200];
L" <binding template=\"ToastGeneric\">\r\n" ZeroMemory(bodyFormat, sizeof(bodyFormat));
L" <text><![CDATA[Checking for updates]]></text>\r\n" if (LoadStringW(hEPGui, IDS_UPDATES_INSTALLEDVER, bodyFormat, ARRAYSIZE(bodyFormat)))
L" <text><![CDATA[Installed version: %d.%d.%d.%d]]></text>\r\n" {
L" <text placement=\"attribution\"><![CDATA[ExplorerPatcher]]></text>\r\n" swprintf_s(body, ARRAYSIZE(body), bodyFormat, dwLeftMost, dwSecondLeft, dwSecondRight, dwRightMost);
L" </binding>\r\n" }
L" </visual>\r\n"
L" <audio src=\"ms-winsoundevent:Notification.Default\" loop=\"false\" silent=\"false\"/>\r\n" swprintf_s(buf, TOAST_BUFSIZ, text, _T(UPDATES_RELEASE_INFO_URL), L"long", title, body);
L"</toast>\r\n";
swprintf_s(buf, TOAST_BUFSIZ, text, dwLeftMost, dwSecondLeft, dwSecondRight, dwRightMost); __x_ABI_CWindows_CData_CXml_CDom_CIXmlDocument* inputXml = NULL;
String2IXMLDocument( String2IXMLDocument(
buf, buf,
wcslen(buf), wcslen(buf),
&inputXml, &inputXml,
NULL NULL
); );
}
if (dwOperation == UPDATES_OP_CHECK || dwOperation == UPDATES_OP_INSTALL) if (dwOperation == UPDATES_OP_CHECK || dwOperation == UPDATES_OP_INSTALL)
{ {
@ -1037,7 +1053,7 @@ BOOL InstallUpdatesIfAvailable(
ZeroMemory(hash, 100 * sizeof(CHAR)); ZeroMemory(hash, 100 * sizeof(CHAR));
ComputeFileHash2(hModule, dllName, hash, 100); ComputeFileHash2(hModule, dllName, hash, 100);
BOOL bFail = FALSE; BOOL bFail = FALSE, bReturnValue = FALSE;
dwLeftMost = 0; dwSecondLeft = 0; dwSecondRight = 0; dwRightMost = 0; dwLeftMost = 0; dwSecondLeft = 0; dwSecondRight = 0; dwRightMost = 0;
if (IsUpdateAvailable(_T(REGPATH), hash, &bFail, wszInfoURL, MAX_PATH, hModule, &dwLeftMost, &dwSecondLeft, &dwSecondRight, &dwRightMost)) 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) if (dwOperation == UPDATES_OP_INSTALL)
{ {
const wchar_t text[] = title[0] = 0; body[0] = 0;
L"<toast scenario=\"reminder\" " LoadStringW(hEPGui, IDS_UPDATES_DLFAILED_T, title, ARRAYSIZE(title));
L"activationType=\"protocol\" launch=\"" _T(UPDATES_RELEASE_INFO_URL) L"\" duration=\"short\">\r\n" LoadStringW(hEPGui, IDS_UPDATES_DLFAILED_B, body, ARRAYSIZE(body));
L" <visual>\r\n"
L" <binding template=\"ToastGeneric\">\r\n" swprintf_s(buf, TOAST_BUFSIZ, text, _T(UPDATES_RELEASE_INFO_URL), L"short", title, body);
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";
String2IXMLDocument( String2IXMLDocument(
text, text,
wcslen(text), wcslen(text),
@ -1097,28 +1107,25 @@ BOOL InstallUpdatesIfAvailable(
} }
else if ((dwOperation == UPDATES_OP_DEFAULT && dwUpdatePolicy == UPDATE_POLICY_NOTIFY) || (dwOperation == UPDATES_OP_CHECK)) else if ((dwOperation == UPDATES_OP_DEFAULT && dwUpdatePolicy == UPDATE_POLICY_NOTIFY) || (dwOperation == UPDATES_OP_CHECK))
{ {
const wchar_t text[] = title[0] = 0; body[0] = 0;
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";
if (!dwLeftMost) if (!dwLeftMost)
{ {
swprintf_s(buf, TOAST_BUFSIZ, text, wszInfoURL, L"New version"); LoadStringW(hEPGui, IDS_UPDATES_AVAILABLE_T_U, title, ARRAYSIZE(title));
} }
else else
{ {
WCHAR wszVersionInfo[100]; WCHAR titleFormat[100];
swprintf_s(wszVersionInfo, 100, L"Version %d.%d.%d.%d is", dwLeftMost, dwSecondLeft, dwSecondRight, dwRightMost); if (LoadStringW(hEPGui, IDS_UPDATES_AVAILABLE_T, titleFormat, ARRAYSIZE(titleFormat)))
swprintf_s(buf, TOAST_BUFSIZ, text, wszInfoURL, wszVersionInfo); {
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; __x_ABI_CWindows_CData_CXml_CDom_CIXmlDocument* inputXml = NULL;
String2IXMLDocument( String2IXMLDocument(
buf, buf,
@ -1148,8 +1155,7 @@ BOOL InstallUpdatesIfAvailable(
inputXml->lpVtbl->Release(inputXml); inputXml->lpVtbl->Release(inputXml);
} }
} }
bReturnValue = TRUE;
return TRUE;
} }
else else
{ {
@ -1163,34 +1169,24 @@ BOOL InstallUpdatesIfAvailable(
} }
if (dwOperation == UPDATES_OP_CHECK || dwOperation == UPDATES_OP_INSTALL) if (dwOperation == UPDATES_OP_CHECK || dwOperation == UPDATES_OP_INSTALL)
{ {
const wchar_t text[] = title[0] = 0; body[0] = 0;
L"<toast scenario=\"reminder\" " if (bFail)
L"activationType=\"protocol\" launch=\"" _T(UPDATES_RELEASE_INFO_URL) L"\" duration=\"short\">\r\n" {
L" <visual>\r\n" LoadStringW(hEPGui, IDS_UPDATES_CHECKFAILED_T, title, ARRAYSIZE(title));
L" <binding template=\"ToastGeneric\">\r\n" LoadStringW(hEPGui, IDS_UPDATES_CHECKFAILED_B, body, ARRAYSIZE(body));
L" <text><![CDATA[No updates are available]]></text>\r\n" }
L" <text><![CDATA[Please check back later.]]></text>\r\n" else
L" <text placement=\"attribution\"><![CDATA[ExplorerPatcher]]></text>\r\n" {
L" </binding>\r\n" LoadStringW(hEPGui, IDS_UPDATES_ISLATEST_T, title, ARRAYSIZE(title));
L" </visual>\r\n" LoadStringW(hEPGui, IDS_UPDATES_ISLATEST_B, body, ARRAYSIZE(body));
L" <audio src=\"ms-winsoundevent:Notification.Default\" loop=\"false\" silent=\"false\"/>\r\n" }
L"</toast>\r\n";
const wchar_t text2[] = swprintf_s(buf, TOAST_BUFSIZ, text, _T(UPDATES_RELEASE_INFO_URL), L"short", title, body);
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";
__x_ABI_CWindows_CData_CXml_CDom_CIXmlDocument* inputXml = NULL; __x_ABI_CWindows_CData_CXml_CDom_CIXmlDocument* inputXml = NULL;
String2IXMLDocument( String2IXMLDocument(
bFail ? text2 : text, buf,
wcslen(bFail ? text2 : text), wcslen(buf),
&inputXml, &inputXml,
NULL NULL
); );
@ -1216,6 +1212,13 @@ BOOL InstallUpdatesIfAvailable(
inputXml->lpVtbl->Release(inputXml); inputXml->lpVtbl->Release(inputXml);
} }
} }
return FALSE; bReturnValue = FALSE;
}
if (hEPGui)
{
FreeLibrary(hEPGui);
} }
return bReturnValue;
} }

1
ExplorerPatcher/updates.h

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

2
ExplorerPatcher/utility.c

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

11
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); __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); __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); __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; 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 #endif
#ifdef __cplusplus #ifdef __cplusplus

4
ep_gui/ep_gui.vcxproj

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

9
ep_gui/resources/EPCrashMessageResources.h

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

36
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

4
ep_gui/resources/ep_gui.rc

@ -71,9 +71,9 @@ BEGIN
VALUE "CompanyName", "VALINET Solutions SRL" VALUE "CompanyName", "VALINET Solutions SRL"
VALUE "FileDescription", "ExplorerPatcher Settings" VALUE "FileDescription", "ExplorerPatcher Settings"
VER_FILE_STRING 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 "LegalCopyright", "Copyright (C) 2006-2023 VALINET Solutions SRL. All rights reserved."
VALUE "OriginalFilename", "ep_gui.exe" VALUE "OriginalFilename", "ep_gui.dll"
VALUE "ProductName", "ExplorerPatcher" VALUE "ProductName", "ExplorerPatcher"
VER_PRODUCT_STRING VER_PRODUCT_STRING
END END

23
ep_gui/resources/lang/ep_gui.en-US.rc

@ -5,6 +5,29 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
STRINGTABLE STRINGTABLE
BEGIN 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_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_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" IDS_CRASH_ONCE "once"

4
ep_gui/resources/resource.h

@ -6,8 +6,8 @@
#define IDR_REGISTRY2 102 #define IDR_REGISTRY2 102
#define IDS_PRODUCTNAME 201 #define IDS_PRODUCTNAME 201
// 401-500 // 301-500
#include "EPCrashMessageResources.h" #include "EPSharedResources.h"
// 1001-2200 // 1001-2200
#include "EPSettingsResources.h" #include "EPSettingsResources.h"

Loading…
Cancel
Save