Log On
Embarcadero Home
Watch, Follow, &
Connect with Us
Share This
QualityCentral
Communities
Articles
Blogs
Resources
Downloads
Help
QualityCentral
Delphi-BCB
Database
Database Tools
BDE Admin
BDE SDK
Data Migration Expert
Database Desktop
DDK (Driver Development Kit)
SQL Builder
SQL Explorer
SQL Monitor
TUtility
You are not logged in.
Help
Print
Public Report
Report From:
Delphi-BCB/Database/Database Tools/BDE SDK
[ Add a report in this area ]
Report #:
7089
Status:
Closed
BDE reports insufficient space on drives with more than 2GB free
Project:
Delphi
Build #:
All
Version:
6.0
Submitted By:
Robert Martin
Report Type:
Basic functionality failure
Date Reported:
1/27/2004 12:57:09 PM
Severity:
Serious / Highly visible problem
Last Updated:
3/20/2012 2:24:39 AM
Platform:
All versions
Internal Tracking #:
196722
Resolution:
Inactive
(Resolution Comments)
Resolved in Build:
:
Duplicate of:
None
Voting and Rating
Overall Rating:
(28 Total Ratings)
4.89 out of 5
Total Votes:
62
Description
It seems there is a bug in the BDE (all versions) that causes it to incorrectly report the amount of free disk space with drives that have over 4GB free space.
We recently encountered this issue on a clients machine and found reference to a BDE bug caused by Borland using an obsolete API call (GetDiskSpace instead of GetDiskSpaceEX).
We believe it is causing a number of clients major problems (now that they have all upgraded their machines they are running out of drive space).
If it has not been fixed is there an official (or un official) work around?
It would seem simple to fix (just change the calls to GetDiskSpaceEX).
Steps to Reproduce:
Get HDD with 9 + GB free.
Copy large files whilst checking free space using obsolete GetDiskSpace API (write a small app)
When space gets near 0 (using API) but is in reality still far more than 4GB, attempt to add / modify indexes on a large file.
BDE reports out of drive space or app crashes.
Workarounds
None
Attachment
None
Comments
Dominic Dumee at 2/24/2004 12:56:03 AM
-
14088 2839689
Jack Hogue at 8/9/2004 12:14:26 PM
-
Dominic,
Could you please update your fix to work with all versions of windows and include the dll here for us to download?
The other version that is here will not work from outside Delphi and I use Paradox!
Reinaldo Yaqez at 2/25/2004 12:11:30 PM
-
Here it is another:
http://codecentral.borland.com/codecentral/ccWeb.exe/listing?id=21475
Jack Hogue at 8/9/2004 11:47:16 AM
-
Where do we put the FIX4GBUG.dll or what do we rename it to?
Is the latest version of the DLL including the fix for NON-NT versions?
Achim Kalwa at 3/22/2004 1:44:16 AM
-
What is the Fix4GBug.dll for, which is included in the downloadable patch?
TIA
Achim
Mike Benning at 2/27/2004 11:11:03 AM
-
Thank you very much for sharing :-) Though it's better than nothing. Will that piece of code work well on the Windows platforms, ranging from Win95 - WinXP?
It would still be best if Borland can fix this inside the BDE code itself, an official fix you might say. There for any development tool that requires the BDE, such as Corel's Paradox(which a lot of people still use) will also be fixed and will also make things much easier on the folks using Delphi or C++Builder.
Omniciel International at 6/1/2004 10:41:54 AM
-
14088 2839689
Lee Grissom at 6/21/2004 9:43:55 PM
-
Could you be more specific? Did it crash? Someone else named Emerson Cavalcanti reported (on the CodeCentral comment area) that this patch crashes on non NT platforms (95/98/Me). Did you observe the same?
Reinaldo Yaqez at 3/1/2004 9:51:07 AM
-
My patch works on all Windows versions, starting from Win 95 OSR 2. "OSR 2" is important, because of the use of the function "GetDiskFreeSpaceEx".
Regards,
Reinaldo
Mike Benning at 3/3/2004 1:06:32 PM
-
Reinaldo, Thanks for the reply.
Thomas Jensen at 7/4/2004 5:19:56 AM
-
Since the solution is extrememy simple, I really can't see why BDE could not be updated with a new v5.3 downloadable release.
Thomas
Eduardo Sagarnaga at 11/9/2004 9:45:14 AM
-
I have my paradox tables working for four years so far, and all of the sudden ALL my Win98's started to popup the message INSUFFICIENT DISK SPACE. My WinXP's and WinNT's still working fine. I am going nuts trying to solve the problem. The patch provided by Reinaldo is not working either. Maybe I need more information, like, where to copy the patch. I tried to install it with regsrv32, which, by the way, doesn't work.
Any suggestions are welcome.
Dominic Dumee at 5/10/2005 12:18:49 AM
-
Here's an update of my first workaround that works on win9x as well as all the others (the problem was that the first fix required the GetDiskFreeSpaceEx function which is not available on old versions of windows):
(note this solution requires the madCollection library installed which you can find
here: http://www.madshi.net )
This solution has only been tested on Delphi 7.
How to use: After the BDE is initialised in your prog simply call InstallGetDiskSpaceHook
It will unhook itself automatically when your program closes.
You need the 2 units below::
======================================================================
First unit WINFIX.PAS:
======================================================================
// This unit will load the GetDiskFreeSpaceEx function
// if it is supported by Windows (only win95 OSR2 + )
// call the function using _GetDiskFreeSpaceEx if it is not null
unit WinFix;
interface
uses Windows;
type
TGetDiskFreeSpaceEx =
function(lpDirectoryName: PChar;
var lpFreeBytesAvailableToCaller,
lpTotalNumberOfBytes: TLargeInteger;
lpTotalNumberOfFreeBytes: PLargeInteger): BOOL; stdcall;
var
_GetDiskFreeSpaceEx : TGetDiskFreeSpaceEx;
OsVersionInfo : TOSVersionInfoA;
implementation
var
CanLoadDLL : Boolean;
DLLHandle : THandle;
initialization
@_GetDiskFreeSpaceEx := Nil;
CanLoadDLL := TRUE;
FillChar( OsVersionInfo, sizeof( OsVersionInfo ), 0 );
OsVersionInfo.dwOSVersionInfoSize := sizeof( OsVersionInfo );
if GetVersionEx( OsVersionInfo ) then
begin
// function is only available on Win95 OSR 2 and better...
if OsVersionInfo.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS then
begin
if LOWORD( OsVersionInfo.dwBuildNumber ) <= 1000 then // 1000+ indicates Win 95 OSR 2
CanLoadDLL := FALSE;
end;
end;
if CanLoadDLL then
begin
DLLHandle := LoadLibrary( 'kernel32.dll' );
if DLLHandle <> 0 then
begin
@_GetDiskFreeSpaceEx := GetProcAddress( DLLHandle, 'GetDiskFreeSpaceExA' );
end;
end;
finalization
if DLLHandle <> 0 then
FreeLibrary( DLLHandle );
end.
======================================================================
2nd unit GETDISKSPACEHOOK.PAS
======================================================================
// Workaround for BDE 'out of disk space' error when free space is just
// over a multiple of 4Gb. (Report #7089 on quality central).
// This workaround intercepts the GetDiskFreeSpace
// function used by the BDE and returns 2Gb free if there's more than
// 2Gb free (I use 2Gb because I think I've seen this same problem with
// multiples of 2Gb before). It only affects the application that inits the hook
// (it is not system wide).
// How to use: After the BDE is initialised in your prog simply call InstallGetDiskSpaceHook
// It will unhook itself automatically when your program closes.
// Use this at your own risk - I accept no responsibility for ANYTHING AT
ALL! :)
// NB: This requires the madCollection library installed which you can find
here:
// http://www.madshi.net
unit GetDiskSpaceHook;
interface
procedure InstallGetDiskSpaceHook;
procedure RemoveGetDiskSpaceHook;
var NextHookGetDiskFreeSpaceA : function( RootPathName : pAnsiChar;
var SectorsPerCluster : cardinal;
var BytesPerSector : cardinal;
var NumberOfFreeClusters : cardinal;
var TotalNumberOfClusters : cardinal ) : longbool; stdcall;
implementation
uses Windows, madCodeHook, sysutils, WinFix;
function HookGetDiskFeeSpaceA( RootPathName : pAnsichar;
var SectorsPerCluster : cardinal;
var BytesPerSector : cardinal;
var NumberOfFreeClusters : cardinal;
var TotalNumberOfClusters : cardinal ) : longbool; stdcall;
var
FreeBytesAvailableToCaller,
FreeDiskBytesAvailable, TotalDiskBytes, TotalNumberOfFreeBytes : TLargeInteger;
FreeK : cardinal;
begin
// call new func only if it's available
if @_GetDiskFreeSpaceEx <> nil then
begin
Result := _GetDiskFreeSpaceEx( RootPathName, FreeDiskBytesAvailable, TotalDiskBytes, @TotalNumberOfFreeBytes );
try
FreeK := Trunc( TotalNumberOfFreeBytes / 1024 );
except
on e : exception do
FreeK := MaxInt div 1024;
end;
end
else
begin
// use the old function if the new one isn't available...
Result := NextHookGetDiskFreeSpaceA( RootPathName, SectorsPerCluster, BytesPerSector, NumberOfFreeClusters, TotalNumberOfClusters );
FreeK := ( NumberOfFreeClusters div 1024 ) * SectorsPerCluster * BytesPerSector;
end;
if Result then
begin
// if we have more than 2 gig free, fool the system into thinking there's 2 gig free
if FreeK > 2 * 1024 * 1024 then
begin
SectorsPerCluster := 1;
BytesPerSector := 1024;
NumberOfFreeClusters := 2 * 1024 * 1024 - 1;
TotalNumberOfClusters := NumberOfFreeClusters;
end;
end;
RenewHook( @NextHookGetDiskFreeSpaceA );
end;
procedure InstallGetDiskSpaceHook;
begin
if @NextHookGetDiskFreeSpaceA = nil then
HookAPI( 'kernel32.dll', 'GetDiskFreeSpaceA', @HookGetDiskFeeSpaceA, @NextHookGetDiskFreeSpaceA );
end;
procedure RemoveGetDiskSpaceHook;
begin
if @NextHookGetDiskFreeSpaceA <> nil then
begin
UnhookAPI( @NextHookGetDiskFreeSpaceA );
@NextHookGetDiskFreeSpaceA := nil;
end;
end;
initialization
@NextHookGetDiskFreeSpaceA := nil;
finalization
RemoveGetDiskSpaceHook;
end.
Stephen Parris at 2/2/2006 6:07:43 AM
-
We have this problem if the Free Disk Space is a multiple of 4GB.
Also the BDE fails if the Physical Memory in the PC is 1GB or more. Does anyone know if there is a work around for this ?
Currently we have to reduce the Memory installed
Thomas Jensen at 1/22/2007 12:15:02 AM
-
I have 2G on Windows XP, but no problem with BDE.
I only use Paradox tables, maybe you use other databases?
I do know of memory sharing problems with BDE, when more than one BDE application is running of the same computer.
By configuring SHAREDMEMLOCATION, it can work without problems.
Chee Wee Chua at 1/23/2007 12:06:38 AM
-
BDE has been deprecated since 2002. See http://dn.codegear.com/article/28688
As such, I don't believe there'll be any fixes to it.
View Your Reports
Search
Server Response from: ETNACODE01
Developer Tools
Blackfish SQL
C++Builder
Delphi
FireMonkey
Prism
InterBase
JBuilder
J Optimizer
HTML5 Builder
3rdRail & TurboRuby
Database Tools
Change Manager
DBArtisan
DB Optimizer
ER/Studio
Performance Center
Rapid SQL
Technical Articles
Tutorials
White Papers
Press Releases
Newsletters
Add Content (GetPublished)
Audio
Audio & Video
Video
Bugs & Suggestions (QualityCentral)
Discussion Forums
Examples (CodeCentral)
Tags
Technology Partners
Downloads
Free Trials
Registered User Downloads
Beta Programs
Add Content (GetPublished)
Articles
Blogs
Bugs & Suggestions (QualityCentral)
Discussion Forums
Examples (CodeCentral)
Member Services
About
Connect with Us