qmgr: COM cleanup for the IClassFactory iface.

This commit is contained in:
Michael Stefaniuc 2011-07-20 15:43:49 +02:00 committed by Alexandre Julliard
parent 2507d6e581
commit 3de56aa9a7
3 changed files with 13 additions and 17 deletions

View File

@ -26,20 +26,17 @@
WINE_DEFAULT_DEBUG_CHANNEL(qmgr); WINE_DEFAULT_DEBUG_CHANNEL(qmgr);
static ULONG WINAPI static ULONG WINAPI
BITS_IClassFactory_AddRef(LPCLASSFACTORY iface) BITS_IClassFactory_AddRef(IClassFactory *iface)
{ {
return 2; return 2; /* non-heap based object */
} }
static HRESULT WINAPI static HRESULT WINAPI
BITS_IClassFactory_QueryInterface(LPCLASSFACTORY iface, REFIID riid, BITS_IClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppvObj)
LPVOID *ppvObj)
{ {
ClassFactoryImpl *This = (ClassFactoryImpl *) iface;
if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IClassFactory)) if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IClassFactory))
{ {
*ppvObj = &This->lpVtbl; *ppvObj = &BITS_ClassFactory.IClassFactory_iface;
return S_OK; return S_OK;
} }
@ -48,14 +45,14 @@ BITS_IClassFactory_QueryInterface(LPCLASSFACTORY iface, REFIID riid,
} }
static ULONG WINAPI static ULONG WINAPI
BITS_IClassFactory_Release(LPCLASSFACTORY iface) BITS_IClassFactory_Release(IClassFactory *iface)
{ {
return 1; return 1; /* non-heap based object */
} }
static HRESULT WINAPI static HRESULT WINAPI
BITS_IClassFactory_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pUnkOuter, BITS_IClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid,
REFIID riid, LPVOID *ppvObj) void **ppvObj)
{ {
HRESULT res; HRESULT res;
IUnknown *punk = NULL; IUnknown *punk = NULL;
@ -75,7 +72,7 @@ BITS_IClassFactory_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pUnkOuter,
} }
static HRESULT WINAPI static HRESULT WINAPI
BITS_IClassFactory_LockServer(LPCLASSFACTORY iface, BOOL fLock) BITS_IClassFactory_LockServer(IClassFactory *iface, BOOL fLock)
{ {
FIXME("Not implemented\n"); FIXME("Not implemented\n");
return E_NOTIMPL; return E_NOTIMPL;
@ -92,5 +89,5 @@ static const IClassFactoryVtbl BITS_IClassFactory_Vtbl =
ClassFactoryImpl BITS_ClassFactory = ClassFactoryImpl BITS_ClassFactory =
{ {
&BITS_IClassFactory_Vtbl { &BITS_IClassFactory_Vtbl }
}; };

View File

@ -90,7 +90,7 @@ typedef struct
typedef struct typedef struct
{ {
const IClassFactoryVtbl *lpVtbl; IClassFactory IClassFactory_iface;
} ClassFactoryImpl; } ClassFactoryImpl;
extern HANDLE stop_event DECLSPEC_HIDDEN; extern HANDLE stop_event DECLSPEC_HIDDEN;

View File

@ -95,9 +95,8 @@ StartCount(void)
return FALSE; return FALSE;
hr = CoRegisterClassObject(&CLSID_BackgroundCopyManager, hr = CoRegisterClassObject(&CLSID_BackgroundCopyManager,
(IUnknown *) &BITS_ClassFactory, (IUnknown *) &BITS_ClassFactory.IClassFactory_iface,
CLSCTX_LOCAL_SERVER, REGCLS_MULTIPLEUSE, CLSCTX_LOCAL_SERVER, REGCLS_MULTIPLEUSE, &dwReg);
&dwReg);
if (FAILED(hr)) if (FAILED(hr))
return FALSE; return FALSE;