Module: wine Branch: master Commit: a0954a193053cf402ff9d8702d9cd81ac6230397 URL: http://source.winehq.org/git/wine.git/?a=commit;h=a0954a193053cf402ff9d8702d...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Tue Jun 24 06:35:43 2014 +0400
scrrun: Implement get_VolumeName().
---
dlls/scrrun/filesystem.c | 15 +++++++++++++-- dlls/scrrun/tests/filesystem.c | 9 +++++++++ 2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/dlls/scrrun/filesystem.c b/dlls/scrrun/filesystem.c index fc8531c..434b402 100644 --- a/dlls/scrrun/filesystem.c +++ b/dlls/scrrun/filesystem.c @@ -957,8 +957,19 @@ static HRESULT WINAPI drive_get_TotalSize(IDrive *iface, VARIANT *v) static HRESULT WINAPI drive_get_VolumeName(IDrive *iface, BSTR *name) { struct drive *This = impl_from_IDrive(iface); - FIXME("(%p)->(%p): stub\n", This, name); - return E_NOTIMPL; + WCHAR nameW[MAX_PATH+1]; + BOOL ret; + + TRACE("(%p)->(%p)\n", This, name); + + if (!name) + return E_POINTER; + + *name = NULL; + ret = GetVolumeInformationW(This->root, nameW, sizeof(nameW)/sizeof(WCHAR), NULL, NULL, NULL, NULL, 0); + if (ret) + *name = SysAllocString(nameW); + return ret ? S_OK : E_FAIL; }
static HRESULT WINAPI drive_put_VolumeName(IDrive *iface, BSTR name) diff --git a/dlls/scrrun/tests/filesystem.c b/dlls/scrrun/tests/filesystem.c index ac78483..9410732 100644 --- a/dlls/scrrun/tests/filesystem.c +++ b/dlls/scrrun/tests/filesystem.c @@ -1830,6 +1830,15 @@ static void test_SerialNumber(void) ok(name != NULL, "got %p\n", name); SysFreeString(name);
+ hr = IDrive_get_VolumeName(drive, NULL); + ok(hr == E_POINTER, "got 0x%08x\n", hr); + + name = NULL; + hr = IDrive_get_VolumeName(drive, &name); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(name != NULL, "got %p\n", name); + SysFreeString(name); + IDrive_Release(drive); IEnumVARIANT_Release(iter); IDriveCollection_Release(drives);