Article View: borland.public.cppbuilder.nativeapi
Article #15760Re: RegQueryValueEx problem
From: Remy Lebeau (TeamB)
Date: Wed, 18 Jun 2003 17:11
Date: Wed, 18 Jun 2003 17:11
34 lines
2164 bytes
2164 bytes
"robertbienert<AT>gmx.net gmx.net >" <"robertbienert<AT> wrote in message
news:3ef0879a$1@newsgroups.borland.com...
> Have you got an example for this?
LPITEMIDLIST pidl = NULL;
char buffer[MAX_PATH+1] = {0};
if( SUCCEEDED(SHGetSpecialFolderLocation(Handle, CSIDL_PERSONAL,
&pidl)) )
{
SHGetPathFromIDList(pidl, buffer);
CoTaskMemFree(pidl);
}
> buffer comes from the calling exe (this is a snipet
> from a dll) and is type char* or LPCSTR (or so).
> Buffsize is its size + 1 byte for the terminating null.
Please always show that when posting code, those are important details.
You still didn't answer my other questions, though - what are the return
values of RegQueryValueEx() and GetLastError() when the code is failing?
> If I call RegCloseKey when RegQueryEx failed, I got an acces violation.
Then I would suspect that you are corrupting your memory in general. Your
buffer is probably invalid, and you are probably overflowing it and writing
into surrounding memory, which is probably writting over your HKEY handle as
well. Please post more complete code snippets.
Gambit
Technical Details
Message-ID:
<3ef09c68@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!news.maxwell.syr.edu!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailReferences:
<3eef5413@newsgroups.borland.com> <3eef5db8$1@newsgroups.borland.com> <3ef0879a$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,5800567a1464c960 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-06-18 10:13:14 PST From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3eef5413@newsgroups.borland.com> <3eef5db8$1@newsgroups.borland.com> <3ef0879a$1@newsgroups.borland.com> Subject: Re: RegQueryValueEx problem Date: Wed, 18 Jun 2003 10:11:45 -0700 Lines: 36 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: 207.175.226.26 Message-ID: <3ef09c68@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1055956072 207.175.226.26 (18 Jun 2003 10:07:52 -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!news.maxwell.syr.edu!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail