localspl: Add unixname port extension.
[wine.git] / dlls / wiaservc / wiadevmgr.c
blobe0156b7f5a23b432c78a75da90d935bccf76cf68
1 /*
2 * WiaDevMgr functions
4 * Copyright 2009 Damjan Jovanovic
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
21 #define COBJMACROS
23 #include "objbase.h"
24 #include "wia_lh.h"
26 #include "wiaservc_private.h"
28 #include "wine/debug.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(wia);
32 typedef struct
34 IEnumWIA_DEV_INFO IEnumWIA_DEV_INFO_iface;
35 LONG ref;
36 } enumwiadevinfo;
38 static inline wiadevmgr *impl_from_IWiaDevMgr(IWiaDevMgr *iface)
40 return CONTAINING_RECORD(iface, wiadevmgr, IWiaDevMgr_iface);
43 static inline enumwiadevinfo *impl_from_IEnumWIA_DEV_INFO(IEnumWIA_DEV_INFO *iface)
45 return CONTAINING_RECORD(iface, enumwiadevinfo, IEnumWIA_DEV_INFO_iface);
48 static HRESULT WINAPI enumwiadevinfo_QueryInterface(IEnumWIA_DEV_INFO *iface, REFIID riid, void **obj)
50 enumwiadevinfo *This = impl_from_IEnumWIA_DEV_INFO(iface);
52 TRACE("(%p, %s, %p)\n", This, debugstr_guid(riid), obj);
54 if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IEnumWIA_DEV_INFO))
55 *obj = iface;
56 else
58 FIXME("interface %s not implemented\n", debugstr_guid(riid));
59 *obj = NULL;
60 return E_NOINTERFACE;
62 IUnknown_AddRef((IUnknown*)*obj);
63 return S_OK;
66 static ULONG WINAPI enumwiadevinfo_AddRef(IEnumWIA_DEV_INFO *iface)
68 enumwiadevinfo *This = impl_from_IEnumWIA_DEV_INFO(iface);
69 ULONG ref = InterlockedIncrement(&This->ref);
70 TRACE("(%p)->(%lu)\n", This, ref);
71 return ref;
74 static ULONG WINAPI enumwiadevinfo_Release(IEnumWIA_DEV_INFO *iface)
76 enumwiadevinfo *This = impl_from_IEnumWIA_DEV_INFO(iface);
77 ULONG ref = InterlockedDecrement(&This->ref);
79 TRACE("(%p)->(%lu)\n", This, ref);
81 if (ref == 0)
82 HeapFree(GetProcessHeap(), 0, This);
83 return ref;
86 static HRESULT WINAPI enumwiadevinfo_Next(IEnumWIA_DEV_INFO *iface, ULONG count, IWiaPropertyStorage **elem, ULONG *fetched)
88 enumwiadevinfo *This = impl_from_IEnumWIA_DEV_INFO(iface);
90 FIXME("(%p, %ld, %p, %p): stub\n", This, count, elem, fetched);
92 *fetched = 0;
93 return E_NOTIMPL;
96 static HRESULT WINAPI enumwiadevinfo_Skip(IEnumWIA_DEV_INFO *iface, ULONG count)
98 enumwiadevinfo *This = impl_from_IEnumWIA_DEV_INFO(iface);
100 FIXME("(%p, %lu): stub\n", This, count);
102 return E_NOTIMPL;
105 static HRESULT WINAPI enumwiadevinfo_Reset(IEnumWIA_DEV_INFO *iface)
107 enumwiadevinfo *This = impl_from_IEnumWIA_DEV_INFO(iface);
109 FIXME("(%p): stub\n", This);
111 return E_NOTIMPL;
114 static HRESULT WINAPI enumwiadevinfo_Clone(IEnumWIA_DEV_INFO *iface, IEnumWIA_DEV_INFO **ret)
116 enumwiadevinfo *This = impl_from_IEnumWIA_DEV_INFO(iface);
118 FIXME("(%p, %p): stub\n", This, ret);
120 return E_NOTIMPL;
123 static HRESULT WINAPI enumwiadevinfo_GetCount(IEnumWIA_DEV_INFO *iface, ULONG *count)
125 enumwiadevinfo *This = impl_from_IEnumWIA_DEV_INFO(iface);
127 FIXME("(%p, %p): stub\n", This, count);
129 *count = 0;
130 return E_NOTIMPL;
133 static const IEnumWIA_DEV_INFOVtbl EnumWIA_DEV_INFOVtbl =
135 enumwiadevinfo_QueryInterface,
136 enumwiadevinfo_AddRef,
137 enumwiadevinfo_Release,
138 enumwiadevinfo_Next,
139 enumwiadevinfo_Skip,
140 enumwiadevinfo_Reset,
141 enumwiadevinfo_Clone,
142 enumwiadevinfo_GetCount
145 static HRESULT WINAPI wiadevmgr_QueryInterface(IWiaDevMgr *iface, REFIID riid, void **ppvObject)
147 wiadevmgr *This = impl_from_IWiaDevMgr(iface);
149 TRACE("(%p, %s, %p)\n", This, debugstr_guid(riid), ppvObject);
151 if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IWiaDevMgr))
152 *ppvObject = iface;
153 else
155 FIXME("interface %s not implemented\n", debugstr_guid(riid));
156 *ppvObject = NULL;
157 return E_NOINTERFACE;
159 IUnknown_AddRef((IUnknown*) *ppvObject);
160 return S_OK;
163 static ULONG WINAPI wiadevmgr_AddRef(IWiaDevMgr *iface)
165 wiadevmgr *This = impl_from_IWiaDevMgr(iface);
166 return InterlockedIncrement(&This->ref);
169 static ULONG WINAPI wiadevmgr_Release(IWiaDevMgr *iface)
171 ULONG ref;
172 wiadevmgr *This = impl_from_IWiaDevMgr(iface);
174 ref = InterlockedDecrement(&This->ref);
175 if (ref == 0)
176 HeapFree(GetProcessHeap(), 0, This);
177 return ref;
180 static HRESULT WINAPI wiadevmgr_EnumDeviceInfo(IWiaDevMgr *iface, LONG flag, IEnumWIA_DEV_INFO **ret)
182 wiadevmgr *This = impl_from_IWiaDevMgr(iface);
183 enumwiadevinfo *enuminfo;
185 TRACE("(%p)->(%lx, %p)\n", This, flag, ret);
187 *ret = NULL;
189 enuminfo = HeapAlloc(GetProcessHeap(), 0, sizeof(*enuminfo));
190 if (!enuminfo)
191 return E_OUTOFMEMORY;
193 enuminfo->IEnumWIA_DEV_INFO_iface.lpVtbl = &EnumWIA_DEV_INFOVtbl;
194 enuminfo->ref = 1;
196 *ret = &enuminfo->IEnumWIA_DEV_INFO_iface;
197 return S_OK;
200 static HRESULT WINAPI wiadevmgr_CreateDevice(IWiaDevMgr *iface, BSTR bstrDeviceID, IWiaItem **ppWiaItemRoot)
202 wiadevmgr *This = impl_from_IWiaDevMgr(iface);
203 FIXME("(%p, %s, %p): stub\n", This, debugstr_w(bstrDeviceID), ppWiaItemRoot);
204 return E_NOTIMPL;
207 static HRESULT WINAPI wiadevmgr_SelectDeviceDlg(IWiaDevMgr *iface, HWND hwndParent, LONG lDeviceType,
208 LONG lFlags, BSTR *pbstrDeviceID, IWiaItem **ppItemRoot)
210 wiadevmgr *This = impl_from_IWiaDevMgr(iface);
211 FIXME("(%p, %p, %ld, 0x%lx, %p, %p): stub\n", This, hwndParent, lDeviceType, lFlags, pbstrDeviceID, ppItemRoot);
212 return E_NOTIMPL;
215 static HRESULT WINAPI wiadevmgr_SelectDeviceDlgID(IWiaDevMgr *iface, HWND hwndParent, LONG lDeviceType,
216 LONG lFlags, BSTR *pbstrDeviceID)
218 wiadevmgr *This = impl_from_IWiaDevMgr(iface);
219 FIXME("(%p, %p, %ld, 0x%lx, %p): stub\n", This, hwndParent, lDeviceType, lFlags, pbstrDeviceID);
220 return E_NOTIMPL;
223 static HRESULT WINAPI wiadevmgr_GetImageDlg(IWiaDevMgr *iface, HWND hwndParent, LONG lDeviceType,
224 LONG lFlags, LONG lIntent, IWiaItem *pItemRoot,
225 BSTR bstrFilename, GUID *pguidFormat)
227 wiadevmgr *This = impl_from_IWiaDevMgr(iface);
228 FIXME("(%p, %p, %ld, 0x%lx, %ld, %p, %s, %s): stub\n", This, hwndParent, lDeviceType, lFlags,
229 lIntent, pItemRoot, debugstr_w(bstrFilename), debugstr_guid(pguidFormat));
230 return E_NOTIMPL;
233 static HRESULT WINAPI wiadevmgr_RegisterEventCallbackProgram(IWiaDevMgr *iface, LONG lFlags, BSTR bstrDeviceID,
234 const GUID *pEventGUID, BSTR bstrCommandline,
235 BSTR bstrName, BSTR bstrDescription, BSTR bstrIcon)
237 wiadevmgr *This = impl_from_IWiaDevMgr(iface);
238 FIXME("(%p, 0x%lx, %s, %s, %s, %s, %s, %s): stub\n", This, lFlags, debugstr_w(bstrDeviceID),
239 debugstr_guid(pEventGUID), debugstr_w(bstrCommandline), debugstr_w(bstrName),
240 debugstr_w(bstrDescription), debugstr_w(bstrIcon));
241 return E_NOTIMPL;
244 static HRESULT WINAPI wiadevmgr_RegisterEventCallbackInterface(IWiaDevMgr *iface, LONG lFlags, BSTR bstrDeviceID,
245 const GUID *pEventGUID, IWiaEventCallback *pIWiaEventCallback,
246 IUnknown **pEventObject)
248 wiadevmgr *This = impl_from_IWiaDevMgr(iface);
249 FIXME("(%p, 0x%lx, %s, %s, %p, %p): stub\n", This, lFlags, debugstr_w(bstrDeviceID),
250 debugstr_guid(pEventGUID), pIWiaEventCallback, pEventObject);
251 return E_NOTIMPL;
254 static HRESULT WINAPI wiadevmgr_RegisterEventCallbackCLSID(IWiaDevMgr *iface, LONG lFlags, BSTR bstrDeviceID,
255 const GUID *pEventGUID, const GUID *pClsID, BSTR bstrName,
256 BSTR bstrDescription, BSTR bstrIcon)
258 wiadevmgr *This = impl_from_IWiaDevMgr(iface);
259 FIXME("(%p, 0x%lx, %s, %s, %s, %s, %s, %s): stub\n", This, lFlags, debugstr_w(bstrDeviceID),
260 debugstr_guid(pEventGUID), debugstr_guid(pClsID), debugstr_w(bstrName),
261 debugstr_w(bstrDescription), debugstr_w(bstrIcon));
262 return E_NOTIMPL;
265 static HRESULT WINAPI wiadevmgr_AddDeviceDlg(IWiaDevMgr *iface, HWND hwndParent, LONG lFlags)
267 wiadevmgr *This = impl_from_IWiaDevMgr(iface);
268 FIXME("(%p, %p, 0x%lx): stub\n", This, hwndParent, lFlags);
269 return E_NOTIMPL;
272 static const IWiaDevMgrVtbl WIASERVC_IWiaDevMgr_Vtbl =
274 wiadevmgr_QueryInterface,
275 wiadevmgr_AddRef,
276 wiadevmgr_Release,
277 wiadevmgr_EnumDeviceInfo,
278 wiadevmgr_CreateDevice,
279 wiadevmgr_SelectDeviceDlg,
280 wiadevmgr_SelectDeviceDlgID,
281 wiadevmgr_GetImageDlg,
282 wiadevmgr_RegisterEventCallbackProgram,
283 wiadevmgr_RegisterEventCallbackInterface,
284 wiadevmgr_RegisterEventCallbackCLSID,
285 wiadevmgr_AddDeviceDlg
288 HRESULT wiadevmgr_Constructor(IWiaDevMgr **ppObj)
290 wiadevmgr *This;
291 TRACE("(%p)\n", ppObj);
292 This = HeapAlloc(GetProcessHeap(), 0, sizeof(wiadevmgr));
293 if (This)
295 This->IWiaDevMgr_iface.lpVtbl = &WIASERVC_IWiaDevMgr_Vtbl;
296 This->ref = 1;
297 *ppObj = &This->IWiaDevMgr_iface;
298 return S_OK;
300 *ppObj = NULL;
301 return E_OUTOFMEMORY;