Preserve staged helper builds and exclude hooks before attachment
This commit is contained in:
1 parent
0db42de77e
commit
989ecb681d
12 files changed
+267
-38
No files matched your search
@@ -0,0 +1,33 @@
|
||||
// SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
#include "../foreground_hooks.h"
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
HANDLE process = GetCurrentProcess();
|
||||
WCHAR image[32768];
|
||||
DWORD length = 32768;
|
||||
assert(QueryFullProcessImageNameW(process, 0, image, &length));
|
||||
WCHAR *name = image;
|
||||
for (DWORD index = 0; index < length; ++index)
|
||||
if (image[index] == L'\\' || image[index] == L'/') name = image + index + 1;
|
||||
|
||||
SetEnvironmentVariableW(L"WINE_ACCESS_EXCLUDED_HOOK_PROGRAMS", NULL);
|
||||
assert(wine_access_hooks_allowed(process));
|
||||
assert(SetEnvironmentVariableW(L"WINE_ACCESS_EXCLUDED_HOOK_PROGRAMS", L"Other Game.exe\n"));
|
||||
assert(wine_access_hooks_allowed(process));
|
||||
assert(!wine_access_hooks_allowed(NULL));
|
||||
assert(SetEnvironmentVariableW(L"WINE_ACCESS_EXCLUDED_HOOK_PROGRAMS", name));
|
||||
assert(!wine_access_hooks_allowed(process));
|
||||
CharUpperBuffW(name, lstrlenW(name));
|
||||
assert(SetEnvironmentVariableW(L"WINE_ACCESS_EXCLUDED_HOOK_PROGRAMS", name));
|
||||
assert(!wine_access_hooks_allowed(process));
|
||||
WCHAR listed[32768] = L"Other Game.exe\n";
|
||||
lstrcatW(listed, name);
|
||||
lstrcatW(listed, L"\nThird Game.exe\n");
|
||||
assert(SetEnvironmentVariableW(L"WINE_ACCESS_EXCLUDED_HOOK_PROGRAMS", listed));
|
||||
assert(!wine_access_hooks_allowed(process));
|
||||
SetEnvironmentVariableW(L"WINE_ACCESS_EXCLUDED_HOOK_PROGRAMS", NULL);
|
||||
puts("PASS: hook exclusions check the actual process before attachment");
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user