Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
f3836f5f
Commit
f3836f5f
authored
Dec 10, 1998
by
Uwe Bonnes
Committed by
Alexandre Julliard
Dec 10, 1998
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed DRIVE_GetFreeSpace to handle space > 4 GByte.
parent
65b637be
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
24 deletions
+36
-24
drive.c
files/drive.c
+36
-24
No files found.
files/drive.c
View file @
f3836f5f
...
...
@@ -580,9 +580,11 @@ int DRIVE_OpenDevice( int drive, int flags )
/***********************************************************************
* DRIVE_GetFreeSpace
*/
static
int
DRIVE_GetFreeSpace
(
int
drive
,
DWORD
*
size
,
DWORD
*
available
)
static
int
DRIVE_GetFreeSpace
(
int
drive
,
LPULARGE_INTEGER
size
,
LPULARGE_INTEGER
available
)
{
struct
statfs
info
;
unsigned
long
long
bigsize
,
bigavail
=
0
;
if
(
!
DRIVE_IsValid
(
drive
))
{
...
...
@@ -602,16 +604,23 @@ static int DRIVE_GetFreeSpace( int drive, DWORD *size, DWORD *available )
return
0
;
}
*
size
=
info
.
f_bsize
*
info
.
f_blocks
;
bigsize
=
(
unsigned
long
long
)
info
.
f_bsize
*
(
unsigned
long
long
)
info
.
f_blocks
;
#ifdef STATFS_HAS_BAVAIL
*
available
=
info
.
f_bavail
*
info
.
f_bsize
;
bigavail
=
(
unsigned
long
long
)
info
.
f_bavail
*
(
unsigned
long
long
)
info
.
f_bsize
;
#else
# ifdef STATFS_HAS_BFREE
*
available
=
info
.
f_bfree
*
info
.
f_bsize
;
bigavail
=
(
unsigned
long
long
)
info
.
f_bfree
*
(
unsigned
long
long
)
info
.
f_bsize
;
# else
# error "statfs has no bfree/bavail member!"
# endif
#endif
size
->
LowPart
=
(
DWORD
)
bigsize
;
size
->
HighPart
=
(
DWORD
)(
bigsize
>>
32
);
available
->
LowPart
=
(
DWORD
)
bigavail
;
available
->
HighPart
=
(
DWORD
)(
bigavail
>>
32
);
return
1
;
}
...
...
@@ -660,7 +669,7 @@ BOOL32 WINAPI GetDiskFreeSpace32A( LPCSTR root, LPDWORD cluster_sectors,
LPDWORD
total_clusters
)
{
int
drive
;
DWORD
size
,
available
;
ULARGE_INTEGER
size
,
available
;
LPCSTR
path
;
DWORD
cluster_sec
;
...
...
@@ -685,30 +694,37 @@ BOOL32 WINAPI GetDiskFreeSpace32A( LPCSTR root, LPDWORD cluster_sectors,
if
(
!
DRIVE_GetFreeSpace
(
drive
,
&
size
,
&
available
))
return
FALSE
;
/* Cap the size and available at 2GB as per specs. */
if
(
size
>
0x7fffffff
)
size
=
0x7fffffff
;
if
(
available
>
0x7fffffff
)
available
=
0x7fffffff
;
if
((
size
.
HighPart
)
||
(
size
.
LowPart
>
0x7fffffff
))
{
size
.
HighPart
=
0
;
size
.
LowPart
=
0x7fffffff
;
}
if
((
available
.
HighPart
)
||
(
available
.
LowPart
>
0x7fffffff
))
{
available
.
HighPart
=
0
;
available
.
LowPart
=
0x7fffffff
;
}
if
(
DRIVE_GetType
(
drive
)
==
TYPE_CDROM
)
{
if
(
sector_bytes
)
*
sector_bytes
=
2048
;
size
/=
2048
;
available
/=
2048
;
size
.
LowPart
/=
2048
;
available
.
LowPart
/=
2048
;
}
else
{
if
(
sector_bytes
)
*
sector_bytes
=
512
;
size
/=
512
;
available
/=
512
;
size
.
LowPart
/=
512
;
available
.
LowPart
/=
512
;
}
/* fixme: probably have to adjust those variables too for CDFS */
cluster_sec
=
1
;
while
(
cluster_sec
*
65536
<
size
)
cluster_sec
*=
2
;
while
(
cluster_sec
*
65536
<
size
.
LowPart
)
cluster_sec
*=
2
;
if
(
cluster_sectors
)
*
cluster_sectors
=
cluster_sec
;
if
(
free_clusters
)
*
free_clusters
=
available
/
cluster_sec
;
*
free_clusters
=
available
.
LowPart
/
cluster_sec
;
if
(
total_clusters
)
*
total_clusters
=
size
/
cluster_sec
;
*
total_clusters
=
size
.
LowPart
/
cluster_sec
;
return
TRUE
;
}
...
...
@@ -740,7 +756,7 @@ BOOL32 WINAPI GetDiskFreeSpaceEx32A( LPCSTR root,
LPULARGE_INTEGER
totalfree
)
{
int
drive
;
DWORD
size
,
available
;
ULARGE_INTEGER
size
,
available
;
if
(
!
root
)
drive
=
DRIVE_GetCurrentDrive
();
else
...
...
@@ -754,14 +770,10 @@ BOOL32 WINAPI GetDiskFreeSpaceEx32A( LPCSTR root,
}
if
(
!
DRIVE_GetFreeSpace
(
drive
,
&
size
,
&
available
))
return
FALSE
;
/*FIXME: Do we have the number of bytes available to the user? */
avail
->
HighPart
=
total
->
HighPart
=
0
;
avail
->
LowPart
=
available
;
total
->
LowPart
=
size
;
if
(
totalfree
)
{
totalfree
->
HighPart
=
0
;
totalfree
->
LowPart
=
available
;
}
avail
->
HighPart
=
available
.
HighPart
;
totalfree
->
HighPart
=
size
.
HighPart
;
avail
->
LowPart
=
available
.
LowPart
;
totalfree
->
LowPart
=
size
.
LowPart
;
return
TRUE
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment