wmiutils: Implement IWbemPath::GetServer.
This commit is contained in:
parent
5a12f6c088
commit
19f9420f62
|
@ -421,11 +421,18 @@ static HRESULT WINAPI path_SetServer(
|
||||||
|
|
||||||
static HRESULT WINAPI path_GetServer(
|
static HRESULT WINAPI path_GetServer(
|
||||||
IWbemPath *iface,
|
IWbemPath *iface,
|
||||||
ULONG *puNameBufLength,
|
ULONG *len,
|
||||||
LPWSTR pName)
|
LPWSTR name)
|
||||||
{
|
{
|
||||||
FIXME("%p, %p, %p\n", iface, puNameBufLength, pName);
|
struct path *path = impl_from_IWbemPath( iface );
|
||||||
return E_NOTIMPL;
|
|
||||||
|
TRACE("%p, %p, %p\n", iface, len, name);
|
||||||
|
|
||||||
|
if (!len || (*len && !name)) return WBEM_E_INVALID_PARAMETER;
|
||||||
|
if (!path->class) return WBEM_E_NOT_AVAILABLE;
|
||||||
|
if (*len > path->len_server) strcpyW( name, path->server );
|
||||||
|
*len = path->len_server + 1;
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI path_GetNamespaceCount(
|
static HRESULT WINAPI path_GetNamespaceCount(
|
||||||
|
|
|
@ -323,6 +323,53 @@ static void test_IWbemPath_GetClassName(void)
|
||||||
IWbemPath_Release( path );
|
IWbemPath_Release( path );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_IWbemPath_GetServer(void)
|
||||||
|
{
|
||||||
|
static const WCHAR dotW[] = {'.',0};
|
||||||
|
IWbemPath *path;
|
||||||
|
HRESULT hr;
|
||||||
|
WCHAR buf[32];
|
||||||
|
ULONG len;
|
||||||
|
|
||||||
|
if (!(path = create_path())) return;
|
||||||
|
|
||||||
|
hr = IWbemPath_GetServer( path, NULL, NULL );
|
||||||
|
ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
|
||||||
|
|
||||||
|
len = 0;
|
||||||
|
hr = IWbemPath_GetServer( path, &len, NULL );
|
||||||
|
ok( hr == WBEM_E_NOT_AVAILABLE, "got %08x\n", hr );
|
||||||
|
|
||||||
|
len = sizeof(buf) / sizeof(buf[0]);
|
||||||
|
hr = IWbemPath_GetServer( path, &len, buf );
|
||||||
|
ok( hr == WBEM_E_NOT_AVAILABLE, "got %08x\n", hr );
|
||||||
|
|
||||||
|
len = sizeof(buf) / sizeof(buf[0]);
|
||||||
|
hr = IWbemPath_GetServer( path, &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_GetServer( path, &len, NULL );
|
||||||
|
ok( hr == S_OK, "got %08x\n", hr );
|
||||||
|
|
||||||
|
len = sizeof(buf) / sizeof(buf[0]);
|
||||||
|
hr = IWbemPath_GetServer( path, &len, NULL );
|
||||||
|
ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
|
||||||
|
ok( len == sizeof(buf) / sizeof(buf[0]), "unexpected length %u\n", len );
|
||||||
|
|
||||||
|
len = sizeof(buf) / sizeof(buf[0]);
|
||||||
|
hr = IWbemPath_GetServer( path, &len, buf );
|
||||||
|
ok( hr == S_OK, "got %08x\n", hr );
|
||||||
|
ok( !lstrcmpW( buf, dotW ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
|
||||||
|
ok( len == lstrlenW( dotW ) + 1, "unexpected length %u\n", len );
|
||||||
|
|
||||||
|
IWbemPath_Release( path );
|
||||||
|
}
|
||||||
|
|
||||||
START_TEST (path)
|
START_TEST (path)
|
||||||
{
|
{
|
||||||
CoInitialize( NULL );
|
CoInitialize( NULL );
|
||||||
|
@ -330,6 +377,7 @@ START_TEST (path)
|
||||||
test_IWbemPath_SetText();
|
test_IWbemPath_SetText();
|
||||||
test_IWbemPath_GetText();
|
test_IWbemPath_GetText();
|
||||||
test_IWbemPath_GetClassName();
|
test_IWbemPath_GetClassName();
|
||||||
|
test_IWbemPath_GetServer();
|
||||||
|
|
||||||
CoUninitialize();
|
CoUninitialize();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue