OLE32: BindCtxImpl_RegisterObjectParam

Alberto Massari alby at exln.com
Thu Dec 26 07:05:20 CST 2002


Changelog:
 - IBindCtx::RegisterObjectParam is supposed to replace the old value if the key is already registered

Alberto

Index: bindctx.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/bindctx.c,v
retrieving revision 1.17
diff -u -r1.17 bindctx.c
--- bindctx.c	19 Dec 2002 22:16:35 -0000	1.17
+++ bindctx.c	26 Dec 2002 11:27:48 -0000
@@ -371,15 +371,24 @@
  ******************************************************************************/
 HRESULT WINAPI BindCtxImpl_RegisterObjectParam(IBindCtx* iface,LPOLESTR pszkey, IUnknown* punk)
 {
+    DWORD index=0;
     ICOM_THIS(BindCtxImpl,iface);
 
-    TRACE("(%p,%p,%p)\n",This,pszkey,punk);
+    TRACE("(%p,%s,%p)\n",This,debugstr_w(pszkey),punk);
 
     if (punk==NULL)
         return E_INVALIDARG;
 
     IUnknown_AddRef(punk);
 
+    if (pszkey!=NULL && BindCtxImpl_GetObjectIndex(This,NULL,pszkey,&index)==S_OK)
+    {
+	TRACE("Overwriting existing key\n");
+	if(This->bindCtxTable[index].pObj!=NULL)
+	    IUnknown_Release(This->bindCtxTable[index].pObj);
+	This->bindCtxTable[index].pObj=punk;
+	return S_OK;
+    }
     This->bindCtxTable[This->bindCtxTableLastIndex].pObj = punk;
     This->bindCtxTable[This->bindCtxTableLastIndex].regType = 1;
 
@@ -422,7 +431,7 @@
     DWORD index;
     ICOM_THIS(BindCtxImpl,iface);
 
-    TRACE("(%p,%p,%p)\n",This,pszkey,punk);
+    TRACE("(%p,%s,%p)\n",This,debugstr_w(pszkey),punk);
 
     if (punk==NULL)
         return E_POINTER;
@@ -448,7 +457,7 @@
 
     ICOM_THIS(BindCtxImpl,iface);
 
-    TRACE("(%p,%p)\n",This,ppenum);
+    TRACE("(%p,%s)\n",This,debugstr_w(ppenum));
 
     if (BindCtxImpl_GetObjectIndex(This,NULL,ppenum,&index)==S_FALSE)
         return E_FAIL;
@@ -516,7 +525,7 @@
     if (found)
         return S_OK;
-    else
-        return S_FALSE;
+    TRACE("key not found\n");
+    return S_FALSE;
 }
 
 /******************************************************************************





More information about the wine-patches mailing list