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>
261 lines
6.5 KiB
C#
261 lines
6.5 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Runtime.InteropServices;
|
|
using System.Runtime.InteropServices.ComTypes;
|
|
using System.Threading;
|
|
|
|
namespace ArchestrA.MxAccess;
|
|
|
|
internal sealed class _ILMXProxyServerEvents_EventProvider : _ILMXProxyServerEvents_Event, IDisposable
|
|
{
|
|
private IConnectionPointContainer m_ConnectionPointContainer;
|
|
|
|
private ArrayList m_aEventSinkHelpers;
|
|
|
|
private IConnectionPoint m_ConnectionPoint;
|
|
|
|
private void Init()
|
|
{
|
|
IConnectionPoint ppCP = null;
|
|
Guid riid = new Guid(new byte[16]
|
|
{
|
|
182, 153, 130, 132, 97, 221, 13, 74, 163, 4,
|
|
57, 71, 165, 100, 184, 156
|
|
});
|
|
m_ConnectionPointContainer.FindConnectionPoint(ref riid, out ppCP);
|
|
m_ConnectionPoint = ppCP;
|
|
m_aEventSinkHelpers = new ArrayList();
|
|
}
|
|
|
|
public void add_OnDataChange(_ILMXProxyServerEvents_OnDataChangeEventHandler P_0)
|
|
{
|
|
Monitor.Enter(this);
|
|
try
|
|
{
|
|
if (m_ConnectionPoint == null)
|
|
{
|
|
Init();
|
|
}
|
|
_ILMXProxyServerEvents_SinkHelper iLMXProxyServerEvents_SinkHelper = new _ILMXProxyServerEvents_SinkHelper();
|
|
int pdwCookie = 0;
|
|
m_ConnectionPoint.Advise(iLMXProxyServerEvents_SinkHelper, out pdwCookie);
|
|
iLMXProxyServerEvents_SinkHelper.m_dwCookie = pdwCookie;
|
|
iLMXProxyServerEvents_SinkHelper.m_OnDataChangeDelegate = P_0;
|
|
m_aEventSinkHelpers.Add(iLMXProxyServerEvents_SinkHelper);
|
|
}
|
|
finally
|
|
{
|
|
Monitor.Exit(this);
|
|
}
|
|
}
|
|
|
|
public void remove_OnDataChange(_ILMXProxyServerEvents_OnDataChangeEventHandler P_0)
|
|
{
|
|
Monitor.Enter(this);
|
|
try
|
|
{
|
|
if (m_aEventSinkHelpers == null)
|
|
{
|
|
return;
|
|
}
|
|
int count = m_aEventSinkHelpers.Count;
|
|
int num = 0;
|
|
if (0 >= count)
|
|
{
|
|
return;
|
|
}
|
|
do
|
|
{
|
|
_ILMXProxyServerEvents_SinkHelper iLMXProxyServerEvents_SinkHelper = (_ILMXProxyServerEvents_SinkHelper)m_aEventSinkHelpers[num];
|
|
if (iLMXProxyServerEvents_SinkHelper.m_OnDataChangeDelegate != null && ((iLMXProxyServerEvents_SinkHelper.m_OnDataChangeDelegate.Equals(P_0) ? 1u : 0u) & 0xFFu) != 0)
|
|
{
|
|
m_aEventSinkHelpers.RemoveAt(num);
|
|
m_ConnectionPoint.Unadvise(iLMXProxyServerEvents_SinkHelper.m_dwCookie);
|
|
if (count <= 1)
|
|
{
|
|
Marshal.ReleaseComObject(m_ConnectionPoint);
|
|
m_ConnectionPoint = null;
|
|
m_aEventSinkHelpers = null;
|
|
}
|
|
break;
|
|
}
|
|
num++;
|
|
}
|
|
while (num < count);
|
|
}
|
|
finally
|
|
{
|
|
Monitor.Exit(this);
|
|
}
|
|
}
|
|
|
|
public void add_OnWriteComplete(_ILMXProxyServerEvents_OnWriteCompleteEventHandler P_0)
|
|
{
|
|
Monitor.Enter(this);
|
|
try
|
|
{
|
|
if (m_ConnectionPoint == null)
|
|
{
|
|
Init();
|
|
}
|
|
_ILMXProxyServerEvents_SinkHelper iLMXProxyServerEvents_SinkHelper = new _ILMXProxyServerEvents_SinkHelper();
|
|
int pdwCookie = 0;
|
|
m_ConnectionPoint.Advise(iLMXProxyServerEvents_SinkHelper, out pdwCookie);
|
|
iLMXProxyServerEvents_SinkHelper.m_dwCookie = pdwCookie;
|
|
iLMXProxyServerEvents_SinkHelper.m_OnWriteCompleteDelegate = P_0;
|
|
m_aEventSinkHelpers.Add(iLMXProxyServerEvents_SinkHelper);
|
|
}
|
|
finally
|
|
{
|
|
Monitor.Exit(this);
|
|
}
|
|
}
|
|
|
|
public void remove_OnWriteComplete(_ILMXProxyServerEvents_OnWriteCompleteEventHandler P_0)
|
|
{
|
|
Monitor.Enter(this);
|
|
try
|
|
{
|
|
if (m_aEventSinkHelpers == null)
|
|
{
|
|
return;
|
|
}
|
|
int count = m_aEventSinkHelpers.Count;
|
|
int num = 0;
|
|
if (0 >= count)
|
|
{
|
|
return;
|
|
}
|
|
do
|
|
{
|
|
_ILMXProxyServerEvents_SinkHelper iLMXProxyServerEvents_SinkHelper = (_ILMXProxyServerEvents_SinkHelper)m_aEventSinkHelpers[num];
|
|
if (iLMXProxyServerEvents_SinkHelper.m_OnWriteCompleteDelegate != null && ((iLMXProxyServerEvents_SinkHelper.m_OnWriteCompleteDelegate.Equals(P_0) ? 1u : 0u) & 0xFFu) != 0)
|
|
{
|
|
m_aEventSinkHelpers.RemoveAt(num);
|
|
m_ConnectionPoint.Unadvise(iLMXProxyServerEvents_SinkHelper.m_dwCookie);
|
|
if (count <= 1)
|
|
{
|
|
Marshal.ReleaseComObject(m_ConnectionPoint);
|
|
m_ConnectionPoint = null;
|
|
m_aEventSinkHelpers = null;
|
|
}
|
|
break;
|
|
}
|
|
num++;
|
|
}
|
|
while (num < count);
|
|
}
|
|
finally
|
|
{
|
|
Monitor.Exit(this);
|
|
}
|
|
}
|
|
|
|
public void add_OperationComplete(_ILMXProxyServerEvents_OperationCompleteEventHandler P_0)
|
|
{
|
|
Monitor.Enter(this);
|
|
try
|
|
{
|
|
if (m_ConnectionPoint == null)
|
|
{
|
|
Init();
|
|
}
|
|
_ILMXProxyServerEvents_SinkHelper iLMXProxyServerEvents_SinkHelper = new _ILMXProxyServerEvents_SinkHelper();
|
|
int pdwCookie = 0;
|
|
m_ConnectionPoint.Advise(iLMXProxyServerEvents_SinkHelper, out pdwCookie);
|
|
iLMXProxyServerEvents_SinkHelper.m_dwCookie = pdwCookie;
|
|
iLMXProxyServerEvents_SinkHelper.m_OperationCompleteDelegate = P_0;
|
|
m_aEventSinkHelpers.Add(iLMXProxyServerEvents_SinkHelper);
|
|
}
|
|
finally
|
|
{
|
|
Monitor.Exit(this);
|
|
}
|
|
}
|
|
|
|
public void remove_OperationComplete(_ILMXProxyServerEvents_OperationCompleteEventHandler P_0)
|
|
{
|
|
Monitor.Enter(this);
|
|
try
|
|
{
|
|
if (m_aEventSinkHelpers == null)
|
|
{
|
|
return;
|
|
}
|
|
int count = m_aEventSinkHelpers.Count;
|
|
int num = 0;
|
|
if (0 >= count)
|
|
{
|
|
return;
|
|
}
|
|
do
|
|
{
|
|
_ILMXProxyServerEvents_SinkHelper iLMXProxyServerEvents_SinkHelper = (_ILMXProxyServerEvents_SinkHelper)m_aEventSinkHelpers[num];
|
|
if (iLMXProxyServerEvents_SinkHelper.m_OperationCompleteDelegate != null && ((iLMXProxyServerEvents_SinkHelper.m_OperationCompleteDelegate.Equals(P_0) ? 1u : 0u) & 0xFFu) != 0)
|
|
{
|
|
m_aEventSinkHelpers.RemoveAt(num);
|
|
m_ConnectionPoint.Unadvise(iLMXProxyServerEvents_SinkHelper.m_dwCookie);
|
|
if (count <= 1)
|
|
{
|
|
Marshal.ReleaseComObject(m_ConnectionPoint);
|
|
m_ConnectionPoint = null;
|
|
m_aEventSinkHelpers = null;
|
|
}
|
|
break;
|
|
}
|
|
num++;
|
|
}
|
|
while (num < count);
|
|
}
|
|
finally
|
|
{
|
|
Monitor.Exit(this);
|
|
}
|
|
}
|
|
|
|
public _ILMXProxyServerEvents_EventProvider(object P_0)
|
|
{
|
|
//Error decoding local variables: Signature type sequence must have at least one element.
|
|
m_ConnectionPointContainer = (IConnectionPointContainer)P_0;
|
|
}
|
|
|
|
public void Finalize()
|
|
{
|
|
Monitor.Enter(this);
|
|
try
|
|
{
|
|
if (m_ConnectionPoint == null)
|
|
{
|
|
return;
|
|
}
|
|
int count = m_aEventSinkHelpers.Count;
|
|
int num = 0;
|
|
if (0 < count)
|
|
{
|
|
do
|
|
{
|
|
_ILMXProxyServerEvents_SinkHelper iLMXProxyServerEvents_SinkHelper = (_ILMXProxyServerEvents_SinkHelper)m_aEventSinkHelpers[num];
|
|
m_ConnectionPoint.Unadvise(iLMXProxyServerEvents_SinkHelper.m_dwCookie);
|
|
num++;
|
|
}
|
|
while (num < count);
|
|
}
|
|
Marshal.ReleaseComObject(m_ConnectionPoint);
|
|
}
|
|
catch (Exception)
|
|
{
|
|
}
|
|
finally
|
|
{
|
|
Monitor.Exit(this);
|
|
}
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
//Error decoding local variables: Signature type sequence must have at least one element.
|
|
Finalize();
|
|
GC.SuppressFinalize(this);
|
|
}
|
|
}
|