wmiutils: Implement IWbemPath::GetNamespaceAt.
This commit is contained in:
parent
ae6468c9a9
commit
af84c4c7a9
|
@ -509,12 +509,18 @@ static HRESULT WINAPI path_SetNamespaceAt(
|
|||
|
||||
static HRESULT WINAPI path_GetNamespaceAt(
|
||||
IWbemPath *iface,
|
||||
ULONG uIndex,
|
||||
ULONG *puNameBufLength,
|
||||
LPWSTR pName)
|
||||
ULONG idx,
|
||||
ULONG *len,
|
||||
LPWSTR name)
|
||||
{
|
||||
FIXME("%p, %u, %p, %p\n", iface, uIndex, puNameBufLength, pName);
|
||||
return E_NOTIMPL;
|
||||
struct path *path = impl_from_IWbemPath( iface );
|
||||
|
||||
TRACE("%p, %u, %p, %p\n", iface, idx, len, name);
|
||||
|
||||
if (!len || (*len && !name) || idx >= path->num_namespaces) return WBEM_E_INVALID_PARAMETER;
|
||||
if (*len > path->len_namespaces[idx]) strcpyW( name, path->namespaces[idx] );
|
||||
*len = path->len_namespaces[idx] + 1;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI path_RemoveNamespaceAt(
|
||||
|
|
|
@ -528,6 +528,62 @@ static void test_IWbemPath_SetServer(void)
|
|||
IWbemPath_Release( path );
|
||||
}
|
||||
|
||||
static void test_IWbemPath_GetNamespaceAt(void)
|
||||
{
|
||||
static const WCHAR rootW[] = {'r','o','o','t',0};
|
||||
static const WCHAR cimv2W[] = {'c','i','m','v','2',0};
|
||||
IWbemPath *path;
|
||||
HRESULT hr;
|
||||
WCHAR buf[32];
|
||||
ULONG len;
|
||||
|
||||
if (!(path = create_path())) return;
|
||||
|
||||
hr = IWbemPath_GetNamespaceAt( path, 0, NULL, NULL );
|
||||
ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
|
||||
|
||||
len = 0;
|
||||
hr = IWbemPath_GetNamespaceAt( path, 0, &len, NULL );
|
||||
ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
|
||||
|
||||
len = sizeof(buf) / sizeof(buf[0]);
|
||||
hr = IWbemPath_GetNamespaceAt( path, 0, &len, buf );
|
||||
ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
|
||||
|
||||
len = sizeof(buf) / sizeof(buf[0]);
|
||||
hr = IWbemPath_GetNamespaceAt( path, 0, &len, NULL );
|
||||
ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
|
||||
ok( len == sizeof(buf) / sizeof(buf[0]), "unexpected length %u\n", len );
|
||||
|
||||
hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path17 );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
|
||||
len = 0;
|
||||
hr = IWbemPath_GetNamespaceAt( path, 2, &len, NULL );
|
||||
ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
|
||||
|
||||
len = sizeof(buf) / sizeof(buf[0]);
|
||||
hr = IWbemPath_GetNamespaceAt( path, 0, &len, NULL );
|
||||
ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
|
||||
ok( len == sizeof(buf) / sizeof(buf[0]), "unexpected length %u\n", len );
|
||||
|
||||
buf[0] = 0;
|
||||
len = sizeof(buf) / sizeof(buf[0]);
|
||||
hr = IWbemPath_GetNamespaceAt( path, 0, &len, buf );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
ok( !lstrcmpW( buf, rootW ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
|
||||
ok( len == lstrlenW( rootW ) + 1, "unexpected length %u\n", len );
|
||||
|
||||
buf[0] = 0;
|
||||
len = sizeof(buf) / sizeof(buf[0]);
|
||||
hr = IWbemPath_GetNamespaceAt( path, 1, &len, buf );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
ok( !lstrcmpW( buf, cimv2W ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
|
||||
ok( len == lstrlenW( cimv2W ) + 1, "unexpected length %u\n", len );
|
||||
|
||||
IWbemPath_Release( path );
|
||||
}
|
||||
|
||||
START_TEST (path)
|
||||
{
|
||||
CoInitialize( NULL );
|
||||
|
@ -539,6 +595,7 @@ START_TEST (path)
|
|||
test_IWbemPath_GetServer();
|
||||
test_IWbemPath_GetInfo();
|
||||
test_IWbemPath_SetServer();
|
||||
test_IWbemPath_GetNamespaceAt();
|
||||
|
||||
CoUninitialize();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue