wmiutils: Implement IWbemPath::SetServer.
This commit is contained in:
parent
bbb29e9d4c
commit
77ae1d0fb7
|
@ -441,10 +441,29 @@ static HRESULT WINAPI path_GetInfo(
|
|||
|
||||
static HRESULT WINAPI path_SetServer(
|
||||
IWbemPath *iface,
|
||||
LPCWSTR Name)
|
||||
LPCWSTR name)
|
||||
{
|
||||
FIXME("%p, %s\n", iface, debugstr_w(Name));
|
||||
return E_NOTIMPL;
|
||||
struct path *path = impl_from_IWbemPath( iface );
|
||||
static const ULONGLONG flags =
|
||||
WBEMPATH_INFO_PATH_HAD_SERVER | WBEMPATH_INFO_V1_COMPLIANT |
|
||||
WBEMPATH_INFO_V2_COMPLIANT | WBEMPATH_INFO_CIM_COMPLIANT;
|
||||
|
||||
TRACE("%p, %s\n", iface, debugstr_w(name));
|
||||
|
||||
heap_free( path->server );
|
||||
if (name)
|
||||
{
|
||||
if (!(path->server = strdupW( name ))) return WBEM_E_OUT_OF_MEMORY;
|
||||
path->len_server = strlenW( path->server );
|
||||
path->flags |= flags;
|
||||
}
|
||||
else
|
||||
{
|
||||
path->server = NULL;
|
||||
path->len_server = 0;
|
||||
path->flags &= ~flags;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI path_GetServer(
|
||||
|
@ -457,7 +476,7 @@ static HRESULT WINAPI path_GetServer(
|
|||
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 (!path->server) return WBEM_E_NOT_AVAILABLE;
|
||||
if (*len > path->len_server) strcpyW( name, path->server );
|
||||
*len = path->len_server + 1;
|
||||
return S_OK;
|
||||
|
@ -504,15 +523,15 @@ static HRESULT WINAPI path_RemoveNamespaceAt(
|
|||
}
|
||||
|
||||
static HRESULT WINAPI path_RemoveAllNamespaces(
|
||||
IWbemPath *iface)
|
||||
IWbemPath *iface)
|
||||
{
|
||||
FIXME("%p\n", iface);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI path_GetScopeCount(
|
||||
IWbemPath *iface,
|
||||
ULONG *puCount)
|
||||
IWbemPath *iface,
|
||||
ULONG *puCount)
|
||||
{
|
||||
FIXME("%p, %p\n", iface, puCount);
|
||||
return E_NOTIMPL;
|
||||
|
|
|
@ -314,6 +314,7 @@ static void test_IWbemPath_GetClassName(void)
|
|||
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_GetClassName( path, &len, buf );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
|
@ -361,6 +362,7 @@ static void test_IWbemPath_GetServer(void)
|
|||
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_GetServer( path, &len, buf );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
|
@ -433,6 +435,57 @@ static void test_IWbemPath_GetInfo(void)
|
|||
IWbemPath_Release( path );
|
||||
}
|
||||
|
||||
static void test_IWbemPath_SetServer(void)
|
||||
{
|
||||
static const WCHAR serverW[] = {'s','e','r','v','e','r',0};
|
||||
IWbemPath *path;
|
||||
WCHAR buf[16];
|
||||
ULONG len;
|
||||
ULONGLONG flags;
|
||||
HRESULT hr;
|
||||
|
||||
if (!(path = create_path())) return;
|
||||
|
||||
hr = IWbemPath_SetServer( path, NULL );
|
||||
ok( hr == S_OK, "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 );
|
||||
|
||||
hr = IWbemPath_SetServer( path, serverW );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
|
||||
buf[0] = 0;
|
||||
len = sizeof(buf) / sizeof(buf[0]);
|
||||
hr = IWbemPath_GetServer( path, &len, buf );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
ok( !lstrcmpW( buf, serverW ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
|
||||
|
||||
flags = 0;
|
||||
hr = IWbemPath_GetInfo( path, 0, &flags );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
ok( flags == (WBEMPATH_INFO_HAS_MACHINE_NAME | WBEMPATH_INFO_V1_COMPLIANT |
|
||||
WBEMPATH_INFO_V2_COMPLIANT | WBEMPATH_INFO_CIM_COMPLIANT |
|
||||
WBEMPATH_INFO_SERVER_NAMESPACE_ONLY | WBEMPATH_INFO_PATH_HAD_SERVER),
|
||||
"got %lx%08lx\n", (unsigned long)(flags >> 32), (unsigned long)flags );
|
||||
|
||||
hr = IWbemPath_SetServer( path, NULL );
|
||||
ok( hr == S_OK, "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 );
|
||||
|
||||
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_SERVER_NAMESPACE_ONLY),
|
||||
"got %lx%08lx\n", (unsigned long)(flags >> 32), (unsigned long)flags );
|
||||
|
||||
IWbemPath_Release( path );
|
||||
}
|
||||
|
||||
START_TEST (path)
|
||||
{
|
||||
CoInitialize( NULL );
|
||||
|
@ -442,6 +495,7 @@ START_TEST (path)
|
|||
test_IWbemPath_GetClassName();
|
||||
test_IWbemPath_GetServer();
|
||||
test_IWbemPath_GetInfo();
|
||||
test_IWbemPath_SetServer();
|
||||
|
||||
CoUninitialize();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue