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.7 KiB
Diff
61 lines
2.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: RustDesk <support@rustdesk.com>
|
|
Date: Fri, 1 Nov 2025 08:00:00 +0000
|
|
Subject: [PATCH] Fix CVBufferCopyAttachments crash on macOS Big Sur
|
|
|
|
Use weak linking for CVBufferCopyAttachments to avoid symbol resolution
|
|
crash on macOS < 12. The function will be NULL on older systems and the
|
|
code will fall back to the deprecated CVBufferGetAttachments.
|
|
|
|
This fixes a crash on macOS Big Sur (11.x) where CVBufferCopyAttachments
|
|
is not available. The runtime check with __builtin_available is not enough
|
|
because the symbol is still resolved at load time, causing a dyld error.
|
|
|
|
Fixes: https://github.com/rustdesk/rustdesk/issues/13377
|
|
---
|
|
libavutil/hwcontext_videotoolbox.c | 21 ++++++++++++++++++++-
|
|
1 file changed, 20 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/libavutil/hwcontext_videotoolbox.c b/libavutil/hwcontext_videotoolbox.c
|
|
index 0000000000..1111111111 100644
|
|
--- a/libavutil/hwcontext_videotoolbox.c
|
|
+++ b/libavutil/hwcontext_videotoolbox.c
|
|
@@ -33,6 +33,25 @@
|
|
#include "pixfmt.h"
|
|
#include "pixdesc.h"
|
|
|
|
+// Weak import CVBufferCopyAttachments to support macOS < 12
|
|
+// The runtime check with __builtin_available is not enough because
|
|
+// the symbol is still resolved at load time, causing dyld errors on Big Sur.
|
|
+// With weak_import, the function pointer will be NULL on older systems.
|
|
+#if TARGET_OS_OSX && defined(__MAC_12_0) && __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_12_0
|
|
+extern CFDictionaryRef CVBufferCopyAttachments(CVBufferRef buffer, CVAttachmentMode mode)
|
|
+ __attribute__((weak_import));
|
|
+#endif
|
|
+#if TARGET_OS_IOS && defined(__IPHONE_15_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_15_0
|
|
+extern CFDictionaryRef CVBufferCopyAttachments(CVBufferRef buffer, CVAttachmentMode mode)
|
|
+ __attribute__((weak_import));
|
|
+#endif
|
|
+#if TARGET_OS_TV && defined(__TVOS_15_0) && __TV_OS_VERSION_MAX_ALLOWED >= __TVOS_15_0
|
|
+extern CFDictionaryRef CVBufferCopyAttachments(CVBufferRef buffer, CVAttachmentMode mode)
|
|
+ __attribute__((weak_import));
|
|
+#endif
|
|
+
|
|
+// End of weak import section
|
|
+
|
|
typedef struct VTFramesContext {
|
|
/**
|
|
* The public AVVTFramesContext. See hwcontext_videotoolbox.h for it.
|
|
@@ -547,7 +566,7 @@ static CFDictionaryRef vt_cv_buffer_copy_attachments(CVBufferRef buffer,
|
|
(TARGET_OS_TV && defined(__TVOS_15_0) && __TV_OS_VERSION_MAX_ALLOWED >= __TVOS_15_0)
|
|
// On recent enough versions, just use the respective API
|
|
if (__builtin_available(macOS 12.0, iOS 15.0, tvOS 15.0, *))
|
|
- return CVBufferCopyAttachments(buffer, attachment_mode);
|
|
+ if (CVBufferCopyAttachments != NULL) return CVBufferCopyAttachments(buffer, attachment_mode);
|
|
#endif
|
|
|
|
// Check that the target is lower than macOS 12 / iOS 15 / tvOS 15
|
|
--
|
|
2.43.0
|
|
|