2 * Copyright (C) 2012 Alistair Leslie-Hughes
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #define NONAMELESSUNION
22 #define NONAMELESSSTRUCT
31 #include "oledb_private.h"
33 #include "wine/debug.h"
34 #include "wine/unicode.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(oledb
);
38 DEFINE_GUID(DBPROPSET_DBINIT
, 0xc8b522bc, 0x5cf3, 0x11ce, 0xad, 0xe5, 0x00, 0xaa, 0x00, 0x44, 0x77, 0x3d);
40 typedef struct datainit
42 IDataInitialize IDataInitialize_iface
;
47 static inline datainit
*impl_from_IDataInitialize(IDataInitialize
*iface
)
49 return CONTAINING_RECORD(iface
, datainit
, IDataInitialize_iface
);
54 IDBInitialize IDBInitialize_iface
;
55 IDBProperties IDBProperties_iface
;
60 static inline dbinit
*impl_from_IDBInitialize(IDBInitialize
*iface
)
62 return CONTAINING_RECORD(iface
, dbinit
, IDBInitialize_iface
);
65 static inline dbinit
*impl_from_IDBProperties(IDBProperties
*iface
)
67 return CONTAINING_RECORD(iface
, dbinit
, IDBProperties_iface
);
70 static HRESULT WINAPI
dbprops_QueryInterface(IDBProperties
*iface
, REFIID riid
, void **ppvObject
)
72 dbinit
*This
= impl_from_IDBProperties(iface
);
74 return IDBInitialize_QueryInterface(&This
->IDBInitialize_iface
, riid
, ppvObject
);
77 static ULONG WINAPI
dbprops_AddRef(IDBProperties
*iface
)
79 dbinit
*This
= impl_from_IDBProperties(iface
);
81 return IDBInitialize_AddRef(&This
->IDBInitialize_iface
);
84 static ULONG WINAPI
dbprops_Release(IDBProperties
*iface
)
86 dbinit
*This
= impl_from_IDBProperties(iface
);
88 return IDBInitialize_Release(&This
->IDBInitialize_iface
);
91 static HRESULT WINAPI
dbprops_GetProperties(IDBProperties
*iface
, ULONG cPropertyIDSets
,
92 const DBPROPIDSET rgPropertyIDSets
[], ULONG
*pcPropertySets
, DBPROPSET
**prgPropertySets
)
94 dbinit
*This
= impl_from_IDBProperties(iface
);
96 FIXME("(%p)->(%d %p %p %p)\n", This
, cPropertyIDSets
, rgPropertyIDSets
, pcPropertySets
, prgPropertySets
);
101 static HRESULT WINAPI
dbprops_GetPropertyInfo(IDBProperties
*iface
, ULONG cPropertyIDSets
,
102 const DBPROPIDSET rgPropertyIDSets
[], ULONG
*pcPropertyInfoSets
,
103 DBPROPINFOSET
**prgPropertyInfoSets
, OLECHAR
**ppDescBuffer
)
105 dbinit
*This
= impl_from_IDBProperties(iface
);
107 FIXME("(%p)->(%d %p %p %p %p)\n", This
, cPropertyIDSets
, rgPropertyIDSets
, pcPropertyInfoSets
,
108 prgPropertyInfoSets
, ppDescBuffer
);
113 static HRESULT WINAPI
dbprops_SetProperties(IDBProperties
*iface
, ULONG cPropertySets
,
114 DBPROPSET rgPropertySets
[])
116 dbinit
*This
= impl_from_IDBProperties(iface
);
118 FIXME("(%p)->(%d %p)\n", This
, cPropertySets
, rgPropertySets
);
123 static const struct IDBPropertiesVtbl dbprops_vtbl
=
125 dbprops_QueryInterface
,
128 dbprops_GetProperties
,
129 dbprops_GetPropertyInfo
,
130 dbprops_SetProperties
133 static HRESULT WINAPI
dbinit_QueryInterface(IDBInitialize
*iface
, REFIID riid
, void **obj
)
135 dbinit
*This
= impl_from_IDBInitialize(iface
);
136 TRACE("(%p)->(%s, %p)\n", This
, debugstr_guid(riid
), obj
);
140 if(IsEqualIID(riid
, &IID_IUnknown
) ||
141 IsEqualIID(riid
, &IID_IDBInitialize
))
145 else if(IsEqualIID(riid
, &IID_IDBProperties
))
147 *obj
= &This
->IDBProperties_iface
;
151 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
152 return E_NOINTERFACE
;
155 IDBInitialize_AddRef(iface
);
159 static ULONG WINAPI
dbinit_AddRef(IDBInitialize
*iface
)
161 dbinit
*This
= impl_from_IDBInitialize(iface
);
162 TRACE("(%p)\n", This
);
164 return InterlockedIncrement(&This
->ref
);
167 static ULONG WINAPI
dbinit_Release(IDBInitialize
*iface
)
169 dbinit
*This
= impl_from_IDBInitialize(iface
);
172 TRACE("(%p)\n", This
);
174 ref
= InterlockedDecrement(&This
->ref
);
177 HeapFree(GetProcessHeap(), 0, This
);
183 static HRESULT WINAPI
dbinit_Initialize(IDBInitialize
*iface
)
185 dbinit
*This
= impl_from_IDBInitialize(iface
);
187 FIXME("(%p) stub\n", This
);
192 static HRESULT WINAPI
dbinit_Uninitialize(IDBInitialize
*iface
)
194 dbinit
*This
= impl_from_IDBInitialize(iface
);
196 FIXME("(%p) stub\n", This
);
201 static const IDBInitializeVtbl dbinit_vtbl
=
203 dbinit_QueryInterface
,
210 static HRESULT
create_db_init(void **obj
)
218 This
= HeapAlloc(GetProcessHeap(), 0, sizeof(*This
));
219 if(!This
) return E_OUTOFMEMORY
;
221 This
->IDBInitialize_iface
.lpVtbl
= &dbinit_vtbl
;
222 This
->IDBProperties_iface
.lpVtbl
= &dbprops_vtbl
;
225 *obj
= &This
->IDBInitialize_iface
;
230 static HRESULT WINAPI
datainit_QueryInterface(IDataInitialize
*iface
, REFIID riid
, void **obj
)
232 datainit
*This
= impl_from_IDataInitialize(iface
);
233 TRACE("(%p)->(%s, %p)\n", This
, debugstr_guid(riid
), obj
);
237 if(IsEqualIID(riid
, &IID_IUnknown
) ||
238 IsEqualIID(riid
, &IID_IDataInitialize
))
240 *obj
= &This
->IDataInitialize_iface
;
244 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
245 return E_NOINTERFACE
;
248 IDataInitialize_AddRef(iface
);
252 static ULONG WINAPI
datainit_AddRef(IDataInitialize
*iface
)
254 datainit
*This
= impl_from_IDataInitialize(iface
);
255 TRACE("(%p)\n", This
);
257 return InterlockedIncrement(&This
->ref
);
260 static ULONG WINAPI
datainit_Release(IDataInitialize
*iface
)
262 datainit
*This
= impl_from_IDataInitialize(iface
);
265 TRACE("(%p)\n", This
);
267 ref
= InterlockedDecrement(&This
->ref
);
270 HeapFree(GetProcessHeap(), 0, This
);
276 static void free_dbpropset(ULONG count
, DBPROPSET
*propset
)
280 for (i
= 0; i
< count
; i
++)
284 for (p
= 0; p
< propset
[i
].cProperties
; p
++)
285 VariantClear(&propset
[i
].rgProperties
[p
].vValue
);
287 CoTaskMemFree(propset
[i
].rgProperties
);
289 CoTaskMemFree(propset
);
295 DBPROPOPTIONS options
;
299 static const WCHAR conn_timeout
[] = {'C','o','n','n','e','c','t',' ','T','i','m','e','o','u','t',0};
300 static const WCHAR datasourceW
[] = {'D','a','t','a',' ','S','o','u','r','c','e',0};
301 static const WCHAR extendedW
[] = {'E','x','t','e','n','d','e','d',' ','P','r','o','p','e','r','t','i','e','s',0};
302 static const WCHAR gen_timeout
[] = {'G','e','n','e','r','a','l',' ','T','i','m','e','o','u','t',0};
303 static const WCHAR initcatW
[] = {'I','n','i','t','i','a','l',' ','C','a','t','a','l','o','g',0};
304 static const WCHAR localeIDW
[] = {'L','o','c','a','l','e',' ','I','d','e','n','t','i','f','i','e','r',0};
305 static const WCHAR locationW
[] = {'L','o','c','a','t','i','o','n',0};
306 static const WCHAR modeW
[] = {'M','o','d','e',0};
307 static const WCHAR oledbservW
[] = {'O','L','E',' ','D','B',' ','S','e','r','v','i','c','i','e','s',0};
308 static const WCHAR passwordW
[] = {'P','a','s','s','w','o','r','d',0};
309 static const WCHAR persistW
[] = {'P','e','r','s','i','s','t',' ','S','e','c','u','r','i','t','y',' ','I','n','f','o',0};
310 static const WCHAR promptW
[] = {'P','r','o','m','p','t',0};
311 static const WCHAR useridW
[] = {'U','s','e','r',' ','I','D',0};
312 static const WCHAR winhandleW
[] = {'W','i','n','d','o','w',' ','H','a','n','d','l','e',0};
314 static const struct dbproperty dbproperties
[] = {
315 { conn_timeout
,DBPROP_INIT_TIMEOUT
, DBPROPOPTIONS_OPTIONAL
, VT_I4
},
316 { datasourceW
, DBPROP_INIT_DATASOURCE
, DBPROPOPTIONS_REQUIRED
, VT_BSTR
},
317 { extendedW
, DBPROP_INIT_PROVIDERSTRING
, DBPROPOPTIONS_REQUIRED
, VT_BSTR
},
318 { gen_timeout
, DBPROP_INIT_GENERALTIMEOUT
, DBPROPOPTIONS_OPTIONAL
, VT_I4
},
319 { initcatW
, DBPROP_CATALOGLOCATION
, DBPROPOPTIONS_OPTIONAL
, VT_BSTR
},
320 { localeIDW
, DBPROP_INIT_LCID
, DBPROPOPTIONS_OPTIONAL
, VT_I4
},
321 { locationW
, DBPROP_INIT_LOCATION
, DBPROPOPTIONS_OPTIONAL
, VT_BSTR
},
322 { modeW
, DBPROP_INIT_MODE
, DBPROPOPTIONS_OPTIONAL
, VT_I4
},
323 { oledbservW
, DBPROP_INIT_OLEDBSERVICES
, DBPROPOPTIONS_OPTIONAL
, VT_I4
},
324 { passwordW
, DBPROP_AUTH_PASSWORD
, DBPROPOPTIONS_OPTIONAL
, VT_BSTR
},
325 { persistW
, DBPROP_AUTH_PERSIST_SENSITIVE_AUTHINFO
, DBPROPOPTIONS_OPTIONAL
, VT_BOOL
},
326 { promptW
, DBPROP_INIT_PROMPT
, DBPROPOPTIONS_OPTIONAL
, VT_I2
},
327 { useridW
, DBPROP_AUTH_USERID
, DBPROPOPTIONS_OPTIONAL
, VT_BSTR
},
329 { winhandleW
, DBPROP_INIT_HWND
, DBPROPOPTIONS_OPTIONAL
, VT_I4
},
331 { winhandleW
, DBPROP_INIT_HWND
, DBPROPOPTIONS_OPTIONAL
, VT_I8
},
336 static HRESULT
set_dbpropset(BSTR name
, BSTR value
, DBPROPSET
**propset
)
343 max
= sizeof(dbproperties
)/sizeof(struct dbproperty
) - 1;
351 r
= strcmpW(dbproperties
[n
].name
, name
);
364 FIXME("unsupported property %s\n", debugstr_w(name
));
370 V_VT(&src
) = VT_BSTR
;
371 V_BSTR(&src
) = value
;
373 hr
= VariantChangeType(&dest
, &src
, 0, dbproperties
[n
].type
);
376 ERR("failed to init property %s value as type %d\n", debugstr_w(name
), dbproperties
[n
].type
);
380 *propset
= CoTaskMemAlloc(sizeof(DBPROPSET
));
384 return E_OUTOFMEMORY
;
387 (*propset
)->rgProperties
= CoTaskMemAlloc(sizeof(DBPROP
));
388 if (!(*propset
)->rgProperties
)
391 CoTaskMemFree(*propset
);
392 return E_OUTOFMEMORY
;
395 (*propset
)->cProperties
= 1;
396 (*propset
)->guidPropertySet
= DBPROPSET_DBINIT
;
397 (*propset
)->rgProperties
[0].dwPropertyID
= dbproperties
[n
].id
;
398 (*propset
)->rgProperties
[0].dwOptions
= dbproperties
[n
].options
;
399 (*propset
)->rgProperties
[0].dwStatus
= 0;
400 memset(&(*propset
)->rgProperties
[0].colid
, 0, sizeof(DBID
));
401 (*propset
)->rgProperties
[0].vValue
= dest
;
406 /*** IDataInitialize methods ***/
407 static HRESULT WINAPI
datainit_GetDataSource(IDataInitialize
*iface
, IUnknown
*outer
, DWORD clsctx
,
408 LPWSTR initstring
, REFIID riid
, IUnknown
**datasource
)
410 static const WCHAR providerW
[] = {'P','r','o','v','i','d','e','r','=',0};
411 static const WCHAR msdasqlW
[] = {'M','S','D','A','S','Q','L',0};
412 datainit
*This
= impl_from_IDataInitialize(iface
);
413 IDBProperties
*dbprops
;
419 TRACE("(%p)->(%p 0x%x %s %s %p)\n", This
, outer
, clsctx
, debugstr_w(initstring
), debugstr_guid(riid
), datasource
);
421 /* first get provider name */
422 provclsid
= IID_NULL
;
423 if (initstring
&& (prov
= strstrW(initstring
, providerW
)))
425 WCHAR
*start
, *progid
;
428 prov
+= sizeof(providerW
)/sizeof(WCHAR
)-1;
430 while (*prov
&& *prov
!= ';')
432 TRACE("got provider %s\n", debugstr_wn(start
, prov
-start
));
435 progid
= CoTaskMemAlloc((len
+1)*sizeof(WCHAR
));
436 if (!progid
) return E_OUTOFMEMORY
;
438 memcpy(progid
, start
, len
*sizeof(WCHAR
));
441 hr
= CLSIDFromProgID(progid
, &provclsid
);
442 CoTaskMemFree(progid
);
445 ERR("provider %s not registered\n", debugstr_wn(start
, prov
-start
));
451 hr
= CLSIDFromProgID(msdasqlW
, &provclsid
);
453 ERR("ODBC provider for OLE DB not registered\n");
456 /* check for provider mismatch if it was specified in init string */
457 if (*datasource
&& prov
)
459 DBPROPIDSET propidset
;
460 enum DBPROPENUM prop
;
464 hr
= IUnknown_QueryInterface(*datasource
, &IID_IDBProperties
, (void**)&dbprops
);
467 WARN("provider doesn't support IDBProperties\n");
471 prop
= DBPROP_INIT_DATASOURCE
;
472 propidset
.rgPropertyIDs
= &prop
;
473 propidset
.cPropertyIDs
= 1;
474 propidset
.guidPropertySet
= DBPROPSET_DBINIT
;
477 hr
= IDBProperties_GetProperties(dbprops
, 1, &propidset
, &count
, &propset
);
478 IDBProperties_Release(dbprops
);
481 WARN("GetProperties failed for datasource, 0x%08x\n", hr
);
485 TRACE("initial data source provider %s\n", debugstr_w(V_BSTR(&propset
->rgProperties
[0].vValue
)));
487 CLSIDFromProgID(V_BSTR(&propset
->rgProperties
[0].vValue
), &initprov
);
488 free_dbpropset(count
, propset
);
490 if (!IsEqualIID(&provclsid
, &initprov
)) return DB_E_MISMATCHEDPROVIDER
;
495 if (!IsEqualIID(&provclsid
, &IID_NULL
))
496 hr
= CoCreateInstance(&provclsid
, outer
, clsctx
, riid
, (void**)datasource
);
498 if (FAILED(hr
) && IsEqualIID(riid
, &IID_IDBInitialize
))
499 hr
= create_db_init((void**)datasource
);
502 /* now set properties */
507 hr
= IUnknown_QueryInterface(*datasource
, &IID_IDBProperties
, (void**)&dbprops
);
510 WARN("provider doesn't support IDBProperties\n");
515 while (start
&& (eq
= strchrW(start
, '=')))
517 static const WCHAR providerW
[] = {'P','r','o','v','i','d','e','r',0};
518 WCHAR
*scol
= strchrW(eq
+1, ';');
521 name
= SysAllocStringLen(start
, eq
- start
);
522 /* skip equal sign to get value */
524 value
= SysAllocStringLen(eq
, scol
? scol
- eq
: -1);
526 /* skip semicolon if present */
530 if (!strcmpW(name
, providerW
))
533 SysFreeString(value
);
537 TRACE("property (name=%s, value=%s)\n", debugstr_w(name
), debugstr_w(value
));
539 hr
= set_dbpropset(name
, value
, &propset
);
541 SysFreeString(value
);
542 if (FAILED(hr
)) return hr
;
544 hr
= IDBProperties_SetProperties(dbprops
, 1, propset
);
545 free_dbpropset(1, propset
);
546 TRACE("provider ret 0x%08x\n", hr
);
549 IDBProperties_Release(dbprops
);
555 /* returns character length of string representation */
556 static int get_propvalue_length(DBPROP
*prop
)
561 if (V_VT(&prop
->vValue
) == VT_BSTR
) return SysStringLen(V_BSTR(&prop
->vValue
));
564 hr
= VariantChangeType(&str
, &prop
->vValue
, 0, VT_BSTR
);
567 int len
= SysStringLen(V_BSTR(&str
));
575 static void write_propvalue_str(WCHAR
*str
, DBPROP
*prop
)
577 VARIANT
*v
= &prop
->vValue
;
581 if (V_VT(v
) == VT_BSTR
)
583 strcatW(str
, V_BSTR(v
));
588 hr
= VariantChangeType(&vstr
, v
, VARIANT_ALPHABOOL
, VT_BSTR
);
591 strcatW(str
, V_BSTR(&vstr
));
596 static WCHAR
*get_propinfo_descr(DBPROP
*prop
, DBPROPINFOSET
*propinfoset
)
600 for (i
= 0; i
< propinfoset
->cPropertyInfos
; i
++)
601 if (propinfoset
->rgPropertyInfos
[i
].dwPropertyID
== prop
->dwPropertyID
)
602 return propinfoset
->rgPropertyInfos
[i
].pwszDescription
;
607 static void free_dbpropinfoset(ULONG count
, DBPROPINFOSET
*propinfoset
)
611 for (i
= 0; i
< count
; i
++)
615 for (p
= 0; p
< propinfoset
[i
].cPropertyInfos
; p
++)
616 VariantClear(&propinfoset
[i
].rgPropertyInfos
[p
].vValues
);
618 CoTaskMemFree(propinfoset
[i
].rgPropertyInfos
);
620 CoTaskMemFree(propinfoset
);
623 static HRESULT WINAPI
datainit_GetInitializationString(IDataInitialize
*iface
, IUnknown
*datasource
,
624 boolean include_pass
, LPWSTR
*init_string
)
626 static const WCHAR provW
[] = {'P','r','o','v','i','d','e','r','=',0};
627 static const WCHAR colW
[] = {';',0};
628 datainit
*This
= impl_from_IDataInitialize(iface
);
629 DBPROPINFOSET
*propinfoset
;
630 IDBProperties
*props
;
631 DBPROPIDSET propidset
;
632 ULONG count
, infocount
;
633 WCHAR
*progid
, *desc
;
640 TRACE("(%p)->(%p %d %p)\n", This
, datasource
, include_pass
, init_string
);
642 /* IPersist support is mandatory for data sources */
643 hr
= IUnknown_QueryInterface(datasource
, &IID_IPersist
, (void**)&persist
);
644 if (FAILED(hr
)) return hr
;
646 memset(&clsid
, 0, sizeof(clsid
));
647 hr
= IPersist_GetClassID(persist
, &clsid
);
648 IPersist_Release(persist
);
649 if (FAILED(hr
)) return hr
;
652 ProgIDFromCLSID(&clsid
, &progid
);
653 TRACE("clsid=%s, progid=%s\n", debugstr_guid(&clsid
), debugstr_w(progid
));
655 /* now get initialization properties */
656 hr
= IUnknown_QueryInterface(datasource
, &IID_IDBProperties
, (void**)&props
);
659 WARN("IDBProperties not supported\n");
660 CoTaskMemFree(progid
);
664 propidset
.rgPropertyIDs
= NULL
;
665 propidset
.cPropertyIDs
= 0;
666 propidset
.guidPropertySet
= DBPROPSET_DBINIT
;
669 hr
= IDBProperties_GetProperties(props
, 1, &propidset
, &count
, &propset
);
672 WARN("failed to get data source properties, 0x%08x\n", hr
);
673 CoTaskMemFree(progid
);
678 IDBProperties_GetPropertyInfo(props
, 1, &propidset
, &infocount
, &propinfoset
, &desc
);
679 IDBProperties_Release(props
);
681 /* check if we need to skip password */
682 len
= strlenW(progid
) + strlenW(provW
) + 1; /* including ';' */
683 for (i
= 0; i
< count
; i
++)
685 WCHAR
*descr
= get_propinfo_descr(&propset
->rgProperties
[i
], propinfoset
);
688 /* include '=' and ';' */
689 len
+= strlenW(descr
) + 2;
690 len
+= get_propvalue_length(&propset
->rgProperties
[i
]);
693 if ((propset
->rgProperties
[i
].dwPropertyID
== DBPROP_AUTH_PERSIST_SENSITIVE_AUTHINFO
) &&
694 (V_BOOL(&propset
->rgProperties
[i
].vValue
) == VARIANT_FALSE
))
695 include_pass
= FALSE
;
698 len
*= sizeof(WCHAR
);
699 *init_string
= CoTaskMemAlloc(len
);
703 strcatW(*init_string
, provW
);
704 strcatW(*init_string
, progid
);
705 strcatW(*init_string
, colW
);
706 CoTaskMemFree(progid
);
708 for (i
= 0; i
< count
; i
++)
712 if (!include_pass
&& propset
->rgProperties
[i
].dwPropertyID
== DBPROP_AUTH_PASSWORD
) continue;
714 descr
= get_propinfo_descr(&propset
->rgProperties
[i
], propinfoset
);
717 static const WCHAR eqW
[] = {'=',0};
718 strcatW(*init_string
, descr
);
719 strcatW(*init_string
, eqW
);
720 write_propvalue_str(*init_string
, &propset
->rgProperties
[i
]);
721 strcatW(*init_string
, colW
);
725 free_dbpropset(count
, propset
);
726 free_dbpropinfoset(infocount
, propinfoset
);
730 TRACE("%s\n", debugstr_w(*init_string
));
734 static HRESULT WINAPI
datainit_CreateDBInstance(IDataInitialize
*iface
, REFCLSID provider
,
735 IUnknown
*outer
, DWORD clsctx
, LPWSTR reserved
, REFIID riid
,
736 IUnknown
**datasource
)
738 datainit
*This
= impl_from_IDataInitialize(iface
);
740 TRACE("(%p)->(%s %p 0x%08x %s %s %p)\n", This
, debugstr_guid(provider
), outer
, clsctx
, debugstr_w(reserved
),
741 debugstr_guid(riid
), datasource
);
743 return CoCreateInstance(provider
, outer
, clsctx
, riid
, (void**)datasource
);
746 static HRESULT WINAPI
datainit_RemoteCreateDBInstanceEx(IDataInitialize
*iface
, REFCLSID clsidProvider
,
747 IUnknown
*pUnkOuter
, DWORD dwClsCtx
, LPWSTR pwszReserved
, COSERVERINFO
*pServerInfo
,
748 DWORD cmq
, GUID
**rgpIID
, IUnknown
**rgpItf
, HRESULT
*rghr
)
750 datainit
*This
= impl_from_IDataInitialize(iface
);
752 FIXME("(%p)->()\n", This
);
757 static HRESULT WINAPI
datainit_LoadStringFromStorage(IDataInitialize
*iface
, LPWSTR pwszFileName
,
758 LPWSTR
*ppwszInitializationString
)
760 datainit
*This
= impl_from_IDataInitialize(iface
);
762 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(pwszFileName
), ppwszInitializationString
);
767 static HRESULT WINAPI
datainit_WriteStringToStorage(IDataInitialize
*iface
, LPWSTR pwszFileName
,
768 LPWSTR pwszInitializationString
, DWORD dwCreationDisposition
)
770 datainit
*This
= impl_from_IDataInitialize(iface
);
772 FIXME("(%p)->(%s %s %d)\n", This
, debugstr_w(pwszFileName
), debugstr_w(pwszInitializationString
), dwCreationDisposition
);
778 static const struct IDataInitializeVtbl datainit_vtbl
=
780 datainit_QueryInterface
,
783 datainit_GetDataSource
,
784 datainit_GetInitializationString
,
785 datainit_CreateDBInstance
,
786 datainit_RemoteCreateDBInstanceEx
,
787 datainit_LoadStringFromStorage
,
788 datainit_WriteStringToStorage
791 HRESULT
create_data_init(IUnknown
*outer
, void **obj
)
795 TRACE("(%p)\n", obj
);
797 if(outer
) return CLASS_E_NOAGGREGATION
;
801 This
= HeapAlloc(GetProcessHeap(), 0, sizeof(*This
));
802 if(!This
) return E_OUTOFMEMORY
;
804 This
->IDataInitialize_iface
.lpVtbl
= &datainit_vtbl
;
807 *obj
= &This
->IDataInitialize_iface
;