win-capture: Blacklist specific executables from game capture

Prevents the common problem of injecting in to certain processes and
getting the hook DLL "stuck":
- windows explorer
- steam
- battle.net
- gog galaxy
- skype
- uplay
- origin
- microsoft visual studio
- task manager
- league of legends lobby window
- windows 10 system settings window
This commit is contained in:
jp9000
2016-07-30 12:49:05 -07:00
parent 17667b8b9d
commit bf166c07f4
4 changed files with 75 additions and 10 deletions

View File

@@ -128,7 +128,7 @@ void get_window_class(struct dstr *class, HWND hwnd)
dstr_from_wcs(class, temp);
}
static void add_window(obs_property_t *p, HWND hwnd)
static void add_window(obs_property_t *p, HWND hwnd, add_window_cb callback)
{
struct dstr class = {0};
struct dstr title = {0};
@@ -141,6 +141,13 @@ static void add_window(obs_property_t *p, HWND hwnd)
get_window_title(&title, hwnd);
get_window_class(&class, hwnd);
if (callback && !callback(title.array, class.array, exe.array)) {
dstr_free(&title);
dstr_free(&class);
dstr_free(&exe);
return;
}
dstr_printf(&desc, "[%s]: %s", exe.array, title.array);
encode_dstr(&title);
@@ -204,12 +211,13 @@ static inline HWND first_window(enum window_search_mode mode)
return window;
}
void fill_window_list(obs_property_t *p, enum window_search_mode mode)
void fill_window_list(obs_property_t *p, enum window_search_mode mode,
add_window_cb callback)
{
HWND window = first_window(mode);
while (window) {
add_window(p, window);
add_window(p, window, callback);
window = next_window(window, mode);
}
}