app
SOLIDWORKS Bridge
Public Made by Adomby adom
Launch, model and quit SOLIDWORKS from any Adom container. Nothing is ever lost.
main
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
[package]
name = "swx-bridge"
version = "0.11.4"
edition = "2021"
rust-version = "1.80"
description = "Adom SOLIDWORKS bridge — swx_* verbs over the SOLIDWORKS COM API, as a single native binary"
license = "MIT"
publish = false
# lib + bin: the bin is a thin `swx_bridge::run()` wrapper so the integration
# tests in tests/ can reuse the crate's own HTTP client / protocol types while
# still driving the REAL compiled binary (CARGO_BIN_EXE_swx-bridge).
[lib]
name = "swx_bridge"
path = "src/lib.rs"
[[bin]]
name = "swx-bridge"
path = "src/main.rs"
[dependencies]
# tiny_http: small blocking HTTP/1.1 server (the stack the official hello-rust
# sample bridge uses). No TLS, no async runtime — ab talks plain loopback HTTP
# at a few requests per second.
tiny_http = "0.12"
# serde + serde_json: the {"command","args"} envelope in, JSON verb results
# out, and the JSON-lines com-host protocol. serde_json::Value is the whole
# data model — the response shapes are dynamic by design (they mirror what the
# COM host returns), so nothing here is worth a derive struct except Command.
serde = { version = "1", features = ["derive"] }
serde_json = "1"
# miniz_oxide: pure-Rust deflate for the PNG swx_render_image writes (0.9.18).
miniz_oxide = "0.8"
[target.'cfg(windows)'.dependencies]
# windows: late-bound IDispatch (GetIDsOfNames + Invoke), GetActiveObject,
# CoCreateInstance, VARIANT/SAFEARRAY marshalling. The COM layer is the whole
# reason this bridge exists on Windows.
windows = { version = "0.62", features = [
"Win32_Foundation",
"Win32_System_Com",
"Win32_System_Ole",
"Win32_System_Variant",
# Threading: the com-host watchdog opens the parent process to check it is
# still alive, so a hard-killed server leaves no orphan holding a COM object.
# Also GetProcessTimes (the CREATION TIME the launch kill list is scoped by),
# GetProcessHandleCount and TerminateProcess — every terminate this bridge
# makes is by pid, never by image name.
"Win32_System_Threading",
# ToolHelp: the launcher-chain process census (src/launchos.rs).
"Win32_System_Diagnostics_ToolHelp",
# ProcessStatus: private memory, for the exhaustion verdict.
"Win32_System_ProcessStatus",
# WindowsAndMessaging: IsHungAppWindow + EnumWindows — how this bridge
# answers "is SOLIDWORKS responding?" WITHOUT COM, which is the only time
# that question matters.
"Win32_UI_WindowsAndMessaging",
# Input_KeyboardAndMouse + SystemInformation: GetLastInputInfo / GetTickCount,
# the user-presence guard's "how long since the user last touched the
# machine" (0.9.9).
"Win32_UI_Input_KeyboardAndMouse",
"Win32_System_SystemInformation",
# Shell: ShellExecuteExW, the launch route that runs the .lnk with an
# explicit SW_SHOWNORMAL. SHELLEXECUTEINFOW carries an HKEY, so the Registry
# feature is what makes the struct exist at all.
"Win32_UI_Shell",
# Storage_FileSystem: GetDiskFreeSpaceExW — the sweep refuses to start
# writing every open document to a volume that cannot hold them.
"Win32_Storage_FileSystem",
"Win32_System_Registry",
# SystemInformation: GetSystemTimeAsFileTime — the bridge reads its own
# clock through the SAME call the process creation times come from, so
# "created at or after our invoke" needs no slack to absorb a conversion.
"Win32_System_SystemInformation",
# RestartManager: the LAST quit rung — RmStartSession / RmRegisterResources /
# RmShutdown, the OS's own polite shutdown. `RmForceShutdown` is never passed
# (a literal 0 at the call site); see src/quit.rs::win.
"Win32_System_RestartManager",
] }
# winreg: App Paths lookup + HKLM\SOFTWARE\SolidWorks version enumeration.
# Safe wrapper over the registry API — cheaper than hand-rolling RegOpenKeyExW
# and its UTF-16 buffer dance for two reads.
winreg = "0.56"
[profile.release]
# Size-optimized, matching the hello-rust sample: this exe ships inside the
# bridge zip on the wiki, so smaller = faster installs.
opt-level = "z"
lto = true
codegen-units = 1
strip = true
# NOT panic="abort" (the hello-rust sample uses it): the com-host child catches
# panics with catch_unwind and answers them as ordinary errors, which needs
# unwinding. A late-bound COM call meeting something unexpected must cost one
# verb, not the user's whole SOLIDWORKS session.