win-capture: Use full app obj name for keepalive mutex

Ensures that the UWP program can open the keepalive mutex to check to
see whether OBS is still alive.  Fixes a bug where UWP programs wouldn't
capture.
This commit is contained in:
jp9000
2020-03-10 06:06:23 -07:00
parent 432017b2c9
commit c76426c5bd
4 changed files with 42 additions and 1 deletions

View File

@@ -53,6 +53,14 @@ wchar_t *get_app_sid(HANDLE process)
static const wchar_t *path_format =
L"\\Sessions\\%lu\\AppContainerNamedObjects\\%s\\%s";
HANDLE create_app_mutex(const wchar_t *sid, const wchar_t *name)
{
wchar_t path[MAX_PATH];
DWORD session_id = WTSGetActiveConsoleSessionId();
_snwprintf(path, MAX_PATH, path_format, session_id, sid, name);
return nt_create_mutex(path);
}
HANDLE open_app_mutex(const wchar_t *sid, const wchar_t *name)
{
wchar_t path[MAX_PATH];