i want to check that registry of a particular program
actually i created two exe files and in the the second exe i want to check if registery of first exe.
if the exe of first exe is working fine then it will do some operations
if not then it will do diffrent operation
the first registry is
RegOpenKey(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion\\Run",&newValue);
RegSetValueEx(newValue,"microsoft security",0,REG_SZ,(LPBYTE)path,sizeof(path));
i check this manually in regedit .this is sucessfully added .
but
i add following code in second exe to check if the first registry is working or not
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("microsoft security"), 0, KEY_ALL_ACCESS, &hKey)!=ERROR_SUCCESS)
{
cout<<"NOT WORKING\n";
}
else
{
cout<<"REGISTRY ALREADY PRESENT\n";
}
but this is always showing message "not working" but in actual key is present as i check manually wat could be reason
plzz provide improved code