Nikolay Sivov : scrrun: Added a IDriveCollection stub.
Alexandre Julliard
julliard at winehq.org
Mon Feb 24 15:42:30 CST 2014
Module: wine
Branch: master
Commit: 8a7795407cc2eb2d3341d379dacdc5737e64d5b5
URL: http://source.winehq.org/git/wine.git/?a=commit;h=8a7795407cc2eb2d3341d379dacdc5737e64d5b5
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Mon Feb 24 08:16:16 2014 +0400
scrrun: Added a IDriveCollection stub.
---
dlls/scrrun/filesystem.c | 165 +++++++++++++++++++++++++++++++++++++++++-
dlls/scrrun/scrrun.c | 7 +-
dlls/scrrun/scrrun.idl | 2 +-
dlls/scrrun/scrrun_private.h | 5 +-
4 files changed, 170 insertions(+), 9 deletions(-)
diff --git a/dlls/scrrun/filesystem.c b/dlls/scrrun/filesystem.c
index 21aaf70..d4f5887 100644
--- a/dlls/scrrun/filesystem.c
+++ b/dlls/scrrun/filesystem.c
@@ -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,
diff --git a/dlls/scrrun/scrrun.c b/dlls/scrrun/scrrun.c
index 9c7c6dc..b88dda1 100644
--- a/dlls/scrrun/scrrun.c
+++ b/dlls/scrrun/scrrun.c
@@ -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)
diff --git a/dlls/scrrun/scrrun.idl b/dlls/scrrun/scrrun.idl
index 73948b5..016eeb6 100644
--- a/dlls/scrrun/scrrun.idl
+++ b/dlls/scrrun/scrrun.idl
@@ -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]
diff --git a/dlls/scrrun/scrrun_private.h b/dlls/scrrun/scrrun_private.h
index 3ffde50..4d3e7be 100644
--- a/dlls/scrrun/scrrun_private.h
+++ b/dlls/scrrun/scrrun_private.h
@@ -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;
More information about the wine-cvs
mailing list