msdaps: Implement IDBProperties_SetProperties proxy and stub.
[wine] / dlls / msdaps / usrmarshal.c
1 /*
2  *    Misc marshaling routinues
3  *
4  * Copyright 2009 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 "objbase.h"
33 #include "oleauto.h"
34 #include "oledb.h"
35
36 #include "wine/debug.h"
37
38 WINE_DEFAULT_DEBUG_CHANNEL(oledb);
39
40 HRESULT CALLBACK IDBCreateCommand_CreateCommand_Proxy(IDBCreateCommand* This, IUnknown *pUnkOuter,
41                                                       REFIID riid, IUnknown **ppCommand)
42 {
43     FIXME("(%p, %p, %s, %p): stub\n", This, pUnkOuter, debugstr_guid(riid),
44           ppCommand);
45     return E_NOTIMPL;
46 }
47
48 HRESULT __RPC_STUB IDBCreateCommand_CreateCommand_Stub(IDBCreateCommand* This, IUnknown *pUnkOuter,
49                                                        REFIID riid, IUnknown **ppCommand, IErrorInfo **ppErrorInfoRem)
50 {
51     FIXME("(%p, %p, %s, %p, %p): stub\n", This, pUnkOuter, debugstr_guid(riid),
52           ppCommand, ppErrorInfoRem);
53     return E_NOTIMPL;
54
55 }
56
57 HRESULT CALLBACK IDBCreateSession_CreateSession_Proxy(IDBCreateSession* This, IUnknown *pUnkOuter,
58                                                       REFIID riid, IUnknown **ppDBSession)
59 {
60     FIXME("(%p, %p, %s, %p): stub\n", This, pUnkOuter, debugstr_guid(riid),
61           ppDBSession);
62     return E_NOTIMPL;
63 }
64
65 HRESULT __RPC_STUB IDBCreateSession_CreateSession_Stub(IDBCreateSession* This, IUnknown *pUnkOuter,
66                                                        REFIID riid, IUnknown **ppDBSession, IErrorInfo **ppErrorInfoRem)
67 {
68     FIXME("(%p, %p, %s, %p, %p): stub\n", This, pUnkOuter, debugstr_guid(riid),
69           ppDBSession, ppErrorInfoRem);
70     return E_NOTIMPL;
71
72 }
73
74 HRESULT CALLBACK IDBProperties_GetProperties_Proxy(IDBProperties* This, ULONG cPropertyIDSets, const DBPROPIDSET rgPropertyIDSets[],
75                                                    ULONG *pcPropertySets, DBPROPSET **prgPropertySets)
76 {
77     FIXME("(%p, %d, %p, %p, %p): stub\n", This, cPropertyIDSets, rgPropertyIDSets, pcPropertySets,
78           prgPropertySets);
79     return E_NOTIMPL;
80 }
81
82 HRESULT __RPC_STUB IDBProperties_GetProperties_Stub(IDBProperties* This, ULONG cPropertyIDSets, const DBPROPIDSET *rgPropertyIDSets,
83                                                     ULONG *pcPropertySets, DBPROPSET **prgPropertySets, IErrorInfo **ppErrorInfoRem)
84 {
85     FIXME("(%p, %d, %p, %p, %p, %p): stub\n", This, cPropertyIDSets, rgPropertyIDSets, pcPropertySets,
86           prgPropertySets, ppErrorInfoRem);
87     return E_NOTIMPL;
88 }
89
90 HRESULT CALLBACK IDBProperties_GetPropertyInfo_Proxy(IDBProperties* This, ULONG cPropertyIDSets, const DBPROPIDSET rgPropertyIDSets[],
91                                                      ULONG *pcPropertyInfoSets, DBPROPINFOSET **prgPropertyInfoSets,
92                                                      OLECHAR **ppDescBuffer)
93 {
94     FIXME("(%p, %d, %p, %p, %p, %p): stub\n", This, cPropertyIDSets, rgPropertyIDSets, pcPropertyInfoSets,
95           prgPropertyInfoSets, ppDescBuffer);
96     return E_NOTIMPL;
97 }
98
99 HRESULT __RPC_STUB IDBProperties_GetPropertyInfo_Stub(IDBProperties* This, ULONG cPropertyIDSets, const DBPROPIDSET *rgPropertyIDSets,
100                                                       ULONG *pcPropertyInfoSets, DBPROPINFOSET **prgPropertyInfoSets,
101                                                       ULONG *pcOffsets, DBBYTEOFFSET **prgDescOffsets, ULONG *pcbDescBuffer,
102                                                       OLECHAR **ppDescBuffer, IErrorInfo **ppErrorInfoRem)
103 {
104     FIXME("(%p, %d, %p, %p, %p, %p, %p, %p, %p, %p): stub\n", This, cPropertyIDSets, rgPropertyIDSets, pcPropertyInfoSets,
105           prgPropertyInfoSets, pcOffsets, prgDescOffsets, pcbDescBuffer, ppDescBuffer, ppErrorInfoRem);
106     return E_NOTIMPL;
107 }
108
109 HRESULT CALLBACK IDBProperties_SetProperties_Proxy(IDBProperties* This, ULONG cPropertySets, DBPROPSET rgPropertySets[])
110 {
111     ULONG prop_set, prop, total_props = 0;
112     HRESULT hr;
113     IErrorInfo *error;
114     DBPROPSTATUS *status;
115
116     TRACE("(%p, %d, %p)\n", This, cPropertySets, rgPropertySets);
117
118     for(prop_set = 0; prop_set < cPropertySets; prop_set++)
119         total_props += rgPropertySets[prop_set].cProperties;
120
121     if(total_props == 0) return S_OK;
122
123     status = CoTaskMemAlloc(total_props * sizeof(*status));
124     if(!status) return E_OUTOFMEMORY;
125
126     hr = IDBProperties_RemoteSetProperties_Proxy(This, cPropertySets, rgPropertySets,
127                                                  total_props, status, &error);
128     if(error)
129     {
130         SetErrorInfo(0, error);
131         IErrorInfo_Release(error);
132     }
133
134     total_props = 0;
135     for(prop_set = 0; prop_set < cPropertySets; prop_set++)
136         for(prop = 0; prop < rgPropertySets[prop_set].cProperties; prop++)
137             rgPropertySets[prop_set].rgProperties[prop].dwStatus = status[total_props++];
138
139     CoTaskMemFree(status);
140     return hr;
141 }
142
143 HRESULT __RPC_STUB IDBProperties_SetProperties_Stub(IDBProperties* This, ULONG cPropertySets, DBPROPSET *rgPropertySets,
144                                                     ULONG cTotalProps, DBPROPSTATUS *rgPropStatus, IErrorInfo **ppErrorInfoRem)
145 {
146     ULONG prop_set, prop, total_props = 0;
147     HRESULT hr;
148
149     TRACE("(%p, %d, %p, %d, %p, %p)\n", This, cPropertySets, rgPropertySets, cTotalProps,
150           rgPropStatus, ppErrorInfoRem);
151
152     *ppErrorInfoRem = NULL;
153     hr = IDBProperties_SetProperties(This, cPropertySets, rgPropertySets);
154     if(FAILED(hr)) GetErrorInfo(0, ppErrorInfoRem);
155
156     for(prop_set = 0; prop_set < cPropertySets; prop_set++)
157         for(prop = 0; prop < rgPropertySets[prop_set].cProperties; prop++)
158             rgPropStatus[total_props++] = rgPropertySets[prop_set].rgProperties[prop].dwStatus;
159
160     return hr;
161 }
162
163 HRESULT CALLBACK IDBInitialize_Initialize_Proxy(IDBInitialize* This)
164 {
165     HRESULT hr;
166     IErrorInfo *error;
167
168     TRACE("(%p)\n", This);
169     hr = IDBInitialize_RemoteInitialize_Proxy(This, &error);
170     if(error)
171     {
172         SetErrorInfo(0, error);
173         IErrorInfo_Release(error);
174     }
175     return hr;
176 }
177
178 HRESULT __RPC_STUB IDBInitialize_Initialize_Stub(IDBInitialize* This, IErrorInfo **ppErrorInfoRem)
179 {
180     HRESULT hr;
181     TRACE("(%p, %p)\n", This, ppErrorInfoRem);
182
183     *ppErrorInfoRem = NULL;
184     hr = IDBInitialize_Initialize(This);
185     if(FAILED(hr)) GetErrorInfo(0, ppErrorInfoRem);
186
187     return hr;
188 }
189
190 HRESULT CALLBACK IDBInitialize_Uninitialize_Proxy(IDBInitialize* This)
191 {
192     FIXME("(%p): stub\n", This);
193     return E_NOTIMPL;
194 }
195
196 HRESULT __RPC_STUB IDBInitialize_Uninitialize_Stub(IDBInitialize* This, IErrorInfo **ppErrorInfoRem)
197 {
198     FIXME("(%p, %p): stub\n", This, ppErrorInfoRem);
199     return E_NOTIMPL;
200 }
201
202 HRESULT CALLBACK IDBDataSourceAdmin_CreateDataSource_Proxy(IDBDataSourceAdmin* This, ULONG cPropertySets,
203                                                            DBPROPSET rgPropertySets[], IUnknown *pUnkOuter,
204                                                            REFIID riid, IUnknown **ppDBSession)
205 {
206     FIXME("(%p, %d, %p, %p, %s, %p): stub\n", This, cPropertySets, rgPropertySets, pUnkOuter,
207           debugstr_guid(riid), ppDBSession);
208     return E_NOTIMPL;
209 }
210
211 HRESULT __RPC_STUB IDBDataSourceAdmin_CreateDataSource_Stub(IDBDataSourceAdmin* This, ULONG cPropertySets,
212                                                             DBPROPSET *rgPropertySets, IUnknown *pUnkOuter,
213                                                             REFIID riid, IUnknown **ppDBSession, ULONG cTotalProps,
214                                                             DBPROPSTATUS *rgPropStatus, IErrorInfo **ppErrorInfoRem)
215 {
216     FIXME("(%p, %d, %p, %p, %s, %p, %d, %p, %p): stub\n", This, cPropertySets, rgPropertySets, pUnkOuter,
217           debugstr_guid(riid), ppDBSession, cTotalProps, rgPropStatus, ppErrorInfoRem);
218     return E_NOTIMPL;
219 }
220
221 HRESULT CALLBACK IDBDataSourceAdmin_DestroyDataSource_Proxy(IDBDataSourceAdmin* This)
222 {
223     FIXME("(%p): stub\n", This);
224     return E_NOTIMPL;
225 }
226
227 HRESULT __RPC_STUB IDBDataSourceAdmin_DestroyDataSource_Stub(IDBDataSourceAdmin* This, IErrorInfo **ppErrorInfoRem)
228 {
229     FIXME("(%p, %p): stub\n", This, ppErrorInfoRem);
230     return E_NOTIMPL;
231 }
232
233 HRESULT CALLBACK IDBDataSourceAdmin_GetCreationProperties_Proxy(IDBDataSourceAdmin* This, ULONG cPropertyIDSets,
234                                                                 const DBPROPIDSET rgPropertyIDSets[], ULONG *pcPropertyInfoSets,
235                                                                 DBPROPINFOSET **prgPropertyInfoSets, OLECHAR **ppDescBuffer)
236 {
237     FIXME("(%p, %d, %p, %p, %p, %p): stub\n", This, cPropertyIDSets, rgPropertyIDSets, pcPropertyInfoSets,
238           prgPropertyInfoSets, ppDescBuffer);
239     return E_NOTIMPL;
240 }
241
242 HRESULT __RPC_STUB IDBDataSourceAdmin_GetCreationProperties_Stub(IDBDataSourceAdmin* This, ULONG cPropertyIDSets,
243                                                                  const DBPROPIDSET *rgPropertyIDSets, ULONG *pcPropertyInfoSets,
244                                                                  DBPROPINFOSET **prgPropertyInfoSets, DBCOUNTITEM *pcOffsets,
245                                                                  DBBYTEOFFSET **prgDescOffsets, ULONG *pcbDescBuffer,
246                                                                  OLECHAR **ppDescBuffer, IErrorInfo **ppErrorInfoRem)
247 {
248     FIXME("(%p, %d, %p, %p, %p, %p, %p, %p, %p, %p): stub\n", This, cPropertyIDSets, rgPropertyIDSets, pcPropertyInfoSets,
249           prgPropertyInfoSets, pcOffsets, prgDescOffsets, pcbDescBuffer, ppDescBuffer, ppErrorInfoRem);
250     return E_NOTIMPL;
251 }
252
253 HRESULT CALLBACK IDBDataSourceAdmin_ModifyDataSource_Proxy(IDBDataSourceAdmin* This, ULONG cPropertySets, DBPROPSET rgPropertySets[])
254 {
255     FIXME("(%p, %d, %p): stub\n", This, cPropertySets, rgPropertySets);
256     return E_NOTIMPL;
257 }
258
259 HRESULT __RPC_STUB IDBDataSourceAdmin_ModifyDataSource_Stub(IDBDataSourceAdmin* This, ULONG cPropertySets,
260                                                             DBPROPSET *rgPropertySets, IErrorInfo **ppErrorInfoRem)
261 {
262     FIXME("(%p, %d, %p, %p): stub\n", This, cPropertySets, rgPropertySets, ppErrorInfoRem);
263     return E_NOTIMPL;
264 }
265
266 HRESULT CALLBACK ISessionProperties_GetProperties_Proxy(ISessionProperties* This, ULONG cPropertyIDSets,
267                                                         const DBPROPIDSET rgPropertyIDSets[], ULONG *pcPropertySets,
268                                                         DBPROPSET **prgPropertySets)
269 {
270     FIXME("(%p, %d, %p, %p, %p): stub\n", This, cPropertyIDSets, rgPropertyIDSets,
271           pcPropertySets, prgPropertySets);
272     return E_NOTIMPL;
273 }
274
275 HRESULT __RPC_STUB ISessionProperties_GetProperties_Stub(ISessionProperties* This, ULONG cPropertyIDSets,
276                                                          const DBPROPIDSET *rgPropertyIDSets, ULONG *pcPropertySets,
277                                                          DBPROPSET **prgPropertySets, IErrorInfo **ppErrorInfoRem)
278 {
279     FIXME("(%p, %d, %p, %p, %p, %p): stub\n", This, cPropertyIDSets, rgPropertyIDSets,
280           pcPropertySets, prgPropertySets, ppErrorInfoRem);
281     return E_NOTIMPL;
282 }
283
284 HRESULT CALLBACK ISessionProperties_SetProperties_Proxy(ISessionProperties* This, ULONG cPropertySets, DBPROPSET rgPropertySets[])
285 {
286     FIXME("(%p, %d, %p): stub\n", This, cPropertySets, rgPropertySets);
287     return E_NOTIMPL;
288 }
289
290 HRESULT __RPC_STUB ISessionProperties_SetProperties_Stub(ISessionProperties* This, ULONG cPropertySets, DBPROPSET *rgPropertySets,
291                                                          ULONG cTotalProps, DBPROPSTATUS *rgPropStatus, IErrorInfo **ppErrorInfoRem)
292 {
293     FIXME("(%p, %d, %p, %d, %p, %p): stub\n", This, cPropertySets, rgPropertySets, cTotalProps,
294           rgPropStatus, ppErrorInfoRem);
295     return E_NOTIMPL;
296 }
297
298 HRESULT CALLBACK IOpenRowset_OpenRowset_Proxy(IOpenRowset* This, IUnknown *pUnkOuter, DBID *pTableID, DBID *pIndexID,
299                                               REFIID riid, ULONG cPropertySets, DBPROPSET rgPropertySets[], IUnknown **ppRowset)
300 {
301     FIXME("(%p, %p, %p, %p, %s, %d, %p, %p): stub\n", This, pUnkOuter, pTableID, pIndexID, debugstr_guid(riid),
302           cPropertySets, rgPropertySets, ppRowset);
303     return E_NOTIMPL;
304 }
305
306 HRESULT __RPC_STUB IOpenRowset_OpenRowset_Stub(IOpenRowset* This, IUnknown *pUnkOuter, DBID *pTableID, DBID *pIndexID,
307                                                REFIID riid, ULONG cPropertySets, DBPROPSET *rgPropertySets,
308                                                IUnknown **ppRowset, ULONG cTotalProps, DBPROPSTATUS *rgPropStatus,
309                                                IErrorInfo **ppErrorInfoRem)
310 {
311     FIXME("(%p, %p, %p, %p, %s, %d, %p, %p, %d, %p, %p): stub\n", This, pUnkOuter, pTableID, pIndexID, debugstr_guid(riid),
312           cPropertySets, rgPropertySets, ppRowset, cTotalProps, rgPropStatus, ppErrorInfoRem);
313     return E_NOTIMPL;
314 }
315
316 HRESULT CALLBACK IBindResource_Bind_Proxy(IBindResource* This, IUnknown *pUnkOuter, LPCOLESTR pwszURL, DBBINDURLFLAG dwBindURLFlags,
317                                           REFGUID rguid, REFIID riid, IAuthenticate *pAuthenticate, DBIMPLICITSESSION *pImplSession,
318                                           DBBINDURLSTATUS *pdwBindStatus, IUnknown **ppUnk)
319 {
320     FIXME("(%p, %p, %s, %08x, %s, %s, %p, %p, %p, %p): stub\n", This, pUnkOuter, debugstr_w(pwszURL), dwBindURLFlags,
321           debugstr_guid(rguid), debugstr_guid(riid), pAuthenticate, pImplSession, pdwBindStatus, ppUnk);
322     return E_NOTIMPL;
323 }
324
325 HRESULT __RPC_STUB IBindResource_Bind_Stub(IBindResource* This, IUnknown *pUnkOuter, LPCOLESTR pwszURL, DBBINDURLFLAG dwBindURLFlags,
326                                            REFGUID rguid, REFIID riid, IAuthenticate *pAuthenticate, IUnknown *pSessionUnkOuter,
327                                            IID *piid, IUnknown **ppSession, DBBINDURLSTATUS *pdwBindStatus, IUnknown **ppUnk)
328 {
329     FIXME("(%p, %p, %s, %08x, %s, %s, %p, %p, %p, %p, %p, %p): stub\n", This, pUnkOuter, debugstr_w(pwszURL), dwBindURLFlags,
330           debugstr_guid(rguid), debugstr_guid(riid), pAuthenticate, pSessionUnkOuter, piid, ppSession, pdwBindStatus, ppUnk);
331     return E_NOTIMPL;
332 }
333
334 HRESULT CALLBACK ICreateRow_CreateRow_Proxy(ICreateRow* This, IUnknown *pUnkOuter, LPCOLESTR pwszURL, DBBINDURLFLAG dwBindURLFlags,
335                                             REFGUID rguid, REFIID riid, IAuthenticate *pAuthenticate, DBIMPLICITSESSION *pImplSession,
336                                             DBBINDURLSTATUS *pdwBindStatus, LPOLESTR *ppwszNewURL, IUnknown **ppUnk)
337 {
338     FIXME("(%p, %p, %s, %08x, %s, %s, %p, %p, %p, %p, %p): stub\n", This, pUnkOuter, debugstr_w(pwszURL), dwBindURLFlags,
339           debugstr_guid(rguid), debugstr_guid(riid), pAuthenticate, pImplSession, pdwBindStatus, ppwszNewURL, ppUnk);
340     return E_NOTIMPL;
341 }
342
343 HRESULT __RPC_STUB ICreateRow_CreateRow_Stub(ICreateRow* This, IUnknown *pUnkOuter, LPCOLESTR pwszURL, DBBINDURLFLAG dwBindURLFlags,
344                                              REFGUID rguid, REFIID riid, IAuthenticate *pAuthenticate, IUnknown *pSessionUnkOuter,
345                                              IID *piid, IUnknown **ppSession, DBBINDURLSTATUS *pdwBindStatus,
346                                              LPOLESTR *ppwszNewURL, IUnknown **ppUnk)
347 {
348     FIXME("(%p, %p, %s, %08x, %s, %s, %p, %p, %p, %p, %p, %p, %p): stub\n", This, pUnkOuter, debugstr_w(pwszURL), dwBindURLFlags,
349           debugstr_guid(rguid), debugstr_guid(riid), pAuthenticate, pSessionUnkOuter, piid, ppSession, pdwBindStatus, ppwszNewURL,
350           ppUnk);
351     return E_NOTIMPL;
352 }