/// <summary> /// 現在の設定をレジストリに保存する /// </summary> private void SaveRegistry() { // ExternalHostsTarget RegistryUtility.FRegistrySetValue(Microsoft.Win32.RegistryHive.LocalMachine, LocalResources.m_gstrAutoHostsUpdateServiceRegistryPath, LocalResources.m_gstrExternalHostsTargetRegistryName, ExternalHostsSaveTarget); // InternalHostsTarget RegistryUtility.FRegistrySetValue(Microsoft.Win32.RegistryHive.LocalMachine, LocalResources.m_gstrAutoHostsUpdateServiceRegistryPath, LocalResources.m_gstrInternalHostsTargetRegistryName, InternalHostsSaveTarget); // ApplyInExternalHosts (Enabled) RegistryUtility.FRegistrySetDwordValue(Microsoft.Win32.RegistryHive.LocalMachine, LocalResources.m_gstrAutoHostsUpdateServiceRegistryPath, LocalResources.m_gstrIsApplyInExternalHostsRegistryName, (IsApplyInExternalHosts) ? (uint)1 : (uint)0); // UpdateInternalHosts (Enabled) RegistryUtility.FRegistrySetDwordValue(Microsoft.Win32.RegistryHive.LocalMachine, LocalResources.m_gstrAutoHostsUpdateServiceRegistryPath, LocalResources.m_gstrIsUpdateInternalHostsRegistryName, (IsUpdateInternalHosts) ? (uint)1 : (uint)0); // NetworkAuthentication (Disabled) RegistryUtility.FRegistrySetDwordValue(Microsoft.Win32.RegistryHive.LocalMachine, LocalResources.m_gstrAutoHostsUpdateServiceRegistryPath, LocalResources.m_gstrIsNetworkAuthenticationName, (IsNetworkAuthentication) ? (uint)1 : (uint)0); // NetworkAuthenticationUsername (Empty) RegistryUtility.FRegistrySetValue(Microsoft.Win32.RegistryHive.LocalMachine, LocalResources.m_gstrAutoHostsUpdateServiceRegistryPath, LocalResources.m_gstrNetworkAuthenticationUsernameName, NetworkAuthenticationUsername); // NetworkAuthenticationPassword (Empty) RegistryUtility.FRegistrySetBinaryValue(Microsoft.Win32.RegistryHive.LocalMachine, LocalResources.m_gstrAutoHostsUpdateServiceRegistryPath, LocalResources.m_gstrNetworkAuthenticationPasswordName, CryptUtility.EncryptString(NetworkAuthenticationPassword)); }
private void SaveRegistryFromXmlResources(XmlResources xmlResources) { // ExternalHostsTarget RegistryUtility.FRegistrySetValue(Microsoft.Win32.RegistryHive.LocalMachine, LocalResources.m_gstrAutoHostsUpdateServiceRegistryPath, LocalResources.m_gstrExternalHostsTargetRegistryName, xmlResources.ExternalHostsTarget); // InternalHostsTarget RegistryUtility.FRegistrySetValue(Microsoft.Win32.RegistryHive.LocalMachine, LocalResources.m_gstrAutoHostsUpdateServiceRegistryPath, LocalResources.m_gstrInternalHostsTargetRegistryName, xmlResources.InternalHostsTarget); // ApplyInExternalHosts (Enabled) RegistryUtility.FRegistrySetDwordValue(Microsoft.Win32.RegistryHive.LocalMachine, LocalResources.m_gstrAutoHostsUpdateServiceRegistryPath, LocalResources.m_gstrIsApplyInExternalHostsRegistryName, (uint)xmlResources.ApplyInExternalHosts); // UpdateInternalHosts (Enabled) RegistryUtility.FRegistrySetDwordValue(Microsoft.Win32.RegistryHive.LocalMachine, LocalResources.m_gstrAutoHostsUpdateServiceRegistryPath, LocalResources.m_gstrIsUpdateInternalHostsRegistryName, (uint)xmlResources.UpdateInternalHosts); // NetworkAuthentication (Disabled) RegistryUtility.FRegistrySetDwordValue(Microsoft.Win32.RegistryHive.LocalMachine, LocalResources.m_gstrAutoHostsUpdateServiceRegistryPath, LocalResources.m_gstrIsNetworkAuthenticationName, (uint)xmlResources.NetworkAuthentication); // NetworkAuthenticationUsername (Empty) RegistryUtility.FRegistrySetValue(Microsoft.Win32.RegistryHive.LocalMachine, LocalResources.m_gstrAutoHostsUpdateServiceRegistryPath, LocalResources.m_gstrNetworkAuthenticationUsernameName, xmlResources.NetworkUsername); // NetworkAuthenticationPassword (Empty) RegistryUtility.FRegistrySetBinaryValue(Microsoft.Win32.RegistryHive.LocalMachine, LocalResources.m_gstrAutoHostsUpdateServiceRegistryPath, LocalResources.m_gstrNetworkAuthenticationPasswordName, xmlResources.NetworkPassword); }
private void serviceInstaller_AfterInstall(object sender, InstallEventArgs e) { // Set default Registry value (InstallUtill) // ExternalHostsTarget RegistryUtility.FRegistrySetValue(Microsoft.Win32.RegistryHive.LocalMachine, LocalResources.m_gstrAutoHostsUpdateServiceRegistryPath, LocalResources.m_gstrExternalHostsTargetRegistryName, LocalResources.m_gstrExternalHostsTargetRegistryDefaultValue); // InternalHostsTarget RegistryUtility.FRegistrySetValue(Microsoft.Win32.RegistryHive.LocalMachine, LocalResources.m_gstrAutoHostsUpdateServiceRegistryPath, LocalResources.m_gstrInternalHostsTargetRegistryName, LocalResources.m_gstrInternalHostsTargetRegistryDefaultValue); // ApplyInExternalHosts (Enabled) RegistryUtility.FRegistrySetDwordValue(Microsoft.Win32.RegistryHive.LocalMachine, LocalResources.m_gstrAutoHostsUpdateServiceRegistryPath, LocalResources.m_gstrIsApplyInExternalHostsRegistryName, LocalResources.m_gintDefaultEnabledValue); // UpdateInternalHosts (Enabled) RegistryUtility.FRegistrySetDwordValue(Microsoft.Win32.RegistryHive.LocalMachine, LocalResources.m_gstrAutoHostsUpdateServiceRegistryPath, LocalResources.m_gstrIsUpdateInternalHostsRegistryName, LocalResources.m_gintDefaultEnabledValue); // NetworkAuthentication (Disabled) RegistryUtility.FRegistrySetDwordValue(Microsoft.Win32.RegistryHive.LocalMachine, LocalResources.m_gstrAutoHostsUpdateServiceRegistryPath, LocalResources.m_gstrIsNetworkAuthenticationName, LocalResources.m_gintDefaultDisabledValue); // NetworkAuthenticationUsername (Empty) RegistryUtility.FRegistrySetValue(Microsoft.Win32.RegistryHive.LocalMachine, LocalResources.m_gstrAutoHostsUpdateServiceRegistryPath, LocalResources.m_gstrNetworkAuthenticationUsernameName, String.Empty); // NetworkAuthenticationPassword (Empty) RegistryUtility.FRegistrySetValue(Microsoft.Win32.RegistryHive.LocalMachine, LocalResources.m_gstrAutoHostsUpdateServiceRegistryPath, LocalResources.m_gstrNetworkAuthenticationPasswordName, String.Empty); }