1 /* OLE DB Initialization
3 * Copyright 2009 Huw Davies
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
23 #define NONAMELESSUNION
24 #define NONAMELESSSTRUCT
34 #include "oledb_private.h"
36 #include "wine/debug.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(oledb);
40 static HINSTANCE instance;
42 BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, LPVOID lpv)
46 case DLL_PROCESS_ATTACH:
48 DisableThreadLibraryCalls(hinst);
51 case DLL_PROCESS_DETACH:
57 /******************************************************************************
62 const IClassFactoryVtbl *lpVtbl;
63 HRESULT (*create_object)( IUnknown*, LPVOID* );
66 static HRESULT WINAPI CF_QueryInterface(IClassFactory *iface, REFIID riid, void **obj)
68 cf *This = (cf *)iface;
70 TRACE("(%p, %s, %p)\n", This, debugstr_guid(riid), obj);
72 if( IsEqualCLSID( riid, &IID_IUnknown ) ||
73 IsEqualCLSID( riid, &IID_IClassFactory ) )
75 IClassFactory_AddRef( iface );
82 static ULONG WINAPI CF_AddRef(IClassFactory *iface)
87 static ULONG WINAPI CF_Release(IClassFactory *iface)
92 static HRESULT WINAPI CF_CreateInstance(IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **obj)
94 cf *This = (cf *)iface;
98 TRACE("(%p, %p, %s, %p)\n", This, pOuter, debugstr_guid(riid), obj);
100 r = This->create_object( pOuter, (void **) &unk );
103 r = IUnknown_QueryInterface( unk, riid, obj );
104 IUnknown_Release( unk );
109 static HRESULT WINAPI CF_LockServer(IClassFactory *iface, BOOL dolock)
111 FIXME("(%p, %d): stub\n", iface, dolock);
115 static const IClassFactoryVtbl CF_Vtbl =
124 static cf oledb_convert_cf = { &CF_Vtbl, create_oledb_convert };
126 /******************************************************************
129 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **obj)
131 TRACE("(%s, %s, %p)\n", debugstr_guid(rclsid), debugstr_guid(riid), obj);
133 if ( IsEqualCLSID (rclsid, &CLSID_OLEDB_CONVERSIONLIBRARY) )
135 *obj = &oledb_convert_cf;
139 return CLASS_E_CLASSNOTAVAILABLE;
142 /******************************************************************
145 HRESULT WINAPI DllCanUnloadNow(void)
150 /***********************************************************************
153 HRESULT WINAPI DllRegisterServer(void)
155 return __wine_register_resources( instance, NULL );
158 /***********************************************************************
159 * DllUnregisterServer
161 HRESULT WINAPI DllUnregisterServer(void)
163 return __wine_unregister_resources( instance, NULL );