Article View: borland.public.cppbuilder.nativeapi
Article #15774Re: RegQueryValueEx problem
From: Remy Lebeau (TeamB)
Date: Wed, 18 Jun 2003 21:54
Date: Wed, 18 Jun 2003 21:54
35 lines
2646 bytes
2646 bytes
"robertbienert<AT>gmx.net gmx.net >" <"robertbienert<AT> wrote in message
news:3ef0da0c@newsgroups.borland.com...
> I'm very sorry, but I haven't checked GetLastError
> so far, maybe because it isn't mentioned in my
> version of Win32.HLP from www.activevb.de.
C++Builder comes with its own copy of the Win32 help files, and you can
always just look everything up at MSDN online directly.
> Here you are: That are the main c file plus the
> header file for both the dll and the using exe:
You didn't include the EXE's actual code at all. You are not showing how
you are actually allocating the buffer that you want your DLL function to
fill in. You're allowing any arbitrary buffer to be passed in from the EXE,
but the DLL is assuming its own buffer size instead of allowing the EXE to
tell the DLL exactly what the buffer size really is.
In fact, looking over this code, you are not assigning any kind of actual
value to your buffer size in the first place. You declared your buffer size
as a pointer that you never actually assign to point to anywhere meaningful.
As such, you're going to have any sort of potential problems when you are
using the value later on because it is not valid to begin with.
I would suggest the simpler of the two possible solutions - just get rid of
your buffer size variable from the DLL altogether and let the function
accept an additional parameter so the EXE call specifically tell the DLL
exactly what the buffer size already is:
int __stdcall getShellFolder(int folder, char *buffer, DWORD buffersize)
Gambit
Technical Details
Message-ID:
<3ef0de90@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-08!supernews.com!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> <3ef09c68@newsgroups.borland.com> <3ef0da0c@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 15:01:40 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> Subject: Re: RegQueryValueEx problem Date: Wed, 18 Jun 2003 14:54:04 -0700 Lines: 37 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: <3ef0de90@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1055973008 207.175.226.26 (18 Jun 2003 14:50:08 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail