- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
using System;
using Microsoft.Win32;
namespace Reester
{
class Program
{
static void Main(string[] args)
{
RegCreatySubKey();
}
private static void RegCreatySubKey()
{
RegistryKey regKey = Registry.LocalMachine;
string[] shell = new[] { "SOFTWARE", "Microsoft", "Windows", "CurrentVersion", "Explorer", "CommandStore", "shell" };
string prog = "Programma";
1) using (regKey = Registry.LocalMachine.OpenSubKey(shell[0],true))// тут regKey равно{HKEY_LOCAL_MACHINE}
2) { //сдеть уже regKey равно {HKEY_LOCAL_MACHINE\SOFTWARE}
3) if (regKey != null)//и тут уже regkey равно Null.А дальше программа не идет.
{
using (regKey = Registry.LocalMachine.OpenSubKey(shell[1], true))
{
if (regKey != null)
{
using (regKey = Registry.LocalMachine.OpenSubKey(shell[2], true))
{
if (regKey != null)
{
using (regKey = Registry.LocalMachine.OpenSubKey(shell[3], true))
{
if (regKey != null)
{
using (regKey = Registry.LocalMachine.OpenSubKey(shell[4], true))
{
if (regKey != null)
{
using (regKey = Registry.LocalMachine.OpenSubKey(shell[5], true))
{
if (regKey != null)
{
using (regKey = Registry.LocalMachine.OpenSubKey(shell[6], true))
{
if (regKey != null)
{
regKey.CreateSubKey(prog);
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
guest 31.12.2014 14:32 # 0
bormand 31.12.2014 17:08 # 0
Psilon 31.12.2014 17:18 # +1
hack2root 09.01.2015 20:25 # 0
guest 09.01.2015 22:09 # +1
inkanus-gray 10.01.2015 17:07 # 0
guest 13.01.2015 05:02 # +2
bormand 13.01.2015 06:15 # 0
guest 13.01.2015 10:11 # 0
gost 31.12.2014 18:22 # +1
inkanus-gray 01.01.2015 14:06 # +2
guest 02.01.2015 15:26 # +3
guest 03.01.2015 22:35 # 0
hack2root 09.01.2015 20:23 # 0
mirTONU 25.08.2021 07:14 # 0