chore: land the reviewed logging, hooking and launch-option changes onto main - #27
Merged
Merged
Conversation
Log sites reached spdlog directly, so each one wrote wherever the default logger happened to point, and a logger built before the host installed its sinks stayed attached to whatever was there at the time. utils::GetLogger(name) hands out a logger per component over a single fan-out sink. Where output goes is decided once, by AddLogSink, and applies to loggers that already exist as well as ones created later - so the bring-up loggers the backend creates at DLL attach write to the same places as everything else. Names are dotted and follow the source tree. The host adds a rotating file sink next to the ini, named per profile so concurrent instances do not share a file, and flushes every second. Loggers flush themselves from warn: forcing one per record would put an fflush on every line inside the shared sink lock, which a script logging in a loop would make everyone else pay. Default volume is unchanged - the framework logger at debug, everything else at spdlog default. Raw spdlog:: calls are gone. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Each call site had rolled its own transaction and its own real-function pointer, and two of them shared a defect: a failed commit left the site believing it had attached, so the matching remove detached hooks that were never installed - eighteen of them in speedhack. Realms additionally dropped its detach error and nulled its real-function pointers while in-flight hook bodies could still be running. core/detour is one API for all of them. Target says where a function lives, Hook<Fn> is a slot whose target and replacement are checked against each other at compile time and whose Real() reaches the original whether or not it is attached, and Batch is one transaction that de-duplicates exports sharing a body, refuses two different replacements over one body, and aborts rather than committing an empty update. A failed DetourTransactionBegin is aborted rather than left pending: one of its two failure modes claims the process-wide transaction slot before returning the error, and leaving it claimed wedges every later attach and detach in the process. A refused detach is reported instead of being swallowed, since the slot keeps a live detour into a DLL that is unloading. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Launch-option parsing moves out of the 1.14d backend into core/config/OptionParser, since nothing about it is version-specific: a backend declares its own options struct and builds a table, and the walker is shared. The table then doubles as the list of switches to take back out. Once the options are parsed their values are cached, so the command line no longer needs to carry them - and a CD key passed as -d2c, or a proxy password inside -proxy, stops being readable through the PEB, Task Manager, WMI and GetCommandLineA/W. The whole switch goes, not just the credential in it, so neither the value nor the fact that it was passed survives. Three buffers hold the line. The wide one and the PEB copy are cut in place (usually the same storage; handled separately when not). The ANSI copy is re-encoded from the cut wide line rather than cut with the same token indices, because a byte-wise split disagrees with a UTF-16 one wherever a DBCS trail byte is 0x5C - which would silently leave the whole line readable through GetCommandLineA. This defeats reading the command line afterwards, not capturing it at creation: anything hooked into process creation has already seen it. Twenty-three tests cover the cut, including the cases where the two splits disagree and nothing may be touched. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a re-land, not new work
#24, #25 and #26 were all merged — but each merged into its base branch, not into
main. GitHub only retargets a stacked PR tomainwhen the base branch is deleted after merging; the bases here were kept, so:main✅split/x64-platformsplit/loggingsplit/detour-apiSo
maincurrently has the x64 change only, and the other three are sitting in intermediate branches.What this PR is
The same three commits, replayed onto current
main:refactor: give every component a named logger over one shared sinkrefactor: put every Detours hook behind one typed slot APIfeat: remove the parsed launch options from the process command lineNothing changed. The resulting tree is byte-identical to
origin/split/detour-api, which is the branch that holds all four merged changes — verified withgit diff, empty output. If you already reviewed #24/#25/#26 there is nothing new to read here; this is purely about getting the content ontomain.After merging
Delete
split/x64-platform,split/logging,split/detour-apiandsplit/option-parser. They hold no unique content once this lands, and leaving them is what caused the mis-targeting in the first place.🤖 Generated with Claude Code