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
26 #include "wiaservc_private.h"
28 #include "wine/debug.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(wia
);
34 IEnumWIA_DEV_INFO IEnumWIA_DEV_INFO_iface
;
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
))
58 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
62 IUnknown_AddRef((IUnknown
*)*obj
);
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
);
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
);
82 HeapFree(GetProcessHeap(), 0, This
);
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
);
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
);
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
);
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
);
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
);
133 static const IEnumWIA_DEV_INFOVtbl EnumWIA_DEV_INFOVtbl
=
135 enumwiadevinfo_QueryInterface
,
136 enumwiadevinfo_AddRef
,
137 enumwiadevinfo_Release
,
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
))
155 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
157 return E_NOINTERFACE
;
159 IUnknown_AddRef((IUnknown
*) *ppvObject
);
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
)
172 wiadevmgr
*This
= impl_from_IWiaDevMgr(iface
);
174 ref
= InterlockedDecrement(&This
->ref
);
176 HeapFree(GetProcessHeap(), 0, This
);
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
);
189 enuminfo
= HeapAlloc(GetProcessHeap(), 0, sizeof(*enuminfo
));
191 return E_OUTOFMEMORY
;
193 enuminfo
->IEnumWIA_DEV_INFO_iface
.lpVtbl
= &EnumWIA_DEV_INFOVtbl
;
196 *ret
= &enuminfo
->IEnumWIA_DEV_INFO_iface
;
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
);
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
);
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
);
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
));
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
));
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
);
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
));
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
);
272 static const IWiaDevMgrVtbl WIASERVC_IWiaDevMgr_Vtbl
=
274 wiadevmgr_QueryInterface
,
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
)
291 TRACE("(%p)\n", ppObj
);
292 This
= HeapAlloc(GetProcessHeap(), 0, sizeof(wiadevmgr
));
295 This
->IWiaDevMgr_iface
.lpVtbl
= &WIASERVC_IWiaDevMgr_Vtbl
;
297 *ppObj
= &This
->IWiaDevMgr_iface
;
301 return E_OUTOFMEMORY
;