Add UAC elevation support with manifest
- Added guruconnect.manifest requesting highestAvailable privileges - Using winres to embed manifest in executable - Added is_elevated() function to detect admin status - Logs elevation status on startup - Manifest includes Windows 7-11 compatibility 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -7,5 +7,26 @@ fn main() -> Result<()> {
|
||||
// Rerun if proto changes
|
||||
println!("cargo:rerun-if-changed=../proto/guruconnect.proto");
|
||||
|
||||
// On Windows, embed the manifest for UAC elevation
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
println!("cargo:rerun-if-changed=guruconnect.manifest");
|
||||
|
||||
let mut res = winres::WindowsResource::new();
|
||||
res.set_manifest_file("guruconnect.manifest");
|
||||
res.set("ProductName", "GuruConnect Agent");
|
||||
res.set("FileDescription", "GuruConnect Remote Desktop Agent");
|
||||
res.set("LegalCopyright", "Copyright (c) AZ Computer Guru");
|
||||
res.set_icon("guruconnect.ico"); // Optional: add icon if available
|
||||
|
||||
// Only compile if the manifest exists
|
||||
if std::path::Path::new("guruconnect.manifest").exists() {
|
||||
if let Err(e) = res.compile() {
|
||||
// Don't fail the build if resource compilation fails
|
||||
eprintln!("Warning: Failed to compile Windows resources: {}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user