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
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
);
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
);
76 static HRESULT WINAPI
stillimagew_GetDeviceInfo(IStillImageW
*iface
, LPWSTR pwszDeviceName
,
79 stillimage
*This
= impl_from_StillImageW(iface
);
80 FIXME("(%p, %s, %p): stub\n", This
, debugstr_w(pwszDeviceName
), ppBuffer
);
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
);
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
);
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
);
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
);
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
));
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
));
134 static HRESULT WINAPI
stillimagew_EnableHwNotifications(IStillImageW
*iface
, LPCWSTR pwszDeviceName
,
137 stillimage
*This
= impl_from_StillImageW(iface
);
138 FIXME("(%p, %s, %u): stub\n", This
, debugstr_w(pwszDeviceName
), bNewState
);
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
);
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
));
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
),
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
);
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
));
180 static const struct IStillImageWVtbl stillimagew_vtbl
=
182 stillimagew_QueryInterface
,
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
))
215 else if (IsEqualGUID(riid
, &IID_IStillImageW
))
216 *ppvObject
= &This
->lpVtbl
;
219 if (IsEqualGUID(riid
, &IID_IStillImageA
))
220 FIXME("interface IStillImageA is unsupported on Windows Vista too, please report if it's needed\n");
222 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
224 return E_NOINTERFACE
;
227 IUnknown_AddRef((IUnknown
*) *ppvObject
);
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
)
240 stillimage
*This
= impl_from_InternalUnknown(iface
);
242 ref
= InterlockedDecrement(&This
->ref
);
244 HeapFree(GetProcessHeap(), 0, This
);
248 static const struct IUnknownVtbl internal_unk_vtbl
=
250 Internal_QueryInterface
,
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
)
272 TRACE("(%p, %u, %p, %p)\n", hinst
, dwVer
, ppSti
, pUnkOuter
);
274 This
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(stillimage
));
277 This
->lpVtbl
= &stillimagew_vtbl
;
278 This
->lpInternalUnkVtbl
= &internal_unk_vtbl
;
280 This
->pUnkOuter
= pUnkOuter
;
282 This
->pUnkOuter
= (IUnknown
*) &This
->lpInternalUnkVtbl
;
285 hr
= IStillImage_Initialize((IStillImageW
*) &This
->lpVtbl
, hinst
, dwVer
);
289 *ppSti
= (IStillImageW
*) &This
->lpInternalUnkVtbl
;
291 *ppSti
= (IStillImageW
*) &This
->lpVtbl
;