🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Problem with GetVolumeInformation

#16666
From: Remy Lebeau (TeamB)
Date: Sun, 04 May 2003 19:48
30 lines
1988 bytes
"hpl" <hpl.muc@web.de> wrote in message
news:3eb5353d$1@newsgroups.borland.com...

> unsigned int vlabellength;
> GetVolumeLabel ("D:\\", vlabel, vlabellength, NULL, NULL, NULL,NULL)

There is no GetVolumeLabel() function.  Please always copy/paste your actual
source code, do not re-type it by hand.

Now then, with that said, you didn't initialize your 'vlabellength' variable
before passing it in to the function.  You need to do that, otherwise the
value will be initialized with a random value from the memory it occupies,
and you will end up with undefined results.  That variable tells the
function how large your buffer is.  If it gets initialized with a random
value, then the function will think your buffer is a different size then it
really is.

    char vlabel[32] = {0};
    unsigned int vlabellength = 32;
    GetVolumeInformation("D:\\", vlabel, vlabellength, NULL, NULL, NULL,
NULL, 0);

Or simply:

    char vlabel[32] = {0};
    GetVolumeInformation("D:\\", vlabel, 32, NULL, NULL, NULL, NULL, 0);


Gambit
Technical Details
Message-ID: <3eb56e26$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <3eb5353d$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,6cac0dea2ce496bd
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-05-04 12:53:38 PST
From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3eb5353d$1@newsgroups.borland.com>
Subject: Re: Problem with GetVolumeInformation
Date: Sun, 4 May 2003 12:48:23 -0700
Lines: 32
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: <3eb56e26$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1052077606 207.175.226.26 (4 May 2003 12:46:46 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail