Initial implement of IStream.

Josef Reidinger josef.reidinger at seznam.cz
Thu Jan 10 17:07:14 CST 2008


---
 dlls/msxml3/domdoc.c |   90 +++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 89 insertions(+), 1 deletions(-)

diff --git a/dlls/msxml3/domdoc.c b/dlls/msxml3/domdoc.c
index 856fcb0..8477d88 100644
--- a/dlls/msxml3/domdoc.c
+++ b/dlls/msxml3/domdoc.c
@@ -169,6 +169,7 @@ typedef struct _domdoc
 {
     const struct IXMLDOMDocument2Vtbl *lpVtbl;
     const struct IPersistStreamVtbl   *lpvtblIPersistStream;
+		const struct IStreamVtbl					*lpvtblIStream;
     LONG ref;
     VARIANT_BOOL async;
     VARIANT_BOOL validating;
@@ -180,7 +181,7 @@ typedef struct _domdoc
     IXMLDOMSchemaCollection *schema;
     HRESULT error;
 
-     /* IPersistStream */
+     /* IPersistStream and also IStream*/
      IStream *stream;
 } domdoc;
 
@@ -219,6 +220,10 @@ static inline domdoc *impl_from_IPersistStream(IPersistStream *iface)
     return (domdoc *)((char*)iface - FIELD_OFFSET(domdoc, lpvtblIPersistStream));
 }
 
+static inline domdoc *impl_from_IStream(IStream *iface)
+{
+    return (domdoc *)((char*)iface - FIELD_OFFSET(domdoc, lpvtblIStream));
+}
 /************************************************************************
  * xmldoc implementation of IPersistStream.
  */
@@ -339,6 +344,85 @@ static const IPersistStreamVtbl xmldoc_IPersistStream_VTable =
     xmldoc_IPersistStream_GetSizeMax,
 };
 
+/************************************************************************
+ * xmldoc implementation of IStream.
+ */
+
+static HRESULT WINAPI xmldoc_IStream_QueryInterface(
+    IStream *iface, REFIID riid, LPVOID *ppvObj)
+{
+    domdoc *this = impl_from_IStream(iface);
+    return IXMLDocument_QueryInterface((IXMLDocument *)this, riid, ppvObj);
+}
+
+static ULONG WINAPI xmldoc_IStream_AddRef(
+    IStream *iface)
+{
+    domdoc *this = impl_from_IStream(iface);
+    return IXMLDocument_AddRef((IXMLDocument *)this);
+}
+
+static ULONG WINAPI xmldoc_IStream_Release(
+    IStream *iface)
+{
+    domdoc *this = impl_from_IStream(iface);
+    return IXMLDocument_Release((IXMLDocument *)this);
+}
+
+
+static HRESULT WINAPI xmldoc_IStream_Read(
+    IStream *iface, void *pv, ULONG cb, ULONG *pcbRead)
+{
+		domdoc *This = impl_from_IStream(iface);
+		if (!This->Stream){
+			
+		}
+		return IStream_Read(This->stream,pv,cb,pcbRead);
+}
+
+static HRESULT WINAPI xmldoc_IStream_Write(
+    IStream *iface, void const *pv, ULONG cb, ULONG *pcbRead)
+{
+		domdoc *This = impl_from_IStream(iface);
+		return IStream_Write(This->stream,pv,cb,pcbRead);
+}
+
+
+static HRESULT WINAPI xmldoc_IStream_Seek(
+		IStream *iface, LARGE_INTEGER dlibMove,
+		DWORD dwOrigin,	ULARGE_INTEGER* plibNewPosition)
+{
+    TRACE("(%p, %lli, %li, %p): stub!\n", iface, dlibMove,
+				dwOrigin, plibNewPosition);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI xmldoc_IStream_SetSize(
+		IStream *iface, ULARGE_INTEGER libNewSize)
+{
+    TRACE("(%p, %llu): stub!\n", iface, libNewSize);
+    return E_NOTIMPL;
+}
+		
+
+static const IStreamVtbl xmldoc_IStream_VTable =
+{
+		xmldoc_IStream_QueryInterface,
+		xmldoc_IStream_AddRef,
+		xmldoc_IStream_Release,
+    xmldoc_IStream_Read,
+    xmldoc_IStream_Write,
+    xmldoc_IStream_Seek,
+    xmldoc_IStream_SetSize
+/*    xmldoc_IStream_CopyTo,
+    xmldoc_IStream_Commit,
+    xmldoc_IStream_Revert,
+    xmldoc_IStream_LockRegion,
+    xmldoc_IStream_UnlockRegion,
+    xmldoc_IStream_Stat,
+    xmldoc_IStream_Clone*/
+};
+
 static HRESULT WINAPI domdoc_QueryInterface( IXMLDOMDocument2 *iface, REFIID riid, void** ppvObject )
 {
     domdoc *This = impl_from_IXMLDOMDocument2( iface );
@@ -362,6 +446,10 @@ static HRESULT WINAPI domdoc_QueryInterface( IXMLDOMDocument2 *iface, REFIID rii
     {
         *ppvObject = (IPersistStream*)&(This->lpvtblIPersistStream);
     }
+    else if (IsEqualGUID(&IID_IStream, riid))
+    {
+        *ppvObject = (IStream*)&(This->lpvtblIStream);
+    }
     else if(IsEqualGUID(&IID_IRunnableObject, riid))
     {
         TRACE("IID_IRunnableObject not supported returning NULL\n");
-- 
1.5.3.7


--------------040106040909070706090504
Content-Type: text/x-patch;
 name="0002-Function-write-need-add-other-func.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="0002-Function-write-need-add-other-func.patch"



More information about the wine-patches mailing list