scrrun: Implement Name() property for Folder.

This commit is contained in:
Nikolay Sivov 2014-01-06 01:22:32 +04:00 committed by Alexandre Julliard
parent b99b69aac2
commit 42d2b51992
2 changed files with 28 additions and 2 deletions

View File

@ -892,8 +892,26 @@ static HRESULT WINAPI folder_get_Path(IFolder *iface, BSTR *path)
static HRESULT WINAPI folder_get_Name(IFolder *iface, BSTR *name) static HRESULT WINAPI folder_get_Name(IFolder *iface, BSTR *name)
{ {
struct folder *This = impl_from_IFolder(iface); struct folder *This = impl_from_IFolder(iface);
FIXME("(%p)->(%p): stub\n", This, name); WCHAR *ptr;
return E_NOTIMPL;
TRACE("(%p)->(%p)\n", This, name);
if(!name)
return E_POINTER;
*name = NULL;
ptr = strrchrW(This->path, '\\');
if (ptr)
{
*name = SysAllocString(ptr+1);
TRACE("%s\n", debugstr_w(*name));
if (!*name) return E_OUTOFMEMORY;
}
else
return E_FAIL;
return S_OK;
} }
static HRESULT WINAPI folder_put_Name(IFolder *iface, BSTR name) static HRESULT WINAPI folder_put_Name(IFolder *iface, BSTR name)
@ -1072,6 +1090,8 @@ HRESULT create_folder(const WCHAR *path, IFolder **folder)
*folder = NULL; *folder = NULL;
TRACE("%s\n", debugstr_w(path));
This = heap_alloc(sizeof(struct folder)); This = heap_alloc(sizeof(struct folder));
if (!This) return E_OUTOFMEMORY; if (!This) return E_OUTOFMEMORY;

View File

@ -882,6 +882,12 @@ if (hr == S_OK) {
hr = IDispatch_QueryInterface(V_DISPATCH(&var), &IID_IFolder, (void**)&folder); hr = IDispatch_QueryInterface(V_DISPATCH(&var), &IID_IFolder, (void**)&folder);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "got 0x%08x\n", hr);
str = NULL;
hr = IFolder_get_Name(folder, &str);
ok(hr == S_OK, "got 0x%08x\n", hr);
SysFreeString(str);
IFolder_Release(folder); IFolder_Release(folder);
VariantClear(&var); VariantClear(&var);