Article View: borland.public.cppbuilder.nativeapi
Article #13857what's wrong with this code?
From: FrankW
Date: Sun, 14 Sep 2003 03:15
Date: Sun, 14 Sep 2003 03:15
38 lines
2052 bytes
2052 bytes
Hi Remy,
Thanks for the reply and sorry for the wrong news group I posted the
question, I tried the KEY_READ right, i still get the same error 161:
LONG lResult;
HKEY hKeyResult = 0;
lResult = RegOpenKeyEx( HKEY_CURRENT_USER,
PChar("\\Software\\Borland\\C++Builder\\4.0"), 0, KEY_READ , &hKeyResult);
//lResult is always 161, why?
if (lResult == ERROR_SUCCESS)
{
}
regards,
Frank
"Remy Lebeau (TeamB)" <gambit47@yahoo.com> wrote in message
news:3f63d9a7@newsgroups.borland.com...
>
> Under NT/2K/XP, KEY_ALL_ACCESS requires the calling user to have admin
> rights. You should NEVER use KEY_ALL_ACCESS in your own code whenever you
> can avoid it.
>
> If you are only going to modify a key's contents, you should open the key
> with KEY_WRITE rights. Even better would be if you can design your code
so
> that you can specify KEY_CREATE_SUB_KEY and KEY_SET_VALUE separately.
>
> If you are only going to read from the key, you should open the key with
> KEY_READ rights. Or better, if you can specify KEY_ENUMERATE_SUB_KEYS and
> KEY_QUERY_VALUE separately.
Technical Details
Message-ID:
<3f63ddac@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!newsfeed.news2me.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,636b723329c7c5e8,start X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-09-13 20:21:24 PST Reply-To: "FrankW" <nospam@nospam.com> From: "FrankW" <nospam@nospam.com> Newsgroups: borland.public.cppbuilder.nativeapi Subject: what's wrong with this code? Date: Sun, 14 Sep 2003 11:15:48 +0800 Lines: 40 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 203.131.162.116 Message-ID: <3f63ddac@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1063509420 203.131.162.116 (13 Sep 2003 20:17:00 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!newsfeed.news2me.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail