Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
9d95788f
Commit
9d95788f
authored
May 17, 2014
by
Nikolay Sivov
Committed by
Alexandre Julliard
May 19, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
scrrun: Return disk space as VT_I4 if it fits.
parent
108c2731
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
10 deletions
+31
-10
filesystem.c
dlls/scrrun/filesystem.c
+21
-6
filesystem.c
dlls/scrrun/tests/filesystem.c
+10
-4
No files found.
dlls/scrrun/filesystem.c
View file @
9d95788f
...
...
@@ -888,6 +888,24 @@ static HRESULT WINAPI drive_get_RootFolder(IDrive *iface, IFolder **folder)
return
E_NOTIMPL
;
}
static
HRESULT
variant_from_largeint
(
const
ULARGE_INTEGER
*
src
,
VARIANT
*
v
)
{
HRESULT
hr
=
S_OK
;
if
(
src
->
HighPart
)
{
V_VT
(
v
)
=
VT_R8
;
hr
=
VarR8FromUI8
(
src
->
QuadPart
,
&
V_R8
(
v
));
}
else
{
V_VT
(
v
)
=
VT_I4
;
V_I4
(
v
)
=
src
->
LowPart
;
}
return
hr
;
}
static
HRESULT
WINAPI
drive_get_AvailableSpace
(
IDrive
*
iface
,
VARIANT
*
v
)
{
struct
drive
*
This
=
impl_from_IDrive
(
iface
);
...
...
@@ -901,8 +919,7 @@ static HRESULT WINAPI drive_get_AvailableSpace(IDrive *iface, VARIANT *v)
if
(
!
GetDiskFreeSpaceExW
(
This
->
root
,
&
avail
,
NULL
,
NULL
))
return
E_FAIL
;
V_VT
(
v
)
=
VT_R8
;
return
VarR8FromUI8
(
avail
.
QuadPart
,
&
V_R8
(
v
));
return
variant_from_largeint
(
&
avail
,
v
);
}
static
HRESULT
WINAPI
drive_get_FreeSpace
(
IDrive
*
iface
,
VARIANT
*
v
)
...
...
@@ -918,8 +935,7 @@ static HRESULT WINAPI drive_get_FreeSpace(IDrive *iface, VARIANT *v)
if
(
!
GetDiskFreeSpaceExW
(
This
->
root
,
&
freespace
,
NULL
,
NULL
))
return
E_FAIL
;
V_VT
(
v
)
=
VT_R8
;
return
VarR8FromUI8
(
freespace
.
QuadPart
,
&
V_R8
(
v
));
return
variant_from_largeint
(
&
freespace
,
v
);
}
static
HRESULT
WINAPI
drive_get_TotalSize
(
IDrive
*
iface
,
VARIANT
*
v
)
...
...
@@ -935,8 +951,7 @@ static HRESULT WINAPI drive_get_TotalSize(IDrive *iface, VARIANT *v)
if
(
!
GetDiskFreeSpaceExW
(
This
->
root
,
NULL
,
&
total
,
NULL
))
return
E_FAIL
;
V_VT
(
v
)
=
VT_R8
;
return
VarR8FromUI8
(
total
.
QuadPart
,
&
V_R8
(
v
));
return
variant_from_largeint
(
&
total
,
v
);
}
static
HRESULT
WINAPI
drive_get_VolumeName
(
IDrive
*
iface
,
BSTR
*
name
)
...
...
dlls/scrrun/tests/filesystem.c
View file @
9d95788f
...
...
@@ -1294,14 +1294,20 @@ static void test_DriveCollection(void)
V_VT
(
&
size
)
=
VT_EMPTY
;
hr
=
IDrive_get_AvailableSpace
(
drive
,
&
size
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
V_VT
(
&
size
)
==
VT_R8
,
"got %d
\n
"
,
V_VT
(
&
size
));
ok
(
V_R8
(
&
size
)
>
0
,
"got %f
\n
"
,
V_R8
(
&
size
));
ok
(
V_VT
(
&
size
)
==
VT_R8
||
V_VT
(
&
size
)
==
VT_I4
,
"got %d
\n
"
,
V_VT
(
&
size
));
if
(
V_VT
(
&
size
)
==
VT_R8
)
ok
(
V_R8
(
&
size
)
>
0
,
"got %f
\n
"
,
V_R8
(
&
size
));
else
ok
(
V_I4
(
&
size
)
>
0
,
"got %d
\n
"
,
V_I4
(
&
size
));
V_VT
(
&
size
)
=
VT_EMPTY
;
hr
=
IDrive_get_FreeSpace
(
drive
,
&
size
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
V_VT
(
&
size
)
==
VT_R8
,
"got %d
\n
"
,
V_VT
(
&
size
));
ok
(
V_R8
(
&
size
)
>
0
,
"got %f
\n
"
,
V_R8
(
&
size
));
ok
(
V_VT
(
&
size
)
==
VT_R8
||
V_VT
(
&
size
)
==
VT_I4
,
"got %d
\n
"
,
V_VT
(
&
size
));
if
(
V_VT
(
&
size
)
==
VT_R8
)
ok
(
V_R8
(
&
size
)
>
0
,
"got %f
\n
"
,
V_R8
(
&
size
));
else
ok
(
V_I4
(
&
size
)
>
0
,
"got %d
\n
"
,
V_I4
(
&
size
));
}
VariantClear
(
&
var
);
}
...
...
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