wbemprox: Add class SystemRestore stub implementation.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50033
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Dmitry Timoshkov 2021-01-20 11:15:57 +01:00 committed by Alexandre Julliard
parent e17ae0dc0f
commit e0cb4d5093
5 changed files with 111 additions and 2 deletions

View File

@ -14,6 +14,7 @@ C_SRCS = \
security.c \
service.c \
services.c \
sysrestore.c \
table.c \
wbemlocator.c

View File

@ -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 },

View File

@ -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 <stdarg.h>
#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;
}

View File

@ -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 );

View File

@ -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 )
{