1 /* 2 * IUpdateDownloader implementation 3 * 4 * Copyright 2008 Hans Leidekker 5 * 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. 10 * 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. 15 * 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 19 */ 20 21 #define COBJMACROS 22 23 #include "config.h" 24 #include <stdarg.h> 25 26 #include "windef.h" 27 #include "winbase.h" 28 #include "winuser.h" 29 #include "ole2.h" 30 #include "initguid.h" 31 #include "wuapi.h" 32 #include "wuapi_private.h" 33 34 #include "wine/debug.h" 35 36 WINE_DEFAULT_DEBUG_CHANNEL(wuapi); 37 38 typedef struct _update_downloader 39 { 40 IUpdateDownloader IUpdateDownloader_iface; 41 LONG refs; 42 } update_downloader; 43 44 static inline update_downloader *impl_from_IUpdateDownloader( IUpdateDownloader *iface ) 45 { 46 return CONTAINING_RECORD(iface, update_downloader, IUpdateDownloader_iface); 47 } 48 49 static ULONG WINAPI update_downloader_AddRef( 50 IUpdateDownloader *iface ) 51 { 52 update_downloader *update_downloader = impl_from_IUpdateDownloader( iface ); 53 return InterlockedIncrement( &update_downloader->refs ); 54 } 55 56 static ULONG WINAPI update_downloader_Release( 57 IUpdateDownloader *iface ) 58 { 59 update_downloader *update_downloader = impl_from_IUpdateDownloader( iface ); 60 LONG refs = InterlockedDecrement( &update_downloader->refs ); 61 if (!refs) 62 { 63 TRACE("destroying %p\n", update_downloader); 64 HeapFree( GetProcessHeap(), 0, update_downloader ); 65 } 66 return refs; 67 } 68 69 static HRESULT WINAPI update_downloader_QueryInterface( 70 IUpdateDownloader *iface, 71 REFIID riid, 72 void **ppvObject ) 73 { 74 update_downloader *This = impl_from_IUpdateDownloader( iface ); 75 76 TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppvObject ); 77 78 if ( IsEqualGUID( riid, &IID_IUpdateDownloader ) || 79 IsEqualGUID( riid, &IID_IDispatch ) || 80 IsEqualGUID( riid, &IID_IUnknown ) ) 81 { 82 *ppvObject = iface; 83 } 84 else 85 { 86 FIXME("interface %s not implemented\n", debugstr_guid(riid)); 87 return E_NOINTERFACE; 88 } 89 IUpdateDownloader_AddRef( iface ); 90 return S_OK; 91 } 92 93 static HRESULT WINAPI update_downloader_GetTypeInfoCount( 94 IUpdateDownloader *iface, 95 UINT *pctinfo ) 96 { 97 FIXME("\n"); 98 return E_NOTIMPL; 99 } 100 101 static HRESULT WINAPI update_downloader_GetTypeInfo( 102 IUpdateDownloader *iface, 103 UINT iTInfo, 104 LCID lcid, 105 ITypeInfo **ppTInfo ) 106 { 107 FIXME("\n"); 108 return E_NOTIMPL; 109 } 110 111 static HRESULT WINAPI update_downloader_GetIDsOfNames( 112 IUpdateDownloader *iface, 113 REFIID riid, 114 LPOLESTR *rgszNames, 115 UINT cNames, 116 LCID lcid, 117 DISPID *rgDispId ) 118 { 119 FIXME("\n"); 120 return E_NOTIMPL; 121 } 122 123 static HRESULT WINAPI update_downloader_Invoke( 124 IUpdateDownloader *iface, 125 DISPID dispIdMember, 126 REFIID riid, 127 LCID lcid, 128 WORD wFlags, 129 DISPPARAMS *pDispParams, 130 VARIANT *pVarResult, 131 EXCEPINFO *pExcepInfo, 132 UINT *puArgErr ) 133 { 134 FIXME("\n"); 135 return E_NOTIMPL; 136 } 137 138 static HRESULT WINAPI update_downloader_get_IsForced( 139 IUpdateDownloader *This, 140 VARIANT_BOOL *retval ) 141 { 142 FIXME("\n"); 143 return E_NOTIMPL; 144 } 145 146 static HRESULT WINAPI update_downloader_put_IsForced( 147 IUpdateDownloader *This, 148 VARIANT_BOOL value ) 149 { 150 FIXME("%p, %d\n", This, value); 151 return S_OK; 152 } 153 154 static HRESULT WINAPI update_downloader_get_ClientApplicationID( 155 IUpdateDownloader *This, 156 BSTR *retval ) 157 { 158 FIXME("\n"); 159 return E_NOTIMPL; 160 } 161 162 static HRESULT WINAPI update_downloader_put_ClientApplicationID( 163 IUpdateDownloader *This, 164 BSTR value ) 165 { 166 FIXME("%p, %s\n", This, debugstr_w(value)); 167 return E_NOTIMPL; 168 } 169 170 static HRESULT WINAPI update_downloader_get_Priority( 171 IUpdateDownloader *This, 172 DownloadPriority *retval ) 173 { 174 FIXME("\n"); 175 return E_NOTIMPL; 176 } 177 178 static HRESULT WINAPI update_downloader_put_Priority( 179 IUpdateDownloader *This, 180 DownloadPriority value ) 181 { 182 FIXME("\n"); 183 return E_NOTIMPL; 184 } 185 186 static HRESULT WINAPI update_downloader_get_Updates( 187 IUpdateDownloader *This, 188 IUpdateCollection **retval ) 189 { 190 FIXME("\n"); 191 return E_NOTIMPL; 192 } 193 194 static HRESULT WINAPI update_downloader_put_Updates( 195 IUpdateDownloader *This, 196 IUpdateCollection *value ) 197 { 198 FIXME("\n"); 199 return E_NOTIMPL; 200 } 201 202 static HRESULT WINAPI update_downloader_BeginDownload( 203 IUpdateDownloader *This, 204 IUnknown *onProgressChanged, 205 IUnknown *onCompleted, 206 VARIANT state, 207 IDownloadJob **retval ) 208 { 209 FIXME("\n"); 210 return E_NOTIMPL; 211 } 212 213 static HRESULT WINAPI update_downloader_Download( 214 IUpdateDownloader *This, 215 IDownloadResult **retval ) 216 { 217 FIXME("\n"); 218 return E_NOTIMPL; 219 } 220 221 static HRESULT WINAPI update_downloader_EndDownload( 222 IUpdateDownloader *This, 223 IDownloadJob *value, 224 IDownloadResult **retval ) 225 { 226 FIXME("\n"); 227 return E_NOTIMPL; 228 } 229 230 static const struct IUpdateDownloaderVtbl update_downloader_vtbl = 231 { 232 update_downloader_QueryInterface, 233 update_downloader_AddRef, 234 update_downloader_Release, 235 update_downloader_GetTypeInfoCount, 236 update_downloader_GetTypeInfo, 237 update_downloader_GetIDsOfNames, 238 update_downloader_Invoke, 239 update_downloader_get_ClientApplicationID, 240 update_downloader_put_ClientApplicationID, 241 update_downloader_get_IsForced, 242 update_downloader_put_IsForced, 243 update_downloader_get_Priority, 244 update_downloader_put_Priority, 245 update_downloader_get_Updates, 246 update_downloader_put_Updates, 247 update_downloader_BeginDownload, 248 update_downloader_Download, 249 update_downloader_EndDownload 250 }; 251 252 HRESULT UpdateDownloader_create( LPVOID *ppObj ) 253 { 254 update_downloader *downloader; 255 256 TRACE("(%p)\n", ppObj); 257 258 downloader = HeapAlloc( GetProcessHeap(), 0, sizeof(*downloader) ); 259 if (!downloader) return E_OUTOFMEMORY; 260 261 downloader->IUpdateDownloader_iface.lpVtbl = &update_downloader_vtbl; 262 downloader->refs = 1; 263 264 *ppObj = &downloader->IUpdateDownloader_iface; 265 266 TRACE("returning iface %p\n", *ppObj); 267 return S_OK; 268 } 269