pub struct QueryFinalPath { /* private fields */ }Expand description
An owned, marshalable parameter set for GetFinalPathNameByHandleW.
§Example
use std::fs;
use std::os::windows::io::AsHandle;
use windows_namespace_request_sys::final_path::QueryFinalPath;
use windows_namespace_request_sys::CapturedHandle;
let path = std::env::temp_dir().join(format!("wnrs-fp-{}.tmp", std::process::id()));
fs::write(&path, b"example")?;
let file = fs::File::open(&path)?;
// Built here; it would resolve identically on a worker, which is the point:
// Globazog performs this on its submitting thread today.
let resolved = QueryFinalPath::new(CapturedHandle::capture(file.as_handle())?)
.perform()?
.to_string_lossy();
// The result is a verbatim path, so it names the object unambiguously.
assert!(resolved.starts_with(r"\\?\"), "unexpected: {resolved}");
assert!(resolved.ends_with(".tmp"), "unexpected: {resolved}");Implementations§
Source§impl QueryFinalPath
impl QueryFinalPath
Sourcepub fn new(handle: CapturedHandle) -> Self
pub fn new(handle: CapturedHandle) -> Self
Begins a request against handle, in the form the audited watcher uses.
Sourcepub fn with_flags(self, flags: FinalPathFlags) -> Self
pub fn with_flags(self, flags: FinalPathFlags) -> Self
Sets dwFlags.
Sourcepub fn handle(&self) -> &CapturedHandle
pub fn handle(&self) -> &CapturedHandle
The owned duplicate of the handle being resolved.
Sourcepub fn flags(&self) -> FinalPathFlags
pub fn flags(&self) -> FinalPathFlags
The flags the call will use.
Sourcepub fn try_clone(&self) -> Result<Self, HandleCaptureError>
pub fn try_clone(&self) -> Result<Self, HandleCaptureError>
Copies the request, duplicating the handle.
§Errors
Returns the handle-capture failure when the handle cannot be duplicated.
Sourcepub fn perform(&self) -> Result<Wtf16String, FinalPathError>
pub fn perform(&self) -> Result<Wtf16String, FinalPathError>
Performs the call on the calling thread, growing the buffer as needed.
§Errors
Returns FinalPathError::Win32 with the raw code unaltered, or
FinalPathError::Unstable if the required size kept changing.
Trait Implementations§
Source§impl Debug for QueryFinalPath
impl Debug for QueryFinalPath
Auto Trait Implementations§
impl Freeze for QueryFinalPath
impl RefUnwindSafe for QueryFinalPath
impl Send for QueryFinalPath
impl Sync for QueryFinalPath
impl Unpin for QueryFinalPath
impl UnsafeUnpin for QueryFinalPath
impl UnwindSafe for QueryFinalPath
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more