sti: Return success from the IStillImageW::UnregisterLaunchApplication stub.
[wine/multimedia.git] / dlls / sti / sti.c
blobc88205d920e8ee13dc0155191639dc07197d34c9
1 /*
2 * Copyright (C) 2002 Aric Stewart for CodeWeavers
3 * Copyright (C) 2009 Damjan Jovanovic
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
20 #include <stdarg.h>
22 #define COBJMACROS
24 #include "windef.h"
25 #include "winbase.h"
26 #include "winreg.h"
27 #include "winerror.h"
28 #include "objbase.h"
29 #include "sti.h"
31 #include "sti_private.h"
33 #include "wine/debug.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(sti);
37 static inline stillimage *impl_from_StillImageW(IStillImageW *iface)
39 return (stillimage *)((char*)iface - FIELD_OFFSET(stillimage, lpVtbl));
42 static HRESULT WINAPI stillimagew_QueryInterface(IStillImageW *iface, REFIID riid, void **ppvObject)
44 stillimage *This = impl_from_StillImageW(iface);
45 TRACE("(%p %s %p)\n", This, debugstr_guid(riid), ppvObject);
46 return IUnknown_QueryInterface(This->pUnkOuter, riid, ppvObject);
49 static ULONG WINAPI stillimagew_AddRef(IStillImageW *iface)
51 stillimage *This = impl_from_StillImageW(iface);
52 return IUnknown_AddRef(This->pUnkOuter);
55 static ULONG WINAPI stillimagew_Release(IStillImageW *iface)
57 stillimage *This = impl_from_StillImageW(iface);
58 return IUnknown_Release(This->pUnkOuter);
61 static HRESULT WINAPI stillimagew_Initialize(IStillImageW *iface, HINSTANCE hinst, DWORD dwVersion)
63 stillimage *This = impl_from_StillImageW(iface);
64 TRACE("(%p, %p, 0x%X)\n", This, hinst, dwVersion);
65 return S_OK;
68 static HRESULT WINAPI stillimagew_GetDeviceList(IStillImageW *iface, DWORD dwType, DWORD dwFlags,
69 DWORD *pdwItemsReturned, LPVOID *ppBuffer)
71 stillimage *This = impl_from_StillImageW(iface);
72 FIXME("(%p, %u, 0x%X, %p, %p): stub\n", This, dwType, dwFlags, pdwItemsReturned, ppBuffer);
73 return E_NOTIMPL;
76 static HRESULT WINAPI stillimagew_GetDeviceInfo(IStillImageW *iface, LPWSTR pwszDeviceName,
77 LPVOID *ppBuffer)
79 stillimage *This = impl_from_StillImageW(iface);
80 FIXME("(%p, %s, %p): stub\n", This, debugstr_w(pwszDeviceName), ppBuffer);
81 return E_NOTIMPL;
84 static HRESULT WINAPI stillimagew_CreateDevice(IStillImageW *iface, LPWSTR pwszDeviceName, DWORD dwMode,
85 PSTIDEVICEW *pDevice, LPUNKNOWN pUnkOuter)
87 stillimage *This = impl_from_StillImageW(iface);
88 FIXME("(%p, %s, %u, %p, %p): stub\n", This, debugstr_w(pwszDeviceName), dwMode, pDevice, pUnkOuter);
89 return E_NOTIMPL;
92 static HRESULT WINAPI stillimagew_GetDeviceValue(IStillImageW *iface, LPWSTR pwszDeviceName, LPWSTR pValueName,
93 LPDWORD pType, LPBYTE pData, LPDWORD cbData)
95 stillimage *This = impl_from_StillImageW(iface);
96 FIXME("(%p, %s, %s, %p, %p, %p): stub\n", This, debugstr_w(pwszDeviceName), debugstr_w(pValueName),
97 pType, pData, cbData);
98 return E_NOTIMPL;
101 static HRESULT WINAPI stillimagew_SetDeviceValue(IStillImageW *iface, LPWSTR pwszDeviceName, LPWSTR pValueName,
102 DWORD type, LPBYTE pData, DWORD cbData)
104 stillimage *This = impl_from_StillImageW(iface);
105 FIXME("(%p, %s, %s, %u, %p, %u): stub\n", This, debugstr_w(pwszDeviceName), debugstr_w(pValueName),
106 type, pData, cbData);
107 return E_NOTIMPL;
110 static HRESULT WINAPI stillimagew_GetSTILaunchInformation(IStillImageW *iface, LPWSTR pwszDeviceName,
111 DWORD *pdwEventCode, LPWSTR pwszEventName)
113 stillimage *This = impl_from_StillImageW(iface);
114 FIXME("(%p, %p, %p, %p): stub\n", This, pwszDeviceName,
115 pdwEventCode, pwszEventName);
116 return E_NOTIMPL;
119 static HRESULT WINAPI stillimagew_RegisterLaunchApplication(IStillImageW *iface, LPWSTR pwszAppName,
120 LPWSTR pwszCommandLine)
122 stillimage *This = impl_from_StillImageW(iface);
123 FIXME("(%p, %s, %s): stub\n", This, debugstr_w(pwszAppName), debugstr_w(pwszCommandLine));
124 return E_NOTIMPL;
127 static HRESULT WINAPI stillimagew_UnregisterLaunchApplication(IStillImageW *iface, LPWSTR pwszAppName)
129 stillimage *This = impl_from_StillImageW(iface);
130 FIXME("(%p, %s): stub\n", This, debugstr_w(pwszAppName));
131 return S_OK;
134 static HRESULT WINAPI stillimagew_EnableHwNotifications(IStillImageW *iface, LPCWSTR pwszDeviceName,
135 BOOL bNewState)
137 stillimage *This = impl_from_StillImageW(iface);
138 FIXME("(%p, %s, %u): stub\n", This, debugstr_w(pwszDeviceName), bNewState);
139 return E_NOTIMPL;
142 static HRESULT WINAPI stillimagew_GetHwNotificationState(IStillImageW *iface, LPCWSTR pwszDeviceName,
143 BOOL *pbCurrentState)
145 stillimage *This = impl_from_StillImageW(iface);
146 FIXME("(%p, %s, %p): stub\n", This, debugstr_w(pwszDeviceName), pbCurrentState);
147 return E_NOTIMPL;
150 static HRESULT WINAPI stillimagew_RefreshDeviceBus(IStillImageW *iface, LPCWSTR pwszDeviceName)
152 stillimage *This = impl_from_StillImageW(iface);
153 FIXME("(%p, %s): stub\n", This, debugstr_w(pwszDeviceName));
154 return E_NOTIMPL;
157 static HRESULT WINAPI stillimagew_LaunchApplicationForDevice(IStillImageW *iface, LPWSTR pwszDeviceName,
158 LPWSTR pwszAppName, LPSTINOTIFY pStiNotify)
160 stillimage *This = impl_from_StillImageW(iface);
161 FIXME("(%p, %s, %s, %p): stub\n", This, debugstr_w(pwszDeviceName), debugstr_w(pwszAppName),
162 pStiNotify);
163 return E_NOTIMPL;
166 static HRESULT WINAPI stillimagew_SetupDeviceParameters(IStillImageW *iface, PSTI_DEVICE_INFORMATIONW pDevInfo)
168 stillimage *This = impl_from_StillImageW(iface);
169 FIXME("(%p, %p): stub\n", This, pDevInfo);
170 return E_NOTIMPL;
173 static HRESULT WINAPI stillimagew_WriteToErrorLog(IStillImageW *iface, DWORD dwMessageType, LPCWSTR pszMessage)
175 stillimage *This = impl_from_StillImageW(iface);
176 FIXME("(%p, %u, %s): stub\n", This, dwMessageType, debugstr_w(pszMessage));
177 return E_NOTIMPL;
180 static const struct IStillImageWVtbl stillimagew_vtbl =
182 stillimagew_QueryInterface,
183 stillimagew_AddRef,
184 stillimagew_Release,
185 stillimagew_Initialize,
186 stillimagew_GetDeviceList,
187 stillimagew_GetDeviceInfo,
188 stillimagew_CreateDevice,
189 stillimagew_GetDeviceValue,
190 stillimagew_SetDeviceValue,
191 stillimagew_GetSTILaunchInformation,
192 stillimagew_RegisterLaunchApplication,
193 stillimagew_UnregisterLaunchApplication,
194 stillimagew_EnableHwNotifications,
195 stillimagew_GetHwNotificationState,
196 stillimagew_RefreshDeviceBus,
197 stillimagew_LaunchApplicationForDevice,
198 stillimagew_SetupDeviceParameters,
199 stillimagew_WriteToErrorLog
202 static inline stillimage *impl_from_InternalUnknown(IUnknown *iface)
204 return (stillimage *)((char*)iface - FIELD_OFFSET(stillimage, lpInternalUnkVtbl));
207 static HRESULT WINAPI Internal_QueryInterface(IUnknown *iface, REFIID riid, void **ppvObject)
209 stillimage *This = impl_from_InternalUnknown(iface);
211 TRACE("(%p %s %p)\n", This, debugstr_guid(riid), ppvObject);
213 if (IsEqualGUID(riid, &IID_IUnknown))
214 *ppvObject = iface;
215 else if (IsEqualGUID(riid, &IID_IStillImageW))
216 *ppvObject = &This->lpVtbl;
217 else
219 if (IsEqualGUID(riid, &IID_IStillImageA))
220 FIXME("interface IStillImageA is unsupported on Windows Vista too, please report if it's needed\n");
221 else
222 FIXME("interface %s not implemented\n", debugstr_guid(riid));
223 *ppvObject = NULL;
224 return E_NOINTERFACE;
227 IUnknown_AddRef((IUnknown*) *ppvObject);
228 return S_OK;
231 static ULONG WINAPI Internal_AddRef(IUnknown *iface)
233 stillimage *This = impl_from_InternalUnknown(iface);
234 return InterlockedIncrement(&This->ref);
237 static ULONG WINAPI Internal_Release(IUnknown *iface)
239 ULONG ref;
240 stillimage *This = impl_from_InternalUnknown(iface);
242 ref = InterlockedDecrement(&This->ref);
243 if (ref == 0)
244 HeapFree(GetProcessHeap(), 0, This);
245 return ref;
248 static const struct IUnknownVtbl internal_unk_vtbl =
250 Internal_QueryInterface,
251 Internal_AddRef,
252 Internal_Release
255 /******************************************************************************
256 * StiCreateInstanceA (STI.@)
258 HRESULT WINAPI StiCreateInstanceA(HINSTANCE hinst, DWORD dwVer, PSTIA *ppSti, LPUNKNOWN pUnkOuter)
260 FIXME("(%p, %u, %p, %p): stub, unimplemented on Windows Vista too, please report if it's needed\n", hinst, dwVer, ppSti, pUnkOuter);
261 return STG_E_UNIMPLEMENTEDFUNCTION;
264 /******************************************************************************
265 * StiCreateInstanceW (STI.@)
267 HRESULT WINAPI StiCreateInstanceW(HINSTANCE hinst, DWORD dwVer, PSTIW *ppSti, LPUNKNOWN pUnkOuter)
269 stillimage *This;
270 HRESULT hr;
272 TRACE("(%p, %u, %p, %p)\n", hinst, dwVer, ppSti, pUnkOuter);
274 This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(stillimage));
275 if (This)
277 This->lpVtbl = &stillimagew_vtbl;
278 This->lpInternalUnkVtbl = &internal_unk_vtbl;
279 if (pUnkOuter)
280 This->pUnkOuter = pUnkOuter;
281 else
282 This->pUnkOuter = (IUnknown*) &This->lpInternalUnkVtbl;
283 This->ref = 1;
285 hr = IStillImage_Initialize((IStillImageW*) &This->lpVtbl, hinst, dwVer);
286 if (SUCCEEDED(hr))
288 if (pUnkOuter)
289 *ppSti = (IStillImageW*) &This->lpInternalUnkVtbl;
290 else
291 *ppSti = (IStillImageW*) &This->lpVtbl;
294 else
295 hr = E_OUTOFMEMORY;
297 return hr;