DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3
  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

Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links