- NOTICE: copyright, GPL-3.0-only, and three additional terms of the kinds section 7 permits - (b) preserve the notices and the attribution in the program's legal notices, (c) mark a modified version as different and do not call it "FrameLedger" alone, (e) no trademark rights in the name. Shipped as licenses\NOTICE.txt; release.yml refuses a published tree without it. - Section 7 wants additional terms named in the source files: every first-party .cs .cpp .h .inl .ps1 .xaml file (1,053; src/native/third_party excluded) opens with the SPDX line and a pointer to NOTICE. tools/notice-check.ps1 is the gate (six self-test cases, both directions; -Fix writes a missing header) and tools/resx-gen.ps1 generates the string accessors with the header. - The native VERSIONINFO LegalCopyright said GPL-3.0-or-later; it now names the real licence. - CONTRIBUTING.md, FORKING.md, CODE_OF_CONDUCT.md (Contributor Covenant 2.1 by reference), legal/TRADEMARKS.md. - 12_BUILD gate list, CLAUDE.md layout and conventions. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
58 lines
3.3 KiB
C#
58 lines
3.3 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.Domain.Detection;
|
|
|
|
namespace FrameLedger.Domain.Tests;
|
|
|
|
/// <summary>
|
|
/// What an executable runs as (beta.8, <c>games.exe_machine</c>): the COFF machine, and for .NET the CLR flags; and which
|
|
/// ids are known before a launch to be processes the x64 hook cannot enter — never an id this build could not establish.
|
|
/// </summary>
|
|
public sealed class ExecutableArchitectureTests
|
|
{
|
|
[Theory]
|
|
[InlineData(ExecutableArchitecture.MachineAmd64, null, ExecutableArchitecture.X64)]
|
|
[InlineData(ExecutableArchitecture.MachineI386, null, ExecutableArchitecture.X86)]
|
|
[InlineData(ExecutableArchitecture.MachineArm64, null, ExecutableArchitecture.Arm64)]
|
|
[InlineData(ExecutableArchitecture.MachineArmNt, null, ExecutableArchitecture.Arm)]
|
|
[InlineData((ushort)0x0200, null, ExecutableArchitecture.Other)]
|
|
[InlineData(ExecutableArchitecture.MachineI386, ExecutableArchitecture.ClrIlOnly, ExecutableArchitecture.AnyCpu)]
|
|
[InlineData(ExecutableArchitecture.MachineI386, ExecutableArchitecture.ClrIlOnly | ExecutableArchitecture.Clr32BitPreferred, ExecutableArchitecture.AnyCpu32)]
|
|
[InlineData(ExecutableArchitecture.MachineI386, ExecutableArchitecture.ClrIlOnly | ExecutableArchitecture.Clr32BitRequired, ExecutableArchitecture.X86)]
|
|
[InlineData(ExecutableArchitecture.MachineI386, 0u, ExecutableArchitecture.X86)]
|
|
[InlineData(ExecutableArchitecture.MachineAmd64, ExecutableArchitecture.ClrIlOnly, ExecutableArchitecture.X64)]
|
|
public void TheIdIsTheMachineAndForDotNetTheClrFlags(ushort machine, uint? clrFlags, string expected) =>
|
|
ExecutableArchitecture.Of(machine, clrFlags).Should().Be(expected);
|
|
|
|
[Theory]
|
|
[InlineData(ExecutableArchitecture.X86, true)]
|
|
[InlineData(ExecutableArchitecture.AnyCpu32, true)]
|
|
[InlineData(ExecutableArchitecture.Arm64, true)]
|
|
[InlineData(ExecutableArchitecture.Arm, true)]
|
|
[InlineData(ExecutableArchitecture.X64, false)]
|
|
[InlineData(ExecutableArchitecture.AnyCpu, false)]
|
|
[InlineData(ExecutableArchitecture.Other, false)]
|
|
[InlineData(ExecutableArchitecture.Unknown, false)]
|
|
[InlineData(null, false)]
|
|
public void OnlyAnEstablishedNonX64IdIsKnownNotHookable(string? id, bool expected) =>
|
|
ExecutableArchitecture.IsKnownNotHookable(id).Should().Be(expected, "an id this build could not establish is the guard's to decide at launch");
|
|
|
|
[Theory]
|
|
[InlineData("nvngx_dlss.dll", "nvngx_dlss.dll", true)]
|
|
[InlineData("nvngx_dlss.dll", "Engine/Plugins/DLSS/Binaries/nvngx_dlss.dll", true)]
|
|
[InlineData("ffx_fsr3*.dll", "bin/FFX_FSR3UPSCALER_X64.DLL", true)]
|
|
[InlineData("libxess.dll", "libxess_dx11.dll", false)]
|
|
[InlineData("ffx_fsr2_*.dll", "ffx_fsr3_x64.dll", false)]
|
|
public void AFileGlobNamesTheWholePathOrTheFileName(string pattern, string file, bool expected) =>
|
|
RuleEvaluator.NamesFile(pattern, file).Should().Be(expected);
|
|
|
|
[Fact]
|
|
public void ALibraryFilesNameIsItsLastSegment()
|
|
{
|
|
new LibraryFile("dlss", "Engine/Plugins/nvngx_dlss.dll", "3.7.10.0", null).FileName.Should().Be("nvngx_dlss.dll");
|
|
new LibraryFile("xess", "libxess.dll", null, null).FileName.Should().Be("libxess.dll");
|
|
}
|
|
}
|