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