PageRenderTime 47ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/reactos/dll/win32/wuapi/installer.c

https://gitlab.com/dj-tech/reactos
C | 348 lines | 289 code | 40 blank | 19 comment | 3 complexity | 4ed9a587ee75d4a9947731721f6518a2 MD5 | raw file
  1. /*
  2. * IUpdateInstaller 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. #include "wuapi_private.h"
  21. typedef struct _update_installer
  22. {
  23. IUpdateInstaller IUpdateInstaller_iface;
  24. LONG refs;
  25. } update_installer;
  26. static inline update_installer *impl_from_IUpdateInstaller( IUpdateInstaller *iface )
  27. {
  28. return CONTAINING_RECORD(iface, update_installer, IUpdateInstaller_iface);
  29. }
  30. static ULONG WINAPI update_installer_AddRef(
  31. IUpdateInstaller *iface )
  32. {
  33. update_installer *update_installer = impl_from_IUpdateInstaller( iface );
  34. return InterlockedIncrement( &update_installer->refs );
  35. }
  36. static ULONG WINAPI update_installer_Release(
  37. IUpdateInstaller *iface )
  38. {
  39. update_installer *update_installer = impl_from_IUpdateInstaller( iface );
  40. LONG refs = InterlockedDecrement( &update_installer->refs );
  41. if (!refs)
  42. {
  43. TRACE("destroying %p\n", update_installer);
  44. HeapFree( GetProcessHeap(), 0, update_installer );
  45. }
  46. return refs;
  47. }
  48. static HRESULT WINAPI update_installer_QueryInterface(
  49. IUpdateInstaller *iface,
  50. REFIID riid,
  51. void **ppvObject )
  52. {
  53. update_installer *This = impl_from_IUpdateInstaller( iface );
  54. TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppvObject );
  55. if ( IsEqualGUID( riid, &IID_IUpdateInstaller ) ||
  56. IsEqualGUID( riid, &IID_IDispatch ) ||
  57. IsEqualGUID( riid, &IID_IUnknown ) )
  58. {
  59. *ppvObject = iface;
  60. }
  61. else
  62. {
  63. FIXME("interface %s not implemented\n", debugstr_guid(riid));
  64. return E_NOINTERFACE;
  65. }
  66. IUpdateInstaller_AddRef( iface );
  67. return S_OK;
  68. }
  69. static HRESULT WINAPI update_installer_GetTypeInfoCount(
  70. IUpdateInstaller *iface,
  71. UINT *pctinfo )
  72. {
  73. FIXME("\n");
  74. return E_NOTIMPL;
  75. }
  76. static HRESULT WINAPI update_installer_GetTypeInfo(
  77. IUpdateInstaller *iface,
  78. UINT iTInfo,
  79. LCID lcid,
  80. ITypeInfo **ppTInfo )
  81. {
  82. FIXME("\n");
  83. return E_NOTIMPL;
  84. }
  85. static HRESULT WINAPI update_installer_GetIDsOfNames(
  86. IUpdateInstaller *iface,
  87. REFIID riid,
  88. LPOLESTR *rgszNames,
  89. UINT cNames,
  90. LCID lcid,
  91. DISPID *rgDispId )
  92. {
  93. FIXME("\n");
  94. return E_NOTIMPL;
  95. }
  96. static HRESULT WINAPI update_installer_Invoke(
  97. IUpdateInstaller *iface,
  98. DISPID dispIdMember,
  99. REFIID riid,
  100. LCID lcid,
  101. WORD wFlags,
  102. DISPPARAMS *pDispParams,
  103. VARIANT *pVarResult,
  104. EXCEPINFO *pExcepInfo,
  105. UINT *puArgErr )
  106. {
  107. FIXME("\n");
  108. return E_NOTIMPL;
  109. }
  110. static HRESULT WINAPI update_installer_get_ClientApplicationID(
  111. IUpdateInstaller *This,
  112. BSTR *retval )
  113. {
  114. FIXME("\n");
  115. return E_NOTIMPL;
  116. }
  117. static HRESULT WINAPI update_installer_put_ClientApplicationID(
  118. IUpdateInstaller *This,
  119. BSTR value )
  120. {
  121. FIXME("%p, %s\n", This, debugstr_w(value));
  122. return E_NOTIMPL;
  123. }
  124. static HRESULT WINAPI update_installer_get_IsForced(
  125. IUpdateInstaller *This,
  126. VARIANT_BOOL *retval )
  127. {
  128. FIXME("\n");
  129. return E_NOTIMPL;
  130. }
  131. static HRESULT WINAPI update_installer_put_IsForced(
  132. IUpdateInstaller *This,
  133. VARIANT_BOOL value )
  134. {
  135. FIXME("\n");
  136. return E_NOTIMPL;
  137. }
  138. static HRESULT WINAPI update_installer_get_ParentHwnd(
  139. IUpdateInstaller *This,
  140. HWND *retval )
  141. {
  142. FIXME("\n");
  143. return E_NOTIMPL;
  144. }
  145. static HRESULT WINAPI update_installer_put_ParentHwnd(
  146. IUpdateInstaller *This,
  147. HWND value )
  148. {
  149. FIXME("\n");
  150. return E_NOTIMPL;
  151. }
  152. static HRESULT WINAPI update_installer_put_ParentWindow(
  153. IUpdateInstaller *This,
  154. IUnknown *value )
  155. {
  156. FIXME("\n");
  157. return E_NOTIMPL;
  158. }
  159. static HRESULT WINAPI update_installer_get_ParentWindow(
  160. IUpdateInstaller *This,
  161. IUnknown **retval )
  162. {
  163. FIXME("\n");
  164. return E_NOTIMPL;
  165. }
  166. static HRESULT WINAPI update_installer_get_Updates(
  167. IUpdateInstaller *This,
  168. IUpdateCollection **retval )
  169. {
  170. FIXME("\n");
  171. return E_NOTIMPL;
  172. }
  173. static HRESULT WINAPI update_installer_put_Updates(
  174. IUpdateInstaller *This,
  175. IUpdateCollection *value )
  176. {
  177. FIXME("\n");
  178. return E_NOTIMPL;
  179. }
  180. static HRESULT WINAPI update_installer_BeginInstall(
  181. IUpdateInstaller *This,
  182. IUnknown *onProgressChanged,
  183. IUnknown *onCompleted,
  184. VARIANT state,
  185. IInstallationJob **retval )
  186. {
  187. FIXME("\n");
  188. return E_NOTIMPL;
  189. }
  190. static HRESULT WINAPI update_installer_BeginUninstall(
  191. IUpdateInstaller *This,
  192. IUnknown *onProgressChanged,
  193. IUnknown *onCompleted,
  194. VARIANT state,
  195. IInstallationJob **retval )
  196. {
  197. FIXME("\n");
  198. return E_NOTIMPL;
  199. }
  200. static HRESULT WINAPI update_installer_EndInstall(
  201. IUpdateInstaller *This,
  202. IInstallationJob *value,
  203. IInstallationResult **retval )
  204. {
  205. FIXME("\n");
  206. return E_NOTIMPL;
  207. }
  208. static HRESULT WINAPI update_installer_EndUninstall(
  209. IUpdateInstaller *This,
  210. IInstallationJob *value,
  211. IInstallationResult **retval )
  212. {
  213. FIXME("\n");
  214. return E_NOTIMPL;
  215. }
  216. static HRESULT WINAPI update_installer_Install(
  217. IUpdateInstaller *This,
  218. IInstallationResult **retval )
  219. {
  220. FIXME("\n");
  221. return E_NOTIMPL;
  222. }
  223. static HRESULT WINAPI update_installer_RunWizard(
  224. IUpdateInstaller *This,
  225. BSTR dialogTitle,
  226. IInstallationResult **retval )
  227. {
  228. FIXME("\n");
  229. return E_NOTIMPL;
  230. }
  231. static HRESULT WINAPI update_installer_get_IsBusy(
  232. IUpdateInstaller *This,
  233. VARIANT_BOOL *retval )
  234. {
  235. FIXME("\n");
  236. return E_NOTIMPL;
  237. }
  238. static HRESULT WINAPI update_installer_Uninstall(
  239. IUpdateInstaller *This,
  240. IInstallationResult **retval )
  241. {
  242. FIXME("\n");
  243. return E_NOTIMPL;
  244. }
  245. static HRESULT WINAPI update_installer_get_AllowSourcePrompts(
  246. IUpdateInstaller *This,
  247. VARIANT_BOOL *retval )
  248. {
  249. FIXME("\n");
  250. return E_NOTIMPL;
  251. }
  252. static HRESULT WINAPI update_installer_put_AllowSourcePrompts(
  253. IUpdateInstaller *This,
  254. VARIANT_BOOL value )
  255. {
  256. FIXME("\n");
  257. return E_NOTIMPL;
  258. }
  259. static HRESULT WINAPI update_installer_get_RebootRequiredBeforeInstallation(
  260. IUpdateInstaller *This,
  261. VARIANT_BOOL *retval )
  262. {
  263. FIXME("\n");
  264. return E_NOTIMPL;
  265. }
  266. static const struct IUpdateInstallerVtbl update_installer_vtbl =
  267. {
  268. update_installer_QueryInterface,
  269. update_installer_AddRef,
  270. update_installer_Release,
  271. update_installer_GetTypeInfoCount,
  272. update_installer_GetTypeInfo,
  273. update_installer_GetIDsOfNames,
  274. update_installer_Invoke,
  275. update_installer_get_ClientApplicationID,
  276. update_installer_put_ClientApplicationID,
  277. update_installer_get_IsForced,
  278. update_installer_put_IsForced,
  279. update_installer_get_ParentHwnd,
  280. update_installer_put_ParentHwnd,
  281. update_installer_put_ParentWindow,
  282. update_installer_get_ParentWindow,
  283. update_installer_get_Updates,
  284. update_installer_put_Updates,
  285. update_installer_BeginInstall,
  286. update_installer_BeginUninstall,
  287. update_installer_EndInstall,
  288. update_installer_EndUninstall,
  289. update_installer_Install,
  290. update_installer_RunWizard,
  291. update_installer_get_IsBusy,
  292. update_installer_Uninstall,
  293. update_installer_get_AllowSourcePrompts,
  294. update_installer_put_AllowSourcePrompts,
  295. update_installer_get_RebootRequiredBeforeInstallation
  296. };
  297. HRESULT UpdateInstaller_create( LPVOID *ppObj )
  298. {
  299. update_installer *installer;
  300. TRACE("(%p)\n", ppObj);
  301. installer = HeapAlloc( GetProcessHeap(), 0, sizeof(*installer) );
  302. if (!installer) return E_OUTOFMEMORY;
  303. installer->IUpdateInstaller_iface.lpVtbl = &update_installer_vtbl;
  304. installer->refs = 1;
  305. *ppObj = &installer->IUpdateInstaller_iface;
  306. TRACE("returning iface %p\n", *ppObj);
  307. return S_OK;
  308. }