From a0954a193053cf402ff9d8702d9cd81ac6230397 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Tue, 24 Jun 2014 06:35:43 +0400 Subject: [PATCH] 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 fc8531cc15f..434b402b158 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 ac784833b21..9410732a896 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);