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