1 /* 2 * IAutomaticUpdates 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 "wuapi.h" 31 #include "wuapi_private.h" 32 33 #include "wine/debug.h" 34 35 WINE_DEFAULT_DEBUG_CHANNEL(wuapi); 36 37 typedef struct _automatic_updates 38 { 39 IAutomaticUpdates IAutomaticUpdates_iface; 40 LONG refs; 41 } automatic_updates; 42 43 static inline automatic_updates *impl_from_IAutomaticUpdates( IAutomaticUpdates *iface ) 44 { 45 return CONTAINING_RECORD(iface, automatic_updates, IAutomaticUpdates_iface); 46 } 47 48 static ULONG WINAPI automatic_updates_AddRef( 49 IAutomaticUpdates *iface ) 50 { 51 automatic_updates *automatic_updates = impl_from_IAutomaticUpdates( iface ); 52 return InterlockedIncrement( &automatic_updates->refs ); 53 } 54 55 static ULONG WINAPI automatic_updates_Release( 56 IAutomaticUpdates *iface ) 57 { 58 automatic_updates *automatic_updates = impl_from_IAutomaticUpdates( iface ); 59 LONG refs = InterlockedDecrement( &automatic_updates->refs ); 60 if (!refs) 61 { 62 TRACE("destroying %p\n", automatic_updates); 63 HeapFree( GetProcessHeap(), 0, automatic_updates ); 64 } 65 return refs; 66 } 67 68 static HRESULT WINAPI automatic_updates_QueryInterface( 69 IAutomaticUpdates *iface, 70 REFIID riid, 71 void **ppvObject ) 72 { 73 automatic_updates *This = impl_from_IAutomaticUpdates( iface ); 74 75 TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppvObject ); 76 77 if ( IsEqualGUID( riid, &IID_IAutomaticUpdates ) || 78 IsEqualGUID( riid, &IID_IDispatch ) || 79 IsEqualGUID( riid, &IID_IUnknown ) ) 80 { 81 *ppvObject = iface; 82 } 83 else 84 { 85 FIXME("interface %s not implemented\n", debugstr_guid(riid)); 86 return E_NOINTERFACE; 87 } 88 IAutomaticUpdates_AddRef( iface ); 89 return S_OK; 90 } 91 92 static HRESULT WINAPI automatic_updates_GetTypeInfoCount( 93 IAutomaticUpdates *iface, 94 UINT *pctinfo ) 95 { 96 FIXME("\n"); 97 return E_NOTIMPL; 98 } 99 100 static HRESULT WINAPI automatic_updates_GetTypeInfo( 101 IAutomaticUpdates *iface, 102 UINT iTInfo, 103 LCID lcid, 104 ITypeInfo **ppTInfo ) 105 { 106 FIXME("\n"); 107 return E_NOTIMPL; 108 } 109 110 static HRESULT WINAPI automatic_updates_GetIDsOfNames( 111 IAutomaticUpdates *iface, 112 REFIID riid, 113 LPOLESTR *rgszNames, 114 UINT cNames, 115 LCID lcid, 116 DISPID *rgDispId ) 117 { 118 FIXME("\n"); 119 return E_NOTIMPL; 120 } 121 122 static HRESULT WINAPI automatic_updates_Invoke( 123 IAutomaticUpdates *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 ) 132 { 133 FIXME("\n"); 134 return E_NOTIMPL; 135 } 136 137 static HRESULT WINAPI automatic_updates_DetectNow( 138 IAutomaticUpdates *This ) 139 { 140 FIXME("\n"); 141 return E_NOTIMPL; 142 } 143 144 static HRESULT WINAPI automatic_updates_Pause( 145 IAutomaticUpdates *This ) 146 { 147 FIXME("\n"); 148 return S_OK; 149 } 150 151 static HRESULT WINAPI automatic_updates_Resume( 152 IAutomaticUpdates *This ) 153 { 154 FIXME("\n"); 155 return S_OK; 156 } 157 158 static HRESULT WINAPI automatic_updates_ShowSettingsDialog( 159 IAutomaticUpdates *This ) 160 { 161 FIXME("\n"); 162 return E_NOTIMPL; 163 } 164 165 static HRESULT WINAPI automatic_updates_EnableService( 166 IAutomaticUpdates *This ) 167 { 168 FIXME("\n"); 169 return E_NOTIMPL; 170 } 171 172 static HRESULT WINAPI automatic_updates_get_ServiceEnabled( 173 IAutomaticUpdates *This, 174 VARIANT_BOOL *retval ) 175 { 176 FIXME("%p\n", retval); 177 return E_NOTIMPL; 178 } 179 180 static HRESULT WINAPI automatic_updates_get_Settings( 181 IAutomaticUpdates *This, 182 IAutomaticUpdatesSettings **retval ) 183 { 184 FIXME("%p\n", retval); 185 return E_NOTIMPL; 186 } 187 188 static const struct IAutomaticUpdatesVtbl automatic_updates_vtbl = 189 { 190 automatic_updates_QueryInterface, 191 automatic_updates_AddRef, 192 automatic_updates_Release, 193 automatic_updates_GetTypeInfoCount, 194 automatic_updates_GetTypeInfo, 195 automatic_updates_GetIDsOfNames, 196 automatic_updates_Invoke, 197 automatic_updates_DetectNow, 198 automatic_updates_Pause, 199 automatic_updates_Resume, 200 automatic_updates_ShowSettingsDialog, 201 automatic_updates_get_Settings, 202 automatic_updates_get_ServiceEnabled, 203 automatic_updates_EnableService 204 }; 205 206 HRESULT AutomaticUpdates_create( LPVOID *ppObj ) 207 { 208 automatic_updates *updates; 209 210 TRACE("(%p)\n", ppObj); 211 212 updates = HeapAlloc( GetProcessHeap(), 0, sizeof(*updates) ); 213 if (!updates) return E_OUTOFMEMORY; 214 215 updates->IAutomaticUpdates_iface.lpVtbl = &automatic_updates_vtbl; 216 updates->refs = 1; 217 218 *ppObj = &updates->IAutomaticUpdates_iface; 219 220 TRACE("returning iface %p\n", *ppObj); 221 return S_OK; 222 } 223