[PATCH] Complete IUnknown_SetOwner call

Nikolay Sivov nsivov at codeweavers.com
Fri Mar 26 20:17:56 CDT 2010


---
 .gitignore               |    1 +
 dlls/shlwapi/ordinal.c   |   41 +++++++++++++++++++----------------------
 dlls/uuid/uuid.c         |    1 +
 include/Makefile.in      |    1 +
 include/shdeprecated.idl |   32 ++++++++++++++++++++++++++++++++
 5 files changed, 54 insertions(+), 22 deletions(-)
 create mode 100644 include/shdeprecated.idl

diff --git a/.gitignore b/.gitignore
index d0cf776..76c7376 100644
--- a/.gitignore
+++ b/.gitignore
@@ -193,6 +193,7 @@ include/qedit.h
 include/richole.h
 include/sensevts.h
 include/servprov.h
+include/shdeprecated.h
 include/shldisp.h
 include/shobjidl.h
 include/shtypes.h
diff --git a/dlls/shlwapi/ordinal.c b/dlls/shlwapi/ordinal.c
index 70c3285..bb17734 100644
--- a/dlls/shlwapi/ordinal.c
+++ b/dlls/shlwapi/ordinal.c
@@ -42,6 +42,7 @@
 #include "mmsystem.h"
 #include "objbase.h"
 #include "exdisp.h"
+#include "shdeprecated.h"
 #include "shlobj.h"
 #include "shlwapi.h"
 #include "shellapi.h"
@@ -1349,36 +1350,32 @@ HRESULT WINAPI IUnknown_GetWindow(IUnknown *lpUnknown, HWND *lphWnd)
 /*************************************************************************
  *      @	[SHLWAPI.173]
  *
- * Call a method on as as yet unidentified object.
+ * Call a SetOwner method of IShellService from specified object.
  *
  * PARAMS
- *  pUnk [I] Object supporting the unidentified interface,
- *  arg  [I] Argument for the call on the object.
+ *  iface [I] Object that supports IShellService
+ *  pUnk  [I] Argument for the SetOwner call
  *
  * RETURNS
- *  S_OK.
+ *  Corresponding return value from last call or E_FAIL for null input
  */
-HRESULT WINAPI IUnknown_SetOwner(IUnknown *pUnk, ULONG arg)
+HRESULT WINAPI IUnknown_SetOwner(IUnknown *iface, IUnknown *pUnk)
 {
-  static const GUID guid_173 = {
-    0x5836fb00, 0x8187, 0x11cf, { 0xa1,0x2b,0x00,0xaa,0x00,0x4a,0xe8,0x37 }
-  };
-  IMalloc *pUnk2;
+  IShellService *service;
+  HRESULT hr;
 
-  TRACE("(%p,%d)\n", pUnk, arg);
+  TRACE("(%p, %p)\n", iface, pUnk);
 
-  /* Note: arg may not be a ULONG and pUnk2 is for sure not an IMalloc -
-   *       We use this interface as its vtable entry is compatible with the
-   *       object in question.
-   * FIXME: Find out what this object is and where it should be defined.
-   */
-  if (pUnk &&
-      SUCCEEDED(IUnknown_QueryInterface(pUnk, &guid_173, (void**)&pUnk2)))
+  if (!iface) return E_FAIL;
+
+  hr = IUnknown_QueryInterface(iface, &IID_IShellService, (void**)&service);
+  if (hr == S_OK)
   {
-    IMalloc_Alloc(pUnk2, arg); /* Faked call!! */
-    IMalloc_Release(pUnk2);
+    hr = IShellService_SetOwner(service, pUnk);
+    IShellService_Release(service);
   }
-  return S_OK;
+
+  return hr;
 }
 
 /*************************************************************************
diff --git a/dlls/uuid/uuid.c b/dlls/uuid/uuid.c
index 5a1a255..f8d19e2 100644
--- a/dlls/uuid/uuid.c
+++ b/dlls/uuid/uuid.c
@@ -47,6 +47,7 @@ DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
 #include "docobj.h"
 #include "exdisp.h"
 
+#include "shdeprecated.h"
 #include "shlguid.h"
 #include "shlobj.h"
 #include "shldisp.h"
diff --git a/include/Makefile.in b/include/Makefile.in
index ce35804..c9570f0 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -77,6 +77,7 @@ PUBLIC_IDL_H_SRCS = \
 	richole.idl \
 	sensevts.idl \
 	servprov.idl \
+	shdeprecated.idl \
 	shldisp.idl \
 	shobjidl.idl \
 	shtypes.idl \
diff --git a/include/shdeprecated.idl b/include/shdeprecated.idl
new file mode 100644
index 0000000..d8d6f64
--- /dev/null
+++ b/include/shdeprecated.idl
@@ -0,0 +1,32 @@
+/*
+ * Deprecated shell interfaces
+ *
+ * Copyright (C) 2010 Nikolay Sivov for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+import "objidl.idl";
+
+[
+    object,
+    local,
+    uuid(5836fb00-8187-11cf-a12b-00aa004ae837)
+]
+interface IShellService : IUnknown
+{
+    HRESULT SetOwner( [in] IUnknown *pUnk );
+}
+
-- 
1.5.6.5


--=-WcahUz4uKQ/7LGao3oaJ--




More information about the wine-patches mailing list