🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #16650

Re: Trying DeleteKey in the registry

#16650
From: Fernando Alvarez
Date: Sat, 03 May 2003 10:22
42 lines
2700 bytes
I am the administrator user in windows XP SP1. I have opened regedt32.exe
and I have all the permissions. I can delete, write, change, etc manually in
the registry. Then, I have done a test. I have wrotten a new key in
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run with name
Hello and value nothing.
So, I have changed my code and it doesn�t work again. I am using BCB 5. This
is my code:

int result;
        TRegistry *registry = new TRegistry();
        registry->RootKey = HKEY_LOCAL_MACHINE;

if(!registry->DeleteKey("\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run
\\Hello"))
                result = GetLastError();
        delete registry;

I think the problem is in DeleteKey. I might have to open the key and then
just delete it, or I dont�t know, to do something different. Any idea? Ah,
a last thing, the type of the key is REG_SZ. Is this important?

Thank you for your help.

"Remy Lebeau (TeamB)" <gambit47@yahoo.com> escribi� en el mensaje
news:3eb30813$1@newsgroups.borland.com...
>
> "Fernando Alvarez" <ferjat@lycos.es> wrote in message
> news:3eb30488$1@newsgroups.borland.com...
> > Now result=5.
>
> As I thought, DeketeKey() is failing.  Error 5 is ERROR_ACCESS_DENIED.  In
> other words, you tried to delete a key you don't have access to.
>
> What OS are you trying this under?  If NT/Win2K/XP, are you trying to do
> this under a user account with admin rights?  If not, then that is
probably
> why it is failing.
>
>
> Gambit
>
>
Technical Details
Message-ID: <3eb39873@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-08!supernews.com!216.166.71.14.MISMATCH!border3.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <3eb2faf3$1@newsgroups.borland.com> <3eb2fbdb$1@newsgroups.borland.com> <3eb30123@newsgroups.borland.com> <3eb302cb$1@newsgroups.borland.com> <3eb30488$1@newsgroups.borland.com> <3eb30813$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 10cc67,3359b20f1ef9dc9
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-05-03 04:04:55 PST
From: "Fernando Alvarez" <ferjat@lycos.es>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3eb2faf3$1@newsgroups.borland.com> <3eb2fbdb$1@newsgroups.borland.com> <3eb30123@newsgroups.borland.com> <3eb302cb$1@newsgroups.borland.com> <3eb30488$1@newsgroups.borland.com> <3eb30813$1@newsgroups.borland.com>
Subject: Re: Trying DeleteKey in the registry
Date: Sat, 3 May 2003 12:22:43 +0200
Lines: 44
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 81.203.10.123
Message-ID: <3eb39873@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1051957363 81.203.10.123 (3 May 2003 03:22:43 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-08!supernews.com!216.166.71.14.MISMATCH!border3.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail