msvcrt: Fix possible deadlock in dup2 function.
[wine.git] / dlls / oledb32 / dslocator.c
blob4af4ab4141e9205febc4d57bef6ad1d84cb89c47
1 /* Data Links
3 * Copyright 2013 Alistair Leslie-Hughes
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include <stdarg.h>
20 #include <string.h>
22 #define COBJMACROS
24 #include "windef.h"
25 #include "winbase.h"
26 #include "objbase.h"
27 #include "oleauto.h"
28 #include "winerror.h"
29 #include "oledb.h"
30 #include "oledberr.h"
31 #include "msdasc.h"
33 #include "oledb_private.h"
35 #include "wine/debug.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(oledb);
40 typedef struct DSLocatorImpl
42 IDataSourceLocator IDataSourceLocator_iface;
43 LONG ref;
45 HWND hwnd;
46 } DSLocatorImpl;
48 static inline DSLocatorImpl *impl_from_IDataSourceLocator( IDataSourceLocator *iface )
50 return CONTAINING_RECORD(iface, DSLocatorImpl, IDataSourceLocator_iface);
54 static HRESULT WINAPI dslocator_QueryInterface(IDataSourceLocator *iface, REFIID riid, void **ppvoid)
56 DSLocatorImpl *This = impl_from_IDataSourceLocator(iface);
57 TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid),ppvoid);
59 *ppvoid = NULL;
61 if (IsEqualIID(riid, &IID_IUnknown) ||
62 IsEqualIID(riid, &IID_IDispatch) ||
63 IsEqualIID(riid, &IID_IDataSourceLocator))
65 *ppvoid = &This->IDataSourceLocator_iface;
68 if(*ppvoid)
70 IUnknown_AddRef( (IUnknown*)*ppvoid );
71 return S_OK;
74 FIXME("interface %s not implemented\n", debugstr_guid(riid));
75 return E_NOINTERFACE;
78 static ULONG WINAPI dslocator_AddRef(IDataSourceLocator *iface)
80 DSLocatorImpl *This = impl_from_IDataSourceLocator(iface);
81 TRACE("(%p)->%u\n",This,This->ref);
82 return InterlockedIncrement(&This->ref);
85 static ULONG WINAPI dslocator_Release(IDataSourceLocator *iface)
87 DSLocatorImpl *This = impl_from_IDataSourceLocator(iface);
88 ULONG ref = InterlockedDecrement(&This->ref);
90 TRACE("(%p)->%u\n",This,ref+1);
92 if (!ref)
94 heap_free(This);
97 return ref;
100 static HRESULT WINAPI dslocator_GetTypeInfoCount(IDataSourceLocator *iface, UINT *pctinfo)
102 DSLocatorImpl *This = impl_from_IDataSourceLocator(iface);
104 FIXME("(%p)->()\n", This);
106 return E_NOTIMPL;
109 static HRESULT WINAPI dslocator_GetTypeInfo(IDataSourceLocator *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
111 DSLocatorImpl *This = impl_from_IDataSourceLocator(iface);
113 FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
115 return E_NOTIMPL;
118 static HRESULT WINAPI dslocator_GetIDsOfNames(IDataSourceLocator *iface, REFIID riid, LPOLESTR *rgszNames,
119 UINT cNames, LCID lcid, DISPID *rgDispId)
121 DSLocatorImpl *This = impl_from_IDataSourceLocator(iface);
123 FIXME("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
125 return E_NOTIMPL;
128 static HRESULT WINAPI dslocator_Invoke(IDataSourceLocator *iface, DISPID dispIdMember, REFIID riid,
129 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
131 DSLocatorImpl *This = impl_from_IDataSourceLocator(iface);
133 FIXME("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
134 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
136 return E_NOTIMPL;
139 static HRESULT WINAPI dslocator_get_hWnd(IDataSourceLocator *iface, COMPATIBLE_LONG *phwndParent)
141 DSLocatorImpl *This = impl_from_IDataSourceLocator(iface);
143 TRACE("(%p)->(%p)\n",This, phwndParent);
145 *phwndParent = (COMPATIBLE_LONG)This->hwnd;
147 return S_OK;
150 static HRESULT WINAPI dslocator_put_hWnd(IDataSourceLocator *iface, COMPATIBLE_LONG hwndParent)
152 DSLocatorImpl *This = impl_from_IDataSourceLocator(iface);
154 TRACE("(%p)->(%p)\n",This, (HWND)hwndParent);
156 This->hwnd = (HWND)hwndParent;
158 return S_OK;
161 static HRESULT WINAPI dslocator_PromptNew(IDataSourceLocator *iface, IDispatch **ppADOConnection)
163 DSLocatorImpl *This = impl_from_IDataSourceLocator(iface);
165 FIXME("(%p)->(%p)\n",This, ppADOConnection);
167 return E_NOTIMPL;
170 static HRESULT WINAPI dslocator_PromptEdit(IDataSourceLocator *iface, IDispatch **ppADOConnection, VARIANT_BOOL *success)
172 DSLocatorImpl *This = impl_from_IDataSourceLocator(iface);
174 FIXME("(%p)->(%p %p)\n",This, ppADOConnection, success);
176 return E_NOTIMPL;
179 static const IDataSourceLocatorVtbl DSLocatorVtbl =
181 dslocator_QueryInterface,
182 dslocator_AddRef,
183 dslocator_Release,
184 dslocator_GetTypeInfoCount,
185 dslocator_GetTypeInfo,
186 dslocator_GetIDsOfNames,
187 dslocator_Invoke,
188 dslocator_get_hWnd,
189 dslocator_put_hWnd,
190 dslocator_PromptNew,
191 dslocator_PromptEdit
194 HRESULT create_dslocator(IUnknown *outer, void **obj)
196 DSLocatorImpl *This;
198 TRACE("(%p, %p)\n", outer, obj);
200 *obj = NULL;
202 if(outer) return CLASS_E_NOAGGREGATION;
204 This = heap_alloc(sizeof(*This));
205 if(!This) return E_OUTOFMEMORY;
207 This->IDataSourceLocator_iface.lpVtbl = &DSLocatorVtbl;
208 This->ref = 1;
209 This->hwnd = 0;
211 *obj = &This->IDataSourceLocator_iface;
213 return S_OK;