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
21 #include "wuapi_private.h"
23 typedef struct _update_session
25 IUpdateSession IUpdateSession_iface
;
29 static inline update_session
*impl_from_IUpdateSession( IUpdateSession
*iface
)
31 return CONTAINING_RECORD(iface
, update_session
, IUpdateSession_iface
);
34 static ULONG WINAPI
update_session_AddRef(
35 IUpdateSession
*iface
)
37 update_session
*update_session
= impl_from_IUpdateSession( iface
);
38 return InterlockedIncrement( &update_session
->refs
);
41 static ULONG WINAPI
update_session_Release(
42 IUpdateSession
*iface
)
44 update_session
*update_session
= impl_from_IUpdateSession( iface
);
45 LONG refs
= InterlockedDecrement( &update_session
->refs
);
48 TRACE("destroying %p\n", update_session
);
49 HeapFree( GetProcessHeap(), 0, update_session
);
54 static HRESULT WINAPI
update_session_QueryInterface(
55 IUpdateSession
*iface
,
59 update_session
*This
= impl_from_IUpdateSession( iface
);
61 TRACE("%p %s %p\n", This
, debugstr_guid( riid
), ppvObject
);
63 if ( IsEqualGUID( riid
, &IID_IUpdateSession
) ||
64 IsEqualGUID( riid
, &IID_IDispatch
) ||
65 IsEqualGUID( riid
, &IID_IUnknown
) )
71 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
74 IUpdateSession_AddRef( iface
);
78 static HRESULT WINAPI
update_session_GetTypeInfoCount(
79 IUpdateSession
*iface
,
86 static HRESULT WINAPI
update_session_GetTypeInfo(
87 IUpdateSession
*iface
,
96 static HRESULT WINAPI
update_session_GetIDsOfNames(
97 IUpdateSession
*iface
,
108 static HRESULT WINAPI
update_session_Invoke(
109 IUpdateSession
*iface
,
114 DISPPARAMS
*pDispParams
,
116 EXCEPINFO
*pExcepInfo
,
123 static HRESULT WINAPI
update_session_get_ClientApplicationID(
124 IUpdateSession
*This
,
131 static HRESULT WINAPI
update_session_put_ClientApplicationID(
132 IUpdateSession
*This
,
135 FIXME("%p, %s\n", This
, debugstr_w(value
));
139 static HRESULT WINAPI
update_session_get_ReadOnly(
140 IUpdateSession
*This
,
141 VARIANT_BOOL
*retval
)
147 static HRESULT WINAPI
update_session_get_WebProxy(
148 IUpdateSession
*This
,
155 static HRESULT WINAPI
update_session_put_WebProxy(
156 IUpdateSession
*This
,
163 static HRESULT WINAPI
update_session_CreateUpdateSearcher(
164 IUpdateSession
*This
,
165 IUpdateSearcher
**retval
)
168 return UpdateSearcher_create( NULL
, (LPVOID
*)retval
);
171 static HRESULT WINAPI
update_session_CreateUpdateDownloader(
172 IUpdateSession
*This
,
173 IUpdateDownloader
**retval
)
176 return UpdateDownloader_create( NULL
, (LPVOID
*)retval
);
179 static HRESULT WINAPI
update_session_CreateUpdateInstaller(
180 IUpdateSession
*This
,
181 IUpdateInstaller
**retval
)
184 return UpdateInstaller_create( NULL
, (LPVOID
*)retval
);
187 static const struct IUpdateSessionVtbl update_session_vtbl
=
189 update_session_QueryInterface
,
190 update_session_AddRef
,
191 update_session_Release
,
192 update_session_GetTypeInfoCount
,
193 update_session_GetTypeInfo
,
194 update_session_GetIDsOfNames
,
195 update_session_Invoke
,
196 update_session_get_ClientApplicationID
,
197 update_session_put_ClientApplicationID
,
198 update_session_get_ReadOnly
,
199 update_session_get_WebProxy
,
200 update_session_put_WebProxy
,
201 update_session_CreateUpdateSearcher
,
202 update_session_CreateUpdateDownloader
,
203 update_session_CreateUpdateInstaller
206 HRESULT
UpdateSession_create( IUnknown
*pUnkOuter
, LPVOID
*ppObj
)
208 update_session
*session
;
210 TRACE("(%p,%p)\n", pUnkOuter
, ppObj
);
212 session
= HeapAlloc( GetProcessHeap(), 0, sizeof(*session
) );
213 if (!session
) return E_OUTOFMEMORY
;
215 session
->IUpdateSession_iface
.lpVtbl
= &update_session_vtbl
;
218 *ppObj
= &session
->IUpdateSession_iface
;
220 TRACE("returning iface %p\n", *ppObj
);