ole32/tests: Fix crash under NT.
[wine/multimedia.git] / dlls / wiaservc / wiadevmgr.c
blobfea4e9453743a04771e1985a33f78dffdf42e0be
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 static inline wiadevmgr *impl_from_IWiaDevMgr(IWiaDevMgr *iface)
34 return CONTAINING_RECORD(iface, wiadevmgr, IWiaDevMgr_iface);
37 static HRESULT WINAPI wiadevmgr_QueryInterface(IWiaDevMgr *iface, REFIID riid, void **ppvObject)
39 wiadevmgr *This = impl_from_IWiaDevMgr(iface);
41 TRACE("(%p, %s, %p)\n", This, debugstr_guid(riid), ppvObject);
43 if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IWiaDevMgr))
44 *ppvObject = iface;
45 else
47 FIXME("interface %s not implemented\n", debugstr_guid(riid));
48 *ppvObject = NULL;
49 return E_NOINTERFACE;
51 IUnknown_AddRef((IUnknown*) *ppvObject);
52 return S_OK;
55 static ULONG WINAPI wiadevmgr_AddRef(IWiaDevMgr *iface)
57 wiadevmgr *This = impl_from_IWiaDevMgr(iface);
58 return InterlockedIncrement(&This->ref);
61 static ULONG WINAPI wiadevmgr_Release(IWiaDevMgr *iface)
63 ULONG ref;
64 wiadevmgr *This = impl_from_IWiaDevMgr(iface);
66 ref = InterlockedDecrement(&This->ref);
67 if (ref == 0)
68 HeapFree(GetProcessHeap(), 0, This);
69 return ref;
72 static HRESULT WINAPI wiadevmgr_EnumDeviceInfo(IWiaDevMgr *iface, LONG lFlag, IEnumWIA_DEV_INFO **ppIEnum)
74 wiadevmgr *This = impl_from_IWiaDevMgr(iface);
75 FIXME("(%p, %d, %p): stub\n", This, lFlag, ppIEnum);
76 return E_NOTIMPL;
79 static HRESULT WINAPI wiadevmgr_CreateDevice(IWiaDevMgr *iface, BSTR bstrDeviceID, IWiaItem **ppWiaItemRoot)
81 wiadevmgr *This = impl_from_IWiaDevMgr(iface);
82 FIXME("(%p, %s, %p): stub\n", This, debugstr_w(bstrDeviceID), ppWiaItemRoot);
83 return E_NOTIMPL;
86 static HRESULT WINAPI wiadevmgr_SelectDeviceDlg(IWiaDevMgr *iface, HWND hwndParent, LONG lDeviceType,
87 LONG lFlags, BSTR *pbstrDeviceID, IWiaItem **ppItemRoot)
89 wiadevmgr *This = impl_from_IWiaDevMgr(iface);
90 FIXME("(%p, %p, %d, 0x%x, %p, %p): stub\n", This, hwndParent, lDeviceType, lFlags, pbstrDeviceID, ppItemRoot);
91 return E_NOTIMPL;
94 static HRESULT WINAPI wiadevmgr_SelectDeviceDlgID(IWiaDevMgr *iface, HWND hwndParent, LONG lDeviceType,
95 LONG lFlags, BSTR *pbstrDeviceID)
97 wiadevmgr *This = impl_from_IWiaDevMgr(iface);
98 FIXME("(%p, %p, %d, 0x%x, %p): stub\n", This, hwndParent, lDeviceType, lFlags, pbstrDeviceID);
99 return E_NOTIMPL;
102 static HRESULT WINAPI wiadevmgr_GetImageDlg(IWiaDevMgr *iface, HWND hwndParent, LONG lDeviceType,
103 LONG lFlags, LONG lIntent, IWiaItem *pItemRoot,
104 BSTR bstrFilename, GUID *pguidFormat)
106 wiadevmgr *This = impl_from_IWiaDevMgr(iface);
107 FIXME("(%p, %p, %d, 0x%x, %d, %p, %s, %s): stub\n", This, hwndParent, lDeviceType, lFlags,
108 lIntent, pItemRoot, debugstr_w(bstrFilename), debugstr_guid(pguidFormat));
109 return E_NOTIMPL;
112 static HRESULT WINAPI wiadevmgr_RegisterEventCallbackProgram(IWiaDevMgr *iface, LONG lFlags, BSTR bstrDeviceID,
113 const GUID *pEventGUID, BSTR bstrCommandline,
114 BSTR bstrName, BSTR bstrDescription, BSTR bstrIcon)
116 wiadevmgr *This = impl_from_IWiaDevMgr(iface);
117 FIXME("(%p, 0x%x, %s, %s, %s, %s, %s, %s): stub\n", This, lFlags, debugstr_w(bstrDeviceID),
118 debugstr_guid(pEventGUID), debugstr_w(bstrCommandline), debugstr_w(bstrName),
119 debugstr_w(bstrDescription), debugstr_w(bstrIcon));
120 return E_NOTIMPL;
123 static HRESULT WINAPI wiadevmgr_RegisterEventCallbackInterface(IWiaDevMgr *iface, LONG lFlags, BSTR bstrDeviceID,
124 const GUID *pEventGUID, IWiaEventCallback *pIWiaEventCallback,
125 IUnknown **pEventObject)
127 wiadevmgr *This = impl_from_IWiaDevMgr(iface);
128 FIXME("(%p, 0x%x, %s, %s, %p, %p): stub\n", This, lFlags, debugstr_w(bstrDeviceID),
129 debugstr_guid(pEventGUID), pIWiaEventCallback, pEventObject);
130 return E_NOTIMPL;
133 static HRESULT WINAPI wiadevmgr_RegisterEventCallbackCLSID(IWiaDevMgr *iface, LONG lFlags, BSTR bstrDeviceID,
134 const GUID *pEventGUID, const GUID *pClsID, BSTR bstrName,
135 BSTR bstrDescription, BSTR bstrIcon)
137 wiadevmgr *This = impl_from_IWiaDevMgr(iface);
138 FIXME("(%p, 0x%x, %s, %s, %s, %s, %s, %s): stub\n", This, lFlags, debugstr_w(bstrDeviceID),
139 debugstr_guid(pEventGUID), debugstr_guid(pClsID), debugstr_w(bstrName),
140 debugstr_w(bstrDescription), debugstr_w(bstrIcon));
141 return E_NOTIMPL;
144 static HRESULT WINAPI wiadevmgr_AddDeviceDlg(IWiaDevMgr *iface, HWND hwndParent, LONG lFlags)
146 wiadevmgr *This = impl_from_IWiaDevMgr(iface);
147 FIXME("(%p, %p, 0x%x): stub\n", This, hwndParent, lFlags);
148 return E_NOTIMPL;
151 static const IWiaDevMgrVtbl WIASERVC_IWiaDevMgr_Vtbl =
153 wiadevmgr_QueryInterface,
154 wiadevmgr_AddRef,
155 wiadevmgr_Release,
156 wiadevmgr_EnumDeviceInfo,
157 wiadevmgr_CreateDevice,
158 wiadevmgr_SelectDeviceDlg,
159 wiadevmgr_SelectDeviceDlgID,
160 wiadevmgr_GetImageDlg,
161 wiadevmgr_RegisterEventCallbackProgram,
162 wiadevmgr_RegisterEventCallbackInterface,
163 wiadevmgr_RegisterEventCallbackCLSID,
164 wiadevmgr_AddDeviceDlg
167 HRESULT wiadevmgr_Constructor(IUnknown *pUnkOuter, LPVOID *ppObj)
169 wiadevmgr *This;
170 TRACE("(%p,%p)\n", pUnkOuter, ppObj);
171 This = HeapAlloc(GetProcessHeap(), 0, sizeof(wiadevmgr));
172 if (This)
174 This->IWiaDevMgr_iface.lpVtbl = &WIASERVC_IWiaDevMgr_Vtbl;
175 This->ref = 1;
176 *ppObj = This;
177 return S_OK;
179 *ppObj = NULL;
180 return E_OUTOFMEMORY;