187 lines
34 KiB
Markdown
187 lines
34 KiB
Markdown
|
|
# Live View and Recording Reimplementation Research
|
|||
|
|
|
|||
|
|
Date: 2026-10-16
|
|||
|
|
|
|||
|
|
## Goal
|
|||
|
|
|
|||
|
|
Assess a managed C# replacement for the minimum useful Surveillance Client workflows: persisted server credentials, one or more live camera views, and arbitrary recording-range downloads to MP4. Target .NET 10 and Avalonia for a possible Windows/macOS/Linux UI, and prefer FFmpeg for media decode, mux, and encode rather than the legacy playback DLL.
|
|||
|
|
|
|||
|
|
## Current Findings
|
|||
|
|
|
|||
|
|
### Native network API candidate
|
|||
|
|
|
|||
|
|
`RSNet.dll` is a native x86 PE library. REA's procedure-name search found an application-facing API surface that includes:
|
|||
|
|
|
|||
|
|
- Lifecycle and connection: `RSNetInit`, `RSNetRelease`, `RSNetConnectionStart`, `RSNetConnectionStartEx`, `RSNetConnectionStop`.
|
|||
|
|
- Discovery and device configuration: `RSNetSearchDev`, `RSNetSetDevInfo`, `RSNetSetNewDevInfo`, `RSNetGetDevInfo`, `RSNetGetDevInfoEx`, `RSNetSetIPAndPort`.
|
|||
|
|
- Live view: `RSNetStartPreview`, `RSNetStopPreview`, `RSNetGetPreviewBitRate`, `RSNetForceIFrame`.
|
|||
|
|
- Recording search and retrieval: `RSNetQueryRecord`, async/Ex variants, `RSNetStartDownloadRecord` and `RSNetStartDownloadRecordEx`, record-playback controls, and `RSNetConnectionStop`.
|
|||
|
|
- Additional functions include PTZ, audio talk, parameter queries, alarms, logs, upgrade, snapshot, and picture-download operations.
|
|||
|
|
|
|||
|
|
This is strong evidence that the installed network DLL contains useful operations for the requested feature set, but it is not yet a usable C# contract. Ghidra identifies the library as x86 and reports `RSNetConnectionStartEx` as `__stdcall` with an opaque integer argument and pointer-like return. The record-download Ex entry takes opaque pointer arguments. Its analyzed setup path allocates buffers, copies arrays with element sizes `0x1c` and `0x108`, then queues work with `QueueUserWorkItem`; the exact request structures, callback/event contract, ownership, and cancellation rules remain unresolved.
|
|||
|
|
|
|||
|
|
### Initial reuse recommendation
|
|||
|
|
|
|||
|
|
For a temporary Windows compatibility prototype, the x86 DLLs could live in a supervised x86 worker. For the requested managed multiplatform product, treat that only as a behavior oracle during reverse engineering, not as the final architecture. Keep protocol and media code managed/platform-neutral, and abstract credential storage behind per-OS secure stores; do not persist credentials in plaintext.
|
|||
|
|
|
|||
|
|
The presence of record query/download functions does not establish that the DLL emits a standard container or MP4. MP4 output should be treated as a separate remux/transcode stage until the downloaded bytes and codec/container contract are verified.
|
|||
|
|
|
|||
|
|
### Playback and MP4 boundary
|
|||
|
|
|
|||
|
|
`RSPlay.dll` is also x86. Its named procedure inventory includes play-instance create/destroy, window binding, `RSPlayInputNetFrame`, draw/decode callback registration, playback controls, and `RSPlay264ToAviStart/Stop`. The frame-input wrapper dispatches through an opaque instance vtable; the AVI conversion entry is another vtable dispatch and shares an address/name with `RSPlayConvertFileStart`. This is evidence of a native decode/render path and an AVI conversion path, not a documented managed ABI or proof of MP4 support. No MP4-named procedure appeared in the complete provider-defined procedure-name search for `RSPlay.dll`.
|
|||
|
|
|
|||
|
|
The bundled `hi_h264dec_w.dll` is x86 and exposes `Hi264DecCreate` and `Hi264DecFrame` names. Ghidra infers that creation accepts a pointer to an undocumented configuration structure and returns an opaque handle; the frame routine accepts seven low-level parameters. Avoid binding this decoder directly unless the SDK wrapper proves unusable.
|
|||
|
|
|
|||
|
|
For MP4, first capture the exact downloaded payload and inspect its codec, framing, timestamps, and audio. Then use a maintained FFmpeg-based remux when the source streams are compatible with MP4; transcode only when required. The legacy AVI conversion can be a compatibility fallback, not the preferred output path. Container behavior and whether arbitrary subranges can be cut without keyframe expansion remain runtime questions.
|
|||
|
|
|
|||
|
|
### P2P and initialization boundary
|
|||
|
|
|
|||
|
|
`RSNetInit` clears global state, derives the directory of the calling process, appends `\\RSNet.ini`, parses that file, and initializes Winsock 2.2. `RSNetInitLX2PPath` copies a caller-supplied path into global storage. The `RSNet.dll` string inventory includes `RSP2PClient.exe`, `RSP2PDaemon.exe`, and P2P/relay labels. These are static references; they do not prove which helper is launched or under what conditions.
|
|||
|
|
|
|||
|
|
The installation contains several vendor-specific P2P directories. The inspected `p2p/SY/PPCS_API.dll` has named initialize/connect/read/write/close/status procedures, but its connect entry aliases shared native code and the exact public parameter contract was not recovered. This makes it a potential provider-specific fallback, not a universal DVR transport. Prefer routing through `RSNet` unless testing establishes that direct use of a particular provider is necessary and supported.
|
|||
|
|
|
|||
|
|
### Main executable coverage
|
|||
|
|
|
|||
|
|
REA opened `Surveillance_client.exe` as an x86 PE with SHA-256 `dc6050f9c96fa68270b79b17d9c2127f0de4f3ddd3478a1c0c552134fff7de14`. The PE resource parser completed and identified a PE32 image. Ghidra's broad overview and focused procedure/string searches on this 10.8 MB executable timed out, including a sequential retry; therefore this pass does not establish the EXE's exact call sequence into `RSNet`/`RSPlay` or the import table. Existing DPI findings are recorded separately in [surveillance-client-dpi-analysis.md](surveillance-client-dpi-analysis.md): Qt 4-era widgets, no obvious static DPI-awareness logic, and persisted pixel geometry. A fresh managed UI should address DPI independently of the native worker.
|
|||
|
|
|
|||
|
|
## Managed Reimplementation Effort
|
|||
|
|
|
|||
|
|
### Bottom line
|
|||
|
|
|
|||
|
|
A .NET 10/Avalonia application is technically viable: Avalonia's upstream build currently targets `net10.0` across its desktop code ([target framework configuration](https://github.com/AvaloniaUI/Avalonia/blob/master/build/TargetFrameworks.props)). That establishes UI framework compatibility, not portability of this DVR's network protocol or the FFmpeg native binaries. FFmpeg can replace much of `RSPlay`'s decode/render and AVI conversion work; it cannot replace `RSNet`'s authentication, command protocol, recording index, or vendor P2P behavior.
|
|||
|
|
|
|||
|
|
The hardest work is discovering and reproducing the wire protocol and any P2P transport, not building the Avalonia screens or calling FFmpeg. REA found `RSNet` entry points that mostly forward opaque structures into internal stateful code. A record query snapshots session data, increments a shared request ID, coordinates through Windows event/critical-section machinery, and waits for a response with a 20-second timeout. The download path additionally allocates/copies native record arrays and queues asynchronous work. These behaviors need a managed protocol/state-machine design, not mechanical translation of export names.
|
|||
|
|
|
|||
|
|
### Planning estimate
|
|||
|
|
|
|||
|
|
Estimates are engineer-weeks for one experienced engineer, assuming access to a representative DVR and firmware. They are deliberately conditional: one successful original-client login and a bounded header-only capture are now observed, but managed-client authentication, live preview, recording, and the main executable's broad Ghidra analysis remain unverified.
|
|||
|
|
|
|||
|
|
| Scope | Effort | Assumptions |
|
|||
|
|
|---|---:|---|
|
|||
|
|
| Go/no-go discovery spike | 2-4 weeks | One device/firmware; establish credentials/auth, direct-LAN connection, one decodable live stream, record search, and a short export. |
|
|||
|
|
| Limited MVP after a successful spike | 12-20 additional weeks | One device family, direct IP/TCP without vendor P2P, a standard H.264/H.265 plus optional AAC stream, agreed camera-count target, arbitrary range search/download, and MP4 output. |
|
|||
|
|
| Add one P2P provider | 4-12+ additional weeks | Provider-specific protocol and relay behavior can be observed; vendor servers and credentials remain accessible. Could be blocked without a documented or observable protocol. |
|
|||
|
|
| Reproduce broad RSNet/RSPlay feature parity | 24-52+ weeks | Includes non-requested surfaces such as PTZ, audio talk, alarms, parameter/config operations, upgrades, fisheye and legacy playback behaviors; excludes extensive multi-family certification. |
|
|||
|
|
|
|||
|
|
The spike plus limited MVP is roughly 14-24 engineer-weeks, or about 3.5-6 months for one full-time engineer. Allow at least +/-50% until a real connection and stream capture prove the framing, authentication, and time-range semantics. Each additional device/P2P family expands both implementation and certification; it is not safe to assume the named P2P DLLs share one protocol.
|
|||
|
|
|
|||
|
|
### What FFmpeg removes, and what it does not
|
|||
|
|
|
|||
|
|
- `RSPlay`'s H.264/H.265 decoding, frame conversion, audio decode, and AVI conversion can likely be replaced with FFmpeg plus Avalonia frame presentation. The RSNet-to-media packet framing, decryption, timestamps, and channel metadata still need to be understood before FFmpeg can consume the stream.
|
|||
|
|
- Prefer stream-copy/remux for MP4 when downloaded packets use an MP4-compatible codec and carry usable timestamps. Transcode only when framing, codec, or timestamp constraints require it. Arbitrary range boundaries may need to expand to keyframes and then be trimmed/re-encoded for exact boundaries.
|
|||
|
|
- Start with FFmpegCore, which drives the native FFmpeg executable through a C# process wrapper. Feed live media over redirected stdin/stdout pipes and use the same backend for MP4 exports; codec work still runs in native FFmpeg. The process boundary is not automatically a performance problem, but live latency, buffering, and extra copies must be measured.
|
|||
|
|
- Keep FFmpegCore behind app-owned media interfaces so a later FFmpeg.AutoGen backend can call `libav*` in-process without changing protocol, view-model, or Avalonia code. Do not expose FFmpegCore command builders, process types, or FFmpeg native pointers outside the backend adapter.
|
|||
|
|
- Model the adapter boundary around encoded packets and decoded frames: packets carry codec/stream metadata, owned payload bytes, PTS/DTS, time base, and keyframe flags; decoded frames carry dimensions, pixel format, and owned pixel memory. Live decode and MP4 mux/remux can be separate interfaces. This keeps packet parsing in the protocol layer and rendering in Avalonia.
|
|||
|
|
- If FFmpegCore's pipe latency/copy cost is unacceptable, replace only the media adapter with FFmpeg.AutoGen. Benchmark with the target camera count and resolution before switching; in-process calls reduce process/pipe overhead but do not make the native codec work itself faster.
|
|||
|
|
- Both approaches require compatible native FFmpeg builds for each RID and review of LGPL/GPL configuration and codec licensing.
|
|||
|
|
- FFmpeg does not implement DVR login, command messages, record search, P2P rendezvous/NAT traversal, or proprietary encryption. Those are the dominant unknowns for a true managed RSNet replacement.
|
|||
|
|
|
|||
|
|
## Proposed .NET/Avalonia Shape
|
|||
|
|
|
|||
|
|
1. Use an Avalonia desktop app targeting `net10.0`, with protocol, device models, and recording logic in separate platform-neutral .NET libraries.
|
|||
|
|
2. Define provider interfaces for direct TCP and each vendor P2P family; start with one direct-IP provider. Keep auth/session lifecycle, heartbeat, retry, cancellation, and protocol parsing independent from Avalonia.
|
|||
|
|
3. Start with FFmpegCore behind app-owned `ILiveVideoDecoder` and `IRecordingMuxer`-style contracts. Keep the contracts independent of FFmpegCore and Avalonia; pass timestamped encoded packets in and owned decoded frames out. Feed FFmpeg only after DVR framing and timestamps are understood, and render frames in Avalonia without legacy Qt/Win32 window handles.
|
|||
|
|
4. Define an `ICredentialStore` abstraction with Windows Credential Manager/DPAPI, macOS Keychain, and Linux Secret Service implementations. Avalonia itself does not make secret storage portable.
|
|||
|
|
5. Keep the original x86 DLLs only as an optional Windows-side comparison oracle during development, subject to runtime access and redistribution terms. Do not make the final cross-platform app depend on them.
|
|||
|
|
6. Validate one camera and one recorded range first; then test concurrent feeds, time zones/DST, keyframe boundaries, cancellation, reconnects, audio, and exported MP4s on each supported OS. Keep a fake media-adapter test and packet fixtures so FFmpegCore and a future FFmpeg.AutoGen implementation can be compared against the same contract.
|
|||
|
|
|
|||
|
|
Before redistribution, verify the vendor DLLs and P2P SDK licensing, supported Windows versions, and all native runtime dependencies. Their presence in the installation does not grant redistribution rights or establish ongoing security maintenance.
|
|||
|
|
|
|||
|
|
## MVP Technical Specification
|
|||
|
|
|
|||
|
|
### Project and dependency layout
|
|||
|
|
|
|||
|
|
Use separate class libraries for application logic, protocol contracts, the RSNet implementation, media contracts, and infrastructure adapters. The Avalonia executable is the composition root and references the concrete adapters; application and domain code do not reference Avalonia, FFmpegCore, or native vendor DLLs.
|
|||
|
|
|
|||
|
|
| Project | Responsibility | Project references |
|
|||
|
|
|---|---|---|
|
|||
|
|
| `Surveillance.Client.Domain` | Device endpoints, channel identity, connection/preview state, and domain errors. No UI or vendor types. | None |
|
|||
|
|
| `Surveillance.Client.Protocol.Abstractions` | `IDeviceSessionFactory`, `IDeviceSession`, and preview-stream contracts, including typed login outcomes. | `Surveillance.Client.Domain` |
|
|||
|
|
| `Surveillance.Client.Media.Abstractions` | Owned encoded-packet and decoded-frame DTOs; `ILiveVideoDecoder` and future `IRecordingMuxer` contracts. | None |
|
|||
|
|
| `Surveillance.Client.Application` | Connect/authenticate, start/stop preview, and credential workflows. Defines the `ICredentialStore` port and coordinates protocol/media abstractions. | Domain, Protocol.Abstractions, Media.Abstractions |
|
|||
|
|
| `Surveillance.Protocol.RSNet` | Managed direct-IP transport, framing, authentication, preview parsing, timeouts, and cancellation for one verified device family. | Domain, Protocol.Abstractions |
|
|||
|
|
| `Surveillance.Media.FFmpegCore` | FFmpegCore process/pipe adapter implementing the app-owned media contracts. No FFmpegCore types escape this project. | Media.Abstractions |
|
|||
|
|
| `Surveillance.Infrastructure.Credentials` | OS-backed secure credential-store adapters. | Application |
|
|||
|
|
| `Surveillance.Client.App` | Avalonia Views and ViewModels, UI dispatch/frame presentation, logging, and DI composition root. | Application, Protocol.RSNet, Media.FFmpegCore, Infrastructure.Credentials |
|
|||
|
|
|
|||
|
|
Keep each later P2P implementation in its own provider project implementing `Protocol.Abstractions`; do not add P2P to the direct-IP MVP. Test projects reference only the layer they exercise: `Surveillance.Client.Domain.Tests`, `Surveillance.Client.Application.Tests`, `Surveillance.Protocol.RSNet.Tests`, `Surveillance.Media.FFmpegCore.Tests`, and `Surveillance.Client.App.Tests`.
|
|||
|
|
|
|||
|
|
### MVVM and dependency injection
|
|||
|
|
|
|||
|
|
- Use CommunityToolkit.Mvvm for observable ViewModels and commands. Views bind to ViewModel properties/commands; ViewModels do not call sockets, FFmpeg, credential APIs, or RSNet exports directly.
|
|||
|
|
- Build the service provider in `Surveillance.Client.App` during Avalonia startup, using `Microsoft.Extensions.DependencyInjection` (and the Generic Host if host-managed logging/configuration is useful). Register application use cases and ports, then their concrete adapters. Resolve top-level windows through the composition root; use constructor injection below it, not a service locator.
|
|||
|
|
- Keep a `DeviceConnectionViewModel` responsible for endpoint fields, saved-device selection, and connect errors. A `LiveViewViewModel` owns the selected channel and start/stop command state. Inject use-case services into both; no ViewModel owns a protocol handle or FFmpeg process.
|
|||
|
|
- Keep Avalonia dispatcher and bitmap conversion in the presentation project. Application services publish app-owned frames; the presentation adapter marshals updates onto the UI thread and writes into a stable-size Avalonia image surface.
|
|||
|
|
- Store the endpoint and username as device configuration and the password/token in an OS secure store behind `ICredentialStore`. Do not log credentials or include them in exception messages. Windows Credential Manager/DPAPI, macOS Keychain, and Linux Secret Service are implementation choices behind that port, not dependencies of the application layer.
|
|||
|
|
|
|||
|
|
### Auth-to-single-live-feed vertical slice
|
|||
|
|
|
|||
|
|
The first end-to-end slice is one direct-IP device, one selected channel, and live video only. Recording search/download, P2P, audio, PTZ, and multi-camera layouts remain later increments.
|
|||
|
|
|
|||
|
|
1. The user selects or enters a device endpoint and credentials.
|
|||
|
|
2. The application saves secrets through `ICredentialStore` after successful authentication. Remembering is enabled by default and can be disabled; on reconnect saved values fill blank credential fields.
|
|||
|
|
3. `ConnectDevice` opens a TCP session through `IDeviceSessionFactory` and sends the mode-0 login request. `FUN_100090e0` selects command `0x1f` with a 16-byte little-endian header and an `0x50`-byte payload: two 36-byte NUL-terminated narrow-string fields followed by two option dwords. Runtime capture of a successful original-client login confirmed `RSNetConnectionStartEx` mode 0 and the transformed-header flag `0x02`. The native worker applies its bit permutation to header bytes `2..15` and the full request payload; it reverses the permutation on the response header and response payload. The managed client now implements this mode-0 transform. Response status is at header offset `+2`; status zero is accepted only when the decoded response body has an `RS` marker at offset `+6`. The native receive helper places the response body at `16 + ((flags >> 2) * 4)`, so the managed reader skips any indicated extension words. The original-client UI reached its logged-in view; managed hardware authentication remains to be retested. The managed implementation uses UTF-8 for the native narrow-string fields, zeroes the uncharacterized option dwords, and leaves nonzero status codes unmapped; encoding, option values, and nonzero status meanings still need device validation. Alternate commands `0x269`/`0x26b` are not implemented. Credentials are sent in cleartext over TCP; use only on a trusted network or VPN until the transport is validated. Connection and authentication diagnostics are written by NLog under the platform's LocalApplicationData `SurveillanceClient/logs` directory, one file per day; credential values and packet payloads are not logged.
|
|||
|
|
4. After authenticated state, `StartLivePreview` requests one channel from `IDeviceSession` and returns an owned async packet stream. The RSNet adapter must first establish the actual preview packet callback/source, framing, codec metadata, timestamps, and buffer ownership. Parse vendor framing in the protocol project; pass only verified elementary-stream access units to media code.
|
|||
|
|
4. `ILiveVideoDecoder` consumes `EncodedVideoPacket` values and yields `DecodedVideoFrame` values. Packets carry codec/stream metadata, owned bytes, PTS/DTS, time base, and keyframe status. Frames carry dimensions, pixel format, row stride, and memory with explicit ownership/lifetime. Keep queues bounded and measure the backpressure policy; never queue unbounded frames on the UI thread.
|
|||
|
|
5. The Avalonia presentation adapter converts frames to its image surface and dispatches updates to the UI thread. Neither protocol DTOs nor media contracts contain Avalonia or FFmpegCore types.
|
|||
|
|
6. Stop is idempotent and cancellation-aware: cancel packet consumption, stop the preview, dispose decoder resources, then disconnect and dispose the device session. Clear displayed frame state and surface terminal errors without exposing secrets. Preserve this order even when preview startup or decoding fails partway through.
|
|||
|
|
|
|||
|
|
**Discovery gate before claiming hardware compatibility:** use a controlled session with one identified device model/firmware to confirm (a) managed authentication against the device, credential encoding, option fields, nonzero status mapping, and cleartext/TLS behavior, and (b) the preview-start handoff and encoded packet boundaries/timestamps. The original client has now authenticated successfully in the UI; a Frida capture observed mode 0, the 96-byte login send, and response traffic while reading no credential payload bytes. Produce sanitized deterministic fixtures and verify direct-IP behavior. The managed implementation is informed by that trace and local fake-server tests, but has not yet passed a hardware login. The UI can report authenticated state while preview remains explicitly unavailable.
|
|||
|
|
|
|||
|
|
### Test plan and acceptance
|
|||
|
|
|
|||
|
|
| Test project / level | Required coverage |
|
|||
|
|
|---|---|
|
|||
|
|
| `Surveillance.Client.Domain.Tests` | Valid/invalid session-state transitions; channel and endpoint invariants; error classification. |
|
|||
|
|
| `Surveillance.Client.Application.Tests` | Connect/auth/start/stop orchestration with fake protocol, credential, and decoder ports; wrong credentials, timeout, cancellation, partial-start failure, and repeated stop; assert secrets never appear in logs. |
|
|||
|
|
| `Surveillance.Protocol.RSNet.Tests` | Captured native mode-0 header golden vector, transformed login request/response loopback coverage, and status rejection; managed hardware auth, preview parsing, fragmentation/coalescing, timeout, and cancellation remain gated on runtime evidence. |
|
|||
|
|
| `Surveillance.Media.FFmpegCore.Tests` | FFmpeg argument construction, pipe input/output, bounded stderr handling, process exit/error mapping, cancellation, and process cleanup. Use a small known media fixture for adapter integration; keep process invocation behind a narrow test seam if needed. |
|
|||
|
|
| `Surveillance.Client.App.Tests` | ViewModel command/state/error behavior with fake use cases and frame presenters; no DVR or FFmpeg executable required. |
|
|||
|
|
| Opt-in hardware integration | One supported model/firmware over direct IP: correct and incorrect login, one channel start, continuous decode, stop/restart, disconnect, and reconnect. Keep this separate from ordinary CI and sanitize any captured fixtures. |
|
|||
|
|
|
|||
|
|
The MVP is accepted when credentials survive app restart only through the OS secure store; one verified direct-IP login produces an authenticated state; one channel displays decoded frames for a 30-minute soak without unbounded queue growth; login/transport/decode failures are visible and recoverable; and stop/cancellation leaves no preview session, socket, or FFmpeg process behind. Record the tested model, firmware, OS, codec, latency, and reconnect behavior. These criteria are conditional on passing the discovery gate and do not imply broad device-family support.
|
|||
|
|
|
|||
|
|
## Evidence Ledger
|
|||
|
|
|
|||
|
|
Evidence below combines static analysis of the installed artifacts with bounded original-client runtime login captures. Credential fields were never read; follow-up captures sampled only the two mode-0 option dwords and decoded response bytes 6–7. The UI success result was user-reported.
|
|||
|
|
|
|||
|
|
| Evidence | Observation | Boundary |
|
|||
|
|
| Original-client response marker (2026-10-16) | The native decoder returned a 1,232-byte body with bytes `53 52` at offsets 6-7; the native worker compares these as little-endian `0x5253`. A separate request capture observed zero-valued option dwords at payload offsets 72 and 76. | Only the two marker bytes and two non-credential option dwords were read; credential fields and all other payload bytes were not accessed. |
|
|||
|
|
|---|---|---|
|
|||
|
|
| Original-client Frida login capture (2026-10-16) | The x86 client called `RSNetConnectionStartEx` with mode bytes `0x35=0` and `0x36=0`, connected to `192.168.100.92:9000`, sent 96-byte login frames with transformed-header flag `0x02`, and received response traffic. The user confirmed the UI reached its logged-in view. | Captured only mode bytes, the first 16 bytes of 96-byte sends, response headers, socket results, and byte counts; request/response payload bytes were never read. UI outcome is user-reported. |
|
|||
|
|
| `ev_0d183bb60c1fc079d8b16095cd7e6e0a89d4915bce519bcfb7327dabd7bc4ebd` (`search_procedures`, Ghidra 12.1.4) | `RSNet.dll` contains named connection, preview, record-query, record-play, and record-download procedures; Winsock imports include `connect`, `send`, and `recv`. | Procedure-name search over the provider's defined procedure inventory; names alone do not establish semantics or export ABI. |
|
|||
|
|
| `ev_d42fbe012e26d4981a08e00ce46e70433e362db4ec26a3f14c685fe3a9e3bb00` (`analyze_function`, `RSNetConnectionStartEx`) | Ghidra reports an x86 `__stdcall` wrapper returning an opaque pointer and accepting one integer-like argument. | Decompiler-derived signature and body for this function; types are inferred from machine code, not vendor headers. |
|
|||
|
|
| `ev_6c73effc02cb39d7d7b41c1d20d3d7b727c24848d206658e748862c0df8efb49` (`analyze_function`, `RSNetStartDownloadRecordEx`) | The wrapper accepts two opaque pointer-like arguments and delegates into native request setup. | Decompiled wrapper; the vendor request type and completion contract are unresolved. |
|
|||
|
|
| `ev_1b112461309bd2e0f9d5d88f747eaf58bd118717148ca9f28e93fc37b9803db6` (`analyze_function`, `FUN_100056c0`) | Preview setup uses a critical section and searches/updates a native collection of session-like objects. | Decompiled function body; names and business meaning of fields are unknown. |
|
|||
|
|
| `ev_e2f17ef25e28e6555e8f96d89b6fcf19d7bccdde1778533bf9dd46635ce2f3ad` (`analyze_function`, `FUN_100103b0`) | Record-download setup allocates/copies per-item buffers and submits a worker through `QueueUserWorkItem`. | Decompiled setup body; queued callback was not recovered as an independent procedure, so transfer and completion semantics remain open. |
|
|||
|
|
| `ev_dc360c49f596100f1bf3d0a2a6df8978f3417a44a185b8a83fe980aa1f400565` (`analyze_function`, `RSNetConnectionStart`) | The public start entry allocates a `0xe98`-byte native object, initializes it through internal helpers, and returns an opaque pointer on success. | Decompiled wrapper; the object layout and actual login/session protocol remain unresolved. |
|
|||
|
|
| `ev_99413f5c1c8b3db71a1b27f2b9859cfd6b9610b855f79975ba8ef145a8b50166` + `ev_04e06a1dfc520df682f516a62663b9ad28a0b825f2e2d3000897afcd80cdc8c0` + `ev_0cd45ef8fd8357e2c1afc1ade8845694727737f2c94e06ed4031810f88340ade` (`analyze_function` / referenced-strings view / xrefs, `FUN_100090e0`) | The x86 worker constructs default login command `0x1f`, a 16-byte header, and an `0x50`-byte payload. It copies two NUL-terminated strings into 36-byte fields, appends two option dwords, applies the native bit permutation for transformed mode, and validates a successful response with an `RS` marker. | Static worker analysis plus the mode-0 runtime capture above. Native narrow-string encoding, option-dword meanings/defaults, and managed-device acceptance remain unverified. |
|
|||
|
|
| `ev_0316a50fa696dd6bbd9f4b84d255689bf6e731b61ec87213da4f80ba188d8393` (`procedure_pseudo_code`, `FUN_100205f0`) | The native helper concatenates a 16-byte header and payload, then calls TCP `send` once and requires the complete byte count. | Assembly/pseudocode of the shipped x86 DLL; it does not establish server acceptance or retry behavior. |
|
|||
|
|
| `ev_66deb589c677f148df9dfede536881c7a90b2a3288901b1c09413e57649740bc` + `ev_6185a26b99ab42e3cfb3b79dc33c3e6b9decb86cf85478ed9777ca6ce6fd62aa` + `ev_6039a85e773b6e22118b90146d6c46fb91ce0c94d4cf64da303235bec0fbed6a` (`procedure_pseudo_code`, receive/header helpers) | The worker reads and reverses the transform on the response header; status is at offset `+2`, zero is success, and `FUN_10003d30` computes the body offset as `16 + ((flags >> 2) * 4)`. It also reverses the response-payload transform before checking `RS` at body offset `+6`; statuses `0x32`/`0x33` set native last-error values. | Static pseudocode plus one successful original-client UI result. Other modes and nonzero status meanings remain unresolved. |
|
|||
|
|
| `ev_34b043c2cfc9f58d0f6ae6798e5531cc4ba34d7b85ab09f9888409b4beefebbe` (`analyze_function`, `RSNetStopPreview`) | The wrapper checks the context and preview handle, calls an internal stop helper, and clears the caller's handle. | Decompiled wrapper at `0x1001c4b0`; helper behavior and packet callback ownership remain unresolved. |
|
|||
|
|
| `ev_c4d3300ea096044c2059e299fae4fd0e864ca62750f5953093405d5e73646a40` (`analyze_function`, `RSNetConnectionStop`) | The wrapper clears the caller's connection pointer and invokes internal shutdown/cleanup helpers for the opaque object. | Decompiled wrapper at `0x1001d0a0`; exact socket/thread shutdown ordering is not established by this wrapper alone. |
|
|||
|
|
| `ev_79ede58629e436b4f454692234adec46614109fb731e7852fcf0454b17a10a4d` (`analyze_function`, `RSNetStartPreview`) | The named start wrapper accepts opaque arguments and delegates preview creation into native state. | It does not establish encoded packet format or the callback/handoff consumed by the original client. |
|
|||
|
|
| `ev_71287e7cb6a061428ece1415f8bf430a5e489914d808cf3f9c37a27bbfa0172a` (`analyze_function`, `RSNetSetDevInfo`) | The function copies `0x48` bytes from its argument and submits a request through internal command machinery. | Structure fields and request purpose are unknown; this is not evidence that the call authenticates a user. |
|
|||
|
|
| `ev_50ae9861dde2005e0a53bc34848c6fefa540a43cf02679531ffd6adfb208a3bf` (`analyze_function`, `RSNetQueryRecordEx`) | Record-query Ex is a short `__stdcall` wrapper taking two opaque pointers and calling an internal query routine. | Does not reveal the public request structure or returned record layout. |
|
|||
|
|
| `ev_5efc588c56e04dc41e8c404e5cb2b74f67afc1e2e2828156e28403421e0bd18b` (`analyze_function`, `FUN_10005eb0`) | The internal record-query path snapshots native state, increments a shared ID, builds request data, and calls a helper with a 20,000 ms timeout. | Decompiled helper; protocol fields and response-to-record mapping are not fully recovered. |
|
|||
|
|
| `ev_f0544388b10f903585f5a108d435109deffec0bda80822656f032d88dd2dd1f6` (`analyze_function`, `FUN_10007330`) | The shared operation queues work under a critical section and waits on a Windows event before returning completion state. | Decompiled synchronization path; it does not by itself identify all socket framing or error semantics. |
|
|||
|
|
| `ev_f42bdfeee987ace213d45429f70c1b137c00fabda859cf6c109536402da45ad4` (`analyze_function`, `RSNetInit`) | Initialization derives the process directory, reads adjacent `RSNet.ini`, and configures Winsock 2.2. | Ghidra pseudocode; configuration parser semantics and runtime side effects remain untested. |
|
|||
|
|
| `ev_de6bc45e95104efae090a5cc3bfac1b363e8e088b69ca529ad086e044e8c6f44` (`analyze_function`, `RSNetInitLX2PPath`) | The function copies a caller-provided path into global storage. | Decompiled function; the code selecting the path and loading any provider was not established. |
|
|||
|
|
| `ev_e973cdc2def91d1adf12ca6361e11f311226f31df289e35bbe1c7646da1c6f6d` (`search_strings`, `RSNet.dll`) | Defined strings include `RSP2PClient.exe`, `RSP2PDaemon.exe`, and P2P/relay labels. | String inventory observations; do not prove process creation or actual provider selection. |
|
|||
|
|
| `ev_a8fff3b40ce4ff520544fe21413db41a358162f4e119b9b11f7a7c36dd3e2769` (`search_procedures`, `RSPlay.dll`) | Named procedures include per-instance playback, network-frame input, decode/draw callbacks, and H.264-to-AVI conversion. | Complete matching defined procedure-name inventory; names do not establish a stable ABI or runtime support. |
|
|||
|
|
| `ev_652be99a1040641c0e78b429cb0dd33846a83c41ab93ef894df5bbd266e7c3df` (`analyze_function`, `RSPlayInputNetFrame`) | The wrapper takes an opaque instance plus two untyped frame parameters and dispatches through a vtable. | Ghidra decompiler signature and body; frame format and ownership remain unknown. |
|
|||
|
|
| `ev_5c28c886f02fe1e47c04ab27320b582d1cb97adf64028ae8c3625864a5e1d5af` (`analyze_function`, `RSPlay264ToAviStart`) | The named AVI conversion entry dispatches through an opaque instance vtable. | Does not establish input/output container details or MP4 capability. |
|
|||
|
|
| `ev_45c4ccbaf121078046672af89dbe07be2d5547b5da13d2e758895977f6bf289d` (`analyze_function`, `Hi264DecCreate`) | H.264 decoder creation takes a pointer to an undocumented config structure and returns an opaque handle. | Ghidra-derived signature; config layout and decoder requirements are unknown. |
|
|||
|
|
| `ev_5dd43643df5d5bd620a18f8da397e72be4dc30e3ed684741109cbee957d14866` (`analyze_function`, `Hi264DecFrame`) | H.264 frame decoding has seven low-level parameters and mutates decoder state. | Ghidra-derived signature; exact types and buffer contract are unknown. |
|
|||
|
|
| `ev_df13bfe4608c52a275d7d6fdd87d924dfd2d1027ff465227fd6837bd35d786c9` (`search_procedures`, `p2p/SY/PPCS_API.dll`) | The SY P2P library contains initialize/connect/read/write/close and status procedure names. | One vendor-specific library only; the search does not establish device-family compatibility or a documented ABI. |
|
|||
|
|
| `ev_522a24d172a10c66d2552f0567b22af89a1c2099c5861a9183d7ab405e590edc` (`inspect_pe_resources`, main EXE) | Resource inspection completed for the exact PE32 executable identity and file hash above. | Resource tree only; it does not establish code behavior or manifest loading. |
|
|||
|
|
|
|||
|
|
## Open Questions
|
|||
|
|
|
|||
|
|
- Do real devices accept the statically recovered default login frame, UTF-8 string encoding, and zero option dwords? What are the meanings of nonzero login statuses and alternate transformed/command modes?
|
|||
|
|
- Where does the original EXE receive encoded preview packets from `RSNet`, and what are their framing, codec, timestamp, and ownership rules?
|
|||
|
|
- Which exact `RSNet` structures and callback signatures does the original EXE pass for record search and download?
|
|||
|
|
- Can a controlled run against one representative DVR confirm direct-IP authentication and one decodable channel before committing to the managed protocol implementation?
|
|||
|
|
- Does the original client use `RSPlay.dll`, FFmpeg, or the HiSilicon decoder DLLs for live rendering and recorded playback, and can any of them write a standard MP4?
|
|||
|
|
- Which of the vendor-specific P2P SDKs under `p2p/` is selected for each device family, and can a modern client load only the required provider?
|
|||
|
|
- Can the executable and relevant DLLs be analyzed in one complete REA pass? The first broad queries on the 10.8 MB EXE timed out; the smaller `RSNet.dll` target was analyzable.
|