Esempio n. 1
0
        /// <summary>
        ///     Constructor for Hive class
        /// </summary>
        /// <param name="hiveName">Name of Hive (\REGISTRY\USER\...)</param>
        /// <param name="hivePath">
        ///     Path to Hive (\Device\HarddiskVolumeX\Windows\System32\config\... or
        ///     C:\Windows\System32\config\...)
        /// </param>
        public Hive(string hiveName, string hivePath)
        {
            _hiveName        = hiveName;
            RegistryHivePath = File.Exists(hivePath) ? hivePath : HiveManager.ConvertDeviceToMsdosName(hivePath);

            try
            {
                HiveFileInfo = new FileInfo(RegistryHivePath);
                OldHiveSize  = GetFileSize(RegistryHivePath);
            }
            catch (Exception ex)
            {
                HiveFileInfo = null;
                OldHiveSize  = 0;

                Debug.WriteLine("The following error occurred trying to get registry hive information: " + ex.Message);
            }

            if (!IsValid)
            {
                return;
            }

            try
            {
                GetTempHivePaths();
            }
            catch (Exception ex)
            {
                HiveFileInfo = null;
                OldHiveSize  = 0;

                Debug.WriteLine("The following error occurred trying to get temporary hive path: " + ex.Message);
            }
        }
Esempio n. 2
0
        /// <summary>
        ///     Gets and sets temporary hive paths
        /// </summary>
        /// <see cref="HiveManager.GetTempHivePath" />
        private void GetTempHivePaths()
        {
            // Temporary directory must be on same partition
            var drive = RegistryHivePath[0];

            OldHivePath = HiveManager.GetTempHivePath(drive);
            NewHivePath = HiveManager.GetTempHivePath(drive);
        }