RegOpenKey error i cant figure out
-
HKEY hKey;
CString path;hKey = HKEY\_LOCAL\_MACHINE; err = ERROR\_SUCCESS; m\_list.InsertItem(0, "HKEY\_LOCAL\_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Installer\\\\UserData\\\\S-1-5-18\\\\Products\\\\109C30587D582624882DD8B8A2B7808B"); path = "SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Installer\\\\UserData\\\\S-1-5-18\\\\Products\\\\109C30587D582624882DD8B8A2B7808B"; err = RegOpenKeyEx(hKey, path, NULL, KEY\_ALL\_ACCESS, &hKey); if (err == ERROR\_SUCCESS) { m\_list.SetItemText(0, 1, "Found"); ErrorExit("RegOpenKey0"); } else { m\_list.SetItemText(0, 1, "Not Found"); <--- this is the one i keep getting ErrorExit("RegOpenKey1"); } RegCloseKey(hKey);
that is the code and it keeps returning error 2 system cant find file but i know the path is good i copied the key from regedit i am on vista 64 bit if it makes a differance ill take any help i can get
-
HKEY hKey;
CString path;hKey = HKEY\_LOCAL\_MACHINE; err = ERROR\_SUCCESS; m\_list.InsertItem(0, "HKEY\_LOCAL\_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Installer\\\\UserData\\\\S-1-5-18\\\\Products\\\\109C30587D582624882DD8B8A2B7808B"); path = "SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Installer\\\\UserData\\\\S-1-5-18\\\\Products\\\\109C30587D582624882DD8B8A2B7808B"; err = RegOpenKeyEx(hKey, path, NULL, KEY\_ALL\_ACCESS, &hKey); if (err == ERROR\_SUCCESS) { m\_list.SetItemText(0, 1, "Found"); ErrorExit("RegOpenKey0"); } else { m\_list.SetItemText(0, 1, "Not Found"); <--- this is the one i keep getting ErrorExit("RegOpenKey1"); } RegCloseKey(hKey);
that is the code and it keeps returning error 2 system cant find file but i know the path is good i copied the key from regedit i am on vista 64 bit if it makes a differance ill take any help i can get
locoone wrote:
that is the code and it keeps returning error 2 system cant find file...
If the function fails, the return value is a nonzero error code defined in
Winerror.h
."Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
-
locoone wrote:
that is the code and it keeps returning error 2 system cant find file...
If the function fails, the return value is a nonzero error code defined in
Winerror.h
."Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
-
HKEY hKey;
CString path;hKey = HKEY\_LOCAL\_MACHINE; err = ERROR\_SUCCESS; m\_list.InsertItem(0, "HKEY\_LOCAL\_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Installer\\\\UserData\\\\S-1-5-18\\\\Products\\\\109C30587D582624882DD8B8A2B7808B"); path = "SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Installer\\\\UserData\\\\S-1-5-18\\\\Products\\\\109C30587D582624882DD8B8A2B7808B"; err = RegOpenKeyEx(hKey, path, NULL, KEY\_ALL\_ACCESS, &hKey); if (err == ERROR\_SUCCESS) { m\_list.SetItemText(0, 1, "Found"); ErrorExit("RegOpenKey0"); } else { m\_list.SetItemText(0, 1, "Not Found"); <--- this is the one i keep getting ErrorExit("RegOpenKey1"); } RegCloseKey(hKey);
that is the code and it keeps returning error 2 system cant find file but i know the path is good i copied the key from regedit i am on vista 64 bit if it makes a differance ill take any help i can get
Do you get different results if you use KEY_QUERY_VALUE instead of KEY_ALL_ACCESS? Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
HKEY hKey;
CString path;hKey = HKEY\_LOCAL\_MACHINE; err = ERROR\_SUCCESS; m\_list.InsertItem(0, "HKEY\_LOCAL\_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Installer\\\\UserData\\\\S-1-5-18\\\\Products\\\\109C30587D582624882DD8B8A2B7808B"); path = "SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Installer\\\\UserData\\\\S-1-5-18\\\\Products\\\\109C30587D582624882DD8B8A2B7808B"; err = RegOpenKeyEx(hKey, path, NULL, KEY\_ALL\_ACCESS, &hKey); if (err == ERROR\_SUCCESS) { m\_list.SetItemText(0, 1, "Found"); ErrorExit("RegOpenKey0"); } else { m\_list.SetItemText(0, 1, "Not Found"); <--- this is the one i keep getting ErrorExit("RegOpenKey1"); } RegCloseKey(hKey);
that is the code and it keeps returning error 2 system cant find file but i know the path is good i copied the key from regedit i am on vista 64 bit if it makes a differance ill take any help i can get
Unicode? If I recall correctly it's possible to have keys that regedit can't display correctly. Thus, if you copy and paste you're not copying the entire key. I'd write a quick and dirty iteration over the root key dumping the raw bytes in each key name to make sure you have the entire key.
Rob Manderson My bloghttp://robmanderson.blogspot.com[^]