Robert Shearman : ole32: Implement CoGetObject.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Jun 29 08:32:01 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: b0efdcbdbd9de273abf5bda9302c5bdfea044613
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=b0efdcbdbd9de273abf5bda9302c5bdfea044613

Author: Robert Shearman <rob at codeweavers.com>
Date:   Wed Jun 28 21:24:38 2006 +0100

ole32: Implement CoGetObject.

---

 dlls/ole32/compobj.c  |   52 +++++++++++++++++++++++++++++++++++++++++++++++++
 dlls/ole32/ole32.spec |    2 +-
 2 files changed, 53 insertions(+), 1 deletions(-)

diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c
index 1a8ab45..fc65ddb 100644
--- a/dlls/ole32/compobj.c
+++ b/dlls/ole32/compobj.c
@@ -2909,6 +2909,58 @@ HRESULT WINAPI CoWaitForMultipleHandles(
     return hr;
 }
 
+
+/***********************************************************************
+ *           CoGetObject [OLE32.@]
+ *
+ * Gets the object named by coverting the name to a moniker and binding to it.
+ *
+ * PARAMS
+ *  pszName      [I] String representing the object.
+ *  pBindOptions [I] Parameters affecting the binding to the named object.
+ *  riid         [I] Interface to bind to on the objecct.
+ *  ppv          [O] On output, the interface riid of the object represented
+ *                   by pszName.
+ *
+ * RETURNS
+ *  Success: S_OK.
+ *  Failure: HRESULT code.
+ *
+ * SEE ALSO
+ *  MkParseDisplayName.
+ */
+HRESULT WINAPI CoGetObject(LPCWSTR pszName, BIND_OPTS *pBindOptions,
+    REFIID riid, void **ppv)
+{
+    IBindCtx *pbc;
+    HRESULT hr;
+
+    *ppv = NULL;
+
+    hr = CreateBindCtx(0, &pbc);
+    if (SUCCEEDED(hr))
+    {
+        if (pBindOptions)
+            hr = IBindCtx_SetBindOptions(pbc, pBindOptions);
+
+        if (SUCCEEDED(hr))
+        {
+            ULONG chEaten;
+            IMoniker *pmk;
+
+            hr = MkParseDisplayName(pbc, pszName, &chEaten, &pmk);
+            if (SUCCEEDED(hr))
+            {
+                hr = IMoniker_BindToObject(pmk, pbc, NULL, riid, ppv);
+                IMoniker_Release(pmk);
+            }
+        }
+
+        IBindCtx_Release(pbc);
+    }
+    return hr;
+}
+
 /***********************************************************************
  *		DllMain (OLE32.@)
  */
diff --git a/dlls/ole32/ole32.spec b/dlls/ole32/ole32.spec
index 74f2bfc..56058bb 100644
--- a/dlls/ole32/ole32.spec
+++ b/dlls/ole32/ole32.spec
@@ -30,7 +30,7 @@
 @ stdcall CoGetInterfaceAndReleaseStream(ptr ptr ptr)
 @ stdcall CoGetMalloc(long ptr)
 @ stdcall CoGetMarshalSizeMax(ptr ptr ptr long ptr long)
-@ stub CoGetObject
+@ stdcall CoGetObject(wstr ptr ptr ptr)
 @ stdcall CoGetPSClsid(ptr ptr)
 @ stdcall CoGetStandardMarshal(ptr ptr long ptr long ptr)
 @ stdcall CoGetState(ptr)




More information about the wine-cvs mailing list