msdaps: Add a stub marshaller object.
[wine/hramrach.git] / dlls / msdaps / row_server.c
blob14f11d2e7d5658d463f24a9bb8d6cae849c75628
1 /*
2 * Row and rowset servers / proxies.
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 #include "oledb.h"
36 #include "row_server.h"
38 #include "wine/debug.h"
40 WINE_DEFAULT_DEBUG_CHANNEL(oledb);
42 HRESULT create_row_server(IUnknown *outer, void **obj)
44 FIXME("(%p, %p): stub\n", outer, obj);
45 *obj = NULL;
46 return E_NOTIMPL;
49 HRESULT create_rowset_server(IUnknown *outer, void **obj)
51 FIXME("(%p, %p): stub\n", outer, obj);
52 *obj = NULL;
53 return E_NOTIMPL;
56 /* Marshal impl */
58 typedef struct
60 const IMarshalVtbl *marshal_vtbl;
62 LONG ref;
63 CLSID unmarshal_class;
64 IUnknown *outer;
65 } marshal;
67 static inline marshal *impl_from_IMarshal(IMarshal *iface)
69 return (marshal *)((char*)iface - FIELD_OFFSET(marshal, marshal_vtbl));
72 static HRESULT WINAPI marshal_QueryInterface(IMarshal *iface, REFIID iid, void **obj)
74 marshal *This = impl_from_IMarshal(iface);
75 TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(iid), obj);
77 if(IsEqualIID(iid, &IID_IUnknown) ||
78 IsEqualIID(iid, &IID_IMarshal))
80 *obj = iface;
82 else
84 FIXME("interface %s not implemented\n", debugstr_guid(iid));
85 *obj = NULL;
86 return E_NOINTERFACE;
89 IMarshal_AddRef(iface);
90 return S_OK;
93 static ULONG WINAPI marshal_AddRef(IMarshal *iface)
95 marshal *This = impl_from_IMarshal(iface);
96 TRACE("(%p)\n", This);
97 return InterlockedIncrement(&This->ref);
100 static ULONG WINAPI marshal_Release(IMarshal *iface)
102 marshal *This = impl_from_IMarshal(iface);
103 LONG ref;
105 TRACE("(%p)\n", This);
107 ref = InterlockedDecrement(&This->ref);
108 if(ref == 0)
110 HeapFree(GetProcessHeap(), 0, This);
113 return ref;
116 static HRESULT WINAPI marshal_GetUnmarshalClass(IMarshal *iface, REFIID iid, void *obj,
117 DWORD dwDestContext, void *pvDestContext,
118 DWORD mshlflags, CLSID *clsid)
120 marshal *This = impl_from_IMarshal(iface);
121 FIXME("(%p)->(%s, %p, %08x, %p, %08x, %p): stub\n", This, debugstr_guid(iid), obj, dwDestContext,
122 pvDestContext, mshlflags, clsid);
124 return E_NOTIMPL;
127 static HRESULT WINAPI marshal_GetMarshalSizeMax(IMarshal *iface, REFIID iid, void *obj,
128 DWORD dwDestContext, void *pvDestContext,
129 DWORD mshlflags, DWORD *size)
131 marshal *This = impl_from_IMarshal(iface);
132 FIXME("(%p)->(%s, %p, %08x, %p, %08x, %p): stub\n", This, debugstr_guid(iid), obj, dwDestContext,
133 pvDestContext, mshlflags, size);
135 return E_NOTIMPL;
138 static HRESULT WINAPI marshal_MarshalInterface(IMarshal *iface, IStream *stream, REFIID iid,
139 void *obj, DWORD dwDestContext, void *pvDestContext,
140 DWORD mshlflags)
142 marshal *This = impl_from_IMarshal(iface);
143 FIXME("(%p)->(%p, %s, %p, %08x, %p, %08x): stub\n", This, stream, debugstr_guid(iid), obj, dwDestContext,
144 pvDestContext, mshlflags);
146 return E_NOTIMPL;
149 static HRESULT WINAPI marshal_UnmarshalInterface(IMarshal *iface, IStream *stream,
150 REFIID iid, void **obj)
152 marshal *This = impl_from_IMarshal(iface);
153 FIXME("(%p)->(%p, %s, %p): stub\n", This, stream, debugstr_guid(iid), obj);
154 *obj = NULL;
156 return E_NOTIMPL;
159 static HRESULT WINAPI marshal_ReleaseMarshalData(IMarshal *iface, IStream *stream)
161 marshal *This = impl_from_IMarshal(iface);
162 FIXME("(%p)->(%p): stub\n", This, stream);
164 return E_NOTIMPL;
167 static HRESULT WINAPI marshal_DisconnectObject(IMarshal *iface, DWORD dwReserved)
169 marshal *This = impl_from_IMarshal(iface);
170 FIXME("(%p)->(%08x)\n", This, dwReserved);
172 return E_NOTIMPL;
175 static const IMarshalVtbl marshal_vtbl =
177 marshal_QueryInterface,
178 marshal_AddRef,
179 marshal_Release,
180 marshal_GetUnmarshalClass,
181 marshal_GetMarshalSizeMax,
182 marshal_MarshalInterface,
183 marshal_UnmarshalInterface,
184 marshal_ReleaseMarshalData,
185 marshal_DisconnectObject
188 static HRESULT create_marshal(IUnknown *outer, const CLSID *class, void **obj)
190 marshal *marshal;
192 TRACE("(%p, %p)\n", outer, obj);
193 *obj = NULL;
195 marshal = HeapAlloc(GetProcessHeap(), 0, sizeof(*marshal));
196 if(!marshal) return E_OUTOFMEMORY;
198 marshal->unmarshal_class = *class;
199 marshal->outer = outer; /* don't ref outer unk */
200 marshal->marshal_vtbl = &marshal_vtbl;
201 marshal->ref = 1;
203 *obj = &marshal->marshal_vtbl;
204 TRACE("returing %p\n", *obj);
205 return S_OK;
208 HRESULT create_row_marshal(IUnknown *outer, void **obj)
210 TRACE("(%p, %p)\n", outer, obj);
211 return create_marshal(outer, &CLSID_wine_row_proxy, obj);
214 HRESULT create_rowset_marshal(IUnknown *outer, void **obj)
216 TRACE("(%p, %p)\n", outer, obj);
217 return create_marshal(outer, &CLSID_wine_rowset_proxy, obj);