Article View: borland.public.cppbuilder.nativeapi
Article #11078Re: Problems getting DISK_GEOMETRY under WinME
From: Remy Lebeau (TeamB)
Date: Wed, 25 Feb 2004 19:59
Date: Wed, 25 Feb 2004 19:59
66 lines
3246 bytes
3246 bytes
"Walt Morrey" <dadinc@bellsouth.net> wrote in message
news:403cb6ce@newsgroups.borland.com...
> With a couple of (DWORD)'s, that compiled and ran --
> it again gave me the same stuff for 26 drives.
I will have to look into it more deeply later, I don't have time at the
moment to actually run through it. Offhand, did you verify that you really
are passing a different drive letter each time you invoke DeviceIoControl()?
> DriveStringBufferSize = GetLogicalDriveStrings( 256,
DriveStringBuffer );
Since you are already retrieving the drive strings in "C:\\" format to begin
with (you did not show that earlier, which is why I did not comment on it),
you can get rid of half your looping and just pass the drive strings to
GetDRIVEINFO() directly, ie:
bool GetDRIVEINFO(const char* Drive, PExtGetDskFreSpcStruct poreg)
{
//...
reg.reg_EDX = (DWORD)Drive;
//...
}
void __fastcall TForm1::GetDrive(TObject *Sender)
{
AnsiString IString;
ExtGetDskFreSpcStruct DriveInfo;
char str[256], DriveStringBuffer[108] = {0}, *drive;
SetFileApisToOEM();
GetLogicalDriveStrings( sizeof(DriveStringBuffer),
DriveStringBuffer );
drive = DriveStringBuffer;
Memo1->Lines->Clear();
while( *drive != '\0' )
{
if( GetDRIVEINFO(drive, &DriveInfo) )
{
sprintf( str, "Drive %s: 0x%08x 0x%08x 0x%08x 0x%08x
0x%08x",
drive,
DriveInfo.TotalClusters,
DriveInfo.TotalPhysSectors,
DriveInfo.SectorsPerCluster,
DriveInfo.BytesPerSector,
DriveInfo.TotalClusters,
DriveInfo.TotalPhysSectors,
DriveInfo.TotalAllocationUnits );
Memo1->Lines->Append( str );
}
else
Memo1->Lines->Append( "Error on Drive " +
AnsiString(drive) );
drive += 4;
}
}
Gambit
Technical Details
Message-ID:
<403cfcba$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-05!sn-xit-09!supernews.com!newsread.com!newsstand.newsread.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4037b73a$1@newsgroups.borland.com> <40382779$1@newsgroups.borland.com> <403a6854$1@newsgroups.borland.com> <403a7265@newsgroups.borland.com> <403cb6ce@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,8ef29fec1dea7408 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2004-02-25 12:10:39 PST From: "Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <4037b73a$1@newsgroups.borland.com> <40382779$1@newsgroups.borland.com> <403a6854$1@newsgroups.borland.com> <403a7265@newsgroups.borland.com> <403cb6ce@newsgroups.borland.com> Subject: Re: Problems getting DISK_GEOMETRY under WinME Date: Wed, 25 Feb 2004 11:59:38 -0800 Lines: 68 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: 67.22.138.253 Message-ID: <403cfcba$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1077738682 67.22.138.253 (25 Feb 2004 11:51:22 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-05!sn-xit-09!supernews.com!newsread.com!newsstand.newsread.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail