qmgr: Add DLL server and service boilerplate with test.

Dan Hipschman dsh at linux.ucla.edu
Tue Jan 15 18:36:03 CST 2008


This is an attempt to get the rest of Roy's BITS patches in.  He's got a
lot.  :-)  This first one contains the last patch he sent, which didn't get
accepted:

http://winehq.org/pipermail/wine-patches/2007-December/048200.html

Besides adding the class factory code, this patch also adds the dll
registration and service code, so it's basically just all the boilerplate.
I wanted to get to a point where we could add a test, and this was the first
place Roy had one.

As for the function of the code, I didn't really change much.  I did some
cleanup, though:

 o removed some comments that were too obvious
 o vertically shortened the code (removed unnecessary braces, etc.)
 o use FAILED() instead of checking for S_OK
 o use less specific method accessors (e.g., IUnknown_QueryInterface instead
   of IBackgroundCopyManager_QueryInterface)
 o choose a header guard less likely to clash (__FACTORY_H__ is too simple)
 o go with a more data-driven approach to string table initialization in
   register_server
 o add some more checks for failure and free some things that were missed
 o start all debug messages with lowercase letters

This list is mostly for Roy since nobody else has seen anything passed the
factory part.  I think he had a good handle on what he was doing and his
approach seems clean.

This is one of those patches that will need make_makefiles run after applying.

---
 dlls/qmgr/Makefile.in       |    6 ++-
 dlls/qmgr/factory.c         |  106 ++++++++++++++++++++++++++++++++
 dlls/qmgr/factory.h         |   35 +++++++++++
 dlls/qmgr/qmgr.inf          |   31 ++++++++++
 dlls/qmgr/qmgr.spec         |    5 +-
 dlls/qmgr/qmgr_main.c       |  105 +++++++++++++++++++++++++++++++-
 dlls/qmgr/qmgr_service.c    |  140 +++++++++++++++++++++++++++++++++++++++++++
 dlls/qmgr/rsrc.rc           |   20 ++++++
 dlls/qmgr/tests/Makefile.in |   17 +++++
 dlls/qmgr/tests/qmgr.c      |   55 +++++++++++++++++
 tools/wine.inf              |    2 +
 11 files changed, 517 insertions(+), 5 deletions(-)
 create mode 100644 dlls/qmgr/factory.c
 create mode 100644 dlls/qmgr/factory.h
 create mode 100644 dlls/qmgr/qmgr.inf
 create mode 100644 dlls/qmgr/qmgr_service.c
 create mode 100644 dlls/qmgr/rsrc.rc
 create mode 100644 dlls/qmgr/tests/Makefile.in
 create mode 100644 dlls/qmgr/tests/qmgr.c

diff --git a/dlls/qmgr/Makefile.in b/dlls/qmgr/Makefile.in
index 3a32cbe..61d8cc7 100644
--- a/dlls/qmgr/Makefile.in
+++ b/dlls/qmgr/Makefile.in
@@ -3,13 +3,17 @@ TOPOBJDIR = ../..
 SRCDIR    = @srcdir@
 VPATH     = @srcdir@
 MODULE    = qmgr.dll
-IMPORTS   = kernel32
+IMPORTS   = kernel32 advapi32 ole32
 EXTRALIBS = -luuid
 
 C_SRCS = \
+	qmgr_service.c \
+	factory.c \
 	qmgr.c \
 	qmgr_main.c
 
+RC_SRCS = rsrc.rc
+
 IDL_I_SRCS = qmgr_local.idl
 
 @MAKE_DLL_RULES@
