include: Add asynot.idl.
[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     HRESULT hr;
44     IErrorInfo *error;
45
46     TRACE("(%p, %p, %s, %p)\n", This, pUnkOuter, debugstr_guid(riid), ppCommand);
47     hr = IDBCreateCommand_RemoteCreateCommand_Proxy(This, pUnkOuter, riid, ppCommand, &error);
48     if(error)
49     {
50         SetErrorInfo(0, error);
51         IErrorInfo_Release(error);
52     }
53     return hr;
54 }
55
56 HRESULT __RPC_STUB IDBCreateCommand_CreateCommand_Stub(IDBCreateCommand* This, IUnknown *pUnkOuter,
57                                                        REFIID riid, IUnknown **ppCommand, IErrorInfo **ppErrorInfoRem)
58 {
59     HRESULT hr;
60
61     TRACE("(%p, %p, %s, %p, %p)\n", This, pUnkOuter, debugstr_guid(riid), ppCommand, ppErrorInfoRem);
62
63     *ppErrorInfoRem = NULL;
64     hr = IDBCreateCommand_CreateCommand(This, pUnkOuter, riid, ppCommand);
65     if(FAILED(hr)) GetErrorInfo(0, ppErrorInfoRem);
66
67     return hr;
68 }
69
70 HRESULT CALLBACK IDBCreateSession_CreateSession_Proxy(IDBCreateSession* This, IUnknown *pUnkOuter,
71                                                       REFIID riid, IUnknown **ppDBSession)
72 {
73     HRESULT hr;
74     IErrorInfo *error;
75
76     TRACE("(%p, %p, %s, %p)\n", This, pUnkOuter, debugstr_guid(riid), ppDBSession);
77     hr = IDBCreateSession_RemoteCreateSession_Proxy(This, pUnkOuter, riid, ppDBSession, &error);
78     if(error)
79     {
80         SetErrorInfo(0, error);
81         IErrorInfo_Release(error);
82     }
83     return hr;
84 }
85
86 HRESULT __RPC_STUB IDBCreateSession_CreateSession_Stub(IDBCreateSession* This, IUnknown *pUnkOuter,
87                                                        REFIID riid, IUnknown **ppDBSession, IErrorInfo **ppErrorInfoRem)
88 {
89     HRESULT hr;
90     TRACE("(%p, %p, %s, %p, %p)\n", This, pUnkOuter, debugstr_guid(riid),
91           ppDBSession, ppErrorInfoRem);
92
93     *ppErrorInfoRem = NULL;
94     hr = IDBCreateSession_CreateSession(This, pUnkOuter, riid, ppDBSession);
95     if(FAILED(hr)) GetErrorInfo(0, ppErrorInfoRem);
96
97     return hr;
98 }
99
100 HRESULT CALLBACK IDBProperties_GetProperties_Proxy(IDBProperties* This, ULONG cPropertyIDSets, const DBPROPIDSET rgPropertyIDSets[],
101                                                    ULONG *pcPropertySets, DBPROPSET **prgPropertySets)
102 {
103     HRESULT hr;
104     IErrorInfo *error;
105
106     TRACE("(%p, %d, %p, %p, %p)\n", This, cPropertyIDSets, rgPropertyIDSets, pcPropertySets,
107           prgPropertySets);
108     hr = IDBProperties_RemoteGetProperties_Proxy(This, cPropertyIDSets, rgPropertyIDSets,
109                                                  pcPropertySets, prgPropertySets, &error);
110     if(error)
111     {
112         SetErrorInfo(0, error);
113         IErrorInfo_Release(error);
114     }
115     return hr;
116 }
117
118 HRESULT __RPC_STUB IDBProperties_GetProperties_Stub(IDBProperties* This, ULONG cPropertyIDSets, const DBPROPIDSET *rgPropertyIDSets,
119                                                     ULONG *pcPropertySets, DBPROPSET **prgPropertySets, IErrorInfo **ppErrorInfoRem)
120 {
121     HRESULT hr;
122
123     TRACE("(%p, %d, %p, %p, %p, %p)\n", This, cPropertyIDSets, rgPropertyIDSets, pcPropertySets,
124           prgPropertySets, ppErrorInfoRem);
125     *ppErrorInfoRem = NULL;
126     hr = IDBProperties_GetProperties(This, cPropertyIDSets, rgPropertyIDSets,
127         pcPropertySets, prgPropertySets);
128     if(FAILED(hr)) GetErrorInfo(0, ppErrorInfoRem);
129
130     return hr;
131 }
132
133 HRESULT CALLBACK IDBProperties_GetPropertyInfo_Proxy(IDBProperties* This, ULONG cPropertyIDSets, const DBPROPIDSET rgPropertyIDSets[],
134                                                      ULONG *pcPropertyInfoSets, DBPROPINFOSET **prgPropertyInfoSets,
135                                                      OLECHAR **ppDescBuffer)
136 {
137     FIXME("(%p, %d, %p, %p, %p, %p): stub\n", This, cPropertyIDSets, rgPropertyIDSets, pcPropertyInfoSets,
138           prgPropertyInfoSets, ppDescBuffer);
139     return E_NOTIMPL;
140 }
141
142 HRESULT __RPC_STUB IDBProperties_GetPropertyInfo_Stub(IDBProperties* This, ULONG cPropertyIDSets, const DBPROPIDSET *rgPropertyIDSets,
143                                                       ULONG *pcPropertyInfoSets, DBPROPINFOSET **prgPropertyInfoSets,
144                                                       ULONG *pcOffsets, DBBYTEOFFSET **prgDescOffsets, ULONG *pcbDescBuffer,
145                                                       OLECHAR **ppDescBuffer, IErrorInfo **ppErrorInfoRem)
146 {
147     FIXME("(%p, %d, %p, %p, %p, %p, %p, %p, %p, %p): stub\n", This, cPropertyIDSets, rgPropertyIDSets, pcPropertyInfoSets,
148           prgPropertyInfoSets, pcOffsets, prgDescOffsets, pcbDescBuffer, ppDescBuffer, ppErrorInfoRem);
149     return E_NOTIMPL;
150 }
151
152 HRESULT CALLBACK IDBProperties_SetProperties_Proxy(IDBProperties* This, ULONG cPropertySets, DBPROPSET rgPropertySets[])
153 {
154     ULONG prop_set, prop, total_props = 0;
155     HRESULT hr;
156     IErrorInfo *error;
157     DBPROPSTATUS *status;
158
159     TRACE("(%p, %d, %p)\n", This, cPropertySets, rgPropertySets);
160
161     for(prop_set = 0; prop_set < cPropertySets; prop_set++)
162         total_props += rgPropertySets[prop_set].cProperties;
163
164     if(total_props == 0) return S_OK;
165
166     status = CoTaskMemAlloc(total_props * sizeof(*status));
167     if(!status) return E_OUTOFMEMORY;
168
169     hr = IDBProperties_RemoteSetProperties_Proxy(This, cPropertySets, rgPropertySets,
170                                                  total_props, status, &error);
171     if(error)
172     {
173         SetErrorInfo(0, error);
174         IErrorInfo_Release(error);
175     }
176
177     total_props = 0;
178     for(prop_set = 0; prop_set < cPropertySets; prop_set++)
179         for(prop = 0; prop < rgPropertySets[prop_set].cProperties; prop++)
180             rgPropertySets[prop_set].rgProperties[prop].dwStatus = status[total_props++];
181
182     CoTaskMemFree(status);
183     return hr;
184 }
185
186 HRESULT __RPC_STUB IDBProperties_SetProperties_Stub(IDBProperties* This, ULONG cPropertySets, DBPROPSET *rgPropertySets,
187                                                     ULONG cTotalProps, DBPROPSTATUS *rgPropStatus, IErrorInfo **ppErrorInfoRem)
188 {
189     ULONG prop_set, prop, total_props = 0;
190     HRESULT hr;
191
192     TRACE("(%p, %d, %p, %d, %p, %p)\n", This, cPropertySets, rgPropertySets, cTotalProps,
193           rgPropStatus, ppErrorInfoRem);
194
195     *ppErrorInfoRem = NULL;
196     hr = IDBProperties_SetProperties(This, cPropertySets, rgPropertySets);
197     if(FAILED(hr)) GetErrorInfo(0, ppErrorInfoRem);
198
199     for(prop_set = 0; prop_set < cPropertySets; prop_set++)
200         for(prop = 0; prop < rgPropertySets[prop_set].cProperties; prop++)
201             rgPropStatus[total_props++] = rgPropertySets[prop_set].rgProperties[prop].dwStatus;
202
203     return hr;
204 }
205
206 HRESULT CALLBACK IDBInitialize_Initialize_Proxy(IDBInitialize* This)
207 {
208     HRESULT hr;
209     IErrorInfo *error;
210
211     TRACE("(%p)\n", This);
212     hr = IDBInitialize_RemoteInitialize_Proxy(This, &error);
213     if(error)
214     {
215         SetErrorInfo(0, error);
216         IErrorInfo_Release(error);
217     }
218     return hr;
219 }
220
221 HRESULT __RPC_STUB IDBInitialize_Initialize_Stub(IDBInitialize* This, IErrorInfo **ppErrorInfoRem)
222 {
223     HRESULT hr;
224     TRACE("(%p, %p)\n", This, ppErrorInfoRem);
225
226     *ppErrorInfoRem = NULL;
227     hr = IDBInitialize_Initialize(This);
228     if(FAILED(hr)) GetErrorInfo(0, ppErrorInfoRem);
229
230     return hr;
231 }
232
233 HRESULT CALLBACK IDBInitialize_Uninitialize_Proxy(IDBInitialize* This)
234 {
235     FIXME("(%p): stub\n", This);
236     return E_NOTIMPL;
237 }
238
239 HRESULT __RPC_STUB IDBInitialize_Uninitialize_Stub(IDBInitialize* This, IErrorInfo **ppErrorInfoRem)
240 {
241     FIXME("(%p, %p): stub\n", This, ppErrorInfoRem);
242     return E_NOTIMPL;
243 }
244
245 HRESULT CALLBACK IDBDataSourceAdmin_CreateDataSource_Proxy(IDBDataSourceAdmin* This, ULONG cPropertySets,
246                                                            DBPROPSET rgPropertySets[], IUnknown *pUnkOuter,
247                                                            REFIID riid, IUnknown **ppDBSession)
248 {
249     ULONG prop_set, prop, total_props = 0;
250     HRESULT hr;
251     IErrorInfo *error;
252     DBPROPSTATUS *status;
253
254     TRACE("(%p, %d, %p, %p, %s, %p)\n", This, cPropertySets, rgPropertySets, pUnkOuter,
255           debugstr_guid(riid), ppDBSession);
256
257     for(prop_set = 0; prop_set < cPropertySets; prop_set++)
258         total_props += rgPropertySets[prop_set].cProperties;
259
260     if(total_props == 0) return S_OK;
261
262     status = CoTaskMemAlloc(total_props * sizeof(*status));
263     if(!status) return E_OUTOFMEMORY;
264
265     hr = IDBDataSourceAdmin_RemoteCreateDataSource_Proxy(This, cPropertySets, rgPropertySets, pUnkOuter,
266                                                          riid, ppDBSession, total_props, status, &error);
267     if(error)
268     {
269         SetErrorInfo(0, error);
270         IErrorInfo_Release(error);
271     }
272
273     total_props = 0;
274     for(prop_set = 0; prop_set < cPropertySets; prop_set++)
275         for(prop = 0; prop < rgPropertySets[prop_set].cProperties; prop++)
276             rgPropertySets[prop_set].rgProperties[prop].dwStatus = status[total_props++];
277
278     CoTaskMemFree(status);
279     return hr;
280 }
281
282 HRESULT __RPC_STUB IDBDataSourceAdmin_CreateDataSource_Stub(IDBDataSourceAdmin* This, ULONG cPropertySets,
283                                                             DBPROPSET *rgPropertySets, IUnknown *pUnkOuter,
284                                                             REFIID riid, IUnknown **ppDBSession, ULONG cTotalProps,
285                                                             DBPROPSTATUS *rgPropStatus, IErrorInfo **ppErrorInfoRem)
286 {
287     ULONG prop_set, prop, total_props = 0;
288     HRESULT hr;
289
290     TRACE("(%p, %d, %p, %p, %s, %p, %d, %p, %p)\n", This, cPropertySets, rgPropertySets, pUnkOuter,
291           debugstr_guid(riid), ppDBSession, cTotalProps, rgPropStatus, ppErrorInfoRem);
292
293     *ppErrorInfoRem = NULL;
294     hr = IDBDataSourceAdmin_CreateDataSource(This, cPropertySets, rgPropertySets, pUnkOuter, riid, ppDBSession);
295     if(FAILED(hr)) GetErrorInfo(0, ppErrorInfoRem);
296
297     for(prop_set = 0; prop_set < cPropertySets; prop_set++)
298         for(prop = 0; prop < rgPropertySets[prop_set].cProperties; prop++)
299             rgPropStatus[total_props++] = rgPropertySets[prop_set].rgProperties[prop].dwStatus;
300
301     return hr;
302 }
303
304 HRESULT CALLBACK IDBDataSourceAdmin_DestroyDataSource_Proxy(IDBDataSourceAdmin* This)
305 {
306     FIXME("(%p): stub\n", This);
307     return E_NOTIMPL;
308 }
309
310 HRESULT __RPC_STUB IDBDataSourceAdmin_DestroyDataSource_Stub(IDBDataSourceAdmin* This, IErrorInfo **ppErrorInfoRem)
311 {
312     FIXME("(%p, %p): stub\n", This, ppErrorInfoRem);
313     return E_NOTIMPL;
314 }
315
316 HRESULT CALLBACK IDBDataSourceAdmin_GetCreationProperties_Proxy(IDBDataSourceAdmin* This, ULONG cPropertyIDSets,
317                                                                 const DBPROPIDSET rgPropertyIDSets[], ULONG *pcPropertyInfoSets,
318                                                                 DBPROPINFOSET **prgPropertyInfoSets, OLECHAR **ppDescBuffer)
319 {
320     FIXME("(%p, %d, %p, %p, %p, %p): stub\n", This, cPropertyIDSets, rgPropertyIDSets, pcPropertyInfoSets,
321           prgPropertyInfoSets, ppDescBuffer);
322     return E_NOTIMPL;
323 }
324
325 HRESULT __RPC_STUB IDBDataSourceAdmin_GetCreationProperties_Stub(IDBDataSourceAdmin* This, ULONG cPropertyIDSets,
326                                                                  const DBPROPIDSET *rgPropertyIDSets, ULONG *pcPropertyInfoSets,
327                                                                  DBPROPINFOSET **prgPropertyInfoSets, DBCOUNTITEM *pcOffsets,
328                                                                  DBBYTEOFFSET **prgDescOffsets, ULONG *pcbDescBuffer,
329                                                                  OLECHAR **ppDescBuffer, IErrorInfo **ppErrorInfoRem)
330 {
331     FIXME("(%p, %d, %p, %p, %p, %p, %p, %p, %p, %p): stub\n", This, cPropertyIDSets, rgPropertyIDSets, pcPropertyInfoSets,
332           prgPropertyInfoSets, pcOffsets, prgDescOffsets, pcbDescBuffer, ppDescBuffer, ppErrorInfoRem);
333     return E_NOTIMPL;
334 }
335
336 HRESULT CALLBACK IDBDataSourceAdmin_ModifyDataSource_Proxy(IDBDataSourceAdmin* This, ULONG cPropertySets, DBPROPSET rgPropertySets[])
337 {
338     FIXME("(%p, %d, %p): stub\n", This, cPropertySets, rgPropertySets);
339     return E_NOTIMPL;
340 }
341
342 HRESULT __RPC_STUB IDBDataSourceAdmin_ModifyDataSource_Stub(IDBDataSourceAdmin* This, ULONG cPropertySets,
343                                                             DBPROPSET *rgPropertySets, IErrorInfo **ppErrorInfoRem)
344 {
345     FIXME("(%p, %d, %p, %p): stub\n", This, cPropertySets, rgPropertySets, ppErrorInfoRem);
346     return E_NOTIMPL;
347 }
348
349 HRESULT CALLBACK ISessionProperties_GetProperties_Proxy(ISessionProperties* This, ULONG cPropertyIDSets,
350                                                         const DBPROPIDSET rgPropertyIDSets[], ULONG *pcPropertySets,
351                                                         DBPROPSET **prgPropertySets)
352 {
353     FIXME("(%p, %d, %p, %p, %p): stub\n", This, cPropertyIDSets, rgPropertyIDSets,
354           pcPropertySets, prgPropertySets);
355     return E_NOTIMPL;
356 }
357
358 HRESULT __RPC_STUB ISessionProperties_GetProperties_Stub(ISessionProperties* This, ULONG cPropertyIDSets,
359                                                          const DBPROPIDSET *rgPropertyIDSets, ULONG *pcPropertySets,
360                                                          DBPROPSET **prgPropertySets, IErrorInfo **ppErrorInfoRem)
361 {
362     FIXME("(%p, %d, %p, %p, %p, %p): stub\n", This, cPropertyIDSets, rgPropertyIDSets,
363           pcPropertySets, prgPropertySets, ppErrorInfoRem);
364     return E_NOTIMPL;
365 }
366
367 HRESULT CALLBACK ISessionProperties_SetProperties_Proxy(ISessionProperties* This, ULONG cPropertySets, DBPROPSET rgPropertySets[])
368 {
369     ULONG prop_set, prop, total_props = 0;
370     HRESULT hr;
371     IErrorInfo *error;
372     DBPROPSTATUS *status;
373
374     TRACE("(%p, %d, %p)\n", This, cPropertySets, rgPropertySets);
375
376     for(prop_set = 0; prop_set < cPropertySets; prop_set++)
377         total_props += rgPropertySets[prop_set].cProperties;
378
379     if(total_props == 0) return S_OK;
380
381     status = CoTaskMemAlloc(total_props * sizeof(*status));
382     if(!status) return E_OUTOFMEMORY;
383
384     hr = ISessionProperties_RemoteSetProperties_Proxy(This, cPropertySets, rgPropertySets,
385                                                       total_props, status, &error);
386     if(error)
387     {
388         SetErrorInfo(0, error);
389         IErrorInfo_Release(error);
390     }
391
392     total_props = 0;
393     for(prop_set = 0; prop_set < cPropertySets; prop_set++)
394         for(prop = 0; prop < rgPropertySets[prop_set].cProperties; prop++)
395             rgPropertySets[prop_set].rgProperties[prop].dwStatus = status[total_props++];
396
397     CoTaskMemFree(status);
398     return hr;
399 }
400
401 HRESULT __RPC_STUB ISessionProperties_SetProperties_Stub(ISessionProperties* This, ULONG cPropertySets, DBPROPSET *rgPropertySets,
402                                                          ULONG cTotalProps, DBPROPSTATUS *rgPropStatus, IErrorInfo **ppErrorInfoRem)
403 {
404     ULONG prop_set, prop, total_props = 0;
405     HRESULT hr;
406
407     TRACE("(%p, %d, %p, %d, %p, %p)\n", This, cPropertySets, rgPropertySets, cTotalProps,
408           rgPropStatus, ppErrorInfoRem);
409
410     *ppErrorInfoRem = NULL;
411     hr = ISessionProperties_SetProperties(This, cPropertySets, rgPropertySets);
412     if(FAILED(hr)) GetErrorInfo(0, ppErrorInfoRem);
413
414     for(prop_set = 0; prop_set < cPropertySets; prop_set++)
415         for(prop = 0; prop < rgPropertySets[prop_set].cProperties; prop++)
416             rgPropStatus[total_props++] = rgPropertySets[prop_set].rgProperties[prop].dwStatus;
417
418     return hr;
419 }
420
421 HRESULT CALLBACK IOpenRowset_OpenRowset_Proxy(IOpenRowset* This, IUnknown *pUnkOuter, DBID *pTableID, DBID *pIndexID,
422                                               REFIID riid, ULONG cPropertySets, DBPROPSET rgPropertySets[], IUnknown **ppRowset)
423 {
424     FIXME("(%p, %p, %p, %p, %s, %d, %p, %p): stub\n", This, pUnkOuter, pTableID, pIndexID, debugstr_guid(riid),
425           cPropertySets, rgPropertySets, ppRowset);
426     return E_NOTIMPL;
427 }
428
429 HRESULT __RPC_STUB IOpenRowset_OpenRowset_Stub(IOpenRowset* This, IUnknown *pUnkOuter, DBID *pTableID, DBID *pIndexID,
430                                                REFIID riid, ULONG cPropertySets, DBPROPSET *rgPropertySets,
431                                                IUnknown **ppRowset, ULONG cTotalProps, DBPROPSTATUS *rgPropStatus,
432                                                IErrorInfo **ppErrorInfoRem)
433 {
434     FIXME("(%p, %p, %p, %p, %s, %d, %p, %p, %d, %p, %p): stub\n", This, pUnkOuter, pTableID, pIndexID, debugstr_guid(riid),
435           cPropertySets, rgPropertySets, ppRowset, cTotalProps, rgPropStatus, ppErrorInfoRem);
436     return E_NOTIMPL;
437 }
438
439 HRESULT CALLBACK IBindResource_Bind_Proxy(IBindResource* This, IUnknown *pUnkOuter, LPCOLESTR pwszURL, DBBINDURLFLAG dwBindURLFlags,
440                                           REFGUID rguid, REFIID riid, IAuthenticate *pAuthenticate, DBIMPLICITSESSION *pImplSession,
441                                           DBBINDURLSTATUS *pdwBindStatus, IUnknown **ppUnk)
442 {
443     HRESULT hr;
444
445     TRACE("(%p, %p, %s, %08x, %s, %s, %p, %p, %p, %p)\n", This, pUnkOuter, debugstr_w(pwszURL), dwBindURLFlags,
446           debugstr_guid(rguid), debugstr_guid(riid), pAuthenticate, pImplSession, pdwBindStatus, ppUnk);
447
448     hr = IBindResource_RemoteBind_Proxy(This, pUnkOuter, pwszURL, dwBindURLFlags, rguid, riid, pAuthenticate,
449                                         pImplSession ? pImplSession->pUnkOuter : NULL, pImplSession ? pImplSession->piid : NULL,
450                                         pImplSession ? &pImplSession->pSession : NULL, pdwBindStatus, ppUnk);
451     return hr;
452 }
453
454 HRESULT __RPC_STUB IBindResource_Bind_Stub(IBindResource* This, IUnknown *pUnkOuter, LPCOLESTR pwszURL, DBBINDURLFLAG dwBindURLFlags,
455                                            REFGUID rguid, REFIID riid, IAuthenticate *pAuthenticate, IUnknown *pSessionUnkOuter,
456                                            IID *piid, IUnknown **ppSession, DBBINDURLSTATUS *pdwBindStatus, IUnknown **ppUnk)
457 {
458     HRESULT hr;
459     DBIMPLICITSESSION impl_session;
460
461     TRACE("(%p, %p, %s, %08x, %s, %s, %p, %p, %p, %p, %p, %p)\n", This, pUnkOuter, debugstr_w(pwszURL), dwBindURLFlags,
462           debugstr_guid(rguid), debugstr_guid(riid), pAuthenticate, pSessionUnkOuter, piid, ppSession, pdwBindStatus, ppUnk);
463
464     impl_session.pUnkOuter = pSessionUnkOuter;
465     impl_session.piid = piid;
466     impl_session.pSession = NULL;
467
468     hr = IBindResource_Bind(This, pUnkOuter, pwszURL, dwBindURLFlags, rguid, riid, pAuthenticate,
469                             ppSession ? &impl_session : NULL, pdwBindStatus, ppUnk);
470
471     if(ppSession) *ppSession = impl_session.pSession;
472     return hr;
473 }
474
475 HRESULT CALLBACK ICreateRow_CreateRow_Proxy(ICreateRow* This, IUnknown *pUnkOuter, LPCOLESTR pwszURL, DBBINDURLFLAG dwBindURLFlags,
476                                             REFGUID rguid, REFIID riid, IAuthenticate *pAuthenticate, DBIMPLICITSESSION *pImplSession,
477                                             DBBINDURLSTATUS *pdwBindStatus, LPOLESTR *ppwszNewURL, IUnknown **ppUnk)
478 {
479     HRESULT hr;
480
481     TRACE("(%p, %p, %s, %08x, %s, %s, %p, %p, %p, %p, %p)\n", This, pUnkOuter, debugstr_w(pwszURL), dwBindURLFlags,
482           debugstr_guid(rguid), debugstr_guid(riid), pAuthenticate, pImplSession, pdwBindStatus, ppwszNewURL, ppUnk);
483
484     hr = ICreateRow_RemoteCreateRow_Proxy(This, pUnkOuter, pwszURL, dwBindURLFlags, rguid, riid, pAuthenticate,
485                                           pImplSession ? pImplSession->pUnkOuter : NULL, pImplSession ? pImplSession->piid : NULL,
486                                           pImplSession ? &pImplSession->pSession : NULL, pdwBindStatus, ppwszNewURL, ppUnk);
487     return hr;
488 }
489
490 HRESULT __RPC_STUB ICreateRow_CreateRow_Stub(ICreateRow* This, IUnknown *pUnkOuter, LPCOLESTR pwszURL, DBBINDURLFLAG dwBindURLFlags,
491                                              REFGUID rguid, REFIID riid, IAuthenticate *pAuthenticate, IUnknown *pSessionUnkOuter,
492                                              IID *piid, IUnknown **ppSession, DBBINDURLSTATUS *pdwBindStatus,
493                                              LPOLESTR *ppwszNewURL, IUnknown **ppUnk)
494 {
495     HRESULT hr;
496     DBIMPLICITSESSION impl_session;
497
498     TRACE("(%p, %p, %s, %08x, %s, %s, %p, %p, %p, %p, %p, %p, %p)\n", This, pUnkOuter, debugstr_w(pwszURL), dwBindURLFlags,
499           debugstr_guid(rguid), debugstr_guid(riid), pAuthenticate, pSessionUnkOuter, piid, ppSession, pdwBindStatus, ppwszNewURL,
500           ppUnk);
501
502     impl_session.pUnkOuter = pSessionUnkOuter;
503     impl_session.piid = piid;
504     impl_session.pSession = NULL;
505
506     hr = ICreateRow_CreateRow(This, pUnkOuter, pwszURL, dwBindURLFlags, rguid, riid, pAuthenticate,
507                               ppSession ? &impl_session : NULL, pdwBindStatus, ppwszNewURL, ppUnk);
508
509     if(ppSession) *ppSession = impl_session.pSession;
510     return hr;
511 }
512
513 HRESULT CALLBACK IAccessor_AddRefAccessor_Proxy(IAccessor* This, HACCESSOR hAccessor, DBREFCOUNT *pcRefCount)
514 {
515     FIXME("(%p)->(%08lx, %p): stub\n", This, hAccessor, pcRefCount);
516     return E_NOTIMPL;
517 }
518
519 HRESULT __RPC_STUB IAccessor_AddRefAccessor_Stub(IAccessor* This, HACCESSOR hAccessor, DBREFCOUNT *pcRefCount,
520                                                  IErrorInfo **ppErrorInfoRem)
521 {
522     FIXME("(%p)->(%08lx, %p, %p): stub\n", This, hAccessor, pcRefCount, ppErrorInfoRem);
523     return E_NOTIMPL;
524 }
525
526 HRESULT CALLBACK IAccessor_CreateAccessor_Proxy(IAccessor* This, DBACCESSORFLAGS dwAccessorFlags, DBCOUNTITEM cBindings,
527                                                 const DBBINDING rgBindings[], DBLENGTH cbRowSize, HACCESSOR *phAccessor,
528                                                 DBBINDSTATUS rgStatus[])
529 {
530     HRESULT hr;
531     IErrorInfo *error;
532     DBCOUNTITEM i;
533
534     TRACE("(%p)->(%08x, %d, %p, %d, %p, %p)\n", This, dwAccessorFlags, cBindings, rgBindings,
535           cbRowSize, phAccessor, rgStatus);
536
537     for(i = 0; i < cBindings; i++)
538     {
539         TRACE("%d: ord %d val off %d len off %d stat off %d part %04x mem_owner %d max_len %d type %04x\n",
540               i, rgBindings[i].iOrdinal, rgBindings[i].obValue, rgBindings[i].obLength, rgBindings[i].obStatus,
541               rgBindings[i].dwPart, rgBindings[i].dwMemOwner, rgBindings[i].cbMaxLen, rgBindings[i].wType);
542     }
543
544     hr = IAccessor_RemoteCreateAccessor_Proxy(This, dwAccessorFlags, cBindings, (DBBINDING *)rgBindings,
545                                               cbRowSize, phAccessor, rgStatus, &error);
546     if(error)
547     {
548         SetErrorInfo(0, error);
549         IErrorInfo_Release(error);
550     }
551
552     TRACE("returning %08x accessor %lx\n", hr, *phAccessor);
553     return hr;
554 }
555
556 HRESULT __RPC_STUB IAccessor_CreateAccessor_Stub(IAccessor* This, DBACCESSORFLAGS dwAccessorFlags, DBCOUNTITEM cBindings,
557                                                  DBBINDING *rgBindings, DBLENGTH cbRowSize, HACCESSOR *phAccessor,
558                                                  DBBINDSTATUS *rgStatus, IErrorInfo **ppErrorInfoRem)
559 {
560     HRESULT hr;
561
562     TRACE("(%p)->(%08x, %d, %p, %d, %p, %p, %p)\n", This, dwAccessorFlags, cBindings, rgBindings,
563           cbRowSize, phAccessor, rgStatus, ppErrorInfoRem);
564
565     *ppErrorInfoRem = NULL;
566     hr = IAccessor_CreateAccessor(This, dwAccessorFlags, cBindings, rgBindings,
567                                   cbRowSize, phAccessor, rgStatus);
568     if(FAILED(hr)) GetErrorInfo(0, ppErrorInfoRem);
569
570     return hr;
571 }
572
573 HRESULT CALLBACK IAccessor_GetBindings_Proxy(IAccessor* This, HACCESSOR hAccessor, DBACCESSORFLAGS *pdwAccessorFlags,
574                                              DBCOUNTITEM *pcBindings, DBBINDING **prgBindings)
575 {
576     FIXME("(%p): stub\n", This);
577     return E_NOTIMPL;
578 }
579
580 HRESULT __RPC_STUB IAccessor_GetBindings_Stub(IAccessor* This, HACCESSOR hAccessor, DBACCESSORFLAGS *pdwAccessorFlags,
581                                               DBCOUNTITEM *pcBindings, DBBINDING **prgBindings, IErrorInfo **ppErrorInfoRem)
582 {
583     FIXME("(%p): stub\n", This);
584     return E_NOTIMPL;
585 }
586
587 HRESULT CALLBACK IAccessor_ReleaseAccessor_Proxy(IAccessor* This, HACCESSOR hAccessor, DBREFCOUNT *pcRefCount)
588 {
589     HRESULT hr;
590     IErrorInfo *error;
591     DBREFCOUNT ref;
592
593     TRACE("(%p)->(%lx, %p)\n", This, hAccessor, pcRefCount);
594
595     hr = IAccessor_RemoteReleaseAccessor_Proxy(This, hAccessor, &ref, &error);
596
597     if(pcRefCount) *pcRefCount = ref;
598     if(error)
599     {
600         SetErrorInfo(0, error);
601         IErrorInfo_Release(error);
602     }
603     return hr;
604 }
605
606 HRESULT __RPC_STUB IAccessor_ReleaseAccessor_Stub(IAccessor* This, HACCESSOR hAccessor, DBREFCOUNT *pcRefCount,
607                                                   IErrorInfo **ppErrorInfoRem)
608 {
609     HRESULT hr;
610
611     TRACE("(%p)->(%lx, %p, %p)\n", This, hAccessor, pcRefCount, ppErrorInfoRem);
612
613     *ppErrorInfoRem = NULL;
614
615     hr = IAccessor_ReleaseAccessor(This, hAccessor, pcRefCount);
616
617     if(FAILED(hr)) GetErrorInfo(0, ppErrorInfoRem);
618     return hr;
619 }
620
621 HRESULT CALLBACK IRowsetInfo_GetProperties_Proxy(IRowsetInfo* This, const ULONG cPropertyIDSets, const DBPROPIDSET rgPropertyIDSets[],
622                                                  ULONG *pcPropertySets, DBPROPSET **prgPropertySets)
623 {
624     HRESULT hr;
625     IErrorInfo *error;
626     ULONG i;
627
628     TRACE("(%p)->(%d, %p, %p, %p)\n", This, cPropertyIDSets, rgPropertyIDSets, pcPropertySets, prgPropertySets);
629
630     for(i = 0; i < cPropertyIDSets; i++)
631     {
632         int j;
633         TRACE("%d: %s %d props\n", i, debugstr_guid(&rgPropertyIDSets[i].guidPropertySet), rgPropertyIDSets[i].cPropertyIDs);
634         for(j = 0; j < rgPropertyIDSets[i].cPropertyIDs; j++)
635             TRACE("\t%d: prop id %d\n", j, rgPropertyIDSets[i].rgPropertyIDs[j]);
636     }
637
638     hr = IRowsetInfo_RemoteGetProperties_Proxy(This, cPropertyIDSets, rgPropertyIDSets, pcPropertySets, prgPropertySets, &error);
639
640     if(error)
641     {
642         SetErrorInfo(0, error);
643         IErrorInfo_Release(error);
644     }
645     return hr;
646 }
647
648 HRESULT __RPC_STUB IRowsetInfo_GetProperties_Stub(IRowsetInfo* This, ULONG cPropertyIDSets, const DBPROPIDSET *rgPropertyIDSets,
649                                                   ULONG *pcPropertySets, DBPROPSET **prgPropertySets, IErrorInfo **ppErrorInfoRem)
650 {
651     HRESULT hr;
652
653     TRACE("(%p)->(%d, %p, %p, %p, %p)\n", This, cPropertyIDSets, rgPropertyIDSets, pcPropertySets, prgPropertySets, ppErrorInfoRem);
654
655     *ppErrorInfoRem = NULL;
656
657     hr = IRowsetInfo_GetProperties(This, cPropertyIDSets, rgPropertyIDSets, pcPropertySets, prgPropertySets);
658     if(FAILED(hr)) GetErrorInfo(0, ppErrorInfoRem);
659     TRACE("returning %08x\n", hr);
660     return hr;
661 }
662
663 HRESULT CALLBACK IRowsetInfo_GetReferencedRowset_Proxy(IRowsetInfo* This, DBORDINAL iOrdinal, REFIID riid, IUnknown **ppReferencedRowset)
664 {
665     FIXME("(%p)->(%d, %s, %p): stub\n", This, iOrdinal, debugstr_guid(riid), ppReferencedRowset);
666     return E_NOTIMPL;
667 }
668
669 HRESULT __RPC_STUB IRowsetInfo_GetReferencedRowset_Stub(IRowsetInfo* This, DBORDINAL iOrdinal, REFIID riid, IUnknown **ppReferencedRowset,
670                                                         IErrorInfo **ppErrorInfoRem)
671 {
672     FIXME("(%p)->(%d, %s, %p, %p): stub\n", This, iOrdinal, debugstr_guid(riid), ppReferencedRowset, ppErrorInfoRem);
673     return E_NOTIMPL;
674 }
675
676 HRESULT CALLBACK IRowsetInfo_GetSpecification_Proxy(IRowsetInfo* This, REFIID riid, IUnknown **ppSpecification)
677 {
678     FIXME("(%p)->(%s, %p): stub\n", This, debugstr_guid(riid), ppSpecification);
679     return E_NOTIMPL;
680 }
681
682 HRESULT __RPC_STUB IRowsetInfo_GetSpecification_Stub(IRowsetInfo* This, REFIID riid, IUnknown **ppSpecification, IErrorInfo **ppErrorInfoRem)
683 {
684     FIXME("(%p)->(%s, %p, %p): stub\n", This, debugstr_guid(riid), ppSpecification, ppErrorInfoRem);
685     return E_NOTIMPL;
686 }
687
688 HRESULT CALLBACK ICommand_Cancel_Proxy(ICommand* This)
689 {
690     FIXME("(%p): stub\n", This);
691     return E_NOTIMPL;
692 }
693
694 HRESULT __RPC_STUB ICommand_Cancel_Stub(ICommand* This, IErrorInfo **ppErrorInfoRem)
695 {
696     FIXME("(%p)->(%p): stub\n", This, ppErrorInfoRem);
697     return E_NOTIMPL;
698 }
699
700 HRESULT CALLBACK ICommand_Execute_Proxy(ICommand* This, IUnknown *pUnkOuter, REFIID riid,
701                                         DBPARAMS *pParams, DBROWCOUNT *pcRowsAffected, IUnknown **ppRowset)
702 {
703     FIXME("(%p)->(%p, %s, %p, %p, %p): stub\n", This, pUnkOuter, debugstr_guid(riid), pParams,
704           pcRowsAffected, ppRowset);
705     if(pParams) TRACE("params {%p, %d, %08lx}\n", pParams->pData, pParams->cParamSets, pParams->hAccessor);
706
707     return E_NOTIMPL;
708 }
709
710 HRESULT __RPC_STUB ICommand_Execute_Stub(ICommand* This, IUnknown *pUnkOuter, REFIID riid, HACCESSOR hAccessor,
711                                          DB_UPARAMS cParamSets, GUID *pGuid, ULONG ulGuidOffset, RMTPACK *pInputParams,
712                                          RMTPACK *pOutputParams, DBCOUNTITEM cBindings, DBBINDING *rgBindings,
713                                          DBSTATUS *rgStatus, DBROWCOUNT *pcRowsAffected, IUnknown **ppRowset)
714 {
715     FIXME("(%p)->(%p, %s, %08lx, %d, %p, %d, %p, %p, %d, %p, %p, %p, %p): stub\n", This, pUnkOuter, debugstr_guid(riid),
716           hAccessor, cParamSets, pGuid, ulGuidOffset, pInputParams, pOutputParams, cBindings, rgBindings, rgStatus,
717           pcRowsAffected, ppRowset);
718     return E_NOTIMPL;
719 }
720
721 HRESULT CALLBACK ICommand_GetDBSession_Proxy(ICommand* This, REFIID riid, IUnknown **ppSession)
722 {
723     FIXME("(%p)->(%s, %p): stub\n", This, debugstr_guid(riid), ppSession);
724     return E_NOTIMPL;
725 }
726
727 HRESULT __RPC_STUB ICommand_GetDBSession_Stub(ICommand* This, REFIID riid, IUnknown **ppSession, IErrorInfo **ppErrorInfoRem)
728 {
729     FIXME("(%p)->(%s, %p, %p): stub\n", This, debugstr_guid(riid), ppSession, ppErrorInfoRem);
730     return E_NOTIMPL;
731 }
732
733 HRESULT CALLBACK ICommandText_GetCommandText_Proxy(ICommandText* This, GUID *pguidDialect, LPOLESTR *ppwszCommand)
734 {
735     FIXME("(%p)->(%p, %p): stub\n", This, pguidDialect, ppwszCommand);
736     return E_NOTIMPL;
737 }
738
739 HRESULT __RPC_STUB ICommandText_GetCommandText_Stub(ICommandText* This, GUID *pguidDialect,
740                                                     LPOLESTR *ppwszCommand, IErrorInfo **ppErrorInfoRem)
741 {
742     FIXME("(%p)->(%p, %p, %p): stub\n", This, pguidDialect, ppwszCommand, ppErrorInfoRem);
743     return E_NOTIMPL;
744 }
745
746 HRESULT CALLBACK ICommandText_SetCommandText_Proxy(ICommandText* This, REFGUID rguidDialect, LPCOLESTR pwszCommand)
747 {
748     HRESULT hr;
749     IErrorInfo *error;
750
751     TRACE("(%p)->(%s, %s)\n", This, debugstr_guid(rguidDialect), debugstr_w(pwszCommand));
752
753     hr = ICommandText_RemoteSetCommandText_Proxy(This, rguidDialect, pwszCommand, &error);
754     if(error)
755     {
756         SetErrorInfo(0, error);
757         IErrorInfo_Release(error);
758     }
759     return hr;
760 }
761
762 HRESULT __RPC_STUB ICommandText_SetCommandText_Stub(ICommandText* This, REFGUID rguidDialect, LPCOLESTR pwszCommand,
763                                                     IErrorInfo **ppErrorInfoRem)
764 {
765     HRESULT hr;
766
767     TRACE("(%p)->(%s, %s, %p)\n", This, debugstr_guid(rguidDialect), debugstr_w(pwszCommand),
768           ppErrorInfoRem);
769
770     *ppErrorInfoRem = NULL;
771     hr = ICommandText_SetCommandText(This, rguidDialect, pwszCommand);
772     if(FAILED(hr)) GetErrorInfo(0, ppErrorInfoRem);
773
774     return hr;
775 }
776
777 HRESULT CALLBACK IDBAsynchNotify_OnLowResource_Proxy(IDBAsynchNotify* This, DB_DWRESERVE dwReserved)
778 {
779     FIXME("(%p)->(%08x): stub\n", This, dwReserved);
780     return E_NOTIMPL;
781 }
782
783 HRESULT __RPC_STUB IDBAsynchNotify_OnLowResource_Stub(IDBAsynchNotify* This, DB_DWRESERVE dwReserved)
784 {
785     FIXME("(%p)->(%08x): stub\n", This, dwReserved);
786     return E_NOTIMPL;
787 }
788
789 HRESULT CALLBACK IDBAsynchNotify_OnProgress_Proxy(IDBAsynchNotify* This, HCHAPTER hChapter, DBASYNCHOP eOperation,
790                                                   DBCOUNTITEM ulProgress, DBCOUNTITEM ulProgressMax, DBASYNCHPHASE eAsynchPhase,
791                                                   LPOLESTR pwszStatusText)
792 {
793     FIXME("(%p)->(%lx, %d, %d, %d, %d, %s): stub\n", This, hChapter, eOperation, ulProgress, ulProgressMax,
794           eAsynchPhase, debugstr_w(pwszStatusText));
795     return E_NOTIMPL;
796 }
797
798 HRESULT __RPC_STUB IDBAsynchNotify_OnProgress_Stub(IDBAsynchNotify* This, HCHAPTER hChapter, DBASYNCHOP eOperation,
799                                                    DBCOUNTITEM ulProgress, DBCOUNTITEM ulProgressMax, DBASYNCHPHASE eAsynchPhase,
800                                                    LPOLESTR pwszStatusText)
801 {
802     FIXME("(%p)->(%lx, %d, %d, %d, %d, %s): stub\n", This, hChapter, eOperation, ulProgress, ulProgressMax,
803           eAsynchPhase, debugstr_w(pwszStatusText));
804     return E_NOTIMPL;
805 }
806
807 HRESULT CALLBACK IDBAsynchNotify_OnStop_Proxy(IDBAsynchNotify* This, HCHAPTER hChapter, DBASYNCHOP eOperation,
808                                               HRESULT hrStatus, LPOLESTR pwszStatusText)
809 {
810     FIXME("(%p)->(%lx, %d, %08x, %s): stub\n", This, hChapter, eOperation, hrStatus, debugstr_w(pwszStatusText));
811     return E_NOTIMPL;
812 }
813
814 HRESULT __RPC_STUB IDBAsynchNotify_OnStop_Stub(IDBAsynchNotify* This, HCHAPTER hChapter, DBASYNCHOP eOperation,
815                                                HRESULT hrStatus, LPOLESTR pwszStatusText)
816 {
817     FIXME("(%p)->(%lx, %d, %08x, %s): stub\n", This, hChapter, eOperation, hrStatus, debugstr_w(pwszStatusText));
818     return E_NOTIMPL;
819 }