configure: Changes from running autconf after previous patch.
[wine/hacks.git] / dlls / wbemprox / main.c
blob3dd21220992f3710ab36b2235370a9f46603e4cb
1 /*
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
20 #include "config.h"
22 #include <stdarg.h>
24 #define COBJMACROS
26 #include "windef.h"
27 #include "winbase.h"
28 #include "objbase.h"
29 #include "wbemcli.h"
31 #include "wbemprox_private.h"
32 #include "wine/debug.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(wbemprox);
36 typedef HRESULT (*fnCreateInstance)( IUnknown *pUnkOuter, LPVOID *ppObj );
38 typedef struct
40 const struct IClassFactoryVtbl *vtbl;
41 fnCreateInstance pfnCreateInstance;
42 } wbemprox_cf;
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 );
55 *ppobj = iface;
56 return S_OK;
58 FIXME("interface %s not implemented\n", debugstr_guid(riid));
59 return E_NOINTERFACE;
62 static ULONG WINAPI wbemprox_cf_AddRef( IClassFactory *iface )
64 return 2;
67 static ULONG WINAPI wbemprox_cf_Release( IClassFactory *iface )
69 return 1;
72 static HRESULT WINAPI wbemprox_cf_CreateInstance( IClassFactory *iface, LPUNKNOWN pOuter,
73 REFIID riid, LPVOID *ppobj )
75 wbemprox_cf *This = impl_from_IClassFactory( iface );
76 HRESULT r;
77 IUnknown *punk;
79 TRACE("%p %s %p\n", pOuter, debugstr_guid(riid), ppobj);
81 *ppobj = NULL;
83 if (pOuter)
84 return CLASS_E_NOAGGREGATION;
86 r = This->pfnCreateInstance( pOuter, (LPVOID *)&punk );
87 if (FAILED(r))
88 return r;
90 r = IUnknown_QueryInterface( punk, riid, ppobj );
91 if (FAILED(r))
92 return r;
94 IUnknown_Release( punk );
95 return r;
98 static HRESULT WINAPI wbemprox_cf_LockServer( IClassFactory *iface, BOOL dolock )
100 FIXME("(%p)->(%d)\n", iface, dolock);
101 return S_OK;
104 static const struct IClassFactoryVtbl wbemprox_cf_vtbl =
106 wbemprox_cf_QueryInterface,
107 wbemprox_cf_AddRef,
108 wbemprox_cf_Release,
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)
118 switch (fdwReason)
120 case DLL_WINE_PREATTACH:
121 return FALSE; /* prefer native version */
122 case DLL_PROCESS_ATTACH:
123 DisableThreadLibraryCalls(hinstDLL);
124 break;
125 case DLL_PROCESS_DETACH:
126 break;
129 return TRUE;
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 )
148 return S_FALSE;