[PATCH 3/3] qmgr: Implemented BackgroundCopyManagerConstructor, BackgroundCopyManagerDestructor, and BITS_IBackgroundCopyManager_Release.

Roy Shea roy at cs.hmc.edu
Mon Dec 17 16:41:17 CST 2007


---
 dlls/qmgr/qmgr.c |   45 +++++++++++++++++++++++++++++++++++++++++++--
 dlls/qmgr/qmgr.h |    4 ++++
 2 files changed, 47 insertions(+), 2 deletions(-)

diff --git a/dlls/qmgr/qmgr.c b/dlls/qmgr/qmgr.c
index 52ea34c..76debc2 100644
--- a/dlls/qmgr/qmgr.c
+++ b/dlls/qmgr/qmgr.c
@@ -23,6 +23,13 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(qmgr);
 
+/* Destructor for instances of background copy manager */
+static void BackgroundCopyManagerDestructor(BackgroundCopyManagerImpl *This)
+{
+    TRACE("%p\n", This);
+    HeapFree(GetProcessHeap(), 0, This);
+}
+
 /* Add a reference to the iface pointer */
 static ULONG WINAPI BITS_IBackgroundCopyManager_AddRef(
         IBackgroundCopyManager* iface)
@@ -70,8 +77,22 @@ static HRESULT WINAPI BITS_IBackgroundCopyManager_QueryInterface(
 static ULONG WINAPI BITS_IBackgroundCopyManager_Release(
         IBackgroundCopyManager* iface)
 {
-    FIXME("Not implemented\n");
-    return E_NOTIMPL;
+    ICOM_THIS_MULTI(BackgroundCopyManagerImpl, lpVtbl, iface);
+    ULONG ref;
+
+    TRACE("\n");
+
+    if (This == NULL)
+    {
+        return E_POINTER;
+    }
+
+    ref = InterlockedDecrement(&This->ref);
+    if (ref == 0)
+    {
+        BackgroundCopyManagerDestructor(This);
+    }
+    return ref;
 }
 
 /*** IBackgroundCopyManager interface methods ***/
@@ -126,3 +147,23 @@ const IBackgroundCopyManagerVtbl BITS_IBackgroundCopyManager_Vtbl =
     BITS_IBackgroundCopyManager_EnumJobs,
     BITS_IBackgroundCopyManager_GetErrorDescription
 };
+
+/* Constructor for instances of background copy manager */
+HRESULT BackgroundCopyManagerConstructor(IUnknown *pUnkOuter, LPVOID *ppObj)
+{
+    BackgroundCopyManagerImpl *This;
+
+    TRACE("(%p,%p)\n", pUnkOuter, ppObj);
+
+    This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
+    if (!This)
+    {
+        return E_OUTOFMEMORY;
+    }
+
+    This->lpVtbl = &BITS_IBackgroundCopyManager_Vtbl;
+    This->ref = 1;
+
+    *ppObj = &This->lpVtbl;
+    return S_OK;
+}
diff --git a/dlls/qmgr/qmgr.h b/dlls/qmgr/qmgr.h
index cbf9e1b..6afc8a0 100644
--- a/dlls/qmgr/qmgr.h
+++ b/dlls/qmgr/qmgr.h
@@ -23,6 +23,8 @@
 
 #include "windef.h"
 #include "objbase.h"
+
+#define COBJMACROS
 #include "bits.h"
 
 #define ICOM_THIS_MULTI(impl,field,iface) \
@@ -35,4 +37,6 @@ typedef struct
     LONG ref;
 } BackgroundCopyManagerImpl;
 
+HRESULT BackgroundCopyManagerConstructor(IUnknown *pUnkOuter, LPVOID *ppObj);
+
 #endif /* __QMGR_H__ */
-- 
1.5.3.1




More information about the wine-patches mailing list