Initial commit: managed .NET 10 AVEVA Historian SDK + reverse-engineering toolkit
Full read-only SDK (src/AVEVA.Historian.Client) implementing the CLAUDE.md required
surface against AVEVA Historian's binary WCF protocol — no native AVEVA runtime
dependency. All operations live-verified against a local Historian:
- ProbeAsync, ReadRawAsync, ReadAggregateAsync, ReadAtTimeAsync, ReadEventsAsync
- BrowseTagNamesAsync, GetTagMetadataAsync (17 native data-type codes mapped)
- GetConnectionStatusAsync, GetStoreForwardStatusAsync, GetSystemParameterAsync
- 108/108 unit + integration tests pass
Includes the reverse-engineering toolkit (tools/AVEVA.Historian.ReverseEngineering)
used to decode the protocol: WCF probes, IL inspection via dnlib, and IL-rewrite
instrumentation (instrument-wcf-{write,read}message etc.) plus the .NET Framework
trace harness (tools/AVEVA.Historian.NativeTraceHarness) for parity testing.
Sanitized handoff evidence under docs/reverse-engineering/. Native AVEVA binaries
(current/, aveva-install-x64/, aveva-install-x86/) are gitignored — fetch separately
from the AVEVA installer.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
param(
|
||||
[string]$TagName = "OtOpcUaParityTest_001.Counter",
|
||||
[int]$LookbackMinutes = 1440,
|
||||
[int]$MaxRows = 1,
|
||||
[int]$AttachDelaySeconds = 3,
|
||||
[string]$OutputPath = $null
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$repoRoot = Split-Path -Parent $PSScriptRoot
|
||||
$fridaScript = Join-Path $PSScriptRoot "frida\aahclientmanaged-open-query.js"
|
||||
$nativeReadScript = Join-Path $PSScriptRoot "Test-AahClientManagedReadIntegrated.ps1"
|
||||
|
||||
if ([string]::IsNullOrWhiteSpace($OutputPath)) {
|
||||
$stamp = Get-Date -Format "yyyyMMdd-HHmmss"
|
||||
$OutputPath = Join-Path $repoRoot "docs\reverse-engineering\frida-aahclientmanaged-attach-read-$stamp.ndjson"
|
||||
}
|
||||
|
||||
$outputDirectory = Split-Path -Parent $OutputPath
|
||||
New-Item -ItemType Directory -Force -Path $outputDirectory | Out-Null
|
||||
|
||||
$powershell = Join-Path $env:WINDIR "System32\WindowsPowerShell\v1.0\powershell.exe"
|
||||
$childOut = Join-Path $env:TEMP ("histsdk-native-read-{0}.out.log" -f ([Guid]::NewGuid().ToString("N")))
|
||||
$childErr = Join-Path $env:TEMP ("histsdk-native-read-{0}.err.log" -f ([Guid]::NewGuid().ToString("N")))
|
||||
|
||||
$childArgs = @(
|
||||
"-NoProfile",
|
||||
"-ExecutionPolicy", "Bypass",
|
||||
"-File", $nativeReadScript,
|
||||
"-TagName", $TagName,
|
||||
"-LookbackMinutes", $LookbackMinutes.ToString(),
|
||||
"-MaxRows", $MaxRows.ToString(),
|
||||
"-ConnectionWaitSeconds", "15",
|
||||
"-PreReadSleepSeconds", $AttachDelaySeconds.ToString(),
|
||||
"-DumpLoadedModules"
|
||||
)
|
||||
|
||||
Write-Host "Starting native read process and pausing $AttachDelaySeconds second(s) after aahClientManaged.dll load."
|
||||
$process = Start-Process -FilePath $powershell -ArgumentList $childArgs -WorkingDirectory $repoRoot -RedirectStandardOutput $childOut -RedirectStandardError $childErr -PassThru -WindowStyle Hidden
|
||||
|
||||
try {
|
||||
Start-Sleep -Seconds 1
|
||||
Write-Host "Attaching Frida to PID $($process.Id). Capture: $OutputPath"
|
||||
& frida -q -p $process.Id -l $fridaScript 2>&1 | Tee-Object -FilePath $OutputPath
|
||||
|
||||
if (-not $process.HasExited) {
|
||||
$process.WaitForExit(30000) | Out-Null
|
||||
}
|
||||
}
|
||||
finally {
|
||||
if (-not $process.HasExited) {
|
||||
Stop-Process -Id $process.Id -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
"--- native stdout ---" | Tee-Object -FilePath $OutputPath -Append
|
||||
Get-Content -LiteralPath $childOut -ErrorAction SilentlyContinue | Tee-Object -FilePath $OutputPath -Append
|
||||
"--- native stderr ---" | Tee-Object -FilePath $OutputPath -Append
|
||||
Get-Content -LiteralPath $childErr -ErrorAction SilentlyContinue | Tee-Object -FilePath $OutputPath -Append
|
||||
Remove-Item -LiteralPath $childOut, $childErr -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
Write-Host "Capture complete: $OutputPath"
|
||||
Reference in New Issue
Block a user