win-capture: Fix getting proper UWP window handles

The "main" windows detected for UWP programs are basically to help
sandbox the programs -- they run in the ApplicationFrameHost process and
help reduce the possibility of other programs trying to access the
actual process window, which is a child window.

To bypass this, go through the list of child windows for the
ApplicationFrameHost window, and then find the one that's attached to
a different process; that different process will always be the target,
and will allows us to open the actual process of the UWP program.
This commit is contained in:
jp9000
2016-10-31 01:46:18 -07:00
parent 4ec1033741
commit 1e48b522fa
3 changed files with 72 additions and 7 deletions

View File

@@ -1443,6 +1443,9 @@ static void game_capture_tick(void *data, float seconds)
if (activate_now) {
HWND hwnd = (HWND)os_atomic_load_long(&gc->hotkey_window);
if (is_uwp_window(hwnd))
hwnd = get_uwp_actual_window(hwnd);
if (get_window_exe(&gc->executable, hwnd)) {
get_window_title(&gc->title, hwnd);
get_window_class(&gc->class, hwnd);