From 3dffae656356675f0456293b56f11a182bdd71c9 Mon Sep 17 00:00:00 2001 From: Thomas Faber Date: Thu, 21 Jun 2012 09:05:15 +0000 Subject: [PATCH] [WUAPI] - Sync to Wine 1.5.4 svn path=/trunk/; revision=56770 --- reactos/dll/win32/wuapi/CMakeLists.txt | 15 +- reactos/dll/win32/wuapi/downloader.c | 8 +- reactos/dll/win32/wuapi/installer.c | 116 ++++++- reactos/dll/win32/wuapi/main.c | 37 +- reactos/dll/win32/wuapi/regsvr.c | 430 ------------------------ reactos/dll/win32/wuapi/searcher.c | 86 ++++- reactos/dll/win32/wuapi/session.c | 8 +- reactos/dll/win32/wuapi/systeminfo.c | 163 +++++++++ reactos/dll/win32/wuapi/updates.c | 10 +- reactos/dll/win32/wuapi/wuapi.rc | 2 + reactos/dll/win32/wuapi/wuapi_private.h | 11 +- reactos/dll/win32/wuapi/wuapi_tlb.idl | 21 ++ reactos/include/psdk/wuapi.idl | 29 ++ reactos/media/doc/README.WINE | 5 +- 14 files changed, 472 insertions(+), 469 deletions(-) delete mode 100644 reactos/dll/win32/wuapi/regsvr.c create mode 100644 reactos/dll/win32/wuapi/systeminfo.c create mode 100644 reactos/dll/win32/wuapi/wuapi.rc create mode 100644 reactos/dll/win32/wuapi/wuapi_tlb.idl diff --git a/reactos/dll/win32/wuapi/CMakeLists.txt b/reactos/dll/win32/wuapi/CMakeLists.txt index 7d0fcc409a4..d7bfa48efa2 100644 --- a/reactos/dll/win32/wuapi/CMakeLists.txt +++ b/reactos/dll/win32/wuapi/CMakeLists.txt @@ -1,5 +1,9 @@ -add_definitions(-D__WINESRC__) +add_typelib(wuapi_tlb.idl) + +add_definitions( + -D__WINESRC__ + -DCOM_NO_WINDOWS_H) remove_definitions(-D_WIN32_WINNT=0x502) add_definitions(-D_WIN32_WINNT=0x600) @@ -14,15 +18,22 @@ list(APPEND SOURCE downloader.c installer.c main.c - regsvr.c searcher.c session.c + systeminfo.c updates.c + wuapi.rc ${CMAKE_CURRENT_BINARY_DIR}/wuapi.def) +set_source_files_properties(wuapi.rc PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/wuapi_tlb.tlb) + add_library(wuapi SHARED ${SOURCE}) set_module_type(wuapi win32dll) target_link_libraries(wuapi uuid wine wuguid) add_importlibs(wuapi ole32 advapi32 msvcrt kernel32 ntdll) + +# wuapi_tlb.tlb needs stdole2.tlb +add_dependencies(wuapi stdole2) + add_cd_file(TARGET wuapi DESTINATION reactos/system32 FOR all) diff --git a/reactos/dll/win32/wuapi/downloader.c b/reactos/dll/win32/wuapi/downloader.c index 72929661df5..6bed32ee660 100644 --- a/reactos/dll/win32/wuapi/downloader.c +++ b/reactos/dll/win32/wuapi/downloader.c @@ -36,13 +36,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(wuapi); typedef struct _update_downloader { - const struct IUpdateDownloaderVtbl *vtbl; + IUpdateDownloader IUpdateDownloader_iface; LONG refs; } update_downloader; static inline update_downloader *impl_from_IUpdateDownloader( IUpdateDownloader *iface ) { - return (update_downloader *)((char *)iface - FIELD_OFFSET( update_downloader, vtbl )); + return CONTAINING_RECORD(iface, update_downloader, IUpdateDownloader_iface); } static ULONG WINAPI update_downloader_AddRef( @@ -257,10 +257,10 @@ HRESULT UpdateDownloader_create( IUnknown *pUnkOuter, LPVOID *ppObj ) downloader = HeapAlloc( GetProcessHeap(), 0, sizeof(*downloader) ); if (!downloader) return E_OUTOFMEMORY; - downloader->vtbl = &update_downloader_vtbl; + downloader->IUpdateDownloader_iface.lpVtbl = &update_downloader_vtbl; downloader->refs = 1; - *ppObj = &downloader->vtbl; + *ppObj = &downloader->IUpdateDownloader_iface; TRACE("returning iface %p\n", *ppObj); return S_OK; diff --git a/reactos/dll/win32/wuapi/installer.c b/reactos/dll/win32/wuapi/installer.c index 1a2c5530a24..f60d6181fcc 100644 --- a/reactos/dll/win32/wuapi/installer.c +++ b/reactos/dll/win32/wuapi/installer.c @@ -35,13 +35,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(wuapi); typedef struct _update_installer { - const struct IUpdateInstallerVtbl *vtbl; + IUpdateInstaller IUpdateInstaller_iface; LONG refs; } update_installer; static inline update_installer *impl_from_IUpdateInstaller( IUpdateInstaller *iface ) { - return (update_installer *)((char *)iface - FIELD_OFFSET( update_installer, vtbl )); + return CONTAINING_RECORD(iface, update_installer, IUpdateInstaller_iface); } static ULONG WINAPI update_installer_AddRef( @@ -213,6 +213,103 @@ static HRESULT WINAPI update_installer_put_Updates( return E_NOTIMPL; } +static HRESULT WINAPI update_installer_BeginInstall( + IUpdateInstaller *This, + IUnknown *onProgressChanged, + IUnknown *onCompleted, + VARIANT state, + IInstallationJob **retval ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_installer_BeginUninstall( + IUpdateInstaller *This, + IUnknown *onProgressChanged, + IUnknown *onCompleted, + VARIANT state, + IInstallationJob **retval ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_installer_EndInstall( + IUpdateInstaller *This, + IInstallationJob *value, + IInstallationResult **retval ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_installer_EndUninstall( + IUpdateInstaller *This, + IInstallationJob *value, + IInstallationResult **retval ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_installer_Install( + IUpdateInstaller *This, + IInstallationResult **retval ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_installer_RunWizard( + IUpdateInstaller *This, + BSTR dialogTitle, + IInstallationResult **retval ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_installer_get_IsBusy( + IUpdateInstaller *This, + VARIANT_BOOL *retval ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_installer_Uninstall( + IUpdateInstaller *This, + IInstallationResult **retval ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_installer_get_AllowSourcePrompts( + IUpdateInstaller *This, + VARIANT_BOOL *retval ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_installer_put_AllowSourcePrompts( + IUpdateInstaller *This, + VARIANT_BOOL value ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_installer_get_RebootRequiredBeforeInstallation( + IUpdateInstaller *This, + VARIANT_BOOL *retval ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + static const struct IUpdateInstallerVtbl update_installer_vtbl = { update_installer_QueryInterface, @@ -232,6 +329,17 @@ static const struct IUpdateInstallerVtbl update_installer_vtbl = update_installer_get_ParentWindow, update_installer_get_Updates, update_installer_put_Updates, + update_installer_BeginInstall, + update_installer_BeginUninstall, + update_installer_EndInstall, + update_installer_EndUninstall, + update_installer_Install, + update_installer_RunWizard, + update_installer_get_IsBusy, + update_installer_Uninstall, + update_installer_get_AllowSourcePrompts, + update_installer_put_AllowSourcePrompts, + update_installer_get_RebootRequiredBeforeInstallation }; HRESULT UpdateInstaller_create( IUnknown *pUnkOuter, LPVOID *ppObj ) @@ -243,10 +351,10 @@ HRESULT UpdateInstaller_create( IUnknown *pUnkOuter, LPVOID *ppObj ) installer = HeapAlloc( GetProcessHeap(), 0, sizeof(*installer) ); if (!installer) return E_OUTOFMEMORY; - installer->vtbl = &update_installer_vtbl; + installer->IUpdateInstaller_iface.lpVtbl = &update_installer_vtbl; installer->refs = 1; - *ppObj = &installer->vtbl; + *ppObj = &installer->IUpdateInstaller_iface; TRACE("returning iface %p\n", *ppObj); return S_OK; diff --git a/reactos/dll/win32/wuapi/main.c b/reactos/dll/win32/wuapi/main.c index d46ad38c99f..80daca0c110 100644 --- a/reactos/dll/win32/wuapi/main.c +++ b/reactos/dll/win32/wuapi/main.c @@ -27,6 +27,7 @@ #include "winbase.h" #include "winuser.h" #include "ole2.h" +#include "rpcproxy.h" #include "wuapi.h" #include "wine/debug.h" @@ -38,13 +39,13 @@ typedef HRESULT (*fnCreateInstance)( IUnknown *pUnkOuter, LPVOID *ppObj ); typedef struct _wucf { - const struct IClassFactoryVtbl *vtbl; + IClassFactory IClassFactory_iface; fnCreateInstance pfnCreateInstance; } wucf; static inline wucf *impl_from_IClassFactory( IClassFactory *iface ) { - return (wucf *)((char *)iface - FIELD_OFFSET( wucf, vtbl )); + return CONTAINING_RECORD(iface, wucf, IClassFactory_iface); } static HRESULT WINAPI wucf_QueryInterface( IClassFactory *iface, REFIID riid, LPVOID *ppobj ) @@ -111,8 +112,11 @@ static const struct IClassFactoryVtbl wucf_vtbl = wucf_LockServer }; -static wucf sessioncf = { &wucf_vtbl, UpdateSession_create }; -static wucf updatescf = { &wucf_vtbl, AutomaticUpdates_create }; +static wucf sessioncf = { { &wucf_vtbl }, UpdateSession_create }; +static wucf updatescf = { { &wucf_vtbl }, AutomaticUpdates_create }; +static wucf sysinfocf = { { &wucf_vtbl }, SystemInformation_create }; + +static HINSTANCE instance; BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID lpv ) { @@ -121,6 +125,7 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID lpv ) case DLL_WINE_PREATTACH: return FALSE; /* prefer native version */ case DLL_PROCESS_ATTACH: + instance = hinst; DisableThreadLibraryCalls( hinst ); break; case DLL_PROCESS_DETACH: @@ -137,11 +142,15 @@ HRESULT WINAPI DllGetClassObject( REFCLSID rclsid, REFIID iid, LPVOID *ppv ) if (IsEqualGUID( rclsid, &CLSID_UpdateSession )) { - cf = (IClassFactory *)&sessioncf.vtbl; + cf = &sessioncf.IClassFactory_iface; } else if (IsEqualGUID( rclsid, &CLSID_AutomaticUpdates )) { - cf = (IClassFactory *)&updatescf.vtbl; + cf = &updatescf.IClassFactory_iface; + } + else if (IsEqualGUID( rclsid, &CLSID_SystemInformation )) + { + cf = &sysinfocf.IClassFactory_iface; } if (!cf) return CLASS_E_CLASSNOTAVAILABLE; return IClassFactory_QueryInterface( cf, iid, ppv ); @@ -151,3 +160,19 @@ HRESULT WINAPI DllCanUnloadNow( void ) { return S_FALSE; } + +/*********************************************************************** + * DllRegisterServer (WUAPI.@) + */ +HRESULT WINAPI DllRegisterServer(void) +{ + return __wine_register_resources( instance ); +} + +/*********************************************************************** + * DllUnregisterServer (WUAPI.@) + */ +HRESULT WINAPI DllUnregisterServer(void) +{ + return __wine_unregister_resources( instance ); +} diff --git a/reactos/dll/win32/wuapi/regsvr.c b/reactos/dll/win32/wuapi/regsvr.c deleted file mode 100644 index 167368c6db7..00000000000 --- a/reactos/dll/win32/wuapi/regsvr.c +++ /dev/null @@ -1,430 +0,0 @@ -/* - * self-registerable dll functions for wuapi.dll - * - * Copyright (C) 2003 John K. Hohm - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - - -#include -#include - -#include "windef.h" -#include "winbase.h" -#include "winuser.h" -#include "winreg.h" -#include "winerror.h" -#include "objbase.h" -#include "wuapi.h" - -#include "wine/debug.h" -#include "wine/unicode.h" - -WINE_DEFAULT_DEBUG_CHANNEL(wuapi); - -/* - * Near the bottom of this file are the exported DllRegisterServer and - * DllUnregisterServer, which make all this worthwhile. - */ - -/*********************************************************************** - * interface for self-registering - */ -struct regsvr_interface -{ - IID const *iid; /* NULL for end of list */ - LPCSTR name; /* can be NULL to omit */ - IID const *base_iid; /* can be NULL to omit */ - int num_methods; /* can be <0 to omit */ - CLSID const *ps_clsid; /* can be NULL to omit */ - CLSID const *ps_clsid32; /* can be NULL to omit */ -}; - -static HRESULT register_interfaces(struct regsvr_interface const *list); -static HRESULT unregister_interfaces(struct regsvr_interface const *list); - -struct regsvr_coclass -{ - CLSID const *clsid; /* NULL for end of list */ - LPCSTR name; /* can be NULL to omit */ - LPCSTR ips; /* can be NULL to omit */ - LPCSTR ips32; /* can be NULL to omit */ - LPCSTR ips32_tmodel; /* can be NULL to omit */ - LPCSTR clsid_str; /* can be NULL to omit */ - LPCSTR progid; /* can be NULL to omit */ -}; - -static HRESULT register_coclasses(struct regsvr_coclass const *list); -static HRESULT unregister_coclasses(struct regsvr_coclass const *list); - -/*********************************************************************** - * static string constants - */ -static WCHAR const interface_keyname[10] = { - 'I', 'n', 't', 'e', 'r', 'f', 'a', 'c', 'e', 0 }; -static WCHAR const base_ifa_keyname[14] = { - 'B', 'a', 's', 'e', 'I', 'n', 't', 'e', 'r', 'f', 'a', 'c', - 'e', 0 }; -static WCHAR const num_methods_keyname[11] = { - 'N', 'u', 'm', 'M', 'e', 't', 'h', 'o', 'd', 's', 0 }; -static WCHAR const ps_clsid_keyname[15] = { - 'P', 'r', 'o', 'x', 'y', 'S', 't', 'u', 'b', 'C', 'l', 's', - 'i', 'd', 0 }; -static WCHAR const ps_clsid32_keyname[17] = { - 'P', 'r', 'o', 'x', 'y', 'S', 't', 'u', 'b', 'C', 'l', 's', - 'i', 'd', '3', '2', 0 }; -static WCHAR const clsid_keyname[6] = { - 'C', 'L', 'S', 'I', 'D', 0 }; -static WCHAR const ips_keyname[13] = { - 'I', 'n', 'P', 'r', 'o', 'c', 'S', 'e', 'r', 'v', 'e', 'r', - 0 }; -static WCHAR const ips32_keyname[15] = { - 'I', 'n', 'P', 'r', 'o', 'c', 'S', 'e', 'r', 'v', 'e', 'r', - '3', '2', 0 }; -static WCHAR const progid_keyname[7] = { - 'P', 'r', 'o', 'g', 'I', 'D', 0 }; -static char const tmodel_valuename[] = "ThreadingModel"; - -/*********************************************************************** - * static helper functions - */ -static LONG register_key_guid(HKEY base, WCHAR const *name, GUID const *guid); -static LONG register_key_defvalueW(HKEY base, WCHAR const *name, - WCHAR const *value); -static LONG register_key_defvalueA(HKEY base, WCHAR const *name, - char const *value); - -/*********************************************************************** - * register_interfaces - */ -static HRESULT register_interfaces(struct regsvr_interface const *list) -{ - LONG res = ERROR_SUCCESS; - HKEY interface_key; - - res = RegCreateKeyExW(HKEY_CLASSES_ROOT, interface_keyname, 0, NULL, 0, - KEY_READ | KEY_WRITE, NULL, &interface_key, NULL); - if (res != ERROR_SUCCESS) goto error_return; - - for (; res == ERROR_SUCCESS && list->iid; ++list) { - WCHAR buf[39]; - HKEY iid_key; - - StringFromGUID2(list->iid, buf, 39); - res = RegCreateKeyExW(interface_key, buf, 0, NULL, 0, - KEY_READ | KEY_WRITE, NULL, &iid_key, NULL); - if (res != ERROR_SUCCESS) goto error_close_interface_key; - - if (list->name) { - res = RegSetValueExA(iid_key, NULL, 0, REG_SZ, - (CONST BYTE*)(list->name), - strlen(list->name) + 1); - if (res != ERROR_SUCCESS) goto error_close_iid_key; - } - - if (list->base_iid) { - res = register_key_guid(iid_key, base_ifa_keyname, list->base_iid); - if (res != ERROR_SUCCESS) goto error_close_iid_key; - } - - if (0 <= list->num_methods) { - static WCHAR const fmt[3] = { '%', 'd', 0 }; - HKEY key; - - res = RegCreateKeyExW(iid_key, num_methods_keyname, 0, NULL, 0, - KEY_READ | KEY_WRITE, NULL, &key, NULL); - if (res != ERROR_SUCCESS) goto error_close_iid_key; - - sprintfW(buf, fmt, list->num_methods); - res = RegSetValueExW(key, NULL, 0, REG_SZ, - (CONST BYTE*)buf, - (lstrlenW(buf) + 1) * sizeof(WCHAR)); - RegCloseKey(key); - - if (res != ERROR_SUCCESS) goto error_close_iid_key; - } - - if (list->ps_clsid) { - res = register_key_guid(iid_key, ps_clsid_keyname, list->ps_clsid); - if (res != ERROR_SUCCESS) goto error_close_iid_key; - } - - if (list->ps_clsid32) { - res = register_key_guid(iid_key, ps_clsid32_keyname, list->ps_clsid32); - if (res != ERROR_SUCCESS) goto error_close_iid_key; - } - - error_close_iid_key: - RegCloseKey(iid_key); - } - -error_close_interface_key: - RegCloseKey(interface_key); -error_return: - return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK; -} - -/*********************************************************************** - * unregister_interfaces - */ -static HRESULT unregister_interfaces(struct regsvr_interface const *list) -{ - LONG res = ERROR_SUCCESS; - HKEY interface_key; - - res = RegOpenKeyExW(HKEY_CLASSES_ROOT, interface_keyname, 0, - KEY_READ | KEY_WRITE, &interface_key); - if (res == ERROR_FILE_NOT_FOUND) return S_OK; - if (res != ERROR_SUCCESS) goto error_return; - - for (; res == ERROR_SUCCESS && list->iid; ++list) { - WCHAR buf[39]; - - StringFromGUID2(list->iid, buf, 39); - res = RegDeleteTreeW(interface_key, buf); - if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS; - } - - RegCloseKey(interface_key); -error_return: - return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK; -} - -/*********************************************************************** - * register_coclasses - */ -static HRESULT register_coclasses(struct regsvr_coclass const *list) -{ - LONG res = ERROR_SUCCESS; - HKEY coclass_key; - - res = RegCreateKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0, NULL, 0, - KEY_READ | KEY_WRITE, NULL, &coclass_key, NULL); - if (res != ERROR_SUCCESS) goto error_return; - - for (; res == ERROR_SUCCESS && list->clsid; ++list) { - WCHAR buf[39]; - HKEY clsid_key; - - StringFromGUID2(list->clsid, buf, 39); - res = RegCreateKeyExW(coclass_key, buf, 0, NULL, 0, - KEY_READ | KEY_WRITE, NULL, &clsid_key, NULL); - if (res != ERROR_SUCCESS) goto error_close_coclass_key; - - if (list->name) { - res = RegSetValueExA(clsid_key, NULL, 0, REG_SZ, - (CONST BYTE*)(list->name), - strlen(list->name) + 1); - if (res != ERROR_SUCCESS) goto error_close_clsid_key; - } - - if (list->ips) { - res = register_key_defvalueA(clsid_key, ips_keyname, list->ips); - if (res != ERROR_SUCCESS) goto error_close_clsid_key; - } - - if (list->ips32) { - HKEY ips32_key; - - res = RegCreateKeyExW(clsid_key, ips32_keyname, 0, NULL, 0, - KEY_READ | KEY_WRITE, NULL, - &ips32_key, NULL); - if (res != ERROR_SUCCESS) goto error_close_clsid_key; - - res = RegSetValueExA(ips32_key, NULL, 0, REG_SZ, - (CONST BYTE*)list->ips32, - lstrlenA(list->ips32) + 1); - if (res == ERROR_SUCCESS && list->ips32_tmodel) - res = RegSetValueExA(ips32_key, tmodel_valuename, 0, REG_SZ, - (CONST BYTE*)list->ips32_tmodel, - strlen(list->ips32_tmodel) + 1); - RegCloseKey(ips32_key); - if (res != ERROR_SUCCESS) goto error_close_clsid_key; - } - - if (list->clsid_str) { - res = register_key_defvalueA(clsid_key, clsid_keyname, - list->clsid_str); - if (res != ERROR_SUCCESS) goto error_close_clsid_key; - } - - if (list->progid) { - HKEY progid_key; - - res = register_key_defvalueA(clsid_key, progid_keyname, - list->progid); - if (res != ERROR_SUCCESS) goto error_close_clsid_key; - - res = RegCreateKeyExA(HKEY_CLASSES_ROOT, list->progid, 0, - NULL, 0, KEY_READ | KEY_WRITE, NULL, - &progid_key, NULL); - if (res != ERROR_SUCCESS) goto error_close_clsid_key; - - res = register_key_defvalueW(progid_key, clsid_keyname, buf); - RegCloseKey(progid_key); - if (res != ERROR_SUCCESS) goto error_close_clsid_key; - } - - error_close_clsid_key: - RegCloseKey(clsid_key); - } - -error_close_coclass_key: - RegCloseKey(coclass_key); -error_return: - return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK; -} - -/*********************************************************************** - * unregister_coclasses - */ -static HRESULT unregister_coclasses(struct regsvr_coclass const *list) -{ - LONG res = ERROR_SUCCESS; - HKEY coclass_key; - - res = RegOpenKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0, - KEY_READ | KEY_WRITE, &coclass_key); - if (res == ERROR_FILE_NOT_FOUND) return S_OK; - if (res != ERROR_SUCCESS) goto error_return; - - for (; res == ERROR_SUCCESS && list->clsid; ++list) { - WCHAR buf[39]; - - StringFromGUID2(list->clsid, buf, 39); - res = RegDeleteTreeW(coclass_key, buf); - if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS; - if (res != ERROR_SUCCESS) goto error_close_coclass_key; - - if (list->progid) { - res = RegDeleteTreeA(HKEY_CLASSES_ROOT, list->progid); - if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS; - if (res != ERROR_SUCCESS) goto error_close_coclass_key; - } - } - -error_close_coclass_key: - RegCloseKey(coclass_key); -error_return: - return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK; -} - -/*********************************************************************** - * regsvr_key_guid - */ -static LONG register_key_guid(HKEY base, WCHAR const *name, GUID const *guid) -{ - WCHAR buf[39]; - - StringFromGUID2(guid, buf, 39); - return register_key_defvalueW(base, name, buf); -} - -/*********************************************************************** - * regsvr_key_defvalueW - */ -static LONG register_key_defvalueW( - HKEY base, - WCHAR const *name, - WCHAR const *value) -{ - LONG res; - HKEY key; - - res = RegCreateKeyExW(base, name, 0, NULL, 0, - KEY_READ | KEY_WRITE, NULL, &key, NULL); - if (res != ERROR_SUCCESS) return res; - res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)value, - (lstrlenW(value) + 1) * sizeof(WCHAR)); - RegCloseKey(key); - return res; -} - -/*********************************************************************** - * regsvr_key_defvalueA - */ -static LONG register_key_defvalueA( - HKEY base, - WCHAR const *name, - char const *value) -{ - LONG res; - HKEY key; - - res = RegCreateKeyExW(base, name, 0, NULL, 0, - KEY_READ | KEY_WRITE, NULL, &key, NULL); - if (res != ERROR_SUCCESS) return res; - res = RegSetValueExA(key, NULL, 0, REG_SZ, (CONST BYTE*)value, - lstrlenA(value) + 1); - RegCloseKey(key); - return res; -} - -/*********************************************************************** - * coclass list - */ -static struct regsvr_coclass const coclass_list[] = { - { &CLSID_UpdateSession, - "CLSID_UpdateSession", - NULL, - "wuapi.dll", - "Both" - }, - { &CLSID_AutomaticUpdates, - "CLSID_AutomaticUpdates", - NULL, - "wuapi.dll", - "Both" - }, - { NULL } /* list terminator */ -}; - -/*********************************************************************** - * interface list - */ -static struct regsvr_interface const interface_list[] = { - { NULL } /* list terminator */ -}; - -/*********************************************************************** - * DllRegisterServer (WUAPI.@) - */ -HRESULT WINAPI DllRegisterServer(void) -{ - HRESULT hr; - - TRACE("\n"); - - hr = register_coclasses(coclass_list); - if (SUCCEEDED(hr)) - hr = register_interfaces(interface_list); - return hr; -} - -/*********************************************************************** - * DllUnregisterServer (WUAPI.@) - */ -HRESULT WINAPI DllUnregisterServer(void) -{ - HRESULT hr; - - TRACE("\n"); - - hr = unregister_coclasses(coclass_list); - if (SUCCEEDED(hr)) - hr = unregister_interfaces(interface_list); - return hr; -} diff --git a/reactos/dll/win32/wuapi/searcher.c b/reactos/dll/win32/wuapi/searcher.c index 8105681f7a1..522f99abf08 100644 --- a/reactos/dll/win32/wuapi/searcher.c +++ b/reactos/dll/win32/wuapi/searcher.c @@ -35,13 +35,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(wuapi); typedef struct _update_searcher { - const struct IUpdateSearcherVtbl *vtbl; + IUpdateSearcher IUpdateSearcher_iface; LONG refs; } update_searcher; static inline update_searcher *impl_from_IUpdateSearcher( IUpdateSearcher *iface ) { - return (update_searcher *)((char *)iface - FIELD_OFFSET( update_searcher, vtbl )); + return CONTAINING_RECORD(iface, update_searcher, IUpdateSearcher_iface); } static ULONG WINAPI update_searcher_AddRef( @@ -217,6 +217,74 @@ static HRESULT WINAPI update_searcher_EndSearch( return E_NOTIMPL; } +static HRESULT WINAPI update_searcher_EscapeString( + IUpdateSearcher *This, + BSTR unescaped, + BSTR *retval ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_searcher_QueryHistory( + IUpdateSearcher *This, + LONG startIndex, + LONG count, + IUpdateHistoryEntryCollection **retval ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_searcher_Search( + IUpdateSearcher *This, + BSTR criteria, + ISearchResult **retval ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_searcher_get_Online( + IUpdateSearcher *This, + VARIANT_BOOL *retval ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_searcher_put_Online( + IUpdateSearcher *This, + VARIANT_BOOL value ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_searcher_GetTotalHistoryCount( + IUpdateSearcher *This, + LONG *retval ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_searcher_get_ServiceID( + IUpdateSearcher *This, + BSTR *retval ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_searcher_put_ServiceID( + IUpdateSearcher *This, + BSTR value ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + static const struct IUpdateSearcherVtbl update_searcher_vtbl = { update_searcher_QueryInterface, @@ -235,7 +303,15 @@ static const struct IUpdateSearcherVtbl update_searcher_vtbl = update_searcher_get_ServerSelection, update_searcher_put_ServerSelection, update_searcher_BeginSearch, - update_searcher_EndSearch + update_searcher_EndSearch, + update_searcher_EscapeString, + update_searcher_QueryHistory, + update_searcher_Search, + update_searcher_get_Online, + update_searcher_put_Online, + update_searcher_GetTotalHistoryCount, + update_searcher_get_ServiceID, + update_searcher_put_ServiceID }; HRESULT UpdateSearcher_create( IUnknown *pUnkOuter, LPVOID *ppObj ) @@ -247,10 +323,10 @@ HRESULT UpdateSearcher_create( IUnknown *pUnkOuter, LPVOID *ppObj ) searcher = HeapAlloc( GetProcessHeap(), 0, sizeof(*searcher) ); if (!searcher) return E_OUTOFMEMORY; - searcher->vtbl = &update_searcher_vtbl; + searcher->IUpdateSearcher_iface.lpVtbl = &update_searcher_vtbl; searcher->refs = 1; - *ppObj = &searcher->vtbl; + *ppObj = &searcher->IUpdateSearcher_iface; TRACE("returning iface %p\n", *ppObj); return S_OK; diff --git a/reactos/dll/win32/wuapi/session.c b/reactos/dll/win32/wuapi/session.c index 5f163c724c5..a6abbc6b072 100644 --- a/reactos/dll/win32/wuapi/session.c +++ b/reactos/dll/win32/wuapi/session.c @@ -36,13 +36,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(wuapi); typedef struct _update_session { - const struct IUpdateSessionVtbl *vtbl; + IUpdateSession IUpdateSession_iface; LONG refs; } update_session; static inline update_session *impl_from_IUpdateSession( IUpdateSession *iface ) { - return (update_session *)((char *)iface - FIELD_OFFSET( update_session, vtbl )); + return CONTAINING_RECORD(iface, update_session, IUpdateSession_iface); } static ULONG WINAPI update_session_AddRef( @@ -226,10 +226,10 @@ HRESULT UpdateSession_create( IUnknown *pUnkOuter, LPVOID *ppObj ) session = HeapAlloc( GetProcessHeap(), 0, sizeof(*session) ); if (!session) return E_OUTOFMEMORY; - session->vtbl = &update_session_vtbl; + session->IUpdateSession_iface.lpVtbl = &update_session_vtbl; session->refs = 1; - *ppObj = &session->vtbl; + *ppObj = &session->IUpdateSession_iface; TRACE("returning iface %p\n", *ppObj); return S_OK; diff --git a/reactos/dll/win32/wuapi/systeminfo.c b/reactos/dll/win32/wuapi/systeminfo.c new file mode 100644 index 00000000000..f3f635fabf7 --- /dev/null +++ b/reactos/dll/win32/wuapi/systeminfo.c @@ -0,0 +1,163 @@ +/* + * IAutomaticUpdates implementation + * + * Copyright 2008 Hans Leidekker + * Copyright 2011 Bernhard Loos + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#define COBJMACROS + +#include "config.h" +#include + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "ole2.h" +#include "wuapi.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wuapi); + +typedef struct _systeminfo +{ + ISystemInformation ISystemInformation_iface; + LONG refs; +} systeminfo; + +static inline systeminfo *impl_from_ISystemInformation(ISystemInformation *iface) +{ + return CONTAINING_RECORD(iface, systeminfo, ISystemInformation_iface); +} + +static ULONG WINAPI systeminfo_AddRef(ISystemInformation *iface) +{ + systeminfo *This = impl_from_ISystemInformation(iface); + return InterlockedIncrement(&This->refs); +} + +static ULONG WINAPI systeminfo_Release(ISystemInformation *iface) +{ + systeminfo *This = impl_from_ISystemInformation(iface); + LONG refs = InterlockedDecrement(&This->refs); + if (!refs) + { + TRACE("destroying %p\n", This); + HeapFree(GetProcessHeap(), 0, This); + } + return refs; +} + +static HRESULT WINAPI systeminfo_QueryInterface(ISystemInformation *iface, + REFIID riid, void **ppvObject) +{ + systeminfo *This = impl_from_ISystemInformation(iface); + + TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObject); + + if (IsEqualGUID(riid, &IID_ISystemInformation) || + IsEqualGUID(riid, &IID_IDispatch) || + IsEqualGUID(riid, &IID_IUnknown)) + { + *ppvObject = iface; + } + else + { + FIXME("interface %s not implemented\n", debugstr_guid(riid)); + return E_NOINTERFACE; + } + ISystemInformation_AddRef(iface); + return S_OK; +} + +static HRESULT WINAPI systeminfo_GetTypeInfoCount(ISystemInformation *iface, + UINT *pctinfo ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI systeminfo_GetTypeInfo(ISystemInformation *iface, + UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI systeminfo_GetIDsOfNames(ISystemInformation *iface, + REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, + DISPID *rgDispId) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI systeminfo_Invoke(ISystemInformation *iface, + DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, + DISPPARAMS *pDispParams, VARIANT *pVarResult, + EXCEPINFO *pExcepInfo, UINT *puArgErr ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI systeminfo_get_OemHardwareSupportLink(ISystemInformation *iface, + BSTR *retval) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI systeminfo_get_RebootRequired(ISystemInformation *iface, + VARIANT_BOOL *retval) +{ + *retval = VARIANT_FALSE; + return S_OK; +} + +static const struct ISystemInformationVtbl systeminfo_vtbl = +{ + systeminfo_QueryInterface, + systeminfo_AddRef, + systeminfo_Release, + systeminfo_GetTypeInfoCount, + systeminfo_GetTypeInfo, + systeminfo_GetIDsOfNames, + systeminfo_Invoke, + systeminfo_get_OemHardwareSupportLink, + systeminfo_get_RebootRequired +}; + +HRESULT SystemInformation_create(IUnknown *pUnkOuter, LPVOID *ppObj) +{ + systeminfo *info; + + TRACE("(%p,%p)\n", pUnkOuter, ppObj); + + info = HeapAlloc(GetProcessHeap(), 0, sizeof(*info)); + if (!info) + return E_OUTOFMEMORY; + + info->ISystemInformation_iface.lpVtbl = &systeminfo_vtbl; + info->refs = 1; + + *ppObj = &info->ISystemInformation_iface; + + TRACE("returning iface %p\n", *ppObj); + return S_OK; +} diff --git a/reactos/dll/win32/wuapi/updates.c b/reactos/dll/win32/wuapi/updates.c index 0366ebc94bf..d099fb4bef3 100644 --- a/reactos/dll/win32/wuapi/updates.c +++ b/reactos/dll/win32/wuapi/updates.c @@ -35,13 +35,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(wuapi); typedef struct _automatic_updates { - const struct IAutomaticUpdatesVtbl *vtbl; + IAutomaticUpdates IAutomaticUpdates_iface; LONG refs; } automatic_updates; static inline automatic_updates *impl_from_IAutomaticUpdates( IAutomaticUpdates *iface ) { - return (automatic_updates *)((char*)iface - FIELD_OFFSET( automatic_updates, vtbl )); + return CONTAINING_RECORD(iface, automatic_updates, IAutomaticUpdates_iface); } static ULONG WINAPI automatic_updates_AddRef( @@ -151,7 +151,7 @@ static HRESULT WINAPI automatic_updates_Resume( IAutomaticUpdates *This ) { FIXME("\n"); - return E_NOTIMPL; + return S_OK; } static HRESULT WINAPI automatic_updates_ShowSettingsDialog( @@ -211,10 +211,10 @@ HRESULT AutomaticUpdates_create( IUnknown *pUnkOuter, LPVOID *ppObj ) updates = HeapAlloc( GetProcessHeap(), 0, sizeof(*updates) ); if (!updates) return E_OUTOFMEMORY; - updates->vtbl = &automatic_updates_vtbl; + updates->IAutomaticUpdates_iface.lpVtbl = &automatic_updates_vtbl; updates->refs = 1; - *ppObj = &updates->vtbl; + *ppObj = &updates->IAutomaticUpdates_iface; TRACE("returning iface %p\n", *ppObj); return S_OK; diff --git a/reactos/dll/win32/wuapi/wuapi.rc b/reactos/dll/win32/wuapi/wuapi.rc new file mode 100644 index 00000000000..e18f0ab0cc3 --- /dev/null +++ b/reactos/dll/win32/wuapi/wuapi.rc @@ -0,0 +1,2 @@ +/* @makedep: wuapi_tlb.tlb */ +1 TYPELIB wuapi_tlb.tlb diff --git a/reactos/dll/win32/wuapi/wuapi_private.h b/reactos/dll/win32/wuapi/wuapi_private.h index 9c10daf0527..444722b81cf 100644 --- a/reactos/dll/win32/wuapi/wuapi_private.h +++ b/reactos/dll/win32/wuapi/wuapi_private.h @@ -16,8 +16,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -extern HRESULT AutomaticUpdates_create( IUnknown *pUnkOuter, LPVOID *ppObj ); -extern HRESULT UpdateSession_create( IUnknown *pUnkOuter, LPVOID *ppObj ); -extern HRESULT UpdateSearcher_create( IUnknown *pUnkOuter, LPVOID *ppObj ); -extern HRESULT UpdateDownloader_create( IUnknown *pUnkOuter, LPVOID *ppObj ); -extern HRESULT UpdateInstaller_create( IUnknown *pUnkOuter, LPVOID *ppObj ); +extern HRESULT AutomaticUpdates_create( IUnknown *pUnkOuter, LPVOID *ppObj ) DECLSPEC_HIDDEN; +extern HRESULT UpdateSession_create( IUnknown *pUnkOuter, LPVOID *ppObj ) DECLSPEC_HIDDEN; +extern HRESULT UpdateSearcher_create( IUnknown *pUnkOuter, LPVOID *ppObj ) DECLSPEC_HIDDEN; +extern HRESULT UpdateDownloader_create( IUnknown *pUnkOuter, LPVOID *ppObj ) DECLSPEC_HIDDEN; +extern HRESULT UpdateInstaller_create( IUnknown *pUnkOuter, LPVOID *ppObj ) DECLSPEC_HIDDEN; +extern HRESULT SystemInformation_create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN; diff --git a/reactos/dll/win32/wuapi/wuapi_tlb.idl b/reactos/dll/win32/wuapi/wuapi_tlb.idl new file mode 100644 index 00000000000..120e36402c3 --- /dev/null +++ b/reactos/dll/win32/wuapi/wuapi_tlb.idl @@ -0,0 +1,21 @@ +/* + * Typelib for wuapi + * + * Copyright 2010 Alexandre Julliard + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "wuapi.idl" diff --git a/reactos/include/psdk/wuapi.idl b/reactos/include/psdk/wuapi.idl index 1989cd40bd6..d1a35930841 100644 --- a/reactos/include/psdk/wuapi.idl +++ b/reactos/include/psdk/wuapi.idl @@ -1300,6 +1300,26 @@ interface IUpdateInstaller : IDispatch [out, retval] VARIANT_BOOL *retval); } +[ + object, + uuid(ADE87BF7-7B56-4275-8FAB-B9B0E591844B), + oleautomation, + hidden, + dual, + nonextensible, + pointer_default(unique), +] +interface ISystemInformation : IDispatch +{ + [propget] + HRESULT OemHardwareSupportLink( + [out, retval] BSTR *retval); + + [propget] + HRESULT RebootRequired( + [out, retval] VARIANT_BOOL *retval); +} + [ helpstring("AutomaticUpdates Class"), threading(both), @@ -1318,4 +1338,13 @@ coclass AutomaticUpdates { interface IAutomaticUpdates; } ] coclass UpdateSession { interface IUpdateSession; } +[ + helpstring("SystemInformation Class"), + threading(both), + progid("Microsoft.Update.SystemInfo.1"), + vi_progid("Microsoft.Update.SystemInfo"), + uuid(C01B9BA0-BEA7-41BA-B604-D0A36F469133) +] +coclass SystemInformation { interface ISystemInformation; } + } /* WUApiLib */ diff --git a/reactos/media/doc/README.WINE b/reactos/media/doc/README.WINE index c9410d8ab93..594d79d72d6 100644 --- a/reactos/media/doc/README.WINE +++ b/reactos/media/doc/README.WINE @@ -193,7 +193,7 @@ reactos/dll/win32/wintrust # Autosync reactos/dll/win32/wldap32 # Autosync reactos/dll/win32/wmi # Synced to Wine-1.5.4 reactos/dll/win32/wtsapi32 # Synced to Wine-1.5.4 -reactos/dll/win32/wuapi # Autosync +reactos/dll/win32/wuapi # Synced to Wine-1.5.4 reactos/dll/win32/xinput1_1 # Synced to Wine-1.5.4 reactos/dll/win32/xinput1_2 # Synced to Wine-1.5.4 reactos/dll/win32/xinput1_3 # Synced to Wine-1.5.4 @@ -247,9 +247,6 @@ msvcrt - reactos/lib/sdk/crt/wine/undname.c # Synced at 20081130 reactos/lib/sdk/crt/thread/thread.c # Synced at 20080604 -snmpapi - - reactos/dll/win32/snmpapi/main.c # Synced at 20090222 - User32 - reactos/dll/win32/user32/controls/button.c # Synced to Wine-1_1_39 reactos/dll/win32/user32/controls/combo.c # Synced to Wine-1_1_39