Exemplo n.º 1
0
        /// <summary>
        /// 생성자입니다.
        /// </summary>
        static Common()
        {
            //Platform 을 설정합니다.
            if (Kernel32Utilscs.Is64Bit() == true)
            {
                registryMode = RegistryMode.WoW64;
            }
            else
            {
                registryMode = RegistryMode.Normal;
            }

            //레지스트리 키의 경로를 설정합니다.
            switch (registryMode)
            {
            case RegistryMode.Normal:
                regKeyRoot      = NormalPath;
                regKeyProxyRoot = NormalProxyPath;
                break;

            case RegistryMode.WoW64:
                regKeyRoot      = Wow64Path;
                regKeyProxyRoot = NormalProxyPath;
                break;

            default:
                regKeyRoot      = NormalPath;
                regKeyProxyRoot = NormalProxyPath;
                break;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// UserAgent 를 초기화 합니다
        /// </summary>
        /// <returns></returns>
        public static bool RestoreRegistryForUserAgent()
        {
            bool result = true;

            try
            {
                RegistryKey userAgentkey = Registry.LocalMachine.CreateSubKey(NormalPath);
                userAgentkey.SetValue("", "");
                foreach (string key in userAgentkey.GetValueNames())
                {
                    userAgentkey.DeleteValue(key, true);
                }

                try
                {
                    userAgentkey.DeleteSubKeyTree("Post Platform");
                }
                catch { }

                //WriteTextLog("mode", Common.registryMode.ToString() + Kernel32Utilscs.Is64Bit().ToString());

                if (Kernel32Utilscs.Is64Bit() == true)
                {
                    userAgentkey = Registry.LocalMachine.CreateSubKey(Wow64Path);
                    userAgentkey.SetValue("", "");
                    foreach (string key in userAgentkey.GetValueNames())
                    {
                        userAgentkey.DeleteValue(key, true);
                    }

                    try
                    {
                        userAgentkey.DeleteSubKeyTree("Post Platform");
                    }
                    catch { }
                }
            }
            catch (Exception ex)
            {
                string str = ex.Message.ToString();
                return(false);
            }

            return(result);
        }