/// <summary> /// Method to create an object from a set of object attributes. /// </summary> /// <param name="obj_attributes">The object attributes to create/open from.</param> /// <returns>The newly created object.</returns> protected override object CreateObject(ObjectAttributes obj_attributes) { Options |= FileOpenOptions.OpenReparsePoint; using (NtFile file = (NtFile)base.CreateObject(obj_attributes)) { if (ReparseTag == ReparseTag.NONE) { return(file.DeleteReparsePoint()); } file.DeleteReparsePoint(ReparseTag); return(null); } }
private static bool DeleteMountPoint(string path) { try { DirectoryInfo to = Directory.GetParent(path); if (to == null) { return(false); } Log("Deleting mount point: " + to.FullName); NtFile.DeleteReparsePoint("\\??\\" + to.FullName); Directory.Delete(to.FullName); } catch { return(false); } return(true); }