Commit 47e9ffa7 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

wmiutils: Implement IWbemPath::GetInfo.

parent a7f4ac28
......@@ -35,16 +35,17 @@ WINE_DEFAULT_DEBUG_CHANNEL(wmiutils);
struct path
{
IWbemPath IWbemPath_iface;
LONG refs;
WCHAR *text;
int len_text;
WCHAR *server;
int len_server;
WCHAR **namespaces;
int *len_namespaces;
int num_namespaces;
WCHAR *class;
int len_class;
LONG refs;
WCHAR *text;
int len_text;
WCHAR *server;
int len_server;
WCHAR **namespaces;
int *len_namespaces;
int num_namespaces;
WCHAR *class;
int len_class;
ULONGLONG flags;
};
static void init_path( struct path *path )
......@@ -58,6 +59,7 @@ static void init_path( struct path *path )
path->num_namespaces = 0;
path->class = NULL;
path->len_class = 0;
path->flags = 0;
}
static void clear_path( struct path *path )
......@@ -136,6 +138,7 @@ static HRESULT parse_text( struct path *path, ULONG mode, const WCHAR *text )
memcpy( path->server, p, len * sizeof(WCHAR) );
path->server[len] = 0;
path->len_server = len;
path->flags |= WBEMPATH_INFO_PATH_HAD_SERVER;
}
p = q;
while (*q && *q != ':')
......@@ -180,6 +183,7 @@ static HRESULT parse_text( struct path *path, ULONG mode, const WCHAR *text )
done:
if (hr != S_OK) clear_path( path );
else path->flags |= WBEMPATH_INFO_CIM_COMPLIANT | WBEMPATH_INFO_V2_COMPLIANT;
return hr;
}
......@@ -197,6 +201,7 @@ static HRESULT WINAPI path_SetText(
if (!uMode || !pszPath) return WBEM_E_INVALID_PARAMETER;
clear_path( path );
if (!pszPath[0]) return S_OK;
if ((hr = parse_text( path, uMode, pszPath )) != S_OK) return hr;
len = strlenW( pszPath );
......@@ -404,11 +409,34 @@ static HRESULT WINAPI path_GetText(
static HRESULT WINAPI path_GetInfo(
IWbemPath *iface,
ULONG uRequestedInfo,
ULONGLONG *puResponse)
ULONG info,
ULONGLONG *response)
{
FIXME("%p, %d, %p\n", iface, uRequestedInfo, puResponse);
return E_NOTIMPL;
struct path *path = impl_from_IWbemPath( iface );
TRACE("%p, %u, %p\n", iface, info, response);
if (info || !response) return WBEM_E_INVALID_PARAMETER;
FIXME("some flags are not implemented\n");
*response = path->flags;
if (!path->server || (path->len_server == 1 && path->server[0] == '.'))
*response |= WBEMPATH_INFO_ANON_LOCAL_MACHINE;
else
*response |= WBEMPATH_INFO_HAS_MACHINE_NAME;
if (!path->class)
*response |= WBEMPATH_INFO_SERVER_NAMESPACE_ONLY;
else
{
*response |= WBEMPATH_INFO_HAS_SUBSCOPES;
if (path->text && strchrW( path->text, '=' )) /* FIXME */
*response |= WBEMPATH_INFO_IS_INST_REF;
else
*response |= WBEMPATH_INFO_IS_CLASS_REF;
}
return S_OK;
}
static HRESULT WINAPI path_SetServer(
......
......@@ -370,6 +370,69 @@ static void test_IWbemPath_GetServer(void)
IWbemPath_Release( path );
}
static void test_IWbemPath_GetInfo(void)
{
IWbemPath *path;
HRESULT hr;
ULONGLONG resp;
if (!(path = create_path())) return;
hr = IWbemPath_GetInfo( path, 0, NULL );
ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
hr = IWbemPath_GetInfo( path, 1, NULL );
ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
resp = 0xdeadbeef;
hr = IWbemPath_GetInfo( path, 0, &resp );
ok( hr == S_OK, "got %08x\n", hr );
ok( resp == (WBEMPATH_INFO_ANON_LOCAL_MACHINE | WBEMPATH_INFO_SERVER_NAMESPACE_ONLY),
"got %lx%08lx\n", (unsigned long)(resp >> 32), (unsigned long)resp );
hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path17 );
ok( hr == S_OK, "got %08x\n", hr );
hr = IWbemPath_GetInfo( path, 0, NULL );
ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
hr = IWbemPath_GetInfo( path, 1, NULL );
ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
resp = 0xdeadbeef;
hr = IWbemPath_GetInfo( path, 0, &resp );
ok( hr == S_OK, "got %08x\n", hr );
ok( resp == (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)(resp >> 32), (unsigned long)resp );
IWbemPath_Release( path );
if (!(path = create_path())) return;
hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path12 );
ok( hr == S_OK, "got %08x\n", hr );
resp = 0xdeadbeef;
hr = IWbemPath_GetInfo( path, 0, &resp );
ok( hr == S_OK, "got %08x\n", hr );
ok( resp == (WBEMPATH_INFO_ANON_LOCAL_MACHINE | WBEMPATH_INFO_IS_CLASS_REF |
WBEMPATH_INFO_HAS_SUBSCOPES | WBEMPATH_INFO_V2_COMPLIANT |
WBEMPATH_INFO_CIM_COMPLIANT),
"got %lx%08lx\n", (unsigned long)(resp >> 32), (unsigned long)resp );
hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path1 );
ok( hr == S_OK, "got %08x\n", hr );
resp = 0xdeadbeef;
hr = IWbemPath_GetInfo( path, 0, &resp );
ok( hr == S_OK, "got %08x\n", hr );
ok( resp == (WBEMPATH_INFO_ANON_LOCAL_MACHINE | WBEMPATH_INFO_SERVER_NAMESPACE_ONLY),
"got %lx%08lx\n", (unsigned long)(resp >> 32), (unsigned long)resp );
IWbemPath_Release( path );
}
START_TEST (path)
{
CoInitialize( NULL );
......@@ -378,6 +441,7 @@ START_TEST (path)
test_IWbemPath_GetText();
test_IWbemPath_GetClassName();
test_IWbemPath_GetServer();
test_IWbemPath_GetInfo();
CoUninitialize();
}
......@@ -21,6 +21,28 @@ import "oaidl.idl";
interface IWbemPath;
interface IWbemPathKeyList;
typedef [v1_enum] enum tag_WBEM_PATH_STATUS_FLAG
{
WBEMPATH_INFO_ANON_LOCAL_MACHINE = 0x1,
WBEMPATH_INFO_HAS_MACHINE_NAME = 0x2,
WBEMPATH_INFO_IS_CLASS_REF = 0x4,
WBEMPATH_INFO_IS_INST_REF = 0x8,
WBEMPATH_INFO_HAS_SUBSCOPES = 0x10,
WBEMPATH_INFO_IS_COMPOUND = 0x20,
WBEMPATH_INFO_HAS_V2_REF_PATHS = 0x40,
WBEMPATH_INFO_HAS_IMPLIED_KEY = 0x80,
WBEMPATH_INFO_CONTAINS_SINGLETON = 0x100,
WBEMPATH_INFO_V1_COMPLIANT = 0x200,
WBEMPATH_INFO_V2_COMPLIANT = 0x400,
WBEMPATH_INFO_CIM_COMPLIANT = 0x800,
WBEMPATH_INFO_IS_SINGLETON = 0x1000,
WBEMPATH_INFO_IS_PARENT = 0x2000,
WBEMPATH_INFO_SERVER_NAMESPACE_ONLY = 0x4000,
WBEMPATH_INFO_NATIVE_PATH = 0x8000,
WBEMPATH_INFO_WMI_PATH = 0x10000,
WBEMPATH_INFO_PATH_HAD_SERVER = 0x20000
} tag_WBEM_PATH_STATUS_FLAG;
typedef [v1_enum] enum tag_WBEM_PATH_CREATE_FLAG
{
WBEMPATH_CREATE_ACCEPT_RELATIVE = 0x1,
......
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