From f428a41194b4cafe70395e4b45feddea3329fed6 Mon Sep 17 00:00:00 2001 From: Victor Nova Date: Sun, 23 Apr 2023 21:34:46 -0700 Subject: [PATCH] win-capture: get-graphics-offsets support for UWP/AppContainer --- .../win-capture/get-graphics-offsets/CMakeLists.txt | 2 ++ .../get-graphics-offsets/get-graphics-offsets.c | 11 ++++++++++- .../get-graphics-offsets/get-graphics-offsets.h | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/plugins/win-capture/get-graphics-offsets/CMakeLists.txt b/plugins/win-capture/get-graphics-offsets/CMakeLists.txt index 7af684bbef2742..7a5cefec431cbd 100644 --- a/plugins/win-capture/get-graphics-offsets/CMakeLists.txt +++ b/plugins/win-capture/get-graphics-offsets/CMakeLists.txt @@ -9,6 +9,8 @@ target_sources( dxgi-offsets.cpp d3d8-offsets.cpp d3d9-offsets.cpp + ../nt-stuff.c + ../nt-stuff.h ../graphics-hook-info.h ../hook-helpers.h) diff --git a/plugins/win-capture/get-graphics-offsets/get-graphics-offsets.c b/plugins/win-capture/get-graphics-offsets/get-graphics-offsets.c index c18cc3793759d2..e1862e92f84009 100644 --- a/plugins/win-capture/get-graphics-offsets/get-graphics-offsets.c +++ b/plugins/win-capture/get-graphics-offsets/get-graphics-offsets.c @@ -1,11 +1,20 @@ #include #include +#include #include #include "get-graphics-offsets.h" struct hook_info *open_hook_info_shmem(const char *shmemName) { - HANDLE shmem = OpenFileMappingA(FILE_MAP_WRITE, false, shmemName); + HANDLE shmem; + if (shmemName[0] == '\\') { + wchar_t wideName[MAX_PATH + 1]; + mbstowcs(wideName, shmemName, MAX_PATH); + shmem = nt_open_map(wideName); + } else { + shmem = OpenFileMappingA(FILE_MAP_WRITE, false, shmemName); + } + if (!shmem) { return NULL; } diff --git a/plugins/win-capture/get-graphics-offsets/get-graphics-offsets.h b/plugins/win-capture/get-graphics-offsets/get-graphics-offsets.h index 53a6ee407cd28c..9884c9c2ec5fa7 100644 --- a/plugins/win-capture/get-graphics-offsets/get-graphics-offsets.h +++ b/plugins/win-capture/get-graphics-offsets/get-graphics-offsets.h @@ -3,6 +3,7 @@ #include #include #include "../graphics-hook-info.h" +#include "../nt-stuff.h" #define DUMMY_WNDCLASS "get_addrs_wndclass"