ntdll: Add stub for RtlSetHeapInformation.
[wine.git] / dlls / msdaps / main.c
blob14c6c0127cead0f45f9bbf7e210a75c8413f5cc7
1 /*
2 * msdaps initialisation.
4 * Copyright 2010 Huw Davies
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.
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.
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
20 #include <stdarg.h>
21 #include <string.h>
23 #define COBJMACROS
24 #define NONAMELESSUNION
25 #define NONAMELESSSTRUCT
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"
38 #include "row_server.h"
40 #include "wine/debug.h"
42 WINE_DEFAULT_DEBUG_CHANNEL(oledb);
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;
50 /*****************************************************************************
51 * DllMain
53 BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
55 return msdaps_DllMain(instance, reason, reserved);
59 /******************************************************************************
60 * ClassFactory
62 typedef struct
64 IClassFactory IClassFactory_iface;
65 HRESULT (*create_object)( IUnknown*, LPVOID* );
66 } cf;
68 static inline cf *impl_from_IClassFactory(IClassFactory *iface)
70 return CONTAINING_RECORD(iface, cf, IClassFactory_iface);
73 static HRESULT WINAPI CF_QueryInterface(IClassFactory *iface, REFIID riid, void **obj)
75 cf *This = impl_from_IClassFactory(iface);
77 TRACE("(%p, %s, %p)\n", This, debugstr_guid(riid), obj);
79 if( IsEqualCLSID( riid, &IID_IUnknown ) ||
80 IsEqualCLSID( riid, &IID_IClassFactory ) )
82 IClassFactory_AddRef( iface );
83 *obj = iface;
84 return S_OK;
86 return E_NOINTERFACE;
89 static ULONG WINAPI CF_AddRef(IClassFactory *iface)
91 return 2;
94 static ULONG WINAPI CF_Release(IClassFactory *iface)
96 return 1;
99 static HRESULT WINAPI CF_CreateInstance(IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **obj)
101 cf *This = impl_from_IClassFactory(iface);
102 IUnknown *unk = NULL;
103 HRESULT r;
105 TRACE("(%p, %p, %s, %p)\n", This, pOuter, debugstr_guid(riid), obj);
107 r = This->create_object( pOuter, (void **) &unk );
108 if (SUCCEEDED(r))
110 r = IUnknown_QueryInterface( unk, riid, obj );
111 IUnknown_Release( unk );
113 return r;
116 static HRESULT WINAPI CF_LockServer(IClassFactory *iface, BOOL dolock)
118 FIXME("(%p, %d): stub\n", iface, dolock);
119 return S_OK;
122 static const IClassFactoryVtbl CF_Vtbl =
124 CF_QueryInterface,
125 CF_AddRef,
126 CF_Release,
127 CF_CreateInstance,
128 CF_LockServer
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 };
136 /***********************************************************************
137 * DllGetClassObject
139 HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, LPVOID *obj)
141 TRACE("(%s, %s, %p)\n", debugstr_guid(clsid), debugstr_guid(iid), obj);
143 if (IsEqualCLSID(clsid, &CLSID_wine_row_server))
145 *obj = &row_server_cf;
146 return S_OK;
149 if (IsEqualCLSID(clsid, &CLSID_wine_row_proxy))
151 *obj = &row_proxy_cf;
152 return S_OK;
155 if (IsEqualCLSID(clsid, &CLSID_wine_rowset_server))
157 *obj = &rowset_server_cf;
158 return S_OK;
161 if (IsEqualCLSID(clsid, &CLSID_wine_rowset_proxy))
163 *obj = &rowset_proxy_cf;
164 return S_OK;
167 return msdaps_DllGetClassObject(clsid, iid, obj);
170 /***********************************************************************
171 * DllCanUnloadNow
173 HRESULT WINAPI DllCanUnloadNow(void)
175 return msdaps_DllCanUnloadNow();
178 /***********************************************************************
179 * DllRegisterServer
181 HRESULT WINAPI DllRegisterServer(void)
183 return msdaps_DllRegisterServer();
186 /***********************************************************************
187 * DllUnregisterServer
189 HRESULT WINAPI DllUnregisterServer(void)
191 return msdaps_DllUnregisterServer();