shell32: Partially implement Folder::get_Title.
authorAlexander Morozov <amorozov@etersoft.ru>
Tue, 18 Jan 2011 18:37:39 +0000 (21:37 +0300)
committerAlexandre Julliard <julliard@winehq.org>
Fri, 28 Jan 2011 16:41:50 +0000 (17:41 +0100)
dlls/shell32/shelldispatch.c
dlls/shell32/tests/shelldispatch.c

index 3ec534755cec887eead4c782d34e64ae659dbde6..67501ae251affd8d447350fa6c5598be1c30a0d8 100644 (file)
@@ -180,10 +180,23 @@ static HRESULT WINAPI FolderImpl_Invoke(Folder3 *iface, DISPID dispIdMember,
 
 static HRESULT WINAPI FolderImpl_get_Title(Folder3 *iface, BSTR *pbs)
 {
-    FIXME("(%p,%p)\n", iface, pbs);
+    FolderImpl *This = impl_from_Folder(iface);
+    WCHAR *p;
+    int len;
+
+    TRACE("(%p,%p)\n", iface, pbs);
 
     *pbs = NULL;
-    return E_NOTIMPL;
+
+    if (V_VT(&This->dir) == VT_I4)
+    {
+        FIXME("special folder constants are not supported\n");
+        return E_NOTIMPL;
+    }
+    p = PathFindFileNameW(V_BSTR(&This->dir));
+    len = lstrlenW(p);
+    *pbs = SysAllocStringLen(p, p[len - 1] == '\\' ? len - 1 : len);
+    return *pbs ? S_OK : E_OUTOFMEMORY;
 }
 
 static HRESULT WINAPI FolderImpl_get_Application(Folder3 *iface,
index a34ec39e863f93e9dc6faf83df334017885afb7e..f253627ad2ee9c56a07a75a9e1d193fd4a6a4cf7 100644 (file)
@@ -148,11 +148,9 @@ static void test_namespace(void)
     if (r == S_OK)
     {
         r = Folder_get_Title(folder, &title);
-        todo_wine
         ok(r == S_OK, "Folder::get_Title failed: %08x\n", r);
         if (r == S_OK)
         {
-            todo_wine
             ok(!lstrcmpW(title, winetestW), "bad title: %s\n",
              wine_dbgstr_w(title));
             SysFreeString(title);
@@ -172,11 +170,9 @@ static void test_namespace(void)
         if (r == S_OK)
         {
             r = Folder_get_Title(folder, &title);
-            todo_wine
             ok(r == S_OK, "Folder::get_Title failed: %08x\n", r);
             if (r == S_OK)
             {
-                todo_wine
                 ok(!lstrcmpW(title, winetestW), "bad title: %s\n",
                  wine_dbgstr_w(title));
                 SysFreeString(title);