RegDeleteValue not deleting the value
Hi all,
I have a value in the registry of type REG_SZ in the key HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\ CurrentVersion\\Run
The registry entry looks like this.
Name: MyProg
Type: REG_SZ
Data: c:\MyProg.exe
Now i want to delete this from the registry so ive used the commands
Code:
HKEY hKey
RegOpenKeyEx( HKEY_LOCAL_MACHINE,TEXT("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"),0, KEY_ALL_ACCESS, &hKey);
RegDeleteValue(hKey,"MyProg");
RegCloseKey(hKey);
Is there anything immediately obviously wrong with this?
I also checked its Error_Success of the RegDeleteValue and it does not return ERROR_SUCCESS so it must not be deleting correctly.
Thanks for any help :)