Share via

IApplicationActivationManager race condition

lb90 1 Reputation point
2022-07-26T14:26:48.423+00:00

IApplicationActivationManager::ActivateApplication() and related methods return a process ID (PID) as an out parameter. The process ID can then be used in a call to OpenProcess() to retrieve a process HANDLE so to gather any additional information or synchronize with the spawned process.

Unfortunately, testing on Windows 10 21H2 suggests that there's a race condition between retrieving the process ID from the ActivateApplication() methods and calling OpenProcess(). ApplicationActivationManager should really keep an open HANDLE to the spawned process, until disposed by the last call to Release(), to avoid such race condition.

See https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nn-shobjidl_core-iapplicationactivationmanager

Thank you,
Luca

Developer technologies | Universal Windows Platform (UWP)
Windows development | Windows API - Win32

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.