build(loader): request UAC elevation via requireAdministrator manifest

OpenZenLoader.exe now ships with a requireAdministrator manifest
instead of asInvoker. The Windows loader prompts for UAC consent
once at launch, which:

- guarantees OpenProcess / VirtualAllocEx / CreateRemoteThread
  succeed against javaw.exe when the Minecraft launcher (HMCL,
  MultiMC) was itself started elevated,
- avoids the silent injection failure observed on locked-down
  standard user accounts.

The EXE also picks up the UAC shield overlay on its file icon.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Shirona1337
2026-05-23 18:32:32 +08:00
parent 7f76b86c84
commit 18224465c2
+7 -1
View File
@@ -45,7 +45,13 @@ set_target_properties(OpenZenLoader PROPERTIES
)
if(MSVC)
# requireAdministrator: ensures the loader can OpenProcess /
# VirtualAllocEx / CreateRemoteThread against javaw.exe even when the
# Minecraft launcher (HMCL, MultiMC) was itself started elevated, and
# avoids the silent injection failure that happens on locked-down user
# accounts. The user will see one UAC consent prompt when launching
# OpenZenLoader.exe.
set_target_properties(OpenZenLoader PROPERTIES
LINK_FLAGS "/SUBSYSTEM:WINDOWS /MANIFESTUAC:\"level='asInvoker' uiAccess='false'\""
LINK_FLAGS "/SUBSYSTEM:WINDOWS /MANIFESTUAC:\"level='requireAdministrator' uiAccess='false'\""
)
endif()