LegacyUpdate/shared/Wow64.c
Adam Demasi 8d1c727da6
Avoid IE medium integrity elevation request prompt
This prompt is showing up when the user clicks to open the WU options dialog,
when the site is not in the trusted zone. We can work around this by moving this
logic to the launcher, then marking LegacyUpdate.exe as trusted.
2024-12-11 16:47:29 +10:30

45 lines
1.2 KiB
C

#include "stdafx.h"
#include "Wow64.h"
typedef BOOL (WINAPI *_Wow64DisableWow64FsRedirection)(PVOID *OldValue);
typedef BOOL (WINAPI *_Wow64RevertWow64FsRedirection)(PVOID OldValue);
static BOOL _loadedWow64;
static _Wow64DisableWow64FsRedirection $Wow64DisableWow64FsRedirection;
static _Wow64RevertWow64FsRedirection $Wow64RevertWow64FsRedirection;
#if _WIN64
// Not needed
#define DisableWow64FsRedirection(OldValue) TRUE
#define RevertWow64FsRedirection(OldValue) TRUE
#else
static void LoadWow64Symbols() {
if (!_loadedWow64) {
_loadedWow64 = TRUE;
HMODULE kernel32 = GetModuleHandle(L"kernel32.dll");
$Wow64DisableWow64FsRedirection = (_Wow64DisableWow64FsRedirection)GetProcAddress(kernel32, "Wow64DisableWow64FsRedirection");
$Wow64RevertWow64FsRedirection = (_Wow64RevertWow64FsRedirection)GetProcAddress(kernel32, "Wow64RevertWow64FsRedirection");
}
}
BOOL DisableWow64FsRedirection(PVOID *OldValue) {
LoadWow64Symbols();
if ($Wow64DisableWow64FsRedirection) {
return $Wow64DisableWow64FsRedirection(OldValue);
} else {
return TRUE;
}
}
BOOL RevertWow64FsRedirection(PVOID OldValue) {
LoadWow64Symbols();
if ($Wow64RevertWow64FsRedirection) {
return $Wow64RevertWow64FsRedirection(OldValue);
} else {
return TRUE;
}
}
#endif