scrrun: Added a IDriveCollection stub.

This commit is contained in:
Nikolay Sivov 2014-02-24 08:16:16 +04:00 committed by Alexandre Julliard
parent 4da741daf1
commit 8a7795407c
4 changed files with 170 additions and 9 deletions

View File

@ -50,6 +50,11 @@ struct filecollection {
BSTR path;
};
struct drivecollection {
IDriveCollection IDriveCollection_iface;
LONG ref;
};
struct enumdata {
union
{
@ -123,6 +128,11 @@ static inline struct filecollection *impl_from_IFileCollection(IFileCollection *
return CONTAINING_RECORD(iface, struct filecollection, IFileCollection_iface);
}
static inline struct drivecollection *impl_from_IDriveCollection(IDriveCollection *iface)
{
return CONTAINING_RECORD(iface, struct drivecollection, IDriveCollection_iface);
}
static inline struct enumvariant *impl_from_IEnumVARIANT(IEnumVARIANT *iface)
{
return CONTAINING_RECORD(iface, struct enumvariant, IEnumVARIANT_iface);
@ -1150,6 +1160,156 @@ static HRESULT create_filecoll(BSTR path, IFileCollection **files)
return S_OK;
}
static HRESULT WINAPI drivecoll_QueryInterface(IDriveCollection *iface, REFIID riid, void **obj)
{
struct drivecollection *This = impl_from_IDriveCollection(iface);
TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj);
*obj = NULL;
if (IsEqualIID( riid, &IID_IDriveCollection ) ||
IsEqualIID( riid, &IID_IDispatch ) ||
IsEqualIID( riid, &IID_IUnknown ))
{
*obj = iface;
IDriveCollection_AddRef(iface);
}
else
return E_NOINTERFACE;
return S_OK;
}
static ULONG WINAPI drivecoll_AddRef(IDriveCollection *iface)
{
struct drivecollection *This = impl_from_IDriveCollection(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p)->(%d)\n", This, ref);
return ref;
}
static ULONG WINAPI drivecoll_Release(IDriveCollection *iface)
{
struct drivecollection *This = impl_from_IDriveCollection(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->(%d)\n", This, ref);
if (!ref)
heap_free(This);
return ref;
}
static HRESULT WINAPI drivecoll_GetTypeInfoCount(IDriveCollection *iface, UINT *pctinfo)
{
struct drivecollection *This = impl_from_IDriveCollection(iface);
TRACE("(%p)->(%p)\n", This, pctinfo);
*pctinfo = 1;
return S_OK;
}
static HRESULT WINAPI drivecoll_GetTypeInfo(IDriveCollection *iface, UINT iTInfo,
LCID lcid, ITypeInfo **ppTInfo)
{
struct drivecollection *This = impl_from_IDriveCollection(iface);
TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
return get_typeinfo(IDriveCollection_tid, ppTInfo);
}
static HRESULT WINAPI drivecoll_GetIDsOfNames(IDriveCollection *iface, REFIID riid,
LPOLESTR *rgszNames, UINT cNames,
LCID lcid, DISPID *rgDispId)
{
struct drivecollection *This = impl_from_IDriveCollection(iface);
ITypeInfo *typeinfo;
HRESULT hr;
TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
hr = get_typeinfo(IDriveCollection_tid, &typeinfo);
if(SUCCEEDED(hr))
{
hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
ITypeInfo_Release(typeinfo);
}
return hr;
}
static HRESULT WINAPI drivecoll_Invoke(IDriveCollection *iface, DISPID dispIdMember,
REFIID riid, LCID lcid, WORD wFlags,
DISPPARAMS *pDispParams, VARIANT *pVarResult,
EXCEPINFO *pExcepInfo, UINT *puArgErr)
{
struct drivecollection *This = impl_from_IDriveCollection(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(IDriveCollection_tid, &typeinfo);
if(SUCCEEDED(hr))
{
hr = ITypeInfo_Invoke(typeinfo, iface, dispIdMember, wFlags,
pDispParams, pVarResult, pExcepInfo, puArgErr);
ITypeInfo_Release(typeinfo);
}
return hr;
}
static HRESULT WINAPI drivecoll_get_Item(IDriveCollection *iface, VARIANT key, IDrive **drive)
{
struct drivecollection *This = impl_from_IDriveCollection(iface);
FIXME("(%p)->(%p): stub\n", This, drive);
return E_NOTIMPL;
}
static HRESULT WINAPI drivecoll_get__NewEnum(IDriveCollection *iface, IUnknown **penum)
{
struct drivecollection *This = impl_from_IDriveCollection(iface);
FIXME("(%p)->(%p): stub\n", This, penum);
return E_NOTIMPL;
}
static HRESULT WINAPI drivecoll_get_Count(IDriveCollection *iface, LONG *count)
{
struct drivecollection *This = impl_from_IDriveCollection(iface);
FIXME("(%p)->(%p): stub\n", This, count);
return E_NOTIMPL;
}
static const IDriveCollectionVtbl drivecollectionvtbl = {
drivecoll_QueryInterface,
drivecoll_AddRef,
drivecoll_Release,
drivecoll_GetTypeInfoCount,
drivecoll_GetTypeInfo,
drivecoll_GetIDsOfNames,
drivecoll_Invoke,
drivecoll_get_Item,
drivecoll_get__NewEnum,
drivecoll_get_Count
};
static HRESULT create_drivecoll(IDriveCollection **drives)
{
struct drivecollection *This;
*drives = NULL;
This = heap_alloc(sizeof(*This));
if (!This) return E_OUTOFMEMORY;
This->IDriveCollection_iface.lpVtbl = &drivecollectionvtbl;
This->ref = 1;
*drives = &This->IDriveCollection_iface;
return S_OK;
}
static HRESULT WINAPI folder_QueryInterface(IFolder *iface, REFIID riid, void **obj)
{
struct folder *This = impl_from_IFolder(iface);
@ -1944,9 +2104,8 @@ static HRESULT WINAPI filesys_Invoke(IFileSystem3 *iface, DISPID dispIdMember,
static HRESULT WINAPI filesys_get_Drives(IFileSystem3 *iface, IDriveCollection **ppdrives)
{
FIXME("%p %p\n", iface, ppdrives);
return E_NOTIMPL;
TRACE("%p %p\n", iface, ppdrives);
return create_drivecoll(ppdrives);
}
static HRESULT WINAPI filesys_BuildPath(IFileSystem3 *iface, BSTR Path,

View File

@ -103,12 +103,13 @@ static ITypeInfo *typeinfos[LAST_tid];
static REFIID tid_ids[] = {
&IID_NULL,
&IID_IDictionary,
&IID_IDriveCollection,
&IID_IFile,
&IID_IFileCollection,
&IID_IFileSystem3,
&IID_IFolder,
&IID_IFolderCollection,
&IID_ITextStream,
&IID_IFile,
&IID_IFileCollection
&IID_ITextStream
};
static HRESULT load_typelib(void)

View File

@ -263,7 +263,7 @@ library Scripting
oleautomation
]
interface IDriveCollection : IDispatch {
[id(DISPID_VALUE)]
[id(DISPID_VALUE), propget]
HRESULT Item([in] VARIANT Key, [out, retval] IDrive** ppdrive);
[id(DISPID_NEWENUM), propget, restricted, hidden]

View File

@ -25,12 +25,13 @@ typedef enum tid_t
{
NULL_tid,
IDictionary_tid,
IDriveCollection_tid,
IFile_tid,
IFileCollection_tid,
IFileSystem3_tid,
IFolder_tid,
IFolderCollection_tid,
ITextStream_tid,
IFile_tid,
IFileCollection_tid,
LAST_tid
} tid_t;