scrrun: Implement GetDriveName().

This commit is contained in:
Nikolay Sivov 2014-06-21 20:30:11 +04:00 committed by Alexandre Julliard
parent 500bbb3e9a
commit d2d62cf578
2 changed files with 57 additions and 4 deletions

View file

@ -2937,12 +2937,19 @@ static HRESULT WINAPI filesys_BuildPath(IFileSystem3 *iface, BSTR Path,
return S_OK;
}
static HRESULT WINAPI filesys_GetDriveName(IFileSystem3 *iface, BSTR Path,
BSTR *pbstrResult)
static HRESULT WINAPI filesys_GetDriveName(IFileSystem3 *iface, BSTR path, BSTR *drive)
{
FIXME("%p %s %p\n", iface, debugstr_w(Path), pbstrResult);
TRACE("(%p)->(%s %p)\n", iface, debugstr_w(path), drive);
return E_NOTIMPL;
if (!drive)
return E_POINTER;
*drive = NULL;
if (path && strlenW(path) > 1 && path[1] == ':')
*drive = SysAllocStringLen(path, 2);
return S_OK;
}
static inline DWORD get_parent_folder_name(const WCHAR *path, DWORD len)

View file

@ -1745,6 +1745,51 @@ todo_wine
SysFreeString(nameW);
}
struct getdrivename_test {
const WCHAR path[10];
const WCHAR drive[5];
};
static const struct getdrivename_test getdrivenametestdata[] = {
{ {'C',':','\\','1','.','t','s','t',0}, {'C',':',0} },
{ {'O',':','\\','1','.','t','s','t',0}, {'O',':',0} },
{ {'O',':',0}, {'O',':',0} },
{ {'o',':',0}, {'o',':',0} },
{ {'O','O',':',0} },
{ {':',0} },
{ {'O',0} },
{ { 0 } }
};
static void test_GetDriveName(void)
{
const struct getdrivename_test *ptr = getdrivenametestdata;
HRESULT hr;
BSTR name;
hr = IFileSystem3_GetDriveName(fs3, NULL, NULL);
ok(hr == E_POINTER, "got 0x%08x\n", hr);
name = (void*)0xdeadbeef;
hr = IFileSystem3_GetDriveName(fs3, NULL, &name);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(name == NULL, "got %p\n", name);
while (*ptr->path) {
BSTR path = SysAllocString(ptr->path);
name = (void*)0xdeadbeef;
hr = IFileSystem3_GetDriveName(fs3, path, &name);
ok(hr == S_OK, "got 0x%08x\n", hr);
if (name)
ok(!lstrcmpW(ptr->drive, name), "got %s, expected %s\n", wine_dbgstr_w(name), wine_dbgstr_w(ptr->drive));
else
ok(!*ptr->drive, "got %s, expected %s\n", wine_dbgstr_w(name), wine_dbgstr_w(ptr->drive));
SysFreeString(path);
SysFreeString(name);
ptr++;
}
}
START_TEST(filesystem)
{
HRESULT hr;
@ -1777,6 +1822,7 @@ START_TEST(filesystem)
test_WriteLine();
test_ReadAll();
test_Read();
test_GetDriveName();
IFileSystem3_Release(fs3);