当前位置: 首页>>代码示例>>C#>>正文


C# RegistryHive类代码示例

本文整理汇总了C#中RegistryHive的典型用法代码示例。如果您正苦于以下问题:C# RegistryHive类的具体用法?C# RegistryHive怎么用?C# RegistryHive使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RegistryHive类属于命名空间,在下文中一共展示了RegistryHive类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HBinSizeShouldNotMatchReadSize

        public void HBinSizeShouldNotMatchReadSize()
        {
            var r = new RegistryHive(@"..\..\Hives\SAM_DUPENAME");
            //if you don't call parse, it wont match

            Check.That(r.Header.Length).IsNotEqualTo(r.HBinRecordTotalSize);
        }
开发者ID:seandiviney,项目名称:Registry,代码行数:7,代码来源:TestRegistryHive.cs

示例2: add_key

 private void add_key(IList<RegistryKey> keys, RegistryHive hive, RegistryView view)
 {
     FaultTolerance.try_catch_with_logging_exception(
         () => keys.Add(RegistryKey.OpenBaseKey(hive, view)),
         "Could not open registry hive '{0}' for view '{1}'".format_with(hive.to_string(), view.to_string()),
         logWarningInsteadOfError: true);
 }
开发者ID:secretGeek,项目名称:choco,代码行数:7,代码来源:RegistryService.cs

示例3: GetRegBaseKey

        public static RegistryKey GetRegBaseKey(RegistryHive hive)
        {
#if NET4
            return RegistryKey.OpenBaseKey(hive, (Environment.Is64BitOperatingSystem ? RegistryView.Registry64 : RegistryView.Registry32));
#else
            RegistryKey result = null;

            switch (hive)
            {
                case RegistryHive.ClassesRoot:
                    break;
                case RegistryHive.CurrentConfig:
                    break;
                case RegistryHive.CurrentUser:
                    break;
                case RegistryHive.DynData:
                    break;
                case RegistryHive.PerformanceData:
                    break;
                case RegistryHive.Users:
                    break;
                default:
                    result = Microsoft.Win32.Registry.LocalMachine;
                    break;
            }

            return result;
#endif
        }
开发者ID:sreenandini,项目名称:test_buildscripts,代码行数:29,代码来源:ConfigSettingAttribute.cs

示例4:

 public RegistrySettingsProvider
     (RegistryHive hKey, RegistryView view = RegistryView.Default, string baseKey = null)
 {
     this.hKey = hKey;
     this.view = view;
     this.baseKey = baseKey ?? ProductInfo.Company + "\\" + ProductInfo.Product;
 }
开发者ID:jammycakes,项目名称:dolstagis.ideas,代码行数:7,代码来源:RegistrySettingsProvider.cs

示例5: deleteRegistryKey

		private void deleteRegistryKey(RegistryHive hive, string key)
		{
			using (var reg = RegistryKey.OpenBaseKey(hive, RegistryView.Default))
			{
				reg.DeleteSubKey(key);
			}
		}
开发者ID:GorelH,项目名称:dropkick,代码行数:7,代码来源:CreateRegistryKeyTaskTest.cs

示例6: RemoveRegistrySubKey

        /// <summary>
        /// Удалить ключ реестра
        /// </summary>
        /// <param name="root">Ветка реестра</param>
        /// <param name="key">Ключ для удаления</param>
        public static void RemoveRegistrySubKey(RegistryHive root, string key)
        {
            switch (root)
            {
                case RegistryHive.ClassesRoot:
                    Registry.ClassesRoot.DeleteSubKey(key);
                    break;

                case RegistryHive.CurrentUser:
                    Registry.CurrentUser.DeleteSubKey(key);
                    break;

                case RegistryHive.LocalMachine:
                    Registry.LocalMachine.DeleteSubKey(key);
                    break;

                case RegistryHive.Users:
                    Registry.Users.DeleteSubKey(key);
                    break;

                case RegistryHive.CurrentConfig:
                    Registry.CurrentConfig.DeleteSubKey(key);
                    break;
            }
        }
开发者ID:Lootero4eg,项目名称:anvlib,代码行数:30,代码来源:RegistryUtils.cs

示例7: GetRawRegistryKeyTimestamp

        private Int64 GetRawRegistryKeyTimestamp(RegistryHive hive, string keyname)
        {
            if (String.IsNullOrEmpty(keyname))
            {
                return 0; // Otherwise the function opens HKLM (or HKCU) again.
            }

            UIntPtr hkey = OpenKey(hive, keyname, KEY_QUERY_VALUE);

            if (hkey == UIntPtr.Zero)
            {
                return 0; // Didn't open key
            }

            Int64 timestamp;

            uint result2 = NativeMethods.RegQueryInfoKey(
                hkey, IntPtr.Zero,
                IntPtr.Zero, IntPtr.Zero,
                IntPtr.Zero, IntPtr.Zero,
                IntPtr.Zero, IntPtr.Zero,
                IntPtr.Zero, IntPtr.Zero,
                IntPtr.Zero, out timestamp);

            if (result2 != 0)
            {
                timestamp = 0; // Failed, don't return whatever value was supplied.
            }

            NativeMethods.RegCloseKey(hkey);

            return timestamp;
        }
开发者ID:tmzu,项目名称:keymapper,代码行数:33,代码来源:RegistryTimestampService.cs

示例8: OpenBaseKey

 public IRegistryKey OpenBaseKey(
     RegistryHive hKey,
     RegistryView view
 )
 {
     return new RegistryKeyWrap(RegistryKey.OpenBaseKey(hKey, view));
 }
开发者ID:sign42,项目名称:SystemWrapper,代码行数:7,代码来源:RegistryKeySystem.cs

