Release v0.6.36: offload notification registration and mitigate Viber paste timing

This commit is contained in:
2026-11-04 15:40:50 +02:00
parent d13e9849a7
commit 94cab4c112
16 changed files with 220 additions and 19 deletions
+11 -1
View File
@@ -5,9 +5,11 @@
static std::wstring programs;
static std::wstring activationExecutable, activationCommand;
static int activationCalls{};
static DWORD launchFlags{}; static bool inheritsHandles{};
static BOOL WINAPI testCreateProcess(LPCWSTR path, LPWSTR command, LPSECURITY_ATTRIBUTES,
LPSECURITY_ATTRIBUTES, BOOL, DWORD, LPVOID, LPCWSTR, LPSTARTUPINFOW, LPPROCESS_INFORMATION)
LPSECURITY_ATTRIBUTES, BOOL inherit, DWORD flags, LPVOID, LPCWSTR, LPSTARTUPINFOW, LPPROCESS_INFORMATION)
{
launchFlags=flags; inheritsHandles=inherit;
++activationCalls; activationExecutable=path; activationCommand=command;
SetLastError(ERROR_CANCELLED); return FALSE; // Inspect activation without starting any program.
}
@@ -55,6 +57,14 @@ int main()
valid=id.vt==VT_CLSID && *id.puuid==ks::ActivatorId; PropVariantClear(&id);
if(!valid) throw std::runtime_error("shortcut activator missing");
ks::registerScreenshotNotifications(); // Registration is safe to repeat.
bool launchFailed=false;
try { ks::startScreenshotNotificationRegistration(); }
catch(const std::exception &) { launchFailed=true; }
if(!launchFailed || activationExecutable!=helper.wstring() ||
activationCommand!=L"\""+helper.wstring()+L"\" --register-notifications" ||
!(launchFlags&CREATE_NO_WINDOW) || inheritsHandles)
throw std::runtime_error("registration must launch the sibling helper and propagate failure");
activationCalls=0;
ks::Activator activator(helper.wstring(),false);
activator.Activate(L"HrynCo.KSwitcher.Screenshot",L"check-update",nullptr,0);
auto main=(helper.parent_path()/L"KSwitcher.exe").wstring();