d3d9/tests: Add r500 fp_special results.
[wine] / dlls / msdaps / main.c
1 /*
2  * msdaps initialisation.
3  *
4  * Copyright 2010 Huw Davies
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20 #include <stdarg.h>
21 #include <string.h>
22
23 #define COBJMACROS
24 #define NONAMELESSUNION
25 #define NONAMELESSSTRUCT
26
27 #include "windef.h"
28 #include "winbase.h"
29 #include "wingdi.h"
30 #include "winuser.h"
31 #include "winerror.h"
32 #include "initguid.h"
33 #include "objbase.h"
34 #include "oleauto.h"
35 #define DBINITCONSTANTS
36 #include "oledb.h"
37
38 #include "row_server.h"
39
40 #include "wine/debug.h"
41
42 WINE_DEFAULT_DEBUG_CHANNEL(oledb);
43
44 extern BOOL WINAPI msdaps_DllMain(HINSTANCE, DWORD, LPVOID) DECLSPEC_HIDDEN;
45 extern HRESULT WINAPI msdaps_DllGetClassObject(REFCLSID, REFIID, LPVOID *) DECLSPEC_HIDDEN;
46 extern HRESULT WINAPI msdaps_DllCanUnloadNow(void) DECLSPEC_HIDDEN;
47 extern HRESULT WINAPI msdaps_DllRegisterServer(void) DECLSPEC_HIDDEN;
48 extern HRESULT WINAPI msdaps_DllUnregisterServer(void) DECLSPEC_HIDDEN;
49
50 /*****************************************************************************
51  *              DllMain
52  */
53 BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
54 {
55     return msdaps_DllMain(instance, reason, reserved);
56 }
57
58
59 /******************************************************************************
60  * ClassFactory
61  */
62 typedef struct
63 {
64     IClassFactory IClassFactory_iface;
65     HRESULT (*create_object)( IUnknown*, LPVOID* );
66 } cf;
67
68 static inline cf *impl_from_IClassFactory(IClassFactory *iface)
69 {
70     return CONTAINING_RECORD(iface, cf, IClassFactory_iface);
71 }
72
73 static HRESULT WINAPI CF_QueryInterface(IClassFactory *iface, REFIID riid, void **obj)
74 {
75     cf *This = impl_from_IClassFactory(iface);
76
77     TRACE("(%p, %s, %p)\n", This, debugstr_guid(riid), obj);
78
79     if( IsEqualCLSID( riid, &IID_IUnknown ) ||
80         IsEqualCLSID( riid, &IID_IClassFactory ) )
81     {
82         IClassFactory_AddRef( iface );
83         *obj = iface;
84         return S_OK;
85     }
86     return E_NOINTERFACE;
87 }
88
89 static ULONG WINAPI CF_AddRef(IClassFactory *iface)
90 {
91     return 2;
92 }
93
94 static ULONG WINAPI CF_Release(IClassFactory *iface)
95 {
96     return 1;
97 }
98
99 static HRESULT WINAPI CF_CreateInstance(IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **obj)
100 {
101     cf *This = impl_from_IClassFactory(iface);
102     IUnknown *unk = NULL;
103     HRESULT r;
104
105     TRACE("(%p, %p, %s, %p)\n", This, pOuter, debugstr_guid(riid), obj);
106
107     r = This->create_object( pOuter, (void **) &unk );
108     if (SUCCEEDED(r))
109     {
110         r = IUnknown_QueryInterface( unk, riid, obj );
111         IUnknown_Release( unk );
112     }
113     return r;
114 }
115
116 static HRESULT WINAPI CF_LockServer(IClassFactory *iface, BOOL dolock)
117 {
118     FIXME("(%p, %d): stub\n", iface, dolock);
119     return S_OK;
120 }
121
122 static const IClassFactoryVtbl CF_Vtbl =
123 {
124     CF_QueryInterface,
125     CF_AddRef,
126     CF_Release,
127     CF_CreateInstance,
128     CF_LockServer
129 };
130
131 static cf row_server_cf = { { &CF_Vtbl }, create_row_server };
132 static cf row_proxy_cf  = { { &CF_Vtbl }, create_row_marshal };
133 static cf rowset_server_cf = { { &CF_Vtbl }, create_rowset_server };
134 static cf rowset_proxy_cf  = { { &CF_Vtbl }, create_rowset_marshal };
135
136 /***********************************************************************
137  *              DllGetClassObject
138  */
139 HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, LPVOID *obj)
140 {
141     TRACE("(%s, %s, %p)\n", debugstr_guid(clsid), debugstr_guid(iid), obj);
142
143     if (IsEqualCLSID(clsid, &CLSID_wine_row_server))
144     {
145         *obj = &row_server_cf;
146         return S_OK;
147     }
148
149     if (IsEqualCLSID(clsid, &CLSID_wine_row_proxy))
150     {
151         *obj = &row_proxy_cf;
152         return S_OK;
153     }
154
155     if (IsEqualCLSID(clsid, &CLSID_wine_rowset_server))
156     {
157         *obj = &rowset_server_cf;
158         return S_OK;
159     }
160
161     if (IsEqualCLSID(clsid, &CLSID_wine_rowset_proxy))
162     {
163         *obj = &rowset_proxy_cf;
164         return S_OK;
165     }
166
167     return msdaps_DllGetClassObject(clsid, iid, obj);
168 }
169
170 /***********************************************************************
171  *              DllCanUnloadNow
172  */
173 HRESULT WINAPI DllCanUnloadNow(void)
174 {
175     return msdaps_DllCanUnloadNow();
176 }
177
178 /***********************************************************************
179  *                DllRegisterServer
180  */
181 HRESULT WINAPI DllRegisterServer(void)
182 {
183     return msdaps_DllRegisterServer();
184 }
185
186 /***********************************************************************
187  *                DllUnregisterServer
188  */
189 HRESULT WINAPI DllUnregisterServer(void)
190 {
191     return msdaps_DllUnregisterServer();
192 }