3 * Copyright 2009 Austin English
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
31 #include "wbemprox_private.h"
32 #include "wine/debug.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(wbemprox);
36 typedef HRESULT (*fnCreateInstance)( IUnknown *pUnkOuter, LPVOID *ppObj );
40 const struct IClassFactoryVtbl *vtbl;
41 fnCreateInstance pfnCreateInstance;
44 static inline wbemprox_cf *impl_from_IClassFactory( IClassFactory *iface )
46 return (wbemprox_cf *)((char *)iface - FIELD_OFFSET( wbemprox_cf, vtbl ));
49 static HRESULT WINAPI wbemprox_cf_QueryInterface( IClassFactory *iface, REFIID riid, LPVOID *ppobj )
51 if (IsEqualGUID(riid, &IID_IUnknown) ||
52 IsEqualGUID(riid, &IID_IClassFactory))
54 IClassFactory_AddRef( iface );
58 FIXME("interface %s not implemented\n", debugstr_guid(riid));
62 static ULONG WINAPI wbemprox_cf_AddRef( IClassFactory *iface )
67 static ULONG WINAPI wbemprox_cf_Release( IClassFactory *iface )
72 static HRESULT WINAPI wbemprox_cf_CreateInstance( IClassFactory *iface, LPUNKNOWN pOuter,
73 REFIID riid, LPVOID *ppobj )
75 wbemprox_cf *This = impl_from_IClassFactory( iface );
79 TRACE("%p %s %p\n", pOuter, debugstr_guid(riid), ppobj);
84 return CLASS_E_NOAGGREGATION;
86 r = This->pfnCreateInstance( pOuter, (LPVOID *)&punk );
90 r = IUnknown_QueryInterface( punk, riid, ppobj );
94 IUnknown_Release( punk );
98 static HRESULT WINAPI wbemprox_cf_LockServer( IClassFactory *iface, BOOL dolock )
100 FIXME("(%p)->(%d)\n", iface, dolock);
104 static const struct IClassFactoryVtbl wbemprox_cf_vtbl =
106 wbemprox_cf_QueryInterface,
109 wbemprox_cf_CreateInstance,
110 wbemprox_cf_LockServer
113 static wbemprox_cf wbem_locator_cf = { &wbemprox_cf_vtbl, WbemLocator_create };
115 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
120 case DLL_WINE_PREATTACH:
121 return FALSE; /* prefer native version */
122 case DLL_PROCESS_ATTACH:
123 DisableThreadLibraryCalls(hinstDLL);
125 case DLL_PROCESS_DETACH:
132 HRESULT WINAPI DllGetClassObject( REFCLSID rclsid, REFIID iid, LPVOID *ppv )
134 IClassFactory *cf = NULL;
136 TRACE("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv);
138 if (IsEqualGUID( rclsid, &CLSID_WbemLocator ))
140 cf = (IClassFactory *)&wbem_locator_cf.vtbl;
142 if (!cf) return CLASS_E_CLASSNOTAVAILABLE;
143 return IClassFactory_QueryInterface( cf, iid, ppv );
146 HRESULT WINAPI DllCanUnloadNow( void )