mf/session: Forward more events to the application.
[wine/zf.git] / dlls / wuapi / session.c
blob29365dd86c8adaab192b9d58f68ee4f18716711c
1 /*
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 #define COBJMACROS
23 #include <stdarg.h>
25 #include "windef.h"
26 #include "winbase.h"
27 #include "winuser.h"
28 #include "ole2.h"
29 #include "wuapi.h"
31 #include "wine/debug.h"
32 #include "wuapi_private.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(wuapi);
36 typedef struct _update_session
38 IUpdateSession IUpdateSession_iface;
39 LONG refs;
40 } update_session;
42 static inline update_session *impl_from_IUpdateSession( IUpdateSession *iface )
44 return CONTAINING_RECORD(iface, update_session, IUpdateSession_iface);
47 static ULONG WINAPI update_session_AddRef(
48 IUpdateSession *iface )
50 update_session *update_session = impl_from_IUpdateSession( iface );
51 return InterlockedIncrement( &update_session->refs );
54 static ULONG WINAPI update_session_Release(
55 IUpdateSession *iface )
57 update_session *update_session = impl_from_IUpdateSession( iface );
58 LONG refs = InterlockedDecrement( &update_session->refs );
59 if (!refs)
61 TRACE("destroying %p\n", update_session);
62 HeapFree( GetProcessHeap(), 0, update_session );
64 return refs;
67 static HRESULT WINAPI update_session_QueryInterface(
68 IUpdateSession *iface,
69 REFIID riid,
70 void **ppvObject )
72 update_session *This = impl_from_IUpdateSession( iface );
74 TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppvObject );
76 if ( IsEqualGUID( riid, &IID_IUpdateSession ) ||
77 IsEqualGUID( riid, &IID_IDispatch ) ||
78 IsEqualGUID( riid, &IID_IUnknown ) )
80 *ppvObject = iface;
82 else
84 FIXME("interface %s not implemented\n", debugstr_guid(riid));
85 return E_NOINTERFACE;
87 IUpdateSession_AddRef( iface );
88 return S_OK;
91 static HRESULT WINAPI update_session_GetTypeInfoCount(
92 IUpdateSession *iface,
93 UINT *pctinfo )
95 FIXME("\n");
96 return E_NOTIMPL;
99 static HRESULT WINAPI update_session_GetTypeInfo(
100 IUpdateSession *iface,
101 UINT iTInfo,
102 LCID lcid,
103 ITypeInfo **ppTInfo )
105 FIXME("\n");
106 return E_NOTIMPL;
109 static HRESULT WINAPI update_session_GetIDsOfNames(
110 IUpdateSession *iface,
111 REFIID riid,
112 LPOLESTR *rgszNames,
113 UINT cNames,
114 LCID lcid,
115 DISPID *rgDispId )
117 FIXME("\n");
118 return E_NOTIMPL;
121 static HRESULT WINAPI update_session_Invoke(
122 IUpdateSession *iface,
123 DISPID dispIdMember,
124 REFIID riid,
125 LCID lcid,
126 WORD wFlags,
127 DISPPARAMS *pDispParams,
128 VARIANT *pVarResult,
129 EXCEPINFO *pExcepInfo,
130 UINT *puArgErr )
132 FIXME("\n");
133 return E_NOTIMPL;
136 static HRESULT WINAPI update_session_get_ClientApplicationID(
137 IUpdateSession *This,
138 BSTR *retval )
140 FIXME("\n");
141 return E_NOTIMPL;
144 static HRESULT WINAPI update_session_put_ClientApplicationID(
145 IUpdateSession *This,
146 BSTR value )
148 FIXME("%p, %s\n", This, debugstr_w(value));
149 return S_OK;
152 static HRESULT WINAPI update_session_get_ReadOnly(
153 IUpdateSession *This,
154 VARIANT_BOOL *retval )
156 FIXME("\n");
157 return E_NOTIMPL;
160 static HRESULT WINAPI update_session_get_WebProxy(
161 IUpdateSession *This,
162 IWebProxy **retval )
164 FIXME("\n");
165 return E_NOTIMPL;
168 static HRESULT WINAPI update_session_put_WebProxy(
169 IUpdateSession *This,
170 IWebProxy *value )
172 FIXME("\n");
173 return E_NOTIMPL;
176 static HRESULT WINAPI update_session_CreateUpdateSearcher(
177 IUpdateSession *This,
178 IUpdateSearcher **retval )
180 TRACE("%p\n", This);
181 return UpdateSearcher_create( (LPVOID *)retval );
184 static HRESULT WINAPI update_session_CreateUpdateDownloader(
185 IUpdateSession *This,
186 IUpdateDownloader **retval )
188 TRACE("%p\n", This);
189 return UpdateDownloader_create( (LPVOID *)retval );
192 static HRESULT WINAPI update_session_CreateUpdateInstaller(
193 IUpdateSession *This,
194 IUpdateInstaller **retval )
196 TRACE("%p\n", This);
197 return UpdateInstaller_create( (LPVOID *)retval );
200 static const struct IUpdateSessionVtbl update_session_vtbl =
202 update_session_QueryInterface,
203 update_session_AddRef,
204 update_session_Release,
205 update_session_GetTypeInfoCount,
206 update_session_GetTypeInfo,
207 update_session_GetIDsOfNames,
208 update_session_Invoke,
209 update_session_get_ClientApplicationID,
210 update_session_put_ClientApplicationID,
211 update_session_get_ReadOnly,
212 update_session_get_WebProxy,
213 update_session_put_WebProxy,
214 update_session_CreateUpdateSearcher,
215 update_session_CreateUpdateDownloader,
216 update_session_CreateUpdateInstaller
219 HRESULT UpdateSession_create( LPVOID *ppObj )
221 update_session *session;
223 TRACE("(%p)\n", ppObj);
225 session = HeapAlloc( GetProcessHeap(), 0, sizeof(*session) );
226 if (!session) return E_OUTOFMEMORY;
228 session->IUpdateSession_iface.lpVtbl = &update_session_vtbl;
229 session->refs = 1;
231 *ppObj = &session->IUpdateSession_iface;
233 TRACE("returning iface %p\n", *ppObj);
234 return S_OK;