我目前正在为Windows x86开发一个需要以管理员身份运行的Rust应用程序.因此,我编写了一个Windows list ,允许您请求管理员模式.
以下是app.manifest
个(在项目的根部):
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
这是Cargo.toml
%的文件
[package]
name = "wrapper"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
named-lock = "0.3.0"
rand = "0.8.5"
reqwest = "0.11.24"
tokio = { version = "1.36.0", features = ["rt", "rt-multi-thread"] }
winapi = { version = "0.3.9", features = ["processthreadsapi", "securitybaseapi", "winnt", "fileapi", "minwinbase", "iphlpapi", "winsock2", "ws2def"] }
windows-service = "0.6.0"
[profile.release]
opt-level = 3
[package.metadata.win]
manifest = "app.manifest"
问题是,当我编译Via Cargo(cargo build --release --target=i686-pc-windows-gnu
)时, list 似乎没有被考虑在内.