ReactOS 0.4.16-dev-334-g4d9f67c
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[] = {0};
29static const WCHAR path2[] = {'\\',0};
30static const WCHAR path3[] = {'\\','\\','s','e','r','v','e','r',0};
31static const WCHAR path4[] = {'\\','\\','s','e','r','v','e','r','\\',0};
32static const WCHAR path5[] = {'\\','\\','.','\\',0};
33static const WCHAR path6[] = {'/','/','.','/','r','o','o','t','/','c','i','m','v','2',0};
34static const WCHAR path7[] =
35 {'/','/','.','/','r','o','o','t','/','c','i','m','v','2',':','W','i','n','3','2','_',
36 'O','p','e','r','a','t','i','n','g','S','y','s','t','e','m',0};
37static const WCHAR path8[] =
38 {'/','r','o','o','t','/','c','i','m','v','2',':','W','i','n','3','2','_',
39 'O','p','e','r','a','t','i','n','g','S','y','s','t','e','m',0};
40static const WCHAR path9[] =
41 {'\\','\\','.','\\','r','o','o','t','\\','c','i','m','v','2',':','W','i','n','3','2','_',
42 'O','p','e','r','a','t','i','n','g','S','y','s','t','e','m',0};
43static const WCHAR path10[] =
44 {'/','\\','.','\\','r','o','o','t','\\','c','i','m','v','2',':','W','i','n','3','2','_',
45 'O','p','e','r','a','t','i','n','g','S','y','s','t','e','m',0};
46static const WCHAR path11[] =
47 {'/','/','.','\\','r','o','o','t','\\','c','i','m','v','2',':','W','i','n','3','2','_',
48 'O','p','e','r','a','t','i','n','g','S','y','s','t','e','m',0};
49static const WCHAR path12[] =
50 {'r','o','o','t','\\','c','i','m','v','2',':','W','i','n','3','2','_',
51 'O','p','e','r','a','t','i','n','g','S','y','s','t','e','m',0};
52static const WCHAR path13[] =
53 {'\\','\\','.','\\','r','o','o','t','\\','c','i','m','v','2',0};
54static const WCHAR path14[] =
55 {'W','i','n','3','2','_','O','p','e','r','a','t','i','n','g','S','y','s','t','e','m',0};
56static const WCHAR path15[] =
57 {'r','o','o','t','\\','c','i','m','v','2',0};
58static const WCHAR path16[] =
59 {'\\','\\','.','\\','r','o','o','t','\\','c','i','m','v','2',0};
60static const WCHAR path17[] =
61 {'\\','\\','.','\\','r','o','o','t','\\','c','i','m','v','2',':','W','i','n','3','2','_',
62 'L','o','g','i','c','a','l','D','i','s','k','.','D','e','v','i','c','e','I','d','=',
63 '"','C',':','"',0};
64static const WCHAR path18[] =
65 {'\\','\\','.','\\','r','o','o','t','\\','c','i','m','v','2',':','W','i','n','3','2','_',
66 'L','o','g','i','c','a','l','D','i','s','k','.','D','e','v','i','c','e','I','d','=',
67 '"','C',':','"',',','D','r','i','v','e','T','y','p','e','=','3',0};
68static const WCHAR path19[] =
69 {'\\','\\','.','\\','r','o','o','t','\\','c','i','m','v','2',':','W','i','n','3','2','_',
70 'L','o','g','i','c','a','l','D','i','s','k','.','D','e','v','i','c','e','I','d','=',0};
71static const WCHAR path20[] =
72 {'\\','\\','.','\\','r','o','o','t','\\','c','i','m','v','2',':','W','i','n','3','2','_',
73 'L','o','g','i','c','a','l','D','i','s','k','.','D','e','v','i','c','e','I','d',' ','=',' ',
74 '"','C',':','"',0};
75
77{
78 HRESULT hr;
80
81 hr = CoCreateInstance( &CLSID_WbemDefPath, NULL, CLSCTX_INPROC_SERVER, &IID_IWbemPath, (void **)&path );
82 if (hr != S_OK)
83 {
84 win_skip( "can't create WbemDefPath instance, skipping tests\n" );
85 return NULL;
86 }
87 return path;
88}
89
90static void test_IWbemPath_SetText(void)
91{
92 static const struct
93 {
94 const WCHAR *path;
95 ULONG mode;
97 BOOL todo;
98 } test[] =
99 {
127 };
129 HRESULT hr;
130 UINT i;
131
132 if (!(path = create_path())) return;
133
134 hr = IWbemPath_SetText( path, 0, NULL );
135 ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
136
137 hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, NULL );
138 ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
139
140 for (i = 0; i < ARRAY_SIZE(test); i++)
141 {
142 hr = IWbemPath_SetText( path, test[i].mode, test[i].path );
144 ok( hr == test[i].ret, "%u got %08x\n", i, hr );
145
146 if (test[i].ret == S_OK)
147 {
148 WCHAR buf[128];
149 ULONG len;
150
151 memset( buf, 0x55, sizeof(buf) );
152 len = ARRAY_SIZE(buf);
153 hr = IWbemPath_GetText( path, WBEMPATH_GET_ORIGINAL, &len, buf );
154 ok( hr == S_OK, "%u got %08x\n", i, hr );
155 ok( !lstrcmpW( buf, test[i].path ), "%u unexpected path %s\n", i, wine_dbgstr_w(buf) );
156 ok( len == lstrlenW( test[i].path ) + 1, "%u unexpected length %u\n", i, len );
157 }
158 }
159 IWbemPath_Release( path );
160}
161
162static void test_IWbemPath_GetText(void)
163{
164 static const WCHAR serviceW[] =
165 {'W','i','n','3','2','_','S','e','r','v','i','c','e','.','N','a','m','e','=',
166 '\"','S','e','r','v','i','c','e','\"',0};
167 static const WCHAR classW[] =
168 {'W','i','n','3','2','_','C','l','a','s','s',0};
169 static const WCHAR expected1W[] =
170 {'r','o','o','t','\\','c','i','m','v','2',':','W','i','n','3','2','_',
171 'L','o','g','i','c','a','l','D','i','s','k','.','D','e','v','i','c','e','I','d','=',
172 '"','C',':','"',0};
173 static const WCHAR expected2W[] =
174 {'W','i','n','3','2','_','L','o','g','i','c','a','l','D','i','s','k','.',
175 'D','e','v','i','c','e','I','d','=','"','C',':','"',0};
176 static const WCHAR expected3W[] =
177 {'\\','\\','.','\\','r','o','o','t','\\','c','i','m','v','2',0};
178 WCHAR buf[128];
179 ULONG len, count;
181 HRESULT hr;
182
183 if (!(path = create_path())) return;
184
185 hr = IWbemPath_GetText( path, 0, NULL, NULL );
186 ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
187
188 len = ARRAY_SIZE(buf);
189 hr = IWbemPath_GetText( path, 0, &len, NULL );
190 ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
191 ok( len == ARRAY_SIZE(buf), "unexpected length %u\n", len );
192
193 len = ARRAY_SIZE(buf);
194 memset( buf, 0x55, sizeof(buf) );
195 hr = IWbemPath_GetText( path, 0, &len, buf );
196 ok( hr == S_OK, "got %08x\n", hr );
197 ok( !buf[0], "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
198 ok( len == 1, "unexpected length %u\n", len );
199
200 hr = IWbemPath_GetText( path, WBEMPATH_GET_ORIGINAL, NULL, NULL );
201 ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
202
203 len = ARRAY_SIZE(buf);
204 hr = IWbemPath_GetText( path, WBEMPATH_GET_ORIGINAL, &len, NULL );
205 ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
206 ok( len == ARRAY_SIZE(buf), "unexpected length %u\n", len );
207
208 len = ARRAY_SIZE(buf);
209 memset( buf, 0x55, sizeof(buf) );
210 hr = IWbemPath_GetText( path, WBEMPATH_GET_ORIGINAL, &len, buf );
211 ok( hr == S_OK, "got %08x\n", hr );
212 ok( !buf[0], "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
213 ok( len == 1, "unexpected length %u\n", len );
214
215 len = ARRAY_SIZE(buf);
216 memset( buf, 0x55, sizeof(buf) );
217 hr = IWbemPath_GetText( path, WBEMPATH_GET_SERVER_TOO, &len, buf );
218 ok( hr == S_OK, "got %08x\n", hr );
219 todo_wine ok( !buf[0], "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
220 todo_wine ok( len == 1, "unexpected length %u\n", len );
221
222 hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path8 );
223 ok( hr == S_OK, "got %08x\n", hr );
224
225 count = 0xdeadbeef;
226 hr = IWbemPath_GetNamespaceCount( path, &count );
227 ok( hr == S_OK, "got %08x\n", hr );
228 ok( count == 2, "got %u\n", count );
229
230 len = ARRAY_SIZE(buf);
231 memset( buf, 0x55, sizeof(buf) );
232 hr = IWbemPath_GetText( path, WBEMPATH_GET_SERVER_TOO, &len, buf );
233 ok( hr == S_OK, "got %08x\n", hr );
234 ok( !lstrcmpW( buf, path9 ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
235 ok( len == lstrlenW( path9 ) + 1, "unexpected length %u\n", len );
236
237 len = ARRAY_SIZE(buf);
238 memset( buf, 0x55, sizeof(buf) );
239 hr = IWbemPath_GetText( path, WBEMPATH_GET_SERVER_AND_NAMESPACE_ONLY, &len, buf );
240 ok( hr == S_OK, "got %08x\n", hr );
241 ok( !lstrcmpW( buf, path13 ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
242 ok( len == lstrlenW( path13 ) + 1, "unexpected length %u\n", len );
243
244 len = ARRAY_SIZE(buf);
245 memset( buf, 0x55, sizeof(buf) );
246 hr = IWbemPath_GetText( path, WBEMPATH_GET_RELATIVE_ONLY, &len, buf );
247 ok( hr == S_OK, "got %08x\n", hr );
248 ok( !lstrcmpW( buf, path14 ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
249 ok( len == lstrlenW( path14 ) + 1, "unexpected length %u\n", len );
250
251 len = ARRAY_SIZE(buf);
252 memset( buf, 0x55, sizeof(buf) );
253 hr = IWbemPath_GetText( path, WBEMPATH_GET_NAMESPACE_ONLY, &len, buf );
254 ok( hr == S_OK, "got %08x\n", hr );
255 ok( !lstrcmpW( buf, path15 ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
256 ok( len == lstrlenW( path15 ) + 1, "unexpected length %u\n", len );
257
258 len = ARRAY_SIZE(buf);
259 memset( buf, 0x55, sizeof(buf) );
260 hr = IWbemPath_GetText( path, 0, &len, buf );
261 ok( hr == S_OK, "got %08x\n", hr );
262 ok( !lstrcmpW( buf, path12 ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
263 ok( len == lstrlenW( path12 ) + 1, "unexpected length %u\n", len );
264
265 hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path1 );
266 ok( hr == S_OK, "got %08x\n", hr );
267
268 count = 0xdeadbeef;
269 hr = IWbemPath_GetNamespaceCount( path, &count );
270 ok( hr == S_OK, "got %08x\n", hr );
271 ok( !count, "got %u\n", count );
272
273 hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path6 );
274 ok( hr == S_OK, "got %08x\n", hr );
275
276 count = 0xdeadbeef;
277 hr = IWbemPath_GetNamespaceCount( path, &count );
278 ok( hr == S_OK, "got %08x\n", hr );
279 ok( count == 2, "got %u\n", count );
280
281 len = 0;
282 hr = IWbemPath_GetText( path, WBEMPATH_GET_SERVER_TOO, &len, NULL );
283 ok( hr == S_OK, "got %08x\n", hr );
284 ok( len == lstrlenW( path16 ) + 1, "unexpected length %u\n", len );
285
286 len = ARRAY_SIZE(buf);
287 memset( buf, 0x55, sizeof(buf) );
288 hr = IWbemPath_GetText( path, WBEMPATH_GET_SERVER_TOO, &len, buf );
289 ok( hr == S_OK, "got %08x\n", hr );
290 ok( !lstrcmpW( buf, path16 ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
291 ok( len == lstrlenW( path16 ) + 1, "unexpected length %u\n", len );
292
293 hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path17 );
294 ok( hr == S_OK, "got %08x\n", hr );
295
296 len = ARRAY_SIZE(buf);
297 memset( buf, 0x55, sizeof(buf) );
298 hr = IWbemPath_GetText( path, WBEMPATH_GET_SERVER_TOO, &len, buf );
299 ok( hr == S_OK, "got %08x\n", hr );
300 ok( !lstrcmpW( buf, path17 ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
301 ok( len == lstrlenW( path17 ) + 1, "unexpected length %u\n", len );
302
303 len = ARRAY_SIZE(buf);
304 memset( buf, 0x55, sizeof(buf) );
305 hr = IWbemPath_GetText( path, 0, &len, buf );
306 ok( hr == S_OK, "got %08x\n", hr );
307 ok( !lstrcmpW( buf, expected1W ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
308 ok( len == lstrlenW( expected1W ) + 1, "unexpected length %u\n", len );
309
310 len = ARRAY_SIZE(buf);
311 memset( buf, 0x55, sizeof(buf) );
312 hr = IWbemPath_GetText( path, WBEMPATH_GET_RELATIVE_ONLY, &len, buf );
313 ok( hr == S_OK, "got %08x\n", hr );
314 ok( !lstrcmpW( buf, expected2W ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
315 ok( len == lstrlenW( expected2W ) + 1, "unexpected length %u\n", len );
316
317 hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path15 );
318 ok( hr == S_OK, "got %08x\n", hr );
319
320 len = ARRAY_SIZE(buf);
321 memset( buf, 0x55, sizeof(buf) );
322 hr = IWbemPath_GetText( path, WBEMPATH_GET_SERVER_TOO, &len, buf );
323 ok( hr == S_OK, "got %08x\n", hr );
324 ok( !lstrcmpW( buf, expected3W ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
325 ok( len == lstrlenW( expected3W ) + 1, "unexpected length %u\n", len );
326
327 hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path18 );
328 ok( hr == S_OK, "got %08x\n", hr );
329
330 hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path19 );
331 ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
332
333 hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path20 );
334 ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
335
336 IWbemPath_Release( path );
337 if (!(path = create_path())) return;
338
339 hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, serviceW );
340 ok( hr == S_OK, "got %08x\n", hr );
341
342 len = ARRAY_SIZE(buf);
343 memset( buf, 0x55, sizeof(buf) );
344 hr = IWbemPath_GetText( path, WBEMPATH_GET_RELATIVE_ONLY, &len, buf );
345 ok( hr == S_OK, "got %08x\n", hr );
346 ok( !lstrcmpW( buf, serviceW ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
347 ok( len == lstrlenW( serviceW ) + 1, "unexpected length %u\n", len );
348
349 IWbemPath_Release( path );
350 if (!(path = create_path())) return;
351
352 hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, classW );
353 ok( hr == S_OK, "got %08x\n", hr );
354
355 len = ARRAY_SIZE(buf);
356 memset( buf, 0x55, sizeof(buf) );
357 hr = IWbemPath_GetText( path, WBEMPATH_GET_RELATIVE_ONLY, &len, buf );
358 ok( hr == S_OK, "got %08x\n", hr );
359 ok( !lstrcmpW( buf, classW ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
360 ok( len == lstrlenW( classW ) + 1, "unexpected length %u\n", len );
361
362 IWbemPath_Release( path );
363}
364
366{
367 static const WCHAR classW[] = {'W','i','n','3','2','_','L','o','g','i','c','a','l','D','i','s','k',0};
369 HRESULT hr;
370 WCHAR buf[32];
371 ULONG len;
372
373 if (!(path = create_path())) return;
374
375 hr = IWbemPath_GetClassName( path, NULL, NULL );
376 ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
377
378 len = 0;
379 hr = IWbemPath_GetClassName( path, &len, NULL );
380 ok( hr == WBEM_E_INVALID_OBJECT_PATH, "got %08x\n", hr );
381
382 len = ARRAY_SIZE(buf);
383 hr = IWbemPath_GetClassName( path, &len, buf );
384 ok( hr == WBEM_E_INVALID_OBJECT_PATH, "got %08x\n", hr );
385
386 len = ARRAY_SIZE(buf);
387 hr = IWbemPath_GetClassName( path, &len, NULL );
388 ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
389 ok( len == ARRAY_SIZE(buf), "unexpected length %u\n", len );
390
391 hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path17 );
392 ok( hr == S_OK, "got %08x\n", hr );
393
394 len = 0;
395 hr = IWbemPath_GetClassName( path, &len, NULL );
396 ok( hr == S_OK, "got %08x\n", hr );
397
398 len = ARRAY_SIZE(buf);
399 hr = IWbemPath_GetClassName( path, &len, NULL );
400 ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
401 ok( len == ARRAY_SIZE(buf), "unexpected length %u\n", len );
402
403 buf[0] = 0;
404 len = ARRAY_SIZE(buf);
405 hr = IWbemPath_GetClassName( path, &len, buf );
406 ok( hr == S_OK, "got %08x\n", hr );
407 ok( !lstrcmpW( buf, classW ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
408 ok( len == lstrlenW( classW ) + 1, "unexpected length %u\n", len );
409
410 IWbemPath_Release( path );
411}
412
414{
415 static const WCHAR classW[] = {'c','l','a','s','s',0};
416 static const WCHAR emptyW[] = {0};
418 WCHAR buf[16];
419 ULONG len;
421 HRESULT hr;
422
423 if (!(path = create_path())) return;
424
425 hr = IWbemPath_SetClassName( path, NULL );
426 ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
427
428 hr = IWbemPath_SetClassName( path, emptyW );
429 ok( hr == S_OK, "got %08x\n", hr );
430
431 hr = IWbemPath_SetClassName( path, classW );
432 ok( hr == S_OK, "got %08x\n", hr );
433
434 buf[0] = 0;
435 len = ARRAY_SIZE(buf);
436 hr = IWbemPath_GetClassName( path, &len, buf );
437 ok( hr == S_OK, "got %08x\n", hr );
438 ok( !lstrcmpW( buf, classW ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
439
440 flags = 0;
441 hr = IWbemPath_GetInfo( path, 0, &flags );
442 ok( hr == S_OK, "got %08x\n", hr );
446 "got %s\n", wine_dbgstr_longlong(flags) );
447
448 IWbemPath_Release( path );
449}
450
452{
453 static const WCHAR dotW[] = {'.',0};
455 HRESULT hr;
456 WCHAR buf[32];
457 ULONG len;
458
459 if (!(path = create_path())) return;
460
461 hr = IWbemPath_GetServer( path, NULL, NULL );
462 ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
463
464 len = 0;
465 hr = IWbemPath_GetServer( path, &len, NULL );
466 ok( hr == WBEM_E_NOT_AVAILABLE, "got %08x\n", hr );
467
468 len = ARRAY_SIZE(buf);
469 hr = IWbemPath_GetServer( path, &len, buf );
470 ok( hr == WBEM_E_NOT_AVAILABLE, "got %08x\n", hr );
471
472 len = ARRAY_SIZE(buf);
473 hr = IWbemPath_GetServer( path, &len, NULL );
474 ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
475 ok( len == ARRAY_SIZE(buf), "unexpected length %u\n", len );
476
477 hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path17 );
478 ok( hr == S_OK, "got %08x\n", hr );
479
480 len = 0;
481 hr = IWbemPath_GetServer( path, &len, NULL );
482 ok( hr == S_OK, "got %08x\n", hr );
483
484 len = ARRAY_SIZE(buf);
485 hr = IWbemPath_GetServer( path, &len, NULL );
486 ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
487 ok( len == ARRAY_SIZE(buf), "unexpected length %u\n", len );
488
489 buf[0] = 0;
490 len = ARRAY_SIZE(buf);
491 hr = IWbemPath_GetServer( path, &len, buf );
492 ok( hr == S_OK, "got %08x\n", hr );
493 ok( !lstrcmpW( buf, dotW ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
494 ok( len == lstrlenW( dotW ) + 1, "unexpected length %u\n", len );
495
496 IWbemPath_Release( path );
497}
498
499static void test_IWbemPath_GetInfo(void)
500{
502 HRESULT hr;
503 ULONGLONG resp;
504
505 if (!(path = create_path())) return;
506
507 hr = IWbemPath_GetInfo( path, 0, NULL );
508 ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
509
510 hr = IWbemPath_GetInfo( path, 1, NULL );
511 ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
512
513 resp = 0xdeadbeef;
514 hr = IWbemPath_GetInfo( path, 0, &resp );
515 ok( hr == S_OK, "got %08x\n", hr );
517 "got %s\n", wine_dbgstr_longlong(resp) );
518
519 hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path17 );
520 ok( hr == S_OK, "got %08x\n", hr );
521
522 hr = IWbemPath_GetInfo( path, 0, NULL );
523 ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
524
525 hr = IWbemPath_GetInfo( path, 1, NULL );
526 ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
527
528 resp = 0xdeadbeef;
529 hr = IWbemPath_GetInfo( path, 0, &resp );
530 ok( hr == S_OK, "got %08x\n", hr );
534 "got %s\n", wine_dbgstr_longlong(resp) );
535
536 IWbemPath_Release( path );
537 if (!(path = create_path())) return;
538
539 hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path12 );
540 ok( hr == S_OK, "got %08x\n", hr );
541
542 resp = 0xdeadbeef;
543 hr = IWbemPath_GetInfo( path, 0, &resp );
544 ok( hr == S_OK, "got %08x\n", hr );
548 "got %s\n", wine_dbgstr_longlong(resp) );
549
550 hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path1 );
551 ok( hr == S_OK, "got %08x\n", hr );
552
553 resp = 0xdeadbeef;
554 hr = IWbemPath_GetInfo( path, 0, &resp );
555 ok( hr == S_OK, "got %08x\n", hr );
557 "got %s\n", wine_dbgstr_longlong(resp) );
558
559 IWbemPath_Release( path );
560}
561
563{
564 static const WCHAR serverW[] = {'s','e','r','v','e','r',0};
565 static const WCHAR emptyW[] = {0};
567 WCHAR buf[16];
568 ULONG len;
570 HRESULT hr;
571
572 if (!(path = create_path())) return;
573
574 hr = IWbemPath_SetServer( path, NULL );
575 ok( hr == S_OK, "got %08x\n", hr );
576
577 len = ARRAY_SIZE(buf);
578 hr = IWbemPath_GetServer( path, &len, buf );
579 ok( hr == WBEM_E_NOT_AVAILABLE, "got %08x\n", hr );
580
581 hr = IWbemPath_SetServer( path, emptyW );
582 ok( hr == S_OK, "got %08x\n", hr );
583
584 hr = IWbemPath_SetServer( path, serverW );
585 ok( hr == S_OK, "got %08x\n", hr );
586
587 buf[0] = 0;
588 len = ARRAY_SIZE(buf);
589 hr = IWbemPath_GetServer( path, &len, buf );
590 ok( hr == S_OK, "got %08x\n", hr );
591 ok( !lstrcmpW( buf, serverW ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
592
593 flags = 0;
594 hr = IWbemPath_GetInfo( path, 0, &flags );
595 ok( hr == S_OK, "got %08x\n", hr );
599 "got %s\n", wine_dbgstr_longlong(flags) );
600
601 hr = IWbemPath_SetServer( path, NULL );
602 ok( hr == S_OK, "got %08x\n", hr );
603
604 len = ARRAY_SIZE(buf);
605 hr = IWbemPath_GetServer( path, &len, buf );
606 ok( hr == WBEM_E_NOT_AVAILABLE, "got %08x\n", hr );
607
608 flags = 0;
609 hr = IWbemPath_GetInfo( path, 0, &flags );
610 ok( hr == S_OK, "got %08x\n", hr );
612 "got %s\n", wine_dbgstr_longlong(flags) );
613
614 IWbemPath_Release( path );
615}
616
618{
619 static const WCHAR rootW[] = {'r','o','o','t',0};
620 static const WCHAR cimv2W[] = {'c','i','m','v','2',0};
622 HRESULT hr;
623 WCHAR buf[32];
624 ULONG len;
625
626 if (!(path = create_path())) return;
627
628 hr = IWbemPath_GetNamespaceAt( path, 0, NULL, NULL );
629 ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
630
631 len = 0;
632 hr = IWbemPath_GetNamespaceAt( path, 0, &len, NULL );
633 ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
634
635 len = ARRAY_SIZE(buf);
636 hr = IWbemPath_GetNamespaceAt( path, 0, &len, buf );
637 ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
638
639 len = ARRAY_SIZE(buf);
640 hr = IWbemPath_GetNamespaceAt( path, 0, &len, NULL );
641 ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
642 ok( len == ARRAY_SIZE(buf), "unexpected length %u\n", len );
643
644 hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path17 );
645 ok( hr == S_OK, "got %08x\n", hr );
646
647 len = 0;
648 hr = IWbemPath_GetNamespaceAt( path, 2, &len, NULL );
649 ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
650
651 len = ARRAY_SIZE(buf);
652 hr = IWbemPath_GetNamespaceAt( path, 0, &len, NULL );
653 ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
654 ok( len == ARRAY_SIZE(buf), "unexpected length %u\n", len );
655
656 buf[0] = 0;
657 len = ARRAY_SIZE(buf);
658 hr = IWbemPath_GetNamespaceAt( path, 0, &len, buf );
659 ok( hr == S_OK, "got %08x\n", hr );
660 ok( !lstrcmpW( buf, rootW ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
661 ok( len == lstrlenW( rootW ) + 1, "unexpected length %u\n", len );
662
663 buf[0] = 0;
664 len = ARRAY_SIZE(buf);
665 hr = IWbemPath_GetNamespaceAt( path, 1, &len, buf );
666 ok( hr == S_OK, "got %08x\n", hr );
667 ok( !lstrcmpW( buf, cimv2W ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
668 ok( len == lstrlenW( cimv2W ) + 1, "unexpected length %u\n", len );
669
670 IWbemPath_Release( path );
671}
672
674{
675 static const ULONGLONG expected_flags =
680 WCHAR buf[16];
681 ULONG len;
683 HRESULT hr;
684
685 if (!(path = create_path())) return;
686
687 hr = IWbemPath_RemoveAllNamespaces( path );
688 ok( hr == S_OK, "got %08x\n", hr );
689
690 hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path17 );
691 ok( hr == S_OK, "got %08x\n", hr );
692
693 flags = 0;
694 hr = IWbemPath_GetInfo( path, 0, &flags );
695 ok( hr == S_OK, "got %08x\n", hr );
696 ok( flags == expected_flags,
697 "got %s\n", wine_dbgstr_longlong(flags) );
698
699 hr = IWbemPath_RemoveAllNamespaces( path );
700 ok( hr == S_OK, "got %08x\n", hr );
701
702 flags = 0;
703 hr = IWbemPath_GetInfo( path, 0, &flags );
704 ok( hr == S_OK, "got %08x\n", hr );
705 ok( flags == expected_flags,
706 "got %s\n", wine_dbgstr_longlong(flags) );
707
708 buf[0] = 0;
709 len = ARRAY_SIZE(buf);
710 hr = IWbemPath_GetNamespaceAt( path, 0, &len, buf );
711 ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
712
713 IWbemPath_Release( path );
714}
715
717{
718 static const ULONGLONG expected_flags =
722 static const WCHAR cimv2W[] = {'c','i','m','v','2',0};
724 WCHAR buf[16];
725 ULONG len, count;
727 HRESULT hr;
728
729 if (!(path = create_path())) return;
730
731 hr = IWbemPath_RemoveNamespaceAt( path, 0 );
732 ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
733
734 hr = IWbemPath_SetText( path, WBEMPATH_CREATE_ACCEPT_ALL, path17 );
735 ok( hr == S_OK, "got %08x\n", hr );
736
737 flags = 0;
738 hr = IWbemPath_GetInfo( path, 0, &flags );
739 ok( hr == S_OK, "got %08x\n", hr );
740 ok( flags == expected_flags,
741 "got %s\n", wine_dbgstr_longlong(flags) );
742
743 count = 0xdeadbeef;
744 hr = IWbemPath_GetNamespaceCount( path, &count );
745 ok( hr == S_OK, "got %08x\n", hr );
746 ok( count == 2, "got %u\n", count );
747
748 hr = IWbemPath_RemoveNamespaceAt( path, 0 );
749 ok( hr == S_OK, "got %08x\n", hr );
750
751 flags = 0;
752 hr = IWbemPath_GetInfo( path, 0, &flags );
753 ok( hr == S_OK, "got %08x\n", hr );
754 ok( flags == expected_flags,
755 "got %s\n", wine_dbgstr_longlong(flags) );
756
757 count = 0xdeadbeef;
758 hr = IWbemPath_GetNamespaceCount( path, &count );
759 ok( hr == S_OK, "got %08x\n", hr );
760 ok( count == 1, "got %u\n", count );
761
762 buf[0] = 0;
763 len = ARRAY_SIZE(buf);
764 hr = IWbemPath_GetNamespaceAt( path, 0, &len, buf );
765 ok( hr == S_OK, "got %08x\n", hr );
766 ok( !lstrcmpW( buf, cimv2W ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
767 ok( len == lstrlenW( cimv2W ) + 1, "unexpected length %u\n", len );
768
769 hr = IWbemPath_RemoveNamespaceAt( path, 0 );
770 ok( hr == S_OK, "got %08x\n", hr );
771
772 flags = 0;
773 hr = IWbemPath_GetInfo( path, 0, &flags );
774 ok( hr == S_OK, "got %08x\n", hr );
775 ok( flags == expected_flags,
776 "got %s\n", wine_dbgstr_longlong(flags) );
777
778 count = 0xdeadbeef;
779 hr = IWbemPath_GetNamespaceCount( path, &count );
780 ok( hr == S_OK, "got %08x\n", hr );
781 ok( !count, "got %u\n", count );
782
783 buf[0] = 0;
784 len = ARRAY_SIZE(buf);
785 hr = IWbemPath_GetNamespaceAt( path, 0, &len, buf );
786 ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
787
788 IWbemPath_Release( path );
789}
790
792{
793 static const ULONGLONG expected_flags =
797 static const WCHAR rootW[] = {'r','o','o','t',0};
798 static const WCHAR cimv2W[] = {'c','i','m','v','2',0};
800 WCHAR buf[16];
801 ULONG len, count;
803 HRESULT hr;
804
805 if (!(path = create_path())) return;
806
807 hr = IWbemPath_SetNamespaceAt( path, 0, NULL );
808 ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
809
810 hr = IWbemPath_SetNamespaceAt( path, 1, cimv2W );
811 ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr );
812
813 hr = IWbemPath_SetNamespaceAt( path, 0, cimv2W );
814 ok( hr == S_OK, "got %08x\n", hr );
815
816 count = 0xdeadbeef;
817 hr = IWbemPath_GetNamespaceCount( path, &count );
818 ok( hr == S_OK, "got %08x\n", hr );
819 ok( count == 1, "got %u\n", count );
820
821 flags = 0;
822 hr = IWbemPath_GetInfo( path, 0, &flags );
823 ok( hr == S_OK, "got %08x\n", hr );
824 ok( flags == expected_flags,
825 "got %s\n", wine_dbgstr_longlong(flags) );
826
827 buf[0] = 0;
828 len = ARRAY_SIZE(buf);
829 hr = IWbemPath_GetNamespaceAt( path, 0, &len, buf );
830 ok( hr == S_OK, "got %08x\n", hr );
831 ok( !lstrcmpW( buf, cimv2W ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
832 ok( len == lstrlenW( cimv2W ) + 1, "unexpected length %u\n", len );
833
834 hr = IWbemPath_SetNamespaceAt( path, 0, rootW );
835 ok( hr == S_OK, "got %08x\n", hr );
836
837 flags = 0;
838 hr = IWbemPath_GetInfo( path, 0, &flags );
839 ok( hr == S_OK, "got %08x\n", hr );
840 ok( flags == expected_flags,
841 "got %s\n", wine_dbgstr_longlong(flags) );
842
843 count = 0xdeadbeef;
844 hr = IWbemPath_GetNamespaceCount( path, &count );
845 ok( hr == S_OK, "got %08x\n", hr );
846 ok( count == 2, "got %u\n", count );
847
848 buf[0] = 0;
849 len = ARRAY_SIZE(buf);
850 hr = IWbemPath_GetNamespaceAt( path, 0, &len, buf );
851 ok( hr == S_OK, "got %08x\n", hr );
852 ok( !lstrcmpW( buf, rootW ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
853 ok( len == lstrlenW( rootW ) + 1, "unexpected length %u\n", len );
854
855 buf[0] = 0;
856 len = ARRAY_SIZE(buf);
857 hr = IWbemPath_GetNamespaceAt( path, 1, &len, buf );
858 ok( hr == S_OK, "got %08x\n", hr );
859 ok( !lstrcmpW( buf, cimv2W ), "unexpected buffer contents %s\n", wine_dbgstr_w(buf) );
860 ok( len == lstrlenW( cimv2W ) + 1, "unexpected length %u\n", len );
861
862 IWbemPath_Release( path );
863}
864
866{
868
880
882}
#define ok(value,...)
Definition: atltest.h:57
#define START_TEST(x)
Definition: atltest.h:75
#define ARRAY_SIZE(A)
Definition: main.h:20
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
static const WCHAR rootW[]
Definition: chain.c:69
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:4243
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
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
static const WCHAR emptyW[]
Definition: navigate.c:40
#define S_OK
Definition: intsafe.h:52
#define wine_dbgstr_w
Definition: kernel32.h:34
#define todo_wine_if(is_todo)
Definition: custom.c:86
#define todo_wine
Definition: custom.c:89
static const WCHAR dotW[]
Definition: directory.c:80
DWORD todo
Definition: path.c:47
static const WCHAR path3[]
Definition: misc.c:320
static const WCHAR path19[]
Definition: path.c:68
static IWbemPath * create_path(void)
Definition: path.c:76
static void test_IWbemPath_GetText(void)
Definition: path.c:162
static void test_IWbemPath_RemoveAllNamespaces(void)
Definition: path.c:673
static void test_IWbemPath_GetInfo(void)
Definition: path.c:499
static const WCHAR path7[]
Definition: path.c:34
static const WCHAR path18[]
Definition: path.c:64
static void test_IWbemPath_GetClassName(void)
Definition: path.c:365
static const WCHAR path11[]
Definition: path.c:46
static void test_IWbemPath_GetNamespaceAt(void)
Definition: path.c:617
static void test_IWbemPath_SetClassName(void)
Definition: path.c:413
static void test_IWbemPath_SetNamespaceAt(void)
Definition: path.c:791
static void test_IWbemPath_GetServer(void)
Definition: path.c:451
static const WCHAR path5[]
Definition: path.c:32
static const WCHAR path14[]
Definition: path.c:54
static void test_IWbemPath_SetText(void)
Definition: path.c:90
static void test_IWbemPath_RemoveNamespaceAt(void)
Definition: path.c:716
static const WCHAR path10[]
Definition: path.c:43
static const WCHAR path12[]
Definition: path.c:49
static const WCHAR path20[]
Definition: path.c:71
static const WCHAR path1[]
Definition: path.c:28
static const WCHAR path16[]
Definition: path.c:58
static const WCHAR path13[]
Definition: path.c:52
static const WCHAR path8[]
Definition: path.c:37
static const WCHAR path17[]
Definition: path.c:60
static const WCHAR path6[]
Definition: path.c:33
static const WCHAR path9[]
Definition: path.c:40
static void test_IWbemPath_SetServer(void)
Definition: path.c:562
static const WCHAR path4[]
Definition: path.c:31
static const WCHAR path2[]
Definition: path.c:29
static const WCHAR path15[]
Definition: path.c:56
unsigned int UINT
Definition: ndis.h:50
#define test
Definition: rosglue.h:37
#define win_skip
Definition: test.h:163
#define memset(x, y, z)
Definition: compat.h:39
HRESULT hr
Definition: shlfolder.c:183
uint32_t ULONG
Definition: typedefs.h:59
uint64_t ULONGLONG
Definition: typedefs.h:67
static const WCHAR classW[]
Definition: lex.c:40
@ 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
int ret
@ 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_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
__wchar_t WCHAR
Definition: xmlstorage.h:180