ReactOS 0.4.17-dev-966-gf06eace
path.c
Go to the documentation of this file.
1/*
2 * Copyright 2012 Hans Leidekker for CodeWeavers
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 */
18
19#define COBJMACROS
20
21#include <stdarg.h>
22#include "windows.h"
23#include "initguid.h"
24#include "wmiutils.h"
25#include "wbemcli.h"
26#include "wine/test.h"
27
28static const WCHAR path1[] = L"";
29static const WCHAR path2[] = L"\\";
30static const WCHAR path3[] = L"\\\\server";
31static const WCHAR path4[] = L"\\\\server\\";
32static const WCHAR path5[] = L"\\\\.\\";
33static const WCHAR path6[] = L"//./root/cimv2";
34static const WCHAR path7[] = L"//./root/cimv2:Win32_OperatingSystem";
35static const WCHAR path8[] = L"/root/cimv2:Win32_OperatingSystem";
36static const WCHAR path9[] = L"\\\\.\\root\\cimv2:Win32_OperatingSystem";
37static const WCHAR path10[] = L"/\\.\\root\\cimv2:Win32_OperatingSystem";
38static const WCHAR path11[] = L"//.\\root\\cimv2:Win32_OperatingSystem";
39static const WCHAR path12[] = L"root\\cimv2:Win32_OperatingSystem";
40static const WCHAR path13[] = L"\\\\.\\root\\cimv2";
41static const WCHAR path14[] = L"Win32_OperatingSystem";
42static const WCHAR path15[] = L"root\\cimv2";
43static const WCHAR path16[] = L"\\\\.\\root\\cimv2";
44static const WCHAR path17[] = L"\\\\.\\root\\cimv2:Win32_LogicalDisk.DeviceId=\"C:\"";
45static const WCHAR path18[] = L"\\\\.\\root\\cimv2:Win32_LogicalDisk.DeviceId=\"C:\",DriveType=3";
46static const WCHAR path19[] = L"\\\\.\\root\\cimv2:Win32_LogicalDisk.DeviceId=";
47static const WCHAR path20[] = L"\\\\.\\root\\cimv2:Win32_LogicalDisk.DeviceId = \"C:\"";
48
50{
51 HRESULT hr;
53
54 hr = CoCreateInstance( &CLSID_WbemDefPath, NULL, CLSCTX_INPROC_SERVER, &IID_IWbemPath, (void **)&path );
55 if (hr != S_OK)
56 {
57 win_skip( "can't create WbemDefPath instance, skipping tests\n" );
58 return NULL;
59 }
60 return path;
61}
62
63static void test_IWbemPath_SetText(void)
64{
65 static const struct
66 {
67 const WCHAR *path;
68 ULONG mode;
70 BOOL todo;
71 } test[] =
72 {
100 };
102 HRESULT hr;
103 UINT i;
104
105 if (!(path = create_path())) return;
106
107 hr = IWbemPath_SetText( path, 0, NULL );
108 ok( hr == WBEM_E_INVALID_PARAMETER, "got %#lx\n", hr );
109
110 hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, NULL );
111 ok( hr == WBEM_E_INVALID_PARAMETER, "got %#lx\n", hr );
112
113 for (i = 0; i < ARRAY_SIZE(test); i++)
114 {
115 hr = IWbemPath_SetText( path, test[i].mode, test[i].path );
117 ok( hr == test[i].ret, "%u got %#lx\n", i, hr );
118
119 if (test[i].ret == S_OK)
120 {
121 WCHAR buf[128];
122 ULONG len;
123
124 memset( buf, 0x55, sizeof(buf) );
125 len = ARRAY_SIZE(buf);
126 hr = IWbemPath_GetText( path, WBEMPATH_GET_ORIGINAL, &len, buf );
127 ok( hr == S_OK, "%u got %#lx\n", i, hr );
128 ok( !lstrcmpW( buf, test[i].path ), "%u unexpected path %s\n", i, wine_dbgstr_w(buf) );
129 ok( len == lstrlenW( test[i].path ) + 1, "%u unexpected length %lu\n", i, len );
130 }
131 }
132 IWbemPath_Release( path );
133}
134
135static void test_IWbemPath_GetText(void)
136{
137 static const WCHAR serviceW[] = L"Win32_Service.Name=\"Service\"";
138 static const WCHAR classW[] = L"Win32_Class";
139 static const WCHAR expected1W[] = L"root\\cimv2:Win32_LogicalDisk.DeviceId=\"C:\"";
140 static const WCHAR expected2W[] = L"Win32_LogicalDisk.DeviceId=\"C:\"";
141 static const WCHAR expected3W[] = L"\\\\.\\root\\cimv2";
142 WCHAR buf[128];
143 ULONG len, count;
145 HRESULT hr;
146
147 if (!(path = create_path())) return;
148
149 hr = IWbemPath_GetText( path, 0, NULL, NULL );
150 ok( hr == WBEM_E_INVALID_PARAMETER, "got %#lx\n", hr );
151
152 len = ARRAY_SIZE(buf);
153 hr = IWbemPath_GetText( path, 0, &len, NULL );
154 ok( hr == WBEM_E_INVALID_PARAMETER, "got %#lx\n", hr );
155 ok( len == ARRAY_SIZE(buf), "unexpected length %lu\n", len );
156
157 len = ARRAY_SIZE(buf);
158 memset( buf, 0x55, sizeof(buf) );
159 hr = IWbemPath_GetText( path, 0, &len, buf );
160 ok( hr == S_OK, "got %#lx\n", hr );
161 ok( !buf[0], "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
162 ok( len == 1, "unexpected length %lu\n", len );
163
164 hr = IWbemPath_GetText( path, WBEMPATH_GET_ORIGINAL, NULL, NULL );
165 ok( hr == WBEM_E_INVALID_PARAMETER, "got %#lx\n", hr );
166
167 len = ARRAY_SIZE(buf);
168 hr = IWbemPath_GetText( path, WBEMPATH_GET_ORIGINAL, &len, NULL );
169 ok( hr == WBEM_E_INVALID_PARAMETER, "got %#lx\n", hr );
170 ok( len == ARRAY_SIZE(buf), "unexpected length %lu\n", len );
171
172 len = ARRAY_SIZE(buf);
173 memset( buf, 0x55, sizeof(buf) );
174 hr = IWbemPath_GetText( path, WBEMPATH_GET_ORIGINAL, &len, buf );
175 ok( hr == S_OK, "got %#lx\n", hr );
176 ok( !buf[0], "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
177 ok( len == 1, "unexpected length %lu\n", len );
178
179 len = ARRAY_SIZE(buf);
180 memset( buf, 0x55, sizeof(buf) );
181 hr = IWbemPath_GetText( path, WBEMPATH_GET_SERVER_TOO, &len, buf );
182 ok( hr == S_OK, "got %#lx\n", hr );
183 todo_wine ok( !buf[0], "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
184 todo_wine ok( len == 1, "unexpected length %lu\n", len );
185
186 hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path8 );
187 ok( hr == S_OK, "got %#lx\n", hr );
188
189 count = 0xdeadbeef;
190 hr = IWbemPath_GetNamespaceCount( path, &count );
191 ok( hr == S_OK, "got %#lx\n", hr );
192 ok( count == 2, "got %lu\n", count );
193
194 len = ARRAY_SIZE(buf);
195 memset( buf, 0x55, sizeof(buf) );
196 hr = IWbemPath_GetText( path, WBEMPATH_GET_SERVER_TOO, &len, buf );
197 ok( hr == S_OK, "got %#lx\n", hr );
198 ok( !lstrcmpW( buf, path9 ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
199 ok( len == lstrlenW( path9 ) + 1, "unexpected length %lu\n", len );
200
201 len = ARRAY_SIZE(buf);
202 memset( buf, 0x55, sizeof(buf) );
203 hr = IWbemPath_GetText( path, WBEMPATH_GET_SERVER_AND_NAMESPACE_ONLY, &len, buf );
204 ok( hr == S_OK, "got %#lx\n", hr );
205 ok( !lstrcmpW( buf, path13 ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
206 ok( len == lstrlenW( path13 ) + 1, "unexpected length %lu\n", len );
207
208 len = ARRAY_SIZE(buf);
209 memset( buf, 0x55, sizeof(buf) );
210 hr = IWbemPath_GetText( path, WBEMPATH_GET_RELATIVE_ONLY, &len, buf );
211 ok( hr == S_OK, "got %#lx\n", hr );
212 ok( !lstrcmpW( buf, path14 ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
213 ok( len == lstrlenW( path14 ) + 1, "unexpected length %lu\n", len );
214
215 len = ARRAY_SIZE(buf);
216 memset( buf, 0x55, sizeof(buf) );
217 hr = IWbemPath_GetText( path, WBEMPATH_GET_NAMESPACE_ONLY, &len, buf );
218 ok( hr == S_OK, "got %#lx\n", hr );
219 ok( !lstrcmpW( buf, path15 ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
220 ok( len == lstrlenW( path15 ) + 1, "unexpected length %lu\n", len );
221
222 len = ARRAY_SIZE(buf);
223 memset( buf, 0x55, sizeof(buf) );
224 hr = IWbemPath_GetText( path, 0, &len, buf );
225 ok( hr == S_OK, "got %#lx\n", hr );
226 ok( !lstrcmpW( buf, path12 ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
227 ok( len == lstrlenW( path12 ) + 1, "unexpected length %lu\n", len );
228
229 hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path1 );
230 ok( hr == S_OK, "got %#lx\n", hr );
231
232 count = 0xdeadbeef;
233 hr = IWbemPath_GetNamespaceCount( path, &count );
234 ok( hr == S_OK, "got %#lx\n", hr );
235 ok( !count, "got %lu\n", count );
236
237 hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path6 );
238 ok( hr == S_OK, "got %#lx\n", hr );
239
240 count = 0xdeadbeef;
241 hr = IWbemPath_GetNamespaceCount( path, &count );
242 ok( hr == S_OK, "got %#lx\n", hr );
243 ok( count == 2, "got %lu\n", count );
244
245 len = 0;
246 hr = IWbemPath_GetText( path, WBEMPATH_GET_SERVER_TOO, &len, NULL );
247 ok( hr == S_OK, "got %#lx\n", hr );
248 ok( len == lstrlenW( path16 ) + 1, "unexpected length %lu\n", len );
249
250 len = ARRAY_SIZE(buf);
251 memset( buf, 0x55, sizeof(buf) );
252 hr = IWbemPath_GetText( path, WBEMPATH_GET_SERVER_TOO, &len, buf );
253 ok( hr == S_OK, "got %#lx\n", hr );
254 ok( !lstrcmpW( buf, path16 ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
255 ok( len == lstrlenW( path16 ) + 1, "unexpected length %lu\n", len );
256
257 hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path17 );
258 ok( hr == S_OK, "got %#lx\n", hr );
259
260 len = ARRAY_SIZE(buf);
261 memset( buf, 0x55, sizeof(buf) );
262 hr = IWbemPath_GetText( path, WBEMPATH_GET_SERVER_TOO, &len, buf );
263 ok( hr == S_OK, "got %#lx\n", hr );
264 ok( !lstrcmpW( buf, path17 ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
265 ok( len == lstrlenW( path17 ) + 1, "unexpected length %lu\n", len );
266
267 len = ARRAY_SIZE(buf);
268 memset( buf, 0x55, sizeof(buf) );
269 hr = IWbemPath_GetText( path, 0, &len, buf );
270 ok( hr == S_OK, "got %#lx\n", hr );
271 ok( !lstrcmpW( buf, expected1W ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
272 ok( len == lstrlenW( expected1W ) + 1, "unexpected length %lu\n", len );
273
274 len = ARRAY_SIZE(buf);
275 memset( buf, 0x55, sizeof(buf) );
276 hr = IWbemPath_GetText( path, WBEMPATH_GET_RELATIVE_ONLY, &len, buf );
277 ok( hr == S_OK, "got %#lx\n", hr );
278 ok( !lstrcmpW( buf, expected2W ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
279 ok( len == lstrlenW( expected2W ) + 1, "unexpected length %lu\n", len );
280
281 hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path15 );
282 ok( hr == S_OK, "got %#lx\n", hr );
283
284 len = ARRAY_SIZE(buf);
285 memset( buf, 0x55, sizeof(buf) );
286 hr = IWbemPath_GetText( path, WBEMPATH_GET_SERVER_TOO, &len, buf );
287 ok( hr == S_OK, "got %#lx\n", hr );
288 ok( !lstrcmpW( buf, expected3W ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
289 ok( len == lstrlenW( expected3W ) + 1, "unexpected length %lu\n", len );
290
291 hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path18 );
292 ok( hr == S_OK, "got %#lx\n", hr );
293
294 hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path19 );
295 ok( hr == WBEM_E_INVALID_PARAMETER, "got %#lx\n", hr );
296
297 hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path20 );
298 ok( hr == WBEM_E_INVALID_PARAMETER, "got %#lx\n", hr );
299
300 IWbemPath_Release( path );
301 if (!(path = create_path())) return;
302
303 hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, serviceW );
304 ok( hr == S_OK, "got %#lx\n", hr );
305
306 len = ARRAY_SIZE(buf);
307 memset( buf, 0x55, sizeof(buf) );
308 hr = IWbemPath_GetText( path, WBEMPATH_GET_RELATIVE_ONLY, &len, buf );
309 ok( hr == S_OK, "got %#lx\n", hr );
310 ok( !lstrcmpW( buf, serviceW ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
311 ok( len == lstrlenW( serviceW ) + 1, "unexpected length %lu\n", len );
312
313 IWbemPath_Release( path );
314 if (!(path = create_path())) return;
315
316 hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, classW );
317 ok( hr == S_OK, "got %#lx\n", hr );
318
319 len = ARRAY_SIZE(buf);
320 memset( buf, 0x55, sizeof(buf) );
321 hr = IWbemPath_GetText( path, WBEMPATH_GET_RELATIVE_ONLY, &len, buf );
322 ok( hr == S_OK, "got %#lx\n", hr );
323 ok( !lstrcmpW( buf, classW ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
324 ok( len == lstrlenW( classW ) + 1, "unexpected length %lu\n", len );
325
326 IWbemPath_Release( path );
327}
328
330{
331 static const WCHAR classW[] = L"Win32_LogicalDisk";
333 HRESULT hr;
334 WCHAR buf[32];
335 ULONG len;
336
337 if (!(path = create_path())) return;
338
339 hr = IWbemPath_GetClassName( path, NULL, NULL );
340 ok( hr == WBEM_E_INVALID_PARAMETER, "got %#lx\n", hr );
341
342 len = 0;
343 hr = IWbemPath_GetClassName( path, &len, NULL );
344 ok( hr == WBEM_E_INVALID_OBJECT_PATH, "got %#lx\n", hr );
345
346 len = ARRAY_SIZE(buf);
347 hr = IWbemPath_GetClassName( path, &len, buf );
348 ok( hr == WBEM_E_INVALID_OBJECT_PATH, "got %#lx\n", hr );
349
350 len = ARRAY_SIZE(buf);
351 hr = IWbemPath_GetClassName( path, &len, NULL );
352 ok( hr == WBEM_E_INVALID_PARAMETER, "got %#lx\n", hr );
353 ok( len == ARRAY_SIZE(buf), "unexpected length %lu\n", len );
354
355 hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path17 );
356 ok( hr == S_OK, "got %#lx\n", hr );
357
358 len = 0;
359 hr = IWbemPath_GetClassName( path, &len, NULL );
360 ok( hr == S_OK, "got %#lx\n", hr );
361
362 len = ARRAY_SIZE(buf);
363 hr = IWbemPath_GetClassName( path, &len, NULL );
364 ok( hr == WBEM_E_INVALID_PARAMETER, "got %#lx\n", hr );
365 ok( len == ARRAY_SIZE(buf), "unexpected length %lu\n", len );
366
367 buf[0] = 0;
368 len = ARRAY_SIZE(buf);
369 hr = IWbemPath_GetClassName( path, &len, buf );
370 ok( hr == S_OK, "got %#lx\n", hr );
371 ok( !lstrcmpW( buf, classW ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
372 ok( len == lstrlenW( classW ) + 1, "unexpected length %lu\n", len );
373
374 IWbemPath_Release( path );
375}
376
378{
379 static const WCHAR classW[] = L"class";
381 WCHAR buf[16];
382 ULONG len;
384 HRESULT hr;
385
386 if (!(path = create_path())) return;
387
388 hr = IWbemPath_SetClassName( path, NULL );
389 ok( hr == WBEM_E_INVALID_PARAMETER, "got %#lx\n", hr );
390
391 hr = IWbemPath_SetClassName( path, L"" );
392 ok( hr == S_OK, "got %#lx\n", hr );
393
394 hr = IWbemPath_SetClassName( path, classW );
395 ok( hr == S_OK, "got %#lx\n", hr );
396
397 buf[0] = 0;
398 len = ARRAY_SIZE(buf);
399 hr = IWbemPath_GetClassName( path, &len, buf );
400 ok( hr == S_OK, "got %#lx\n", hr );
401 ok( !lstrcmpW( buf, classW ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
402
403 flags = 0;
404 hr = IWbemPath_GetInfo( path, 0, &flags );
405 ok( hr == S_OK, "got %#lx\n", hr );
409 "got %s\n", wine_dbgstr_longlong(flags) );
410
411 IWbemPath_Release( path );
412}
413
415{
417 HRESULT hr;
418 WCHAR buf[32];
419 ULONG len;
420
421 if (!(path = create_path())) return;
422
423 hr = IWbemPath_GetServer( path, NULL, NULL );
424 ok( hr == WBEM_E_INVALID_PARAMETER, "got %#lx\n", hr );
425
426 len = 0;
427 hr = IWbemPath_GetServer( path, &len, NULL );
428 ok( hr == WBEM_E_NOT_AVAILABLE, "got %#lx\n", hr );
429
430 len = ARRAY_SIZE(buf);
431 hr = IWbemPath_GetServer( path, &len, buf );
432 ok( hr == WBEM_E_NOT_AVAILABLE, "got %#lx\n", hr );
433
434 len = ARRAY_SIZE(buf);
435 hr = IWbemPath_GetServer( path, &len, NULL );
436 ok( hr == WBEM_E_INVALID_PARAMETER, "got %#lx\n", hr );
437 ok( len == ARRAY_SIZE(buf), "unexpected length %lu\n", len );
438
439 hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path17 );
440 ok( hr == S_OK, "got %#lx\n", hr );
441
442 len = 0;
443 hr = IWbemPath_GetServer( path, &len, NULL );
444 ok( hr == S_OK, "got %#lx\n", hr );
445
446 len = ARRAY_SIZE(buf);
447 hr = IWbemPath_GetServer( path, &len, NULL );
448 ok( hr == WBEM_E_INVALID_PARAMETER, "got %#lx\n", hr );
449 ok( len == ARRAY_SIZE(buf), "unexpected length %lu\n", len );
450
451 buf[0] = 0;
452 len = ARRAY_SIZE(buf);
453 hr = IWbemPath_GetServer( path, &len, buf );
454 ok( hr == S_OK, "got %#lx\n", hr );
455 ok( !lstrcmpW( buf, L"." ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
456 ok( len == lstrlenW(L"." ) + 1, "unexpected length %lu\n", len );
457
458 IWbemPath_Release( path );
459}
460
461static void test_IWbemPath_GetInfo(void)
462{
464 HRESULT hr;
465 ULONGLONG resp;
466
467 if (!(path = create_path())) return;
468
469 hr = IWbemPath_GetInfo( path, 0, NULL );
470 ok( hr == WBEM_E_INVALID_PARAMETER, "got %#lx\n", hr );
471
472 hr = IWbemPath_GetInfo( path, 1, NULL );
473 ok( hr == WBEM_E_INVALID_PARAMETER, "got %#lx\n", hr );
474
475 resp = 0xdeadbeef;
476 hr = IWbemPath_GetInfo( path, 0, &resp );
477 ok( hr == S_OK, "got %#lx\n", hr );
479 "got %s\n", wine_dbgstr_longlong(resp) );
480
481 hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path17 );
482 ok( hr == S_OK, "got %#lx\n", hr );
483
484 hr = IWbemPath_GetInfo( path, 0, NULL );
485 ok( hr == WBEM_E_INVALID_PARAMETER, "got %#lx\n", hr );
486
487 hr = IWbemPath_GetInfo( path, 1, NULL );
488 ok( hr == WBEM_E_INVALID_PARAMETER, "got %#lx\n", hr );
489
490 resp = 0xdeadbeef;
491 hr = IWbemPath_GetInfo( path, 0, &resp );
492 ok( hr == S_OK, "got %#lx\n", hr );
496 "got %s\n", wine_dbgstr_longlong(resp) );
497
498 IWbemPath_Release( path );
499 if (!(path = create_path())) return;
500
501 hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path12 );
502 ok( hr == S_OK, "got %#lx\n", hr );
503
504 resp = 0xdeadbeef;
505 hr = IWbemPath_GetInfo( path, 0, &resp );
506 ok( hr == S_OK, "got %#lx\n", hr );
510
511 hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path1 );
512 ok( hr == S_OK, "got %#lx\n", hr );
513
514 resp = 0xdeadbeef;
515 hr = IWbemPath_GetInfo( path, 0, &resp );
516 ok( hr == S_OK, "got %#lx\n", hr );
518 "got %s\n", wine_dbgstr_longlong(resp) );
519
520 hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, L"Win32_LogicalDisk=\"C:\"" );
521 ok( hr == S_OK, "got %#lx\n", hr );
522
523 resp = 0xdeadbeef;
524 hr = IWbemPath_GetInfo( path, 0, &resp );
525 ok( hr == S_OK, "got %#lx\n", hr );
529 "got %s\n", wine_dbgstr_longlong(resp) );
530
531 IWbemPath_Release( path );
532}
533
535{
537 WCHAR buf[16];
538 ULONG len;
540 HRESULT hr;
541
542 if (!(path = create_path())) return;
543
544 hr = IWbemPath_SetServer( path, NULL );
545 ok( hr == S_OK, "got %#lx\n", hr );
546
547 len = ARRAY_SIZE(buf);
548 hr = IWbemPath_GetServer( path, &len, buf );
549 ok( hr == WBEM_E_NOT_AVAILABLE, "got %#lx\n", hr );
550
551 hr = IWbemPath_SetServer( path, L"" );
552 ok( hr == S_OK, "got %#lx\n", hr );
553
554 hr = IWbemPath_SetServer( path, L"server" );
555 ok( hr == S_OK, "got %#lx\n", hr );
556
557 buf[0] = 0;
558 len = ARRAY_SIZE(buf);
559 hr = IWbemPath_GetServer( path, &len, buf );
560 ok( hr == S_OK, "got %#lx\n", hr );
561 ok( !lstrcmpW( buf, L"server" ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
562
563 flags = 0;
564 hr = IWbemPath_GetInfo( path, 0, &flags );
565 ok( hr == S_OK, "got %#lx\n", hr );
569 "got %s\n", wine_dbgstr_longlong(flags) );
570
571 hr = IWbemPath_SetServer( path, NULL );
572 ok( hr == S_OK, "got %#lx\n", hr );
573
574 len = ARRAY_SIZE(buf);
575 hr = IWbemPath_GetServer( path, &len, buf );
576 ok( hr == WBEM_E_NOT_AVAILABLE, "got %#lx\n", hr );
577
578 flags = 0;
579 hr = IWbemPath_GetInfo( path, 0, &flags );
580 ok( hr == S_OK, "got %#lx\n", hr );
582 "got %s\n", wine_dbgstr_longlong(flags) );
583
584 IWbemPath_Release( path );
585}
586
588{
590 HRESULT hr;
591 WCHAR buf[32];
592 ULONG len;
593
594 if (!(path = create_path())) return;
595
596 hr = IWbemPath_GetNamespaceAt( path, 0, NULL, NULL );
597 ok( hr == WBEM_E_INVALID_PARAMETER, "got %#lx\n", hr );
598
599 len = 0;
600 hr = IWbemPath_GetNamespaceAt( path, 0, &len, NULL );
601 ok( hr == WBEM_E_INVALID_PARAMETER, "got %#lx\n", hr );
602
603 len = ARRAY_SIZE(buf);
604 hr = IWbemPath_GetNamespaceAt( path, 0, &len, buf );
605 ok( hr == WBEM_E_INVALID_PARAMETER, "got %#lx\n", hr );
606
607 len = ARRAY_SIZE(buf);
608 hr = IWbemPath_GetNamespaceAt( path, 0, &len, NULL );
609 ok( hr == WBEM_E_INVALID_PARAMETER, "got %#lx\n", hr );
610 ok( len == ARRAY_SIZE(buf), "unexpected length %lu\n", len );
611
612 hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path17 );
613 ok( hr == S_OK, "got %#lx\n", hr );
614
615 len = 0;
616 hr = IWbemPath_GetNamespaceAt( path, 2, &len, NULL );
617 ok( hr == WBEM_E_INVALID_PARAMETER, "got %#lx\n", hr );
618
619 len = ARRAY_SIZE(buf);
620 hr = IWbemPath_GetNamespaceAt( path, 0, &len, NULL );
621 ok( hr == WBEM_E_INVALID_PARAMETER, "got %#lx\n", hr );
622 ok( len == ARRAY_SIZE(buf), "unexpected length %lu\n", len );
623
624 buf[0] = 0;
625 len = ARRAY_SIZE(buf);
626 hr = IWbemPath_GetNamespaceAt( path, 0, &len, buf );
627 ok( hr == S_OK, "got %#lx\n", hr );
628 ok( !lstrcmpW( buf, L"root" ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
629 ok( len == lstrlenW( L"root" ) + 1, "unexpected length %lu\n", len );
630
631 buf[0] = 0;
632 len = ARRAY_SIZE(buf);
633 hr = IWbemPath_GetNamespaceAt( path, 1, &len, buf );
634 ok( hr == S_OK, "got %#lx\n", hr );
635 ok( !lstrcmpW( buf, L"cimv2" ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
636 ok( len == lstrlenW( L"cimv2" ) + 1, "unexpected length %lu\n", len );
637
638 IWbemPath_Release( path );
639}
640
642{
643 static const ULONGLONG expected_flags =
648 WCHAR buf[16];
649 ULONG len;
651 HRESULT hr;
652
653 if (!(path = create_path())) return;
654
655 hr = IWbemPath_RemoveAllNamespaces( path );
656 ok( hr == S_OK, "got %#lx\n", hr );
657
658 hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path17 );
659 ok( hr == S_OK, "got %#lx\n", hr );
660
661 flags = 0;
662 hr = IWbemPath_GetInfo( path, 0, &flags );
663 ok( hr == S_OK, "got %#lx\n", hr );
664 ok( flags == expected_flags,
665 "got %s\n", wine_dbgstr_longlong(flags) );
666
667 hr = IWbemPath_RemoveAllNamespaces( path );
668 ok( hr == S_OK, "got %#lx\n", hr );
669
670 flags = 0;
671 hr = IWbemPath_GetInfo( path, 0, &flags );
672 ok( hr == S_OK, "got %#lx\n", hr );
673 ok( flags == expected_flags,
674 "got %s\n", wine_dbgstr_longlong(flags) );
675
676 buf[0] = 0;
677 len = ARRAY_SIZE(buf);
678 hr = IWbemPath_GetNamespaceAt( path, 0, &len, buf );
679 ok( hr == WBEM_E_INVALID_PARAMETER, "got %#lx\n", hr );
680
681 IWbemPath_Release( path );
682}
683
685{
686 static const ULONGLONG expected_flags =
691 WCHAR buf[16];
692 ULONG len, count;
694 HRESULT hr;
695
696 if (!(path = create_path())) return;
697
698 hr = IWbemPath_RemoveNamespaceAt( path, 0 );
699 ok( hr == WBEM_E_INVALID_PARAMETER, "got %#lx\n", hr );
700
701 hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path17 );
702 ok( hr == S_OK, "got %#lx\n", hr );
703
704 flags = 0;
705 hr = IWbemPath_GetInfo( path, 0, &flags );
706 ok( hr == S_OK, "got %#lx\n", hr );
707 ok( flags == expected_flags,
708 "got %s\n", wine_dbgstr_longlong(flags) );
709
710 count = 0xdeadbeef;
711 hr = IWbemPath_GetNamespaceCount( path, &count );
712 ok( hr == S_OK, "got %#lx\n", hr );
713 ok( count == 2, "got %lu\n", count );
714
715 hr = IWbemPath_RemoveNamespaceAt( path, 0 );
716 ok( hr == S_OK, "got %#lx\n", hr );
717
718 flags = 0;
719 hr = IWbemPath_GetInfo( path, 0, &flags );
720 ok( hr == S_OK, "got %#lx\n", hr );
721 ok( flags == expected_flags,
722 "got %s\n", wine_dbgstr_longlong(flags) );
723
724 count = 0xdeadbeef;
725 hr = IWbemPath_GetNamespaceCount( path, &count );
726 ok( hr == S_OK, "got %#lx\n", hr );
727 ok( count == 1, "got %lu\n", count );
728
729 buf[0] = 0;
730 len = ARRAY_SIZE(buf);
731 hr = IWbemPath_GetNamespaceAt( path, 0, &len, buf );
732 ok( hr == S_OK, "got %#lx\n", hr );
733 ok( !lstrcmpW( buf, L"cimv2" ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
734 ok( len == lstrlenW( L"cimv2" ) + 1, "unexpected length %lu\n", len );
735
736 hr = IWbemPath_RemoveNamespaceAt( path, 0 );
737 ok( hr == S_OK, "got %#lx\n", hr );
738
739 flags = 0;
740 hr = IWbemPath_GetInfo( path, 0, &flags );
741 ok( hr == S_OK, "got %#lx\n", hr );
742 ok( flags == expected_flags, "got %s\n", wine_dbgstr_longlong(flags) );
743
744 count = 0xdeadbeef;
745 hr = IWbemPath_GetNamespaceCount( path, &count );
746 ok( hr == S_OK, "got %#lx\n", hr );
747 ok( !count, "got %lu\n", count );
748
749 buf[0] = 0;
750 len = ARRAY_SIZE(buf);
751 hr = IWbemPath_GetNamespaceAt( path, 0, &len, buf );
752 ok( hr == WBEM_E_INVALID_PARAMETER, "got %#lx\n", hr );
753
754 IWbemPath_Release( path );
755}
756
758{
759 static const ULONGLONG expected_flags =
764 WCHAR buf[16];
765 ULONG len, count;
767 HRESULT hr;
768
769 if (!(path = create_path())) return;
770
771 hr = IWbemPath_SetNamespaceAt( path, 0, NULL );
772 ok( hr == WBEM_E_INVALID_PARAMETER, "got %#lx\n", hr );
773
774 hr = IWbemPath_SetNamespaceAt( path, 1, L"cimv2" );
775 ok( hr == WBEM_E_INVALID_PARAMETER, "got %#lx\n", hr );
776
777 hr = IWbemPath_SetNamespaceAt( path, 0, L"cimv2" );
778 ok( hr == S_OK, "got %#lx\n", hr );
779
780 count = 0xdeadbeef;
781 hr = IWbemPath_GetNamespaceCount( path, &count );
782 ok( hr == S_OK, "got %#lx\n", hr );
783 ok( count == 1, "got %lu\n", count );
784
785 flags = 0;
786 hr = IWbemPath_GetInfo( path, 0, &flags );
787 ok( hr == S_OK, "got %#lx\n", hr );
788 ok( flags == expected_flags, "got %s\n", wine_dbgstr_longlong(flags) );
789
790 buf[0] = 0;
791 len = ARRAY_SIZE(buf);
792 hr = IWbemPath_GetNamespaceAt( path, 0, &len, buf );
793 ok( hr == S_OK, "got %#lx\n", hr );
794 ok( !lstrcmpW( buf, L"cimv2" ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
795 ok( len == lstrlenW( L"cimv2" ) + 1, "unexpected length %lu\n", len );
796
797 hr = IWbemPath_SetNamespaceAt( path, 0, L"root" );
798 ok( hr == S_OK, "got %#lx\n", hr );
799
800 flags = 0;
801 hr = IWbemPath_GetInfo( path, 0, &flags );
802 ok( hr == S_OK, "got %#lx\n", hr );
803 ok( flags == expected_flags, "got %s\n", wine_dbgstr_longlong(flags) );
804
805 count = 0xdeadbeef;
806 hr = IWbemPath_GetNamespaceCount( path, &count );
807 ok( hr == S_OK, "got %#lx\n", hr );
808 ok( count == 2, "got %lu\n", count );
809
810 buf[0] = 0;
811 len = ARRAY_SIZE(buf);
812 hr = IWbemPath_GetNamespaceAt( path, 0, &len, buf );
813 ok( hr == S_OK, "got %#lx\n", hr );
814 ok( !lstrcmpW( buf, L"root" ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
815 ok( len == lstrlenW( L"root" ) + 1, "unexpected length %lu\n", len );
816
817 buf[0] = 0;
818 len = ARRAY_SIZE(buf);
819 hr = IWbemPath_GetNamespaceAt( path, 1, &len, buf );
820 ok( hr == S_OK, "got %#lx\n", hr );
821 ok( !lstrcmpW( buf, L"cimv2" ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
822 ok( len == lstrlenW( L"cimv2" ) + 1, "unexpected length %lu\n", len );
823
824 IWbemPath_Release( path );
825}
826
828{
830
842
844}
#define ok(value,...)
Definition: atltest.h:57
#define START_TEST(x)
Definition: atltest.h:75
#define ARRAY_SIZE(A)
Definition: main.h:20
HRESULT hr
Definition: delayimp.cpp:582
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: combase.c:2842
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, IUnknown *outer, DWORD cls_context, REFIID riid, void **obj)
Definition: combase.c:1685
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49
#define lstrlenW
Definition: compat.h:750
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4152
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:531
return ret
Definition: mutex.c:147
#define L(x)
Definition: resources.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLenum mode
Definition: glext.h:6217
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLbitfield flags
Definition: glext.h:7161
GLenum GLsizei len
Definition: glext.h:6722
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT
Definition: sysinfo.c:13
#define S_OK
Definition: intsafe.h:52
#define wine_dbgstr_w
Definition: kernel32.h:34
#define win_skip
Definition: minitest.h:67
#define todo_wine_if(is_todo)
Definition: minitest.h:81
#define todo_wine
Definition: minitest.h:80
DWORD todo
Definition: path.c:47
static const WCHAR path3[]
Definition: misc.c:297
static const WCHAR path19[]
Definition: path.c:46
static IWbemPath * create_path(void)
Definition: path.c:49
static void test_IWbemPath_GetText(void)
Definition: path.c:135
static void test_IWbemPath_RemoveAllNamespaces(void)
Definition: path.c:641
static void test_IWbemPath_GetInfo(void)
Definition: path.c:461
static const WCHAR path7[]
Definition: path.c:34
static const WCHAR path18[]
Definition: path.c:45
static void test_IWbemPath_GetClassName(void)
Definition: path.c:329
static const WCHAR path11[]
Definition: path.c:38
static void test_IWbemPath_GetNamespaceAt(void)
Definition: path.c:587
static void test_IWbemPath_SetClassName(void)
Definition: path.c:377
static void test_IWbemPath_SetNamespaceAt(void)
Definition: path.c:757
static void test_IWbemPath_GetServer(void)
Definition: path.c:414
static const WCHAR path5[]
Definition: path.c:32
static const WCHAR path14[]
Definition: path.c:41
static void test_IWbemPath_SetText(void)
Definition: path.c:63
static void test_IWbemPath_RemoveNamespaceAt(void)
Definition: path.c:684
static const WCHAR path10[]
Definition: path.c:37
static const WCHAR path12[]
Definition: path.c:39
static const WCHAR path20[]
Definition: path.c:47
static const WCHAR path1[]
Definition: path.c:28
static const WCHAR path16[]
Definition: path.c:43
static const WCHAR path13[]
Definition: path.c:40
static const WCHAR path8[]
Definition: path.c:35
static const WCHAR path17[]
Definition: path.c:44
static const WCHAR path6[]
Definition: path.c:33
static const WCHAR path9[]
Definition: path.c:36
static void test_IWbemPath_SetServer(void)
Definition: path.c:534
static const WCHAR path4[]
Definition: path.c:31
static const WCHAR path2[]
Definition: path.c:29
static const WCHAR path15[]
Definition: path.c:42
short WCHAR
Definition: pedump.c:58
#define test
Definition: rosglue.h:37
#define memset(x, y, z)
Definition: compat.h:39
uint64_t ULONGLONG
Definition: typedefs.h:67
uint32_t ULONG
Definition: typedefs.h:59
@ WBEM_E_NOT_AVAILABLE
Definition: wbemcli.idl:59
@ WBEM_E_INVALID_PARAMETER
Definition: wbemcli.idl:58
@ WBEM_E_INVALID_OBJECT_PATH
Definition: wbemcli.idl:108
@ WBEMPATH_GET_RELATIVE_ONLY
Definition: wmiutils.idl:57
@ WBEMPATH_GET_ORIGINAL
Definition: wmiutils.idl:61
@ WBEMPATH_GET_SERVER_AND_NAMESPACE_ONLY
Definition: wmiutils.idl:59
@ WBEMPATH_GET_SERVER_TOO
Definition: wmiutils.idl:58
@ WBEMPATH_GET_NAMESPACE_ONLY
Definition: wmiutils.idl:60
@ WBEMPATH_TREAT_SINGLE_IDENT_AS_NS
Definition: wmiutils.idl:51
@ WBEMPATH_CREATE_ACCEPT_RELATIVE
Definition: wmiutils.idl:48
@ WBEMPATH_CREATE_ACCEPT_ABSOLUTE
Definition: wmiutils.idl:49
@ WBEMPATH_CREATE_ACCEPT_ALL
Definition: wmiutils.idl:50
@ WBEMPATH_INFO_HAS_IMPLIED_KEY
Definition: wmiutils.idl:33
@ WBEMPATH_INFO_IS_CLASS_REF
Definition: wmiutils.idl:28
@ WBEMPATH_INFO_HAS_MACHINE_NAME
Definition: wmiutils.idl:27
@ WBEMPATH_INFO_V2_COMPLIANT
Definition: wmiutils.idl:36
@ WBEMPATH_INFO_HAS_SUBSCOPES
Definition: wmiutils.idl:30
@ WBEMPATH_INFO_PATH_HAD_SERVER
Definition: wmiutils.idl:43
@ WBEMPATH_INFO_IS_INST_REF
Definition: wmiutils.idl:29
@ WBEMPATH_INFO_SERVER_NAMESPACE_ONLY
Definition: wmiutils.idl:40
@ WBEMPATH_INFO_CIM_COMPLIANT
Definition: wmiutils.idl:37
@ WBEMPATH_INFO_ANON_LOCAL_MACHINE
Definition: wmiutils.idl:26
@ WBEMPATH_INFO_V1_COMPLIANT
Definition: wmiutils.idl:35