[PATCH 2/2] qmgr: Implemented BackgroundCopyManagerConstructor, BackgroundCopyManagerDestructor, and BITS_IBackgroundCopyManager_Release.
Roy Shea
roy at cs.hmc.edu
Wed Dec 19 22:03:39 CST 2007
This revised patch:
- Removes unneeded use of ICOM_THIS_MULTI
- Removes unneeded NULL checks on the incoming iface pointer
---
dlls/qmgr/qmgr.c | 40 ++++++++++++++++++++++++++++++++++++++--
dlls/qmgr/qmgr.h | 4 ++++
2 files changed, 42 insertions(+), 2 deletions(-)
diff --git a/dlls/qmgr/qmgr.c b/dlls/qmgr/qmgr.c
index 7dacca5..2ef2125 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)
@@ -62,8 +69,17 @@ static HRESULT WINAPI BITS_IBackgroundCopyManager_QueryInterface(
static ULONG WINAPI BITS_IBackgroundCopyManager_Release(
IBackgroundCopyManager* iface)
{
- FIXME("Not implemented\n");
- return E_NOTIMPL;
+ BackgroundCopyManagerImpl * This = (BackgroundCopyManagerImpl *)iface;
+ ULONG ref;
+
+ TRACE("\n");
+
+ ref = InterlockedDecrement(&This->ref);
+ if (ref == 0)
+ {
+ BackgroundCopyManagerDestructor(This);
+ }
+ return ref;
}
/*** IBackgroundCopyManager interface methods ***/
@@ -118,3 +134,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 bd10c58..0b821cb 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"
/* Background copy manager vtbl and related data */
@@ -32,4 +34,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