Exemplo n.º 1
0
 public static RegistryKey GetStartupRunKey(bool runOnce, StartupRegistryHives startupHive)
 {
     if (startupHive == StartupRegistryHives.CURRENT_USER)
     {
         if (runOnce)
         {
             return(HKCU_RunOnce_Key);
         }
         else
         {
             return(HKCU_Run_Key);
         }
     }
     else
     {
         if (runOnce)
         {
             return(HKLM_RunOnce_Key);
         }
         else
         {
             return(HKLM_Run_Key);
         }
     }
 }
Exemplo n.º 2
0
        public static void SetRunCommand(
            bool runOnce,
            StartupRegistryHives startupHive,
            string keyValueName,
            CMDForLoopCommand command)
        {
            string      registryKeyValueData = SystemPathConstants.CmdPathCommand + " " + command.ToString();
            RegistryKey startupRunKey        = GetStartupRunKey(runOnce, startupHive);

            Registry.SetValue(startupRunKey.Name, keyValueName, registryKeyValueData, RegistryValueKind.String);
        }
Exemplo n.º 3
0
        public static void SetRunCommand(
            bool runOnce,
            StartupRegistryHives startupHive,
            string keyValueName,
            CLICommand[] commands)
        {
            string registryKeyValueData = SystemPathConstants.CmdPathCommand;

            registryKeyValueData += CMDCommands.ToOneLine(commands);

            RegistryKey startupRunKey = GetStartupRunKey(runOnce, startupHive);

            Registry.SetValue(startupRunKey.Name, keyValueName, registryKeyValueData, RegistryValueKind.String);
        }