Skip to content

Commit

Permalink
kernelbase: Apply blacklist automatically to Origin executables
Browse files Browse the repository at this point in the history
  • Loading branch information
aeikum committed Jun 10, 2020
1 parent 5b00ca6 commit 2409bd1
Showing 1 changed file with 44 additions and 10 deletions.
54 changes: 44 additions & 10 deletions dlls/kernelbase/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,23 +447,57 @@ static unsigned int blacklist_filename_count;

static BOOL CALLBACK init_file_blacklist(PINIT_ONCE init_once, PVOID parameter, PVOID *context)
{
static WCHAR origin_blacklist[] = L"kernel32.dll;user32.dll";

const WCHAR separators[] = L",; ";
WCHAR *buffer, *token;
DWORD size;

if (!(size = GetEnvironmentVariableW(L"WINE_BLACKLIST_FILES", NULL, 0)))
return TRUE;

if (!(buffer = heap_alloc(sizeof(*buffer) * size)))
if ((size = GetEnvironmentVariableW(L"WINE_BLACKLIST_FILES", NULL, 0)))
{
ERR("No memory.\n");
return FALSE;
}
if (!(buffer = heap_alloc(sizeof(*buffer) * size)))
{
ERR("No memory.\n");
return FALSE;
}

if (GetEnvironmentVariableW(L"WINE_BLACKLIST_FILES", buffer, size) != size - 1)
if (GetEnvironmentVariableW(L"WINE_BLACKLIST_FILES", buffer, size) != size - 1)
{
ERR("Error getting WINE_BLACKLIST_FILES env variable.\n");
return FALSE;
}
}
else
{
ERR("Error getting WINE_BLACKLIST_FILES env variable.\n");
return FALSE;
static const WCHAR *origin_names[] = {
L"igoproxy64.exe",
L"igoproxy.exe",
L"origin.exe",
L"easteamproxy.exe"
};

WCHAR cur_exe[MAX_PATH];
DWORD cur_exe_len, i;

if (!(cur_exe_len = GetModuleFileNameW(NULL, cur_exe, ARRAY_SIZE(cur_exe))))
return TRUE;

buffer = NULL;

for (i = 0; i < ARRAY_SIZE(origin_names); ++i)
{
DWORD origin_name_len = wcslen(origin_names[i]);
if (cur_exe_len >= origin_name_len &&
wcsicmp(cur_exe + cur_exe_len - origin_name_len, origin_names[i]) == 0)
{
FIXME("using origin file blacklist for %s\n", debugstr_w(cur_exe));
buffer = origin_blacklist;
break;
}
}

if (!buffer)
return TRUE;
}

blacklist_filename_count = 0;
Expand Down

0 comments on commit 2409bd1

Please sign in to comment.