fe2a6db786
rust / build / test / clippy / fmt (push) Has been cancelled
Layout:
- src/ .NET 10 x64 reference: MxNativeCodec, MxNativeClient,
MxAsbClient, probes, tests, harnesses. Executable spec.
- design/ Architectural plan for the Rust port (M0–M6), error
model, protocol invariants, risks (R1–R16), adversarial
review log (review.md).
- rust/ Rust workspace. M0 skeleton + M1 codec parity.
mxaccess-codec: 215 unit tests + 2 cross-implementation
parity tests (byte-identical against .NET reference).
Other crates are M0 stubs awaiting M2+.
- captures/ Frida + netsh + pcap evidence per CLAUDE.md
("captures are evidence, not throwaway logs").
- analysis/ Decompiled C# (frida/proxy/decompiled-*),
Ghidra exports for native DLLs (`exports/` only —
working state at `projects/` and AVEVA's input
binaries at `input/` are gitignored).
- docs/ Reverse-engineering reference docs.
- tools/ Setup-LiveProbeEnv.ps1 (Infisical credential fetcher),
Compute-Crc.ps1 (.NET parity helper).
- .github/workflows/ Rust CI: fmt + build + test + clippy on Windows.
- LICENSE MIT (Joseph Doherty, 2026).
Verified:
- cargo test --workspace → 217 passed (215 unit + 2 .NET parity), 0 failed
- cargo clippy --workspace -- -D warnings → clean
- cargo fmt --all -- --check → clean
- cargo publish --dry-run -p mxaccess-codec → packages cleanly
Excluded from history (see .gitignore):
- **/bin, **/obj, **/target — build artifacts
- analysis/ghidra/projects/ — Ghidra working state (regenerable)
- analysis/ghidra/input/ — AVEVA proprietary DLLs (vendor IP)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
158 lines
4.6 KiB
C#
158 lines
4.6 KiB
C#
#define TRACE
|
|
using System.ComponentModel;
|
|
using System.Diagnostics;
|
|
using System.Globalization;
|
|
using System.Reflection;
|
|
|
|
namespace ArchestrAServices.Common;
|
|
|
|
public static class ServiceTrace
|
|
{
|
|
public static TraceSource DiagData { get; private set; }
|
|
|
|
public static TraceSource DiagControl { get; private set; }
|
|
|
|
public static TraceSource DiagCommand { get; private set; }
|
|
|
|
public static TraceSource DiagException { get; private set; }
|
|
|
|
public static TraceSource SecurityEvent { get; private set; }
|
|
|
|
public static TraceSource DiagDiagnostics { get; private set; }
|
|
|
|
public static TraceSource DiagCsv { get; private set; }
|
|
|
|
static ServiceTrace()
|
|
{
|
|
DiagData = new TraceSource("DataFlowLogs");
|
|
DiagControl = new TraceSource("ControlFlowLogs");
|
|
DiagCommand = new TraceSource("CommandLogs");
|
|
DiagException = new TraceSource("ExceptionLogs");
|
|
SecurityEvent = new TraceSource("SecurityLogs");
|
|
DiagDiagnostics = new TraceSource("DiagnosticsLogs");
|
|
DiagCsv = new TraceSource("CSVDiagnostics");
|
|
}
|
|
|
|
public static void SetLogIdentityAll(string identity)
|
|
{
|
|
DiagData.SetLogIdentity(identity);
|
|
DiagControl.SetLogIdentity(identity);
|
|
DiagCommand.SetLogIdentity(identity);
|
|
DiagException.SetLogIdentity(identity);
|
|
SecurityEvent.SetLogIdentity(identity);
|
|
DiagDiagnostics.SetLogIdentity(identity);
|
|
DiagCsv.SetLogIdentity(identity);
|
|
}
|
|
|
|
public static void SetLogIdentity(this TraceSource traceSource, [Localizable(false)] string identity)
|
|
{
|
|
if (traceSource == null || string.IsNullOrEmpty(identity))
|
|
{
|
|
return;
|
|
}
|
|
foreach (TraceListener listener in traceSource.Listeners)
|
|
{
|
|
PropertyInfo property = listener.GetType().GetProperty("LoggingIdentity");
|
|
if (property != null && property.CanWrite && property.PropertyType == typeof(string))
|
|
{
|
|
property.SetValue(listener, identity, null);
|
|
}
|
|
}
|
|
}
|
|
|
|
public static void LogInfo([Localizable(false)] string message)
|
|
{
|
|
DiagDiagnostics.TraceEvent(TraceEventType.Information, 0, message);
|
|
}
|
|
|
|
public static void LogInfo([Localizable(false)] string format, params object[] args)
|
|
{
|
|
LogInfo(string.Format(CultureInfo.InvariantCulture, format, args));
|
|
}
|
|
|
|
public static void LogWarning([Localizable(false)] string message)
|
|
{
|
|
DiagException.TraceEvent(TraceEventType.Warning, 0, message);
|
|
}
|
|
|
|
public static void LogWarning([Localizable(false)] string format, params object[] args)
|
|
{
|
|
LogWarning(string.Format(CultureInfo.InvariantCulture, format, args));
|
|
}
|
|
|
|
public static void LogError([Localizable(false)] string message)
|
|
{
|
|
DiagException.TraceEvent(TraceEventType.Error, 0, message);
|
|
}
|
|
|
|
public static void LogError([Localizable(false)] string format, params object[] args)
|
|
{
|
|
LogError(string.Format(CultureInfo.InvariantCulture, format, args));
|
|
}
|
|
|
|
public static void LogCritical([Localizable(false)] string message)
|
|
{
|
|
DiagException.TraceEvent(TraceEventType.Critical, 0, message);
|
|
}
|
|
|
|
public static void LogCritical([Localizable(false)] string format, params object[] args)
|
|
{
|
|
LogCritical(string.Format(CultureInfo.InvariantCulture, format, args));
|
|
}
|
|
|
|
public static void LogVerbose([Localizable(false)] string message)
|
|
{
|
|
DiagDiagnostics.TraceEvent(TraceEventType.Verbose, 0, message);
|
|
}
|
|
|
|
public static void LogVerbose([Localizable(false)] string format, params object[] args)
|
|
{
|
|
LogVerbose(string.Format(CultureInfo.InvariantCulture, format, args));
|
|
}
|
|
|
|
public static void LogStart([Localizable(false)] string message)
|
|
{
|
|
SecurityEvent.TraceEvent(TraceEventType.Start, 0, message);
|
|
}
|
|
|
|
public static void LogStart([Localizable(false)] string format, params object[] args)
|
|
{
|
|
LogStart(string.Format(CultureInfo.InvariantCulture, format, args));
|
|
}
|
|
|
|
public static void LogStop([Localizable(false)] string message)
|
|
{
|
|
SecurityEvent.TraceEvent(TraceEventType.Stop, 0, message);
|
|
}
|
|
|
|
public static void LogStop([Localizable(false)] string format, params object[] args)
|
|
{
|
|
LogStop(string.Format(CultureInfo.InvariantCulture, format, args));
|
|
}
|
|
|
|
public static void LogSuspend([Localizable(false)] string message)
|
|
{
|
|
SecurityEvent.TraceEvent(TraceEventType.Suspend, 0, message);
|
|
}
|
|
|
|
public static void LogSuspend([Localizable(false)] string format, params object[] args)
|
|
{
|
|
LogSuspend(string.Format(CultureInfo.InvariantCulture, format, args));
|
|
}
|
|
|
|
public static void LogResume([Localizable(false)] string message)
|
|
{
|
|
SecurityEvent.TraceEvent(TraceEventType.Resume, 0, message);
|
|
}
|
|
|
|
public static void LogResume([Localizable(false)] string format, params object[] args)
|
|
{
|
|
LogResume(string.Format(CultureInfo.InvariantCulture, format, args));
|
|
}
|
|
|
|
public static void LogCsv(params object[] args)
|
|
{
|
|
DiagCsv.TraceEvent(TraceEventType.Information, 0, string.Empty, args);
|
|
}
|
|
}
|