forked from extern/nushell
Bump windows from 0.48.0 to 0.52.0 (#11325)
# Description Bump `windows` to 0.52.0 and fix `is_admin` https://github.com/microsoft/windows-rs/pull/2476 # User-Facing Changes N/A --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
parent
5e5d1ea81b
commit
748d82cec1
20
Cargo.lock
generated
20
Cargo.lock
generated
@ -1788,7 +1788,7 @@ dependencies = [
|
|||||||
"iana-time-zone-haiku",
|
"iana-time-zone-haiku",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
"windows-core",
|
"windows-core 0.51.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -2893,7 +2893,7 @@ dependencies = [
|
|||||||
"uuid",
|
"uuid",
|
||||||
"wax",
|
"wax",
|
||||||
"which 5.0.0",
|
"which 5.0.0",
|
||||||
"windows 0.48.0",
|
"windows 0.52.0",
|
||||||
"winreg",
|
"winreg",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -6136,11 +6136,12 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows"
|
name = "windows"
|
||||||
version = "0.48.0"
|
version = "0.52.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f"
|
checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-targets 0.48.5",
|
"windows-core 0.52.0",
|
||||||
|
"windows-targets 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -6152,6 +6153,15 @@ dependencies = [
|
|||||||
"windows-targets 0.48.5",
|
"windows-targets 0.48.5",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-core"
|
||||||
|
version = "0.52.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9"
|
||||||
|
dependencies = [
|
||||||
|
"windows-targets 0.52.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-sys"
|
name = "windows-sys"
|
||||||
version = "0.45.0"
|
version = "0.45.0"
|
||||||
|
@ -122,7 +122,7 @@ features = [
|
|||||||
"Win32_Security",
|
"Win32_Security",
|
||||||
"Win32_System_Threading",
|
"Win32_System_Threading",
|
||||||
]
|
]
|
||||||
version = "0.48"
|
version = "0.52"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
plugin = ["nu-parser/plugin"]
|
plugin = ["nu-parser/plugin"]
|
||||||
|
@ -66,16 +66,17 @@ fn is_root_impl() -> bool {
|
|||||||
System::Threading::{GetCurrentProcess, OpenProcessToken},
|
System::Threading::{GetCurrentProcess, OpenProcessToken},
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut handle = HANDLE::default();
|
|
||||||
let mut elevated = false;
|
let mut elevated = false;
|
||||||
|
|
||||||
// Checks whether the access token associated with the current process has elevated privileges.
|
// Checks whether the access token associated with the current process has elevated privileges.
|
||||||
// SAFETY: `elevated` only touched by safe code.
|
// SAFETY: `elevated` only touched by safe code.
|
||||||
// `handle` lives long enough, initialized, mutated as out param, used, closed with validity check.
|
// `handle` lives long enough, initialized, mutated, used and closed with validity check.
|
||||||
// `elevation` only read on success and passed with correct `size`.
|
// `elevation` only read on success and passed with correct `size`.
|
||||||
unsafe {
|
unsafe {
|
||||||
|
let mut handle = HANDLE::default();
|
||||||
|
|
||||||
// Opens the access token associated with the current process.
|
// Opens the access token associated with the current process.
|
||||||
if OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &mut handle).as_bool() {
|
if OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &mut handle).is_ok() {
|
||||||
let mut elevation = TOKEN_ELEVATION::default();
|
let mut elevation = TOKEN_ELEVATION::default();
|
||||||
let mut size = std::mem::size_of::<TOKEN_ELEVATION>() as u32;
|
let mut size = std::mem::size_of::<TOKEN_ELEVATION>() as u32;
|
||||||
|
|
||||||
@ -89,7 +90,7 @@ fn is_root_impl() -> bool {
|
|||||||
size,
|
size,
|
||||||
&mut size,
|
&mut size,
|
||||||
)
|
)
|
||||||
.as_bool()
|
.is_ok()
|
||||||
{
|
{
|
||||||
// Whether the token has elevated privileges.
|
// Whether the token has elevated privileges.
|
||||||
// Safe to read as `GetTokenInformation` will not write outside `elevation` and it succeeded
|
// Safe to read as `GetTokenInformation` will not write outside `elevation` and it succeeded
|
||||||
@ -100,7 +101,7 @@ fn is_root_impl() -> bool {
|
|||||||
|
|
||||||
if !handle.is_invalid() {
|
if !handle.is_invalid() {
|
||||||
// Closes the object handle.
|
// Closes the object handle.
|
||||||
CloseHandle(handle);
|
let _ = CloseHandle(handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user