ole32.PropVariantClear

Robert Shearman R.J.Shearman at warwick.ac.uk
Sat Jan 11 20:08:16 CST 2003


Made a start of the PropVariantClear function on the hunt for another bug

ChangeLog:
- Support a few trivial cases in PropVariantClear

Rob
-------------- next part --------------
Index: wine/dlls/ole32/ole2.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/ole2.c,v
retrieving revision 1.39
diff -u -r1.39 ole2.c
--- wine/dlls/ole32/ole2.c	7 Jan 2003 20:36:27 -0000	1.39
+++ wine/dlls/ole32/ole2.c	11 Jan 2003 21:07:11 -0000
@@ -541,6 +541,9 @@
   /*
    * Setup the drag n drop tracking window.
    */
+  if (!IsValidInterface((LPUNKNOWN)pDropSource))
+      return E_INVALIDARG;
+
   trackerInfo.dataObject        = pDataObject;
   trackerInfo.dropSource        = pDropSource;
   trackerInfo.dwOKEffect        = dwOKEffect;
Index: wine/dlls/ole32/ole2stubs.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/ole2stubs.c,v
retrieving revision 1.28
diff -u -r1.28 ole2stubs.c
--- wine/dlls/ole32/ole2stubs.c	7 Jan 2003 20:36:27 -0000	1.28
+++ wine/dlls/ole32/ole2stubs.c	11 Jan 2003 21:07:11 -0000
@@ -25,6 +25,7 @@
 #include "winbase.h"
 #include "winuser.h"
 #include "ole2.h"
+#include "objidl.h"
 #include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(ole);
@@ -225,13 +226,42 @@
 /***********************************************************************
  *           PropVariantClear			    [OLE32.166]
  */
-HRESULT WINAPI PropVariantClear(void *pvar) /* [in/out] FIXME: PROPVARIANT * */
+HRESULT WINAPI PropVariantClear(PROPVARIANT * pvar) /* [in/out] FIXME: PROPVARIANT * */
 {
-	FIXME("(%p): stub:\n", pvar);
+	TRACE("(%p)\n", pvar);
 
-	*(LPWORD)pvar = 0;
-	/* sets at least the vt field to VT_EMPTY */
-	return E_NOTIMPL;
+	if (!pvar)
+	    return S_OK;
+
+	switch(pvar->vt)
+	{
+	    case VT_BSTR:
+	        CoTaskMemFree(pvar->u.bstrVal);
+		break;
+	    case VT_STREAM:
+	    case VT_STREAMED_OBJECT:
+	    case VT_STORAGE:
+	    case VT_STORED_OBJECT:
+	        IUnknown_Release((LPUNKNOWN)pvar->u.pStream);
+		break;
+	    case VT_CLSID:
+	    case VT_CF:
+	    case VT_LPSTR:
+	    case VT_LPWSTR:
+	    case VT_BLOB:
+	    case VT_BLOB_OBJECT:
+	        FIXME("Don't know what to do for variant type %d\n", pvar->vt);
+	    default:
+	        if (pvar->vt && VT_VECTOR)
+		{
+		    FIXME("Need to recursively destroy elements in vector\n");
+//		    SafeArrayDestroy(pvar->u.caub);
+		}
+	}
+
+	ZeroMemory(pvar, sizeof(PROPVARIANT));
+
+	return S_OK;
 }


More information about the wine-patches mailing list