From e0cb4d509338f5d1d6db71584722731d38b0d837 Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Wed, 20 Jan 2021 11:15:57 +0100 Subject: [PATCH] wbemprox: Add class SystemRestore stub implementation. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50033 Signed-off-by: Dmitry Timoshkov Signed-off-by: Hans Leidekker Signed-off-by: Alexandre Julliard --- dlls/wbemprox/Makefile.in | 1 + dlls/wbemprox/builtin.c | 38 ++++++++++++++++++++ dlls/wbemprox/sysrestore.c | 62 ++++++++++++++++++++++++++++++++ dlls/wbemprox/tests/query.c | 7 ++-- dlls/wbemprox/wbemprox_private.h | 5 +++ 5 files changed, 111 insertions(+), 2 deletions(-) create mode 100644 dlls/wbemprox/sysrestore.c diff --git a/dlls/wbemprox/Makefile.in b/dlls/wbemprox/Makefile.in index a26c833878f..ed2710f8855 100644 --- a/dlls/wbemprox/Makefile.in +++ b/dlls/wbemprox/Makefile.in @@ -14,6 +14,7 @@ C_SRCS = \ security.c \ service.c \ services.c \ + sysrestore.c \ table.c \ wbemlocator.c diff --git a/dlls/wbemprox/builtin.c b/dlls/wbemprox/builtin.c index 9bd58ca77e6..39166a21171 100644 --- a/dlls/wbemprox/builtin.c +++ b/dlls/wbemprox/builtin.c @@ -406,6 +406,20 @@ static const struct column col_systemsecurity[] = { L"GetSD", CIM_FLAG_ARRAY|COL_FLAG_METHOD }, { L"SetSD", CIM_FLAG_ARRAY|COL_FLAG_METHOD }, }; +static const struct column col_sysrestore[] = +{ + { L"CreationTime", CIM_STRING }, + { L"Description", CIM_STRING }, + { L"EventType", CIM_UINT32 }, + { L"RestorePointType", CIM_UINT32 }, + { L"SequenceNumber", CIM_UINT32 }, + /* methods */ + { L"CreateRestorePoint", CIM_FLAG_ARRAY|COL_FLAG_METHOD }, + { L"Disable", CIM_FLAG_ARRAY|COL_FLAG_METHOD }, + { L"Enable", CIM_FLAG_ARRAY|COL_FLAG_METHOD }, + { L"GetLastRestoreStatus", CIM_FLAG_ARRAY|COL_FLAG_METHOD }, + { L"Restore", CIM_FLAG_ARRAY|COL_FLAG_METHOD }, +}; static const struct column col_videocontroller[] = { { L"AdapterCompatibility", CIM_STRING }, @@ -783,6 +797,19 @@ struct record_stdregprov class_method *enumvalues; class_method *getstringvalue; }; +struct record_sysrestore +{ + const WCHAR *creation_time; + const WCHAR *description; + UINT32 event_type; + UINT32 restore_point_type; + UINT32 sequence_number; + class_method *create_restore_point; + class_method *disable_restore; + class_method *enable_restore; + class_method *get_last_restore_status; + class_method *restore; +}; struct record_systemsecurity { class_method *getsd; @@ -865,6 +892,10 @@ static const struct record_param data_param[] = { L"StdRegProv", L"GetStringValue", 1, L"sValueName", CIM_STRING }, { L"StdRegProv", L"GetStringValue", -1, L"ReturnValue", CIM_UINT32 }, { L"StdRegProv", L"GetStringValue", -1, L"sValue", CIM_STRING }, + { L"SystemRestore", L"Disable", 1, L"Drive", CIM_STRING }, + { L"SystemRestore", L"Disable", -1, L"ReturnValue", CIM_UINT32 }, + { L"SystemRestore", L"Enable", 1, L"Drive", CIM_STRING }, + { L"SystemRestore", L"Enable", -1, L"ReturnValue", CIM_UINT32 }, { L"Win32_Process", L"GetOwner", -1, L"ReturnValue", CIM_UINT32 }, { L"Win32_Process", L"GetOwner", -1, L"User", CIM_STRING }, { L"Win32_Process", L"GetOwner", -1, L"Domain", CIM_STRING }, @@ -895,6 +926,12 @@ static const struct record_stdregprov data_stdregprov[] = { { reg_create_key, reg_enum_key, reg_enum_values, reg_get_stringvalue } }; + +static const struct record_sysrestore data_sysrestore[] = +{ + { NULL, NULL, 0, 0, 0, create_restore_point, disable_restore, enable_restore, get_last_restore_status, restore } +}; + static UINT16 systemenclosure_chassistypes[] = { 1, @@ -3981,6 +4018,7 @@ static struct table builtin_classes[] = { L"CIM_LogicalDisk", C(col_logicaldisk), 0, 0, NULL, fill_logicaldisk }, { L"CIM_Processor", C(col_processor), 0, 0, NULL, fill_processor }, { L"StdRegProv", C(col_stdregprov), D(data_stdregprov) }, + { L"SystemRestore", C(col_sysrestore), D(data_sysrestore) }, { L"Win32_BIOS", C(col_bios), 0, 0, NULL, fill_bios }, { L"Win32_BaseBoard", C(col_baseboard), 0, 0, NULL, fill_baseboard }, { L"Win32_CDROMDrive", C(col_cdromdrive), 0, 0, NULL, fill_cdromdrive }, diff --git a/dlls/wbemprox/sysrestore.c b/dlls/wbemprox/sysrestore.c new file mode 100644 index 00000000000..b840d220b5c --- /dev/null +++ b/dlls/wbemprox/sysrestore.c @@ -0,0 +1,62 @@ +/* + * SystemRestore implementation + * + * Copyright 2020 Dmitry Timoshkov + * + * 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 + +#include "windef.h" +#include "winbase.h" +#include "wbemcli.h" + +#include "wine/debug.h" +#include "wbemprox_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wbemprox); + +HRESULT create_restore_point( IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObject **out ) +{ + FIXME("stub\n"); + return S_OK; +} + +HRESULT disable_restore( IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObject **out ) +{ + FIXME("stub\n"); + return S_OK; +} + +HRESULT enable_restore( IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObject **out ) +{ + FIXME("stub\n"); + return S_OK; +} + +HRESULT get_last_restore_status( IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObject **out ) +{ + FIXME("stub\n"); + return E_NOTIMPL; +} + +HRESULT restore( IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObject **out ) +{ + FIXME("stub\n"); + return S_OK; +} diff --git a/dlls/wbemprox/tests/query.c b/dlls/wbemprox/tests/query.c index 37b6fb4e8dc..1c7a615dd4e 100644 --- a/dlls/wbemprox/tests/query.c +++ b/dlls/wbemprox/tests/query.c @@ -1772,16 +1772,19 @@ static void test_SystemRestore( IWbemServices *services ) hr = IWbemServices_GetObject( services, class, 0, NULL, &service, NULL ); if (hr != S_OK) { - skip( "SystemRestore not available\n" ); + win_skip( "SystemRestore not available\n" ); SysFreeString( class ); return; } check_property( service, L"CreationTime", VT_NULL, CIM_STRING ); check_property( service, L"Description", VT_NULL, CIM_STRING ); + if (0) /* FIXME */ + { check_property( service, L"EventType", VT_NULL, CIM_UINT32 ); check_property( service, L"RestorePointType", VT_NULL, CIM_UINT32 ); check_property( service, L"SequenceNumber", VT_NULL, CIM_UINT32 ); + } method = SysAllocString( L"Enable" ); sig_in = NULL; @@ -1802,7 +1805,7 @@ static void test_SystemRestore( IWbemServices *services ) out = NULL; hr = IWbemServices_ExecMethod( services, class, method, 0, NULL, in, &out, NULL ); ok( hr == S_OK || hr == WBEM_E_ACCESS_DENIED, "failed to execute method %08x\n", hr ); - if (hr == S_OK) + if (hr == S_OK && out) { VariantInit( &var ); hr = IWbemClassObject_Get( out, L"ReturnValue", 0, &var, NULL, NULL ); diff --git a/dlls/wbemprox/wbemprox_private.h b/dlls/wbemprox/wbemprox_private.h index 30649257641..ff9a7f6ff82 100644 --- a/dlls/wbemprox/wbemprox_private.h +++ b/dlls/wbemprox/wbemprox_private.h @@ -253,6 +253,11 @@ HRESULT service_start_service(IWbemClassObject *, IWbemClassObject *, IWbemClass HRESULT service_stop_service(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN; HRESULT security_get_sd(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN; HRESULT security_set_sd(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN; +HRESULT create_restore_point(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN; +HRESULT disable_restore(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN; +HRESULT enable_restore(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN; +HRESULT get_last_restore_status(IWbemClassObject *, IWbemClassObject *in, IWbemClassObject **) DECLSPEC_HIDDEN; +HRESULT restore(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN; static inline WCHAR *heap_strdupW( const WCHAR *src ) {