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>
69 lines
2.0 KiB
C#
69 lines
2.0 KiB
C#
using System;
|
|
using System.Net.Sockets;
|
|
using System.Runtime.InteropServices;
|
|
using System.Security;
|
|
|
|
namespace ArchestrAServices.Common.Resolution;
|
|
|
|
[SuppressUnmanagedCodeSecurity]
|
|
internal class WinSock
|
|
{
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
|
public struct WSAData
|
|
{
|
|
[MarshalAs(UnmanagedType.U2)]
|
|
public ushort wVersion;
|
|
|
|
[MarshalAs(UnmanagedType.U2)]
|
|
public ushort wHighVersion;
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 257)]
|
|
private byte[] szDescription;
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 129)]
|
|
private byte[] szSystemStatus;
|
|
|
|
[MarshalAs(UnmanagedType.U2)]
|
|
public ushort iMaxSockets;
|
|
|
|
[MarshalAs(UnmanagedType.U2)]
|
|
public ushort iMaxUdpDg;
|
|
|
|
[MarshalAs(UnmanagedType.LPStr)]
|
|
public string lpVendorInfo;
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
|
public struct hostent
|
|
{
|
|
public IntPtr h_name;
|
|
|
|
public IntPtr h_aliases;
|
|
|
|
[MarshalAs(UnmanagedType.I2)]
|
|
public short h_addrtype;
|
|
|
|
[MarshalAs(UnmanagedType.I2)]
|
|
public short h_length;
|
|
|
|
public unsafe byte** h_addr_list;
|
|
}
|
|
|
|
internal const uint INADDR_NONE = uint.MaxValue;
|
|
|
|
[DllImport("ws2_32", CharSet = CharSet.Ansi, SetLastError = true)]
|
|
internal static extern int WSAStartup([In][MarshalAs(UnmanagedType.U2)] ushort wVersionRequested, [MarshalAs(UnmanagedType.Struct)] out WSAData lpWSAData);
|
|
|
|
[DllImport("ws2_32", CharSet = CharSet.Ansi, SetLastError = true)]
|
|
internal static extern int WSACleanup();
|
|
|
|
[DllImport("ws2_32", CharSet = CharSet.Ansi, SetLastError = true)]
|
|
internal unsafe static extern hostent* gethostbyaddr([In][MarshalAs(UnmanagedType.I4)] ref int addr, [In][MarshalAs(UnmanagedType.I4)] int len, [In] ProtocolFamily type);
|
|
|
|
[DllImport("ws2_32", BestFitMapping = false, CharSet = CharSet.Ansi, SetLastError = true)]
|
|
internal unsafe static extern hostent* gethostbyname([In] string host);
|
|
|
|
[DllImport("ws2_32", BestFitMapping = false, CharSet = CharSet.Ansi, SetLastError = true)]
|
|
internal static extern int inet_addr([In] string cp);
|
|
}
|