[PATCH] bits: Implemented BITS_IBackgroundCopyManager_Release and Test (12/12)
Roy Shea
roy at cs.hmc.edu
Thu Nov 15 10:24:56 CST 2007
This patch adds functionality to BITS allowing a basic test creating a BITS
object. This test uses a good deal of infrastructure including svchost and
qmgrprxy. Running the tests requires first registering ole32, qmgr, and
qmgrprxy with regsvr32.
---
dlls/qmgr/qmgr.c | 19 ++++++++++++++-
dlls/qmgr/qmgr.spec | 4 +-
dlls/qmgr/tests/Makefile.in | 17 ++++++++++++++
dlls/qmgr/tests/qmgr.c | 50 +++++++++++++++++++++++++++++++++++++++++++
4 files changed, 86 insertions(+), 4 deletions(-)
create mode 100644 dlls/qmgr/tests/Makefile.in
create mode 100644 dlls/qmgr/tests/qmgr.c
diff --git a/dlls/qmgr/qmgr.c b/dlls/qmgr/qmgr.c
index 2e716ff..fa93d56 100644
--- a/dlls/qmgr/qmgr.c
+++ b/dlls/qmgr/qmgr.c
@@ -75,8 +75,23 @@ 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, bitsVtbl, iface);
+ ULONG ref;
+
+ TRACE("\n");
+
+ if (This == NULL)
+ {
+ return E_POINTER;
+ }
+
+ ref = InterlockedDecrement(&This->ref);
+ if (ref == 0)
+ {
+ HeapFree(GetProcessHeap(), 0, This);
+ InterlockedDecrement(&dll_ref);
+ }
+ return ref;
}
/*** IBackgroundCopyManager interface methods ***/
diff --git a/dlls/qmgr/qmgr.spec b/dlls/qmgr/qmgr.spec
index 13979d0..6a22606 100644
--- a/dlls/qmgr/qmgr.spec
+++ b/dlls/qmgr/qmgr.spec
@@ -1,6 +1,6 @@
@ stdcall -private DllCanUnloadNow()
@ stdcall -private DllGetClassObject(ptr ptr ptr)
-@ stub DllRegisterServer
-@ stub DllUnregisterServer
+@ stdcall -private DllRegisterServer()
+@ stdcall -private DllUnregisterServer()
@ stdcall -private ServiceMain(long ptr)
diff --git a/dlls/qmgr/tests/Makefile.in b/dlls/qmgr/tests/Makefile.in
new file mode 100644
index 0000000..4c15af7
--- /dev/null
+++ b/dlls/qmgr/tests/Makefile.in
@@ -0,0 +1,17 @@
+TOPSRCDIR = @top_srcdir@
+TOPOBJDIR = ../../..
+SRCDIR = @srcdir@
+VPATH = @srcdir@
+TESTDLL = qmgr.dll
+IMPORTS = ole32 shlwapi kernel32
+MODCFLAGS = @BUILTINFLAG@
+EXTRAINCL = -I$(SRCDIR)/..
+
+CTESTS = \
+ qmgr.c
+
+IDL_I_SRCS = ../qmgr_local.idl
+
+ at MAKE_TEST_RULES@
+
+ at DEPENDENCIES@ # everything below this line is overwritten by make depend
diff --git a/dlls/qmgr/tests/qmgr.c b/dlls/qmgr/tests/qmgr.c
new file mode 100644
index 0000000..64c8e08
--- /dev/null
+++ b/dlls/qmgr/tests/qmgr.c
@@ -0,0 +1,50 @@
+/*
+ * Unit test suite for bits functions
+ *
+ * Copyright 2007 Google (Roy Shea)
+ *
+ * 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
+ */
+
+#include <stdio.h>
+
+#define COBJMACROS
+
+#include "wine/test.h"
+#include "bits.h"
+
+static void test_CreateInstance(void)
+{
+ HRESULT hres;
+ IBackgroundCopyManager* manager = NULL;
+
+ hres = CoCreateInstance(&CLSID_BackgroundCopyManager, NULL,
+ CLSCTX_LOCAL_SERVER, &IID_IBackgroundCopyManager,
+ (void **) &manager);
+ ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
+ if(hres != S_OK)
+ {
+ skip("Unable to create bits instance.\n");
+ return;
+ }
+
+}
+
+START_TEST(qmgr)
+{
+ CoInitialize(NULL);
+ test_CreateInstance();
+ CoUninitialize();
+}
--
1.5.3.1
More information about the wine-patches
mailing list