Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Large volumes show as 2.1GB using FileSystemObject 1

Status
Not open for further replies.

BruceHesher

Programmer
Jul 7, 1999
50
US
I have written a program in VB5 that lists all of the drives, local and network, that are accessable to the PC on which the program is running. It displays the attributes of the partitions (filesysytem, size, freespace, etc). I used the Microsoft Scripting Runtime library scrrun.dll. The program works well except for one bug, the drive.totalsize and drive.freespace of a large partition show as 2.1GB (actually are 20GB and 18GB respectively). Any ideas?<br>
Also I was able to find the DLL but not the help file. Does anyone know where I can get the file &quot;VBENLR98.CHM&quot;?<br>
<br>
thanx Bruce<br>
<br>

 
Bruce -<br>
<br>
You must be running on Windows 95 or 98. They have a limitation on the largest file system object they can show, and if it's larger, they just show the 2gb value. This is part of their DOS heritage.<br>
<br>
If you were to run the same program on an NT box, you would see the correct size.<br>
<br>
To verify this, look at the properties of the drive in question (right-click, properties). It will show up there as only 2gb, too, so even explorer has the limitation.<br>
<br>
Chip H.<br>

 
according to microsoft if yer running Win98 with a Fat32 partition, the limit is 2 tetrebytes(always thought it was 32gigs)<br>
so far heres what i've heard<br>
Fat16 - 2 Gig<br>
Fat32 - 8gigs (i think Fat32X is the one that goes upto 2 tetre)<br>
NTFS - 64Gig<br>
Linux Ext2 ( 16 tetrebytes)<br>
<br>
correct those if i heard wrong <p>Karl<br><a href=mailto:kb244@bellsouth.net>kb244@bellsouth.net</a><br><a href= </a><br>
 
kb244 --<br>
<br>
NTFS uses a 64-bit file pointer, so it has a limit of 16.384 Zettabytes (16 Giga-gigabytes) per volume and per file. You can have one mega-huge file that size on a volume (with no room left over), or any combination of files up to that large.<br>
<br>
I hate to think what a disk array that large would cost!<br>
<br>
Chip H.<br>
<br>

 
Thanks for the input. Being limited by their DOS heritage makes sence. When I run the program on a WINNT machine the partitions sizes are indeed reported correctly. However, on a Win98 machine when I look at a 20GB partition on another PC in the local network using Windows Eplorer it shows as 20GB. Explorer Plus also correctly reports the partions size. The limitation must be due to something in scrrun.dll and how it works on Win98. <br>
Bruce
 
I need that Freespace property works on Win98, giving the correct HD free space in HD over 2.1 GB.
Which is the solution?
It's needed to download scr56en.exe scripting update for Win98?

Vladimir
 
I hate to think what a disk array that large would cost!

In 50 years, probably the equivalent of 2 bucks, and will fit inside the latest palm pilot as bubble memory that never runs out of power, unless you leave it in the dark for 2 years.

:)
 
I don't know if it's relevant, but if you're storing the number in a long integer, that will only go up to 2,147,483,647, which is 2.1Gb.

Lee
 
Here's a MSDN article on using GetDiskFreeSpaceEx:


Note that it only works on OS versions after Win95 Service Release 2 (no Win95 original).

I can't believe a 5-year old thread got resurrected like this....

Chip H.


____________________________________________________________________
Click here to learn Ways to help with Tsunami Relief
If you want to get the best response to a question, please read FAQ222-2244 first
 
Or we can use Currency variables to avoid the complex handling of LARGE_INTEGERS.
___
[tt]
Option Explicit
Private Declare Function GetDiskFreeSpaceEx Lib "kernel32" Alias "GetDiskFreeSpaceExA" (ByVal lpDirectoryName As String, lpFreeBytesAvailableToCaller As Currency, lpTotalNumberOfBytes As Currency, lpTotalNumberOfFreeBytes As Currency) As Long
Private Sub Form_Load()
Dim Total As Currency, Free As Currency, Available As Currency
GetDiskFreeSpaceEx "C:\", Available, Total, Free
'scale-up the currency variables to get actual value
Available = Available * 10000
Total = Total * 10000
Free = Free * 10000

Debug.Print "Available space:", Available; "bytes", Format$(Available / 2 ^ 30, "(0.00GB)")
Debug.Print "Total space: ", Total; "bytes", Format$(Total / 2 ^ 30, "(0.00GB)")
Debug.Print "Free space: ", Free; "bytes", Format$(Free / 2 ^ 30, "(0.00GB)")
End Sub[/tt]
___

By the way, I cannot reproduce the bug reported here using the FileSystemObject.
The following code reports all sizes correctly on my PC, both on Win98 and WinXP.
___
[tt]
Private Sub Form_Load()
With CreateObject("Scripting.FileSystemObject").GetDrive("C:")
MsgBox .AvailableSpace
MsgBox .TotalSize
MsgBox .FreeSpace
End With
End Sub[/tt]
 
FAT32 on all drives. Win98 SE with no service packs or any other additional updates installed.

The file version of scrrun.dll is found to be 5.6.0.6626 on both operating systems.
 
That's probably why you don't experience the issue on your copy of W98 then.
 
Yes, it works.
I used the example that comes in MSDN article Q225144, and I can show HD free space over 2.1GB on Win98SE machine.

Thanks for the help.

Vladimir
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top