DiskSize/DiskFree error 
Author Message
 DiskSize/DiskFree error

Hi group,

TP7 is unable to display the correct disksize and diskfree if the value is
greater than 2gb. Is there a fix? I searched on dejanews but all the results
were related to Delphi.

Thanks.



Wed, 18 Jun 1902 08:00:00 GMT  
 DiskSize/DiskFree error

|Hi group,

|TP7 is unable to display the correct disksize and diskfree if the value is
|greater than 2gb. Is there a fix? I searched on dejanews but all the results
|were related to Delphi.

Look up Int21h function 7302h in Ralf Brown's Interrupt List.

Phil



Wed, 18 Jun 1902 08:00:00 GMT  
 DiskSize/DiskFree error
anonymous schrieb:

Quote:
> TP7 is unable to display the correct disksize and diskfree if the value is
> greater than 2gb. Is there a fix? I searched on dejanews but all the results
> were related to Delphi.

Yes there is one if your OS is Windows 9x. I've written a unit primary
for the use of long filenames with BP, but in this unit are also e never
version of DiskFree/DiskSize that work with larger drives.

Check out http://home.t-online.de/home/andreas.killer/ for the unit LFN.

By, Andreas.



Wed, 18 Jun 1902 08:00:00 GMT  
 DiskSize/DiskFree error

Quote:
> Hi group,

> TP7 is unable to display the correct disksize and diskfree if the value is
> greater than 2gb. Is there a fix? I searched on dejanews but all the results
> were related to Delphi.

> Thanks.

GetKbFree and  GetKbSize return the free space available in kilobytes and the
total size of the drive in kilobytes, respectively.

type
  { GetDiskInfo record }

  TDiskInfo = packed record
    SectsPerCluster: Word;
    BytesPerSector : Word;
    ClustersFree   : Word;
    ClustersTotal  : Word;
  end;

function LongMul(X, Y: Integer): Longint; inline (
  $5A/$58/$F7/$EA);

function GetDiskInfo(Drive: Byte; var DiskInfo: TDiskInfo): Boolean;
assembler;
asm
            mov   dl,[Drive]
            mov   ah,$36
            int   $21
            les   di,[DiskInfo]
            cmp   ax,-1
            mov   [es:di+TDiskInfo.SectsPerCluster],ax
            mov   al,0

            mov   [es:di+TDiskInfo.BytesPerSector],cx
            mov   [es:di+TDiskInfo.ClustersFree],bx
            mov   [es:di+TDiskInfo.ClustersTotal],dx

end;

function GetKbFree(Drive: Byte): Longint;
var
  DiskInfo: TDiskInfo;
begin
  GetKbFree := 0;
  if GetDiskInfo(Drive, DiskInfo)
   then with DiskInfo do
    GetKbFree := LongMul(LongMul(SectsPerCluster, BytesPerSector) shr 5,
                         ClustersFree) shr 5;
end;

function GetKbSize(Drive: Byte): Longint;
var
  DiskInfo: TDiskInfo;
begin
  GetKbSize := 0;
  if GetDiskInfo(Drive, DiskInfo)
   then with DiskInfo do
    GetKbSize := LongMul(LongMul(SectsPerCluster, BytesPerSector) shr 5,
                         ClustersTotal) shr 5;
end;

--
Jay

Jason Burgon - Author of Graphic Vision
New version 2 now available from:
http://www.jayman.demon.co.uk



Wed, 18 Jun 1902 08:00:00 GMT  
 DiskSize/DiskFree error
|GetKbFree and  GetKbSize return the free space available in kilobytes and the
|total size of the drive in kilobytes, respectively.

|type
|  { GetDiskInfo record }

|  TDiskInfo = packed record
|    SectsPerCluster: Word;
|    BytesPerSector : Word;
|    ClustersFree   : Word;
|    ClustersTotal  : Word;
|  end;

This code does not work on a FAT32 drive where the ClustersFree and
ClustersTotal can both exceed MaxWord.

Use Int 21 AX=7302

Phil



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. DiskFree and DiskSize - HD > 2.2

2. DiskSize, DiskFree HD > 2 GO

3. DiskSize, DiskFree HD > 2 GO

4. DiskFree and DiskSize on large/NonDos drives

5. Updated DiskSize support for FAT32

6. DiskSize >= 2gB

7. diskfree V2 **whinging sods**

8. diskfree-etc source

9. diskfree() and large disks

10. Problem with DISKFREE on 2+ GIG drives?

11. Diskfree problem with large hard disks

12. DiskFree on network drives

 

 
Powered by phpBB® Forum Software