🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: SHBindToParent problem.

#1657
From: Bob Gonder
Date: Wed, 27 Jun 2007 14:12
33 lines
2527 bytes
patrickartaud wrote:

>But now I have an error for
>StrRetToBuf(&str, pidlItem, szDisplayName, ARRAYSIZE(szDisplayName));
>I obtain acces violation at the address 770FE18D.Write at the adress 
>00000008
>
>The declaration of "buffer" is:
>char* szDisplayName;//[MAX_PATH];//= L"";   // The display name's string for 
>Favorites
>char* szPath;//[MAX_PATH] = L"";         // The path for Favorites.

That is NOT what the example shows.
The function is going to write to the memory that you point at, but your pointers are
garbage (apparently one of them currently holds an 8).

>yes I have looked and changed the WCHAR typedef of the example because I had 
>an error "improper use of typedef "WCHAR" and I have looked in the help that 
>was equivalent.

NOT evquivalent at all.
WCHAR  is a wchar_t, not a  char  (see wtypes.h)

Fix the Syntax, not the Type,
and certainly don't throw away the place you are going to get the information into.

	WCHAR	szDisplayName[ MAX_PATH ] = {0};
	WCHAR	szPath[ MAX_PATH ] = {0};

>I'm not very lucky with this example :
>http://msdn2.microsoft.com/en-us/library/aa930230.aspx

Mostly because you are trying to change it too much.
Technical Details
Message-ID: <8tq483lh023ihf32f2t3a7o7oenuvp9n26@4ax.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <467c00bc$1@newsgroups.borland.com> <fl1o73tka3i9em1qc6e8259qj5inidost9@4ax.com> <467cccc1@newsgroups.borland.com> <gq7q7313djtvh95k3n69m52drr0ccho44l@4ax.com> <467fdeed$1@newsgroups.borland.com> <la4083dagokmo2f56nc1ap3fqbg4b18e1n@4ax.com> <468124ff@newsgroups.borland.com> <4rb283tf5al4nlgfprsmana1fmcr8o60lb@4ax.com> <468151d0@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,dbc285481b02e32d
X-Google-Attributes: gid10cc67,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: Bob Gonder <notbg@notmindspring.invalid>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: SHBindToParent problem.
Date: Wed, 27 Jun 2007 07:12:12 -0700
Organization: MindSpring Enterprises, Inc.
Reply-To: notbg@notmindspring.invalid
Message-ID: <8tq483lh023ihf32f2t3a7o7oenuvp9n26@4ax.com>
References: <467c00bc$1@newsgroups.borland.com> <fl1o73tka3i9em1qc6e8259qj5inidost9@4ax.com> <467cccc1@newsgroups.borland.com> <gq7q7313djtvh95k3n69m52drr0ccho44l@4ax.com> <467fdeed$1@newsgroups.borland.com> <la4083dagokmo2f56nc1ap3fqbg4b18e1n@4ax.com> <468124ff@newsgroups.borland.com> <4rb283tf5al4nlgfprsmana1fmcr8o60lb@4ax.com> <468151d0@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.93/32.576 English (American)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 69.69.82.65
X-Trace: newsgroups.borland.com 1182953531 69.69.82.65 (27 Jun 2007 07:12:11 -0700)
Lines: 35
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
X-Original-Bytes: 2381