diff --git a/dlls/qmgr/factory.c b/dlls/qmgr/factory.c
new file mode 100644
index 0000000..d814e33
--- /dev/null
+++ b/dlls/qmgr/factory.c
@@ -0,0 +1,106 @@
+/*
+ * Class factory interface for Queue Manager (BITS)
+ *
+ * Copyright (C) 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
+ */
+
+#define COBJMACROS
+
+#include "qmgr.h"
+#include "factory.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(qmgr);
+
+static ULONG WINAPI
+BITS_IClassFactory_AddRef(LPCLASSFACTORY iface)
+{
+  ClassFactoryImpl *This = (ClassFactoryImpl *) iface;
+  TRACE("\n");
+  return InterlockedIncrement(&This->ref);
+}
+
+static HRESULT WINAPI
+BITS_IClassFactory_QueryInterface(LPCLASSFACTORY iface, REFIID riid,
+                                  LPVOID *ppvObj)
+{
+  ClassFactoryImpl *This = (ClassFactoryImpl *) iface;
+
+  TRACE("IID: %s\n", debugstr_guid(riid));
+
+  if (IsEqualGUID(riid, &IID_IUnknown)
+      || IsEqualGUID(riid, &IID_IClassFactory))
+  {
+    *ppvObj = &This->lpVtbl;
+    IClassFactory_AddRef(iface);
+    return S_OK;
+  }
+
+  *ppvObj = NULL;
+  return E_NOINTERFACE;
+}
+
+static ULONG WINAPI
+BITS_IClassFactory_Release(LPCLASSFACTORY iface)
+{
+  ClassFactoryImpl *This = (ClassFactoryImpl *) iface;
+  TRACE("\n");
+  return InterlockedDecrement(&This->ref);
+}
+
+static HRESULT WINAPI
+BITS_IClassFactory_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pUnkOuter,
+                                  REFIID riid, LPVOID *ppvObj)
+{
+  HRESULT res;
+  IUnknown *punk = NULL;
+
+  TRACE("IID: %s\n", debugstr_guid(riid));
+
+  if (pUnkOuter)
+    return CLASS_E_NOAGGREGATION;
+
+  res = BackgroundCopyManagerConstructor(pUnkOuter, (LPVOID*) &punk);
+  if (FAILED(res))
+    return res;
+
+  res = IUnknown_QueryInterface(punk, riid, ppvObj);
+  IUnknown_Release(punk);
+  return res;
+}
+
+static HRESULT WINAPI
+BITS_IClassFactory_LockServer(LPCLASSFACTORY iface, BOOL fLock)
+{
+    FIXME("not implemented\n");
+    return E_NOTIMPL;
+}
+
+static const IClassFactoryVtbl BITS_IClassFactory_Vtbl =
+{
+    BITS_IClassFactory_QueryInterface,
+    BITS_IClassFactory_AddRef,
+    BITS_IClassFactory_Release,
+    BITS_IClassFactory_CreateInstance,
+    BITS_IClassFactory_LockServer
+};
+
+ClassFactoryImpl BITS_ClassFactory =
+{
+    &BITS_IClassFactory_Vtbl,
+    0
+};
diff --git a/dlls/qmgr/factory.h b/dlls/qmgr/factory.h
new file mode 100644
index 0000000..c0413c8
--- /dev/null
+++ b/dlls/qmgr/factory.h
@@ -0,0 +1,35 @@
+/*
+ * Factory interface for BITS
+ *
+ * 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
+ */
+
+#ifndef __QMGR_FACTORY_H__
+#define __QMGR_FACTORY_H__
+
+#include "windef.h"
+#include "objbase.h"
+
+typedef struct
+{
+    const IClassFactoryVtbl *lpVtbl;
+    LONG ref;
+} ClassFactoryImpl;
+
+extern ClassFactoryImpl BITS_ClassFactory;
+
+#endif /* __QMGR_FACTORY_H__ */
diff --git a/dlls/qmgr/qmgr.inf b/dlls/qmgr/qmgr.inf
new file mode 100644
index 0000000..0550f01
--- /dev/null
+++ b/dlls/qmgr/qmgr.inf
@@ -0,0 +1,31 @@
+[version]
+Signature="$CHICAGO$"
+
+
+[Strings]
+Services="System\CurrentControlSet\Services"
+
+
+[RegisterDll]
+AddReg = Qmgr.Reg
+
+
+[UnregisterDll]
+DelReg = Qmgr.Reg
+
+
+[Qmgr.Reg]
+
+HKCR,"AppID\BITS","AppID",,"%CLSID_BackgroundCopyQMgr%"
+HKCR,"AppID\%CLSID_BackgroundCopyQMgr%","LocalService",,"BITS"
+HKCR,"CLSID\%CLSID_BackgroundCopyManager%","AppID",,"%CLSID_BackgroundCopyQMgr%"
+
+HKLM,"Software\Microsoft\Windows NT\CurrentVersion\SvcHost","netsvcs",0x00010000,"BITS"
+
+HKLM,"%Services%\BITS","Type",0x00010001,00000110
+HKLM,"%Services%\BITS","Start",0x00010001,00000003
+HKLM,"%Services%\BITS","ErrorControl",0x00010001,00000001
+HKLM,"%Services%\BITS","Description",,"BITS Service"
+HKLM,"%Services%\BITS","DispalyName",,"BITS"
+HKLM,"%Services%\BITS","ImagePath",0x00020000,"svchost.exe -k netsvcs"
+HKLM,"%Services%\BITS\Parameters","ServiceDll",0x00020000,"qmgr.dll"
diff --git a/dlls/qmgr/qmgr.spec b/dlls/qmgr/qmgr.spec
index 1a63b32..2431c63 100644
--- a/dlls/qmgr/qmgr.spec
+++ b/dlls/qmgr/qmgr.spec
@@ -1,2 +1,3 @@
-@ stub DllRegisterServer
-@ stub DllUnregisterServer
+@ stdcall -private DllRegisterServer()
+@ stdcall -private DllUnregisterServer()
+@ stdcall -private ServiceMain(long ptr)
diff --git a/dlls/qmgr/qmgr_main.c b/dlls/qmgr/qmgr_main.c
index d00ac2d..e98b837 100644
--- a/dlls/qmgr/qmgr_main.c
+++ b/dlls/qmgr/qmgr_main.c
@@ -21,15 +21,30 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#include <assert.h>
 #include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
 
