Alexander Morozov : shell32: Partially implement FolderItem::get_Path.
Alexandre Julliard
julliard at winehq.org
Tue Feb 8 17:23:49 CST 2011
Module: wine
Branch: master
Commit: 9ba0f5c52ea87c2e268f779794bf410f74d3ab0f
URL: http://source.winehq.org/git/wine.git/?a=commit;h=9ba0f5c52ea87c2e268f779794bf410f74d3ab0f
Author: Alexander Morozov <amorozov at etersoft.ru>
Date: Wed Feb 2 21:12:15 2011 +0300
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));
More information about the wine-cvs
mailing list