Nikolay Sivov : scrrun: Implement FreeSpace() for a drive.
Alexandre Julliard
julliard at winehq.org
Thu Apr 3 13:31:16 CDT 2014
Module: wine
Branch: master
Commit: ba232c8f699aa2f41f35d557e787a595f1d22810
URL: http://source.winehq.org/git/wine.git/?a=commit;h=ba232c8f699aa2f41f35d557e787a595f1d22810
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Thu Apr 3 17:35:08 2014 +0400
scrrun: Implement FreeSpace() for a drive.
---
dlls/scrrun/filesystem.c | 14 ++++++++++++--
dlls/scrrun/tests/filesystem.c | 9 +++++++++
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/dlls/scrrun/filesystem.c b/dlls/scrrun/filesystem.c
index 35fd3a2..b04637c 100644
--- a/dlls/scrrun/filesystem.c
+++ b/dlls/scrrun/filesystem.c
@@ -908,8 +908,18 @@ static HRESULT WINAPI drive_get_AvailableSpace(IDrive *iface, VARIANT *v)
static HRESULT WINAPI drive_get_FreeSpace(IDrive *iface, VARIANT *v)
{
struct drive *This = impl_from_IDrive(iface);
- FIXME("(%p)->(%p): stub\n", This, v);
- return E_NOTIMPL;
+ ULARGE_INTEGER freespace;
+
+ TRACE("(%p)->(%p)\n", This, v);
+
+ if (!v)
+ return E_POINTER;
+
+ if (!GetDiskFreeSpaceExW(This->root, &freespace, NULL, NULL))
+ return E_FAIL;
+
+ V_VT(v) = VT_R8;
+ return VarR8FromUI8(freespace.QuadPart, &V_R8(v));
}
static HRESULT WINAPI drive_get_TotalSize(IDrive *iface, VARIANT *v)
diff --git a/dlls/scrrun/tests/filesystem.c b/dlls/scrrun/tests/filesystem.c
index a53aa9d..c258a0f 100644
--- a/dlls/scrrun/tests/filesystem.c
+++ b/dlls/scrrun/tests/filesystem.c
@@ -1264,6 +1264,9 @@ static void test_DriveCollection(void)
hr = IDrive_get_AvailableSpace(drive, NULL);
ok(hr == E_POINTER, "got 0x%08x\n", hr);
+ hr = IDrive_get_FreeSpace(drive, NULL);
+ ok(hr == E_POINTER, "got 0x%08x\n", hr);
+
if (type == Fixed) {
VARIANT_BOOL ready = VARIANT_FALSE;
VARIANT size;
@@ -1283,6 +1286,12 @@ static void test_DriveCollection(void)
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));
+
+ 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));
}
VariantClear(&var);
}
More information about the wine-cvs
mailing list