fix(app): embed Common-Controls v6 manifest so TaskDialogIndirect resolves

Symptom: jarvis-app.exe failed to start with a MessageBox saying
"Точка входа в процедуру TaskDialogIndirect не найдена в библиотеке
DLL ... jarvis-app.exe". Loader phase, no log lines ever written.

Cause: tray-icon 0.21 / winit 0.30 transitive Win32 imports include
TaskDialogIndirect from comctl32.dll, which is a Common-Controls v6
API. Without a side-by-side manifest declaring a dependency on
Microsoft.Windows.Common-Controls v6.0.0.0, Windows loads the legacy
v5 comctl32 (which does not export TaskDialogIndirect) and the
loader rejects the exe before main().

jarvis-gui does not hit this because tauri-build embeds its own
manifest as part of the Tauri compile step. jarvis-app had no
manifest at all.

Fix:
- app.manifest: Common-Controls v6 dependency, supportedOS for
  Win7..Win11, PerMonitorV2 DPI awareness, UTF-8 active code page,
  asInvoker execution level.
- app.manifest.rc: 3-line .rc that embeds the manifest with
  CREATEPROCESS_MANIFEST_RESOURCE_ID (1) and RT_MANIFEST (24).
- build.rs: on cfg(windows), embed_resource::compile() compiles the
  .rc and links the resulting .res into the exe. rerun-if-changed
  on the manifest sources.
- Cargo.toml: target-windows build-dependency on embed-resource 3.

Verified: jarvis-app.exe now runs cleanly through all init steps:
commands parsed, audio init, recorder init found "Микрофон (5-
Fifine Microphone)", IPC server up on ws://127.0.0.1:9712, VAD
already flushing frames.

UTF-8 active code page in the manifest also helps russian-character
fidelity when win32 APIs are invoked from PowerShell helpers.
This commit is contained in:
Bossiara13 2026-05-15 13:26:00 +03:00
parent a3bdf90237
commit 9911b6ec40
5 changed files with 81 additions and 5 deletions

1
Cargo.lock generated
View file

@ -3271,6 +3271,7 @@ name = "jarvis-app"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"dotenvy", "dotenvy",
"embed-resource",
"glib 0.21.5", "glib 0.21.5",
"gtk", "gtk",
"image", "image",

View file

@ -31,4 +31,7 @@ winrt-notification.workspace = true
[target.'cfg(target_os = "linux")'.dependencies] [target.'cfg(target_os = "linux")'.dependencies]
gtk = "0.18" gtk = "0.18"
glib = "0.21.5" glib = "0.21.5"
[target.'cfg(target_os = "windows")'.build-dependencies]
embed-resource = "3"

View file

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
type="win32"
name="J.A.R.V.I.S.app"
version="0.1.0.0"
processorArchitecture="*"
/>
<description>J.A.R.V.I.S. voice assistant daemon</description>
<!--
Declare a dependency on Common Controls v6 so transitive Win32 imports
like TaskDialogIndirect (used by tray-icon / winit dialog fallbacks)
can find their entry points in comctl32.dll. Without this, Windows
loads the legacy v5 comctl32 and the exe fails to start with
"TaskDialogIndirect entry point not found".
-->
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
<!-- DPI / Windows version compatibility -->
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows 10 / 11 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<!-- Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
</application>
</compatibility>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2,PerMonitor</dpiAwareness>
<activeCodePage xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">UTF-8</activeCodePage>
</windowsSettings>
</application>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>

View file

@ -0,0 +1,4 @@
#define RT_MANIFEST 24
#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "app.manifest"

View file

@ -1,10 +1,18 @@
fn main() { fn main() {
// link to Vosk lib
// println!("cargo:rustc-link-lib=libvosk.dll");
let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap(); let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap();
let lib_path = std::path::Path::new(&manifest_dir) let lib_path = std::path::Path::new(&manifest_dir)
.join("..\\..\\lib\\windows\\amd64"); .join("..\\..\\lib\\windows\\amd64");
println!("cargo:rustc-link-search=native={}", lib_path.display()); println!("cargo:rustc-link-search=native={}", lib_path.display());
// Embed a Common-Controls v6 manifest on Windows so transitive imports
// pulled in by tray-icon / winit (TaskDialogIndirect, themed controls,
// per-monitor DPI) resolve against comctl32 v6. Without this the exe
// crashes at load with "TaskDialogIndirect entry point not found".
#[cfg(target_os = "windows")]
{
println!("cargo:rerun-if-changed=app.manifest");
println!("cargo:rerun-if-changed=app.manifest.rc");
let _ = embed_resource::compile("app.manifest.rc", embed_resource::NONE);
}
} }