2013-01-02 13:35:09 +01:00
|
|
|
/*
|
|
|
|
* Copyright 2012 Hans Leidekker for CodeWeavers
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include "windows.h"
|
|
|
|
#include "initguid.h"
|
|
|
|
#include "wmiutils.h"
|
|
|
|
#include "wbemcli.h"
|
|
|
|
#include "wine/test.h"
|
|
|
|
|
2020-10-25 23:40:41 +01:00
|
|
|
static const WCHAR path1[] = L"";
|
|
|
|
static const WCHAR path2[] = L"\\";
|
|
|
|
static const WCHAR path3[] = L"\\\\server";
|
|
|
|
static const WCHAR path4[] = L"\\\\server\\";
|
|
|
|
static const WCHAR path5[] = L"\\\\.\\";
|
|
|
|
static const WCHAR path6[] = L"//./root/cimv2";
|
|
|
|
static const WCHAR path7[] = L"//./root/cimv2:Win32_OperatingSystem";
|
|
|
|
static const WCHAR path8[] = L"/root/cimv2:Win32_OperatingSystem";
|
|
|
|
static const WCHAR path9[] = L"\\\\.\\root\\cimv2:Win32_OperatingSystem";
|
|
|
|
static const WCHAR path10[] = L"/\\.\\root\\cimv2:Win32_OperatingSystem";
|
|
|
|
static const WCHAR path11[] = L"//.\\root\\cimv2:Win32_OperatingSystem";
|
|
|
|
static const WCHAR path12[] = L"root\\cimv2:Win32_OperatingSystem";
|
|
|
|
static const WCHAR path13[] = L"\\\\.\\root\\cimv2";
|
|
|
|
static const WCHAR path14[] = L"Win32_OperatingSystem";
|
|
|
|
static const WCHAR path15[] = L"root\\cimv2";
|
|
|
|
static const WCHAR path16[] = L"\\\\.\\root\\cimv2";
|
|
|
|
static const WCHAR path17[] = L"\\\\.\\root\\cimv2:Win32_LogicalDisk.DeviceId=\"C:\"";
|
|
|
|
static const WCHAR path18[] = L"\\\\.\\root\\cimv2:Win32_LogicalDisk.DeviceId=\"C:\",DriveType=3";
|
|
|
|
static const WCHAR path19[] = L"\\\\.\\root\\cimv2:Win32_LogicalDisk.DeviceId=";
|
|
|
|
static const WCHAR path20[] = L"\\\\.\\root\\cimv2:Win32_LogicalDisk.DeviceId = \"C:\"";
|
2013-01-02 13:35:09 +01:00
|
|
|
|
2013-01-14 10:51:24 +01:00
|
|
|
static IWbemPath *create_path(void)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
IWbemPath *path;
|
|
|
|
|
|
|
|
hr = CoCreateInstance( &CLSID_WbemDefPath, NULL, CLSCTX_INPROC_SERVER, &IID_IWbemPath, (void **)&path );
|
|
|
|
if (hr != S_OK)
|
|
|
|
{
|
|
|
|
win_skip( "can't create WbemDefPath instance, skipping tests\n" );
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
return path;
|
|
|
|
}
|
|
|
|
|
2013-01-02 13:35:09 +01:00
|
|
|
static void test_IWbemPath_SetText(void)
|
|
|
|
{
|
|
|
|
static const struct
|
|
|
|
{
|
|
|
|
const WCHAR *path;
|
|
|
|
ULONG mode;
|
|
|
|
HRESULT ret;
|
2014-01-07 00:14:37 +01:00
|
|
|
BOOL todo;
|
2013-01-02 13:35:09 +01:00
|
|
|
} test[] =
|
|
|
|
{
|
|
|
|
{ path1, 0, WBEM_E_INVALID_PARAMETER },
|
|
|
|
{ path1, WBEMPATH_CREATE_ACCEPT_ALL, S_OK },
|
|
|
|
{ path2, 0, WBEM_E_INVALID_PARAMETER },
|
|
|
|
{ path2, WBEMPATH_CREATE_ACCEPT_ALL, S_OK },
|
|
|
|
{ path3, 0, WBEM_E_INVALID_PARAMETER },
|
|
|
|
{ path3, WBEMPATH_CREATE_ACCEPT_ALL, S_OK },
|
|
|
|
{ path4, 0, WBEM_E_INVALID_PARAMETER },
|
|
|
|
{ path4, WBEMPATH_CREATE_ACCEPT_ALL, S_OK },
|
|
|
|
{ path5, 0, WBEM_E_INVALID_PARAMETER },
|
|
|
|
{ path5, WBEMPATH_CREATE_ACCEPT_ALL, S_OK },
|
|
|
|
{ path6, 0, WBEM_E_INVALID_PARAMETER },
|
|
|
|
{ path6, WBEMPATH_CREATE_ACCEPT_ALL, S_OK },
|
|
|
|
{ path7, 0, WBEM_E_INVALID_PARAMETER },
|
|
|
|
{ path7, WBEMPATH_CREATE_ACCEPT_RELATIVE, S_OK },
|
|
|
|
{ path7, WBEMPATH_CREATE_ACCEPT_ABSOLUTE, S_OK },
|
|
|
|
{ path7, WBEMPATH_CREATE_ACCEPT_ALL, S_OK },
|
2014-01-07 00:14:37 +01:00
|
|
|
{ path7, WBEMPATH_TREAT_SINGLE_IDENT_AS_NS, WBEM_E_INVALID_PARAMETER, TRUE },
|
2013-01-02 13:35:09 +01:00
|
|
|
{ path7, WBEMPATH_TREAT_SINGLE_IDENT_AS_NS + 1, S_OK },
|
|
|
|
{ path8, WBEMPATH_CREATE_ACCEPT_RELATIVE, S_OK },
|
2014-01-07 00:14:37 +01:00
|
|
|
{ path8, WBEMPATH_CREATE_ACCEPT_ABSOLUTE, WBEM_E_INVALID_PARAMETER, TRUE },
|
2013-01-02 13:35:09 +01:00
|
|
|
{ path8, WBEMPATH_CREATE_ACCEPT_ALL, S_OK },
|
2014-01-07 00:14:37 +01:00
|
|
|
{ path8, WBEMPATH_TREAT_SINGLE_IDENT_AS_NS, WBEM_E_INVALID_PARAMETER, TRUE },
|
2013-01-02 13:35:09 +01:00
|
|
|
{ path8, WBEMPATH_TREAT_SINGLE_IDENT_AS_NS + 1, S_OK },
|
|
|
|
{ path9, WBEMPATH_CREATE_ACCEPT_ABSOLUTE, S_OK },
|
2014-01-07 00:14:37 +01:00
|
|
|
{ path10, WBEMPATH_CREATE_ACCEPT_ABSOLUTE, WBEM_E_INVALID_PARAMETER, TRUE },
|
2013-05-14 14:01:08 +02:00
|
|
|
{ path11, WBEMPATH_CREATE_ACCEPT_ABSOLUTE, S_OK },
|
|
|
|
{ path15, WBEMPATH_CREATE_ACCEPT_ALL, S_OK }
|
2013-01-02 13:35:09 +01:00
|
|
|
};
|
|
|
|
IWbemPath *path;
|
|
|
|
HRESULT hr;
|
|
|
|
UINT i;
|
|
|
|
|
2013-01-14 10:51:24 +01:00
|
|
|
if (!(path = create_path())) return;
|
2013-01-02 13:35:09 +01:00
|
|
|
|
|
|
|
hr = IWbemPath_SetText( path, 0, NULL );
|
|
|
|
ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
|
|
|
|
|
|
|
|
hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, NULL );
|
|
|
|
ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
|
|
|
|
|
2018-05-29 01:05:29 +02:00
|
|
|
for (i = 0; i < ARRAY_SIZE(test); i++)
|
2013-01-02 13:35:09 +01:00
|
|
|
{
|
|
|
|
hr = IWbemPath_SetText( path, test[i].mode, test[i].path );
|
2016-02-17 00:12:44 +01:00
|
|
|
todo_wine_if (test[i].todo)
|
|
|
|
ok( hr == test[i].ret, "%u got %08x\n", i, hr );
|
2013-01-02 13:35:09 +01:00
|
|
|
|
|
|
|
if (test[i].ret == S_OK)
|
|
|
|
{
|
|
|
|
WCHAR buf[128];
|
|
|
|
ULONG len;
|
|
|
|
|
|
|
|
memset( buf, 0x55, sizeof(buf) );
|
2018-05-29 01:05:29 +02:00
|
|
|
len = ARRAY_SIZE(buf);
|
2013-01-02 13:35:09 +01:00
|
|
|
hr = IWbemPath_GetText( path, WBEMPATH_GET_ORIGINAL, &len, buf );
|
|
|
|
ok( hr == S_OK, "%u got %08x\n", i, hr );
|
|
|
|
ok( !lstrcmpW( buf, test[i].path ), "%u unexpected path %s\n", i, wine_dbgstr_w(buf) );
|
|
|
|
ok( len == lstrlenW( test[i].path ) + 1, "%u unexpected length %u\n", i, len );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
IWbemPath_Release( path );
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_IWbemPath_GetText(void)
|
|
|
|
{
|
2020-10-25 23:40:41 +01:00
|
|
|
static const WCHAR serviceW[] = L"Win32_Service.Name=\"Service\"";
|
|
|
|
static const WCHAR classW[] = L"Win32_Class";
|
|
|
|
static const WCHAR expected1W[] = L"root\\cimv2:Win32_LogicalDisk.DeviceId=\"C:\"";
|
|
|
|
static const WCHAR expected2W[] = L"Win32_LogicalDisk.DeviceId=\"C:\"";
|
|
|
|
static const WCHAR expected3W[] = L"\\\\.\\root\\cimv2";
|
2013-01-02 13:35:09 +01:00
|
|
|
WCHAR buf[128];
|
|
|
|
ULONG len, count;
|
2013-01-14 10:51:24 +01:00
|
|
|
IWbemPath *path;
|
2013-01-02 13:35:09 +01:00
|
|
|
HRESULT hr;
|
|
|
|
|
2013-01-14 10:51:24 +01:00
|
|
|
if (!(path = create_path())) return;
|
2013-01-02 13:35:09 +01:00
|
|
|
|
|
|
|
hr = IWbemPath_GetText( path, 0, NULL, NULL );
|
|
|
|
ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
|
|
|
|
|
2018-05-29 01:05:29 +02:00
|
|
|
len = ARRAY_SIZE(buf);
|
2013-01-02 13:35:09 +01:00
|
|
|
hr = IWbemPath_GetText( path, 0, &len, NULL );
|
|
|
|
ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
|
2018-05-29 01:05:29 +02:00
|
|
|
ok( len == ARRAY_SIZE(buf), "unexpected length %u\n", len );
|
2013-01-02 13:35:09 +01:00
|
|
|
|
2018-05-29 01:05:29 +02:00
|
|
|
len = ARRAY_SIZE(buf);
|
2013-01-02 13:35:09 +01:00
|
|
|
memset( buf, 0x55, sizeof(buf) );
|
|
|
|
hr = IWbemPath_GetText( path, 0, &len, buf );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
ok( !buf[0], "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
|
|
|
|
ok( len == 1, "unexpected length %u\n", len );
|
|
|
|
|
|
|
|
hr = IWbemPath_GetText( path, WBEMPATH_GET_ORIGINAL, NULL, NULL );
|
|
|
|
ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
|
|
|
|
|
2018-05-29 01:05:29 +02:00
|
|
|
len = ARRAY_SIZE(buf);
|
2013-01-02 13:35:09 +01:00
|
|
|
hr = IWbemPath_GetText( path, WBEMPATH_GET_ORIGINAL, &len, NULL );
|
|
|
|
ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
|
2018-05-29 01:05:29 +02:00
|
|
|
ok( len == ARRAY_SIZE(buf), "unexpected length %u\n", len );
|
2013-01-02 13:35:09 +01:00
|
|
|
|
2018-05-29 01:05:29 +02:00
|
|
|
len = ARRAY_SIZE(buf);
|
2013-01-02 13:35:09 +01:00
|
|
|
memset( buf, 0x55, sizeof(buf) );
|
|
|
|
hr = IWbemPath_GetText( path, WBEMPATH_GET_ORIGINAL, &len, buf );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
ok( !buf[0], "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
|
|
|
|
ok( len == 1, "unexpected length %u\n", len );
|
|
|
|
|
2018-05-29 01:05:29 +02:00
|
|
|
len = ARRAY_SIZE(buf);
|
2013-01-02 13:35:09 +01:00
|
|
|
memset( buf, 0x55, sizeof(buf) );
|
|
|
|
hr = IWbemPath_GetText( path, WBEMPATH_GET_SERVER_TOO, &len, buf );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
todo_wine ok( !buf[0], "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
|
|
|
|
todo_wine ok( len == 1, "unexpected length %u\n", len );
|
|
|
|
|
|
|
|
hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path8 );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
|
|
|
|
count = 0xdeadbeef;
|
|
|
|
hr = IWbemPath_GetNamespaceCount( path, &count );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
ok( count == 2, "got %u\n", count );
|
|
|
|
|
2018-05-29 01:05:29 +02:00
|
|
|
len = ARRAY_SIZE(buf);
|
2013-01-02 13:35:09 +01:00
|
|
|
memset( buf, 0x55, sizeof(buf) );
|
|
|
|
hr = IWbemPath_GetText( path, WBEMPATH_GET_SERVER_TOO, &len, buf );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
ok( !lstrcmpW( buf, path9 ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
|
|
|
|
ok( len == lstrlenW( path9 ) + 1, "unexpected length %u\n", len );
|
|
|
|
|
2018-05-29 01:05:29 +02:00
|
|
|
len = ARRAY_SIZE(buf);
|
2013-01-02 13:35:09 +01:00
|
|
|
memset( buf, 0x55, sizeof(buf) );
|
|
|
|
hr = IWbemPath_GetText( path, WBEMPATH_GET_SERVER_AND_NAMESPACE_ONLY, &len, buf );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
ok( !lstrcmpW( buf, path13 ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
|
|
|
|
ok( len == lstrlenW( path13 ) + 1, "unexpected length %u\n", len );
|
|
|
|
|
2018-05-29 01:05:29 +02:00
|
|
|
len = ARRAY_SIZE(buf);
|
2013-01-02 13:35:09 +01:00
|
|
|
memset( buf, 0x55, sizeof(buf) );
|
|
|
|
hr = IWbemPath_GetText( path, WBEMPATH_GET_RELATIVE_ONLY, &len, buf );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
ok( !lstrcmpW( buf, path14 ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
|
|
|
|
ok( len == lstrlenW( path14 ) + 1, "unexpected length %u\n", len );
|
|
|
|
|
2018-05-29 01:05:29 +02:00
|
|
|
len = ARRAY_SIZE(buf);
|
2013-01-02 13:35:09 +01:00
|
|
|
memset( buf, 0x55, sizeof(buf) );
|
|
|
|
hr = IWbemPath_GetText( path, WBEMPATH_GET_NAMESPACE_ONLY, &len, buf );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
ok( !lstrcmpW( buf, path15 ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
|
|
|
|
ok( len == lstrlenW( path15 ) + 1, "unexpected length %u\n", len );
|
|
|
|
|
2018-05-29 01:05:29 +02:00
|
|
|
len = ARRAY_SIZE(buf);
|
2013-01-02 13:35:09 +01:00
|
|
|
memset( buf, 0x55, sizeof(buf) );
|
|
|
|
hr = IWbemPath_GetText( path, 0, &len, buf );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
ok( !lstrcmpW( buf, path12 ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
|
|
|
|
ok( len == lstrlenW( path12 ) + 1, "unexpected length %u\n", len );
|
|
|
|
|
|
|
|
hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path1 );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
|
|
|
|
count = 0xdeadbeef;
|
|
|
|
hr = IWbemPath_GetNamespaceCount( path, &count );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
ok( !count, "got %u\n", count );
|
|
|
|
|
2013-01-03 14:36:36 +01:00
|
|
|
hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path6 );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
|
|
|
|
count = 0xdeadbeef;
|
|
|
|
hr = IWbemPath_GetNamespaceCount( path, &count );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
ok( count == 2, "got %u\n", count );
|
|
|
|
|
|
|
|
len = 0;
|
|
|
|
hr = IWbemPath_GetText( path, WBEMPATH_GET_SERVER_TOO, &len, NULL );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
ok( len == lstrlenW( path16 ) + 1, "unexpected length %u\n", len );
|
|
|
|
|
2018-05-29 01:05:29 +02:00
|
|
|
len = ARRAY_SIZE(buf);
|
2013-01-03 14:36:36 +01:00
|
|
|
memset( buf, 0x55, sizeof(buf) );
|
|
|
|
hr = IWbemPath_GetText( path, WBEMPATH_GET_SERVER_TOO, &len, buf );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
ok( !lstrcmpW( buf, path16 ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
|
|
|
|
ok( len == lstrlenW( path16 ) + 1, "unexpected length %u\n", len );
|
|
|
|
|
|
|
|
hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path17 );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
|
2018-05-29 01:05:29 +02:00
|
|
|
len = ARRAY_SIZE(buf);
|
2013-01-03 14:36:36 +01:00
|
|
|
memset( buf, 0x55, sizeof(buf) );
|
|
|
|
hr = IWbemPath_GetText( path, WBEMPATH_GET_SERVER_TOO, &len, buf );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
2013-02-21 10:45:17 +01:00
|
|
|
ok( !lstrcmpW( buf, path17 ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
|
|
|
|
ok( len == lstrlenW( path17 ) + 1, "unexpected length %u\n", len );
|
|
|
|
|
2018-05-29 01:05:29 +02:00
|
|
|
len = ARRAY_SIZE(buf);
|
2013-02-21 10:45:17 +01:00
|
|
|
memset( buf, 0x55, sizeof(buf) );
|
|
|
|
hr = IWbemPath_GetText( path, 0, &len, buf );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
ok( !lstrcmpW( buf, expected1W ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
|
|
|
|
ok( len == lstrlenW( expected1W ) + 1, "unexpected length %u\n", len );
|
|
|
|
|
2018-05-29 01:05:29 +02:00
|
|
|
len = ARRAY_SIZE(buf);
|
2013-02-21 10:45:17 +01:00
|
|
|
memset( buf, 0x55, sizeof(buf) );
|
|
|
|
hr = IWbemPath_GetText( path, WBEMPATH_GET_RELATIVE_ONLY, &len, buf );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
ok( !lstrcmpW( buf, expected2W ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
|
|
|
|
ok( len == lstrlenW( expected2W ) + 1, "unexpected length %u\n", len );
|
|
|
|
|
2013-05-14 14:01:08 +02:00
|
|
|
hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path15 );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
|
2018-05-29 01:05:29 +02:00
|
|
|
len = ARRAY_SIZE(buf);
|
2013-05-14 14:01:08 +02:00
|
|
|
memset( buf, 0x55, sizeof(buf) );
|
|
|
|
hr = IWbemPath_GetText( path, WBEMPATH_GET_SERVER_TOO, &len, buf );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
ok( !lstrcmpW( buf, expected3W ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
|
|
|
|
ok( len == lstrlenW( expected3W ) + 1, "unexpected length %u\n", len );
|
|
|
|
|
2013-02-21 10:45:17 +01:00
|
|
|
hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path18 );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
|
|
|
|
hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path19 );
|
|
|
|
ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
|
|
|
|
|
|
|
|
hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path20 );
|
|
|
|
ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
|
2013-01-03 14:36:36 +01:00
|
|
|
|
2013-06-07 10:30:31 +02:00
|
|
|
IWbemPath_Release( path );
|
|
|
|
if (!(path = create_path())) return;
|
|
|
|
|
|
|
|
hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, serviceW );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
|
2018-05-29 01:05:29 +02:00
|
|
|
len = ARRAY_SIZE(buf);
|
2013-06-07 10:30:31 +02:00
|
|
|
memset( buf, 0x55, sizeof(buf) );
|
|
|
|
hr = IWbemPath_GetText( path, WBEMPATH_GET_RELATIVE_ONLY, &len, buf );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
ok( !lstrcmpW( buf, serviceW ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
|
|
|
|
ok( len == lstrlenW( serviceW ) + 1, "unexpected length %u\n", len );
|
|
|
|
|
|
|
|
IWbemPath_Release( path );
|
|
|
|
if (!(path = create_path())) return;
|
|
|
|
|
|
|
|
hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, classW );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
|
2018-05-29 01:05:29 +02:00
|
|
|
len = ARRAY_SIZE(buf);
|
2013-06-07 10:30:31 +02:00
|
|
|
memset( buf, 0x55, sizeof(buf) );
|
|
|
|
hr = IWbemPath_GetText( path, WBEMPATH_GET_RELATIVE_ONLY, &len, buf );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
ok( !lstrcmpW( buf, classW ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
|
|
|
|
ok( len == lstrlenW( classW ) + 1, "unexpected length %u\n", len );
|
|
|
|
|
2013-01-02 13:35:09 +01:00
|
|
|
IWbemPath_Release( path );
|
2013-01-14 10:51:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void test_IWbemPath_GetClassName(void)
|
|
|
|
{
|
2020-10-25 23:40:41 +01:00
|
|
|
static const WCHAR classW[] = L"Win32_LogicalDisk";
|
2013-01-14 10:51:24 +01:00
|
|
|
IWbemPath *path;
|
|
|
|
HRESULT hr;
|
|
|
|
WCHAR buf[32];
|
|
|
|
ULONG len;
|
|
|
|
|
|
|
|
if (!(path = create_path())) return;
|
|
|
|
|
|
|
|
hr = IWbemPath_GetClassName( path, NULL, NULL );
|
|
|
|
ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
|
|
|
|
|
|
|
|
len = 0;
|
|
|
|
hr = IWbemPath_GetClassName( path, &len, NULL );
|
|
|
|
ok( hr == WBEM_E_INVALID_OBJECT_PATH, "got %08x\n", hr );
|
|
|
|
|
2018-05-29 01:05:29 +02:00
|
|
|
len = ARRAY_SIZE(buf);
|
2013-01-14 10:51:24 +01:00
|
|
|
hr = IWbemPath_GetClassName( path, &len, buf );
|
|
|
|
ok( hr == WBEM_E_INVALID_OBJECT_PATH, "got %08x\n", hr );
|
|
|
|
|
2018-05-29 01:05:29 +02:00
|
|
|
len = ARRAY_SIZE(buf);
|
2013-01-14 10:51:24 +01:00
|
|
|
hr = IWbemPath_GetClassName( path, &len, NULL );
|
|
|
|
ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
|
2018-05-29 01:05:29 +02:00
|
|
|
ok( len == ARRAY_SIZE(buf), "unexpected length %u\n", len );
|
2013-01-14 10:51:24 +01:00
|
|
|
|
|
|
|
hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path17 );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
|
|
|
|
len = 0;
|
|
|
|
hr = IWbemPath_GetClassName( path, &len, NULL );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
|
2018-05-29 01:05:29 +02:00
|
|
|
len = ARRAY_SIZE(buf);
|
2013-01-14 10:51:24 +01:00
|
|
|
hr = IWbemPath_GetClassName( path, &len, NULL );
|
|
|
|
ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
|
2018-05-29 01:05:29 +02:00
|
|
|
ok( len == ARRAY_SIZE(buf), "unexpected length %u\n", len );
|
2013-01-14 10:51:24 +01:00
|
|
|
|
2013-01-16 10:57:30 +01:00
|
|
|
buf[0] = 0;
|
2018-05-29 01:05:29 +02:00
|
|
|
len = ARRAY_SIZE(buf);
|
2013-01-14 10:51:24 +01:00
|
|
|
hr = IWbemPath_GetClassName( path, &len, buf );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
ok( !lstrcmpW( buf, classW ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
|
|
|
|
ok( len == lstrlenW( classW ) + 1, "unexpected length %u\n", len );
|
|
|
|
|
|
|
|
IWbemPath_Release( path );
|
2013-01-02 13:35:09 +01:00
|
|
|
}
|
|
|
|
|
2013-01-17 15:29:12 +01:00
|
|
|
static void test_IWbemPath_SetClassName(void)
|
|
|
|
{
|
2020-10-25 23:40:41 +01:00
|
|
|
static const WCHAR classW[] = L"class";
|
2013-01-17 15:29:12 +01:00
|
|
|
IWbemPath *path;
|
|
|
|
WCHAR buf[16];
|
|
|
|
ULONG len;
|
|
|
|
ULONGLONG flags;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
if (!(path = create_path())) return;
|
|
|
|
|
|
|
|
hr = IWbemPath_SetClassName( path, NULL );
|
|
|
|
ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
|
|
|
|
|
2020-10-25 23:40:41 +01:00
|
|
|
hr = IWbemPath_SetClassName( path, L"" );
|
2013-01-17 15:29:12 +01:00
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
|
|
|
|
hr = IWbemPath_SetClassName( path, classW );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
|
|
|
|
buf[0] = 0;
|
2018-05-29 01:05:29 +02:00
|
|
|
len = ARRAY_SIZE(buf);
|
2013-01-17 15:29:12 +01:00
|
|
|
hr = IWbemPath_GetClassName( path, &len, buf );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
ok( !lstrcmpW( buf, classW ), "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_ANON_LOCAL_MACHINE | WBEMPATH_INFO_IS_CLASS_REF |
|
|
|
|
WBEMPATH_INFO_HAS_SUBSCOPES | WBEMPATH_INFO_V2_COMPLIANT |
|
|
|
|
WBEMPATH_INFO_CIM_COMPLIANT),
|
2017-07-04 00:29:44 +02:00
|
|
|
"got %s\n", wine_dbgstr_longlong(flags) );
|
2013-01-17 15:29:12 +01:00
|
|
|
|
|
|
|
IWbemPath_Release( path );
|
|
|
|
}
|
|
|
|
|
2013-01-14 10:52:05 +01:00
|
|
|
static void test_IWbemPath_GetServer(void)
|
|
|
|
{
|
|
|
|
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 );
|
|
|
|
|
2018-05-29 01:05:29 +02:00
|
|
|
len = ARRAY_SIZE(buf);
|
2013-01-14 10:52:05 +01:00
|
|
|
hr = IWbemPath_GetServer( path, &len, buf );
|
|
|
|
ok( hr == WBEM_E_NOT_AVAILABLE, "got %08x\n", hr );
|
|
|
|
|
2018-05-29 01:05:29 +02:00
|
|
|
len = ARRAY_SIZE(buf);
|
2013-01-14 10:52:05 +01:00
|
|
|
hr = IWbemPath_GetServer( path, &len, NULL );
|
|
|
|
ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
|
2018-05-29 01:05:29 +02:00
|
|
|
ok( len == ARRAY_SIZE(buf), "unexpected length %u\n", len );
|
2013-01-14 10:52:05 +01:00
|
|
|
|
|
|
|
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 );
|
|
|
|
|
2018-05-29 01:05:29 +02:00
|
|
|
len = ARRAY_SIZE(buf);
|
2013-01-14 10:52:05 +01:00
|
|
|
hr = IWbemPath_GetServer( path, &len, NULL );
|
|
|
|
ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
|
2018-05-29 01:05:29 +02:00
|
|
|
ok( len == ARRAY_SIZE(buf), "unexpected length %u\n", len );
|
2013-01-14 10:52:05 +01:00
|
|
|
|
2013-01-16 10:57:30 +01:00
|
|
|
buf[0] = 0;
|
2018-05-29 01:05:29 +02:00
|
|
|
len = ARRAY_SIZE(buf);
|
2013-01-14 10:52:05 +01:00
|
|
|
hr = IWbemPath_GetServer( path, &len, buf );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
2020-10-25 23:40:41 +01:00
|
|
|
ok( !lstrcmpW( buf, L"." ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
|
|
|
|
ok( len == lstrlenW(L"." ) + 1, "unexpected length %u\n", len );
|
2013-01-14 10:52:05 +01:00
|
|
|
|
|
|
|
IWbemPath_Release( path );
|
|
|
|
}
|
|
|
|
|
2013-01-15 11:26:48 +01:00
|
|
|
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),
|
2017-07-04 00:29:44 +02:00
|
|
|
"got %s\n", wine_dbgstr_longlong(resp) );
|
2013-01-15 11:26:48 +01:00
|
|
|
|
|
|
|
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),
|
2017-07-04 00:29:44 +02:00
|
|
|
"got %s\n", wine_dbgstr_longlong(resp) );
|
2013-01-15 11:26:48 +01:00
|
|
|
|
|
|
|
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),
|
2017-07-04 00:29:44 +02:00
|
|
|
"got %s\n", wine_dbgstr_longlong(resp) );
|
2013-01-15 11:26:48 +01:00
|
|
|
|
|
|
|
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),
|
2017-07-04 00:29:44 +02:00
|
|
|
"got %s\n", wine_dbgstr_longlong(resp) );
|
2013-01-15 11:26:48 +01:00
|
|
|
|
|
|
|
IWbemPath_Release( path );
|
|
|
|
}
|
|
|
|
|
2013-01-16 10:57:30 +01:00
|
|
|
static void test_IWbemPath_SetServer(void)
|
|
|
|
{
|
|
|
|
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 );
|
|
|
|
|
2018-05-29 01:05:29 +02:00
|
|
|
len = ARRAY_SIZE(buf);
|
2013-01-16 10:57:30 +01:00
|
|
|
hr = IWbemPath_GetServer( path, &len, buf );
|
|
|
|
ok( hr == WBEM_E_NOT_AVAILABLE, "got %08x\n", hr );
|
|
|
|
|
2020-10-25 23:40:41 +01:00
|
|
|
hr = IWbemPath_SetServer( path, L"" );
|
2013-01-17 15:29:12 +01:00
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
|
2020-10-25 23:40:41 +01:00
|
|
|
hr = IWbemPath_SetServer( path, L"server" );
|
2013-01-16 10:57:30 +01:00
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
|
|
|
|
buf[0] = 0;
|
2018-05-29 01:05:29 +02:00
|
|
|
len = ARRAY_SIZE(buf);
|
2013-01-16 10:57:30 +01:00
|
|
|
hr = IWbemPath_GetServer( path, &len, buf );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
2020-10-25 23:40:41 +01:00
|
|
|
ok( !lstrcmpW( buf, L"server" ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
|
2013-01-16 10:57:30 +01:00
|
|
|
|
|
|
|
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),
|
2017-07-04 00:29:44 +02:00
|
|
|
"got %s\n", wine_dbgstr_longlong(flags) );
|
2013-01-16 10:57:30 +01:00
|
|
|
|
|
|
|
hr = IWbemPath_SetServer( path, NULL );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
|
2018-05-29 01:05:29 +02:00
|
|
|
len = ARRAY_SIZE(buf);
|
2013-01-16 10:57:30 +01:00
|
|
|
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),
|
2017-07-04 00:29:44 +02:00
|
|
|
"got %s\n", wine_dbgstr_longlong(flags) );
|
2013-01-16 10:57:30 +01:00
|
|
|
|
|
|
|
IWbemPath_Release( path );
|
|
|
|
}
|
|
|
|
|
2013-01-17 15:29:48 +01:00
|
|
|
static void test_IWbemPath_GetNamespaceAt(void)
|
|
|
|
{
|
|
|
|
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 );
|
|
|
|
|
2018-05-29 01:05:29 +02:00
|
|
|
len = ARRAY_SIZE(buf);
|
2013-01-17 15:29:48 +01:00
|
|
|
hr = IWbemPath_GetNamespaceAt( path, 0, &len, buf );
|
|
|
|
ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
|
|
|
|
|
2018-05-29 01:05:29 +02:00
|
|
|
len = ARRAY_SIZE(buf);
|
2013-01-17 15:29:48 +01:00
|
|
|
hr = IWbemPath_GetNamespaceAt( path, 0, &len, NULL );
|
|
|
|
ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
|
2018-05-29 01:05:29 +02:00
|
|
|
ok( len == ARRAY_SIZE(buf), "unexpected length %u\n", len );
|
2013-01-17 15:29:48 +01:00
|
|
|
|
|
|
|
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 );
|
|
|
|
|
2018-05-29 01:05:29 +02:00
|
|
|
len = ARRAY_SIZE(buf);
|
2013-01-17 15:29:48 +01:00
|
|
|
hr = IWbemPath_GetNamespaceAt( path, 0, &len, NULL );
|
|
|
|
ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
|
2018-05-29 01:05:29 +02:00
|
|
|
ok( len == ARRAY_SIZE(buf), "unexpected length %u\n", len );
|
2013-01-17 15:29:48 +01:00
|
|
|
|
|
|
|
buf[0] = 0;
|
2018-05-29 01:05:29 +02:00
|
|
|
len = ARRAY_SIZE(buf);
|
2013-01-17 15:29:48 +01:00
|
|
|
hr = IWbemPath_GetNamespaceAt( path, 0, &len, buf );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
2020-10-25 23:40:41 +01:00
|
|
|
ok( !lstrcmpW( buf, L"root" ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
|
|
|
|
ok( len == lstrlenW( L"root" ) + 1, "unexpected length %u\n", len );
|
2013-01-17 15:29:48 +01:00
|
|
|
|
|
|
|
buf[0] = 0;
|
2018-05-29 01:05:29 +02:00
|
|
|
len = ARRAY_SIZE(buf);
|
2013-01-17 15:29:48 +01:00
|
|
|
hr = IWbemPath_GetNamespaceAt( path, 1, &len, buf );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
2020-10-25 23:40:41 +01:00
|
|
|
ok( !lstrcmpW( buf, L"cimv2" ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
|
|
|
|
ok( len == lstrlenW( L"cimv2" ) + 1, "unexpected length %u\n", len );
|
2013-01-17 15:29:48 +01:00
|
|
|
|
|
|
|
IWbemPath_Release( path );
|
|
|
|
}
|
|
|
|
|
2013-01-17 15:30:17 +01:00
|
|
|
static void test_IWbemPath_RemoveAllNamespaces(void)
|
|
|
|
{
|
2013-01-17 15:30:44 +01:00
|
|
|
static const ULONGLONG expected_flags =
|
|
|
|
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;
|
2013-01-17 15:30:17 +01:00
|
|
|
IWbemPath *path;
|
|
|
|
WCHAR buf[16];
|
|
|
|
ULONG len;
|
|
|
|
ULONGLONG flags;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
if (!(path = create_path())) return;
|
|
|
|
|
|
|
|
hr = IWbemPath_RemoveAllNamespaces( path );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
|
|
|
|
hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path17 );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
|
|
|
|
flags = 0;
|
|
|
|
hr = IWbemPath_GetInfo( path, 0, &flags );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
2013-01-17 15:30:44 +01:00
|
|
|
ok( flags == expected_flags,
|
2017-07-04 00:29:44 +02:00
|
|
|
"got %s\n", wine_dbgstr_longlong(flags) );
|
2013-01-17 15:30:17 +01:00
|
|
|
|
|
|
|
hr = IWbemPath_RemoveAllNamespaces( path );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
|
|
|
|
flags = 0;
|
|
|
|
hr = IWbemPath_GetInfo( path, 0, &flags );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
2013-01-17 15:30:44 +01:00
|
|
|
ok( flags == expected_flags,
|
2017-07-04 00:29:44 +02:00
|
|
|
"got %s\n", wine_dbgstr_longlong(flags) );
|
2013-01-17 15:30:17 +01:00
|
|
|
|
|
|
|
buf[0] = 0;
|
2018-05-29 01:05:29 +02:00
|
|
|
len = ARRAY_SIZE(buf);
|
2013-01-17 15:30:17 +01:00
|
|
|
hr = IWbemPath_GetNamespaceAt( path, 0, &len, buf );
|
|
|
|
ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
|
|
|
|
|
|
|
|
IWbemPath_Release( path );
|
|
|
|
}
|
|
|
|
|
2013-01-17 15:30:44 +01:00
|
|
|
static void test_IWbemPath_RemoveNamespaceAt(void)
|
|
|
|
{
|
|
|
|
static const ULONGLONG expected_flags =
|
|
|
|
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;
|
|
|
|
IWbemPath *path;
|
|
|
|
WCHAR buf[16];
|
|
|
|
ULONG len, count;
|
|
|
|
ULONGLONG flags;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
if (!(path = create_path())) return;
|
|
|
|
|
|
|
|
hr = IWbemPath_RemoveNamespaceAt( path, 0 );
|
|
|
|
ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
|
|
|
|
|
|
|
|
hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path17 );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
|
|
|
|
flags = 0;
|
|
|
|
hr = IWbemPath_GetInfo( path, 0, &flags );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
ok( flags == expected_flags,
|
2017-07-04 00:29:44 +02:00
|
|
|
"got %s\n", wine_dbgstr_longlong(flags) );
|
2013-01-17 15:30:44 +01:00
|
|
|
|
|
|
|
count = 0xdeadbeef;
|
|
|
|
hr = IWbemPath_GetNamespaceCount( path, &count );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
ok( count == 2, "got %u\n", count );
|
|
|
|
|
|
|
|
hr = IWbemPath_RemoveNamespaceAt( path, 0 );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
|
|
|
|
flags = 0;
|
|
|
|
hr = IWbemPath_GetInfo( path, 0, &flags );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
ok( flags == expected_flags,
|
2017-07-04 00:29:44 +02:00
|
|
|
"got %s\n", wine_dbgstr_longlong(flags) );
|
2013-01-17 15:30:44 +01:00
|
|
|
|
|
|
|
count = 0xdeadbeef;
|
|
|
|
hr = IWbemPath_GetNamespaceCount( path, &count );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
ok( count == 1, "got %u\n", count );
|
|
|
|
|
|
|
|
buf[0] = 0;
|
2018-05-29 01:05:29 +02:00
|
|
|
len = ARRAY_SIZE(buf);
|
2013-01-17 15:30:44 +01:00
|
|
|
hr = IWbemPath_GetNamespaceAt( path, 0, &len, buf );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
2020-10-25 23:40:41 +01:00
|
|
|
ok( !lstrcmpW( buf, L"cimv2" ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
|
|
|
|
ok( len == lstrlenW( L"cimv2" ) + 1, "unexpected length %u\n", len );
|
2013-01-17 15:30:44 +01:00
|
|
|
|
|
|
|
hr = IWbemPath_RemoveNamespaceAt( path, 0 );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
|
|
|
|
flags = 0;
|
|
|
|
hr = IWbemPath_GetInfo( path, 0, &flags );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
ok( flags == expected_flags,
|
2017-07-04 00:29:44 +02:00
|
|
|
"got %s\n", wine_dbgstr_longlong(flags) );
|
2013-01-17 15:30:44 +01:00
|
|
|
|
|
|
|
count = 0xdeadbeef;
|
|
|
|
hr = IWbemPath_GetNamespaceCount( path, &count );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
ok( !count, "got %u\n", count );
|
|
|
|
|
|
|
|
buf[0] = 0;
|
2018-05-29 01:05:29 +02:00
|
|
|
len = ARRAY_SIZE(buf);
|
2013-01-17 15:30:44 +01:00
|
|
|
hr = IWbemPath_GetNamespaceAt( path, 0, &len, buf );
|
|
|
|
ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
|
|
|
|
|
|
|
|
IWbemPath_Release( path );
|
|
|
|
}
|
|
|
|
|
2013-01-17 15:31:45 +01:00
|
|
|
static void test_IWbemPath_SetNamespaceAt(void)
|
|
|
|
{
|
|
|
|
static const ULONGLONG expected_flags =
|
|
|
|
WBEMPATH_INFO_ANON_LOCAL_MACHINE | WBEMPATH_INFO_V1_COMPLIANT |
|
|
|
|
WBEMPATH_INFO_V2_COMPLIANT | WBEMPATH_INFO_CIM_COMPLIANT |
|
|
|
|
WBEMPATH_INFO_SERVER_NAMESPACE_ONLY;
|
|
|
|
IWbemPath *path;
|
|
|
|
WCHAR buf[16];
|
|
|
|
ULONG len, count;
|
|
|
|
ULONGLONG flags;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
if (!(path = create_path())) return;
|
|
|
|
|
|
|
|
hr = IWbemPath_SetNamespaceAt( path, 0, NULL );
|
|
|
|
ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
|
|
|
|
|
2020-10-25 23:40:41 +01:00
|
|
|
hr = IWbemPath_SetNamespaceAt( path, 1, L"cimv2" );
|
2013-01-17 15:31:45 +01:00
|
|
|
ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
|
|
|
|
|
2020-10-25 23:40:41 +01:00
|
|
|
hr = IWbemPath_SetNamespaceAt( path, 0, L"cimv2" );
|
2013-01-17 15:31:45 +01:00
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
|
|
|
|
count = 0xdeadbeef;
|
|
|
|
hr = IWbemPath_GetNamespaceCount( path, &count );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
ok( count == 1, "got %u\n", count );
|
|
|
|
|
|
|
|
flags = 0;
|
|
|
|
hr = IWbemPath_GetInfo( path, 0, &flags );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
ok( flags == expected_flags,
|
2017-07-04 00:29:44 +02:00
|
|
|
"got %s\n", wine_dbgstr_longlong(flags) );
|
2013-01-17 15:31:45 +01:00
|
|
|
|
|
|
|
buf[0] = 0;
|
2018-05-29 01:05:29 +02:00
|
|
|
len = ARRAY_SIZE(buf);
|
2013-01-17 15:31:45 +01:00
|
|
|
hr = IWbemPath_GetNamespaceAt( path, 0, &len, buf );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
2020-10-25 23:40:41 +01:00
|
|
|
ok( !lstrcmpW( buf, L"cimv2" ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
|
|
|
|
ok( len == lstrlenW( L"cimv2" ) + 1, "unexpected length %u\n", len );
|
2013-01-17 15:31:45 +01:00
|
|
|
|
2020-10-25 23:40:41 +01:00
|
|
|
hr = IWbemPath_SetNamespaceAt( path, 0, L"root" );
|
2013-01-17 15:31:45 +01:00
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
|
|
|
|
flags = 0;
|
|
|
|
hr = IWbemPath_GetInfo( path, 0, &flags );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
ok( flags == expected_flags,
|
2017-07-04 00:29:44 +02:00
|
|
|
"got %s\n", wine_dbgstr_longlong(flags) );
|
2013-01-17 15:31:45 +01:00
|
|
|
|
|
|
|
count = 0xdeadbeef;
|
|
|
|
hr = IWbemPath_GetNamespaceCount( path, &count );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
|
|
|
ok( count == 2, "got %u\n", count );
|
|
|
|
|
|
|
|
buf[0] = 0;
|
2018-05-29 01:05:29 +02:00
|
|
|
len = ARRAY_SIZE(buf);
|
2013-01-17 15:31:45 +01:00
|
|
|
hr = IWbemPath_GetNamespaceAt( path, 0, &len, buf );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
2020-10-25 23:40:41 +01:00
|
|
|
ok( !lstrcmpW( buf, L"root" ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
|
|
|
|
ok( len == lstrlenW( L"root" ) + 1, "unexpected length %u\n", len );
|
2013-01-17 15:31:45 +01:00
|
|
|
|
|
|
|
buf[0] = 0;
|
2018-05-29 01:05:29 +02:00
|
|
|
len = ARRAY_SIZE(buf);
|
2013-01-17 15:31:45 +01:00
|
|
|
hr = IWbemPath_GetNamespaceAt( path, 1, &len, buf );
|
|
|
|
ok( hr == S_OK, "got %08x\n", hr );
|
2020-10-25 23:40:41 +01:00
|
|
|
ok( !lstrcmpW( buf, L"cimv2" ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
|
|
|
|
ok( len == lstrlenW( L"cimv2" ) + 1, "unexpected length %u\n", len );
|
2013-01-17 15:31:45 +01:00
|
|
|
|
|
|
|
IWbemPath_Release( path );
|
|
|
|
}
|
|
|
|
|
2013-01-02 13:35:09 +01:00
|
|
|
START_TEST (path)
|
|
|
|
{
|
2013-01-14 10:51:24 +01:00
|
|
|
CoInitialize( NULL );
|
|
|
|
|
2013-01-02 13:35:09 +01:00
|
|
|
test_IWbemPath_SetText();
|
|
|
|
test_IWbemPath_GetText();
|
2013-01-14 10:51:24 +01:00
|
|
|
test_IWbemPath_GetClassName();
|
2013-01-17 15:29:12 +01:00
|
|
|
test_IWbemPath_SetClassName();
|
2013-01-14 10:52:05 +01:00
|
|
|
test_IWbemPath_GetServer();
|
2013-01-15 11:26:48 +01:00
|
|
|
test_IWbemPath_GetInfo();
|
2013-01-16 10:57:30 +01:00
|
|
|
test_IWbemPath_SetServer();
|
2013-01-17 15:29:48 +01:00
|
|
|
test_IWbemPath_GetNamespaceAt();
|
2013-01-17 15:30:17 +01:00
|
|
|
test_IWbemPath_RemoveAllNamespaces();
|
2013-01-17 15:30:44 +01:00
|
|
|
test_IWbemPath_RemoveNamespaceAt();
|
2013-01-17 15:31:45 +01:00
|
|
|
test_IWbemPath_SetNamespaceAt();
|
2013-01-14 10:51:24 +01:00
|
|
|
|
|
|
|
CoUninitialize();
|
2013-01-02 13:35:09 +01:00
|
|
|
}
|