2 * Unit tests for IDxDiagContainer
4 * Copyright 2010 Andrew Nguyen
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #include "wine/dxdiag.h"
26 #include "wine/test.h"
34 static IDxDiagProvider
*pddp
;
35 static IDxDiagContainer
*pddc
;
37 static const WCHAR DxDiag_SystemInfo
[] = {'D','x','D','i','a','g','_','S','y','s','t','e','m','I','n','f','o',0};
38 static const WCHAR DxDiag_DisplayDevices
[] = {'D','x','D','i','a','g','_','D','i','s','p','l','a','y','D','e','v','i','c','e','s',0};
39 static const WCHAR DxDiag_SoundDevices
[] = {'D','x','D','i','a','g','_','D','i','r','e','c','t','S','o','u','n','d','.',
40 'D','x','D','i','a','g','_','S','o','u','n','d','D','e','v','i','c','e','s',0};
41 static const WCHAR DxDiag_SoundCaptureDevices
[] = {'D','x','D','i','a','g','_','D','i','r','e','c','t','S','o','u','n','d','.',
42 'D','x','D','i','a','g','_','S','o','u','n','d','C','a','p','t','u','r','e',
43 'D','e','v','i','c','e','s',0};
45 /* Based on debugstr_variant in dlls/jscript/jsutils.c. */
46 static const char *debugstr_variant(const VARIANT
*var
)
58 sprintf(buf
, "{VT_BSTR: %s}", wine_dbgstr_w(V_BSTR(var
)));
61 sprintf(buf
, "{VT_BOOL: %x}", V_BOOL(var
));
64 sprintf(buf
, "{VT_UI4: %u}", V_UI4(var
));
67 sprintf(buf
, "{vt %d}", V_VT(var
));
74 static BOOL
create_root_IDxDiagContainer(void)
77 DXDIAG_INIT_PARAMS params
;
79 hr
= CoCreateInstance(&CLSID_DxDiagProvider
, NULL
, CLSCTX_INPROC_SERVER
,
80 &IID_IDxDiagProvider
, (LPVOID
*)&pddp
);
83 params
.dwSize
= sizeof(params
);
84 params
.dwDxDiagHeaderVersion
= DXDIAG_DX9_SDK_VERSION
;
85 params
.bAllowWHQLChecks
= FALSE
;
86 params
.pReserved
= NULL
;
87 hr
= IDxDiagProvider_Initialize(pddp
, ¶ms
);
90 hr
= IDxDiagProvider_GetRootContainer(pddp
, &pddc
);
94 IDxDiagProvider_Release(pddp
);
99 static void test_GetNumberOfChildContainers(void)
104 if (!create_root_IDxDiagContainer())
106 skip("Unable to create the root IDxDiagContainer\n");
110 hr
= IDxDiagContainer_GetNumberOfChildContainers(pddc
, NULL
);
111 ok(hr
== E_INVALIDARG
,
112 "Expected IDxDiagContainer::GetNumberOfChildContainers to return E_INVALIDARG, got 0x%08x\n", hr
);
114 hr
= IDxDiagContainer_GetNumberOfChildContainers(pddc
, &count
);
116 "Expected IDxDiagContainer::GetNumberOfChildContainers to return S_OK, got 0x%08x\n", hr
);
118 ok(count
!= 0, "Expected the number of child containers for the root container to be non-zero\n");
120 IDxDiagContainer_Release(pddc
);
121 IDxDiagProvider_Release(pddp
);
124 static void test_GetNumberOfProps(void)
129 if (!create_root_IDxDiagContainer())
131 skip("Unable to create the root IDxDiagContainer\n");
135 hr
= IDxDiagContainer_GetNumberOfProps(pddc
, NULL
);
136 ok(hr
== E_INVALIDARG
, "Expected IDxDiagContainer::GetNumberOfProps to return E_INVALIDARG, got 0x%08x\n", hr
);
138 hr
= IDxDiagContainer_GetNumberOfProps(pddc
, &count
);
139 ok(hr
== S_OK
, "Expected IDxDiagContainer::GetNumberOfProps to return S_OK, got 0x%08x\n", hr
);
141 ok(count
== 0, "Expected the number of properties for the root container to be zero\n");
143 IDxDiagContainer_Release(pddc
);
144 IDxDiagProvider_Release(pddp
);
147 static void test_EnumChildContainerNames(void)
150 WCHAR container
[256];
151 DWORD maxcount
, index
;
152 static const WCHAR testW
[] = {'t','e','s','t',0};
153 static const WCHAR zerotestW
[] = {0,'e','s','t',0};
155 if (!create_root_IDxDiagContainer())
157 skip("Unable to create the root IDxDiagContainer\n");
161 /* Test various combinations of invalid parameters. */
162 hr
= IDxDiagContainer_EnumChildContainerNames(pddc
, 0, NULL
, 0);
163 ok(hr
== E_INVALIDARG
,
164 "Expected IDxDiagContainer::EnumChildContainerNames to return E_INVALIDARG, got 0x%08x\n", hr
);
166 hr
= IDxDiagContainer_EnumChildContainerNames(pddc
, 0, NULL
, sizeof(container
)/sizeof(WCHAR
));
167 ok(hr
== E_INVALIDARG
,
168 "Expected IDxDiagContainer::EnumChildContainerNames to return E_INVALIDARG, got 0x%08x\n", hr
);
170 /* Test the conditions in which the output buffer can be modified. */
171 memcpy(container
, testW
, sizeof(testW
));
172 hr
= IDxDiagContainer_EnumChildContainerNames(pddc
, 0, container
, 0);
173 ok(hr
== E_INVALIDARG
,
174 "Expected IDxDiagContainer::EnumChildContainerNames to return E_INVALIDARG, got 0x%08x\n", hr
);
175 ok(!memcmp(container
, testW
, sizeof(testW
)),
176 "Expected the container buffer to be untouched, got %s\n", wine_dbgstr_w(container
));
178 memcpy(container
, testW
, sizeof(testW
));
179 hr
= IDxDiagContainer_EnumChildContainerNames(pddc
, ~0, container
, 0);
180 ok(hr
== E_INVALIDARG
,
181 "Expected IDxDiagContainer::EnumChildContainerNames to return E_INVALIDARG, got 0x%08x\n", hr
);
182 ok(!memcmp(container
, testW
, sizeof(testW
)),
183 "Expected the container buffer to be untouched, got %s\n", wine_dbgstr_w(container
));
185 memcpy(container
, testW
, sizeof(testW
));
186 hr
= IDxDiagContainer_EnumChildContainerNames(pddc
, ~0, container
, sizeof(container
)/sizeof(WCHAR
));
187 ok(hr
== E_INVALIDARG
,
188 "Expected IDxDiagContainer::EnumChildContainerNames to return E_INVALIDARG, got 0x%08x\n", hr
);
189 ok(!memcmp(container
, zerotestW
, sizeof(zerotestW
)),
190 "Expected the container buffer string to be empty, got %s\n", wine_dbgstr_w(container
));
192 hr
= IDxDiagContainer_GetNumberOfChildContainers(pddc
, &maxcount
);
193 ok(hr
== S_OK
, "Expected IDxDiagContainer::GetNumberOfChildContainers to return S_OK, got 0x%08x\n", hr
);
196 skip("IDxDiagContainer::GetNumberOfChildContainers failed\n");
200 trace("Starting child container enumeration of the root container:\n");
202 /* We should be able to enumerate as many child containers as the value
203 * that IDxDiagContainer::GetNumberOfChildContainers returns. */
204 for (index
= 0; index
<= maxcount
; index
++)
206 /* A buffer size of 1 is unlikely to be valid, as only a null terminator
207 * could be stored, and it is unlikely that a container name could be empty. */
208 DWORD buffersize
= 1;
209 memcpy(container
, testW
, sizeof(testW
));
210 hr
= IDxDiagContainer_EnumChildContainerNames(pddc
, index
, container
, buffersize
);
211 if (hr
== E_INVALIDARG
)
213 /* We should get here when index is one more than the maximum index value. */
214 ok(maxcount
== index
,
215 "Expected IDxDiagContainer::EnumChildContainerNames to return E_INVALIDARG "
216 "on the last index %d, got 0x%08x\n", index
, hr
);
217 ok(container
[0] == '\0',
218 "Expected the container buffer string to be empty, got %s\n", wine_dbgstr_w(container
));
221 else if (hr
== DXDIAG_E_INSUFFICIENT_BUFFER
)
225 ok(container
[0] == '\0',
226 "Expected the container buffer string to be empty, got %s\n", wine_dbgstr_w(container
));
228 /* Get the container name to compare against. */
229 hr
= IDxDiagContainer_EnumChildContainerNames(pddc
, index
, temp
, sizeof(temp
)/sizeof(WCHAR
));
231 "Expected IDxDiagContainer::EnumChildContainerNames to return S_OK, got 0x%08x\n", hr
);
233 /* Show that the DirectX SDK's stipulation that the buffer be at
234 * least 256 characters long is a mere suggestion, and smaller sizes
235 * can be acceptable also. IDxDiagContainer::EnumChildContainerNames
236 * doesn't provide a way of getting the exact size required, so the
237 * buffersize value will be iterated to at most 256 characters. */
238 for (buffersize
= 2; buffersize
<= 256; buffersize
++)
240 memcpy(container
, testW
, sizeof(testW
));
241 hr
= IDxDiagContainer_EnumChildContainerNames(pddc
, index
, container
, buffersize
);
242 if (hr
!= DXDIAG_E_INSUFFICIENT_BUFFER
)
245 ok(!memcmp(temp
, container
, sizeof(WCHAR
)*(buffersize
- 1)),
246 "Expected truncated container name string, got %s\n", wine_dbgstr_w(container
));
250 "Expected IDxDiagContainer::EnumChildContainerNames to return S_OK, "
251 "got hr = 0x%08x, buffersize = %d\n", hr
, buffersize
);
253 trace("pddc[%d] = %s, length = %d\n", index
, wine_dbgstr_w(container
), buffersize
);
257 ok(0, "IDxDiagContainer::EnumChildContainerNames unexpectedly returned 0x%08x\n", hr
);
263 IDxDiagContainer_Release(pddc
);
264 IDxDiagProvider_Release(pddp
);
267 static void test_GetChildContainer(void)
270 WCHAR container
[256] = {0};
271 IDxDiagContainer
*child
;
273 if (!create_root_IDxDiagContainer())
275 skip("Unable to create the root IDxDiagContainer\n");
279 /* Test various combinations of invalid parameters. */
280 hr
= IDxDiagContainer_GetChildContainer(pddc
, NULL
, NULL
);
281 ok(hr
== E_INVALIDARG
,
282 "Expected IDxDiagContainer::GetChildContainer to return E_INVALIDARG, got 0x%08x\n", hr
);
284 child
= (void*)0xdeadbeef;
285 hr
= IDxDiagContainer_GetChildContainer(pddc
, NULL
, &child
);
286 ok(hr
== E_INVALIDARG
,
287 "Expected IDxDiagContainer::GetChildContainer to return E_INVALIDARG, got 0x%08x\n", hr
);
288 ok(child
== (void*)0xdeadbeef, "Expected output pointer to be unchanged, got %p\n", child
);
290 hr
= IDxDiagContainer_GetChildContainer(pddc
, container
, NULL
);
291 ok(hr
== E_INVALIDARG
,
292 "Expected IDxDiagContainer::GetChildContainer to return E_INVALIDARG, got 0x%08x\n", hr
);
294 child
= (void*)0xdeadbeef;
295 hr
= IDxDiagContainer_GetChildContainer(pddc
, container
, &child
);
296 ok(hr
== E_INVALIDARG
,
297 "Expected IDxDiagContainer::GetChildContainer to return E_INVALIDARG, got 0x%08x\n", hr
);
298 ok(child
== NULL
, "Expected output pointer to be NULL, got %p\n", child
);
300 /* Get the name of a suitable child container. */
301 hr
= IDxDiagContainer_EnumChildContainerNames(pddc
, 0, container
, sizeof(container
)/sizeof(WCHAR
));
303 "Expected IDxDiagContainer::EnumChildContainerNames to return S_OK, got 0x%08x\n", hr
);
306 skip("IDxDiagContainer::EnumChildContainerNames failed\n");
310 child
= (void*)0xdeadbeef;
311 hr
= IDxDiagContainer_GetChildContainer(pddc
, container
, &child
);
313 "Expected IDxDiagContainer::GetChildContainer to return S_OK, got 0x%08x\n", hr
);
314 ok(child
!= NULL
&& child
!= (void*)0xdeadbeef, "Expected a valid output pointer, got %p\n", child
);
318 IDxDiagContainer
*ptr
;
320 /* Show that IDxDiagContainer::GetChildContainer returns a different pointer
321 * for multiple calls for the same container name. */
322 hr
= IDxDiagContainer_GetChildContainer(pddc
, container
, &ptr
);
324 "Expected IDxDiagContainer::GetChildContainer to return S_OK, got 0x%08x\n", hr
);
326 ok(ptr
!= child
, "Expected the two pointers (%p vs. %p) to be unequal\n", child
, ptr
);
328 IDxDiagContainer_Release(ptr
);
329 IDxDiagContainer_Release(child
);
333 IDxDiagContainer_Release(pddc
);
334 IDxDiagProvider_Release(pddp
);
337 static void test_dot_parsing(void)
340 WCHAR containerbufW
[256] = {0}, childbufW
[256] = {0};
346 const HRESULT expect
;
350 { ".%s.%s", E_INVALIDARG
},
351 { "%s.%s..", E_INVALIDARG
},
352 { ".%s.%s.", E_INVALIDARG
},
353 { "..%s.%s", E_INVALIDARG
},
356 if (!create_root_IDxDiagContainer())
358 skip("Unable to create the root IDxDiagContainer\n");
362 /* Find a container with a child container of its own. */
363 hr
= IDxDiagContainer_GetNumberOfChildContainers(pddc
, &count
);
364 ok(hr
== S_OK
, "Expected IDxDiagContainer::GetNumberOfChildContainers to return S_OK, got 0x%08x\n", hr
);
367 skip("IDxDiagContainer::GetNumberOfChildContainers failed\n");
371 for (index
= 0; index
< count
; index
++)
373 IDxDiagContainer
*child
;
375 hr
= IDxDiagContainer_EnumChildContainerNames(pddc
, index
, containerbufW
, sizeof(containerbufW
)/sizeof(WCHAR
));
376 ok(hr
== S_OK
, "Expected IDxDiagContainer_EnumChildContainerNames to return S_OK, got 0x%08x\n", hr
);
379 skip("IDxDiagContainer::EnumChildContainerNames failed\n");
383 hr
= IDxDiagContainer_GetChildContainer(pddc
, containerbufW
, &child
);
384 ok(hr
== S_OK
, "Expected IDxDiagContainer::GetChildContainer to return S_OK, got 0x%08x\n", hr
);
388 hr
= IDxDiagContainer_EnumChildContainerNames(child
, 0, childbufW
, sizeof(childbufW
)/sizeof(WCHAR
));
389 ok(hr
== S_OK
|| hr
== E_INVALIDARG
,
390 "Expected IDxDiagContainer::EnumChildContainerNames to return S_OK or E_INVALIDARG, got 0x%08x\n", hr
);
391 IDxDiagContainer_Release(child
);
398 if (!*containerbufW
|| !*childbufW
)
400 skip("Unable to find a suitable container\n");
404 trace("Testing IDxDiagContainer::GetChildContainer dot parsing with container %s and child container %s.\n",
405 wine_dbgstr_w(containerbufW
), wine_dbgstr_w(childbufW
));
407 for (i
= 0; i
< sizeof(test_strings
)/sizeof(test_strings
[0]); i
++)
409 IDxDiagContainer
*child
;
410 char containerbufA
[256];
412 char dotbufferA
[255 + 255 + 3 + 1];
413 WCHAR dotbufferW
[255 + 255 + 3 + 1]; /* containerbuf + childbuf + dots + null terminator */
415 WideCharToMultiByte(CP_ACP
, 0, containerbufW
, -1, containerbufA
, sizeof(containerbufA
), NULL
, NULL
);
416 WideCharToMultiByte(CP_ACP
, 0, childbufW
, -1, childbufA
, sizeof(childbufA
), NULL
, NULL
);
417 sprintf(dotbufferA
, test_strings
[i
].format
, containerbufA
, childbufA
);
418 MultiByteToWideChar(CP_ACP
, 0, dotbufferA
, -1, dotbufferW
, sizeof(dotbufferW
)/sizeof(WCHAR
));
420 trace("Trying container name %s\n", wine_dbgstr_w(dotbufferW
));
421 hr
= IDxDiagContainer_GetChildContainer(pddc
, dotbufferW
, &child
);
422 ok(hr
== test_strings
[i
].expect
,
423 "Expected IDxDiagContainer::GetChildContainer to return 0x%08x for %s, got 0x%08x\n",
424 test_strings
[i
].expect
, wine_dbgstr_w(dotbufferW
), hr
);
426 IDxDiagContainer_Release(child
);
430 IDxDiagContainer_Release(pddc
);
431 IDxDiagProvider_Release(pddp
);
434 static void test_EnumPropNames(void)
437 WCHAR container
[256], property
[256];
438 IDxDiagContainer
*child
= NULL
;
439 DWORD count
, index
, propcount
;
440 static const WCHAR testW
[] = {'t','e','s','t',0};
442 if (!create_root_IDxDiagContainer())
444 skip("Unable to create the root IDxDiagContainer\n");
448 /* Find a container with a non-zero number of properties. */
449 hr
= IDxDiagContainer_GetNumberOfChildContainers(pddc
, &count
);
450 ok(hr
== S_OK
, "Expected IDxDiagContainer::GetNumberOfChildContainers to return S_OK, got 0x%08x\n", hr
);
453 skip("IDxDiagContainer::GetNumberOfChildContainers failed\n");
457 for (index
= 0; index
< count
; index
++)
459 hr
= IDxDiagContainer_EnumChildContainerNames(pddc
, index
, container
, sizeof(container
)/sizeof(WCHAR
));
460 ok(hr
== S_OK
, "Expected IDxDiagContainer_EnumChildContainerNames to return S_OK, got 0x%08x\n", hr
);
463 skip("IDxDiagContainer::EnumChildContainerNames failed\n");
467 hr
= IDxDiagContainer_GetChildContainer(pddc
, container
, &child
);
468 ok(hr
== S_OK
, "Expected IDxDiagContainer::GetChildContainer to return S_OK, got 0x%08x\n", hr
);
472 hr
= IDxDiagContainer_GetNumberOfProps(child
, &propcount
);
473 ok(hr
== S_OK
, "Expected IDxDiagContainer::GetNumberOfProps to return S_OK, got 0x%08x\n", hr
);
477 IDxDiagContainer_Release(child
);
487 skip("Unable to find a container with non-zero property count\n");
491 hr
= IDxDiagContainer_EnumPropNames(child
, ~0, NULL
, 0);
492 ok(hr
== E_INVALIDARG
, "Expected IDxDiagContainer::EnumPropNames to return E_INVALIDARG, got 0x%08x\n", hr
);
494 memcpy(property
, testW
, sizeof(testW
));
495 hr
= IDxDiagContainer_EnumPropNames(child
, ~0, property
, 0);
496 ok(hr
== E_INVALIDARG
, "Expected IDxDiagContainer::EnumPropNames to return E_INVALIDARG, got 0x%08x\n", hr
);
497 ok(!memcmp(property
, testW
, sizeof(testW
)),
498 "Expected the property buffer to be unchanged, got %s\n", wine_dbgstr_w(property
));
500 memcpy(property
, testW
, sizeof(testW
));
501 hr
= IDxDiagContainer_EnumPropNames(child
, ~0, property
, sizeof(property
)/sizeof(WCHAR
));
502 ok(hr
== E_INVALIDARG
, "Expected IDxDiagContainer::EnumPropNames to return E_INVALIDARG, got 0x%08x\n", hr
);
503 ok(!memcmp(property
, testW
, sizeof(testW
)),
504 "Expected the property buffer to be unchanged, got %s\n", wine_dbgstr_w(property
));
506 trace("Starting property enumeration of the %s container:\n", wine_dbgstr_w(container
));
508 /* We should be able to enumerate as many properties as the value that
509 * IDxDiagContainer::GetNumberOfProps returns. */
510 for (index
= 0; index
<= propcount
; index
++)
512 /* A buffer size of 1 is unlikely to be valid, as only a null terminator
513 * could be stored, and it is unlikely that a property name could be empty. */
514 DWORD buffersize
= 1;
516 memcpy(property
, testW
, sizeof(testW
));
517 hr
= IDxDiagContainer_EnumPropNames(child
, index
, property
, buffersize
);
518 if (hr
== E_INVALIDARG
)
520 /* We should get here when index is one more than the maximum index value. */
521 ok(propcount
== index
,
522 "Expected IDxDiagContainer::EnumPropNames to return E_INVALIDARG "
523 "on the last index %d, got 0x%08x\n", index
, hr
);
524 ok(!memcmp(property
, testW
, sizeof(testW
)),
525 "Expected the property buffer to be unchanged, got %s\n", wine_dbgstr_w(property
));
528 else if (hr
== DXDIAG_E_INSUFFICIENT_BUFFER
)
532 ok(property
[0] == '\0',
533 "Expected the property buffer string to be empty, got %s\n", wine_dbgstr_w(property
));
534 hr
= IDxDiagContainer_EnumPropNames(child
, index
, temp
, sizeof(temp
)/sizeof(WCHAR
));
536 "Expected IDxDiagContainer::EnumPropNames to return S_OK, got 0x%08x\n", hr
);
538 /* Show that the DirectX SDK's stipulation that the buffer be at
539 * least 256 characters long is a mere suggestion, and smaller sizes
540 * can be acceptable also. IDxDiagContainer::EnumPropNames doesn't
541 * provide a way of getting the exact size required, so the buffersize
542 * value will be iterated to at most 256 characters. */
543 for (buffersize
= 2; buffersize
<= 256; buffersize
++)
545 memcpy(property
, testW
, sizeof(testW
));
546 hr
= IDxDiagContainer_EnumPropNames(child
, index
, property
, buffersize
);
547 if (hr
!= DXDIAG_E_INSUFFICIENT_BUFFER
)
550 ok(!memcmp(temp
, property
, sizeof(WCHAR
)*(buffersize
- 1)),
551 "Expected truncated property name string, got %s\n", wine_dbgstr_w(property
));
555 "Expected IDxDiagContainer::EnumPropNames to return S_OK, "
556 "got hr = 0x%08x, buffersize = %d\n", hr
, buffersize
);
558 trace("child[%d] = %s, length = %d\n", index
, wine_dbgstr_w(property
), buffersize
);
562 ok(0, "IDxDiagContainer::EnumPropNames unexpectedly returned 0x%08x\n", hr
);
567 IDxDiagContainer_Release(child
);
570 IDxDiagContainer_Release(pddc
);
571 IDxDiagProvider_Release(pddp
);
574 static void test_GetProp(void)
577 WCHAR container
[256], property
[256];
578 IDxDiagContainer
*child
= NULL
;
582 SAFEARRAYBOUND bound
;
584 static const WCHAR emptyW
[] = {0};
585 static const WCHAR testW
[] = {'t','e','s','t',0};
587 if (!create_root_IDxDiagContainer())
589 skip("Unable to create the root IDxDiagContainer\n");
593 /* Find a container with a property. */
594 hr
= IDxDiagContainer_GetNumberOfChildContainers(pddc
, &count
);
595 ok(hr
== S_OK
, "Expected IDxDiagContainer::GetNumberOfChildContainers to return S_OK, got 0x%08x\n", hr
);
598 skip("IDxDiagContainer::GetNumberOfChildContainers failed\n");
602 for (index
= 0; index
< count
; index
++)
604 hr
= IDxDiagContainer_EnumChildContainerNames(pddc
, index
, container
, sizeof(container
)/sizeof(WCHAR
));
605 ok(hr
== S_OK
, "Expected IDxDiagContainer_EnumChildContainerNames to return S_OK, got 0x%08x\n", hr
);
608 skip("IDxDiagContainer::EnumChildContainerNames failed\n");
612 hr
= IDxDiagContainer_GetChildContainer(pddc
, container
, &child
);
613 ok(hr
== S_OK
, "Expected IDxDiagContainer::GetChildContainer to return S_OK, got 0x%08x\n", hr
);
617 hr
= IDxDiagContainer_EnumPropNames(child
, 0, property
, sizeof(property
)/sizeof(WCHAR
));
618 ok(hr
== S_OK
|| hr
== E_INVALIDARG
,
619 "Expected IDxDiagContainer::EnumPropNames to return S_OK or E_INVALIDARG, got 0x%08x\n", hr
);
625 IDxDiagContainer_Release(child
);
633 skip("Unable to find a suitable container\n");
637 hr
= IDxDiagContainer_GetProp(child
, NULL
, NULL
);
638 ok(hr
== E_INVALIDARG
, "Expected IDxDiagContainer::GetProp to return E_INVALIDARG, got 0x%08x\n", hr
);
641 hr
= IDxDiagContainer_GetProp(child
, NULL
, &var
);
642 ok(hr
== E_INVALIDARG
, "Expected IDxDiagContainer::GetProp to return E_INVALIDARG, got 0x%08x\n", hr
);
643 ok(V_VT(&var
) == 0xdead, "Expected the variant to be untouched, got %u\n", V_VT(&var
));
645 hr
= IDxDiagContainer_GetProp(child
, emptyW
, NULL
);
646 ok(hr
== E_INVALIDARG
, "Expected IDxDiagContainer::GetProp to return E_INVALIDARG, got 0x%08x\n", hr
);
649 hr
= IDxDiagContainer_GetProp(child
, emptyW
, &var
);
650 ok(hr
== E_INVALIDARG
, "Expected IDxDiagContainer::GetProp to return E_INVALIDARG, got 0x%08x\n", hr
);
651 ok(V_VT(&var
) == 0xdead, "Expected the variant to be untouched, got %u\n", V_VT(&var
));
653 hr
= IDxDiagContainer_GetProp(child
, testW
, NULL
);
654 ok(hr
== E_INVALIDARG
, "Expected IDxDiagContainer::GetProp to return E_INVALIDARG, got 0x%08x\n", hr
);
657 hr
= IDxDiagContainer_GetProp(child
, testW
, &var
);
658 ok(hr
== E_INVALIDARG
, "Expected IDxDiagContainer::GetProp to return E_INVALIDARG, got 0x%08x\n", hr
);
659 ok(V_VT(&var
) == 0xdead, "Expected the variant to be untouched, got %u\n", V_VT(&var
));
662 hr
= IDxDiagContainer_GetProp(child
, property
, &var
);
663 ok(hr
== S_OK
, "Expected IDxDiagContainer::GetProp to return S_OK, got 0x%08x\n", hr
);
664 ok(V_VT(&var
) != VT_EMPTY
, "Expected the variant to be modified, got %d\n", V_VT(&var
));
666 /* Since the documentation for IDxDiagContainer::GetProp claims that the
667 * function reports return values from VariantCopy, try to exercise failure
668 * paths in handling the destination variant. */
670 /* Try an invalid variant type. */
672 hr
= IDxDiagContainer_GetProp(child
, property
, &var
);
673 ok(hr
== S_OK
, "Expected IDxDiagContainer::GetProp to return S_OK, got 0x%08x\n", hr
);
674 ok(V_VT(&var
) != 0xdead, "Expected the variant to be modified, got %d\n", V_VT(&var
));
676 /* Try passing a variant with a locked SAFEARRAY. */
679 sa
= SafeArrayCreate(VT_UI1
, 1, &bound
);
680 ok(sa
!= NULL
, "Expected SafeArrayCreate to return a valid pointer\n");
682 V_VT(&var
) = (VT_ARRAY
| VT_UI1
);
685 hr
= SafeArrayLock(sa
);
686 ok(hr
== S_OK
, "Expected SafeArrayLock to return S_OK, got 0x%08x\n", hr
);
688 hr
= IDxDiagContainer_GetProp(child
, property
, &var
);
689 ok(hr
== S_OK
, "Expected IDxDiagContainer::GetProp to return S_OK, got 0x%08x\n", hr
);
690 ok(V_VT(&var
) != (VT_ARRAY
| VT_UI1
), "Expected the variant to be modified\n");
692 hr
= SafeArrayUnlock(sa
);
693 ok(hr
== S_OK
, "Expected SafeArrayUnlock to return S_OK, got 0x%08x\n", hr
);
694 hr
= SafeArrayDestroy(sa
);
695 ok(hr
== S_OK
, "Expected SafeArrayDestroy to return S_OK, got 0x%08x\n", hr
);
697 /* Determine whether GetProp calls VariantClear on the passed variant. */
698 V_VT(&var
) = VT_UNKNOWN
;
699 V_UNKNOWN(&var
) = (IUnknown
*)child
;
700 IDxDiagContainer_AddRef(child
);
702 hr
= IDxDiagContainer_GetProp(child
, property
, &var
);
703 ok(hr
== S_OK
, "Expected IDxDiagContainer::GetProp to return S_OK, got 0x%08x\n", hr
);
704 ok(V_VT(&var
) != VT_UNKNOWN
, "Expected the variant to be modified\n");
706 IDxDiagContainer_AddRef(child
);
707 ref
= IDxDiagContainer_Release(child
);
708 ok(ref
== 2, "Expected reference count to be 2, got %u\n", ref
);
709 IDxDiagContainer_Release(child
);
711 IDxDiagContainer_Release(child
);
713 IDxDiagContainer_Release(pddc
);
714 IDxDiagProvider_Release(pddp
);
717 static void test_root_children(void)
719 static const WCHAR DxDiag_DirectSound
[] = {'D','x','D','i','a','g','_','D','i','r','e','c','t','S','o','u','n','d',0};
720 static const WCHAR DxDiag_DirectMusic
[] = {'D','x','D','i','a','g','_','D','i','r','e','c','t','M','u','s','i','c',0};
721 static const WCHAR DxDiag_DirectInput
[] = {'D','x','D','i','a','g','_','D','i','r','e','c','t','I','n','p','u','t',0};
722 static const WCHAR DxDiag_DirectPlay
[] = {'D','x','D','i','a','g','_','D','i','r','e','c','t','P','l','a','y',0};
723 static const WCHAR DxDiag_SystemDevices
[] = {'D','x','D','i','a','g','_','S','y','s','t','e','m','D','e','v','i','c','e','s',0};
724 static const WCHAR DxDiag_DirectXFiles
[] = {'D','x','D','i','a','g','_','D','i','r','e','c','t','X','F','i','l','e','s',0};
725 static const WCHAR DxDiag_DirectShowFilters
[] = {'D','x','D','i','a','g','_','D','i','r','e','c','t','S','h','o','w','F','i','l','t','e','r','s',0};
726 static const WCHAR DxDiag_LogicalDisks
[] = {'D','x','D','i','a','g','_','L','o','g','i','c','a','l','D','i','s','k','s',0};
731 static const WCHAR
*root_children
[] = {
732 DxDiag_SystemInfo
, DxDiag_DisplayDevices
, DxDiag_DirectSound
,
733 DxDiag_DirectMusic
, DxDiag_DirectInput
, DxDiag_DirectPlay
,
734 DxDiag_SystemDevices
, DxDiag_DirectXFiles
, DxDiag_DirectShowFilters
,
738 if (!create_root_IDxDiagContainer())
740 skip("Unable to create the root IDxDiagContainer\n");
744 /* Verify the identity and ordering of the root container's children. */
745 hr
= IDxDiagContainer_GetNumberOfChildContainers(pddc
, &count
);
746 ok(hr
== S_OK
, "Expected IDxDiagContainer::GetNumberOfChildContainers to return S_OK, got 0x%08x\n", hr
);
749 skip("IDxDiagContainer::GetNumberOfChildContainers failed\n");
753 ok(count
== sizeof(root_children
)/sizeof(root_children
[0]),
754 "Got unexpected count %u for the number of child containers\n", count
);
756 if (count
!= sizeof(root_children
)/sizeof(root_children
[0]))
758 skip("Received unexpected number of child containers\n");
762 for (index
= 0; index
<= count
; index
++)
764 WCHAR container
[256];
766 hr
= IDxDiagContainer_EnumChildContainerNames(pddc
, index
, container
, sizeof(container
)/sizeof(WCHAR
));
767 if (hr
== E_INVALIDARG
)
770 "Expected IDxDiagContainer::EnumChildContainerNames to return "
771 "E_INVALIDARG on the last index %u\n", count
);
776 ok(!lstrcmpW(container
, root_children
[index
]),
777 "Expected container %s for index %u, got %s\n",
778 wine_dbgstr_w(root_children
[index
]), index
, wine_dbgstr_w(container
));
782 ok(0, "IDxDiagContainer::EnumChildContainerNames unexpectedly returned 0x%08x\n", hr
);
788 IDxDiagContainer_Release(pddc
);
789 IDxDiagProvider_Release(pddp
);
792 static void test_container_properties(IDxDiagContainer
*container
, const struct property_test
*property_tests
, size_t len
)
796 /* Check that the container has no properties if there are no properties to examine. */
801 hr
= IDxDiagContainer_GetNumberOfProps(container
, &prop_count
);
802 ok(hr
== S_OK
, "Expected IDxDiagContainer::GetNumberOfProps to return S_OK, got 0x%08x\n", hr
);
804 ok(prop_count
== 0, "Expected container property count to be zero, got %u\n", prop_count
);
813 /* Examine the variant types of obtained property values. */
814 for (i
= 0; i
< len
; i
++)
816 hr
= IDxDiagContainer_GetProp(container
, property_tests
[i
].prop
, &var
);
817 ok(hr
== S_OK
, "[%d] Expected IDxDiagContainer::GetProp to return S_OK for %s, got 0x%08x\n",
818 i
, wine_dbgstr_w(property_tests
[i
].prop
), hr
);
822 ok(V_VT(&var
) == property_tests
[i
].vt
,
823 "[%d] Expected variant type %d, got %d\n", i
, property_tests
[i
].vt
, V_VT(&var
));
824 trace("%s = %s\n", wine_dbgstr_w(property_tests
[i
].prop
), debugstr_variant(&var
));
831 static void test_DxDiag_SystemInfo(void)
833 static const WCHAR dwOSMajorVersion
[] = {'d','w','O','S','M','a','j','o','r','V','e','r','s','i','o','n',0};
834 static const WCHAR dwOSMinorVersion
[] = {'d','w','O','S','M','i','n','o','r','V','e','r','s','i','o','n',0};
835 static const WCHAR dwOSBuildNumber
[] = {'d','w','O','S','B','u','i','l','d','N','u','m','b','e','r',0};
836 static const WCHAR dwOSPlatformID
[] = {'d','w','O','S','P','l','a','t','f','o','r','m','I','D',0};
837 static const WCHAR dwDirectXVersionMajor
[] = {'d','w','D','i','r','e','c','t','X','V','e','r','s','i','o','n','M','a','j','o','r',0};
838 static const WCHAR dwDirectXVersionMinor
[] = {'d','w','D','i','r','e','c','t','X','V','e','r','s','i','o','n','M','i','n','o','r',0};
839 static const WCHAR szDirectXVersionLetter
[] = {'s','z','D','i','r','e','c','t','X','V','e','r','s','i','o','n','L','e','t','t','e','r',0};
840 static const WCHAR bDebug
[] = {'b','D','e','b','u','g',0};
841 static const WCHAR bNECPC98
[] = {'b','N','E','C','P','C','9','8',0};
842 static const WCHAR ullPhysicalMemory
[] = {'u','l','l','P','h','y','s','i','c','a','l','M','e','m','o','r','y',0};
843 static const WCHAR ullUsedPageFile
[] = {'u','l','l','U','s','e','d','P','a','g','e','F','i','l','e',0};
844 static const WCHAR ullAvailPageFile
[] = {'u','l','l','A','v','a','i','l','P','a','g','e','F','i','l','e',0};
845 static const WCHAR szWindowsDir
[] = {'s','z','W','i','n','d','o','w','s','D','i','r',0};
846 static const WCHAR szCSDVersion
[] = {'s','z','C','S','D','V','e','r','s','i','o','n',0};
847 static const WCHAR szDirectXVersionEnglish
[] = {'s','z','D','i','r','e','c','t','X','V','e','r','s','i','o','n','E','n','g','l','i','s','h',0};
848 static const WCHAR szDirectXVersionLongEnglish
[] = {'s','z','D','i','r','e','c','t','X','V','e','r','s','i','o','n','L','o','n','g','E','n','g','l','i','s','h',0};
849 static const WCHAR bNetMeetingRunning
[] = {'b','N','e','t','M','e','e','t','i','n','g','R','u','n','n','i','n','g',0};
850 static const WCHAR szMachineNameLocalized
[] = {'s','z','M','a','c','h','i','n','e','N','a','m','e','L','o','c','a','l','i','z','e','d',0};
851 static const WCHAR szMachineNameEnglish
[] = {'s','z','M','a','c','h','i','n','e','N','a','m','e','E','n','g','l','i','s','h',0};
852 static const WCHAR szLanguagesLocalized
[] = {'s','z','L','a','n','g','u','a','g','e','s','L','o','c','a','l','i','z','e','d',0};
853 static const WCHAR szLanguagesEnglish
[] = {'s','z','L','a','n','g','u','a','g','e','s','E','n','g','l','i','s','h',0};
854 static const WCHAR szTimeLocalized
[] = {'s','z','T','i','m','e','L','o','c','a','l','i','z','e','d',0};
855 static const WCHAR szTimeEnglish
[] = {'s','z','T','i','m','e','E','n','g','l','i','s','h',0};
856 static const WCHAR szPhysicalMemoryEnglish
[] = {'s','z','P','h','y','s','i','c','a','l','M','e','m','o','r','y','E','n','g','l','i','s','h',0};
857 static const WCHAR szPageFileLocalized
[] = {'s','z','P','a','g','e','F','i','l','e','L','o','c','a','l','i','z','e','d',0};
858 static const WCHAR szPageFileEnglish
[] = {'s','z','P','a','g','e','F','i','l','e','E','n','g','l','i','s','h',0};
859 static const WCHAR szOSLocalized
[] = {'s','z','O','S','L','o','c','a','l','i','z','e','d',0};
860 static const WCHAR szOSExLocalized
[] = {'s','z','O','S','E','x','L','o','c','a','l','i','z','e','d',0};
861 static const WCHAR szOSExLongLocalized
[] = {'s','z','O','S','E','x','L','o','n','g','L','o','c','a','l','i','z','e','d',0};
862 static const WCHAR szOSEnglish
[] = {'s','z','O','S','E','n','g','l','i','s','h',0};
863 static const WCHAR szOSExEnglish
[] = {'s','z','O','S','E','x','E','n','g','l','i','s','h',0};
864 static const WCHAR szOSExLongEnglish
[] = {'s','z','O','S','E','x','L','o','n','g','E','n','g','l','i','s','h',0};
865 static const WCHAR szProcessorEnglish
[] = {'s','z','P','r','o','c','e','s','s','o','r','E','n','g','l','i','s','h',0};
867 static const struct property_test property_tests
[] =
869 {dwOSMajorVersion
, VT_UI4
},
870 {dwOSMinorVersion
, VT_UI4
},
871 {dwOSBuildNumber
, VT_UI4
},
872 {dwOSPlatformID
, VT_UI4
},
873 {dwDirectXVersionMajor
, VT_UI4
},
874 {dwDirectXVersionMinor
, VT_UI4
},
875 {szDirectXVersionLetter
, VT_BSTR
},
878 {ullPhysicalMemory
, VT_BSTR
},
879 {ullUsedPageFile
, VT_BSTR
},
880 {ullAvailPageFile
, VT_BSTR
},
881 {szWindowsDir
, VT_BSTR
},
882 {szCSDVersion
, VT_BSTR
},
883 {szDirectXVersionEnglish
, VT_BSTR
},
884 {szDirectXVersionLongEnglish
, VT_BSTR
},
885 {bNetMeetingRunning
, VT_BOOL
},
886 {szMachineNameLocalized
, VT_BSTR
},
887 {szMachineNameEnglish
, VT_BSTR
},
888 {szLanguagesLocalized
, VT_BSTR
},
889 {szLanguagesEnglish
, VT_BSTR
},
890 {szTimeLocalized
, VT_BSTR
},
891 {szTimeEnglish
, VT_BSTR
},
892 {szPhysicalMemoryEnglish
, VT_BSTR
},
893 {szPageFileLocalized
, VT_BSTR
},
894 {szPageFileEnglish
, VT_BSTR
},
895 {szOSLocalized
, VT_BSTR
},
896 {szOSExLocalized
, VT_BSTR
},
897 {szOSExLongLocalized
, VT_BSTR
},
898 {szOSEnglish
, VT_BSTR
},
899 {szOSExEnglish
, VT_BSTR
},
900 {szOSExLongEnglish
, VT_BSTR
},
901 {szProcessorEnglish
, VT_BSTR
},
904 IDxDiagContainer
*container
, *container2
;
905 static const WCHAR empty
[] = {0};
908 if (!create_root_IDxDiagContainer())
910 skip("Unable to create the root IDxDiagContainer\n");
914 hr
= IDxDiagContainer_GetChildContainer(pddc
, empty
, &container2
);
915 ok(hr
== E_INVALIDARG
, "Expected IDxDiagContainer::GetChildContainer to return E_INVALIDARG, got 0x%08x\n", hr
);
917 hr
= IDxDiagContainer_GetChildContainer(pddc
, DxDiag_SystemInfo
, &container
);
918 ok(hr
== S_OK
, "Expected IDxDiagContainer::GetChildContainer to return S_OK, got 0x%08x\n", hr
);
922 trace("Testing container DxDiag_SystemInfo\n");
923 test_container_properties(container
, property_tests
, sizeof(property_tests
)/sizeof(property_tests
[0]));
926 hr
= IDxDiagContainer_GetChildContainer(container
, empty
, &container2
);
927 ok(hr
== S_OK
, "Expected IDxDiagContainer::GetChildContainer to return S_OK, got 0x%08x\n", hr
);
928 ok(container2
!= NULL
, "Expected container2 != NULL\n");
929 ok(container2
!= container
, "Expected container != container2\n");
930 if (hr
== S_OK
) IDxDiagContainer_Release(container2
);
932 IDxDiagContainer_Release(container
);
935 IDxDiagContainer_Release(pddc
);
936 IDxDiagProvider_Release(pddp
);
939 static void test_DxDiag_DisplayDevices(void)
941 static const WCHAR szDescription
[] = {'s','z','D','e','s','c','r','i','p','t','i','o','n',0};
942 static const WCHAR szDeviceName
[] = {'s','z','D','e','v','i','c','e','N','a','m','e',0};
943 static const WCHAR szKeyDeviceID
[] = {'s','z','K','e','y','D','e','v','i','c','e','I','D',0};
944 static const WCHAR szKeyDeviceKey
[] = {'s','z','K','e','y','D','e','v','i','c','e','K','e','y',0};
945 static const WCHAR szVendorId
[] = {'s','z','V','e','n','d','o','r','I','d',0};
946 static const WCHAR szDeviceId
[] = {'s','z','D','e','v','i','c','e','I','d',0};
947 static const WCHAR szDeviceIdentifier
[] = {'s','z','D','e','v','i','c','e','I','d','e','n','t','i','f','i','e','r',0};
948 static const WCHAR dwWidth
[] = {'d','w','W','i','d','t','h',0};
949 static const WCHAR dwHeight
[] = {'d','w','H','e','i','g','h','t',0};
950 static const WCHAR dwBpp
[] = {'d','w','B','p','p',0};
951 static const WCHAR szDisplayMemoryLocalized
[] = {'s','z','D','i','s','p','l','a','y','M','e','m','o','r','y','L','o','c','a','l','i','z','e','d',0};
952 static const WCHAR szDisplayMemoryEnglish
[] = {'s','z','D','i','s','p','l','a','y','M','e','m','o','r','y','E','n','g','l','i','s','h',0};
953 static const WCHAR szDriverName
[] = {'s','z','D','r','i','v','e','r','N','a','m','e',0};
954 static const WCHAR szDriverVersion
[] = {'s','z','D','r','i','v','e','r','V','e','r','s','i','o','n',0};
955 static const WCHAR szSubSysId
[] = {'s','z','S','u','b','S','y','s','I','d',0};
956 static const WCHAR szRevisionId
[] = {'s','z','R','e','v','i','s','i','o','n','I','d',0};
957 static const WCHAR dwRefreshRate
[] = {'d','w','R','e','f','r','e','s','h','R','a','t','e',0};
958 static const WCHAR szManufacturer
[] = {'s','z','M','a','n','u','f','a','c','t','u','r','e','r',0};
959 static const WCHAR b3DAccelerationExists
[] = {'b','3','D','A','c','c','e','l','e','r','a','t','i','o','n','E','x','i','s','t','s',0};
960 static const WCHAR b3DAccelerationEnabled
[] = {'b','3','D','A','c','c','e','l','e','r','a','t','i','o','n','E','n','a','b','l','e','d',0};
961 static const WCHAR bDDAccelerationEnabled
[] = {'b','D','D','A','c','c','e','l','e','r','a','t','i','o','n','E','n','a','b','l','e','d',0};
962 static const WCHAR iAdapter
[] = {'i','A','d','a','p','t','e','r',0};
964 static const struct property_test property_tests
[] =
966 {szDescription
, VT_BSTR
},
967 {szDeviceName
, VT_BSTR
},
968 {szKeyDeviceID
, VT_BSTR
},
969 {szKeyDeviceKey
, VT_BSTR
},
970 {szVendorId
, VT_BSTR
},
971 {szDeviceId
, VT_BSTR
},
972 {szDeviceIdentifier
, VT_BSTR
},
976 {szDisplayMemoryLocalized
, VT_BSTR
},
977 {szDisplayMemoryEnglish
, VT_BSTR
},
978 {szDriverName
, VT_BSTR
},
979 {szDriverVersion
, VT_BSTR
},
980 {szSubSysId
, VT_BSTR
},
981 {szRevisionId
, VT_BSTR
},
982 {dwRefreshRate
, VT_UI4
},
983 {szManufacturer
, VT_BSTR
},
984 {b3DAccelerationExists
, VT_BOOL
},
985 {b3DAccelerationEnabled
, VT_BOOL
},
986 {bDDAccelerationEnabled
, VT_BOOL
},
990 IDxDiagContainer
*display_cont
= NULL
;
994 if (!create_root_IDxDiagContainer())
996 skip("Unable to create the root IDxDiagContainer\n");
1000 hr
= IDxDiagContainer_GetChildContainer(pddc
, DxDiag_DisplayDevices
, &display_cont
);
1001 ok(hr
== S_OK
, "Expected IDxDiagContainer::GetChildContainer to return S_OK, got 0x%08x\n", hr
);
1006 hr
= IDxDiagContainer_GetNumberOfProps(display_cont
, &count
);
1007 ok(hr
== S_OK
, "Expected IDxDiagContainer::GetNumberOfProps to return S_OK, got 0x%08x\n", hr
);
1009 ok(count
== 0, "Expected count to be 0, got %u\n", count
);
1011 hr
= IDxDiagContainer_GetNumberOfChildContainers(display_cont
, &count
);
1012 ok(hr
== S_OK
, "Expected IDxDiagContainer::GetNumberOfChildContainers to return S_OK, got 0x%08x\n", hr
);
1017 for (i
= 0; i
< count
; i
++)
1019 WCHAR child_container
[256];
1020 IDxDiagContainer
*child
;
1022 hr
= IDxDiagContainer_EnumChildContainerNames(display_cont
, i
, child_container
, sizeof(child_container
)/sizeof(WCHAR
));
1023 ok(hr
== S_OK
, "Expected IDxDiagContainer::EnumChildContainerNames to return S_OK, got 0x%08x\n", hr
);
1025 hr
= IDxDiagContainer_GetChildContainer(display_cont
, child_container
, &child
);
1026 ok(hr
== S_OK
, "Expected IDxDiagContainer::GetChildContainer to return S_OK, got 0x%08x\n", hr
);
1030 trace("Testing container %s\n", wine_dbgstr_w(child_container
));
1031 test_container_properties(child
, property_tests
, sizeof(property_tests
)/sizeof(property_tests
[0]));
1033 IDxDiagContainer_Release(child
);
1037 if (display_cont
) IDxDiagContainer_Release(display_cont
);
1038 IDxDiagContainer_Release(pddc
);
1039 IDxDiagProvider_Release(pddp
);
1042 static void test_DxDiag_SoundDevices(void)
1044 static const WCHAR szDescription
[] = {'s','z','D','e','s','c','r','i','p','t','i','o','n',0};
1045 static const WCHAR szGuidDeviceID
[] = {'s','z','G','u','i','d','D','e','v','i','c','e','I','D',0};
1046 static const WCHAR szDriverPath
[] = {'s','z','D','r','i','v','e','r','P','a','t','h',0};
1047 static const WCHAR szDriverName
[] = {'s','z','D','r','i','v','e','r','N','a','m','e',0};
1048 static const WCHAR empty
[] = {0};
1050 static const struct property_test property_tests
[] =
1052 {szDescription
, VT_BSTR
},
1053 {szGuidDeviceID
, VT_BSTR
},
1054 {szDriverName
, VT_BSTR
},
1055 {szDriverPath
, VT_BSTR
},
1058 IDxDiagContainer
*sound_cont
= NULL
;
1062 if (!create_root_IDxDiagContainer())
1064 skip("Unable to create the root IDxDiagContainer\n");
1068 hr
= IDxDiagContainer_GetChildContainer(pddc
, DxDiag_SoundDevices
, &sound_cont
);
1069 ok(hr
== S_OK
, "Expected IDxDiagContainer::GetChildContainer to return S_OK, got 0x%08x\n", hr
);
1074 hr
= IDxDiagContainer_GetNumberOfProps(sound_cont
, &count
);
1075 ok(hr
== S_OK
, "Expected IDxDiagContainer::GetNumberOfProps to return S_OK, got 0x%08x\n", hr
);
1077 ok(count
== 0, "Expected count to be 0, got %u\n", count
);
1079 hr
= IDxDiagContainer_GetNumberOfChildContainers(sound_cont
, &count
);
1080 ok(hr
== S_OK
, "Expected IDxDiagContainer::GetNumberOfChildContainers to return S_OK, got 0x%08x\n", hr
);
1085 for (i
= 0; i
< count
; i
++)
1087 WCHAR child_container
[256];
1088 IDxDiagContainer
*child
, *child2
;
1090 hr
= IDxDiagContainer_EnumChildContainerNames(sound_cont
, i
, child_container
, sizeof(child_container
)/sizeof(WCHAR
));
1091 ok(hr
== S_OK
, "Expected IDxDiagContainer::EnumChildContainerNames to return S_OK, got 0x%08x\n", hr
);
1093 hr
= IDxDiagContainer_GetChildContainer(sound_cont
, child_container
, &child
);
1094 ok(hr
== S_OK
, "Expected IDxDiagContainer::GetChildContainer to return S_OK, got 0x%08x\n", hr
);
1098 trace("Testing container %s\n", wine_dbgstr_w(child_container
));
1099 test_container_properties(child
, property_tests
, sizeof(property_tests
)/sizeof(property_tests
[0]));
1103 hr
= IDxDiagContainer_GetChildContainer(child
, empty
, &child2
);
1104 ok(hr
== S_OK
, "Expected IDxDiagContainer::GetChildContainer to return S_OK, got 0x%08x\n", hr
);
1105 ok(child2
!= NULL
, "Expected child2 != NULL\n");
1106 ok(child2
!= child
, "Expected child != child2\n");
1107 if (hr
== S_OK
) IDxDiagContainer_Release(child2
);
1109 IDxDiagContainer_Release(child
);
1113 if (sound_cont
) IDxDiagContainer_Release(sound_cont
);
1114 IDxDiagContainer_Release(pddc
);
1115 IDxDiagProvider_Release(pddp
);
1118 static void test_DxDiag_SoundCaptureDevices(void)
1120 static const WCHAR szDescription
[] = {'s','z','D','e','s','c','r','i','p','t','i','o','n',0};
1121 static const WCHAR szGuidDeviceID
[] = {'s','z','G','u','i','d','D','e','v','i','c','e','I','D',0};
1122 static const WCHAR szDriverPath
[] = {'s','z','D','r','i','v','e','r','P','a','t','h',0};
1123 static const WCHAR szDriverName
[] = {'s','z','D','r','i','v','e','r','N','a','m','e',0};
1125 static const struct property_test property_tests
[] =
1127 {szDescription
, VT_BSTR
},
1128 {szGuidDeviceID
, VT_BSTR
},
1129 {szDriverName
, VT_BSTR
},
1130 {szDriverPath
, VT_BSTR
},
1133 IDxDiagContainer
*sound_cont
= NULL
;
1137 if (!create_root_IDxDiagContainer())
1139 skip("Unable to create the root IDxDiagContainer\n");
1143 hr
= IDxDiagContainer_GetChildContainer(pddc
, DxDiag_SoundCaptureDevices
, &sound_cont
);
1144 ok(hr
== S_OK
, "Expected IDxDiagContainer::GetChildContainer to return S_OK, got 0x%08x\n", hr
);
1149 hr
= IDxDiagContainer_GetNumberOfProps(sound_cont
, &count
);
1150 ok(hr
== S_OK
, "Expected IDxDiagContainer::GetNumberOfProps to return S_OK, got 0x%08x\n", hr
);
1152 ok(count
== 0, "Expected count to be 0, got %u\n", count
);
1154 hr
= IDxDiagContainer_GetNumberOfChildContainers(sound_cont
, &count
);
1155 ok(hr
== S_OK
, "Expected IDxDiagContainer::GetNumberOfChildContainers to return S_OK, got 0x%08x\n", hr
);
1160 for (i
= 0; i
< count
; i
++)
1162 WCHAR child_container
[256];
1163 IDxDiagContainer
*child
;
1165 hr
= IDxDiagContainer_EnumChildContainerNames(sound_cont
, i
, child_container
, sizeof(child_container
)/sizeof(WCHAR
));
1166 ok(hr
== S_OK
, "Expected IDxDiagContainer::EnumChildContainerNames to return S_OK, got 0x%08x\n", hr
);
1168 hr
= IDxDiagContainer_GetChildContainer(sound_cont
, child_container
, &child
);
1169 ok(hr
== S_OK
, "Expected IDxDiagContainer::GetChildContainer to return S_OK, got 0x%08x\n", hr
);
1173 trace("Testing container %s\n", wine_dbgstr_w(child_container
));
1174 test_container_properties(child
, property_tests
, sizeof(property_tests
)/sizeof(property_tests
[0]));
1176 IDxDiagContainer_Release(child
);
1180 if (sound_cont
) IDxDiagContainer_Release(sound_cont
);
1181 IDxDiagContainer_Release(pddc
);
1182 IDxDiagProvider_Release(pddp
);
1185 START_TEST(container
)
1188 test_GetNumberOfChildContainers();
1189 test_GetNumberOfProps();
1190 test_EnumChildContainerNames();
1191 test_GetChildContainer();
1193 test_EnumPropNames();
1196 test_root_children();
1197 test_DxDiag_SystemInfo();
1198 test_DxDiag_DisplayDevices();
1199 test_DxDiag_SoundDevices();
1200 test_DxDiag_SoundCaptureDevices();