mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 08:55:19 +00:00
[WBEMPROX_WINETEST]
* Sync with Wine 1.7.27. CORE-8540 svn path=/trunk/; revision=64612
This commit is contained in:
parent
cbbaf54b85
commit
89e96775ab
3 changed files with 82 additions and 4 deletions
|
@ -9,5 +9,5 @@ list(APPEND SOURCE
|
|||
add_executable(wbemprox_winetest ${SOURCE})
|
||||
target_link_libraries(wbemprox_winetest uuid)
|
||||
set_module_type(wbemprox_winetest win32cui)
|
||||
add_importlibs(wbemprox_winetest oleaut32 ole32 user32 msvcrt kernel32)
|
||||
add_importlibs(wbemprox_winetest advapi32 oleaut32 ole32 user32 msvcrt kernel32)
|
||||
add_cd_file(TARGET wbemprox_winetest DESTINATION reactos/bin FOR all)
|
||||
|
|
|
@ -650,6 +650,83 @@ static void test_GetNames( IWbemServices *services )
|
|||
SysFreeString( wql );
|
||||
}
|
||||
|
||||
static void test_SystemSecurity( IWbemServices *services )
|
||||
{
|
||||
static const WCHAR systemsecurityW[] = {'_','_','S','y','s','t','e','m','S','e','c','u','r','i','t','y',0};
|
||||
static const WCHAR getsdW[] = {'G','e','t','S','D',0};
|
||||
static const WCHAR returnvalueW[] = {'R','e','t','u','r','n','V','a','l','u','e',0};
|
||||
static const WCHAR sdW[] = {'S','D',0};
|
||||
BSTR class = SysAllocString( systemsecurityW ), method;
|
||||
IWbemClassObject *reg, *out;
|
||||
VARIANT retval, var_sd;
|
||||
void *data;
|
||||
SECURITY_DESCRIPTOR_RELATIVE *sd;
|
||||
CIMTYPE type;
|
||||
HRESULT hr;
|
||||
BYTE sid_admin_buffer[SECURITY_MAX_SID_SIZE];
|
||||
SID *sid_admin = (SID*)sid_admin_buffer;
|
||||
DWORD sid_size;
|
||||
BOOL ret;
|
||||
|
||||
hr = IWbemServices_GetObject( services, class, 0, NULL, ®, NULL );
|
||||
if (hr != S_OK)
|
||||
{
|
||||
win_skip( "__SystemSecurity not available\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
sid_size = sizeof(sid_admin_buffer);
|
||||
ret = CreateWellKnownSid( WinBuiltinAdministratorsSid, NULL, sid_admin, &sid_size );
|
||||
ok( ret, "CreateWellKnownSid failed\n" );
|
||||
|
||||
out = NULL;
|
||||
method = SysAllocString( getsdW );
|
||||
hr = IWbemServices_ExecMethod( services, class, method, 0, NULL, NULL, &out, NULL );
|
||||
ok( hr == S_OK || hr == WBEM_E_ACCESS_DENIED, "failed to execute method %08x\n", hr );
|
||||
SysFreeString( method );
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
type = 0xdeadbeef;
|
||||
VariantInit( &retval );
|
||||
hr = IWbemClassObject_Get( out, returnvalueW, 0, &retval, &type, NULL );
|
||||
ok( hr == S_OK, "failed to get return value %08x\n", hr );
|
||||
ok( V_VT( &retval ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &retval ) );
|
||||
ok( !V_I4( &retval ), "unexpected error %u\n", V_UI4( &retval ) );
|
||||
ok( type == CIM_UINT32, "unexpected type 0x%x\n", type );
|
||||
|
||||
type = 0xdeadbeef;
|
||||
VariantInit( &var_sd );
|
||||
hr = IWbemClassObject_Get( out, sdW, 0, &var_sd, &type, NULL );
|
||||
ok( hr == S_OK, "failed to get names %08x\n", hr );
|
||||
ok( V_VT( &var_sd ) == (VT_UI1|VT_ARRAY), "unexpected variant type 0x%x\n", V_VT( &var_sd ) );
|
||||
ok( type == (CIM_UINT8|CIM_FLAG_ARRAY), "unexpected type 0x%x\n", type );
|
||||
|
||||
hr = SafeArrayAccessData( V_ARRAY( &var_sd ), &data );
|
||||
ok( hr == S_OK, "SafeArrayAccessData failed %x\n", hr );
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
sd = data;
|
||||
|
||||
ok( (sd->Control & SE_SELF_RELATIVE) == SE_SELF_RELATIVE, "relative flag unset\n" );
|
||||
ok( sd->Owner != 0, "no owner SID\n");
|
||||
ok( sd->Group != 0, "no owner SID\n");
|
||||
ok( EqualSid( (PSID)((LPBYTE)sd + sd->Owner), sid_admin ), "unexpected owner SID\n" );
|
||||
ok( EqualSid( (PSID)((LPBYTE)sd + sd->Group), sid_admin ), "unexpected group SID\n" );
|
||||
|
||||
hr = SafeArrayUnaccessData( V_ARRAY( &var_sd ) );
|
||||
ok( hr == S_OK, "SafeArrayUnaccessData failed %x\n", hr );
|
||||
}
|
||||
|
||||
VariantClear( &var_sd );
|
||||
IWbemClassObject_Release( out );
|
||||
}
|
||||
else if (hr == WBEM_E_ACCESS_DENIED)
|
||||
win_skip( "insufficient privs to test __SystemSecurity\n" );
|
||||
|
||||
SysFreeString( class );
|
||||
}
|
||||
|
||||
START_TEST(query)
|
||||
{
|
||||
static const WCHAR cimv2W[] = {'R','O','O','T','\\','C','I','M','V','2',0};
|
||||
|
@ -682,6 +759,7 @@ START_TEST(query)
|
|||
test_notification_query_async( services );
|
||||
test_query_async( services );
|
||||
test_GetNames( services );
|
||||
test_SystemSecurity( services );
|
||||
|
||||
SysFreeString( path );
|
||||
IWbemServices_Release( services );
|
||||
|
|
|
@ -131,7 +131,7 @@ static void test_IWbemLocator(void)
|
|||
{ path8W, WBEM_E_INVALID_NAMESPACE },
|
||||
{ path9W, S_OK },
|
||||
{ path10W, WBEM_E_INVALID_PARAMETER },
|
||||
{ path11W, S_OK },
|
||||
{ path11W, S_OK, FALSE, WBEM_E_INVALID_PARAMETER },
|
||||
{ path12W, S_OK },
|
||||
{ path13W, S_OK },
|
||||
{ path14W, S_OK },
|
||||
|
@ -139,8 +139,8 @@ static void test_IWbemLocator(void)
|
|||
{ path16W, S_OK },
|
||||
{ path17W, WBEM_E_INVALID_NAMESPACE },
|
||||
{ path18W, S_OK },
|
||||
{ path19W, WBEM_E_INVALID_NAMESPACE },
|
||||
{ path20W, WBEM_E_INVALID_NAMESPACE },
|
||||
{ path19W, WBEM_E_INVALID_NAMESPACE, FALSE, WBEM_E_INVALID_PARAMETER },
|
||||
{ path20W, WBEM_E_INVALID_NAMESPACE, FALSE, WBEM_E_INVALID_PARAMETER },
|
||||
{ path21W, S_OK },
|
||||
{ path22W, S_OK },
|
||||
{ path23W, WBEM_E_INVALID_NAMESPACE },
|
||||
|
|
Loading…
Reference in a new issue