Exemplo n.º 1
0
        internal NtFileObjectId(NtFile volume, FileObjectIdInformation info)
        {
            FileReferenceNumber = info.FileReference;
            ExtendedInfo        = info.ExtendedInfo;
            ObjectId            = info.ObjectId;
            FullPath            = string.Empty;
            Win32Path           = string.Empty;
            using (var file = NtFile.OpenFileById(volume, FileReferenceNumber, FileAccessRights.ReadAttributes,
                                                  FileShareMode.None, FileOpenOptions.OpenReparsePoint | FileOpenOptions.OpenForBackupIntent, false)) {
                if (!file.IsSuccess)
                {
                    return;
                }

                FileAttributes = file.Result.FileAttributes;
                FullPath       = file.Result.FullPath;
                Win32Path      = file.Result.GetWin32PathName(0, false).GetResultOrDefault(string.Empty);
            }
        }
Exemplo n.º 2
0
        internal NtFileReparsePoint(NtFile volume, FileReparsePointInformation info)
        {
            FileReferenceNumber = info.FileReferenceNumber;
            Buffer    = new OpaqueReparseBuffer(info.Tag, new byte[0]);
            FullPath  = string.Empty;
            Win32Path = string.Empty;
            using (var file = NtFile.OpenFileById(volume, info.FileReferenceNumber, FileAccessRights.ReadAttributes,
                                                  FileShareMode.None, FileOpenOptions.OpenReparsePoint | FileOpenOptions.OpenForBackupIntent, false))
            {
                if (!file.IsSuccess)
                {
                    return;
                }

                FileAttributes = file.Result.FileAttributes;
                FullPath       = file.Result.FullPath;
                Win32Path      = file.Result.GetWin32PathName(0, false).GetResultOrDefault(string.Empty);
                Buffer         = file.Result.GetReparsePoint(false).GetResultOrDefault(Buffer);
            }
        }