Skip to content

A lightweight, macOS-style dock for Windows 11, with glass visuals, smooth magnification, and Genie effect.

fix(shell): embed common controls v6 manifest and suppress shell extension error dialogs

Saivarshith Mitukula22960bc6012d
diff --git a/apps/dock/Cargo.toml b/apps/dock/Cargo.toml
index 89be063..681b120 100644
--- a/apps/dock/Cargo.toml
+++ b/apps/dock/Cargo.toml
@@ -52,6 +52,7 @@ windows = { workspace = true, features = [
"Win32_Graphics_Gdi",
"Win32_Security",
"Win32_System_Com",
+ "Win32_System_Diagnostics_Debug",
"Win32_System_Diagnostics_ToolHelp",
"Win32_System_Console",
"Win32_System_LibraryLoader",
diff --git a/apps/dock/build.rs b/apps/dock/build.rs
index a4e63b0..fff326c 100644
--- a/apps/dock/build.rs
+++ b/apps/dock/build.rs
@@ -1,12 +1,61 @@
+const MANIFEST: &str = r#"<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
+ <assemblyIdentity
+ type="win32"
+ name="CrafterStation.Muelle"
+ version="1.0.0.0"
+ processorArchitecture="*"
+ />
+ <dependency>
+ <dependentAssembly>
+ <assemblyIdentity
+ type="win32"
+ name="Microsoft.Windows.Common-Controls"
+ version="6.0.0.0"
+ processorArchitecture="*"
+ publicKeyToken="6595b64144ccf1df"
+ language="*"
+ />
+ </dependentAssembly>
+ </dependency>
+ <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
+ <security>
+ <requestedPrivileges>
+ <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
+ </requestedPrivileges>
+ </security>
+ </trustInfo>
+ <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
+ <application>
+ <!-- Windows 10 and Windows 11 -->
+ <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
+ </application>
+ </compatibility>
+ <asmv3:application>
+ <asmv3: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>
+ <longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
+ </asmv3:windowsSettings>
+ </asmv3:application>
+</assembly>
+"#;
+
fn main() {
println!("cargo:rerun-if-changed=../../assets/brand/muelle.ico");
+ println!("cargo:rerun-if-changed=build.rs");
let mut resources = winresource::WindowsResource::new();
resources.set_icon("../../assets/brand/muelle.ico");
// Code signing checks that every signed file names the same product.
resources.set("ProductName", "Muelle");
resources.set("FileDescription", "Muelle dock");
+ // Ensure Microsoft.Windows.Common-Controls 6.0.0.0 is declared so shell
+ // extensions (like utshellext.dll) find modern exports like LoadIconWithScaleDown
+ // (ordinal 381) instead of failing on comctl32 v5 (issue #23).
+ resources.set_manifest(MANIFEST);
if let Err(error) = resources.compile() {
- // The icon is cosmetic: a missing resource compiler must not block the build.
- println!("cargo:warning=no se pudo incrustar el icono: {error}");
+ // The icon and manifest are cosmetic during non-Windows builds or missing rc:
+ // a missing resource compiler must not block the build.
+ println!("cargo:warning=no se pudieron incrustar los recursos: {error}");
}
}
diff --git a/apps/dock/src/main.rs b/apps/dock/src/main.rs
index 6bc7eb5..f72bbbe 100644
--- a/apps/dock/src/main.rs
+++ b/apps/dock/src/main.rs
@@ -41,6 +41,7 @@ use windows::{
Win32::{
Foundation::{ERROR_ALREADY_EXISTS, GetLastError},
System::{
+ Diagnostics::Debug::{SEM_FAILCRITICALERRORS, SEM_NOOPENFILEERRORBOX, SetErrorMode},
Threading::CreateMutexW,
WinRT::{
CreateDispatcherQueueController, DQTAT_COM_STA, DQTYPE_THREAD_CURRENT,
@@ -53,6 +54,11 @@ use windows::{
};
fn main() -> Result<()> {
+ // Suppress system modal error dialogs (missing DLLs, missing ordinals in 3rd-party shell extensions).
+ // SAFETY: Affects process-level error mode without side effects on memory or concurrency.
+ unsafe {
+ let _ = SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
+ }
let args: Vec<String> = env::args().skip(1).collect();
match args
.iter()
diff --git a/apps/dock/src/shell_work.rs b/apps/dock/src/shell_work.rs
index f6e1cb6..b91d7bb 100644
--- a/apps/dock/src/shell_work.rs
+++ b/apps/dock/src/shell_work.rs
@@ -18,10 +18,11 @@ use muelle_shell::{files, launcher, pins::unpin_from_taskbar, recycle_bin};
use serde::{Deserialize, Serialize};
use windows::Win32::{
Foundation::{HANDLE, HWND, WAIT_TIMEOUT},
- System::Com::{
- COINIT_APARTMENTTHREADED, COINIT_DISABLE_OLE1DDE, CoInitializeEx, CoUninitialize,
+ System::{
+ Com::{COINIT_APARTMENTTHREADED, COINIT_DISABLE_OLE1DDE, CoInitializeEx, CoUninitialize},
+ Diagnostics::Debug::{SEM_FAILCRITICALERRORS, SEM_NOOPENFILEERRORBOX, SetErrorMode},
+ Threading::WaitForSingleObject,
},
- System::Threading::WaitForSingleObject,
UI::WindowsAndMessaging::AllowSetForegroundWindow,
};
@@ -266,6 +267,10 @@ fn read_action(input: impl Read) -> Result<Action> {
}
pub fn worker_main() -> Result<()> {
+ // SAFETY: Suppress system modal error popups (missing DLLs or ordinals in 3rd-party shell extensions).
+ unsafe {
+ let _ = SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
+ }
let action = read_action(std::io::stdin().lock())?;
// SAFETY: The helper owns this apartment and balances it after the native
// shell action returns. Shell launch calls wait for activation before exit.
diff --git a/crates/muelle-shell/Cargo.toml b/crates/muelle-shell/Cargo.toml
index 5f9feb0..ea3ad85 100644
--- a/crates/muelle-shell/Cargo.toml
+++ b/crates/muelle-shell/Cargo.toml
@@ -26,6 +26,7 @@ windows = { workspace = true, features = [
"Win32_Storage_Packaging_Appx",
"Win32_System_Com",
"Win32_System_Com_StructuredStorage",
+ "Win32_System_Diagnostics_Debug",
"Win32_System_Power",
"Win32_System_ProcessStatus",
"Win32_System_Registry",
diff --git a/crates/muelle-shell/src/launcher.rs b/crates/muelle-shell/src/launcher.rs
index 9528e7e..43f16ee 100644
--- a/crates/muelle-shell/src/launcher.rs
+++ b/crates/muelle-shell/src/launcher.rs
@@ -8,14 +8,17 @@ use windows::{
Win32::{
Foundation::{CloseHandle, HANDLE, HWND, LPARAM, RECT, WPARAM},
Security::{GetTokenInformation, TOKEN_ELEVATION, TOKEN_QUERY, TokenElevation},
- System::Threading::{OpenProcess, OpenProcessToken, PROCESS_QUERY_LIMITED_INFORMATION},
+ System::{
+ Diagnostics::Debug::{SEM_FAILCRITICALERRORS, SEM_NOOPENFILEERRORBOX, SetErrorMode},
+ Threading::{OpenProcess, OpenProcessToken, PROCESS_QUERY_LIMITED_INFORMATION},
+ },
UI::{
Input::KeyboardAndMouse::{
INPUT, INPUT_0, INPUT_KEYBOARD, KEYBD_EVENT_FLAGS, KEYBDINPUT, KEYEVENTF_KEYUP,
SendInput, VIRTUAL_KEY, VK_A, VK_B, VK_D, VK_ESCAPE, VK_LCONTROL, VK_LWIN, VK_N,
VK_RETURN, VK_S, VK_TAB, VK_V, VK_W,
},
- Shell::{SEE_MASK_NOASYNC, SHELLEXECUTEINFOW, ShellExecuteExW},
+ Shell::{SEE_MASK_FLAG_NO_UI, SEE_MASK_NOASYNC, SHELLEXECUTEINFOW, ShellExecuteExW},
WindowsAndMessaging::{
ASFW_ANY, AllowSetForegroundWindow, FindWindowW, GWL_EXSTYLE, GetForegroundWindow,
GetWindowLongW, GetWindowRect, GetWindowThreadProcessId, IsIconic, IsWindow,
@@ -58,13 +61,18 @@ pub fn open_as_admin(id: &str) -> Result<(), LaunchError> {
fn shell_execute(verb: PCWSTR, id: &str, arguments: Option<&str>) -> Result<(), LaunchError> {
allow_foreground();
+ // SAFETY: Suppresses system modal error popups (e.g. broken shell extensions or missing ordinals).
+ unsafe {
+ let _ = SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
+ }
let file = HSTRING::from(id);
let arguments = arguments.map(HSTRING::from);
let mut request = SHELLEXECUTEINFOW {
cbSize: size_of::<SHELLEXECUTEINFOW>() as u32,
// A disposable caller must finish activation (including DDE) before
// its thread exits. This does not wait for the launched app to close.
- fMask: SEE_MASK_NOASYNC,
+ // SEE_MASK_FLAG_NO_UI suppresses shell error dialogs without hiding UAC prompts.
+ fMask: SEE_MASK_NOASYNC | SEE_MASK_FLAG_NO_UI,
lpVerb: verb,
lpFile: PCWSTR(file.as_ptr()),
lpParameters: arguments