msdaps: Implement IDBCreateCommand_CreateCommand proxy and stub.
[wine/testsucceed.git] / dlls / msdaps / usrmarshal.c
blobcc4803c19954d6c046a91646980c6e879f1c57fe
1 /*
2 * Misc marshaling routinues
4 * Copyright 2009 Huw Davies
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #include <stdarg.h>
21 #include <string.h>
23 #define COBJMACROS
24 #define NONAMELESSUNION
25 #define NONAMELESSSTRUCT
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"
36 #include "wine/debug.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(oledb);
40 HRESULT CALLBACK IDBCreateCommand_CreateCommand_Proxy(IDBCreateCommand* This, IUnknown *pUnkOuter,
41 REFIID riid, IUnknown **ppCommand)
43 HRESULT hr;
44 IErrorInfo *error;
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)
50 SetErrorInfo(0, error);
51 IErrorInfo_Release(error);
53 return hr;
56 HRESULT __RPC_STUB IDBCreateCommand_CreateCommand_Stub(IDBCreateCommand* This, IUnknown *pUnkOuter,
57 REFIID riid, IUnknown **ppCommand, IErrorInfo **ppErrorInfoRem)
59 HRESULT hr;
61 TRACE("(%p, %p, %s, %p, %p)\n", This, pUnkOuter, debugstr_guid(riid), ppCommand, ppErrorInfoRem);
63 *ppErrorInfoRem = NULL;
64 hr = IDBCreateCommand_CreateCommand(This, pUnkOuter, riid, ppCommand);
65 if(FAILED(hr)) GetErrorInfo(0, ppErrorInfoRem);
67 return hr;
70 HRESULT CALLBACK IDBCreateSession_CreateSession_Proxy(IDBCreateSession* This, IUnknown *pUnkOuter,
71 REFIID riid, IUnknown **ppDBSession)
73 HRESULT hr;
74 IErrorInfo *error;
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)
80 SetErrorInfo(0, error);
81 IErrorInfo_Release(error);
83 return hr;
86 HRESULT __RPC_STUB IDBCreateSession_CreateSession_Stub(IDBCreateSession* This, IUnknown *pUnkOuter,
87 REFIID riid, IUnknown **ppDBSession, IErrorInfo **ppErrorInfoRem)
89 HRESULT hr;
90 TRACE("(%p, %p, %s, %p, %p)\n", This, pUnkOuter, debugstr_guid(riid),
91 ppDBSession, ppErrorInfoRem);
93 *ppErrorInfoRem = NULL;
94 hr = IDBCreateSession_CreateSession(This, pUnkOuter, riid, ppDBSession);
95 if(FAILED(hr)) GetErrorInfo(0, ppErrorInfoRem);
97 return hr;
100 HRESULT CALLBACK IDBProperties_GetProperties_Proxy(IDBProperties* This, ULONG cPropertyIDSets, const DBPROPIDSET rgPropertyIDSets[],
101 ULONG *pcPropertySets, DBPROPSET **prgPropertySets)
103 FIXME("(%p, %d, %p, %p, %p): stub\n", This, cPropertyIDSets, rgPropertyIDSets, pcPropertySets,
104 prgPropertySets);
105 return E_NOTIMPL;
108 HRESULT __RPC_STUB IDBProperties_GetProperties_Stub(IDBProperties* This, ULONG cPropertyIDSets, const DBPROPIDSET *rgPropertyIDSets,
109 ULONG *pcPropertySets, DBPROPSET **prgPropertySets, IErrorInfo **ppErrorInfoRem)
111 FIXME("(%p, %d, %p, %p, %p, %p): stub\n", This, cPropertyIDSets, rgPropertyIDSets, pcPropertySets,
112 prgPropertySets, ppErrorInfoRem);
113 return E_NOTIMPL;
116 HRESULT CALLBACK IDBProperties_GetPropertyInfo_Proxy(IDBProperties* This, ULONG cPropertyIDSets, const DBPROPIDSET rgPropertyIDSets[],
117 ULONG *pcPropertyInfoSets, DBPROPINFOSET **prgPropertyInfoSets,
118 OLECHAR **ppDescBuffer)
120 FIXME("(%p, %d, %p, %p, %p, %p): stub\n", This, cPropertyIDSets, rgPropertyIDSets, pcPropertyInfoSets,
121 prgPropertyInfoSets, ppDescBuffer);
122 return E_NOTIMPL;
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)
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;
135 HRESULT CALLBACK IDBProperties_SetProperties_Proxy(IDBProperties* This, ULONG cPropertySets, DBPROPSET rgPropertySets[])
137 ULONG prop_set, prop, total_props = 0;
138 HRESULT hr;
139 IErrorInfo *error;
140 DBPROPSTATUS *status;
142 TRACE("(%p, %d, %p)\n", This, cPropertySets, rgPropertySets);
144 for(prop_set = 0; prop_set < cPropertySets; prop_set++)
145 total_props += rgPropertySets[prop_set].cProperties;
147 if(total_props == 0) return S_OK;
149 status = CoTaskMemAlloc(total_props * sizeof(*status));
150 if(!status) return E_OUTOFMEMORY;
152 hr = IDBProperties_RemoteSetProperties_Proxy(This, cPropertySets, rgPropertySets,
153 total_props, status, &error);
154 if(error)
156 SetErrorInfo(0, error);
157 IErrorInfo_Release(error);
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++];
165 CoTaskMemFree(status);
166 return hr;
169 HRESULT __RPC_STUB IDBProperties_SetProperties_Stub(IDBProperties* This, ULONG cPropertySets, DBPROPSET *rgPropertySets,
170 ULONG cTotalProps, DBPROPSTATUS *rgPropStatus, IErrorInfo **ppErrorInfoRem)
172 ULONG prop_set, prop, total_props = 0;
173 HRESULT hr;
175 TRACE("(%p, %d, %p, %d, %p, %p)\n", This, cPropertySets, rgPropertySets, cTotalProps,
176 rgPropStatus, ppErrorInfoRem);
178 *ppErrorInfoRem = NULL;
179 hr = IDBProperties_SetProperties(This, cPropertySets, rgPropertySets);
180 if(FAILED(hr)) GetErrorInfo(0, ppErrorInfoRem);
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;
186 return hr;
189 HRESULT CALLBACK IDBInitialize_Initialize_Proxy(IDBInitialize* This)
191 HRESULT hr;
192 IErrorInfo *error;
194 TRACE("(%p)\n", This);
195 hr = IDBInitialize_RemoteInitialize_Proxy(This, &error);
196 if(error)
198 SetErrorInfo(0, error);
199 IErrorInfo_Release(error);
201 return hr;
204 HRESULT __RPC_STUB IDBInitialize_Initialize_Stub(IDBInitialize* This, IErrorInfo **ppErrorInfoRem)
206 HRESULT hr;
207 TRACE("(%p, %p)\n", This, ppErrorInfoRem);
209 *ppErrorInfoRem = NULL;
210 hr = IDBInitialize_Initialize(This);
211 if(FAILED(hr)) GetErrorInfo(0, ppErrorInfoRem);
213 return hr;
216 HRESULT CALLBACK IDBInitialize_Uninitialize_Proxy(IDBInitialize* This)
218 FIXME("(%p): stub\n", This);
219 return E_NOTIMPL;
222 HRESULT __RPC_STUB IDBInitialize_Uninitialize_Stub(IDBInitialize* This, IErrorInfo **ppErrorInfoRem)
224 FIXME("(%p, %p): stub\n", This, ppErrorInfoRem);
225 return E_NOTIMPL;
228 HRESULT CALLBACK IDBDataSourceAdmin_CreateDataSource_Proxy(IDBDataSourceAdmin* This, ULONG cPropertySets,
229 DBPROPSET rgPropertySets[], IUnknown *pUnkOuter,
230 REFIID riid, IUnknown **ppDBSession)
232 FIXME("(%p, %d, %p, %p, %s, %p): stub\n", This, cPropertySets, rgPropertySets, pUnkOuter,
233 debugstr_guid(riid), ppDBSession);
234 return E_NOTIMPL;
237 HRESULT __RPC_STUB IDBDataSourceAdmin_CreateDataSource_Stub(IDBDataSourceAdmin* This, ULONG cPropertySets,
238 DBPROPSET *rgPropertySets, IUnknown *pUnkOuter,
239 REFIID riid, IUnknown **ppDBSession, ULONG cTotalProps,
240 DBPROPSTATUS *rgPropStatus, IErrorInfo **ppErrorInfoRem)
242 FIXME("(%p, %d, %p, %p, %s, %p, %d, %p, %p): stub\n", This, cPropertySets, rgPropertySets, pUnkOuter,
243 debugstr_guid(riid), ppDBSession, cTotalProps, rgPropStatus, ppErrorInfoRem);
244 return E_NOTIMPL;
247 HRESULT CALLBACK IDBDataSourceAdmin_DestroyDataSource_Proxy(IDBDataSourceAdmin* This)
249 FIXME("(%p): stub\n", This);
250 return E_NOTIMPL;
253 HRESULT __RPC_STUB IDBDataSourceAdmin_DestroyDataSource_Stub(IDBDataSourceAdmin* This, IErrorInfo **ppErrorInfoRem)
255 FIXME("(%p, %p): stub\n", This, ppErrorInfoRem);
256 return E_NOTIMPL;
259 HRESULT CALLBACK IDBDataSourceAdmin_GetCreationProperties_Proxy(IDBDataSourceAdmin* This, ULONG cPropertyIDSets,
260 const DBPROPIDSET rgPropertyIDSets[], ULONG *pcPropertyInfoSets,
261 DBPROPINFOSET **prgPropertyInfoSets, OLECHAR **ppDescBuffer)
263 FIXME("(%p, %d, %p, %p, %p, %p): stub\n", This, cPropertyIDSets, rgPropertyIDSets, pcPropertyInfoSets,
264 prgPropertyInfoSets, ppDescBuffer);
265 return E_NOTIMPL;
268 HRESULT __RPC_STUB IDBDataSourceAdmin_GetCreationProperties_Stub(IDBDataSourceAdmin* This, ULONG cPropertyIDSets,
269 const DBPROPIDSET *rgPropertyIDSets, ULONG *pcPropertyInfoSets,
270 DBPROPINFOSET **prgPropertyInfoSets, DBCOUNTITEM *pcOffsets,
271 DBBYTEOFFSET **prgDescOffsets, ULONG *pcbDescBuffer,
272 OLECHAR **ppDescBuffer, IErrorInfo **ppErrorInfoRem)
274 FIXME("(%p, %d, %p, %p, %p, %p, %p, %p, %p, %p): stub\n", This, cPropertyIDSets, rgPropertyIDSets, pcPropertyInfoSets,
275 prgPropertyInfoSets, pcOffsets, prgDescOffsets, pcbDescBuffer, ppDescBuffer, ppErrorInfoRem);
276 return E_NOTIMPL;
279 HRESULT CALLBACK IDBDataSourceAdmin_ModifyDataSource_Proxy(IDBDataSourceAdmin* This, ULONG cPropertySets, DBPROPSET rgPropertySets[])
281 FIXME("(%p, %d, %p): stub\n", This, cPropertySets, rgPropertySets);
282 return E_NOTIMPL;
285 HRESULT __RPC_STUB IDBDataSourceAdmin_ModifyDataSource_Stub(IDBDataSourceAdmin* This, ULONG cPropertySets,
286 DBPROPSET *rgPropertySets, IErrorInfo **ppErrorInfoRem)
288 FIXME("(%p, %d, %p, %p): stub\n", This, cPropertySets, rgPropertySets, ppErrorInfoRem);
289 return E_NOTIMPL;
292 HRESULT CALLBACK ISessionProperties_GetProperties_Proxy(ISessionProperties* This, ULONG cPropertyIDSets,
293 const DBPROPIDSET rgPropertyIDSets[], ULONG *pcPropertySets,
294 DBPROPSET **prgPropertySets)
296 FIXME("(%p, %d, %p, %p, %p): stub\n", This, cPropertyIDSets, rgPropertyIDSets,
297 pcPropertySets, prgPropertySets);
298 return E_NOTIMPL;
301 HRESULT __RPC_STUB ISessionProperties_GetProperties_Stub(ISessionProperties* This, ULONG cPropertyIDSets,
302 const DBPROPIDSET *rgPropertyIDSets, ULONG *pcPropertySets,
303 DBPROPSET **prgPropertySets, IErrorInfo **ppErrorInfoRem)
305 FIXME("(%p, %d, %p, %p, %p, %p): stub\n", This, cPropertyIDSets, rgPropertyIDSets,
306 pcPropertySets, prgPropertySets, ppErrorInfoRem);
307 return E_NOTIMPL;
310 HRESULT CALLBACK ISessionProperties_SetProperties_Proxy(ISessionProperties* This, ULONG cPropertySets, DBPROPSET rgPropertySets[])
312 ULONG prop_set, prop, total_props = 0;
313 HRESULT hr;
314 IErrorInfo *error;
315 DBPROPSTATUS *status;
317 TRACE("(%p, %d, %p)\n", This, cPropertySets, rgPropertySets);
319 for(prop_set = 0; prop_set < cPropertySets; prop_set++)
320 total_props += rgPropertySets[prop_set].cProperties;
322 if(total_props == 0) return S_OK;
324 status = CoTaskMemAlloc(total_props * sizeof(*status));
325 if(!status) return E_OUTOFMEMORY;
327 hr = ISessionProperties_RemoteSetProperties_Proxy(This, cPropertySets, rgPropertySets,
328 total_props, status, &error);
329 if(error)
331 SetErrorInfo(0, error);
332 IErrorInfo_Release(error);
335 total_props = 0;
336 for(prop_set = 0; prop_set < cPropertySets; prop_set++)
337 for(prop = 0; prop < rgPropertySets[prop_set].cProperties; prop++)
338 rgPropertySets[prop_set].rgProperties[prop].dwStatus = status[total_props++];
340 CoTaskMemFree(status);
341 return hr;
344 HRESULT __RPC_STUB ISessionProperties_SetProperties_Stub(ISessionProperties* This, ULONG cPropertySets, DBPROPSET *rgPropertySets,
345 ULONG cTotalProps, DBPROPSTATUS *rgPropStatus, IErrorInfo **ppErrorInfoRem)
347 ULONG prop_set, prop, total_props = 0;
348 HRESULT hr;
350 TRACE("(%p, %d, %p, %d, %p, %p)\n", This, cPropertySets, rgPropertySets, cTotalProps,
351 rgPropStatus, ppErrorInfoRem);
353 *ppErrorInfoRem = NULL;
354 hr = ISessionProperties_SetProperties(This, cPropertySets, rgPropertySets);
355 if(FAILED(hr)) GetErrorInfo(0, ppErrorInfoRem);
357 for(prop_set = 0; prop_set < cPropertySets; prop_set++)
358 for(prop = 0; prop < rgPropertySets[prop_set].cProperties; prop++)
359 rgPropStatus[total_props++] = rgPropertySets[prop_set].rgProperties[prop].dwStatus;
361 return hr;
364 HRESULT CALLBACK IOpenRowset_OpenRowset_Proxy(IOpenRowset* This, IUnknown *pUnkOuter, DBID *pTableID, DBID *pIndexID,
365 REFIID riid, ULONG cPropertySets, DBPROPSET rgPropertySets[], IUnknown **ppRowset)
367 FIXME("(%p, %p, %p, %p, %s, %d, %p, %p): stub\n", This, pUnkOuter, pTableID, pIndexID, debugstr_guid(riid),
368 cPropertySets, rgPropertySets, ppRowset);
369 return E_NOTIMPL;
372 HRESULT __RPC_STUB IOpenRowset_OpenRowset_Stub(IOpenRowset* This, IUnknown *pUnkOuter, DBID *pTableID, DBID *pIndexID,
373 REFIID riid, ULONG cPropertySets, DBPROPSET *rgPropertySets,
374 IUnknown **ppRowset, ULONG cTotalProps, DBPROPSTATUS *rgPropStatus,
375 IErrorInfo **ppErrorInfoRem)
377 FIXME("(%p, %p, %p, %p, %s, %d, %p, %p, %d, %p, %p): stub\n", This, pUnkOuter, pTableID, pIndexID, debugstr_guid(riid),
378 cPropertySets, rgPropertySets, ppRowset, cTotalProps, rgPropStatus, ppErrorInfoRem);
379 return E_NOTIMPL;
382 HRESULT CALLBACK IBindResource_Bind_Proxy(IBindResource* This, IUnknown *pUnkOuter, LPCOLESTR pwszURL, DBBINDURLFLAG dwBindURLFlags,
383 REFGUID rguid, REFIID riid, IAuthenticate *pAuthenticate, DBIMPLICITSESSION *pImplSession,
384 DBBINDURLSTATUS *pdwBindStatus, IUnknown **ppUnk)
386 FIXME("(%p, %p, %s, %08x, %s, %s, %p, %p, %p, %p): stub\n", This, pUnkOuter, debugstr_w(pwszURL), dwBindURLFlags,
387 debugstr_guid(rguid), debugstr_guid(riid), pAuthenticate, pImplSession, pdwBindStatus, ppUnk);
388 return E_NOTIMPL;
391 HRESULT __RPC_STUB IBindResource_Bind_Stub(IBindResource* This, IUnknown *pUnkOuter, LPCOLESTR pwszURL, DBBINDURLFLAG dwBindURLFlags,
392 REFGUID rguid, REFIID riid, IAuthenticate *pAuthenticate, IUnknown *pSessionUnkOuter,
393 IID *piid, IUnknown **ppSession, DBBINDURLSTATUS *pdwBindStatus, IUnknown **ppUnk)
395 FIXME("(%p, %p, %s, %08x, %s, %s, %p, %p, %p, %p, %p, %p): stub\n", This, pUnkOuter, debugstr_w(pwszURL), dwBindURLFlags,
396 debugstr_guid(rguid), debugstr_guid(riid), pAuthenticate, pSessionUnkOuter, piid, ppSession, pdwBindStatus, ppUnk);
397 return E_NOTIMPL;
400 HRESULT CALLBACK ICreateRow_CreateRow_Proxy(ICreateRow* This, IUnknown *pUnkOuter, LPCOLESTR pwszURL, DBBINDURLFLAG dwBindURLFlags,
401 REFGUID rguid, REFIID riid, IAuthenticate *pAuthenticate, DBIMPLICITSESSION *pImplSession,
402 DBBINDURLSTATUS *pdwBindStatus, LPOLESTR *ppwszNewURL, IUnknown **ppUnk)
404 HRESULT hr;
406 TRACE("(%p, %p, %s, %08x, %s, %s, %p, %p, %p, %p, %p)\n", This, pUnkOuter, debugstr_w(pwszURL), dwBindURLFlags,
407 debugstr_guid(rguid), debugstr_guid(riid), pAuthenticate, pImplSession, pdwBindStatus, ppwszNewURL, ppUnk);
409 hr = ICreateRow_RemoteCreateRow_Proxy(This, pUnkOuter, pwszURL, dwBindURLFlags, rguid, riid, pAuthenticate,
410 pImplSession ? pImplSession->pUnkOuter : NULL, pImplSession ? pImplSession->piid : NULL,
411 pImplSession ? &pImplSession->pSession : NULL, pdwBindStatus, ppwszNewURL, ppUnk);
412 return hr;
415 HRESULT __RPC_STUB ICreateRow_CreateRow_Stub(ICreateRow* This, IUnknown *pUnkOuter, LPCOLESTR pwszURL, DBBINDURLFLAG dwBindURLFlags,
416 REFGUID rguid, REFIID riid, IAuthenticate *pAuthenticate, IUnknown *pSessionUnkOuter,
417 IID *piid, IUnknown **ppSession, DBBINDURLSTATUS *pdwBindStatus,
418 LPOLESTR *ppwszNewURL, IUnknown **ppUnk)
420 HRESULT hr;
421 DBIMPLICITSESSION impl_session;
423 TRACE("(%p, %p, %s, %08x, %s, %s, %p, %p, %p, %p, %p, %p, %p)\n", This, pUnkOuter, debugstr_w(pwszURL), dwBindURLFlags,
424 debugstr_guid(rguid), debugstr_guid(riid), pAuthenticate, pSessionUnkOuter, piid, ppSession, pdwBindStatus, ppwszNewURL,
425 ppUnk);
427 impl_session.pUnkOuter = pSessionUnkOuter;
428 impl_session.piid = piid;
429 impl_session.pSession = NULL;
431 hr = ICreateRow_CreateRow(This, pUnkOuter, pwszURL, dwBindURLFlags, rguid, riid, pAuthenticate,
432 ppSession ? &impl_session : NULL, pdwBindStatus, ppwszNewURL, ppUnk);
434 if(ppSession) *ppSession = impl_session.pSession;
435 return hr;