wininet: Support the Cache-Control max-age directive for setting url cache entry...
[wine/testsucceed.git] / dlls / msdaps / main.c
blobb673b5860e96f0cf5e19f2779f427c6f1ca3acc3
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 "objbase.h"
33 #include "oleauto.h"
34 #define DBINITCONSTANTS
35 #include "oledb.h"
37 #include "row_server.h"
39 #include "wine/debug.h"
41 WINE_DEFAULT_DEBUG_CHANNEL(oledb);
43 extern BOOL WINAPI msdaps_DllMain(HINSTANCE, DWORD, LPVOID) DECLSPEC_HIDDEN;
44 extern HRESULT WINAPI msdaps_DllGetClassObject(REFCLSID, REFIID, LPVOID *) DECLSPEC_HIDDEN;
45 extern HRESULT WINAPI msdaps_DllCanUnloadNow(void) DECLSPEC_HIDDEN;
46 extern HRESULT WINAPI msdaps_DllRegisterServer(void) DECLSPEC_HIDDEN;
47 extern HRESULT WINAPI msdaps_DllUnregisterServer(void) DECLSPEC_HIDDEN;
49 /*****************************************************************************
50 * DllMain
52 BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
54 return msdaps_DllMain(instance, reason, reserved);
58 /******************************************************************************
59 * ClassFactory
61 typedef struct
63 IClassFactory IClassFactory_iface;
64 HRESULT (*create_object)( IUnknown*, LPVOID* );
65 } cf;
67 static inline cf *impl_from_IClassFactory(IClassFactory *iface)
69 return CONTAINING_RECORD(iface, cf, IClassFactory_iface);
72 static HRESULT WINAPI CF_QueryInterface(IClassFactory *iface, REFIID riid, void **obj)
74 cf *This = impl_from_IClassFactory(iface);
76 TRACE("(%p, %s, %p)\n", This, debugstr_guid(riid), obj);
78 if( IsEqualCLSID( riid, &IID_IUnknown ) ||
79 IsEqualCLSID( riid, &IID_IClassFactory ) )
81 IClassFactory_AddRef( iface );
82 *obj = iface;
83 return S_OK;
85 return E_NOINTERFACE;
88 static ULONG WINAPI CF_AddRef(IClassFactory *iface)
90 return 2;
93 static ULONG WINAPI CF_Release(IClassFactory *iface)
95 return 1;
98 static HRESULT WINAPI CF_CreateInstance(IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **obj)
100 cf *This = impl_from_IClassFactory(iface);
101 IUnknown *unk = NULL;
102 HRESULT r;
104 TRACE("(%p, %p, %s, %p)\n", This, pOuter, debugstr_guid(riid), obj);
106 r = This->create_object( pOuter, (void **) &unk );
107 if (SUCCEEDED(r))
109 r = IUnknown_QueryInterface( unk, riid, obj );
110 IUnknown_Release( unk );
112 return r;
115 static HRESULT WINAPI CF_LockServer(IClassFactory *iface, BOOL dolock)
117 FIXME("(%p, %d): stub\n", iface, dolock);
118 return S_OK;
121 static const IClassFactoryVtbl CF_Vtbl =
123 CF_QueryInterface,
124 CF_AddRef,
125 CF_Release,
126 CF_CreateInstance,
127 CF_LockServer
130 static cf row_server_cf = { { &CF_Vtbl }, create_row_server };
131 static cf row_proxy_cf = { { &CF_Vtbl }, create_row_marshal };
132 static cf rowset_server_cf = { { &CF_Vtbl }, create_rowset_server };
133 static cf rowset_proxy_cf = { { &CF_Vtbl }, create_rowset_marshal };
135 /***********************************************************************
136 * DllGetClassObject
138 HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, LPVOID *obj)
140 TRACE("(%s, %s, %p)\n", debugstr_guid(clsid), debugstr_guid(iid), obj);
142 if (IsEqualCLSID(clsid, &CLSID_wine_row_server))
144 *obj = &row_server_cf;
145 return S_OK;
148 if (IsEqualCLSID(clsid, &CLSID_wine_row_proxy))
150 *obj = &row_proxy_cf;
151 return S_OK;
154 if (IsEqualCLSID(clsid, &CLSID_wine_rowset_server))
156 *obj = &rowset_server_cf;
157 return S_OK;
160 if (IsEqualCLSID(clsid, &CLSID_wine_rowset_proxy))
162 *obj = &rowset_proxy_cf;
163 return S_OK;
166 return msdaps_DllGetClassObject(clsid, iid, obj);
169 /***********************************************************************
170 * DllCanUnloadNow
172 HRESULT WINAPI DllCanUnloadNow(void)
174 return msdaps_DllCanUnloadNow();
177 /***********************************************************************
178 * DllRegisterServer
180 HRESULT WINAPI DllRegisterServer(void)
182 return msdaps_DllRegisterServer();
185 /***********************************************************************
186 * DllUnregisterServer
188 HRESULT WINAPI DllUnregisterServer(void)
190 return msdaps_DllUnregisterServer();