Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. [URGENT]: RegOpenKeyEx() fails to open the specific key.

[URGENT]: RegOpenKeyEx() fails to open the specific key.

Scheduled Pinned Locked Moved C / C++ / MFC
securityhelptutorialquestion
9 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Supriya Tonape
    wrote on last edited by
    #1

    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

    M L 2 Replies Last reply
    0
    • S 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

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      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:

      S 1 Reply Last reply
      0
      • M Mark Salsbery

        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:

        S Offline
        S Offline
        Supriya Tonape
        wrote on last edited by
        #3

        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.

        M 1 Reply Last reply
        0
        • S 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.

          M Offline
          M Offline
          Mark Salsbery
          wrote on last edited by
          #4

          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:

          S 1 Reply Last reply
          0
          • M Mark Salsbery

            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:

            S Offline
            S Offline
            Supriya Tonape
            wrote on last edited by
            #5

            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

            S M 2 Replies Last reply
            0
            • S 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

              S Offline
              S Offline
              Supriya Tonape
              wrote on last edited by
              #6

              nope KEY_QUERY_VALUE doesnt work.. i am not clear abt 2nd option you told..

              1 Reply Last reply
              0
              • S 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

                M Offline
                M Offline
                Mark Salsbery
                wrote on last edited by
                #7

                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:

                S 1 Reply Last reply
                0
                • M Mark Salsbery

                  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:

                  S Offline
                  S Offline
                  Supriya Tonape
                  wrote on last edited by
                  #8

                  I am taking break :( will reply you after some time. thx for the help!!! appreciate it. (for the time being resolved the prob though.)

                  1 Reply Last reply
                  0
                  • S 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

                    L Offline
                    L Offline
                    leckey 0
                    wrote on last edited by
                    #9

                    No one cares. Read the site guidelines.

                    Blog link to be reinstated at a later date.

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups