wmiutils: Implement IWbemPath::RemoveAllNamespaces.

This commit is contained in:
Hans Leidekker 2013-01-17 15:30:17 +01:00 committed by Alexandre Julliard
parent af84c4c7a9
commit 5391929491
2 changed files with 56 additions and 2 deletions

View File

@ -534,8 +534,18 @@ static HRESULT WINAPI path_RemoveNamespaceAt(
static HRESULT WINAPI path_RemoveAllNamespaces( static HRESULT WINAPI path_RemoveAllNamespaces(
IWbemPath *iface) IWbemPath *iface)
{ {
FIXME("%p\n", iface); struct path *path = impl_from_IWbemPath( iface );
return E_NOTIMPL; int i;
TRACE("%p\n", iface);
for (i = 0; i < path->num_namespaces; i++) heap_free( path->namespaces[i] );
path->num_namespaces = 0;
heap_free( path->namespaces );
path->namespaces = NULL;
heap_free( path->len_namespaces );
path->len_namespaces = NULL;
return S_OK;
} }
static HRESULT WINAPI path_GetScopeCount( static HRESULT WINAPI path_GetScopeCount(

View File

@ -584,6 +584,49 @@ static void test_IWbemPath_GetNamespaceAt(void)
IWbemPath_Release( path ); IWbemPath_Release( path );
} }
static void test_IWbemPath_RemoveAllNamespaces(void)
{
IWbemPath *path;
WCHAR buf[16];
ULONG len;
ULONGLONG flags;
HRESULT hr;
if (!(path = create_path())) return;
hr = IWbemPath_RemoveAllNamespaces( path );
ok( hr == S_OK, "got %08x\n", hr );
hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path17 );
ok( hr == S_OK, "got %08x\n", hr );
flags = 0;
hr = IWbemPath_GetInfo( path, 0, &flags );
ok( hr == S_OK, "got %08x\n", hr );
ok( flags == (WBEMPATH_INFO_ANON_LOCAL_MACHINE | WBEMPATH_INFO_IS_INST_REF |
WBEMPATH_INFO_HAS_SUBSCOPES | WBEMPATH_INFO_V2_COMPLIANT |
WBEMPATH_INFO_CIM_COMPLIANT | WBEMPATH_INFO_PATH_HAD_SERVER),
"got %lx%08lx\n", (unsigned long)(flags >> 32), (unsigned long)flags );
hr = IWbemPath_RemoveAllNamespaces( path );
ok( hr == S_OK, "got %08x\n", hr );
flags = 0;
hr = IWbemPath_GetInfo( path, 0, &flags );
ok( hr == S_OK, "got %08x\n", hr );
ok( flags == (WBEMPATH_INFO_ANON_LOCAL_MACHINE | WBEMPATH_INFO_IS_INST_REF |
WBEMPATH_INFO_HAS_SUBSCOPES | WBEMPATH_INFO_V2_COMPLIANT |
WBEMPATH_INFO_CIM_COMPLIANT | WBEMPATH_INFO_PATH_HAD_SERVER),
"got %lx%08lx\n", (unsigned long)(flags >> 32), (unsigned long)flags );
buf[0] = 0;
len = sizeof(buf) / sizeof(buf[0]);
hr = IWbemPath_GetNamespaceAt( path, 0, &len, buf );
ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
IWbemPath_Release( path );
}
START_TEST (path) START_TEST (path)
{ {
CoInitialize( NULL ); CoInitialize( NULL );
@ -596,6 +639,7 @@ START_TEST (path)
test_IWbemPath_GetInfo(); test_IWbemPath_GetInfo();
test_IWbemPath_SetServer(); test_IWbemPath_SetServer();
test_IWbemPath_GetNamespaceAt(); test_IWbemPath_GetNamespaceAt();
test_IWbemPath_RemoveAllNamespaces();
CoUninitialize(); CoUninitialize();
} }