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
24 #define NONAMELESSUNION
25 #define NONAMELESSSTRUCT
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
);
49 HRESULT
create_rowset_server(IUnknown
*outer
, void **obj
)
51 FIXME("(%p, %p): stub\n", outer
, obj
);
60 const IMarshalVtbl
*marshal_vtbl
;
63 CLSID unmarshal_class
;
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
))
84 FIXME("interface %s not implemented\n", debugstr_guid(iid
));
89 IMarshal_AddRef(iface
);
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
);
105 TRACE("(%p)\n", This
);
107 ref
= InterlockedDecrement(&This
->ref
);
110 HeapFree(GetProcessHeap(), 0, This
);
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
);
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
);
138 static HRESULT WINAPI
marshal_MarshalInterface(IMarshal
*iface
, IStream
*stream
, REFIID iid
,
139 void *obj
, DWORD dwDestContext
, void *pvDestContext
,
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
);
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
);
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
);
167 static HRESULT WINAPI
marshal_DisconnectObject(IMarshal
*iface
, DWORD dwReserved
)
169 marshal
*This
= impl_from_IMarshal(iface
);
170 FIXME("(%p)->(%08x)\n", This
, dwReserved
);
175 static const IMarshalVtbl marshal_vtbl
=
177 marshal_QueryInterface
,
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
)
192 TRACE("(%p, %p)\n", outer
, obj
);
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
;
203 *obj
= &marshal
->marshal_vtbl
;
204 TRACE("returing %p\n", *obj
);
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
);