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>
68 lines
5.2 KiB
C#
68 lines
5.2 KiB
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace ArchestrA.Diagnostics;
|
|
|
|
internal static class NativeMethods
|
|
{
|
|
[DllImport("kernel32")]
|
|
public static extern IntPtr LoadLibraryExW([MarshalAs(UnmanagedType.LPWStr)] string lpMdoule, IntPtr wParam, int flag);
|
|
|
|
[DllImport("kernel32")]
|
|
internal static extern IntPtr LoadLibraryW([MarshalAs(UnmanagedType.LPWStr)] string lpMdoule);
|
|
|
|
[DllImport("LoggerDLL.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode, EntryPoint = "REGISTERLOGGERCLIENT", ExactSpelling = true)]
|
|
internal static extern int RegisterLoggerClient(ref int hIdentity);
|
|
|
|
[DllImport("LoggerDLL.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode, EntryPoint = "UNREGISTERLOGGERCLIENT", ExactSpelling = true)]
|
|
internal static extern int UnregisterLoggerClient(int hIdentity);
|
|
|
|
[DllImport("LoggerDLL.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode, EntryPoint = "SETIDENTITYNAME", ExactSpelling = true)]
|
|
internal static extern int SetIdentityName(int hIdentity, string strIdentity);
|
|
|
|
[DllImport("LoggerDLL.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode, EntryPoint = "LOGERROR", ExactSpelling = true)]
|
|
internal static extern void InternalLogError(int hIdentity, [MarshalAs(UnmanagedType.LPWStr)] string errorMessage);
|
|
|
|
[DllImport("LoggerDLL.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode, EntryPoint = "LOGWARNING", ExactSpelling = true)]
|
|
internal static extern void InternalLogWarning(int hIdentity, [MarshalAs(UnmanagedType.LPWStr)] string errorMessage);
|
|
|
|
[DllImport("LoggerDLL.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode, EntryPoint = "LOGINFO", ExactSpelling = true)]
|
|
internal static extern void InternalLogInfo(int hIdentity, [MarshalAs(UnmanagedType.LPWStr)] string errorMessage);
|
|
|
|
[DllImport("LoggerDLL.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode, EntryPoint = "LOGTRACE", ExactSpelling = true)]
|
|
internal static extern void InternalLogTrace(int hIdentity, [MarshalAs(UnmanagedType.LPWStr)] string errorMessage);
|
|
|
|
[DllImport("LoggerDLL.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode, EntryPoint = "LOGSTARTSTOP", ExactSpelling = true)]
|
|
internal static extern void InternalLogStartStop(int hIdentity, [MarshalAs(UnmanagedType.LPWStr)] string errorMessage);
|
|
|
|
[DllImport("LoggerDLL.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode, EntryPoint = "LOGENTRYEXIT", ExactSpelling = true)]
|
|
internal static extern void InternalLogEntryExit(int hIdentity, [MarshalAs(UnmanagedType.LPWStr)] string errorMessage);
|
|
|
|
[DllImport("LoggerDLL.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode, EntryPoint = "LOGTHREADSTARTSTOP", ExactSpelling = true)]
|
|
internal static extern void InternalLogThreadStartStop(int hIdentity, [MarshalAs(UnmanagedType.LPWStr)] string errorMessage);
|
|
|
|
[DllImport("LoggerDLL.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode, EntryPoint = "LOGSQL", ExactSpelling = true)]
|
|
internal static extern void InternalLogSQL(int hIdentity, [MarshalAs(UnmanagedType.LPWStr)] string errorMessage);
|
|
|
|
[DllImport("LoggerDLL.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode, EntryPoint = "LOGCONNECTION", ExactSpelling = true)]
|
|
internal static extern void InternalLogConnection(int hIdentity, [MarshalAs(UnmanagedType.LPWStr)] string errorMessage);
|
|
|
|
[DllImport("LoggerDLL.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode, EntryPoint = "LOGCTORDTOR", ExactSpelling = true)]
|
|
internal static extern void InternalLogCtorDtor(int hIdentity, [MarshalAs(UnmanagedType.LPWStr)] string errorMessage);
|
|
|
|
[DllImport("LoggerDLL.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode, EntryPoint = "LOGREFCOUNT", ExactSpelling = true)]
|
|
internal static extern void InternalLogRefCount(int hIdentity, [MarshalAs(UnmanagedType.LPWStr)] string errorMessage);
|
|
|
|
[DllImport("LoggerDLL.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode, EntryPoint = "REGISTERLOGFLAG", ExactSpelling = true)]
|
|
internal static extern int RegisterLogFlag(int hIdentity, int nCustomFlag, [MarshalAs(UnmanagedType.LPWStr)] string strFlag);
|
|
|
|
[DllImport("LoggerDLL.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode, EntryPoint = "REGISTERLOGFLAGEX", ExactSpelling = true)]
|
|
internal static extern int RegisterLogFlagEx(int hIdentity, int nCustomFlag, [MarshalAs(UnmanagedType.LPWStr)] string strFlag, int nDefaultVal);
|
|
|
|
[DllImport("LoggerDLL.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode, EntryPoint = "LOGCUSTOM2", ExactSpelling = true)]
|
|
internal static extern void InternalLogCustom(int hIdentity, int nCustomFlag, [MarshalAs(UnmanagedType.LPWStr)] string errorMessage);
|
|
|
|
[DllImport("LoggerDLL.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode, EntryPoint = "GETLOGGERSTATS", ExactSpelling = true)]
|
|
internal static extern int GetLoggerStats([MarshalAs(UnmanagedType.LPWStr)] string hostName, ref int errorCount, ref long ftLastError, ref int warningCount, ref long ftLastWarning);
|
|
}
|