Hi all , i just wanted to know ,why the **** this thing doenst work , i've tested the code 10 mins ago it worked ,and now ,it doesnt .
static private bool ExistanceCheck(string Start, string SubKeyPath, string KeyName, string DefaultVal)//true , changed, false (unexistante , other value)
{
RegistryKey rk = Registry.LocalMachine;//fcking c#
if (Start == "HKLM")
{
rk = Registry.LocalMachine;
}
else if (Start == "HKCU")
{
rk = Registry.CurrentUser;
}
rk = rk.OpenSubKey(SubKeyPath);
object valor = rk.GetValue(KeyName);
try
{
if (valor.ToString() == "")
{
return false;
}
}
catch (Exception)
{
return false;
}
return true;
}
I call it with : bool xyz = ExistanceCheck("HKCU", "SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "DisableRegistryTools", "0");
Btw ,to it to work we need using Microsoft.Win32; .