frontend, plugins: Remove PreferSystem32Images mitigation

This process mitigation flag is inherited by child processes and applies
to load-time DLL resolution, pushing the application's own directory
below the system directories. If there are system-installed copies of
dependent DLLs such as FFmpeg, those get loaded when OBS is updated as
the updater and subsequent relaunch of OBS inherit the mitigation.

As we use SetDefaultDllDirectories, this mitigation is less important,
the proper fix would be to use /DEPENDENTLOADFLAG to protect load-time
import resolution.
This commit is contained in:
Richard Stanway
2026-08-04 17:19:45 -04:00
committed by Ryan Foster
parent d3972603e5
commit 88de106cff
4 changed files with 0 additions and 17 deletions
-5
View File
@@ -846,11 +846,6 @@ static bool vc_runtime_outdated()
static void set_process_mitigation_policies()
{
// DLL planting protection - prefer system32 images
PROCESS_MITIGATION_IMAGE_LOAD_POLICY policy = {};
policy.PreferSystem32Images = 1;
SetProcessMitigationPolicy(ProcessImageLoadPolicy, &policy, sizeof(policy));
PROCESS_MITIGATION_DEP_POLICY dep = {0};
dep.DisableAtlThunkEmulation = 1;
dep.Enable = 1;
@@ -1156,10 +1156,6 @@ int main(int argc, char *argv[])
SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_DEFAULT_DIRS);
SetDllDirectoryW(L"");
PROCESS_MITIGATION_IMAGE_LOAD_POLICY policy = {0};
policy.PreferSystem32Images = 1;
SetProcessMitigationPolicy(ProcessImageLoadPolicy, &policy, sizeof(policy));
argv = malloc(argc * sizeof(char *));
for (int i = 0; i < argc; i++) {
size_t len = wcslen(argv_w[i]);
@@ -21,10 +21,6 @@ int main(int argc, char *argv[])
SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_DEFAULT_DIRS);
SetDllDirectoryW(L"");
PROCESS_MITIGATION_IMAGE_LOAD_POLICY policy = {0};
policy.PreferSystem32Images = 1;
SetProcessMitigationPolicy(ProcessImageLoadPolicy, &policy, sizeof(policy));
if (!RegisterClassA(&wc)) {
printf("failed to register '%s'\n", DUMMY_WNDCLASS);
return -1;
@@ -101,10 +101,6 @@ int main(void)
SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_DEFAULT_DIRS);
SetDllDirectoryW(L"");
PROCESS_MITIGATION_IMAGE_LOAD_POLICY policy = {0};
policy.PreferSystem32Images = 1;
SetProcessMitigationPolicy(ProcessImageLoadPolicy, &policy, sizeof(policy));
load_debug_privilege();
pCommandLineW = GetCommandLineW();