日期:2014-05-17 浏览次数:20774 次
private delegate bool IncreaseProbarHandler(int nIncVal); //Declare a delegate to increase the progress bar value.
private IncreaseProbarHandler _IncHanler = null;
private List<Microsoft.Win32.RegistryKey> _RKeys = new List<Microsoft.Win32.RegistryKey>(); //Store the RegistryKey.
public MainForm() {
InitializeComponent();
}
private void MainForm_Load(object sender, EventArgs e) {
new Thread(ProThread).Start();
RecursiveRegedit(Microsoft.Win32.Registry.CurrentUser);
//RecursiveRegedit(Microsoft.Win32.Registry.LocalMachine);
MessageBox.Show("Done!");
}
//Recursive scan the registry.
void RecursiveRegedit(Microsoft.Win32.RegistryKey regBoot) {
if(regBoot == null) throw new ArgumentNullException("Null Item!");
string[] vals = regBoot.GetValueNames();
foreach(var v in vals) {
if(regBoot.GetValue(v) != null) {
string s = regBoot.GetValue(v).ToString();
if(s.StartsWith("C:", StringComparison.CurrentCultureIgnoreCase))
_RKeys.Add(regBoot); //Add to 'List'.
}
}
if(regBoot.SubKeyCount <= 0) //Exit.
return;
else { //Recursive.
string[] subs = regBoot.GetSubKeyNames();
foreach(string s in subs) {
try {//