shell32: Partially implement FolderItem::get_Path.

This commit is contained in:
Alexander Morozov 2011-02-02 21:12:15 +03:00 committed by Alexandre Julliard
parent 7921522718
commit 9ba0f5c52e
2 changed files with 30 additions and 8 deletions

View File

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

View File

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