Dmitry Timoshkov : wbemprox/tests: Add some tests for SystemRestore class.

Alexandre Julliard julliard at winehq.org
Mon Dec 21 15:49:52 CST 2020


Module: wine
Branch: master
Commit: 5befc694fa9c531ee68d0010ef740b47205d41e9
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=5befc694fa9c531ee68d0010ef740b47205d41e9

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Fri Dec 18 15:51:26 2020 +0300

wbemprox/tests: Add some tests for SystemRestore class.

Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wbemprox/tests/query.c | 63 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)

diff --git a/dlls/wbemprox/tests/query.c b/dlls/wbemprox/tests/query.c
index 73f055e8bd1..37b6fb4e8dc 100644
--- a/dlls/wbemprox/tests/query.c
+++ b/dlls/wbemprox/tests/query.c
@@ -1760,6 +1760,67 @@ static void test_Win32_SoundDevice( IWbemServices *services )
     SysFreeString( wql );
 }
 
+static void test_SystemRestore( IWbemServices *services )
+{
+    WCHAR path[MAX_PATH];
+    BSTR class, method;
+    IWbemClassObject *service, *sig_in, *in, *out;
+    VARIANT var;
+    HRESULT hr;
+
+    class = SysAllocString( L"SystemRestore" );
+    hr = IWbemServices_GetObject( services, class, 0, NULL, &service, NULL );
+    if (hr != S_OK)
+    {
+        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 );
+    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;
+    hr = IWbemClassObject_GetMethod( service, method, 0, &sig_in, NULL );
+    ok( hr == S_OK, "failed to get Enable method %08x\n", hr );
+
+    hr = IWbemClassObject_SpawnInstance( sig_in, 0, &in );
+    ok( hr == S_OK, "failed to spawn instance %08x\n", hr );
+
+    GetWindowsDirectoryW(path, ARRAY_SIZE(path));
+    path[3] = 0; /* otherwise XP fails */
+    V_VT( &var ) = VT_BSTR;
+    V_BSTR( &var ) = SysAllocString( path );
+    hr = IWbemClassObject_Put( in, L"Drive", 0, &var, 0 );
+    ok( hr == S_OK, "failed to set Drive %08x\n", hr );
+    SysFreeString( V_BSTR( &var ) );
+
+    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)
+    {
+        VariantInit( &var );
+        hr = IWbemClassObject_Get( out, L"ReturnValue", 0, &var, NULL, NULL );
+        ok( hr == S_OK, "failed to get return value %08x\n", hr );
+        ok( V_I4( &var ) == ERROR_SUCCESS, "unexpected error %u\n", V_UI4( &var ) );
+
+        IWbemClassObject_Release( out );
+    }
+    else if (hr == WBEM_E_ACCESS_DENIED)
+        win_skip( "insufficient privs to test SystemRestore\n" );
+
+    IWbemClassObject_Release( in );
+    IWbemClassObject_Release( sig_in );
+    IWbemClassObject_Release( service );
+    SysFreeString( method );
+    SysFreeString( class );
+}
+
 START_TEST(query)
 {
     BSTR path = SysAllocString( L"ROOT\\CIMV2" );
@@ -1823,6 +1884,7 @@ START_TEST(query)
     test_Win32_SystemEnclosure( services );
     test_Win32_VideoController( services );
     test_Win32_WinSAT( services );
+    test_SystemRestore( services );
 
     SysFreeString( path );
     IWbemServices_Release( services );
@@ -1836,6 +1898,7 @@ START_TEST(query)
     ok( hr == S_OK, "failed to set proxy blanket %08x\n", hr );
 
     test_StdRegProv( services );
+    test_SystemRestore( services );
 
     SysFreeString( path );
     IWbemServices_Release( services );




More information about the wine-cvs mailing list