Deleting a Registry Key


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Deleting a Registry Key

  1. #1
    Daniel Guest

    Deleting a Registry Key


    I'm using the RegDeleteKey Api call to remove a key that was created by my
    install program.

    The call works fine under Win98, but fails in NT 4.0 because the Key contains
    sub-keys.

    The function returns error 5, which is Access Denied. However, If I go directly
    into the registry
    and manually delete the key WinNT has no problem with that. Any idea how
    to obtain permission
    to do this programmatically?





  2. #2
    Mattias Sjögren Guest

    Re: Deleting a Registry Key

    Daniel,

    >However, If I go directly into the registry and manually delete the key WinNT has no problem with that.


    Well, you aren't really going into the Registry. You are just using a
    utility (probably Regedit or Regedt32) that displays the the contents
    of the Registry. Those utilities use the Registry APIs too.


    >Any idea how to obtain permission to do this programmatically?


    There's no permission you can obtain, it's just a fact that you have
    to work around.

    When you delete a key with Regedit, it handles all the work of
    recursively deleting any subkeys, and that's what you have to do too,
    one way or another.


    Mattias

    __________________________________________________
    Mattias Sjögren (MCP) - mattiass @ hem.passagen.se
    VB+ http://hem.spray.se/mattias.sjogren/
    Please send questions/replies to the newsgroups

  3. #3
    Mattias Sjögren Guest

    Re: Deleting a Registry Key

    Daniel,

    >However, If I go directly into the registry and manually delete the key WinNT has no problem with that.


    Well, you aren't really going into the Registry. You are just using a
    utility (probably Regedit or Regedt32) that displays the the contents
    of the Registry. Those utilities use the Registry APIs too.


    >Any idea how to obtain permission to do this programmatically?


    There's no permission you can obtain, it's just a fact that you have
    to work around.

    When you delete a key with Regedit, it handles all the work of
    recursively deleting any subkeys, and that's what you have to do too,
    one way or another.


    Mattias

    __________________________________________________
    Mattias Sjögren (MCP) - mattiass @ hem.passagen.se
    VB+ http://hem.spray.se/mattias.sjogren/
    Please send questions/replies to the newsgroups

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center