kernel32/tests: Use todo_wine_if() in tests.
[wine.git] / dlls / wuapi / session.c
blobacc7cb0a3515fa2c35d10b9898f7a20a7271638e
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 "config.h"
24 #include <stdarg.h>
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winuser.h"
29 #include "ole2.h"
30 #include "wuapi.h"
32 #include "wine/debug.h"
33 #include "wuapi_private.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(wuapi);
37 typedef struct _update_session
39 IUpdateSession IUpdateSession_iface;
40 LONG refs;
41 } update_session;
43 static inline update_session *impl_from_IUpdateSession( IUpdateSession *iface )
45 return CONTAINING_RECORD(iface, update_session, IUpdateSession_iface);
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 );
60 if (!refs)
62 TRACE("destroying %p\n", update_session);
63 HeapFree( GetProcessHeap(), 0, update_session );
65 return refs;
68 static HRESULT WINAPI update_session_QueryInterface(
69 IUpdateSession *iface,
70 REFIID riid,
71 void **ppvObject )
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 ) )
81 *ppvObject = iface;
83 else
85 FIXME("interface %s not implemented\n", debugstr_guid(riid));
86 return E_NOINTERFACE;
88 IUpdateSession_AddRef( iface );
89 return S_OK;
92 static HRESULT WINAPI update_session_GetTypeInfoCount(
93 IUpdateSession *iface,
94 UINT *pctinfo )
96 FIXME("\n");
97 return E_NOTIMPL;
100 static HRESULT WINAPI update_session_GetTypeInfo(
101 IUpdateSession *iface,
102 UINT iTInfo,
103 LCID lcid,
104 ITypeInfo **ppTInfo )
106 FIXME("\n");
107 return E_NOTIMPL;
110 static HRESULT WINAPI update_session_GetIDsOfNames(
111 IUpdateSession *iface,
112 REFIID riid,
113 LPOLESTR *rgszNames,
114 UINT cNames,
115 LCID lcid,
116 DISPID *rgDispId )
118 FIXME("\n");
119 return E_NOTIMPL;
122 static HRESULT WINAPI update_session_Invoke(
123 IUpdateSession *iface,
124 DISPID dispIdMember,
125 REFIID riid,
126 LCID lcid,
127 WORD wFlags,
128 DISPPARAMS *pDispParams,
129 VARIANT *pVarResult,
130 EXCEPINFO *pExcepInfo,
131 UINT *puArgErr )
133 FIXME("\n");
134 return E_NOTIMPL;
137 static HRESULT WINAPI update_session_get_ClientApplicationID(
138 IUpdateSession *This,
139 BSTR *retval )
141 FIXME("\n");
142 return E_NOTIMPL;
145 static HRESULT WINAPI update_session_put_ClientApplicationID(
146 IUpdateSession *This,
147 BSTR value )
149 FIXME("%p, %s\n", This, debugstr_w(value));
150 return S_OK;
153 static HRESULT WINAPI update_session_get_ReadOnly(
154 IUpdateSession *This,
155 VARIANT_BOOL *retval )
157 FIXME("\n");
158 return E_NOTIMPL;
161 static HRESULT WINAPI update_session_get_WebProxy(
162 IUpdateSession *This,
163 IWebProxy **retval )
165 FIXME("\n");
166 return E_NOTIMPL;
169 static HRESULT WINAPI update_session_put_WebProxy(
170 IUpdateSession *This,
171 IWebProxy *value )
173 FIXME("\n");
174 return E_NOTIMPL;
177 static HRESULT WINAPI update_session_CreateUpdateSearcher(
178 IUpdateSession *This,
179 IUpdateSearcher **retval )
181 TRACE("%p\n", This);
182 return UpdateSearcher_create( (LPVOID *)retval );
185 static HRESULT WINAPI update_session_CreateUpdateDownloader(
186 IUpdateSession *This,
187 IUpdateDownloader **retval )
189 TRACE("%p\n", This);
190 return UpdateDownloader_create( (LPVOID *)retval );
193 static HRESULT WINAPI update_session_CreateUpdateInstaller(
194 IUpdateSession *This,
195 IUpdateInstaller **retval )
197 TRACE("%p\n", This);
198 return UpdateInstaller_create( (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( LPVOID *ppObj )
222 update_session *session;
224 TRACE("(%p)\n", ppObj);
226 session = HeapAlloc( GetProcessHeap(), 0, sizeof(*session) );
227 if (!session) return E_OUTOFMEMORY;
229 session->IUpdateSession_iface.lpVtbl = &update_session_vtbl;
230 session->refs = 1;
232 *ppObj = &session->IUpdateSession_iface;
234 TRACE("returning iface %p\n", *ppObj);
235 return S_OK;