pub struct PreparedPath { /* private fields */ }Expand description
A path that has been through prepare: the exact path a worker will open.
§This is not a session-independent path
Preparation resolves against the process current directory, on the
calling thread, which is what stops the meaning of a relative path changing
between submission and execution. It does not expand a drive letter,
because GetFullPathNameW is lexical and never does – and a drive letter
is resolved against the logon session of the token in effect at open time.
A prepared path carried to a worker running under a captured token from
another logon session can therefore still name a different device. That
hazard is open at the workspace level; this type inherits it rather than
resolving it.
§Example
An ordinary path is resolved to its fully qualified form here, on the calling thread, so the meaning cannot change before a worker opens it:
use windows_namespace_request_sys::prepare;
use wtf_string::Wtf16String;
let prepared = prepare(&Wtf16String::from(r"C:\Windows\.\System32"))?;
// `.` is resolved away, exactly as a later CreateFileW would have done.
assert_eq!(prepared.as_wtf16().to_string_lossy(), r"C:\Windows\System32");§Example: a verbatim path is kept exactly
Win32 disables path parsing for a \?\ path, so trailing separators and
. components are literal name components rather than syntax. Preparation
checks it is fully qualified and otherwise leaves it alone:
use windows_namespace_request_sys::prepare;
use wtf_string::Wtf16String;
let verbatim = prepare(&Wtf16String::from(r"\\?\C:\Windows\"))?;
assert_eq!(verbatim.as_wtf16().to_string_lossy(), r"\\?\C:\Windows\");Implementations§
Source§impl PreparedPath
impl PreparedPath
Sourcepub fn into_wtf16(self) -> Wtf16String
pub fn into_wtf16(self) -> Wtf16String
Releases the prepared path’s owned string.
Trait Implementations§
Source§impl Clone for PreparedPath
impl Clone for PreparedPath
Source§fn clone(&self) -> PreparedPath
fn clone(&self) -> PreparedPath
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more