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. How to delete Registry Key with Maximum rights

How to delete Registry Key with Maximum rights

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++windows-admintutorial
6 Posts 2 Posters 3 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.
  • P Offline
    P Offline
    platso_588
    wrote on last edited by
    #1

    Hello,
    I like to delete the key 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\Root\LEGACY_HTTP\0000' programatically in C++. I get Error 5 which is Access Denied. I tried calling ACL functions but i could not succeed. Can any one help me by giving code snipped through which i can delete the above mentioned Registry Key.

    J 1 Reply Last reply
    0
    • P platso_588

      Hello,
      I like to delete the key 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\Root\LEGACY_HTTP\0000' programatically in C++. I get Error 5 which is Access Denied. I tried calling ACL functions but i could not succeed. Can any one help me by giving code snipped through which i can delete the above mentioned Registry Key.

      J Offline
      J Offline
      Jochen Arndt
      wrote on last edited by
      #2

      You must open the parent key by calling RegOpenKeyEx() with the DELETE access right. Because the key is in HKLM, your code must be also executed as administrator.

      P 1 Reply Last reply
      0
      • J Jochen Arndt

        You must open the parent key by calling RegOpenKeyEx() with the DELETE access right. Because the key is in HKLM, your code must be also executed as administrator.

        P Offline
        P Offline
        platso_588
        wrote on last edited by
        #3

        Thank you. I tried this option aswell, I could able to Delete keys under HKLM\Software\ but could not able to delete the key that i mentioned. I think i need to get access rights beyond Administrator rights inorder to delete the Registry enrty that i mentioned.

        J 1 Reply Last reply
        0
        • P platso_588

          Thank you. I tried this option aswell, I could able to Delete keys under HKLM\Software\ but could not able to delete the key that i mentioned. I think i need to get access rights beyond Administrator rights inorder to delete the Registry enrty that i mentioned.

          J Offline
          J Offline
          Jochen Arndt
          wrote on last edited by
          #4

          You are trying to delete a system key. Such keys can be only deleted by the owner (the user SYSTEM). If you really want to delete such a key (you should know what you are doing), you must change the access rights of the key (e.g. by allowing full access for administrators).

          P 1 Reply Last reply
          0
          • J Jochen Arndt

            You are trying to delete a system key. Such keys can be only deleted by the owner (the user SYSTEM). If you really want to delete such a key (you should know what you are doing), you must change the access rights of the key (e.g. by allowing full access for administrators).

            P Offline
            P Offline
            platso_588
            wrote on last edited by
            #5

            I checked my Administrator has Full right Access. But Still i could not delete the registry Key that i Mentioned.

            J 1 Reply Last reply
            0
            • P platso_588

              I checked my Administrator has Full right Access. But Still i could not delete the registry Key that i Mentioned.

              J Offline
              J Offline
              Jochen Arndt
              wrote on last edited by
              #6

              By default administrators did not have full access to system keys. See the MSDN article Registry Key Security and Access Rights[^] about accessing system keys.

              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