1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-13 07:47:14 +03:00

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.
This commit is contained in:
Athanasius 2021-03-18 10:13:15 +00:00
parent d6e7cbce16
commit 2ddea7d4f1

View File

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