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>
107 lines
4.3 KiB
C#
107 lines
4.3 KiB
C#
using System.Runtime.CompilerServices;
|
|
using ArchestrAServices.ASBIDataV2Contract;
|
|
|
|
internal abstract class StatusUpdater
|
|
{
|
|
private ASBStatusElement[] m_statusElement;
|
|
|
|
public void SetStatus(ASBStatus Status)
|
|
{
|
|
m_statusElement = ASBSerializer.ASBStatusToArray(Status);
|
|
}
|
|
|
|
public abstract void SetStatusCategory(uint StatusCode);
|
|
|
|
public abstract void SetStatusDetail(uint StatusDetail);
|
|
|
|
public abstract void SetQuality(uint Quality);
|
|
|
|
public unsafe void FillInUpdate()
|
|
{
|
|
ASBStatusElement[] statusElement = m_statusElement;
|
|
if (statusElement != null)
|
|
{
|
|
int num = statusElement.Length;
|
|
if (num <= 0)
|
|
{
|
|
return;
|
|
}
|
|
uint statusCategory = 0u;
|
|
bool flag = false;
|
|
uint statusDetail = 1009u;
|
|
bool flag2 = false;
|
|
uint quality = 64u;
|
|
bool flag3 = false;
|
|
uint num2 = 0u;
|
|
bool flag4 = false;
|
|
uint num3 = 0u;
|
|
bool flag5 = false;
|
|
int num4 = 0;
|
|
int num5 = num;
|
|
if (0 < num5)
|
|
{
|
|
do
|
|
{
|
|
switch (statusElement[num4].statusType)
|
|
{
|
|
case ASBStatusType.MXStatusCategory:
|
|
flag = true;
|
|
statusCategory = statusElement[num4].statusValue;
|
|
break;
|
|
case ASBStatusType.MxStatusDetail:
|
|
flag2 = true;
|
|
statusDetail = statusElement[num4].statusValue;
|
|
break;
|
|
case ASBStatusType.OPCUAVendorStatus:
|
|
flag4 = true;
|
|
num2 = statusElement[num4].statusValue;
|
|
break;
|
|
case ASBStatusType.OPCUAStatus:
|
|
flag5 = true;
|
|
num3 = statusElement[num4].statusValue;
|
|
break;
|
|
case ASBStatusType.MxQuality:
|
|
flag3 = true;
|
|
quality = statusElement[num4].statusValue;
|
|
break;
|
|
}
|
|
num4++;
|
|
}
|
|
while (num4 < num5);
|
|
}
|
|
if ((flag5 ^ flag4) && global::_003CModule_003E.CWrapLogger_002ELogFlagLog(global::_003CModule_003E.CLoggerSelect_002E_GetFSLogger(), global::_003CModule_003E.CWrapLogger_002EGetLogFlag(global::_003CModule_003E.CLoggerSelect_002E_GetFSLogger(), 1), 0u))
|
|
{
|
|
global::_003CModule_003E.CWrapLogger_002ELogWarning(global::_003CModule_003E.CLoggerSelect_002E_GetFSLogger(), (char*)System.Runtime.CompilerServices.Unsafe.AsPointer(ref global::_003CModule_003E._003F_003F_C_0040_1JK_0040EOEIELEM_0040_003F_0024AAO_003F_0024AAn_003F_0024AAl_003F_0024AAy_003F_0024AA_003F5_003F_0024AAo_003F_0024AAn_003F_0024AAe_003F_0024AA_003F5_003F_0024AAp_003F_0024AAa_003F_0024AAr_003F_0024AAt_003F_0024AA_003F5_003F_0024AAo_003F_0024AAf_003F_0024AA_003F5_003F_0024AAt_003F_0024AAh_003F_0024AAe_003F_0024AA_003F5_003F_0024AAO_003F_0024AAP_003F_0024AAC_003F_0024AAU_003F_0024AAA_003F_0024AA_003F5_003F_0024AAe_003F_0024AAr_003F_0024AAr_003F_0024AAo_003F_0024AAr_0040), __arglist());
|
|
}
|
|
if (!flag && !flag2 && !flag3 && flag4 && flag5)
|
|
{
|
|
ushort num6 = 0;
|
|
ushort num7 = 0;
|
|
System.Runtime.CompilerServices.Unsafe.SkipInit(out ConsumerDataUtilities consumerDataUtilities);
|
|
quality = global::_003CModule_003E.ConsumerDataUtilities_002EGetOPCDAQualityCode(&consumerDataUtilities, (num3 << 16) | (num2 & 0xFFFF), &num6, &num7);
|
|
statusCategory = num6;
|
|
statusDetail = num7;
|
|
}
|
|
SetStatusCategory(statusCategory);
|
|
SetStatusDetail(statusDetail);
|
|
SetQuality(quality);
|
|
return;
|
|
}
|
|
CWrapLogger* ptr = global::_003CModule_003E.CLoggerSelect_002E_GetFSLogger();
|
|
uint* ptr2 = (uint*)((((int*)ptr)[43] != 0 || global::_003CModule_003E.CWrapLogger_002ELogStartEx(ptr) != 0) ? ((int)((uint*)ptr)[43]) : 0);
|
|
CWrapLogger* ptr3 = global::_003CModule_003E.CLoggerSelect_002E_GetFSLogger();
|
|
if (global::_003CModule_003E.CWrapLogger_002EInitialize(ptr3))
|
|
{
|
|
uint num8 = ((uint*)ptr3)[41];
|
|
if (num8 != 0 && ((delegate* unmanaged[Cdecl, Cdecl]<int, uint*, uint, byte>)(int)num8)(((int*)ptr3)[1], ptr2, 0u) != 0)
|
|
{
|
|
global::_003CModule_003E.CWrapLogger_002ELogWarning(global::_003CModule_003E.CLoggerSelect_002E_GetFSLogger(), (char*)System.Runtime.CompilerServices.Unsafe.AsPointer(ref global::_003CModule_003E._003F_003F_C_0040_1EK_0040KKDLLJGJ_0040_003F_0024AAS_003F_0024AAt_003F_0024AAa_003F_0024AAt_003F_0024AAu_003F_0024AAs_003F_0024AAU_003F_0024AAp_003F_0024AAd_003F_0024AAa_003F_0024AAt_003F_0024AAe_003F_0024AAr_003F_0024AA_003F5_003F_0024AAS_003F_0024AAt_003F_0024AAa_003F_0024AAt_003F_0024AAu_003F_0024AAs_003F_0024AA_003F5_003F_0024AAs_003F_0024AAe_003F_0024AAt_003F_0024AA_003F5_003F_0024AAt_003F_0024AAo_003F_0024AA_003F5_003F_0024AAn_003F_0024AAu_003F_0024AAl_003F_0024AAl_0040), __arglist());
|
|
}
|
|
}
|
|
}
|
|
|
|
public StatusUpdater()
|
|
{
|
|
}
|
|
}
|