2 * IUpdateSession implementation
4 * Copyright 2008 Hans Leidekker
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
32 #include "wine/debug.h"
33 #include "wuapi_private.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(wuapi);
37 typedef struct _update_session
39 const struct IUpdateSessionVtbl *vtbl;
43 static inline update_session *impl_from_IUpdateSession( IUpdateSession *iface )
45 return (update_session *)((char *)iface - FIELD_OFFSET( update_session, vtbl ));
48 static ULONG WINAPI update_session_AddRef(
49 IUpdateSession *iface )
51 update_session *update_session = impl_from_IUpdateSession( iface );
52 return InterlockedIncrement( &update_session->refs );
55 static ULONG WINAPI update_session_Release(
56 IUpdateSession *iface )
58 update_session *update_session = impl_from_IUpdateSession( iface );
59 LONG refs = InterlockedDecrement( &update_session->refs );
62 TRACE("destroying %p\n", update_session);
63 HeapFree( GetProcessHeap(), 0, update_session );
68 static HRESULT WINAPI update_session_QueryInterface(
69 IUpdateSession *iface,
73 update_session *This = impl_from_IUpdateSession( iface );
75 TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppvObject );
77 if ( IsEqualGUID( riid, &IID_IUpdateSession ) ||
78 IsEqualGUID( riid, &IID_IDispatch ) ||
79 IsEqualGUID( riid, &IID_IUnknown ) )
85 FIXME("interface %s not implemented\n", debugstr_guid(riid));
88 IUpdateSession_AddRef( iface );
92 static HRESULT WINAPI update_session_GetTypeInfoCount(
93 IUpdateSession *iface,
100 static HRESULT WINAPI update_session_GetTypeInfo(
101 IUpdateSession *iface,
104 ITypeInfo **ppTInfo )
110 static HRESULT WINAPI update_session_GetIDsOfNames(
111 IUpdateSession *iface,
122 static HRESULT WINAPI update_session_Invoke(
123 IUpdateSession *iface,
128 DISPPARAMS *pDispParams,
130 EXCEPINFO *pExcepInfo,
137 static HRESULT WINAPI update_session_get_ClientApplicationID(
138 IUpdateSession *This,
145 static HRESULT WINAPI update_session_put_ClientApplicationID(
146 IUpdateSession *This,
149 FIXME("%p, %s\n", This, debugstr_w(value));
153 static HRESULT WINAPI update_session_get_ReadOnly(
154 IUpdateSession *This,
155 VARIANT_BOOL *retval )
161 static HRESULT WINAPI update_session_get_WebProxy(
162 IUpdateSession *This,
169 static HRESULT WINAPI update_session_put_WebProxy(
170 IUpdateSession *This,
177 static HRESULT WINAPI update_session_CreateUpdateSearcher(
178 IUpdateSession *This,
179 IUpdateSearcher **retval )
182 return UpdateSearcher_create( NULL, (LPVOID *)retval );
185 static HRESULT WINAPI update_session_CreateUpdateDownloader(
186 IUpdateSession *This,
187 IUpdateDownloader **retval )
190 return UpdateDownloader_create( NULL, (LPVOID *)retval );
193 static HRESULT WINAPI update_session_CreateUpdateInstaller(
194 IUpdateSession *This,
195 IUpdateInstaller **retval )
198 return UpdateInstaller_create( NULL, (LPVOID *)retval );
201 static const struct IUpdateSessionVtbl update_session_vtbl =
203 update_session_QueryInterface,
204 update_session_AddRef,
205 update_session_Release,
206 update_session_GetTypeInfoCount,
207 update_session_GetTypeInfo,
208 update_session_GetIDsOfNames,
209 update_session_Invoke,
210 update_session_get_ClientApplicationID,
211 update_session_put_ClientApplicationID,
212 update_session_get_ReadOnly,
213 update_session_get_WebProxy,
214 update_session_put_WebProxy,
215 update_session_CreateUpdateSearcher,
216 update_session_CreateUpdateDownloader,
217 update_session_CreateUpdateInstaller
220 HRESULT UpdateSession_create( IUnknown *pUnkOuter, LPVOID *ppObj )
222 update_session *session;
224 TRACE("(%p,%p)\n", pUnkOuter, ppObj);
226 session = HeapAlloc( GetProcessHeap(), 0, sizeof(*session) );
227 if (!session) return E_OUTOFMEMORY;
229 session->vtbl = &update_session_vtbl;
232 *ppObj = &session->vtbl;
234 TRACE("returning iface %p\n", *ppObj);