🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Shortcut Information

#1599
From: Remy Lebeau (TeamB)
Date: Thu, 05 Jul 2007 17:48
31 lines
1830 bytes
"Anthony" <anfo@hotmail.com> wrote in message
news:468cd95d@newsgroups.borland.com...

> char * pszFile;
> pszFile = location.c_str();
<snip>
> pShellLink->GetPath(pszFile,MAX_PATH, &pfd, SLGP_UNCPRIORITY);
> pShellLink->GetIconLocation(pszFile, MAX_PATH, &iShow);

You are writing both output values to the same char*, which in turn is
pointing at the string object's internal buffer.  If the string was
not preallocated to at least MAX_PATH characters, then you are going
to be writing into the surrounding memory.

I suggest you use a separate buffer, just like you are when calling
Load(), ie:

    char buf[MAX_PATH+1] = {0};

    if( SUCCEEDED(pShellLink->GetPath(buf, MAX_PATH, &pfd,
SLGP_UNCPRIORITY)) )
        location = buf;

    memset(buf, 0, sizeof(buf));
    if( SUCCEEDED(pShellLink->GetIconLocation(buf, MAX_PATH,
&iShow)) )
        location = buf;


Gambit
Technical Details
Message-ID: <468d2ed5$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.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: <468cd95d@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,825201284ddf9acd
X-Google-Attributes: gid10cc67,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <468cd95d@newsgroups.borland.com>
Subject: Re: Shortcut Information
Date: Thu, 5 Jul 2007 10:48:04 -0700
Lines: 34
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 75.82.252.126
Message-ID: <468d2ed5$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1183657685 75.82.252.126 (5 Jul 2007 10:48:05 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.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: 1686