-#include "windef.h"
-#include "winbase.h"
+#include "objbase.h"
+#include "winuser.h"
+#include "winreg.h"
+#include "advpub.h"
+#include "olectl.h"
+
+#include "bits.h"
+#include "initguid.h"
 
 #include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(qmgr);
 
+/* Handle to the base address of this DLL */
+static HINSTANCE hInst;
+
+/* Other GUIDs used by this module */
+DEFINE_GUID(CLSID_BackgroundCopyQMgr, 0x69AD4AEE, 0x51BE, 0x439b, 0xA9,0x2C, 0x86,0xAE,0x49,0x0E,0x8B,0x30);
+
 /* Entry point for DLL */
 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
 {
@@ -41,6 +56,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
             return FALSE;  /* prefer native version */
         case DLL_PROCESS_ATTACH:
             DisableThreadLibraryCalls(hinstDLL);
+            hInst = hinstDLL;
             break;
         case DLL_PROCESS_DETACH:
             break;
@@ -48,3 +64,88 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
 
     return TRUE;
 }
+
+static LPSTR strdupA(LPCSTR p)
+{
+    LPSTR ret;
+    DWORD len = (strlen(p) + 1);
+    ret = HeapAlloc(GetProcessHeap(), 0, len);
+    memcpy(ret, p, len);
+    return ret;
+}
+
+typedef HRESULT (WINAPI *pRegInstall_t) (HMODULE, LPCSTR, const STRTABLEA *);
+
+/* Use an INF file to register or unregister the DLL */
+static HRESULT register_server(BOOL do_register)
+{
+    #define CLSID_EXPANSION_ENTRY(id) { "CLSID_" #id, &CLSID_ ## id }
+    static const struct {
+        const char *name;
+        const CLSID *clsid;
+    } expns[] =  {
+        CLSID_EXPANSION_ENTRY(BackgroundCopyQMgr),
+        CLSID_EXPANSION_ENTRY(BackgroundCopyManager)
+    };
+    #undef CLSID_EXPANSION_ENTRY
+    HRESULT hres = S_OK;
+    HMODULE hAdvpack;
+    pRegInstall_t pRegInstall;
+    STRTABLEA strtable;
+    STRENTRYA pse[sizeof expns / sizeof expns[0]];
+    int i = 0;
+
+    static const WCHAR wszAdvpack[] = {'a','d','v','p','a','c','k','.','d','l','l',0};
+
+    TRACE("(%x)\n", do_register);
+
+    strtable.cEntries = sizeof pse / sizeof pse[0];
+    strtable.pse = pse;
+    for (i=0; i < strtable.cEntries; i++) {
+        static const char dummy_sample[] = "{12345678-1234-1234-1234-123456789012}";
+        const CLSID *clsid = expns[i].clsid;
+        pse[i].pszName = strdupA(expns[i].name);
+        pse[i].pszValue = HeapAlloc(GetProcessHeap(), 0, sizeof dummy_sample);
+        sprintf(pse[i].pszValue, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
+                clsid->Data1, clsid->Data2, clsid->Data3, clsid->Data4[0],
+                clsid->Data4[1], clsid->Data4[2], clsid->Data4[3], clsid->Data4[4],
+                clsid->Data4[5], clsid->Data4[6], clsid->Data4[7]);
+    }
+
+    hAdvpack = LoadLibraryW(wszAdvpack);
+    if (!hAdvpack) {
+        ERR("couldn't load %s\n", debugstr_w(wszAdvpack));
+        hres = SELFREG_E_CLASS;
+    }
+    else {
+        pRegInstall = (pRegInstall_t) GetProcAddress(hAdvpack, "RegInstall");
+        if (!pRegInstall) {
+            ERR("couldn't find RegInstall in %s\n", debugstr_w(wszAdvpack));
+            hres = SELFREG_E_CLASS;
+        }
+        else
+            hres = pRegInstall(hInst, do_register ? "RegisterDll" : "UnregisterDll",
+                               &strtable);
+        FreeLibrary(hAdvpack);
+    }
+
+    for (i=0; i < sizeof pse / sizeof pse[0]; i++) {
+        HeapFree(GetProcessHeap(), 0, pse[i].pszName);
+        HeapFree(GetProcessHeap(), 0, pse[i].pszValue);
+    }
+
+    if (FAILED(hres))
+        ERR("RegInstall failed: %08x\n", hres);
+
+    return hres;
+}
+
+HRESULT WINAPI DllRegisterServer()
+{
+    return register_server(TRUE);
+}
+
+HRESULT WINAPI DllUnregisterServer()
+{
+    return register_server(FALSE);
+}
diff --git a/dlls/qmgr/qmgr_service.c b/dlls/qmgr/qmgr_service.c
new file mode 100644
index 0000000..85aba5d
--- /dev/null
+++ b/dlls/qmgr/qmgr_service.c
@@ -0,0 +1,140 @@
+/*
+ * ServiceMain function for qmgr running within svchost
+ *
+ * Copyright 2007 (C) 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 <stdarg.h>
+
+#include "windef.h"
+#include "objbase.h"
+#include "winsvc.h"
+#include "bits.h"
+
+#include "factory.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(qmgr);
+
+static WCHAR qmgr_nameW[] = {'B','I','T','S',0};
+static SERVICE_STATUS_HANDLE status_handle;
+static SERVICE_STATUS status;
+static HANDLE stop_event = NULL;
+
+static VOID
+UpdateStatus(DWORD dwCurrentState, DWORD dwWin32ExitCode, DWORD dwWaitHint)
+{
+  status.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
+  status.dwCurrentState = dwCurrentState;
+  if (dwCurrentState == SERVICE_START_PENDING)
+    status.dwControlsAccepted = 0;
+  else
+    status.dwControlsAccepted
+      = (SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_PAUSE_CONTINUE
+         | SERVICE_ACCEPT_SHUTDOWN);
+  status.dwWin32ExitCode = 0;
+  status.dwServiceSpecificExitCode = 0;
+  status.dwCheckPoint = 0;
+  status.dwWaitHint = dwWaitHint;
+
+  if (!SetServiceStatus(status_handle, &status)) {
+    ERR("failed to set service status\n");
+    SetEvent(stop_event);
+  }
+}
+
+/* Handle incoming ControlService signals */
+static DWORD WINAPI
+ServiceHandler(DWORD ctrl, DWORD event_type, LPVOID event_data, LPVOID context)
+{
+  switch (ctrl) {
+  case SERVICE_CONTROL_STOP:
+  case SERVICE_CONTROL_SHUTDOWN:
+    TRACE("shutting down service\n");
+    UpdateStatus(SERVICE_STOP_PENDING, NO_ERROR, 0);
+    SetEvent(stop_event);
+    break;
+  default:
+    FIXME("ignoring handle service ctrl %x\n", ctrl);
+    UpdateStatus(status.dwCurrentState, NO_ERROR, 0);
+    break;
+  }
+
+  return NO_ERROR;
+}
+
+/* Main thread of the service */
+static BOOL
+StartCount(void)
+{
+  HRESULT hr;
+  DWORD dwReg;
+
+  TRACE("\n");
+
+  hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
+  if (!SUCCEEDED(hr))
+    return FALSE;
+
+  hr = CoInitializeSecurity(NULL, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_NONE,
+                            RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE,
+                            NULL);
+  if (!SUCCEEDED(hr))
+    return FALSE;
+
+  hr = CoRegisterClassObject(&CLSID_BackgroundCopyManager,
+                             (IUnknown *) &BITS_ClassFactory,
+                             CLSCTX_LOCAL_SERVER, REGCLS_MULTIPLEUSE,
+                             &dwReg);
+  if (!SUCCEEDED(hr))
+    return FALSE;
+
+  return TRUE;
+}
+
+/* Service entry point */
+VOID WINAPI
+ServiceMain(DWORD dwArgc, LPWSTR *lpszArgv)
+{
+  TRACE("\n");
+
+  stop_event = CreateEventW(NULL, TRUE, FALSE, NULL);
+  if (!stop_event) {
+    ERR("failed to create stop_event\n");
+    return;
+  }
+
+  status_handle = RegisterServiceCtrlHandlerExW(qmgr_nameW, ServiceHandler, NULL);
+  if (!status_handle) {
+    ERR("failed to register handler: %u\n", GetLastError());
+    return;
+  }
+
+  UpdateStatus(SERVICE_START_PENDING, NO_ERROR, 3000);
+  if (!StartCount()) {
+    ERR("failed starting service thread\n");
+    UpdateStatus(SERVICE_STOPPED, NO_ERROR, 0);
+    return;
+  }
+
+  UpdateStatus(SERVICE_RUNNING, NO_ERROR, 0);
+
+  WaitForSingleObject(stop_event, INFINITE);
+  UpdateStatus(SERVICE_STOPPED, NO_ERROR, 0);
+  CloseHandle(stop_event);
+  TRACE("service stoped\n");
+}
diff --git a/dlls/qmgr/rsrc.rc b/dlls/qmgr/rsrc.rc
new file mode 100644
index 0000000..dfc64d0
--- /dev/null
+++ b/dlls/qmgr/rsrc.rc
@@ -0,0 +1,20 @@
+/*
+ * 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
+ */
+
+/* @makedep: qmgr.inf */
+REGINST REGINST qmgr.inf
diff --git a/dlls/qmgr/tests/Makefile.in b/dlls/qmgr/tests/Makefile.in
new file mode 100644
index 0000000..cbb0401
--- /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 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..a4f9918
--- /dev/null
+++ b/dlls/qmgr/tests/qmgr.c
@@ -0,0 +1,55 @@
+/*
+ * 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;
+  ULONG res;
+  IBackgroundCopyManager *manager = NULL;
+
+  /* Creating BITS instance */
+  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;
+  }
+
+  /* Releasing bits manager */
+  res = IBackgroundCopyManager_Release(manager);
+  ok(res == 0, "Bad ref count on release: %u\n", res);
+
+}
+
+START_TEST(qmgr)
+{
+  CoInitialize(NULL);
+  test_CreateInstance();
+  CoUninitialize();
+}
diff --git a/tools/wine.inf b/tools/wine.inf
index c3cb89c..521ba34 100644
--- a/tools/wine.inf
+++ b/tools/wine.inf
@@ -2195,6 +2195,8 @@ HKLM,%CurrentVersion%\Telephony\Country List\998,"SameAreaRule",,"G"
 11,,msxml3.dll,1
 11,,objsel.dll,1
 11,,qcap.dll,1
+11,,qmgr.dll,1
+11,,qmgrprxy.dll,1
 11,,quartz.dll,1
 11,,rsaenh.dll,1
 11,,shdocvw.dll,1



More information about the wine-patches mailing list