[2/2] shell32: Partially implement FolderItem::get_Path.
Alexander Morozov
amorozov at etersoft.ru
Tue Feb 8 06:45:02 CST 2011
-------------- next part --------------
From 67522f06fe6edbae1314c78c205267cab3439f3e Mon Sep 17 00:00:00 2001
From: Alexander Morozov <amorozov at etersoft.ru>
Date: Wed, 2 Feb 2011 21:12:15 +0300
Subject: [PATCH 2/2] shell32: Partially implement FolderItem::get_Path.
---
dlls/shell32/shelldispatch.c | 32 ++++++++++++++++++++++++++++++--
dlls/shell32/tests/shelldispatch.c | 6 ------
2 files changed, 30 insertions(+), 8 deletions(-)
diff --git a/dlls/shell32/shelldispatch.c b/dlls/shell32/shelldispatch.c
index f6ad59f..0ad3b1d 100644
--- a/dlls/shell32/shelldispatch.c
+++ b/dlls/shell32/shelldispatch.c
@@ -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,
diff --git a/dlls/shell32/tests/shelldispatch.c b/dlls/shell32/tests/shelldispatch.c
index 294b3a9..a2b649a 100644
--- a/dlls/shell32/tests/shelldispatch.c
+++ b/dlls/shell32/tests/shelldispatch.c
@@ -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));
--
1.7.3.5
More information about the wine-patches
mailing list