wmiutils: Implement IWbemPath::GetInfo.
This commit is contained in:
parent
a7f4ac283b
commit
47e9ffa773
@ -35,16 +35,17 @@ WINE_DEFAULT_DEBUG_CHANNEL(wmiutils);
|
|||||||
struct path
|
struct path
|
||||||
{
|
{
|
||||||
IWbemPath IWbemPath_iface;
|
IWbemPath IWbemPath_iface;
|
||||||
LONG refs;
|
LONG refs;
|
||||||
WCHAR *text;
|
WCHAR *text;
|
||||||
int len_text;
|
int len_text;
|
||||||
WCHAR *server;
|
WCHAR *server;
|
||||||
int len_server;
|
int len_server;
|
||||||
WCHAR **namespaces;
|
WCHAR **namespaces;
|
||||||
int *len_namespaces;
|
int *len_namespaces;
|
||||||
int num_namespaces;
|
int num_namespaces;
|
||||||
WCHAR *class;
|
WCHAR *class;
|
||||||
int len_class;
|
int len_class;
|
||||||
|
ULONGLONG flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void init_path( struct path *path )
|
static void init_path( struct path *path )
|
||||||
@ -58,6 +59,7 @@ static void init_path( struct path *path )
|
|||||||
path->num_namespaces = 0;
|
path->num_namespaces = 0;
|
||||||
path->class = NULL;
|
path->class = NULL;
|
||||||
path->len_class = 0;
|
path->len_class = 0;
|
||||||
|
path->flags = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void clear_path( struct path *path )
|
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) );
|
memcpy( path->server, p, len * sizeof(WCHAR) );
|
||||||
path->server[len] = 0;
|
path->server[len] = 0;
|
||||||
path->len_server = len;
|
path->len_server = len;
|
||||||
|
path->flags |= WBEMPATH_INFO_PATH_HAD_SERVER;
|
||||||
}
|
}
|
||||||
p = q;
|
p = q;
|
||||||
while (*q && *q != ':')
|
while (*q && *q != ':')
|
||||||
@ -180,6 +183,7 @@ static HRESULT parse_text( struct path *path, ULONG mode, const WCHAR *text )
|
|||||||
|
|
||||||
done:
|
done:
|
||||||
if (hr != S_OK) clear_path( path );
|
if (hr != S_OK) clear_path( path );
|
||||||
|
else path->flags |= WBEMPATH_INFO_CIM_COMPLIANT | WBEMPATH_INFO_V2_COMPLIANT;
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,6 +201,7 @@ static HRESULT WINAPI path_SetText(
|
|||||||
if (!uMode || !pszPath) return WBEM_E_INVALID_PARAMETER;
|
if (!uMode || !pszPath) return WBEM_E_INVALID_PARAMETER;
|
||||||
|
|
||||||
clear_path( path );
|
clear_path( path );
|
||||||
|
if (!pszPath[0]) return S_OK;
|
||||||
if ((hr = parse_text( path, uMode, pszPath )) != S_OK) return hr;
|
if ((hr = parse_text( path, uMode, pszPath )) != S_OK) return hr;
|
||||||
|
|
||||||
len = strlenW( pszPath );
|
len = strlenW( pszPath );
|
||||||
@ -404,11 +409,34 @@ static HRESULT WINAPI path_GetText(
|
|||||||
|
|
||||||
static HRESULT WINAPI path_GetInfo(
|
static HRESULT WINAPI path_GetInfo(
|
||||||
IWbemPath *iface,
|
IWbemPath *iface,
|
||||||
ULONG uRequestedInfo,
|
ULONG info,
|
||||||
ULONGLONG *puResponse)
|
ULONGLONG *response)
|
||||||
{
|
{
|
||||||
FIXME("%p, %d, %p\n", iface, uRequestedInfo, puResponse);
|
struct path *path = impl_from_IWbemPath( iface );
|
||||||
return E_NOTIMPL;
|
|
||||||
|
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(
|
static HRESULT WINAPI path_SetServer(
|
||||||
|
@ -370,6 +370,69 @@ static void test_IWbemPath_GetServer(void)
|
|||||||
IWbemPath_Release( path );
|
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)
|
START_TEST (path)
|
||||||
{
|
{
|
||||||
CoInitialize( NULL );
|
CoInitialize( NULL );
|
||||||
@ -378,6 +441,7 @@ START_TEST (path)
|
|||||||
test_IWbemPath_GetText();
|
test_IWbemPath_GetText();
|
||||||
test_IWbemPath_GetClassName();
|
test_IWbemPath_GetClassName();
|
||||||
test_IWbemPath_GetServer();
|
test_IWbemPath_GetServer();
|
||||||
|
test_IWbemPath_GetInfo();
|
||||||
|
|
||||||
CoUninitialize();
|
CoUninitialize();
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,28 @@ import "oaidl.idl";
|
|||||||
interface IWbemPath;
|
interface IWbemPath;
|
||||||
interface IWbemPathKeyList;
|
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
|
typedef [v1_enum] enum tag_WBEM_PATH_CREATE_FLAG
|
||||||
{
|
{
|
||||||
WBEMPATH_CREATE_ACCEPT_RELATIVE = 0x1,
|
WBEMPATH_CREATE_ACCEPT_RELATIVE = 0x1,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user