[URGENT]: RegOpenKeyEx() fails to open the specific key.
-
Hi, I am trying to open this key : "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MRxDAV\EncryptedDirectories" I am getting error code '5' when I try to access this key which means 'Access Denied'. However I am able to access other subkey in same hierarchy eg. "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MRxDAV\Security" Can anybody tell how to avoid this '5' error or whats the cause of it ? Also I am the admin on the machine on which I am scanning this regkey. Thanks, Supriya Tonape
-
Hi, I am trying to open this key : "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MRxDAV\EncryptedDirectories" I am getting error code '5' when I try to access this key which means 'Access Denied'. However I am able to access other subkey in same hierarchy eg. "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MRxDAV\Security" Can anybody tell how to avoid this '5' error or whats the cause of it ? Also I am the admin on the machine on which I am scanning this regkey. Thanks, Supriya Tonape
You need to run your app with elevated privileges. Right click your app and choose "Run as Administrator" and it should work. What does your RegOpenKeyEx() code look like? Are you requesting more access rights than you need? Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
You need to run your app with elevated privileges. Right click your app and choose "Run as Administrator" and it should work. What does your RegOpenKeyEx() code look like? Are you requesting more access rights than you need? Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
Yes I am an Admin on the machine I am running this query/app.. Here is a code : //Attempt to open the key on the target. int retval = RegOpenKeyEx( hkRegHive, // Hive of the RegKey pszRegFullKeyPath, // Full path of the key excluding Hive name 0, // Reserved KEY_READ | (Node32Bit ? KEY_WOW64_64KEY : 0), // Access rights to the key &hkScanKey); // Handle to opened key if(retval != NSCOK) return FALSE; Ouput : retval = 5 regards, Supriya Tonape.
-
Yes I am an Admin on the machine I am running this query/app.. Here is a code : //Attempt to open the key on the target. int retval = RegOpenKeyEx( hkRegHive, // Hive of the RegKey pszRegFullKeyPath, // Full path of the key excluding Hive name 0, // Reserved KEY_READ | (Node32Bit ? KEY_WOW64_64KEY : 0), // Access rights to the key &hkScanKey); // Handle to opened key if(retval != NSCOK) return FALSE; Ouput : retval = 5 regards, Supriya Tonape.
Supriya Tonape wrote:
Yes I am an Admin on the machine I am running this query/
That doesn't matter on Vista. You still need to run the process with elevated privileges to perform certain operations, even if you're an administrator. Try KEY_QUERY_VALUE instead of KEY_READ. If that doesn't work then your app requires elevated privileges (you can set this up in the app manifest to force a UAC prompt). Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
Supriya Tonape wrote:
Yes I am an Admin on the machine I am running this query/
That doesn't matter on Vista. You still need to run the process with elevated privileges to perform certain operations, even if you're an administrator. Try KEY_QUERY_VALUE instead of KEY_READ. If that doesn't work then your app requires elevated privileges (you can set this up in the app manifest to force a UAC prompt). Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
I am running this application on XP right now but yes includes Vista too though. I will try what you told. will get back to you. Regards, Supriya Tonape
-
I am running this application on XP right now but yes includes Vista too though. I will try what you told. will get back to you. Regards, Supriya Tonape
nope KEY_QUERY_VALUE doesnt work.. i am not clear abt 2nd option you told..
-
I am running this application on XP right now but yes includes Vista too though. I will try what you told. will get back to you. Regards, Supriya Tonape
You should be able to read that key. What's the value of Node32Bit at the time of the call? What are the permissions set on that key? You can view them in regedit. Are you looking in your own registry or a registry on a remote machine?
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
You should be able to read that key. What's the value of Node32Bit at the time of the call? What are the permissions set on that key? You can view them in regedit. Are you looking in your own registry or a registry on a remote machine?
Mark Salsbery Microsoft MVP - Visual C++ :java:
I am taking break :( will reply you after some time. thx for the help!!! appreciate it. (for the time being resolved the prob though.)
-
Hi, I am trying to open this key : "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MRxDAV\EncryptedDirectories" I am getting error code '5' when I try to access this key which means 'Access Denied'. However I am able to access other subkey in same hierarchy eg. "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MRxDAV\Security" Can anybody tell how to avoid this '5' error or whats the cause of it ? Also I am the admin on the machine on which I am scanning this regkey. Thanks, Supriya Tonape