Commit 53919294 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

wmiutils: Implement IWbemPath::RemoveAllNamespaces.

parent af84c4c7
......@@ -534,8 +534,18 @@ static HRESULT WINAPI path_RemoveNamespaceAt(
static HRESULT WINAPI path_RemoveAllNamespaces(
IWbemPath *iface)
{
FIXME("%p\n", iface);
return E_NOTIMPL;
struct path *path = impl_from_IWbemPath( iface );
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(
......
......@@ -584,6 +584,49 @@ static void test_IWbemPath_GetNamespaceAt(void)
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)
{
CoInitialize( NULL );
......@@ -596,6 +639,7 @@ START_TEST (path)
test_IWbemPath_GetInfo();
test_IWbemPath_SetServer();
test_IWbemPath_GetNamespaceAt();
test_IWbemPath_RemoveAllNamespaces();
CoUninitialize();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment