Microsoft.IO.Redist Creates a directory symbolic link identified by that points to . The absolute path where the symbolic link should be created. The target directory of the symbolic link. A instance that wraps the newly created directory symbolic link. or is . or is empty. -or- is not an absolute path. -or- or contains invalid path characters. A file or directory already exists in the location of . -or- An I/O error occurred. Gets the target of the specified directory link. The path of the directory link. to follow links to the final target; to return the immediate next link. A instance if exists, independently if the target exists or not. if is not a link. The directory on does not exist. -or- The link's file system entry type is inconsistent with that of its target. -or- Too many levels of symbolic links. When is , the maximum number of symbolic links that are followed are 40 on Unix and 63 on Windows. Provides a lower level view of to help process and filter find results. Provides a lower level view of to help process and filter find results. Returns the full path for the find results, based on the initially provided path. A string representing the full path. Gets the full path of the directory this entry resides in. The full path of this entry's directory. Gets the full path of the root directory used for the enumeration. The root directory. Gets the root directory for the enumeration as specified in the constructor. The original root directory. Gets the file name for this entry. This entry's file name. Gets the attributes for this entry. The attributes for this entry. Gets the length of the file, in bytes. The file length in bytes. Gets the creation time for the entry or the oldest available time stamp if the operating system does not support creation time stamps. The creation time for the entry. Gets a datetime offset that represents the last access time in UTC. The last access time in UTC. Gets a datetime offset that represents the last write time in UTC. The last write time in UTC. Gets a value that indicates whether this entry is a directory. if the entry is a directory; otherwise, . Gets a value that indicates whether the file has the hidden attribute. if the file has the hidden attribute; otherwise, . Converts the value of this instance to a . The value of this instance as a . Returns the full path of the find result. A string representing the full path. Enumerable that allows utilizing custom filter predicates and tranform delegates. Delegate for filtering out find results. Delegate for transforming raw find data into a result. Validates the directory and expression strings to check that they have no invalid characters, any special DOS wildcard characters in Win32 in the expression get replaced with their proper escaped representation, and if the expression string begins with a directory name, the directory name is moved and appended at the end of the directory string. A reference to a directory string that we will be checking for normalization. A reference to a expression string that we will be checking for normalization. The kind of matching we want to check in the expression. If the value is Win32, we will replace special DOS wild characters to their safely escaped representation. This replacement does not affect the normalization status of the expression. if the directory reference string get modified inside this function due to the expression beginning with a directory name. if the directory reference string was not modified. The expression is a rooted path. -or- The directory or the expression reference strings contain a null character. The match type is out of the range of the valid MatchType enum values. Enumerates the file system elements of the provided type that are being searched and filtered by a . The type of the result produced by this file system enumerator. Enumerates the file system elements of the provided type that are being searched and filtered by a . Encapsulates a find operation. The directory to search in. Enumeration options to use. Encapsulates a find operation. The directory to search in. Whether the directory path is already normalized or not. Enumeration options to use. When overridden in a derived class, determines whether the specified file system entry should be included in the results. A file system entry reference. if the specified file system entry should be included in the results; otherwise, . When overridden in a derived class, determines whether the specified file system entry should be recursed. A file system entry reference. if the specified directory entry should be recursed into; otherwise, . When overridden in a derived class, generates the result type from the current entry. A file system entry reference. The result type from the current entry. When overridden in a derived class, this method is called whenever the end of a directory is reached. The directory path as a read-only span. When overridden in a derived class, returns a value that indicates whether to continue execution or throw the default exception. The native error code. to continue; to throw the default exception for the given error. Gets the currently visited element. The currently visited element. Gets the currently visited object. The currently visited object. This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface. Always throws . Releases the resources used by the current instance of the class. When overridden in a derived class, releases the unmanaged resources used by the class and optionally releases the managed resources. to release both managed and unmanaged resources; to release only unmanaged resources. Fills the buffer with the next set of data. 'true' if new data was found Simple wrapper to allow creating a file handle for an existing directory. Advances the enumerator to the next item of the . if the enumerator successfully advanced to the next item; if the end of the enumerator has been passed. Provides methods for matching file system names. Translates the given Win32 expression. Change '*' and '?' to '<', '>' and '"' to match Win32 behavior. The expression to translate. A string with the translated Win32 expression. For compatibility, Windows changes some wildcards to provide a closer match to historical DOS 8.3 filename matching. Verifies whether the given Win32 expression matches the given name. Supports the following wildcards: '*', '?', '<', '>', '"'. The backslash character '\' escapes. The expression to match with, such as "*.foo". The name to check against the expression. to ignore case (default), if the match should be case-sensitive. if the given expression matches the given name; otherwise, . The syntax of the parameter is based on the syntax used by FileSystemWatcher, which is based on [RtlIsNameInExpression](/windows/win32/devnotes/rtlisnameinexpression), which defines the rules for matching DOS wildcards (`'*'`, `'?'`, `'<'`, `'>'`, `'"'`). Matching will not correspond to Win32 behavior unless you transform the expression using . Verifies whether the given expression matches the given name. Supports the following wildcards: '*' and '?'. The backslash character '\\' escapes. The expression to match with. The name to check against the expression. to ignore case (default); if the match should be case-sensitive. if the given expression matches the given name; otherwise, . Provides file and directory enumeration options. For internal use. These are the options we want to use if calling the existing Directory/File APIs where you don't explicitly specify EnumerationOptions. Internal singleton for default options. Initializes a new instance of the class with the recommended default options. Converts SearchOptions to FindOptions. Throws if undefined SearchOption. Gets or sets a value that indicates whether to recurse into subdirectories while enumerating. The default is . to recurse into subdirectories; otherwise, . Gets or sets a value that indicates whether to skip files or directories when access is denied (for example, or ). The default is . to skip innacessible files or directories; otherwise, . Gets or sets the suggested buffer size, in bytes. The default is 0 (no suggestion). The buffer size. Not all platforms use user allocated buffers, and some require either fixed buffers or a buffer that has enough space to return a full result. One scenario where this option is useful is with remote share enumeration on Windows. Having a large buffer may result in better performance as more results can be batched over the wire (for example, over a network share). A "large" buffer, for example, would be 16K. Typical is 4K. The suggested buffer size will not be used if it has no meaning for the native APIs on the current platform or if it would be too small for getting at least a single result. Gets or sets the attributes to skip. The default is FileAttributes.Hidden | FileAttributes.System. The attributes to skip. Gets or sets the match type. One of the enumeration values that indicates the match type. For APIs that allow specifying a match expression, this property allows you to specify how to interpret the match expression. The default is simple matching where '*' is always 0 or more characters and '?' is a single character. Gets or sets the case matching behavior. One of the enumeration values that indicates the case matching behavior. For APIs that allow specifying a match expression, this property allows you to specify the case matching behavior. The default is to match platform defaults, which are gleaned from the case sensitivity of the temporary folder. Gets or sets a value that indicates the maximum directory depth to recurse while enumerating, when is set to . A number that represents the maximum directory depth to recurse while enumerating. The default value is . If is set to a negative number, the default value is used. If is set to zero, enumeration returns the contents of the initial directory. Gets or sets a value that indicates whether to return the special directory entries "." and "..". to return the special directory entries "." and ".."; otherwise, . Copies an existing file to a new file. An exception is raised if the destination file already exists. Copies an existing file to a new file. If is false, an exception will be raised if the destination exists. Otherwise it will be overwritten. Creates a file symbolic link identified by that points to . The path where the symbolic link should be created. The path of the target to which the symbolic link points. A instance that wraps the newly created file symbolic link. or is . or is empty. -or- or contains a null character. A file or directory already exists in the location of . -or- An I/O error occurred. Gets the target of the specified file link. The path of the file link. to follow links to the final target; to return the immediate next link. A instance if exists, independently if the target exists or not. if is not a link. The file on does not exist. -or- The link's file system entry type is inconsistent with that of its target. -or- Too many levels of symbolic links. When is , the maximum number of symbolic links that are followed are 40 on Unix and 63 on Windows. Gets reparse point information associated to . The immediate link target, absolute or relative or null if the file is not a supported link. Returns 0 on success, otherwise a Win32 error code. Note that classes should use -1 as the uninitialized state for dataInitialized. The file path from which the file attribute information will be filled. A struct that will contain the attribute information. Return the error code for not found errors? If this instance represents a link, returns the link target's path. If a link does not exist in , or this instance does not represent a link, returns . Creates a symbolic link located in that points to the specified . The path of the symbolic link target. is . is empty. -or- This instance was not created passing an absolute path. -or- contains invalid path characters. A file or directory already exists in the location of . -or- An I/O error occurred. Gets the target of the specified link. to follow links to the final target; to return the immediate next link. A instance if the link exists, independently if the target exists or not; if this file or directory is not a link. The file or directory does not exist. -or- The link's file system entry type is inconsistent with that of its target. -or- Too many levels of symbolic links. When is , the maximum number of symbolic links that are followed are 40 on Unix and 63 on Windows. Returns the original path. Use FullName or Name properties for the full path or file/directory name. Specifies the type of character casing to match. Matches using the default casing for the given platform. Matches respecting character casing. Matches ignoring character casing. Specifies the type of wildcard matching to use. Matches using '*' and '?' wildcards. * matches from zero to any amount of characters. ? matches exactly one character. *.* matches any name with a period in it (with , this would match all items). Match using Win32 DOS style matching semantics.'*', '?', '<', '>', and '"' are all considered wildcards. Matches in a traditional DOS / Windows command prompt way. *.* matches all files. ? matches collapse to periods. file.??t will match file.t, file.at, and file.txt. Enum describing whether the search operation should retrieve files/directories from the current directory alone or should include all the subdirectories also. Include only the current directory in the search operation Include the current directory and all the sub-directories underneath it including reparse points in the search operation. This will traverse reparse points (i.e, mounted points and symbolic links) recursively. If the directory structure searched contains a loop because of hard links, the search operation will go on for ever. Simple wrapper to safely disable the normal media insertion prompt for removable media (floppies, cds, memory cards, etc.) Note that removable media file systems lazily load. After starting the OS they won't be loaded until you have media in the drive- and as such the prompt won't happen. You have to have had media in at least once to get the file system to load and then have removed it. Returns the directory portion of a file path. This method effectively removes the last segment of the given file path, i.e. it returns a string consisting of all characters up to but not including the last backslash ("\") in the file path. The returned value is null if the specified path is null, empty, or a root (such as "\", "C:", or "\\server\share"). Directory separators are normalized in the returned string. Returns the directory portion of a file path. The returned value is empty if the specified path is null, empty, or a root (such as "\", "C:", or "\\server\share"). Unlike the string overload, this method will not normalize directory separators. Returns the extension of the given path. The returned value includes the period (".") character of the extension except when you have a terminal period when you get string.Empty, such as ".exe" or ".cpp". The returned value is null if the given path is null or empty if the given path does not include an extension. Returns the extension of the given path. The returned value is an empty ReadOnlySpan if the given path does not include an extension. Returns the name and extension parts of the given path. The resulting string contains the characters of path that follow the last separator in path. The resulting string is null if path is null. The returned ReadOnlySpan contains the characters of the path that follows the last separator in path. Returns the characters between the last separator and last (.) in the path. Returns a cryptographically strong random 8.3 string that can be used as either a folder name or a file name. Returns true if the path is fixed to a specific drive or UNC path. This method does no validation of the path (URIs will be returned as relative as a result). Returns false if the path specified is relative to the current drive or working directory. Handles paths that use the alternate directory separator. It is a frequent mistake to assume that rooted paths are not relative. This isn't the case. "C:a" is drive relative- meaning that it will be resolved against the current directory for C: (rooted, but relative). "C:\a" is rooted and not relative (the current directory will not be used to modify the path). Thrown if is null. Tests if a path's file name includes a file extension. A trailing period is not considered an extension. Create a relative path from one path to another. Paths will be resolved before calculating the difference. Default path comparison for the active platform will be used (OrdinalIgnoreCase for Windows or Mac, Ordinal for Unix). The source path the output should be relative to. This path is always considered to be a directory. The destination path. The relative path or if the paths don't share the same root. Thrown if or is null or an empty string. Trims one trailing directory separator beyond the root of the path. Trims one trailing directory separator beyond the root of the path. Returns true if the path ends in a directory separator. Returns true if the path ends in a directory separator. Unlike the string overload, this method will not normalize directory separators. Returns the volume name for dos, UNC and device paths. Returns offset as -1 if the path is not in Unc format, otherwise returns the root length. Contains internal volume helpers that are shared between many projects. Wrapper to help with path normalization. Normalize the given path. Normalizes via Win32 GetFullPathName(). Path to normalize Thrown if we have a string that is too large to fit into a UNICODE_STRING. Thrown if the path is empty. Normalized path Normalize the given path. Exceptions are the same as the string overload. Calls GetFullPathName on the given path. The path name. MUST be null terminated after the span. Builder that will store the result. Contains internal path helpers that are shared between many projects. Contains internal path helpers that are shared between many projects. Contains internal path helpers that are shared between many projects. Returns true if the path starts in a directory separator. Get the common path length from the start of the string. Gets the count of common characters from the left optionally ignoring case Returns true if the two paths have the same root Try to remove relative segments from the given path (without combining with a root). Input path The length of the root of the given path Try to remove relative segments from the given path (without combining with a root). Input path The length of the root of the given path String builder that will store the result "true" if the path was modified Trims one trailing directory separator beyond the root of the path. Returns true if the path ends in a directory separator. Trims one trailing directory separator beyond the root of the path. Returns true if the path ends in a directory separator. Returns true if the given character is a valid drive letter Adds the extended path prefix (\\?\) if not already a device path, IF the path is not relative, AND the path is more than 259 characters. (> MAX_PATH + null). This will also insert the extended prefix if the path ends with a period or a space. Trailing periods and spaces are normally eaten away from paths during normalization, but if we see such a path at this point it should be normalized and has retained the final characters. (Typically from one of the *Info classes) Adds the extended path prefix (\\?\) if not relative or already a device path. Returns true if the path uses any of the DOS device path syntaxes. ("\\.\", "\\?\", or "\??\") Returns true if the path is a device UNC (\\?\UNC\, \\.\UNC\) Returns true if the path uses the canonical form of extended syntax ("\\?\" or "\??\"). If the path matches exactly (cannot use alternate directory separators) Windows will skip normalization and path length checks. Gets the length of the root of the path (drive, share, etc.). Returns true if the path specified is relative to the current drive or working directory. Returns false if the path is fixed to a specific drive or UNC path. This method does no validation of the path (URIs will be returned as relative as a result). Handles paths that use the alternate directory separator. It is a frequent mistake to assume that rooted paths (Path.IsPathRooted) are not relative. This isn't the case. "C:a" is drive relative- meaning that it will be resolved against the current directory for C: (rooted, but relative). "C:\a" is rooted and not relative (the current directory will not be used to modify the path). True if the given character is a directory separator. Normalize separators in the given path. Converts forward slashes into back slashes and compresses slash runs, keeping initial 2 if present. Also trims initial whitespace in front of "rooted" paths (see PathStartSkip). This effectively replicates the behavior of the legacy NormalizePath when it was called with fullCheck=false and expandShortpaths=false. The current NormalizePath gets directory separator normalization from Win32's GetFullPathName(), which will resolve relative paths and as such can't be used here (and is overkill for our uses). Like the current NormalizePath this will not try and analyze periods/spaces within directory segments. The only callers that used to use Path.Normalize(fullCheck=false) were Path.GetDirectoryName() and Path.GetPathRoot(). Both usages do not need trimming of trailing whitespace here. GetPathRoot() could technically skip normalizing separators after the second segment- consider as a future optimization. For legacy .NET Framework behavior with ExpandShortPaths: - It has no impact on GetPathRoot() so doesn't need consideration. - It could impact GetDirectoryName(), but only if the path isn't relative (C:\ or \\Server\Share). In the case of GetDirectoryName() the ExpandShortPaths behavior was undocumented and provided inconsistent results if the path was fixed/relative. For example: "C:\PROGRA~1\A.TXT" would return "C:\Program Files" while ".\PROGRA~1\A.TXT" would return ".\PROGRA~1". If you ultimately call GetFullPath() this doesn't matter, but if you don't or have any intermediate string handling could easily be tripped up by this undocumented behavior. We won't match this old behavior because: 1. It was undocumented 2. It was costly (extremely so if it actually contained '~') 3. Doesn't play nice with string logic 4. Isn't a cross-plat friendly concept/behavior Returns true if the path is effectively empty for the current OS. For unix, this is empty or null. For Windows, this is empty, null, or just spaces ((char)32). Returns a comparison that can be used to compare file and directory names for equality. Gets whether the system is case-sensitive. Provides static methods for converting from Win32 errors codes to exceptions, HRESULTS and error messages. Converts, resetting it, the last Win32 error into a corresponding object, optionally including the specified path in the error message. Converts the specified Win32 error into a corresponding object, optionally including the specified path in the error message. If not already an HRESULT, returns an HRESULT for the specified Win32 error code. Returns a Win32 error code for the specified HRESULT if it came from FACILITY_WIN32 If not, returns the HRESULT unchanged Returns a string message for the specified Win32 error code. Get a pinnable reference to the builder. Does not ensure there is a null char after This overload is pattern matched in the C# 7.3+ compiler so you can omit the explicit method call, and write eg "fixed (char* c = builder)" Get a pinnable reference to the builder. Ensures that the builder has a null char after Returns the underlying storage of the builder. Returns a span around the contents of the builder. Ensures that the builder has a null char after Resize the internal buffer either by doubling current buffer size or by adding to whichever is greater. Number of chars requested beyond current position. Returns a string from the given span, terminating the string at null if present. Gets the null-terminated string length of the given span. Returns true if the given string equals the given span. The span's logical length is to the first null if present. An attribute used to indicate a GC transition should be skipped when making an unmanaged function call. Example of a valid use case. The Win32 `GetTickCount()` function is a small performance related function that reads some global memory and returns the value. In this case, the GC transition overhead is significantly more than the memory read. using System; using System.Runtime.InteropServices; class Program { [DllImport("Kernel32")] [SuppressGCTransition] static extern int GetTickCount(); static void Main() { Console.WriteLine($"{GetTickCount()}"); } } This attribute is ignored if applied to a method without the . Forgoing this transition can yield benefits when the cost of the transition is more than the execution time of the unmanaged function. However, avoiding this transition removes some of the guarantees the runtime provides through a normal P/Invoke. When exiting the managed runtime to enter an unmanaged function the GC must transition from Cooperative mode into Preemptive mode. Full details on these modes can be found at https://github.com/dotnet/runtime/blob/main/docs/coding-guidelines/clr-code-guide.md#2.1.8. Suppressing the GC transition is an advanced scenario and should not be done without fully understanding potential consequences. One of these consequences is an impact to Mixed-mode debugging (https://docs.microsoft.com/visualstudio/debugger/how-to-debug-in-mixed-mode). During Mixed-mode debugging, it is not possible to step into or set breakpoints in a P/Invoke that has been marked with this attribute. A workaround is to switch to native debugging and set a breakpoint in the native function. In general, usage of this attribute is not recommended if debugging the P/Invoke is important, for example stepping through the native code or diagnosing an exception thrown from the native code. The runtime may load the native library for method marked with this attribute in advance before the method is called for the first time. Usage of this attribute is not recommended for platform neutral libraries with conditional platform specific code. The P/Invoke method that this attribute is applied to must have all of the following properties: * Native function always executes for a trivial amount of time (less than 1 microsecond). * Native function does not perform a blocking syscall (e.g. any type of I/O). * Native function does not call back into the runtime (e.g. Reverse P/Invoke). * Native function does not throw exceptions. * Native function does not manipulate locks or other concurrency primitives. Consequences of invalid uses of this attribute: * GC starvation. * Immediate runtime termination. * Data corruption. Base type for all platform-specific API attributes. Records the platform that the project targeted. Records the operating system (and minimum version) that supports an API. Multiple attributes can be applied to indicate support on multiple operating systems. Callers can apply a or use guards to prevent calls to APIs on unsupported operating systems. A given platform should only be specified once. Marks APIs that were removed in a given operating system version. Primarily used by OS bindings to indicate APIs that are only available in earlier versions. Annotates a custom guard field, property or method with a supported platform name and optional version. Multiple attributes can be applied to indicate guard for multiple supported platforms. Callers can apply a to a field, property or method and use that field, property or method in a conditional or assert statements in order to safely call platform specific APIs. The type of the field or property should be boolean, the method return type should be boolean in order to be used as platform guard. Annotates the custom guard field, property or method with an unsupported platform name and optional version. Multiple attributes can be applied to indicate guard for multiple unsupported platforms. Callers can apply a to a field, property or method and use that field, property or method in a conditional or assert statements as a guard to safely call APIs unsupported on those platforms. The type of the field or property should be boolean, the method return type should be boolean in order to be used as platform guard. The target file '{0}' is a directory, not a file. Invalid File or Directory attributes value. Second path fragment must not be a drive or UNC name. Path must not be a drive. File name cannot be null. Path cannot be null. Enum value was out of legal range. Empty file name is not legal. Empty path name is not legal. Illegal characters in path '{0}'. Invalid seek origin. The directory specified, '{0}', is not a subdirectory of '{1}'. Path cannot be the empty string or all whitespace. Cannot create '{0}' because a file or directory with the same name already exists. The specified directory '{0}' cannot be created. Unable to read beyond the end of the stream. The file '{0}' already exists. Unable to find the specified file. Could not find file '{0}'. The file is too long. This operation is currently limited to supporting files less than 2 gigabytes in size. The link's file system entry type is inconsistent with that of its target: {0} Could not find a part of the path. Could not find a part of the path '{0}'. The specified file name or path is too long, or a component of the specified path is too long. The process cannot access the file '{0}' because it is being used by another process. The process cannot access the file because it is being used by another process. Source and destination path must be different. Source and destination path must have identical roots. Move will not work across volumes. [Unknown] Access to the path is denied. Access to the path '{0}' is denied. File encryption is not supported on this platform. The path '{0}' is too long, or a component of the specified path is too long. Basepath argument is not fully qualified. The path is empty. Drive name must be a root directory (i.e. 'C:\') or a drive letter ('C'). Non-negative number required. Specifies that null is allowed as an input even if the corresponding type disallows it. Specifies that null is disallowed as an input even if the corresponding type allows it. Specifies that an output may be null even if the corresponding type disallows it. Specifies that an output will not be null even if the corresponding type allows it. Specifies that an input argument was not null when the call returns. Specifies that when a method returns , the parameter may be null even if the corresponding type disallows it. Initializes the attribute with the specified return value condition. The return value condition. If the method returns this value, the associated parameter may be null. Gets the return value condition. Specifies that when a method returns , the parameter will not be null even if the corresponding type allows it. Initializes the attribute with the specified return value condition. The return value condition. If the method returns this value, the associated parameter will not be null. Gets the return value condition. Specifies that the output will be non-null if the named parameter is non-null. Initializes the attribute with the associated parameter name. The associated parameter name. The output will be non-null if the argument to the parameter specified is non-null. Gets the associated parameter name. Applied to a method that will never return under any circumstance. Specifies that the method will not return if the associated Boolean parameter is passed the specified value. Initializes the attribute with the specified parameter value. The condition parameter value. Code after the method will be considered unreachable by diagnostics if the argument to the associated parameter matches this value. Gets the condition parameter value. Specifies that the method or property will ensure that the listed field and property members have not-null values. Initializes the attribute with a field or property member. The field or property member that is promised to be not-null. Initializes the attribute with the list of field and property members. The list of field and property members that are promised to be not-null. Gets field or property member names. Specifies that the method or property will ensure that the listed field and property members have not-null values when returning with the specified return value condition. Initializes the attribute with the specified return value condition and a field or property member. The return value condition. If the method returns this value, the associated parameter will not be null. The field or property member that is promised to be not-null. Initializes the attribute with the specified return value condition and list of field and property members. The return value condition. If the method returns this value, the associated parameter will not be null. The list of field and property members that are promised to be not-null. Gets the return value condition. Gets field or property member names. Blittable version of Windows BOOL type. It is convenient in situations where manual marshalling is required, or to avoid overhead of regular bool marshalling. Some Windows APIs return arbitrary integer values although the return type is defined as BOOL. It is best to never compare BOOL to TRUE. Always use bResult != BOOL.FALSE or bResult == BOOL.FALSE . Blittable version of Windows BOOLEAN type. It is convenient in situations where manual marshalling is required, or to avoid overhead of regular bool marshalling. Some Windows APIs return arbitrary integer values although the return type is defined as BOOLEAN. It is best to never compare BOOLEAN to TRUE. Always use bResult != BOOLEAN.FALSE or bResult == BOOLEAN.FALSE . The link target is a directory. Allows creation of symbolic links from a process that is not elevated. Requires Windows 10 Insiders build 14972 or later. Developer Mode must first be enabled on the machine before this option will function. Creates a symbolic link. The symbolic link to be created. The name of the target for the symbolic link to be created. If it has a device name associated with it, the link is treated as an absolute link; otherwise, the link is treated as a relative link. if the link target is a directory; otherwise. WARNING: This method does not implicitly handle long paths. Use FindFirstFile. Returns a string message for the specified Win32 error code. WARNING: This method does not implicitly handle long paths. Use GetFileAttributesEx. WARNING: This method does not implicitly handle long paths. Use GetFullPathName or PathHelper. WARNING: This method does not implicitly handle long paths. Use GetFullPath/PathHelper. WARNING: This method does not implicitly handle long paths. Use CopyFileEx. WARNING: This method does not implicitly handle long paths. Use CreateDirectory. WARNING: This method does not implicitly handle long paths. Use CreateFile. WARNING: This method does not implicitly handle long paths. Use CreateFile. WARNING: This method does not implicitly handle long paths. Use DeleteFile. WARNING: This method does not implicitly handle long paths. Use DeleteVolumeMountPoint. WARNING: This method does not implicitly handle long paths. Use MoveFile. Moves a file or directory, optionally overwriting existing destination file. NOTE: overwrite must be false for directories. Source file or directory Destination file or directory True to overwrite existing destination file. NOTE: must pass false for directories as overwrite of directories is not supported. WARNING: This method does not implicitly handle long paths. Use RemoveDirectory. WARNING: This method does not implicitly handle long paths. Use SetFileAttributes. WARNING: This method does not implicitly handle long paths. Use EncryptFile. WARNING: This method does not implicitly handle long paths. Use DecryptFile. 100-nanosecond intervals (ticks) since January 1, 1601 (UTC). For NT times that are defined as longs (LARGE_INTEGER, etc.). Do NOT use for FILETIME unless you are POSITIVE it will fall on an 8 byte boundary. 100-nanosecond intervals (ticks) since January 1, 1601 (UTC). OBJECT_ATTRIBUTES structure. The OBJECT_ATTRIBUTES structure specifies attributes that can be applied to objects or object handles by routines that create objects and/or return handles to objects. Optional handle to root object directory for the given ObjectName. Can be a file system directory or object manager directory. Name of the object. Must be fully qualified if RootDirectory isn't set. Otherwise is relative to RootDirectory. If null, object will receive default security settings. Optional quality of service to be applied to the object. Used to indicate security impersonation level and context tracking mode (dynamic or static). Equivalent of InitializeObjectAttributes macro with the exception that you can directly set SQOS. This handle can be inherited by child processes of the current process. This flag only applies to objects that are named within the object manager. By default, such objects are deleted when all open handles to them are closed. If this flag is specified, the object is not deleted when all open handles are closed. Only a single handle can be open for this object. Lookups for this object should be case insensitive. Create on existing object should open, not fail with STATUS_OBJECT_NAME_COLLISION. Open the symbolic link, not its target. Length in bytes, not including the null terminator, if any. Max size of the buffer in bytes SECURITY_QUALITY_OF_SERVICE structure. Used to support client impersonation. Client specifies this to a server to allow it to impersonate the client. SECURITY_IMPERSONATION_LEVEL enumeration values. [SECURITY_IMPERSONATION_LEVEL] The server process cannot obtain identification information about the client and cannot impersonate the client. [SecurityAnonymous] The server process can obtain identification information about the client, but cannot impersonate the client. [SecurityIdentification] The server process can impersonate the client's security context on it's local system. [SecurityImpersonation] The server process can impersonate the client's security context on remote systems. [SecurityDelegation] SECURITY_CONTEXT_TRACKING_MODE The server is given a snapshot of the client's security context. [SECURITY_STATIC_TRACKING] The server is continually updated with changes. [SECURITY_DYNAMIC_TRACKING] FILE_FULL_DIR_INFORMATION structure. Used with GetFileInformationByHandleEx and FileIdBothDirectoryInfo/RestartInfo as well as NtQueryFileInformation. Equivalent to FILE_FULL_DIR_INFO structure. Offset in bytes of the next entry, if any. Byte offset within the parent directory, undefined for NTFS. File attributes. Note that MSDN documentation isn't correct for this- it can return any FILE_ATTRIBUTE that is currently set on the file, not just the ones documented. The length of the file name in bytes (without null). The extended attribute size OR the reparse tag if a reparse point. Gets the next info pointer or null if there are no more. Status Request dependent value. The completion status, either STATUS_SUCCESS if the operation was completed successfully or some other informational, warning, or error status. Reserved for internal use. File creation disposition when calling directly to NT APIs. Default. Replace or create. Deletes existing file instead of overwriting. As this potentially deletes it requires that DesiredAccess must include Delete. This has no equivalent in CreateFile. Open if exists or fail if doesn't exist. Equivalent to OPEN_EXISTING or . TruncateExisting also uses Open and then manually truncates the file by calling NtSetInformationFile with FileAllocationInformation and an allocation size of 0. Create if doesn't exist or fail if does exist. Equivalent to CREATE_NEW or . Open if exists or create if doesn't exist. Equivalent to OPEN_ALWAYS or . Open and overwrite if exists or fail if doesn't exist. Equivalent to TRUNCATE_EXISTING or . Open and overwrite if exists or create if doesn't exist. Equivalent to CREATE_ALWAYS or . Options for creating/opening files with NtCreateFile. File being created or opened must be a directory file. Disposition must be FILE_CREATE, FILE_OPEN, or FILE_OPEN_IF. Can only be used with FILE_SYNCHRONOUS_IO_ALERT/NONALERT, FILE_WRITE_THROUGH, FILE_OPEN_FOR_BACKUP_INTENT, and FILE_OPEN_BY_FILE_ID flags. Applications that write data to the file must actually transfer the data into the file before any requested write operation is considered complete. This flag is set automatically if FILE_NO_INTERMEDIATE_BUFFERING is set. All accesses to the file are sequential. File cannot be cached in driver buffers. Cannot use with AppendData desired access. All operations are performed synchronously. Any wait on behalf of the caller is subject to premature termination from alerts. Cannot be used with FILE_SYNCHRONOUS_IO_NONALERT. Synchronous DesiredAccess flag is required. I/O system will maintain file position context. All operations are performed synchronously. Waits in the system to synchronize I/O queuing and completion are not subject to alerts. Cannot be used with FILE_SYNCHRONOUS_IO_ALERT. Synchronous DesiredAccess flag is required. I/O system will maintain file position context. File being created or opened must not be a directory file. Can be a data file, device, or volume. Create a tree connection for this file in order to open it over the network. Not used by device and intermediate drivers. Complete the operation immediately with a success code of STATUS_OPLOCK_BREAK_IN_PROGRESS if the target file is oplocked. Not compatible with ReserveOpfilter or OpenRequiringOplock. Not used by device and intermediate drivers. If the extended attributes on an existing file being opened indicate that the caller must understand extended attributes to properly interpret the file, fail the request. Not used by device and intermediate drivers. Accesses to the file can be random, so no sequential read-ahead operations should be performed on the file by FSDs or the system. Delete the file when the last handle to it is passed to NtClose. Requires Delete flag in DesiredAccess parameter. Open the file by reference number or object ID. The file name that is specified by the ObjectAttributes name parameter includes the 8 or 16 byte file reference number or ID for the file in the ObjectAttributes name field. The device name can optionally be prefixed. NTFS supports both reference numbers and object IDs. 16 byte reference numbers are 8 byte numbers padded with zeros. ReFS only supports reference numbers (not object IDs). 8 byte and 16 byte reference numbers are not related. Note that as the UNICODE_STRING will contain raw byte data, it may not be a "valid" string. Not used by device and intermediate drivers. \??\C:\{8 bytes of binary FileID} \device\HardDiskVolume1\{16 bytes of binary ObjectID} {8 bytes of binary FileID} The file is being opened for backup intent. Therefore, the system should check for certain access rights and grant the caller the appropriate access to the file before checking the DesiredAccess parameter against the file's security descriptor. Not used by device and intermediate drivers. When creating a file, specifies that it should not inherit the compression bit from the parent directory. The file is being opened and an opportunistic lock (oplock) on the file is being requested as a single atomic operation. The file system checks for oplocks before it performs the create operation and will fail the create with a return code of STATUS_CANNOT_BREAK_OPLOCK if the result would be to break an existing oplock. Not compatible with CompleteIfOplocked or ReserveOpFilter. Windows 7 and up. CreateFile2 uses this flag to prevent opening a file that you don't have access to without specifying FILE_SHARE_READ. (Preventing users that can only read a file from denying access to other readers.) Windows 7 and up. The client opening the file or device is session aware and per session access is validated if necessary. Windows 8 and up. This flag allows an application to request a filter opportunistic lock (oplock) to prevent other applications from getting share violations. Not compatible with CompleteIfOplocked or OpenRequiringOplock. If there are already open handles, the create request will fail with STATUS_OPLOCK_NOT_GRANTED. Open a file with a reparse point attribute, bypassing the normal reparse point processing. Causes files that are marked with the Offline attribute not to be recalled from remote storage. More details can be found in Remote Storage documentation (see Basic Concepts). https://technet.microsoft.com/en-us/library/cc938459.aspx System.IO.FileAccess looks up these values when creating handles File Security and Access Rights https://msdn.microsoft.com/en-us/library/windows/desktop/aa364399.aspx For a file, the right to read data from the file. Directory version of this flag is . For a directory, the right to list the contents. File version of this flag is . For a file, the right to write data to the file. Directory version of this flag is . For a directory, the right to create a file in a directory. File version of this flag is . For a file, the right to append data to a file. is needed to overwrite existing data. Directory version of this flag is . For a directory, the right to create a subdirectory. File version of this flag is . For a named pipe, the right to create a pipe instance. The right to read extended attributes. The right to write extended attributes. The right to execute the file. Directory version of this flag is . For a directory, the right to traverse the directory. File version of this flag is . For a directory, the right to delete a directory and all the files it contains, including read-only files. The right to read attributes. The right to write attributes. All standard and specific rights. [FILE_ALL_ACCESS] The right to delete the object. The right to read the information in the object's security descriptor. Doesn't include system access control list info (SACL). The right to modify the discretionary access control list (DACL) in the object's security descriptor. The right to change the owner in the object's security descriptor. The right to use the object for synchronization. Enables a thread to wait until the object is in the signaled state. This is required if opening a synchronous handle. Same as READ_CONTROL. Same as READ_CONTROL. Same as READ_CONTROL. Maps internally to | | | | . (For directories, | | | | .) Maps internally to | | | | | . (For directories, | | AddFile | | | .) Maps internally to | | | . (For directories, | | | .)