Commit 9ba0f5c5 authored by Alexander Morozov's avatar Alexander Morozov Committed by Alexandre Julliard

shell32: Partially implement FolderItem::get_Path.

parent 79215227
......@@ -225,10 +225,38 @@ static HRESULT WINAPI FolderItemImpl_put_Name(FolderItem *iface, BSTR bs)
static HRESULT WINAPI FolderItemImpl_get_Path(FolderItem *iface, BSTR *pbs)
{
FIXME("(%p,%p)\n", iface, pbs);
FolderItemImpl *This = impl_from_FolderItem(iface);
HRESULT ret = S_OK;
WCHAR *pathW;
int len;
TRACE("(%p,%p)\n", iface, pbs);
*pbs = NULL;
return E_NOTIMPL;
if (V_VT(&This->dir) == VT_I4)
{
pathW = HeapAlloc(GetProcessHeap(), 0, MAX_PATH * sizeof(WCHAR));
if (!pathW) return E_OUTOFMEMORY;
ret = SHGetFolderPathW(NULL, V_I4(&This->dir), NULL, SHGFP_TYPE_CURRENT,
pathW);
if (ret == S_OK)
*pbs = SysAllocString(pathW);
else if (ret == E_INVALIDARG)
{
FIXME("not implemented for %#x\n", V_I4(&This->dir));
ret = E_NOTIMPL;
}
HeapFree(GetProcessHeap(), 0, pathW);
}
else /* VT_BSTR */
{
pathW = V_BSTR(&This->dir);
len = lstrlenW(pathW);
*pbs = SysAllocStringLen(pathW, pathW[len - 1] == '\\' ? len - 1 : len);
}
if (ret == S_OK && !*pbs)
ret = E_OUTOFMEMORY;
return ret;
}
static HRESULT WINAPI FolderItemImpl_get_GetLink(FolderItem *iface,
......
......@@ -150,10 +150,8 @@ static void test_namespace(void)
if (r == S_OK)
{
r = FolderItem_get_Path(item, &item_path);
todo_wine
ok(r == S_OK, "FolderItem::get_Path failed: %08x\n", r);
if (pSHGetFolderPathW)
todo_wine
ok(!lstrcmpW(item_path, path), "expected %s, got %s\n",
wine_dbgstr_w(path), wine_dbgstr_w(item_path));
SysFreeString(item_path);
......@@ -239,10 +237,8 @@ static void test_namespace(void)
if (r == S_OK)
{
r = FolderItem_get_Path(item, &item_path);
todo_wine
ok(r == S_OK, "FolderItem::get_Path failed: %08x\n", r);
if (long_pathW)
todo_wine
ok(!lstrcmpW(item_path, long_pathW),
"expected %s, got %s\n", wine_dbgstr_w(long_pathW),
wine_dbgstr_w(item_path));
......@@ -284,10 +280,8 @@ static void test_namespace(void)
if (r == S_OK)
{
r = FolderItem_get_Path(item, &item_path);
todo_wine
ok(r == S_OK, "FolderItem::get_Path failed: %08x\n", r);
if (long_pathW)
todo_wine
ok(!lstrcmpW(item_path, long_pathW),
"expected %s, got %s\n", wine_dbgstr_w(long_pathW),
wine_dbgstr_w(item_path));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment