public ObjectManagerPSDriveInfo(NtObject root, PSDriveInfo drive_info)
            : base(drive_info)
        {
            if (root is NtDirectory dir)
            {
                DirectoryRoot = new NtDirectoryContainer(dir);
            }
            else if (root is NtKey key)
            {
                bool open_for_backup = false;
                using (var token = NtToken.OpenProcessToken())
                {
                    if (token.SinglePrivilegeCheck(TokenPrivilegeValue.SeBackupPrivilege))
                    {
                        open_for_backup = true;
                    }
                }

                DirectoryRoot = new NtKeyContainer(key, open_for_backup);
            }
            else
            {
                throw new ArgumentException($"Invalid root object. {root.NtTypeName}");
            }
        }
Exemple #2
0
 public NtDirectoryContainer(NtDirectory dir)
     : base(dir)
 {
     _dir = dir;
     if (dir.FullPath == @"\")
     {
         _key = new NtKeyContainer();
     }
 }
Exemple #3
0
 public ObjectManagerPSDriveInfo(NtObject root, PSDriveInfo drive_info)
     : base(drive_info)
 {
     if (root is NtDirectory dir)
     {
         DirectoryRoot = new NtDirectoryContainer(dir);
     }
     else if (root is NtKey key)
     {
         DirectoryRoot = new NtKeyContainer(key);
     }
     else
     {
         throw new ArgumentException($"Invalid root object. {root.NtTypeName}");
     }
 }