Mods: LARP_HOST_NAME for mods that only start in a host program they know #87
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/gamingwithhomie--larp!87
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-87"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@kadiratesdev on GitHub · 2026-12-05 18:01 UTC · original
kadiratesdev:feat/host-name→main· +392 −3 · 6 files · 1 commits · merged 2026-12-05 19:00 UTCSummary
Some proxy DLLs (e.g. a
winmm.dllplaced beside the program) and native modscheck which program they were loaded into before they do anything: in
DllMainthey read
GetModuleFileNameW(NULL)and compare the file name against a list ofhosts they were written for. Under larp that name is
larp.exe, so such a modloads but stays silently inactive, even though everything else it needs (the
title mapped through the loader, its loader notification, its code at the
expected RVAs) is there.
This PR adds an opt-in
LARP_HOST_NAME=<file name>. While larp loads mods, theprocess' main module is shown under that file name (same folder); right after,
the real name is put back, so larp's own uses of its path (
current_exe,relaunch,
nv-profile, Agility SDK lookup) are unaffected. Unset (the default),nothing is renamed.
Changes
apps/larp/src/host_name.rs(new): validates the value (plain file name only),and swaps
FullDllName/BaseDllNameof the main module's loader entry(
PEB.Ldr, entry whoseDllBase == PEB.ImageBaseAddress) under the loaderlock (
LdrLockLoaderLock); a guard puts them back on drop. New strings areleaked (a few bytes) so no reader can ever see freed memory.
apps/larp/src/main.rs:run --executeapplies the name first, thenadvisor::check(), thenmods::load_all(guard). The name must be in placebefore
advisor::check(): loading the NVIDIA API there pulls innvapi64_impl.dll, which importswinmm.dll, and awinmm.dllbesidelarp.exeis found first and loaded right then. A proxy reads its host's nameonce, when it loads, so it has to see the configured name at that moment.
apps/larp/src/mods.rs:load_all()loads, in order,winmm.dll(a proxybeside
larp.exe, by its full path, or finds it already loaded; else Windows'own), MFG Unlocker and
mods\, then drops the guard. It logs (INFO) and printsone summary line saying which
winmm.dllis in use, from where, whether it wasalready loaded at startup, and under which name the program was shown; it warns
if a
winmm.dllexists besidelarp.exebut Windows' own was loaded.apps/larp/build.rs:/DELAYLOAD:winmm.dll. larp importswinmm.dllonlyfor
timeBeginPeriod; with a normal import a proxy'sDllMainran whileWindows started the process, before larp could do anything.
apps/larp/Cargo.toml: windows-sys featureWin32_System_SystemInformation(
GetSystemDirectoryW, to tell the proxy from Windows' own).docs/environment-variables.md:LARP_HOST_NAMErow in "Mods".Behaviour without the switch
The only change is when
winmm.dllis loaded: at the start ofrun --executeinstead of at process start (other commands load it on first use, if ever).
Load order relative to MFG Unlocker and
mods\is the same as before.Testing
cargo test -p larp, run under Wine for x86_64-pc-windows-msvc):name validation, folder kept, and
GetModuleFileNameW(NULL)returns the newname while renamed and the original one after. 7/7 pass.
winmm.dllno longer appears in thenormal import table (delay-load table instead).
winmm.dllproxy besidelarp.exe, underWine and on Windows 11 (
larp run --execute <missing file>, so no game isstarted): without
LARP_HOST_NAMEthe proxy stays inactive (writes nothing);with
LARP_HOST_NAME=<a host it lists>it starts (writes its log). On Windowsthe proxy is loaded by
nvapi64_impl.dllduringadvisor::check(), which iswhy the name is applied before it.
Sirius Turkish subtitle proxy beside
larp.exeandLARP_HOST_NAMEset to ahost that proxy lists: the proxy's own log appeared, and the user reported
that Turkish text appears to work in-game. Fonts and Turkish capitals were
not checked in detail.
Notes
load_all) seelarp.exe.@copilot-pull-request-reviewer[bot] on GitHub · 2026-12-05 18:01 UTC · original · reviewed
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.