/// <summary>
            /// レジストリに登録
            /// </summary>
            /// <param name="startup_register_place">スタートアップの登録場所</param>
            /// <param name="register_name">登録名</param>
            /// <param name="file_path">ファイルパス</param>
            /// <param name="parameter">パラメータ</param>
            private static void RegisterRegistry(
                StartupRegisterPlace startup_register_place,
                string register_name,
                string file_path,
                string parameter
                )
            {
                RegistryHivePath registry_hive_path = null;

                switch (startup_register_place)
                {
                case StartupRegisterPlace.RegistryLogonUser:
                    registry_hive_path = StartupRegistryHidePath.LogonUser();
                    break;

                case StartupRegisterPlace.RegistryAllUser:
                    registry_hive_path = StartupRegistryHidePath.AllUser();
                    break;

                case StartupRegisterPlace.RegistryLogonUserOnce:
                    registry_hive_path = StartupRegistryHidePath.LogonUserOnce();
                    break;

                case StartupRegisterPlace.RegistryAllUserOnce:
                    registry_hive_path = StartupRegistryHidePath.AllUserOnce();
                    break;

                case StartupRegisterPlace.RegistryAllUser32Bit:
                    registry_hive_path = StartupRegistryHidePath.AllUser32Bit();
                    break;

                case StartupRegisterPlace.RegistryAllUserOnce32Bit:
                    registry_hive_path = StartupRegistryHidePath.AllUserOnce32Bit();
                    break;
                }

                string write_string;     // 書き込む文字列

                if (string.IsNullOrEmpty(parameter))
                {
                    write_string = file_path;
                }
                else
                {
                    write_string = "\"" + file_path + "\" " + parameter;
                }

                using (Microsoft.Win32.RegistryKey base_registry_key = Microsoft.Win32.RegistryKey.OpenBaseKey(registry_hive_path.RegistryHive, Microsoft.Win32.RegistryView.Default))
                {
                    using (Microsoft.Win32.RegistryKey sub_registry_key = base_registry_key.CreateSubKey(registry_hive_path.Path))
                    {
                        sub_registry_key.SetValue(register_name, write_string, Microsoft.Win32.RegistryValueKind.String);
                    }
                }
            }
            /// <summary>
            /// スタートアップの有効状態を変更
            /// </summary>
            /// <param name="startup_register_place">スタートアップの登録場所</param>
            /// <param name="register_name">登録名</param>
            /// <param name="effective_state">有効状態</param>
            /// <exception cref="FreeEcho.FEStartupControl.ChangeEffectiveStateStartupException"></exception>
            public static void ChangeEffectiveState(
                StartupRegisterPlace startup_register_place,
                string register_name,
                bool effective_state
                )
            {
                try
                {
                    RegistryHivePath registry_hive_path = null;
                    string           extension          = null; // 拡張子

                    switch (startup_register_place)
                    {
                    case StartupRegisterPlace.FolderLogonUser:
                        registry_hive_path = StartupRegistryHidePath.DisabledFolderLogonUser();
                        extension          = ".lnk";
                        break;

                    case StartupRegisterPlace.FolderAllUser:
                        registry_hive_path = StartupRegistryHidePath.DisabledFolderAllUser();
                        extension          = ".lnk";
                        break;

                    case StartupRegisterPlace.RegistryLogonUser:
                        registry_hive_path = StartupRegistryHidePath.DisabledRegistryLogonUser();
                        break;

                    case StartupRegisterPlace.RegistryAllUser:
                        registry_hive_path = StartupRegistryHidePath.DisabledRegistryAllUser();
                        break;

                    case StartupRegisterPlace.RegistryAllUser32Bit:
                        registry_hive_path = StartupRegistryHidePath.DisabledRegistryAllUser32Bit();
                        break;
                    }

                    using (Microsoft.Win32.RegistryKey base_registry_key = Microsoft.Win32.RegistryKey.OpenBaseKey(registry_hive_path.RegistryHive, Microsoft.Win32.RegistryView.Default))
                    {
                        using (Microsoft.Win32.RegistryKey sub_registry_key = base_registry_key.CreateSubKey(registry_hive_path.Path))
                        {
                            sub_registry_key.SetValue(register_name + extension, effective_state ? new byte[] { 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } : new byte[] { 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, Microsoft.Win32.RegistryValueKind.Binary);
                        }
                    }
                }
                catch
                {
                    throw new ChangeEffectiveStateStartupException();
                }
            }
            /// <summary>
            /// スタートアップを削除
            /// </summary>
            /// <param name="startup_register_place">登録場所</param>
            /// <param name="register_name">登録名</param>
            /// <exception cref="FreeEcho.FEStartupControl.DeleteStartupException"></exception>
            public static void DeleteStartup(
                StartupRegisterPlace startup_register_place,
                string register_name
                )
            {
                try
                {
                    string           startup_folder_path = null;
                    RegistryHivePath registry_hive_path  = null;

                    switch (startup_register_place)
                    {
                    case StartupRegisterPlace.FolderLogonUser:
                        startup_folder_path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Startup);
                        break;

                    case StartupRegisterPlace.FolderAllUser:
                        startup_folder_path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.CommonStartup);
                        break;

                    case StartupRegisterPlace.RegistryLogonUser:
                        registry_hive_path = StartupRegistryHidePath.LogonUser();
                        break;

                    case StartupRegisterPlace.RegistryAllUser:
                        registry_hive_path = StartupRegistryHidePath.AllUser();
                        break;

                    case StartupRegisterPlace.RegistryLogonUserOnce:
                        registry_hive_path = StartupRegistryHidePath.LogonUserOnce();
                        break;

                    case StartupRegisterPlace.RegistryAllUserOnce:
                        registry_hive_path = StartupRegistryHidePath.AllUserOnce();
                        break;

                    case StartupRegisterPlace.RegistryAllUser32Bit:
                        registry_hive_path = StartupRegistryHidePath.AllUser32Bit();
                        break;

                    case StartupRegisterPlace.RegistryAllUserOnce32Bit:
                        registry_hive_path = StartupRegistryHidePath.AllUserOnce32Bit();
                        break;
                    }

                    if (startup_folder_path != null)
                    {
                        startup_folder_path += "/" + register_name + ".lnk";
                        System.IO.File.Delete(startup_folder_path);
                    }
                    else if (registry_hive_path != null)
                    {
                        using (Microsoft.Win32.RegistryKey base_registry_key = Microsoft.Win32.RegistryKey.OpenBaseKey(registry_hive_path.RegistryHive, Microsoft.Win32.RegistryView.Default))
                        {
                            using (Microsoft.Win32.RegistryKey sub_registry_key = base_registry_key.CreateSubKey(registry_hive_path.Path))
                            {
                                sub_registry_key.DeleteValue(register_name);
                            }
                        }
                    }
                }
                catch
                {
                    throw new DeleteStartupException();
                }
            }
 /// <summary>
 /// キャンセルされているスタートアップを取得
 /// </summary>
 /// <param name="startup_information">スタートアップ情報</param>
 private static void GetCancelStartup(
     ref System.Collections.Generic.List <StartupInformation> startup_information
     )
 {
     GetDesignationCancelStartup(ref startup_information, StartupRegisterPlace.FolderLogonUser, StartupRegistryHidePath.DisabledFolderLogonUser());
     GetDesignationCancelStartup(ref startup_information, StartupRegisterPlace.FolderAllUser, StartupRegistryHidePath.DisabledFolderAllUser());
     GetDesignationCancelStartup(ref startup_information, StartupRegisterPlace.RegistryLogonUser, StartupRegistryHidePath.DisabledRegistryLogonUser());
     if (System.Environment.Is64BitProcess)
     {
         GetDesignationCancelStartup(ref startup_information, StartupRegisterPlace.RegistryAllUser, StartupRegistryHidePath.DisabledRegistryAllUser());
         GetDesignationCancelStartup(ref startup_information, StartupRegisterPlace.RegistryAllUser32Bit, StartupRegistryHidePath.DisabledRegistryAllUser32Bit());
     }
 }
 /// <summary>
 /// レジストリに登録されているスタートアップを取得
 /// </summary>
 /// <param name="startup_information">スタートアップ情報</param>
 private static void GetRegistryStartup(
     ref System.Collections.Generic.List <StartupInformation> startup_information
     )
 {
     GetDesignationRegistry(ref startup_information, StartupRegisterPlace.RegistryLogonUser, StartupRegistryHidePath.LogonUser());
     GetDesignationRegistry(ref startup_information, StartupRegisterPlace.RegistryAllUser, StartupRegistryHidePath.AllUser());
     GetDesignationRegistry(ref startup_information, StartupRegisterPlace.RegistryLogonUserOnce, StartupRegistryHidePath.LogonUserOnce());
     GetDesignationRegistry(ref startup_information, StartupRegisterPlace.RegistryAllUserOnce, StartupRegistryHidePath.AllUserOnce());
     if (System.Environment.Is64BitProcess)
     {
         GetDesignationRegistry(ref startup_information, StartupRegisterPlace.RegistryAllUser32Bit, StartupRegistryHidePath.AllUser32Bit());
         GetDesignationRegistry(ref startup_information, StartupRegisterPlace.RegistryAllUserOnce32Bit, StartupRegistryHidePath.AllUserOnce32Bit());
     }
 }