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>
124 lines
8.9 KiB
C#
124 lines
8.9 KiB
C#
using System;
|
|
using System.Runtime.CompilerServices;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace Interop.Lmx;
|
|
|
|
[ComImport]
|
|
[ComConversionLoss]
|
|
[Guid("D55C14E8-FB22-48F8-A092-EF9BC452A083")]
|
|
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
|
public interface IDataClient
|
|
{
|
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
|
void Initialize([In][MarshalAs(UnmanagedType.BStr)] string bstrNamespace);
|
|
|
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
|
[return: MarshalAs(UnmanagedType.BStr)]
|
|
string GetLastError();
|
|
|
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
|
void ResetHeap();
|
|
|
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
|
IntPtr Connect([In][MarshalAs(UnmanagedType.BStr)] string endPointUri, [In] ulong timeout, [In] ref _IUserToken userToken, out uint clientId);
|
|
|
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
|
[return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_RECORD)]
|
|
IArchestrAResult[] Connect2([In][MarshalAs(UnmanagedType.BStr)] string endPointUri, [In] ulong timeout, [In] ref _IUserToken userToken, out uint clientId);
|
|
|
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
|
IntPtr DisConnect();
|
|
|
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
|
[return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_RECORD)]
|
|
IArchestrAResult[] Disconnect2();
|
|
|
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
|
int IsIDataClientConnected();
|
|
|
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
|
IntPtr CreateSubscription([In] long MaxQueueSize, [In] ulong SampleInterval, [In] int ActiveState, out long SubscriptionId);
|
|
|
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
|
[return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_RECORD)]
|
|
IArchestrAResult[] CreateSubscription2([In] long MaxQueueSize, [In] ulong SampleInterval, [In] int ActiveState, out long SubscriptionId);
|
|
|
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
|
IntPtr ChangeSubscription([In] long SubscriptionId, [In] int ActiveState);
|
|
|
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
|
[return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_RECORD)]
|
|
IArchestrAResult[] ChangeSubscription2([In] long SubscriptionId, [In] int ActiveState);
|
|
|
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
|
IntPtr DeleteSubscription([In] long SubscriptionId);
|
|
|
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
|
[return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_RECORD)]
|
|
IArchestrAResult[] DeleteSubscription2([In] long SubscriptionId);
|
|
|
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
|
IntPtr AddMonitoredItems([In] long SubscriptionId, [In] ref _IMonitoredItem MonItems, [In] uint ItemsCount, [Out] IntPtr pResultCode, out uint ResultCount);
|
|
|
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
|
[return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_RECORD)]
|
|
IArchestrAResult[] AddMonitoredItems2([In] long SubscriptionId, [In][MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_RECORD)] IMonitoredItem2[] MonItems, [In] uint ItemsCount, [MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_RECORD)] out ASBResultCode[] pResultCode, out uint ResultCount);
|
|
|
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
|
IntPtr ChangeMonitoredItems([In] long SubscriptionId, [In] ref _IMonitoredItem MonItems, [In] uint ItemsCount, [Out] IntPtr pResultCode, out uint ResultCount);
|
|
|
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
|
[return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_RECORD)]
|
|
IArchestrAResult[] ChangeMonitoredItems2([In] long SubscriptionId, [In][MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_RECORD)] IMonitoredItem2[] MonItems, [In] uint ItemsCount, [MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_RECORD)] out ASBResultCode[] pResultCode, out uint ResultCount);
|
|
|
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
|
IntPtr DeleteMonitoredItems([In] long SubscriptionId, [In] ref ulong ItemIds, [In] uint ItemsCount, [Out] IntPtr pResultCode, out uint ResultCount);
|
|
|
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
|
[return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_RECORD)]
|
|
IArchestrAResult[] DeleteMonitoredItems2([In] long SubscriptionId, [In][MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UI8)] ulong[] ItemIds, [In] uint ItemsCount, [MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_RECORD)] out ASBResultCode[] pResultCode, out uint ResultCount);
|
|
|
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
|
IntPtr RegisterItems([In] ref _IItemIdentity IdItems, [In] uint ItemsCount, [Out] IntPtr pResultCode, out uint ResultCount);
|
|
|
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
|
[return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_RECORD)]
|
|
IArchestrAResult[] RegisterItems2([In][MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_RECORD)] IItemIdentity2[] IdItems, [In] uint ItemsCount, [MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_RECORD)] out ASBResultCode[] pResultCode, out uint ResultCount);
|
|
|
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
|
IntPtr UnregisterItems([In] ref ulong varItems, [In] uint ItemsCount, [Out] IntPtr pResultCode, out uint ResultCount);
|
|
|
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
|
[return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_RECORD)]
|
|
IArchestrAResult[] UnregisterItems2([In][MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UI8)] ulong[] varItems, [In] uint ItemsCount, [MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_RECORD)] out ASBResultCode[] pResultCode, out uint ResultCount);
|
|
|
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
|
IntPtr Write([In] ref _WriteRequest pWriteRequests, [In] uint RequestsCount, [In] uint WriteHandle, [In] ref _IUserToken User, [In] ref _IUserToken userToken, [Out] IntPtr pResultCode, out uint ResultCount);
|
|
|
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
|
[return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_RECORD)]
|
|
IArchestrAResult[] Write2([In][MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_RECORD)] WriteRequest2[] pWriteRequests, [In] uint RequestsCount, [In] uint WriteHandle, [In] ref _IUserToken User, [In] ref _IUserToken userToken, [MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_RECORD)] out ASBResultCode[] pResultCode, out uint ResultCount);
|
|
|
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
|
IntPtr Publish([In] long SubscriptionId, [Out] IntPtr pDataUpdates, out uint UpdatesCount);
|
|
|
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
|
[return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_RECORD)]
|
|
IArchestrAResult[] Publish2([In] long SubscriptionId, [MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_RECORD)] out DataChangeUpdate[] pDataUpdates, out uint ResultCount);
|
|
|
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
|
IntPtr PublishWriteComplete([Out] IntPtr pResultCode, out uint ResultCount);
|
|
|
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
|
[return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_RECORD)]
|
|
IArchestrAResult[] PublishWriteComplete2([MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_RECORD)] out ASBResultCode[] pResultCode, out uint ResultCount);
|
|
|
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
|
IntPtr Read([In] ref _IItemIdentity IdItems, [In] uint ItemsCount, [Out] IntPtr pDataUpdates, out uint UpdatesCount);
|
|
|
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
|
[return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_RECORD)]
|
|
IArchestrAResult[] Read2([In][MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_RECORD)] IItemIdentity2[] IdItems, [In] uint ItemsCount, [MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_RECORD)] out DataChangeUpdate[] pDataUpdates, out uint UpdatesCount);
|
|
}
|