Module: wine Branch: master Commit: 61a3bd330210e21842b010c536422c18dac55eba URL: http://source.winehq.org/git/wine.git/?a=commit;h=61a3bd330210e21842b010c536...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Sun Mar 30 15:59:00 2014 +0400
scrrun: Implement AvailableSpace property for a drive.
---
dlls/scrrun/filesystem.c | 16 +++++++++++++--- dlls/scrrun/tests/filesystem.c | 9 +++++++++ 2 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/dlls/scrrun/filesystem.c b/dlls/scrrun/filesystem.c index 04d649d..a1eb6c1 100644 --- a/dlls/scrrun/filesystem.c +++ b/dlls/scrrun/filesystem.c @@ -736,11 +736,21 @@ static HRESULT WINAPI drive_get_RootFolder(IDrive *iface, IFolder **folder) return E_NOTIMPL; }
-static HRESULT WINAPI drive_get_AvailableSpace(IDrive *iface, VARIANT *avail) +static HRESULT WINAPI drive_get_AvailableSpace(IDrive *iface, VARIANT *v) { struct drive *This = impl_from_IDrive(iface); - FIXME("(%p)->(%p): stub\n", This, avail); - return E_NOTIMPL; + ULARGE_INTEGER avail; + + TRACE("(%p)->(%p)\n", This, v); + + if (!v) + return E_POINTER; + + if (!GetDiskFreeSpaceExW(This->root, &avail, NULL, NULL)) + return E_FAIL; + + V_VT(v) = VT_R8; + return VarR8FromUI8(avail.QuadPart, &V_R8(v)); }
static HRESULT WINAPI drive_get_FreeSpace(IDrive *iface, VARIANT *v) diff --git a/dlls/scrrun/tests/filesystem.c b/dlls/scrrun/tests/filesystem.c index 215df42..3bf1209 100644 --- a/dlls/scrrun/tests/filesystem.c +++ b/dlls/scrrun/tests/filesystem.c @@ -1250,6 +1250,9 @@ static void test_DriveCollection(void) hr = IDrive_get_TotalSize(drive, NULL); ok(hr == E_POINTER, "got 0x%08x\n", hr);
+ hr = IDrive_get_AvailableSpace(drive, NULL); + ok(hr == E_POINTER, "got 0x%08x\n", hr); + if (type == Fixed) { VARIANT_BOOL ready = VARIANT_FALSE; VARIANT size; @@ -1263,6 +1266,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_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)); } VariantClear(&var); }