示例9: DeleteRegistryKeyValue

 public static bool DeleteRegistryKeyValue(RegistryHive hive, string path, string name) =>
     RegistryKey.OpenBaseKey(hive, RegistryView.Registry64).OpenWritableSubKeySafe(path,
         (key) =>
         {
             key.DeleteValue(name, true);
             return true;
         });
开发者ID:killbug2004,项目名称:BlackHole,代码行数:7,代码来源:RegistryHelper.cs

示例10: Bin

        public Bin(RegistryHive hive, Stream stream)
        {
            _hive = hive;
            _fileStream = stream;
            _streamPos = stream.Position;

            stream.Position = _streamPos;
            byte[] buffer = Utilities.ReadFully(stream, 0x20);
            _header = new BinHeader();
            _header.ReadFrom(buffer, 0);

            _fileStream.Position = _streamPos;
            _buffer = Utilities.ReadFully(_fileStream, _header.BinSize);

            // Gather list of all free cells.
            _freeCells = new List<Range<int, int>>();
            int pos = 0x20;
            while (pos < _buffer.Length)
            {
                int size = Utilities.ToInt32LittleEndian(_buffer, pos);
                if (size > 0)
                {
                    _freeCells.Add(new Range<int, int>(pos, size));
                }

                pos += Math.Abs(size);
            }
        }
开发者ID:marinehero,项目名称:ThinkAway.net,代码行数:28,代码来源:Bin.cs

示例11: CleanUpRegistry

        private static void CleanUpRegistry(RegistryHive hive)
        {
            var regValueNames = new[]{ Reg_LoggingEnabled,
									   Reg_DebugLogEnabled,
                                       Reg_FileLogEnabled,
                                       Reg_Severity,
                                       Reg_Path};

            using (RegistryKey rootKey = RegistryKey.OpenBaseKey(hive, RegistryView.Default))
            {
                using (RegistryKey key = rootKey.OpenSubKey(TestKeyPath, true))
                {
                    if (key != null)
                    {
                        foreach (var regValueName in regValueNames)
                        {
                            try
                            {
                                key.DeleteValue(regValueName);
                            }
                            catch (ArgumentException)
                            {
                                // Assumption: ArgumentExceptions caused by values that are not present
                            }
                        }
                    }
                }
            }

        }
开发者ID:killbug2004,项目名称:WSProf,代码行数:30,代码来源:TestConfiguration.cs

示例12: DoRun

        protected override void DoRun()
        {
            using (Stream fileStream = File.OpenRead(_bcdFile.Value))
            {
                using (RegistryHive hive = new RegistryHive(fileStream))
                {

                    Store bcdDb = new Store(hive.Root);
                    foreach (var obj in bcdDb.Objects)
                    {
                        Console.WriteLine(obj.FriendlyName + ":");
                        Console.WriteLine("               Id: " + obj.ToString());
                        Console.WriteLine("             Type: " + obj.ObjectType);
                        Console.WriteLine("   App Image Type: " + obj.ApplicationImageType);
                        Console.WriteLine("         App Type: " + obj.ApplicationType);
                        Console.WriteLine("  App can inherit: " + obj.IsInheritableBy(ObjectType.Application));
                        Console.WriteLine("  Dev can inherit: " + obj.IsInheritableBy(ObjectType.Device));
                        Console.WriteLine("  ELEMENTS");
                        foreach (var elem in obj.Elements)
                        {
                            Console.WriteLine("    " + elem.FriendlyName + ":");
                            Console.WriteLine("          Id: " + elem.ToString());
                            Console.WriteLine("       Class: " + elem.Class);
                            Console.WriteLine("      Format: " + elem.Format);
                            Console.WriteLine("       Value: " + elem.Value);
                        }

                        Console.WriteLine();
                    }
                }
            }
        }
开发者ID:JGTM2016,项目名称:discutils,代码行数:32,代码来源:Program.cs

示例13: RegistryKeyMonitor

        public RegistryKeyMonitor(
            RegistryHive hive,
            string key,
            RegistryNotifyFilter filter,
            RegistryKeyWatch watch,
            KeyChangedDelegate keyChanged,
            ExceptionRaisedDelegate exceptionRaised)
        {
            if (keyChanged == null)
            {
                throw new ArgumentNullException(nameof(keyChanged));
            }

            if (exceptionRaised == null)
            {
                throw new ArgumentNullException(nameof(exceptionRaised));
            }

            RegistryHive = hive;
            Key = key;
            Filter = filter;
            WatchSubTree = watch == RegistryKeyWatch.KeyAndSubKeys;
            this.keyChanged = keyChanged;
            this.exceptionRaised = exceptionRaised;

            StartMonitor();
        }
开发者ID:vbfox,项目名称:win32iam,代码行数:27,代码来源:RegistryKeyMonitor.cs

示例14: SetValue

 public void SetValue(RegistryHive hive, string registryValueName, object value)
 {
     RegistryKey rootKey = RegistryKey.OpenBaseKey(hive, RegistryView.Default);
     RegistryKey testKey = rootKey.CreateSubKey(TestKeyPath);
     Assert.NotNull(testKey);
     testKey.SetValue(registryValueName, value);
 }
开发者ID:killbug2004,项目名称:WSProf,代码行数:7,代码来源:RegHelper.cs

示例15: CreateRegistryKey

		public static RegistryKeyOptions CreateRegistryKey(this ProtoServer protoServer, RegistryHive hive, string name, Action<RegistryKeyOptions> options)
		{
			var proto = CreateRegistryKey(protoServer, hive, name);
			if (options != null)
				options(proto);
			return proto;
		}
开发者ID:GorelH,项目名称:dropkick,代码行数:7,代码来源:Extension.cs


注:本文中的RegistryHive类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。