Share via


ReparsePointAware.PinAndRequireNoReparsePoints(String, Boolean) Method

Definition

Opens a SafeFileHandle to an existing file or directory and confirms that the resulting canonical path matches that of the given path. The resulting SafeFileHandle is IDisposable and can be used within using statements to ensure that subsequent file operations are writing to paths without reparse points.

public static Microsoft.Win32.SafeHandles.SafeFileHandle PinAndRequireNoReparsePoints (string expectedPath, bool asDirectory);
static member PinAndRequireNoReparsePoints : string * bool -> Microsoft.Win32.SafeHandles.SafeFileHandle
Public Shared Function PinAndRequireNoReparsePoints (expectedPath As String, asDirectory As Boolean) As SafeFileHandle

Parameters

expectedPath
String

Expected path to pin.

asDirectory
Boolean

Whether it is a file or directory path.

Returns

SafeFileHandle to the file/directory that was specified.

Exceptions

The path contains Windows Reparse Points or otherwise cannot be accessed.

Applies to