mirror of
https://github.com/valinet/ExplorerPatcher.git
synced 2024-11-27 17:00:59 +01:00
Updates: Revamped code with rich notification content and proper JSON parsing
This commit is contained in:
parent
4799b4bf25
commit
2b9c747212
14
.github/workflows/build.yml
vendored
14
.github/workflows/build.yml
vendored
@ -102,16 +102,16 @@ jobs:
|
||||
if ls build/Release/ep_taskbar.*.amd64.dll 1> /dev/null 2>&1; then
|
||||
mkdir -p build/Release/x64
|
||||
for file in build/Release/ep_taskbar.*.amd64.dll; do
|
||||
cp "$file" "build/Release/x64/$(basename "$file" .amd64.dll).dll"
|
||||
mv "$file" "build/Release/x64/$(basename "$file" .amd64.dll).dll"
|
||||
done
|
||||
fi
|
||||
|
||||
# if ls build/Release/ep_taskbar.*.arm64.dll 1> /dev/null 2>&1; then
|
||||
# mkdir -p build/Release/ARM64
|
||||
# for file in build/Release/ep_taskbar.*.arm64.dll; do
|
||||
# cp "$file" "build/Release/ARM64/$(basename "$file" .arm64.dll).dll"
|
||||
# done
|
||||
# fi
|
||||
if ls build/Release/ep_taskbar.*.arm64.dll 1> /dev/null 2>&1; then
|
||||
mkdir -p build/Release/ARM64
|
||||
for file in build/Release/ep_taskbar.*.arm64.dll; do
|
||||
mv "$file" "build/Release/ARM64/$(basename "$file" .arm64.dll).dll"
|
||||
done
|
||||
fi
|
||||
|
||||
- name: Build funchook amd64
|
||||
shell: powershell
|
||||
|
@ -257,7 +257,7 @@
|
||||
<ClCompile Include="TaskbarCenter.c">
|
||||
<ExcludedFromBuild Condition="'$(WithMainPatcher)'!='true'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="updates.c">
|
||||
<ClCompile Include="updates.cpp">
|
||||
<ExcludedFromBuild Condition="'$(WithMainPatcher)'!='true'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="utility.c">
|
||||
|
@ -17,7 +17,7 @@
|
||||
#else
|
||||
#define SETUP_UTILITY_NAME "ep_setup.arm64.exe"
|
||||
#endif
|
||||
#define TOAST_BUFSIZ 1024
|
||||
#define TOAST_BUFSIZ 1536
|
||||
#define SEH_REGPATH "Control Panel\\Quick Actions\\Control Center\\QuickActionsStateCapture\\ExplorerPatcher"
|
||||
#define EP_SETUP_HELPER_SWITCH "/CreateExplorerShellUnelevatedAfterServicing"
|
||||
#define EP_DWM_SERVICENAME "ep_dwm_" EP_CLSID_LITE
|
||||
|
@ -246,197 +246,6 @@ HRESULT WINAPI _DllGetClassObject(
|
||||
DEFINE_GUID(CLSID_EPStart10,
|
||||
0x9717d01, 0x5d10, 0x4fb5, 0xbd, 0x5, 0x46, 0x38, 0xb, 0x51, 0x65, 0xaa);
|
||||
|
||||
#pragma region "Updates"
|
||||
#if WITH_MAIN_PATCHER
|
||||
DWORD CheckForUpdatesThread(LPVOID timeout)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
HSTRING_HEADER header_AppIdHString;
|
||||
HSTRING AppIdHString = NULL;
|
||||
HSTRING_HEADER header_ToastNotificationManagerHString;
|
||||
HSTRING ToastNotificationManagerHString = NULL;
|
||||
__x_ABI_CWindows_CUI_CNotifications_CIToastNotificationManagerStatics* toastStatics = NULL;
|
||||
__x_ABI_CWindows_CUI_CNotifications_CIToastNotifier* notifier = NULL;
|
||||
HSTRING_HEADER header_ToastNotificationHString;
|
||||
HSTRING ToastNotificationHString = NULL;
|
||||
__x_ABI_CWindows_CUI_CNotifications_CIToastNotificationFactory* notifFactory = NULL;
|
||||
__x_ABI_CWindows_CUI_CNotifications_CIToastNotification* toast = NULL;
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
HWND hShell_TrayWnd = FindWindowExW(
|
||||
NULL,
|
||||
NULL,
|
||||
L"Shell_TrayWnd",
|
||||
NULL
|
||||
);
|
||||
if (hShell_TrayWnd)
|
||||
{
|
||||
Sleep(timeout);
|
||||
break;
|
||||
}
|
||||
Sleep(100);
|
||||
}
|
||||
printf("[Updates] Starting daemon.\n");
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
hr = RoInitialize(RO_INIT_MULTITHREADED);
|
||||
}
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
hr = WindowsCreateStringReference(
|
||||
APPID,
|
||||
(UINT32)(sizeof(APPID) / sizeof(TCHAR) - 1),
|
||||
&header_AppIdHString,
|
||||
&AppIdHString
|
||||
);
|
||||
}
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
hr = WindowsCreateStringReference(
|
||||
RuntimeClass_Windows_UI_Notifications_ToastNotificationManager,
|
||||
(UINT32)(sizeof(RuntimeClass_Windows_UI_Notifications_ToastNotificationManager) / sizeof(wchar_t) - 1),
|
||||
&header_ToastNotificationManagerHString,
|
||||
&ToastNotificationManagerHString
|
||||
);
|
||||
}
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
hr = RoGetActivationFactory(
|
||||
ToastNotificationManagerHString,
|
||||
&UIID_IToastNotificationManagerStatics,
|
||||
(LPVOID*)&toastStatics
|
||||
);
|
||||
}
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
hr = toastStatics->lpVtbl->CreateToastNotifierWithId(
|
||||
toastStatics,
|
||||
AppIdHString,
|
||||
¬ifier
|
||||
);
|
||||
}
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
hr = WindowsCreateStringReference(
|
||||
RuntimeClass_Windows_UI_Notifications_ToastNotification,
|
||||
(UINT32)(sizeof(RuntimeClass_Windows_UI_Notifications_ToastNotification) / sizeof(wchar_t) - 1),
|
||||
&header_ToastNotificationHString,
|
||||
&ToastNotificationHString
|
||||
);
|
||||
}
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
hr = RoGetActivationFactory(
|
||||
ToastNotificationHString,
|
||||
&UIID_IToastNotificationFactory,
|
||||
(LPVOID*)¬ifFactory
|
||||
);
|
||||
}
|
||||
|
||||
HANDLE hEvents[2];
|
||||
hEvents[0] = CreateEventW(NULL, FALSE, FALSE, L"EP_Ev_CheckForUpdates_" _T(EP_CLSID));
|
||||
hEvents[1] = CreateEventW(NULL, FALSE, FALSE, L"EP_Ev_InstallUpdates_" _T(EP_CLSID));
|
||||
if (hEvents[0] && hEvents[1])
|
||||
{
|
||||
if (bShowUpdateToast)
|
||||
{
|
||||
ShowUpdateSuccessNotification(hModule, notifier, notifFactory, &toast);
|
||||
|
||||
HKEY hKey = NULL;
|
||||
|
||||
RegCreateKeyExW(
|
||||
HKEY_CURRENT_USER,
|
||||
TEXT(REGPATH),
|
||||
0,
|
||||
NULL,
|
||||
REG_OPTION_NON_VOLATILE,
|
||||
KEY_READ | KEY_WOW64_64KEY | KEY_WRITE,
|
||||
NULL,
|
||||
&hKey,
|
||||
NULL
|
||||
);
|
||||
if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
hKey = NULL;
|
||||
}
|
||||
if (hKey)
|
||||
{
|
||||
bShowUpdateToast = FALSE;
|
||||
RegSetValueExW(
|
||||
hKey,
|
||||
TEXT("IsUpdatePending"),
|
||||
0,
|
||||
REG_DWORD,
|
||||
&bShowUpdateToast,
|
||||
sizeof(DWORD)
|
||||
);
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
}
|
||||
if (dwUpdatePolicy != UPDATE_POLICY_MANUAL)
|
||||
{
|
||||
InstallUpdatesIfAvailable(hModule, notifier, notifFactory, &toast, UPDATES_OP_DEFAULT, bAllocConsole, dwUpdatePolicy);
|
||||
}
|
||||
DWORD dwRet = 0;
|
||||
while (TRUE)
|
||||
{
|
||||
switch (WaitForMultipleObjects(2, hEvents, FALSE, INFINITE))
|
||||
{
|
||||
case WAIT_OBJECT_0:
|
||||
{
|
||||
InstallUpdatesIfAvailable(hModule, notifier, notifFactory, &toast, UPDATES_OP_CHECK, bAllocConsole, dwUpdatePolicy);
|
||||
break;
|
||||
}
|
||||
case WAIT_OBJECT_0 + 1:
|
||||
{
|
||||
InstallUpdatesIfAvailable(hModule, notifier, notifFactory, &toast, UPDATES_OP_INSTALL, bAllocConsole, dwUpdatePolicy);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
CloseHandle(hEvents[0]);
|
||||
CloseHandle(hEvents[1]);
|
||||
}
|
||||
|
||||
if (toast)
|
||||
{
|
||||
toast->lpVtbl->Release(toast);
|
||||
}
|
||||
if (notifFactory)
|
||||
{
|
||||
notifFactory->lpVtbl->Release(notifFactory);
|
||||
}
|
||||
if (ToastNotificationHString)
|
||||
{
|
||||
WindowsDeleteString(ToastNotificationHString);
|
||||
}
|
||||
if (notifier)
|
||||
{
|
||||
notifier->lpVtbl->Release(notifier);
|
||||
}
|
||||
if (toastStatics)
|
||||
{
|
||||
toastStatics->lpVtbl->Release(toastStatics);
|
||||
}
|
||||
if (ToastNotificationManagerHString)
|
||||
{
|
||||
WindowsDeleteString(ToastNotificationManagerHString);
|
||||
}
|
||||
if (AppIdHString)
|
||||
{
|
||||
WindowsDeleteString(AppIdHString);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#pragma endregion
|
||||
|
||||
|
||||
#pragma region "Generics"
|
||||
#if WITH_MAIN_PATCHER
|
||||
HWND GetMonitorInfoFromPointForTaskbarFlyoutActivation(POINT ptCursor, DWORD dwFlags, LPMONITORINFO lpMi)
|
||||
|
File diff suppressed because it is too large
Load Diff
1426
ExplorerPatcher/updates.cpp
Normal file
1426
ExplorerPatcher/updates.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@ -8,6 +8,10 @@
|
||||
#include "utility.h"
|
||||
#include "../ep_gui/resources/EPSharedResources.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern HMODULE hModule;
|
||||
|
||||
#define UPDATES_VERBOSE_OUTPUT
|
||||
@ -20,6 +24,7 @@ extern HMODULE hModule;
|
||||
#define UPDATES_OP_DEFAULT 0
|
||||
#define UPDATES_OP_CHECK 1
|
||||
#define UPDATES_OP_INSTALL 2
|
||||
#define UPDATES_OP_INSTALL_NO_CONFIRM 3
|
||||
|
||||
#define UPDATES_USER_AGENT "ExplorerPatcher"
|
||||
#define UPDATES_FORM_HEADERS "Content-Type: text/plain;\r\n"
|
||||
@ -31,24 +36,10 @@ extern HMODULE hModule;
|
||||
#define UPDATES_RELEASE_INFO_URL_STABLE "https://github.com/valinet/ExplorerPatcher/releases/latest"
|
||||
#define UPDATES_RELEASE_INFO_URL_STAGING "https://api.github.com/repos/valinet/ExplorerPatcher/releases?per_page=1"
|
||||
|
||||
typedef struct IsUpdateAvailableParameters
|
||||
{
|
||||
HINTERNET hInternet;
|
||||
HANDLE hEvent;
|
||||
};
|
||||
DWORD CheckForUpdatesThread(LPVOID params);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
BOOL IsUpdatePolicy(LPCWSTR wszDataStore, DWORD dwUpdatePolicy);
|
||||
BOOL ShowUpdateSuccessNotification(
|
||||
HMODULE hModule,
|
||||
__x_ABI_CWindows_CUI_CNotifications_CIToastNotifier* notifier,
|
||||
__x_ABI_CWindows_CUI_CNotifications_CIToastNotificationFactory* notifFactory,
|
||||
__x_ABI_CWindows_CUI_CNotifications_CIToastNotification** toast
|
||||
);
|
||||
BOOL InstallUpdatesIfAvailable(
|
||||
HMODULE hModule,
|
||||
__x_ABI_CWindows_CUI_CNotifications_CIToastNotifier* notifier,
|
||||
__x_ABI_CWindows_CUI_CNotifications_CIToastNotificationFactory* notifFactory,
|
||||
__x_ABI_CWindows_CUI_CNotifications_CIToastNotification** toast,
|
||||
DWORD dwOperation, DWORD bAllocConsole, DWORD dwUpdatePolicy
|
||||
);
|
||||
#endif
|
@ -16,6 +16,8 @@
|
||||
#define IDS_UPDATES_DLFAILED_B 312
|
||||
#define IDS_UPDATES_INSTALLEDVER 313
|
||||
#define IDS_UPDATES_PROMPT 314
|
||||
#define IDS_UPDATES_AVAILABLE_A 315
|
||||
#define IDS_UPDATES_DOWNLOADING_0 316
|
||||
|
||||
// 351-400
|
||||
|
||||
|
@ -8,12 +8,14 @@ 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_AVAILABLE_B "Click here to learn more about this update."
|
||||
IDS_UPDATES_AVAILABLE_A "Update now"
|
||||
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_DOWNLOADING_0 "Preparing…"
|
||||
IDS_UPDATES_SUCCESS_T "Update successful"
|
||||
IDS_UPDATES_DLFAILED_T "Update failed"
|
||||
IDS_UPDATES_DLFAILED_B "The has cancelled the process or an error has occured when attempting to install this update."
|
||||
|
Loading…
Reference in New Issue
Block a user