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"
35 WINE_DEFAULT_DEBUG_CHANNEL(oledb
);
38 typedef struct datainit
40 IDataInitialize IDataInitialize_iface
;
45 static inline datainit
*impl_from_IDataInitialize(IDataInitialize
*iface
)
47 return CONTAINING_RECORD(iface
, datainit
, IDataInitialize_iface
);
50 static HRESULT WINAPI
datainit_QueryInterface(IDataInitialize
*iface
, REFIID riid
, void **obj
)
52 datainit
*This
= impl_from_IDataInitialize(iface
);
53 TRACE("(%p)->(%s, %p)\n", This
, debugstr_guid(riid
), obj
);
57 if(IsEqualIID(riid
, &IID_IUnknown
) ||
58 IsEqualIID(riid
, &IID_IDataInitialize
))
60 *obj
= &This
->IDataInitialize_iface
;
64 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
68 IDataInitialize_AddRef(iface
);
72 static ULONG WINAPI
datainit_AddRef(IDataInitialize
*iface
)
74 datainit
*This
= impl_from_IDataInitialize(iface
);
75 TRACE("(%p)\n", This
);
77 return InterlockedIncrement(&This
->ref
);
80 static ULONG WINAPI
datainit_Release(IDataInitialize
*iface
)
82 datainit
*This
= impl_from_IDataInitialize(iface
);
85 TRACE("(%p)\n", This
);
87 ref
= InterlockedDecrement(&This
->ref
);
90 HeapFree(GetProcessHeap(), 0, This
);
96 /*** IDataInitialize methods ***/
97 static HRESULT WINAPI
datainit_GetDataSource(IDataInitialize
*iface
, IUnknown
*pUnkOuter
, DWORD dwClsCtx
,
98 LPWSTR pwszInitializationString
, REFIID riid
, IUnknown
**ppDataSource
)
100 datainit
*This
= impl_from_IDataInitialize(iface
);
102 FIXME("(%p)->(%p %d %s %s %p)\n", This
, pUnkOuter
, dwClsCtx
, debugstr_w(pwszInitializationString
),
103 debugstr_guid(riid
), ppDataSource
);
108 static HRESULT WINAPI
datainit_GetInitializationString(IDataInitialize
*iface
, IUnknown
*pDataSource
,
109 boolean fIncludePassword
, LPWSTR
*ppwszInitString
)
111 datainit
*This
= impl_from_IDataInitialize(iface
);
113 FIXME("(%p)->(%p %d %p)\n", This
, pDataSource
, fIncludePassword
, ppwszInitString
);
118 static HRESULT WINAPI
datainit_CreateDBInstance(IDataInitialize
*iface
, REFCLSID clsidProvider
,
119 IUnknown
*pUnkOuter
, DWORD dwClsCtx
, LPWSTR pwszReserved
, REFIID riid
,
120 IUnknown
**ppDataSource
)
122 datainit
*This
= impl_from_IDataInitialize(iface
);
124 FIXME("(%p)->()\n", This
);
129 static HRESULT WINAPI
datainit_RemoteCreateDBInstanceEx(IDataInitialize
*iface
, REFCLSID clsidProvider
,
130 IUnknown
*pUnkOuter
, DWORD dwClsCtx
, LPWSTR pwszReserved
, COSERVERINFO
*pServerInfo
,
131 DWORD cmq
, GUID
**rgpIID
, IUnknown
**rgpItf
, HRESULT
*rghr
)
133 datainit
*This
= impl_from_IDataInitialize(iface
);
135 FIXME("(%p)->()\n", This
);
140 static HRESULT WINAPI
datainit_LoadStringFromStorage(IDataInitialize
*iface
, LPWSTR pwszFileName
,
141 LPWSTR
*ppwszInitializationString
)
143 datainit
*This
= impl_from_IDataInitialize(iface
);
145 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(pwszFileName
), ppwszInitializationString
);
150 static HRESULT WINAPI
datainit_WriteStringToStorage(IDataInitialize
*iface
, LPWSTR pwszFileName
,
151 LPWSTR pwszInitializationString
, DWORD dwCreationDisposition
)
153 datainit
*This
= impl_from_IDataInitialize(iface
);
155 FIXME("(%p)->(%s %s %d)\n", This
, debugstr_w(pwszFileName
), debugstr_w(pwszInitializationString
), dwCreationDisposition
);
161 static const struct IDataInitializeVtbl datainit_vtbl
=
163 datainit_QueryInterface
,
166 datainit_GetDataSource
,
167 datainit_GetInitializationString
,
168 datainit_CreateDBInstance
,
169 datainit_RemoteCreateDBInstanceEx
,
170 datainit_LoadStringFromStorage
,
171 datainit_WriteStringToStorage
174 HRESULT
create_data_init(IUnknown
*outer
, void **obj
)
178 TRACE("(%p)\n", obj
);
180 if(outer
) return CLASS_E_NOAGGREGATION
;
184 This
= HeapAlloc(GetProcessHeap(), 0, sizeof(*This
));
185 if(!This
) return E_OUTOFMEMORY
;
187 This
->IDataInitialize_iface
.lpVtbl
= &datainit_vtbl
;
190 *obj
= &This
->IDataInitialize_iface
;