Skip to main content

QueryFinalPath

Struct QueryFinalPath 

Source
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

Source

pub fn new(handle: CapturedHandle) -> Self

Begins a request against handle, in the form the audited watcher uses.

Source

pub fn with_flags(self, flags: FinalPathFlags) -> Self

Sets dwFlags.

Source

pub fn handle(&self) -> &CapturedHandle

The owned duplicate of the handle being resolved.

Source

pub fn flags(&self) -> FinalPathFlags

The flags the call will use.

Source

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.

Source

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

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Request for QueryFinalPath

Source§

type Error = FinalPathError

How performing it can fail. Read more
Source§

type Output = WtfString<Wtf16>

What performing the request produces.
Source§

fn perform(&self) -> Result<Wtf16String, FinalPathError>

Performs the request on the calling thread. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.