uint WindowsDirectoryShareMode { get; }
Source
Gets the Windows sharing policy used while holding an artifact parent directory open.
Opens collector artifacts without following symbolic links or accepting non-regular files.
FileStream OpenRegularFile(string projectOutputDirectory, string rawResultsDirectory, string candidate, Action? beforeWindowsCandidateOpen = null)
Opens candidate
for reading and validates the opened object itself.
projectOutputDirectory
rawResultsDirectory
candidate
beforeWindowsCandidateOpen
Every untrusted path component is traversed without following links on Unix. On Windows, the opened handle is rejected when it is a reparse point or non-disk file, and its final path must remain beneath the already-open raw-results directory. Unsupported platforms fail closed.
void EnsureWindowsDirectoryIdentityUnchanged(WindowsDirectoryIdentity expected, WindowsDirectoryIdentity actual)
Rejects a Windows directory that no longer names the same opened file-system object.
expected
actual
string[] ValidateUnixRelativeArtifactPath(string relativePath)
Splits a Unix artifact path only after proving that it is a relative descent with no navigation components.
Identifies one Windows file-system object independently of its path.
VolumeSerialNumber
FileId
Associates a Windows directory path with the identity of its opened file-system object.
Path
Identity
Provides the native file-system primitives shared by secure coverage path traversal.
This type contains only the operating-system boundary. Callers remain responsible for choosing no-follow flags, validating object kinds and identities, and retaining handles for the lifetime of each security-sensitive operation.
bool WindowsCreateDirectory(string path, nint securityAttributes)
Atomically creates a fresh Windows directory with the supplied private owner/ACL; an existing path is never accepted.
path
securityAttributes
True only for a newly created directory; the native last error identifies every failure.
(int Directory, int NoFollow) UnixTraversalFlags(bool macos, Architecture architecture)
Selects no-follow directory and file flags for Darwin or a supported Linux architecture.
macos
architecture
The native directory-only and no-follow flags, respectively.
PlatformNotSupportedException
This selects native constants only. Callers still retain and verify the opened object and its ancestors.
int UnixOpen(string path, int flags)
Opens a Unix path with the supplied native flags.
path
flags
A nonnegative file descriptor on success; otherwise -1
.
int UnixOpenAt(int directoryDescriptor, string path, int flags)
Opens a Unix path relative to an existing directory descriptor.
directoryDescriptor
path
flags
A nonnegative file descriptor on success; otherwise -1
.
int UnixOpenAt(int directoryDescriptor, string path, int flags, uint mode)
Opens or creates a Unix path relative to an existing directory descriptor.
directoryDescriptor
path
flags
mode
A nonnegative file descriptor on success; otherwise -1
.
int UnixFStat(int descriptor, nint buffer)
Reads metadata using the native stat layout selected for the current Unix ABI.
descriptor
buffer
Zero on success; otherwise -1
with the native error available.
int InvokeUnixFStat(string platform, Architecture architecture, int descriptor, nint buffer, Func<int, nint, int> unixFStat, Func<int, nint, int> darwinX64FStat)
Dispatches fstat to the ABI-compatible libc symbol.
Intel Darwin's 64-bit inode structure is exposed as fstat$INODE64
; arm64 uses fstat
.
int UnixFChmod(int descriptor, uint mode)
Changes the permissions of an open Unix descriptor.
descriptor
mode
Zero on success; otherwise -1
.
SafeFileHandle WindowsCreateFile(string fileName, uint desiredAccess, uint shareMode, nint securityAttributes, uint creationDisposition, uint flagsAndAttributes, nint templateFile)
Opens or creates a Windows file-system object without applying managed path traversal.
fileName
desiredAccess
shareMode
securityAttributes
creationDisposition
flagsAndAttributes
templateFile
A handle that is invalid when the native open fails.
string WindowsExtendedPath(string absolutePath)
Formats an already absolute Windows path for native Unicode file APIs without the legacy MAX_PATH limit.
absolutePath
The extended drive or UNC spelling, preserving an existing extended prefix.
This changes only native path spelling. Callers still validate containment, reparse points, identity and access rights.
bool WindowsGetFileInformationByHandleEx(SafeFileHandle handle, int fileInformationClass, out WindowsFileAttributeTagInformation fileInformation, uint bufferSize)
Reads the attribute and reparse-tag metadata for an open Windows handle.
handle
fileInformationClass
fileInformation
bufferSize
fileInformation
in bytes.
true
on success; otherwise false
.
bool WindowsGetFileBasicInformationByHandleEx(SafeFileHandle handle, int fileInformationClass, out WindowsFileBasicInformation fileInformation, uint bufferSize)
Reads basic timestamps and attributes for an open Windows file handle.
handle
fileInformationClass
fileInformation
bufferSize
fileInformation
in bytes.
true
on success; otherwise false
.
bool WindowsGetFileInformationByHandle(SafeFileHandle handle, out WindowsByHandleFileInformation fileInformation)
Reads stable file-system identity metadata for an open Windows handle.
handle
fileInformation
true
on success; otherwise false
.
uint WindowsGetFileType(SafeFileHandle handle)
Gets the Windows object type associated with an open handle.
handle
The native file-type constant, or zero when the call fails.
uint WindowsGetFinalPathNameByHandle(SafeFileHandle handle, Span<char> path, uint flags)
Resolves the final Windows path for an open handle into the supplied buffer.
handle
path
flags
The path length excluding the terminator, or the required buffer length when the buffer is too small; zero indicates failure and leaves the native error available to the caller.
Contains Windows file attributes and the reparse tag for an open handle.
Contains native Windows basic timestamps and attributes.
Contains stable identity and size metadata for an open Windows handle.
Represents the blittable two-word layout of a native Windows FILETIME
.