Article View: borland.public.cppbuilder.nativeapi
Article #15684Re: RegQueryValueEx problem
From: Remy Lebeau (TeamB)
Date: Fri, 20 Jun 2003 21:48
Date: Fri, 20 Jun 2003 21:48
42 lines
2253 bytes
2253 bytes
"robertbienert<AT>gmx.net gmx.net >" <"robertbienert<AT> wrote in message
news:3ef379f4@newsgroups.borland.com...
> What can the DLL to with this third parameter?
Just pass it as-is to RegQueryValueEx(), ie:
int __stdcall getShellFolder(int folder, char *buffer, DWORD buffersize)
{
//...
RegQueryValueEx(regh, regkey, NULL, NULL,
reinterpret_cast<LPBYTE>(buffer), &buffersize);
//...
}
Or, if you go the SHGetSpecialFolderLocation() approach (which you should do
anyway):
int __stdcall getShellFolder(int folder, char *buffer, DWORD buffersize)
{
LPITEMIDLIST pidl = NULL;
int retval = 0;
if( buffersize >= MAX_PATH )
{
if( SUCCEEDED(SHGetSpecialFolderLocation(NULL, folder, &pidl)) )
{
retval = SHGetPathFromIDList(pidl, buffer);
CoTaskMemFree(pidl);
}
}
return retval;
}
> It can see, that the buffer maybe to small.
Yes, though RegQueryValueEx() already does that for you.
Gambit
Technical Details
Message-ID:
<3ef3804e$1@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-09!supernews.com!news.maxwell.syr.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<3eef5413@newsgroups.borland.com> <3eef5db8$1@newsgroups.borland.com> <3ef0879a$1@newsgroups.borland.com> <3ef09c68@newsgroups.borland.com> <3ef0da0c@newsgroups.borland.com> <3ef0de90@newsgroups.borland.com> <3ef379f4@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-20 14:51:41 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> <3ef09c68@newsgroups.borland.com> <3ef0da0c@newsgroups.borland.com> <3ef0de90@newsgroups.borland.com> <3ef379f4@newsgroups.borland.com> Subject: Re: RegQueryValueEx problem Date: Fri, 20 Jun 2003 14:48:47 -0700 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: 207.175.226.26 Message-ID: <3ef3804e$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1056145486 207.175.226.26 (20 Jun 2003 14:44:46 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail