scrrun: Added IFolderCollection stub.
This commit is contained in:
parent
c84189609d
commit
2a3f1560bb
@ -36,6 +36,11 @@
|
|||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(scrrun);
|
WINE_DEFAULT_DEBUG_CHANNEL(scrrun);
|
||||||
|
|
||||||
|
struct foldercollection {
|
||||||
|
IFolderCollection IFolderCollection_iface;
|
||||||
|
LONG ref;
|
||||||
|
};
|
||||||
|
|
||||||
struct folder {
|
struct folder {
|
||||||
IFolder IFolder_iface;
|
IFolder IFolder_iface;
|
||||||
LONG ref;
|
LONG ref;
|
||||||
@ -76,6 +81,11 @@ static inline struct textstream *impl_from_ITextStream(ITextStream *iface)
|
|||||||
return CONTAINING_RECORD(iface, struct textstream, ITextStream_iface);
|
return CONTAINING_RECORD(iface, struct textstream, ITextStream_iface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline struct foldercollection *impl_from_IFolderCollection(IFolderCollection *iface)
|
||||||
|
{
|
||||||
|
return CONTAINING_RECORD(iface, struct foldercollection, IFolderCollection_iface);
|
||||||
|
}
|
||||||
|
|
||||||
static inline HRESULT create_error(DWORD err)
|
static inline HRESULT create_error(DWORD err)
|
||||||
{
|
{
|
||||||
switch(err) {
|
switch(err) {
|
||||||
@ -337,6 +347,165 @@ static HRESULT create_textstream(IOMode mode, ITextStream **ret)
|
|||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI foldercoll_QueryInterface(IFolderCollection *iface, REFIID riid, void **obj)
|
||||||
|
{
|
||||||
|
struct foldercollection *This = impl_from_IFolderCollection(iface);
|
||||||
|
|
||||||
|
TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj);
|
||||||
|
|
||||||
|
*obj = NULL;
|
||||||
|
|
||||||
|
if (IsEqualIID( riid, &IID_IFolderCollection ) ||
|
||||||
|
IsEqualIID( riid, &IID_IDispatch ) ||
|
||||||
|
IsEqualIID( riid, &IID_IUnknown ))
|
||||||
|
{
|
||||||
|
*obj = iface;
|
||||||
|
IFolderCollection_AddRef(iface);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return E_NOINTERFACE;
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ULONG WINAPI foldercoll_AddRef(IFolderCollection *iface)
|
||||||
|
{
|
||||||
|
struct foldercollection *This = impl_from_IFolderCollection(iface);
|
||||||
|
ULONG ref = InterlockedIncrement(&This->ref);
|
||||||
|
TRACE("(%p)->(%d)\n", This, ref);
|
||||||
|
return ref;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ULONG WINAPI foldercoll_Release(IFolderCollection *iface)
|
||||||
|
{
|
||||||
|
struct foldercollection *This = impl_from_IFolderCollection(iface);
|
||||||
|
ULONG ref = InterlockedDecrement(&This->ref);
|
||||||
|
TRACE("(%p)->(%d)\n", This, ref);
|
||||||
|
|
||||||
|
if (!ref)
|
||||||
|
heap_free(This);
|
||||||
|
|
||||||
|
return ref;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI foldercoll_GetTypeInfoCount(IFolderCollection *iface, UINT *pctinfo)
|
||||||
|
{
|
||||||
|
struct foldercollection *This = impl_from_IFolderCollection(iface);
|
||||||
|
TRACE("(%p)->(%p)\n", This, pctinfo);
|
||||||
|
*pctinfo = 1;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI foldercoll_GetTypeInfo(IFolderCollection *iface, UINT iTInfo,
|
||||||
|
LCID lcid, ITypeInfo **ppTInfo)
|
||||||
|
{
|
||||||
|
struct foldercollection *This = impl_from_IFolderCollection(iface);
|
||||||
|
TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
|
||||||
|
return get_typeinfo(IFolderCollection_tid, ppTInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI foldercoll_GetIDsOfNames(IFolderCollection *iface, REFIID riid,
|
||||||
|
LPOLESTR *rgszNames, UINT cNames,
|
||||||
|
LCID lcid, DISPID *rgDispId)
|
||||||
|
{
|
||||||
|
struct foldercollection *This = impl_from_IFolderCollection(iface);
|
||||||
|
ITypeInfo *typeinfo;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
|
||||||
|
|
||||||
|
hr = get_typeinfo(IFolderCollection_tid, &typeinfo);
|
||||||
|
if(SUCCEEDED(hr))
|
||||||
|
{
|
||||||
|
hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
|
||||||
|
ITypeInfo_Release(typeinfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI foldercoll_Invoke(IFolderCollection *iface, DISPID dispIdMember,
|
||||||
|
REFIID riid, LCID lcid, WORD wFlags,
|
||||||
|
DISPPARAMS *pDispParams, VARIANT *pVarResult,
|
||||||
|
EXCEPINFO *pExcepInfo, UINT *puArgErr)
|
||||||
|
{
|
||||||
|
struct foldercollection *This = impl_from_IFolderCollection(iface);
|
||||||
|
ITypeInfo *typeinfo;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
|
||||||
|
lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
||||||
|
|
||||||
|
hr = get_typeinfo(IFolderCollection_tid, &typeinfo);
|
||||||
|
if(SUCCEEDED(hr))
|
||||||
|
{
|
||||||
|
hr = ITypeInfo_Invoke(typeinfo, iface, dispIdMember, wFlags,
|
||||||
|
pDispParams, pVarResult, pExcepInfo, puArgErr);
|
||||||
|
ITypeInfo_Release(typeinfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI foldercoll_Add(IFolderCollection *iface, BSTR name, IFolder **folder)
|
||||||
|
{
|
||||||
|
struct foldercollection *This = impl_from_IFolderCollection(iface);
|
||||||
|
FIXME("(%p)->(%s %p): stub\n", This, debugstr_w(name), folder);
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI foldercoll_get_Item(IFolderCollection *iface, VARIANT key, IFolder **folder)
|
||||||
|
{
|
||||||
|
struct foldercollection *This = impl_from_IFolderCollection(iface);
|
||||||
|
FIXME("(%p)->(%p): stub\n", This, folder);
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI foldercoll_get__NewEnum(IFolderCollection *iface, IUnknown **newenum)
|
||||||
|
{
|
||||||
|
struct foldercollection *This = impl_from_IFolderCollection(iface);
|
||||||
|
FIXME("(%p)->(%p): stub\n", This, newenum);
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI foldercoll_get_Count(IFolderCollection *iface, LONG *count)
|
||||||
|
{
|
||||||
|
struct foldercollection *This = impl_from_IFolderCollection(iface);
|
||||||
|
FIXME("(%p)->(%p): stub\n", This, count);
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const IFolderCollectionVtbl foldercollvtbl = {
|
||||||
|
foldercoll_QueryInterface,
|
||||||
|
foldercoll_AddRef,
|
||||||
|
foldercoll_Release,
|
||||||
|
foldercoll_GetTypeInfoCount,
|
||||||
|
foldercoll_GetTypeInfo,
|
||||||
|
foldercoll_GetIDsOfNames,
|
||||||
|
foldercoll_Invoke,
|
||||||
|
foldercoll_Add,
|
||||||
|
foldercoll_get_Item,
|
||||||
|
foldercoll_get__NewEnum,
|
||||||
|
foldercoll_get_Count
|
||||||
|
};
|
||||||
|
|
||||||
|
static HRESULT create_foldercoll(IFolderCollection **folders)
|
||||||
|
{
|
||||||
|
struct foldercollection *This;
|
||||||
|
|
||||||
|
*folders = NULL;
|
||||||
|
|
||||||
|
This = heap_alloc(sizeof(struct foldercollection));
|
||||||
|
if (!This) return E_OUTOFMEMORY;
|
||||||
|
|
||||||
|
This->IFolderCollection_iface.lpVtbl = &foldercollvtbl;
|
||||||
|
This->ref = 1;
|
||||||
|
|
||||||
|
*folders = &This->IFolderCollection_iface;
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI folder_QueryInterface(IFolder *iface, REFIID riid, void **obj)
|
static HRESULT WINAPI folder_QueryInterface(IFolder *iface, REFIID riid, void **obj)
|
||||||
{
|
{
|
||||||
struct folder *This = impl_from_IFolder(iface);
|
struct folder *This = impl_from_IFolder(iface);
|
||||||
@ -568,8 +737,13 @@ static HRESULT WINAPI folder_get_Size(IFolder *iface, VARIANT *size)
|
|||||||
static HRESULT WINAPI folder_get_SubFolders(IFolder *iface, IFolderCollection **folders)
|
static HRESULT WINAPI folder_get_SubFolders(IFolder *iface, IFolderCollection **folders)
|
||||||
{
|
{
|
||||||
struct folder *This = impl_from_IFolder(iface);
|
struct folder *This = impl_from_IFolder(iface);
|
||||||
FIXME("(%p)->(%p): stub\n", This, folders);
|
|
||||||
return E_NOTIMPL;
|
TRACE("(%p)->(%p)\n", This, folders);
|
||||||
|
|
||||||
|
if(!folders)
|
||||||
|
return E_POINTER;
|
||||||
|
|
||||||
|
return create_foldercoll(folders);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI folder_get_Files(IFolder *iface, IFileCollection **files)
|
static HRESULT WINAPI folder_get_Files(IFolder *iface, IFileCollection **files)
|
||||||
|
@ -105,6 +105,7 @@ static REFIID tid_ids[] = {
|
|||||||
&IID_IDictionary,
|
&IID_IDictionary,
|
||||||
&IID_IFileSystem3,
|
&IID_IFileSystem3,
|
||||||
&IID_IFolder,
|
&IID_IFolder,
|
||||||
|
&IID_IFolderCollection,
|
||||||
&IID_ITextStream,
|
&IID_ITextStream,
|
||||||
&IID_IFile
|
&IID_IFile
|
||||||
};
|
};
|
||||||
|
@ -27,6 +27,7 @@ typedef enum tid_t
|
|||||||
IDictionary_tid,
|
IDictionary_tid,
|
||||||
IFileSystem3_tid,
|
IFileSystem3_tid,
|
||||||
IFolder_tid,
|
IFolder_tid,
|
||||||
|
IFolderCollection_tid,
|
||||||
ITextStream_tid,
|
ITextStream_tid,
|
||||||
IFile_tid,
|
IFile_tid,
|
||||||
LAST_tid
|
LAST_tid
|
||||||
|
@ -775,6 +775,30 @@ static void test_GetFolder(void)
|
|||||||
IFolder_Release(folder);
|
IFolder_Release(folder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_FolderCollection(void)
|
||||||
|
{
|
||||||
|
IFolderCollection *folders;
|
||||||
|
WCHAR buffW[MAX_PATH];
|
||||||
|
IFolder *folder;
|
||||||
|
HRESULT hr;
|
||||||
|
BSTR str;
|
||||||
|
|
||||||
|
GetWindowsDirectoryW(buffW, MAX_PATH);
|
||||||
|
str = SysAllocString(buffW);
|
||||||
|
hr = IFileSystem3_GetFolder(fs3, str, &folder);
|
||||||
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
|
SysFreeString(str);
|
||||||
|
|
||||||
|
hr = IFolder_get_SubFolders(folder, NULL);
|
||||||
|
ok(hr == E_POINTER, "got 0x%08x\n", hr);
|
||||||
|
|
||||||
|
hr = IFolder_get_SubFolders(folder, &folders);
|
||||||
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
|
|
||||||
|
IFolderCollection_Release(folders);
|
||||||
|
IFolder_Release(folder);
|
||||||
|
}
|
||||||
|
|
||||||
START_TEST(filesystem)
|
START_TEST(filesystem)
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
@ -800,6 +824,7 @@ START_TEST(filesystem)
|
|||||||
test_CopyFolder();
|
test_CopyFolder();
|
||||||
test_BuildPath();
|
test_BuildPath();
|
||||||
test_GetFolder();
|
test_GetFolder();
|
||||||
|
test_FolderCollection();
|
||||||
|
|
||||||
IFileSystem3_Release(fs3);
|
IFileSystem3_Release(fs3);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user