server: Move socket async activation to sock_poll_event.
[wine] / dlls / oledb32 / main.c
1 /* OLE DB Initialization
2  *
3  * Copyright 2009 Huw Davies
4  *
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.
9  *
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.
14  *
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
18  */
19
20 #include <stdarg.h>
21
22 #define COBJMACROS
23 #define NONAMELESSUNION
24 #define NONAMELESSSTRUCT
25
26 #include "windef.h"
27 #include "winbase.h"
28 #include "ole2.h"
29
30 #include "initguid.h"
31 #include "msdaguid.h"
32
33 #include "oledb_private.h"
34
35 #include "wine/debug.h"
36
37 WINE_DEFAULT_DEBUG_CHANNEL(oledb);
38
39 BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, LPVOID lpv)
40 {
41     switch(reason)
42     {
43     case DLL_PROCESS_ATTACH:
44         DisableThreadLibraryCalls(hinst);
45         break;
46
47     case DLL_PROCESS_DETACH:
48         break;
49     }
50     return TRUE;
51 }
52
53 /******************************************************************************
54  * ClassFactory
55  */
56 typedef struct
57 {
58     const IClassFactoryVtbl *lpVtbl;
59     HRESULT (*create_object)( IUnknown*, LPVOID* );
60 } cf;
61
62 static HRESULT WINAPI CF_QueryInterface(IClassFactory *iface, REFIID riid, void **obj)
63 {
64     cf *This = (cf *)iface;
65
66     TRACE("(%p, %s, %p)\n", This, debugstr_guid(riid), obj);
67
68     if( IsEqualCLSID( riid, &IID_IUnknown ) ||
69         IsEqualCLSID( riid, &IID_IClassFactory ) )
70     {
71         IClassFactory_AddRef( iface );
72         *obj = iface;
73         return S_OK;
74     }
75     return E_NOINTERFACE;
76 }
77
78 static ULONG WINAPI CF_AddRef(IClassFactory *iface)
79 {
80     return 2;
81 }
82
83 static ULONG WINAPI CF_Release(IClassFactory *iface)
84 {
85     return 1;
86 }
87
88 static HRESULT WINAPI CF_CreateInstance(IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **obj)
89 {
90     cf *This = (cf *)iface;
91     IUnknown *unk = NULL;
92     HRESULT r;
93
94     TRACE("(%p, %p, %s, %p)\n", This, pOuter, debugstr_guid(riid), obj);
95
96     r = This->create_object( pOuter, (void **) &unk );
97     if (SUCCEEDED(r))
98     {
99         r = IUnknown_QueryInterface( unk, riid, obj );
100         IUnknown_Release( unk );
101     }
102     return r;
103 }
104
105 static HRESULT WINAPI CF_LockServer(IClassFactory *iface, BOOL dolock)
106 {
107     FIXME("(%p, %d): stub\n", iface, dolock);
108     return S_OK;
109 }
110
111 static const IClassFactoryVtbl CF_Vtbl =
112 {
113     CF_QueryInterface,
114     CF_AddRef,
115     CF_Release,
116     CF_CreateInstance,
117     CF_LockServer
118 };
119
120 static cf oledb_convert_cf = { &CF_Vtbl, create_oledb_convert };
121
122 /******************************************************************
123  * DllGetClassObject
124  */
125 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **obj)
126 {
127     TRACE("(%s, %s, %p)\n", debugstr_guid(rclsid), debugstr_guid(riid), obj);
128
129     if ( IsEqualCLSID (rclsid, &CLSID_OLEDB_CONVERSIONLIBRARY) )
130     {
131         *obj = &oledb_convert_cf;
132         return S_OK;
133     }
134
135     return CLASS_E_CLASSNOTAVAILABLE;
136 }
137
138 /******************************************************************
139  *              DllCanUnloadNow
140  */
141 HRESULT WINAPI DllCanUnloadNow(void)
142 {
143     return S_FALSE;
144 }