scrrun: Implement get_VolumeName().

This commit is contained in:
Nikolay Sivov 2014-06-24 06:35:43 +04:00 committed by Alexandre Julliard
parent 6a2e1b3f31
commit a0954a1930
2 changed files with 22 additions and 2 deletions

View File

@ -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)

View File

@ -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);