From 2ddea7d4f1531026be877c3645f23938b68e7e4d Mon Sep 17 00:00:00 2001 From: Athanasius Date: Thu, 18 Mar 2021 10:13:15 +0000 Subject: [PATCH] Log when we detect edmc:// arg and attempt ShellExecute() This is the code path for when something ignores the ddeexec registry key and instead invokes EDMarketConnector.exe with the edmc://... argument directly. Our response is to try ShellExecute() to invoke the DDE path instead. If the DDE path isn't set up (registry key `Computer\HKEY_CLASSES_ROOT\edmc\shell\open\ddeexec` not present and correct), then this will cause a loop of repeatedly invoking EDMarketConnector.exe. That key is inserted by the installer. The only reasons for it to not be there would be something blocking the installer from creating it or something removing it after install. --- EDMarketConnector.py | 1 + 1 file changed, 1 insertion(+) diff --git a/EDMarketConnector.py b/EDMarketConnector.py index e95b68b8..ce97f9e3 100755 --- a/EDMarketConnector.py +++ b/EDMarketConnector.py @@ -142,6 +142,7 @@ if __name__ == '__main__': # noqa: C901 if GetProcessHandleFromHwnd(window_handle): # If GetProcessHandleFromHwnd succeeds then the app is already running as this user if len(sys.argv) > 1 and sys.argv[1].startswith(protocolhandler_redirect): + logger.debug('Invoked with edmc:// protocol handler arg') CoInitializeEx(0, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE) # Wait for it to be responsive to avoid ShellExecute recursing ShowWindow(window_handle, SW_RESTORE)