Skip to content

Commit 1136d93

Browse files
committed
refactor: switch not-simulated flags to ulong and make models init-only
1 parent 519ecb4 commit 1136d93

2 files changed

Lines changed: 28 additions & 31 deletions

File tree

Consyzer/Core/Models/LibraryResolutionResult.cs

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ internal sealed class LibraryResolutionResult
1717
public required IReadOnlyList<string> HeuristicCandidates { get; init; }
1818

1919
/// <summary>
20-
/// Flags indicating which loader mechanisms are NOT simulated in current strict version.
20+
/// Flags indicating which loader mechanisms are NOT simulated.
2121
/// Used to justify Inconclusive.
2222
/// </summary>
2323
public required NotSimulatedMechanisms NotSimulated { get; init; }
@@ -35,7 +35,6 @@ internal sealed record ResolvedPresence(
3535
MechanismKind MechanismKind
3636
);
3737

38-
3938
/// <summary>
4039
/// Loader mechanism category for reporting only.
4140
/// </summary>
@@ -49,39 +48,37 @@ internal enum MechanismKind
4948
}
5049

5150
[Flags]
52-
internal enum NotSimulatedMechanisms
51+
internal enum NotSimulatedMechanisms : ulong
5352
{
5453
None = 0,
5554

5655
// Windows (bit range 0..9)
57-
WindowsSxS = 1 << 0,
58-
WindowsKnownDlls = 1 << 1,
59-
WindowsDllRedirection = 1 << 2,
60-
WindowsProcessDirectoryOverrides = 1 << 3,
61-
WindowsApiSetSchema = 1 << 4,
62-
WindowsPackageGraph = 1 << 5,
63-
WindowsLoadedModuleList = 1 << 6,
64-
WindowsSafeSearchModeAndFlags = 1 << 7,
65-
66-
WindowsAppPathsRegistry = 1 << 8,
67-
WindowsDotNetSearchPathOverrides = 1 << 9,
56+
WindowsSxS = 1UL << 0,
57+
WindowsKnownDlls = 1UL << 1,
58+
WindowsDllRedirection = 1UL << 2,
59+
WindowsProcessDirectoryOverrides = 1UL << 3,
60+
WindowsApiSetSchema = 1UL << 4,
61+
WindowsPackageGraph = 1UL << 5,
62+
WindowsLoadedModuleList = 1UL << 6,
63+
WindowsSafeSearchModeAndFlags = 1UL << 7,
64+
WindowsAppPathsRegistry = 1UL << 8,
65+
WindowsDotNetSearchPathOverrides = 1UL << 9,
6866

6967
// Linux (bit range 10..16)
70-
LinuxRPathRunPath = 1 << 10,
71-
LinuxLdSoCache = 1 << 11,
72-
LinuxLdSoConf = 1 << 12,
73-
LinuxSecureExecution = 1 << 13,
74-
LinuxTransitiveDependencies = 1 << 14,
75-
LinuxMultiarchDefaultPaths = 1 << 15,
76-
LinuxLdPreload = 1 << 16,
68+
LinuxRPathRunPath = 1UL << 10,
69+
LinuxLdSoCache = 1UL << 11,
70+
LinuxLdSoConf = 1UL << 12,
71+
LinuxSecureExecution = 1UL << 13,
72+
LinuxTransitiveDependencies = 1UL << 14,
73+
LinuxMultiarchDefaultPaths = 1UL << 15,
74+
LinuxLdPreload = 1UL << 16,
7775

7876
// macOS (bit range 17..23)
79-
MacOsAtRPathLoaderExecutablePath = 1 << 17,
80-
MacOsDyldFallbackLibraryPath = 1 << 18,
81-
MacOsProtectedProcessRestrictions = 1 << 19,
82-
MacOsDyldSharedCacheOrOverrides = 1 << 20,
83-
MacOsTransitiveDependencies = 1 << 21,
84-
85-
MacOsDyldFrameworkPathOrFrameworkSearch = 1 << 22,
86-
MacOsDyldInsertLibraries = 1 << 23
77+
MacOsAtRPathLoaderExecutablePath = 1UL << 17,
78+
MacOsDyldFallbackLibraryPath = 1UL << 18,
79+
MacOsProtectedProcessRestrictions = 1UL << 19,
80+
MacOsDyldSharedCacheOrOverrides = 1UL << 20,
81+
MacOsTransitiveDependencies = 1UL << 21,
82+
MacOsDyldFrameworkPathOrFrameworkSearch = 1UL << 22,
83+
MacOsDyldInsertLibraries = 1UL << 23
8784
}

Consyzer/Core/Models/PInvokeMethod.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ namespace Consyzer.Core.Models;
44

55
internal sealed class PInvokeMethodGroup
66
{
7-
public required FileInfo File { get; set; }
8-
public required IReadOnlyList<PInvokeMethod> Methods { get; set; }
7+
public required FileInfo File { get; init; }
8+
public required IReadOnlyList<PInvokeMethod> Methods { get; init; }
99
}
1010

1111
internal sealed class PInvokeMethod

0 commit comments

Comments
 (0)