f8ead215d8
build-windows / build-hello-agent-x64 (push) Successful in 5m41s
A single-binary, Flutter-free remote-support agent that speaks the stock
RustDesk wire protocol. Designed for one-line MDM deployment against a
self-hosted rustdesk-server: a supporter using the unmodified rustdesk.exe
client connects, the controlled-side user gets a native Win32 approval
prompt, click Yes / No.
CLI surface
hello-agent.exe --install # register + start service
hello-agent.exe --uninstall # stop, delete, clean up
hello-agent.exe --config <BLOB> # admin-UI deploy string
hello-agent.exe --install --config <BLOB> # MDM one-liner
--config accepts both forms emitted by the rustdesk-server admin UI: the
reversed-base64 deploy string and the host=,key=,api=,relay= filename
form. Decoded via the upstream custom_server module, persisted via
hbb_common::config::Config::set_option.
Architecture
--service runs as a Session 0 LocalSystem service. It polls
WTSGetActiveConsoleSessionId and (re)spawns hello-agent.exe --server
into the active console session via librustdesk::platform::run_as_user,
handling the Session 0 → user-session token impersonation.
--server is the worker. It boots three concurrent components:
1. cm_popup: an IPC listener on the rustdesk `_cm` named pipe
2. librustdesk::start_server(true, false): the upstream protocol
stack — rendezvous mediator, NAT punch, IPC server, screen
capture, login validation, hbbs_http heartbeat / sysinfo sync
3. (implicit) ApproveMode::Click is pinned in config, so every
incoming connection routes through cm_popup
The popup mechanism reuses an existing upstream contract without any
patches to the protocol code: when a peer connects with no password,
Connection::start in the upstream code calls try_start_cm_ipc, which
ipc::connect-s the `_cm` pipe before falling back to spawning a Flutter
CM child. Since cm_popup is up first, step 1 succeeds; we read the
Data::Login{authorized:false} frame, show MessageBoxTimeoutW (Yes/No,
60s, top-most, system-modal), and reply Data::Authorize or Data::Close.
Source tree
src/main.rs CLI dispatcher + run_server() composition
src/cli.rs hand-rolled argv parser + unit tests
src/service.rs windows-service install/uninstall/dispatcher
src/config_import.rs --config blob decoding + persistence
src/cm_popup.rs _cm IPC listener + Win32 approval dialog
Vendoring
The upstream RustDesk crate is vendored under vendor/rustdesk/ — full
workspace including libs/{hbb_common, scrap, enigo, clipboard,
virtual_display, remote_printer}. This makes the build self-contained
(no submodules, no sibling-repo checkout in CI) and gives us freedom to
fork in a different direction later. Excluded from the vendor: .git,
target/, flutter/, appimage/, flatpak/, fastlane/, docs/, examples/,
ci/, build.py, Dockerfile, upstream README/CLAUDE/AGENTS/GEMINI.
One local divergence vs. upstream: vendor/rustdesk/src/lib.rs flips
`mod custom_server` → `pub mod custom_server` so config_import.rs can
call get_custom_server_from_string without going through the
ui_interface shim. Documented in README.md → "Re-syncing the vendored
copy".
CI
.gitea/workflows/build-windows.yml builds on a self-hosted Windows
runner with Rust 1.75, LLVM 15.0.6 (libclang for bindgen via libvpx-sys),
and a vcpkg cache. The vendored vcpkg.json drives x64-windows-static
deps. The workflow stages the resulting hello-agent.exe into
SignOutput\, reports authenticode signing status (warns on unsigned),
and uploads as artifact. ~15 min full build, faster on incremental.
Out of scope for this commit: Linux/macOS builds, code signing, MSI
packaging, coexistence with stock rustdesk on the same box (currently
shares the RustDesk APP_NAME and config dir).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
61 lines
2.2 KiB
Diff
61 lines
2.2 KiB
Diff
diff --git a/build/cmake/cpu.cmake b/build/cmake/cpu.cmake
|
|
index acebe20..8c67d89 100644
|
|
--- a/build/cmake/cpu.cmake
|
|
+++ b/build/cmake/cpu.cmake
|
|
@@ -120,6 +120,19 @@ elseif("${AOM_TARGET_CPU}" MATCHES "^x86")
|
|
set(RTCD_ARCH_X86_64 "yes")
|
|
endif()
|
|
|
|
+ # AVX2 requires __m256i definition starting v3.9.0
|
|
+
|
|
+ if(ENABLE_AVX2)
|
|
+ aom_check_source_compiles("x86_64_avx2_m256i_available" "
|
|
+#include <emmintrin.h>
|
|
+#ifndef __m256i
|
|
+#error 1
|
|
+#endif" HAVE_AVX2_M256I)
|
|
+ if(HAVE_AVX2_M256I EQUAL 0)
|
|
+ set(ENABLE_AVX2 0)
|
|
+ endif()
|
|
+ endif()
|
|
+
|
|
set(X86_FLAVORS "MMX;SSE;SSE2;SSE3;SSSE3;SSE4_1;SSE4_2;AVX;AVX2")
|
|
foreach(flavor ${X86_FLAVORS})
|
|
if(ENABLE_${flavor} AND NOT disable_remaining_flavors)
|
|
diff --git a/aom_dsp/x86/synonyms.h b/aom_dsp/x86/synonyms.h
|
|
index 0d51cdf..6744ec5 100644
|
|
--- a/aom_dsp/x86/synonyms.h
|
|
+++ b/aom_dsp/x86/synonyms.h
|
|
@@ -46,13 +46,6 @@ static INLINE __m128i xx_loadu_128(const void *a) {
|
|
return _mm_loadu_si128((const __m128i *)a);
|
|
}
|
|
|
|
-// Load 64 bits from each of hi and low, and pack into an SSE register
|
|
-// Since directly loading as `int64_t`s and using _mm_set_epi64 may violate
|
|
-// the strict aliasing rule, this takes a different approach
|
|
-static INLINE __m128i xx_loadu_2x64(const void *hi, const void *lo) {
|
|
- return _mm_unpacklo_epi64(_mm_loadu_si64(lo), _mm_loadu_si64(hi));
|
|
-}
|
|
-
|
|
static INLINE void xx_storel_32(void *const a, const __m128i v) {
|
|
const int val = _mm_cvtsi128_si32(v);
|
|
memcpy(a, &val, sizeof(val));
|
|
diff --git a/aom_dsp/x86/synonyms_avx2.h b/aom_dsp/x86/synonyms_avx2.h
|
|
index d4e8f69..45be17e 100644
|
|
--- a/aom_dsp/x86/synonyms_avx2.h
|
|
+++ b/aom_dsp/x86/synonyms_avx2.h
|
|
@@ -25,6 +25,13 @@
|
|
* Intrinsics prefixed with yy_ operate on or return 256bit YMM registers.
|
|
*/
|
|
|
|
+// Load 64 bits from each of hi and low, and pack into an SSE register
|
|
+// Since directly loading as `int64_t`s and using _mm_set_epi64 may violate
|
|
+// the strict aliasing rule, this takes a different approach
|
|
+static INLINE __m128i xx_loadu_2x64(const void *hi, const void *lo) {
|
|
+ return _mm_unpacklo_epi64(_mm_loadu_si64(lo), _mm_loadu_si64(hi));
|
|
+}
|
|
+
|
|
// Loads and stores to do away with the tedium of casting the address
|
|
// to the right type.
|
|
static INLINE __m256i yy_load_256(const void *a) {
|