* docs(spike-notes): §25 - the Xbox/GDK titles' layout, read-only, and the launch probe's decision table, written before the run (D77) (beta.33 PR-1) The owner's 11 GDK packages under C:\XboxGames and D:\xbox, read without launching anything: the .GamingRoot files, MicrosoftGame.config / appxmanifest.xml, the WindowsApps junction chain, and the executables refusing FILE_READ_DATA and FILE_EXECUTE to every process outside their package. Then the probe's method and the table that decides what each outcome changes - committed before the probe runs, as the house rule asks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(spike-notes): §25's run - six GDK titles activated through their packages; the image paths, the chains, the tokens, the mitigations, and what a start by path really does (D77, D80) (beta.33 PR-1) The image path and the loader's main-module path are both the Content spelling on every process of every chain; no chain member the guard's rights cannot open; no fuzzy-fragment module; full trust, not an AppContainer, medium integrity; none of the four mitigations. And CreateProcess by path is not error 5, as assumed: the package's launch executable is replaced by an unpackaged gamelaunchhelper.exe that activates the package (the game is never the caller's process nor its descendant), and an Unreal shipping executable runs outside its package. D80 stands on those two measured grounds; the read-only claim is struck and dated in place. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat: games from the Xbox app and the Microsoft Store - the GDK library, a package root as an install-root boundary for the guard and detection, the xbox platform rule (root_file, rules 2026.11.1), the game's own art; Privacy 2.13 (D77-D81) (beta.33 PR-1) The import gains a fifth store, `xbox`: each ready drive's .GamingRoot names the games folders, each <Game>\Content\ holding MicrosoftGame.config beside appxmanifest.xml is a GDK package (read with DTDs prohibited), and Windows' appmodel calls (PackageFamilyNameFromId, GetPackagesByPackageFamily) say whether it is installed for this user. The record: the family name as the store id, Content as the install folder (the spelling the game's own process reports, spike-notes section 25), the AUMID as the launch key; ExecutableLocator picks the process that draws, never gamelaunchhelper.exe. Safety: no install-root boundary matched the Xbox layout, so check 4 walked only an Unreal title's Binaries\WinGDK. A GDK package root is now a boundary for InstallRoot and the native ResolveInstallRoot alike, asked only where no store boundary matched (it can only widen the walk); GamesInstalled joins the native list; one case list, tests/fixtures/install-roots/cases.txt, is read by Catch2 and xUnit both. Detection: an `xbox` platform first in the array (a GDK FINAL FANTASY ships steam_api64.dll), decided by a new root_file signal from the install root's own listing, so a deep walk that ran short cannot make it Unknown. Art: the square logo and the splash image the package names, from inside the package root only. games.platform's vocabulary gains xbox; the importer's fake repository now validates as the real one does. Privacy Policy 2.13 with the wording approved with the plan; TRADEMARKS, 02_SPEC, 15_ROADMAP, 05/06/08/19/20, README, LIMITATIONS and the guide follow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
216 lines
12 KiB
C#
216 lines
12 KiB
C#
// SPDX-License-Identifier: GPL-3.0-only
|
|
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
|
|
|
using FluentAssertions;
|
|
using FrameLedger.Infrastructure.Import;
|
|
|
|
namespace FrameLedger.Infrastructure.Tests.Import;
|
|
|
|
/// <summary>
|
|
/// The install trees the locator was measured wrong on (2026-09-21), rebuilt with the real file names and the real
|
|
/// sizes: what mattered on GIRLS' FRONTLINE 2 was that a plugin-folder helper out-weighed a Unity player stub.
|
|
/// </summary>
|
|
public sealed class ExecutableLocatorTests : IDisposable
|
|
{
|
|
private readonly string _dir = Path.Combine(Path.GetTempPath(), "fl-locator-" + Guid.NewGuid().ToString("N"));
|
|
|
|
public ExecutableLocatorTests() => Directory.CreateDirectory(_dir);
|
|
|
|
public void Dispose() => Directory.Delete(_dir, recursive: true);
|
|
|
|
private static CancellationToken Ct => TestContext.Current.CancellationToken;
|
|
|
|
private string Sub(params string[] parts)
|
|
{
|
|
string p = Path.Combine([_dir, .. parts]);
|
|
Directory.CreateDirectory(p);
|
|
return p;
|
|
}
|
|
|
|
[Fact]
|
|
public async Task AUnityPlayerBeatsTheLargerBrowserHelperInItsPluginFolder()
|
|
{
|
|
// An apostrophe in the directory name, as on disk: the path is data everywhere it travels.
|
|
string game = Sub("GIRLS' FRONTLINE 2 EXILIUM");
|
|
string plugins = Sub("GIRLS' FRONTLINE 2 EXILIUM", "GF2_Exilium_Data", "Plugins");
|
|
await File.WriteAllBytesAsync(Path.Combine(game, "GF2_Exilium.exe"), new byte[675_392], Ct);
|
|
await File.WriteAllBytesAsync(Path.Combine(game, "UnityCrashHandler64.exe"), new byte[1_077_896], Ct);
|
|
await File.WriteAllBytesAsync(Path.Combine(game, "crashpad_handler.exe"), new byte[917_056], Ct);
|
|
await File.WriteAllBytesAsync(Path.Combine(game, "KernelDumpAnalyzer.exe"), new byte[36_928], Ct);
|
|
await File.WriteAllBytesAsync(Path.Combine(plugins, "ZFGameBrowser.exe"), new byte[1_082_944], Ct);
|
|
|
|
new ExecutableLocator().PickPrimary(game).Should().Be(Path.Combine(game, "GF2_Exilium.exe"),
|
|
"X.exe beside X_Data is the Unity player; the browser helper is larger, is under X_Data\\Plugins, and is not the game");
|
|
}
|
|
|
|
[Fact]
|
|
public async Task ThePluginFolderIsExcludedEvenWhenNothingElseMarksTheHelper()
|
|
{
|
|
string game = Sub("Title");
|
|
string plugins = Sub("Title", "Title_Data", "Plugins", "x86_64");
|
|
await File.WriteAllBytesAsync(Path.Combine(game, "Title.exe"), new byte[100], Ct);
|
|
await File.WriteAllBytesAsync(Path.Combine(plugins, "Overlay.exe"), new byte[900_000], Ct);
|
|
|
|
ExecutableLocator.IsUnderPluginFolder(game, Path.Combine(plugins, "Overlay.exe")).Should().BeTrue();
|
|
ExecutableLocator.IsUnderPluginFolder(game, Path.Combine(game, "Title.exe")).Should().BeFalse();
|
|
new ExecutableLocator().PickPrimary(game).Should().Be(Path.Combine(game, "Title.exe"));
|
|
}
|
|
|
|
[Fact]
|
|
public async Task AnUnrealShippingBinaryBeatsALargerRootBootstrapper()
|
|
{
|
|
string game = Sub("Rune Factory Guardians of Azuma");
|
|
string bin = Sub("Rune Factory Guardians of Azuma", "Game", "Binaries", "Win64");
|
|
await File.WriteAllBytesAsync(Path.Combine(game, "Game.exe"), new byte[500_000], Ct);
|
|
await File.WriteAllBytesAsync(Path.Combine(bin, "Game-Win64-Shipping.exe"), new byte[400_000], Ct);
|
|
|
|
new ExecutableLocator().PickPrimary(game).Should().Be(Path.Combine(bin, "Game-Win64-Shipping.exe"),
|
|
"the root executable of an Unreal package starts the shipping binary and exits; the shipping binary is the process that presents");
|
|
}
|
|
|
|
[Fact]
|
|
public async Task AGdkUnrealPackagePicksTheWinGdkShippingBinaryOverTheStubAndTheLaunchHelper()
|
|
{
|
|
// A Game About Digging A Hole from the Xbox app (spike-notes §25), its real sizes: the package launches the 233,984-byte
|
|
// stub, the stub starts the shipping binary, and gamelaunchhelper.exe is the GDK's own launcher.
|
|
string content = Sub("A Game About Digging A Hole", "Content");
|
|
string bin = Sub("A Game About Digging A Hole", "Content", "DiggingGame", "Binaries", "WinGDK");
|
|
await File.WriteAllBytesAsync(Path.Combine(content, "MicrosoftGame.config"), [], Ct);
|
|
await File.WriteAllBytesAsync(Path.Combine(content, "appxmanifest.xml"), [], Ct);
|
|
await File.WriteAllBytesAsync(Path.Combine(content, "DiggingGame.exe"), new byte[233_984], Ct);
|
|
await File.WriteAllBytesAsync(Path.Combine(content, "gamelaunchhelper.exe"), new byte[113_096], Ct);
|
|
await File.WriteAllBytesAsync(Path.Combine(bin, "DiggingGame-WinGDK-Shipping.exe"), new byte[2_000], Ct);
|
|
|
|
new ExecutableLocator().PickPrimary(content).Should().Be(Path.Combine(bin, "DiggingGame-WinGDK-Shipping.exe"),
|
|
"the WinGDK shipping binary is the process that presents; the stub and the GDK's launcher are not the game");
|
|
}
|
|
|
|
[Fact]
|
|
public async Task TheGdkLaunchHelperIsNeverTheGameEvenWhenItIsTheLargest()
|
|
{
|
|
// A GDK title of no engine the locator knows: only the name of the package's parent folder and the sizes say anything.
|
|
string content = Sub("Microsoft Jewel", "Content");
|
|
await File.WriteAllBytesAsync(Path.Combine(content, "MicrosoftGame.config"), [], Ct);
|
|
await File.WriteAllBytesAsync(Path.Combine(content, "appxmanifest.xml"), [], Ct);
|
|
await File.WriteAllBytesAsync(Path.Combine(content, "gamelaunchhelper.exe"), new byte[900_000], Ct);
|
|
await File.WriteAllBytesAsync(Path.Combine(content, "ToolKit.exe"), new byte[800_000], Ct);
|
|
await File.WriteAllBytesAsync(Path.Combine(content, "MicrosoftJewel.exe"), new byte[239_936], Ct);
|
|
|
|
new ExecutableLocator().PickPrimary(content).Should().Be(Path.Combine(content, "MicrosoftJewel.exe"),
|
|
"a package root's name is the folder above Content, so the executable named after the game outranks a larger stranger; " +
|
|
"the launcher is never the game");
|
|
}
|
|
|
|
[Fact]
|
|
public async Task AnExecutableNamedAfterTheInstallBeatsALargerStranger()
|
|
{
|
|
string game = Sub("Cyberpunk 2077");
|
|
string bin = Sub("Cyberpunk 2077", "bin", "x64");
|
|
await File.WriteAllBytesAsync(Path.Combine(bin, "Cyberpunk2077.exe"), new byte[1000], Ct);
|
|
await File.WriteAllBytesAsync(Path.Combine(bin, "REDprelauncher.exe"), new byte[5000], Ct);
|
|
|
|
new ExecutableLocator().PickPrimary(game).Should().Be(Path.Combine(bin, "Cyberpunk2077.exe"));
|
|
}
|
|
|
|
[Fact]
|
|
public async Task ARedistributablesFolderIsNotWalkedAndTheFourthLevelIs()
|
|
{
|
|
string rdr = Sub("Red Dead Redemption 2");
|
|
string redist = Sub("Red Dead Redemption 2", "Redistributables");
|
|
await File.WriteAllBytesAsync(Path.Combine(rdr, "RDR2.exe"), new byte[90_000], Ct);
|
|
await File.WriteAllBytesAsync(Path.Combine(rdr, "PlayRDR2.exe"), new byte[500], Ct);
|
|
await File.WriteAllBytesAsync(Path.Combine(redist, "Rockstar-Games-Launcher.exe"), new byte[140_000], Ct);
|
|
new ExecutableLocator().PickPrimary(rdr).Should().Be(Path.Combine(rdr, "RDR2.exe"));
|
|
|
|
string beast = Sub("Dying Light The Beast");
|
|
string bin = Sub("Dying Light The Beast", "ph_ft", "work", "bin", "x64");
|
|
await File.WriteAllBytesAsync(Path.Combine(bin, "DyingLightGame_TheBeast_x64_rwdi.exe"), new byte[1000], Ct);
|
|
await File.WriteAllBytesAsync(Path.Combine(bin, "crashpad_handler.exe"), new byte[5000], Ct);
|
|
new ExecutableLocator().PickPrimary(beast).Should().Be(Path.Combine(bin, "DyingLightGame_TheBeast_x64_rwdi.exe"), "the title keeps its game four levels down");
|
|
}
|
|
|
|
[Fact]
|
|
public async Task SizeStillDecidesBetweenEquals()
|
|
{
|
|
string game = Sub("Some Title");
|
|
await File.WriteAllBytesAsync(Path.Combine(game, "a.exe"), new byte[10], Ct);
|
|
await File.WriteAllBytesAsync(Path.Combine(game, "b.exe"), new byte[2000], Ct);
|
|
|
|
new ExecutableLocator().PickPrimary(game).Should().Be(Path.Combine(game, "b.exe"));
|
|
}
|
|
|
|
/// <summary>
|
|
/// A Doll's Locket - Remake (itch, 2026-10-12), with its real names: a .NET launcher named after the install at the top
|
|
/// (213,745,664 bytes on disk — scaled down here, it only has to be the largest), NW.js's toast helper beside it, and the
|
|
/// RPG Maker MZ runtime one folder down beside its <c>nw.dll</c> and <c>package.json</c>. The runtime is the process
|
|
/// that draws (D56); the launcher only starts it.
|
|
/// </summary>
|
|
[Fact]
|
|
public async Task AnNwjsRuntimeBeatsTheLauncherNamedAfterTheInstallAndItsHelpersAreDropped()
|
|
{
|
|
string cave = Sub("a-dolls-locket-remake");
|
|
string game = Sub("a-dolls-locket-remake", "Dolls Locket");
|
|
string css = Sub("a-dolls-locket-remake", "Dolls Locket", "css");
|
|
await File.WriteAllBytesAsync(Path.Combine(game, "DollsLocket.exe"), new byte[3_000_000], Ct);
|
|
await File.WriteAllBytesAsync(Path.Combine(game, "notification_helper.exe"), new byte[919_552], Ct);
|
|
await File.WriteAllBytesAsync(Path.Combine(css, "Game.exe"), new byte[2_139_648], Ct);
|
|
await File.WriteAllBytesAsync(Path.Combine(css, "notification_helper.exe"), new byte[919_552], Ct);
|
|
await File.WriteAllBytesAsync(Path.Combine(css, "nw.dll"), new byte[10], Ct);
|
|
await File.WriteAllTextAsync(Path.Combine(css, "package.json"), "{\"name\":\"rmmz-game\",\"main\":\"index.html\"}", Ct);
|
|
|
|
new ExecutableLocator().PickPrimary(cave).Should().Be(Path.Combine(css, "Game.exe"),
|
|
"an executable beside nw.dll and package.json is the NW.js runtime; the larger launcher named after the install only starts it");
|
|
}
|
|
|
|
[Fact]
|
|
public async Task AnNwjsRuntimeAtTheRootIsTheGameAndAUnityPlayerOutranksAnNwjsToolBesideIt()
|
|
{
|
|
// Flower in Us (Steam): the runtime at the root, NW.js 0.82.0's helper beside it.
|
|
string flower = Sub("Flower in Us");
|
|
await File.WriteAllBytesAsync(Path.Combine(flower, "Game.exe"), new byte[2_191_360], Ct);
|
|
await File.WriteAllBytesAsync(Path.Combine(flower, "notification_helper.exe"), new byte[1_157_632], Ct);
|
|
await File.WriteAllBytesAsync(Path.Combine(flower, "nw.dll"), new byte[10], Ct);
|
|
await File.WriteAllTextAsync(Path.Combine(flower, "package.json"), "{}", Ct);
|
|
new ExecutableLocator().PickPrimary(flower).Should().Be(Path.Combine(flower, "Game.exe"));
|
|
|
|
// A Unity game shipping an NW.js tool: the NW.js rank sits below the engines' own layouts.
|
|
string unity = Sub("Some Unity Title");
|
|
string tool = Sub("Some Unity Title", "tools", "config");
|
|
Sub("Some Unity Title", "Title_Data");
|
|
await File.WriteAllBytesAsync(Path.Combine(unity, "Title.exe"), new byte[650_000], Ct);
|
|
await File.WriteAllBytesAsync(Path.Combine(tool, "Config.exe"), new byte[2_000_000], Ct);
|
|
await File.WriteAllBytesAsync(Path.Combine(tool, "nw.dll"), new byte[10], Ct);
|
|
await File.WriteAllTextAsync(Path.Combine(tool, "package.json"), "{}", Ct);
|
|
new ExecutableLocator().PickPrimary(unity).Should().Be(Path.Combine(unity, "Title.exe"), "X.exe beside X_Data outranks an NW.js folder");
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData("ZFGameBrowser")]
|
|
[InlineData("KernelDumpAnalyzer")]
|
|
[InlineData("msedgewebview2")]
|
|
[InlineData("QtWebEngineSubprocess")]
|
|
[InlineData("vconsole2")]
|
|
[InlineData("BsSndRpt64")]
|
|
[InlineData("CrashReportClient")]
|
|
[InlineData("UnityCrashHandler64")]
|
|
[InlineData("crashpad_handler")]
|
|
[InlineData("notification_helper")]
|
|
public void TheHelpersThisWasMeasuredOnAreHelpers(string name) =>
|
|
ExecutableLocator.IsHelper(name).Should().BeTrue();
|
|
|
|
/// <summary>
|
|
/// What may overrule a store's own pick is a whole name, never a fragment: <c>node</c> is a helper fragment and inside
|
|
/// a real game's name.
|
|
/// </summary>
|
|
[Theory]
|
|
[InlineData("notification_helper", true)]
|
|
[InlineData("NOTIFICATION_HELPER", true)]
|
|
[InlineData("crashpad_handler", true)]
|
|
[InlineData("UnityCrashHandler64", true)]
|
|
[InlineData("Nodebuster", false)]
|
|
[InlineData("Game", false)]
|
|
[InlineData("DollsLocket", false)]
|
|
public void OnlyWholeRuntimeHelperNamesOverruleAStore(string name, bool helper) =>
|
|
ExecutableLocator.IsRuntimeHelper(name).Should().Be(helper);
|
|
}
|