Basic implementation of IStream:Clone
Medland, Bill
Bill.Medland at accpac.com
Mon Sep 10 13:45:58 CDT 2001
<<diff18.txt>>
-------------- next part --------------
Bill Medland (medbi01 at accpac.com)
Basic implementation of IStream:Clone
Index: wine/dlls/ole32/stg_stream.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/stg_stream.c,v
retrieving revision 1.8
diff -u -r1.8 stg_stream.c
--- wine/dlls/ole32/stg_stream.c 2000/10/13 20:26:04 1.8
+++ wine/dlls/ole32/stg_stream.c 2001/09/10 17:39:35
@@ -826,10 +826,44 @@
return E_FAIL;
}
+/***
+ * This method is part of the IStream interface.
+ *
+ * This method returns a clone of the interface that allows for
+ * another seek pointer
+ *
+ * See the documentation of IStream for more info.
+ *
+ * I am not totally sure what I am doing here but I presume that this
+ * should be basically as simple as creating a new stream with the same
+ * parent etc and positioning its seek cursor.
+ */
HRESULT WINAPI StgStreamImpl_Clone(
IStream* iface,
IStream** ppstm) /* [out] */
{
- FIXME("not implemented!\n");
- return E_NOTIMPL;
+ StgStreamImpl* const This=(StgStreamImpl*)iface;
+ HRESULT hres;
+ StgStreamImpl* new_stream;
+ LARGE_INTEGER seek_pos;
+
+ /*
+ * Sanity check
+ */
+ if ( ppstm == 0 )
+ return STG_E_INVALIDPOINTER;
+
+ new_stream = StgStreamImpl_Construct (This->parentStorage, This->grfMode, This->ownerProperty);
+
+ if (!new_stream)
+ return STG_E_INSUFFICIENTMEMORY; /* Currently the only reason for new_stream=0 */
+
+ *ppstm = (IStream*) new_stream;
+ seek_pos.QuadPart = This->currentPosition.QuadPart;
+
+ hres=StgStreamImpl_Seek (*ppstm, seek_pos, STREAM_SEEK_SET, NULL);
+
+ assert (SUCCEEDED(hres));
+
+ return S_OK;
}
More information about the wine-patches
mailing list