ReactOS 0.4.16-dev-311-g9382aa2
devenum.c File Reference
#include <stdio.h>
#include "wine/test.h"
#include "initguid.h"
#include "ole2.h"
#include "strmif.h"
#include "uuids.h"
#include "vfwmsgs.h"
#include "mmsystem.h"
#include "dsound.h"
#include "mmddk.h"
#include "vfw.h"
#include "dmoreg.h"
#include "setupapi.h"
Include dependency graph for devenum.c:

Go to the source code of this file.

Macros

#define COBJMACROS
 
#define check_display_name(parser, buffer)   check_display_name_(__LINE__, parser, buffer)
 

Functions

 DEFINE_GUID (GUID_NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
 
static WCHARstrchrW (const WCHAR *str, WCHAR ch)
 
static int strncmpW (const WCHAR *str1, const WCHAR *str2, int n)
 
static void test_devenum (IBindCtx *bind_ctx)
 
static void test_moniker_isequal (void)
 
static BOOL find_moniker (const GUID *class, IMoniker *needle)
 
 DEFINE_GUID (CLSID_TestFilter, 0xdeadbeef, 0xcf51, 0x43e6, 0xb6, 0xc5, 0x29, 0x9e, 0xa8, 0xb6, 0xb5, 0x91)
 
static void test_register_filter (void)
 
static IMonikercheck_display_name_ (int line, IParseDisplayName *parser, WCHAR *buffer)
 
static void test_directshow_filter (void)
 
static void test_codec (void)
 
static void test_dmo (void)
 
static void test_legacy_filter (void)
 
static BOOL CALLBACK test_dsound (GUID *guid, const WCHAR *desc, const WCHAR *module, void *context)
 
static void test_waveout (void)
 
static void test_wavein (void)
 
static void test_midiout (void)
 
static void test_vfw (void)
 
 START_TEST (devenum)
 

Variables

static const WCHAR friendly_name [] = {'F','r','i','e','n','d','l','y','N','a','m','e',0}
 
static const WCHAR deviceW [] = {'@','d','e','v','i','c','e',':',0}
 
static const WCHAR clsidW [] = {'C','L','S','I','D',0}
 
static const WCHAR waveW [] = {'w','a','v','e',':',0}
 
static const WCHAR dmoW [] = {'d','m','o',':',0}
 
static const WCHAR swW [] = {'s','w',':',0}
 
static const WCHAR cmW [] = {'c','m',':',0}
 
static const WCHAR backslashW [] = {'\\',0}
 

Macro Definition Documentation

◆ check_display_name

#define check_display_name (   parser,
  buffer 
)    check_display_name_(__LINE__, parser, buffer)

Definition at line 332 of file devenum.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 21 of file devenum.c.

Function Documentation

◆ check_display_name_()

static IMoniker * check_display_name_ ( int  line,
IParseDisplayName parser,
WCHAR buffer 
)
static

Definition at line 314 of file devenum.c.

315{
316 IMoniker *mon;
317 ULONG eaten;
318 HRESULT hr;
319 WCHAR *str;
320
321 hr = IParseDisplayName_ParseDisplayName(parser, NULL, buffer, &eaten, &mon);
322 ok_(__FILE__, line)(hr == S_OK, "ParseDisplayName failed: %#x\n", hr);
323
324 hr = IMoniker_GetDisplayName(mon, NULL, NULL, &str);
325 ok_(__FILE__, line)(hr == S_OK, "GetDisplayName failed: %#x\n", hr);
326 ok_(__FILE__, line)(!lstrcmpW(str, buffer), "got %s\n", wine_dbgstr_w(str));
327
329
330 return mon;
331}
#define ok_(x1, x2)
Definition: atltest.h:61
#define NULL
Definition: types.h:112
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4243
GLuint buffer
Definition: glext.h:5915
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
#define S_OK
Definition: intsafe.h:52
#define wine_dbgstr_w
Definition: kernel32.h:34
const WCHAR * str
HRESULT hr
Definition: shlfolder.c:183
Definition: parser.c:49
Definition: import.c:81
uint32_t ULONG
Definition: typedefs.h:59
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ DEFINE_GUID() [1/2]

DEFINE_GUID ( CLSID_TestFilter  ,
0xdeadbeef  ,
0xcf51  ,
0x43e6  ,
0xb6  ,
0xc5  ,
0x29  ,
0x9e  ,
0xa8  ,
0xb6  ,
0xb5  ,
0x91   
)

◆ DEFINE_GUID() [2/2]

DEFINE_GUID ( GUID_NULL  ,
,
,
,
,
,
,
,
,
,
,
 
)

◆ find_moniker()

static BOOL find_moniker ( const GUID class,
IMoniker needle 
)
static

Definition at line 243 of file devenum.c.

244{
245 ICreateDevEnum *devenum;
246 IEnumMoniker *enum_mon;
247 IMoniker *mon;
248 BOOL found = FALSE;
249
250 CoCreateInstance(&CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC, &IID_ICreateDevEnum, (void **)&devenum);
251 ICreateDevEnum_CreateClassEnumerator(devenum, class, &enum_mon, 0);
252 while (!found && IEnumMoniker_Next(enum_mon, 1, &mon, NULL) == S_OK)
253 {
254 if (IMoniker_IsEqual(mon, needle) == S_OK)
255 found = TRUE;
256
257 IMoniker_Release(mon);
258 }
259
260 IEnumMoniker_Release(enum_mon);
261 ICreateDevEnum_Release(devenum);
262 return found;
263}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
unsigned int BOOL
Definition: ntddk_ex.h:94

Referenced by test_codec(), test_directshow_filter(), test_dmo(), test_legacy_filter(), and test_register_filter().

◆ START_TEST()

START_TEST ( devenum  )

Definition at line 1024 of file devenum.c.

1025{
1026 IBindCtx *bind_ctx = NULL;
1027 HRESULT hr;
1028
1030
1032
1033 /* IBindCtx is allowed in IMoniker_BindToStorage (IMediaCatMoniker_BindToStorage) */
1034 hr = CreateBindCtx(0, &bind_ctx);
1035 ok(hr == S_OK, "Cannot create BindCtx: (res = 0x%x)\n", hr);
1036 if (bind_ctx) {
1037 test_devenum(bind_ctx);
1038 IBindCtx_Release(bind_ctx);
1039 }
1040
1044 test_codec();
1045 test_dmo();
1046
1049 ok(hr == S_OK, "got %#x\n", hr);
1050 test_waveout();
1051 test_wavein();
1052 test_midiout();
1053 test_vfw();
1054
1056}
#define ok(value,...)
Definition: atltest.h:57
HRESULT WINAPI DirectSoundEnumerateW(LPDSENUMCALLBACKW lpDSEnumCallback, LPVOID lpContext)
Definition: enum.c:210
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
static void test_midiout(void)
Definition: devenum.c:886
static void test_legacy_filter(void)
Definition: devenum.c:553
static void test_dmo(void)
Definition: devenum.c:490
static void test_devenum(IBindCtx *bind_ctx)
Definition: devenum.c:62
static void test_register_filter(void)
Definition: devenum.c:267
static void test_moniker_isequal(void)
Definition: devenum.c:154
static void test_wavein(void)
Definition: devenum.c:800
static void test_codec(void)
Definition: devenum.c:436
static void test_directshow_filter(void)
Definition: devenum.c:334
static void test_vfw(void)
Definition: devenum.c:953
static void test_waveout(void)
Definition: devenum.c:707
static BOOL CALLBACK test_dsound(GUID *guid, const WCHAR *desc, const WCHAR *module, void *context)
Definition: devenum.c:618
HRESULT WINAPI CreateBindCtx(DWORD reserved, LPBC *ppbc)
Definition: bindctx.c:556

◆ strchrW()

static WCHAR * strchrW ( const WCHAR str,
WCHAR  ch 
)
inlinestatic

Definition at line 49 of file devenum.c.

50{
51 do { if (*str == ch) return (WCHAR *)str; } while (*str++);
52 return NULL;
53}

◆ strncmpW()

static int strncmpW ( const WCHAR str1,
const WCHAR str2,
int  n 
)
inlinestatic

Definition at line 55 of file devenum.c.

56{
57 if (n <= 0) return 0;
58 while ((--n > 0) && *str1 && (*str1 == *str2)) { str1++; str2++; }
59 return *str1 - *str2;
60}
GLdouble n
Definition: glext.h:7729

◆ test_codec()

static void test_codec ( void  )
static

Definition at line 436 of file devenum.c.

437{
438 static WCHAR testW[] = {'\\','t','e','s','t',0};
440 IPropertyBag *prop_bag;
441 IMoniker *mon;
442 WCHAR buffer[200];
443 VARIANT var;
444 HRESULT hr;
445
446 /* Test ParseDisplayName and GetDisplayName */
447 hr = CoCreateInstance(&CLSID_CDeviceMoniker, NULL, CLSCTX_INPROC, &IID_IParseDisplayName, (void **)&parser);
448 ok(hr == S_OK, "Failed to create ParseDisplayName: %#x\n", hr);
449
452 StringFromGUID2(&CLSID_AudioRendererCategory, buffer + lstrlenW(buffer), CHARS_IN_GUID);
455
456 /* Test writing and reading from the property bag */
457 ok(!find_moniker(&CLSID_AudioRendererCategory, mon), "codec should not be registered\n");
458
459 hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&prop_bag);
460 ok(hr == S_OK, "BindToStorage failed: %#x\n", hr);
461
463 hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
465
466 V_VT(&var) = VT_BSTR;
468 hr = IPropertyBag_Write(prop_bag, friendly_name, &var);
469 ok(hr == S_OK, "Write failed: %#x\n", hr);
470
472 hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
473 ok(hr == S_OK, "Read failed: %#x\n", hr);
474 ok(!lstrcmpW(V_BSTR(&var), testW), "got %s\n", wine_dbgstr_w(V_BSTR(&var)));
475
476 /* unlike DirectShow filters, these are automatically generated, so
477 * enumerating them will destroy the key */
478 ok(!find_moniker(&CLSID_AudioRendererCategory, mon), "codec should not be registered\n");
479
481 hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
483
484 IPropertyBag_Release(prop_bag);
485 IMoniker_Release(mon);
486
487 IParseDisplayName_Release(parser);
488}
#define CHARS_IN_GUID
#define lstrcpyW
Definition: compat.h:749
@ VT_BSTR
Definition: compat.h:2303
#define lstrlenW
Definition: compat.h:750
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2434
static const WCHAR testW[]
Definition: jsregexp.c:44
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
const char * var
Definition: shader.c:5666
static const WCHAR cmW[]
Definition: devenum.c:46
#define check_display_name(parser, buffer)
Definition: devenum.c:332
static const WCHAR deviceW[]
Definition: devenum.c:41
static BOOL find_moniker(const GUID *class, IMoniker *needle)
Definition: devenum.c:243
static const WCHAR friendly_name[]
Definition: devenum.c:40
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
#define V_VT(A)
Definition: oleauto.h:211
#define V_BSTR(A)
Definition: oleauto.h:226
const GUID IID_IParseDisplayName
const GUID IID_IPropertyBag
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:648
void WINAPI VariantInit(VARIANTARG *pVarg)
Definition: variant.c:568
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92

Referenced by START_TEST().

◆ test_devenum()

static void test_devenum ( IBindCtx bind_ctx)
static

Definition at line 62 of file devenum.c.

63{
64 IEnumMoniker *enum_cat, *enum_moniker;
65 ICreateDevEnum* create_devenum;
66 IPropertyBag *prop_bag;
68 GUID cat_guid, clsid;
69 WCHAR *displayname;
71 HRESULT hr;
72 int count;
73
74 hr = CoCreateInstance(&CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC,
75 &IID_ICreateDevEnum, (LPVOID*)&create_devenum);
76 ok(hr == S_OK, "Failed to create devenum: %#x\n", hr);
77
78 hr = ICreateDevEnum_CreateClassEnumerator(create_devenum, &CLSID_ActiveMovieCategories, &enum_cat, 0);
79 ok(hr == S_OK, "Failed to enum categories: %#x\n", hr);
80
81 while (IEnumMoniker_Next(enum_cat, 1, &moniker, NULL) == S_OK)
82 {
83 hr = IMoniker_BindToStorage(moniker, bind_ctx, NULL, &IID_IPropertyBag, (void **)&prop_bag);
84 ok(hr == S_OK, "IMoniker_BindToStorage failed: %#x\n", hr);
85
87 hr = IPropertyBag_Read(prop_bag, clsidW, &var, NULL);
88 ok(hr == S_OK, "Failed to read CLSID: %#x\n", hr);
89
90 hr = CLSIDFromString(V_BSTR(&var), &cat_guid);
91 ok(hr == S_OK, "got %#x\n", hr);
92
94 hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
95 ok(hr == S_OK, "Failed to read FriendlyName: %#x\n", hr);
96
97 if (winetest_debug > 1)
98 trace("%s %s:\n", wine_dbgstr_guid(&cat_guid), wine_dbgstr_w(V_BSTR(&var)));
99
101 IPropertyBag_Release(prop_bag);
102 IMoniker_Release(moniker);
103
104 hr = ICreateDevEnum_CreateClassEnumerator(create_devenum, &cat_guid, &enum_moniker, 0);
105 ok(SUCCEEDED(hr), "Failed to enum devices: %#x\n", hr);
106
107 if (hr == S_OK)
108 {
109 count = 0;
110
111 while (IEnumMoniker_Next(enum_moniker, 1, &moniker, NULL) == S_OK)
112 {
113 hr = IMoniker_GetDisplayName(moniker, NULL, NULL, &displayname);
114 ok(hr == S_OK, "got %#x\n", hr);
115
116 hr = IMoniker_GetClassID(moniker, NULL);
117 ok(hr == E_INVALIDARG, "IMoniker_GetClassID should failed %x\n", hr);
118
119 hr = IMoniker_GetClassID(moniker, &clsid);
120 ok(hr == S_OK, "IMoniker_GetClassID failed with error %x\n", hr);
121 ok(IsEqualGUID(&clsid, &CLSID_CDeviceMoniker),
122 "Expected CLSID_CDeviceMoniker got %s\n", wine_dbgstr_guid(&clsid));
123
125 hr = IMoniker_BindToStorage(moniker, bind_ctx, NULL, &IID_IPropertyBag, (LPVOID*)&prop_bag);
126 ok(hr == S_OK, "IMoniker_BindToStorage failed with error %x\n", hr);
127
128 hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
130 "IPropertyBag_Read failed: %#x\n", hr);
131
132 if (winetest_debug > 1)
133 trace(" %s %s\n", wine_dbgstr_w(displayname), wine_dbgstr_w(V_BSTR(&var)));
134
135 hr = IMoniker_BindToObject(moniker, bind_ctx, NULL, &IID_IUnknown, NULL);
136 ok(hr == E_POINTER, "got %#x\n", hr);
137
139 CoTaskMemFree(displayname);
140 IPropertyBag_Release(prop_bag);
141 IMoniker_Release(moniker);
142 count++;
143 }
144 IEnumMoniker_Release(enum_moniker);
145
146 ok(count > 0, "CreateClassEnumerator() returned S_OK but no devices were enumerated.\n");
147 }
148 }
149
150 IEnumMoniker_Release(enum_cat);
151 ICreateDevEnum_Release(create_devenum);
152}
#define trace
Definition: atltest.h:70
const GUID IID_IUnknown
#define E_INVALIDARG
Definition: ddrawi.h:101
HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id)
Definition: compobj.c:2338
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define SUCCEEDED(hr)
Definition: intsafe.h:50
static const WCHAR clsidW[]
Definition: devenum.c:42
REFCLSID clsid
Definition: msctf.c:82
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:197
int winetest_debug
#define ERROR_KEY_DOES_NOT_EXIST
Definition: setupapi.h:300
Definition: main.c:40
#define E_POINTER
Definition: winerror.h:2365

Referenced by START_TEST().

◆ test_directshow_filter()

static void test_directshow_filter ( void  )
static

Definition at line 334 of file devenum.c.

335{
336 static const WCHAR instanceW[] = {'\\','I','n','s','t','a','n','c','e',0};
337 static const WCHAR clsidW[] = {'C','L','S','I','D','\\',0};
338 static WCHAR testW[] = {'\\','t','e','s','t',0};
340 IPropertyBag *prop_bag;
341 IMoniker *mon;
342 WCHAR buffer[200];
343 LRESULT res;
344 VARIANT var;
345 HRESULT hr;
346
347 /* Test ParseDisplayName and GetDisplayName */
348 hr = CoCreateInstance(&CLSID_CDeviceMoniker, NULL, CLSCTX_INPROC, &IID_IParseDisplayName, (void **)&parser);
349 ok(hr == S_OK, "Failed to create ParseDisplayName: %#x\n", hr);
350
353 StringFromGUID2(&CLSID_AudioRendererCategory, buffer + lstrlenW(buffer), CHARS_IN_GUID);
356
357 /* Test writing and reading from the property bag */
358 ok(!find_moniker(&CLSID_AudioRendererCategory, mon), "filter should not be registered\n");
359
360 hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&prop_bag);
361 ok(hr == S_OK, "BindToStorage failed: %#x\n", hr);
362
364 hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
366
367 /* writing causes the key to be created */
368 V_VT(&var) = VT_BSTR;
370 hr = IPropertyBag_Write(prop_bag, friendly_name, &var);
371 if (hr != E_ACCESSDENIED)
372 {
373 ok(hr == S_OK, "Write failed: %#x\n", hr);
374
375 ok(find_moniker(&CLSID_AudioRendererCategory, mon), "filter should be registered\n");
376
378 hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
379 ok(hr == S_OK, "Read failed: %#x\n", hr);
380 ok(!lstrcmpW(V_BSTR(&var), testW), "got %s\n", wine_dbgstr_w(V_BSTR(&var)));
381
382 IMoniker_Release(mon);
383
384 /* devenum doesn't give us a way to unregister—we have to do that manually */
386 StringFromGUID2(&CLSID_AudioRendererCategory, buffer + lstrlenW(buffer), CHARS_IN_GUID);
390 ok(!res, "RegDeleteKey failed: %lu\n", res);
391 }
392
394 IPropertyBag_Release(prop_bag);
395
396 /* name can be anything */
397
402
403 hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&prop_bag);
404 ok(hr == S_OK, "BindToStorage failed: %#x\n", hr);
405
407 hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
409
410 V_VT(&var) = VT_BSTR;
412 hr = IPropertyBag_Write(prop_bag, friendly_name, &var);
413 if (hr != E_ACCESSDENIED)
414 {
415 ok(hr == S_OK, "Write failed: %#x\n", hr);
416
418 hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
419 ok(hr == S_OK, "Read failed: %#x\n", hr);
420 ok(!lstrcmpW(V_BSTR(&var), testW), "got %s\n", wine_dbgstr_w(V_BSTR(&var)));
421
422 IMoniker_Release(mon);
423
424 /* vista+ stores it inside the Instance key */
425 RegDeleteKeyA(HKEY_CLASSES_ROOT, "CLSID\\test\\Instance");
426
427 res = RegDeleteKeyA(HKEY_CLASSES_ROOT, "CLSID\\test");
428 ok(!res, "RegDeleteKey failed: %lu\n", res);
429 }
430
432 IPropertyBag_Release(prop_bag);
433 IParseDisplayName_Release(parser);
434}
static const WCHAR instanceW[]
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1239
LONG WINAPI RegDeleteKeyA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey)
Definition: reg.c:1224
GLuint res
Definition: glext.h:9613
static const WCHAR swW[]
Definition: devenum.c:45
LONG_PTR LRESULT
Definition: windef.h:209
#define E_ACCESSDENIED
Definition: winerror.h:2849
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10

Referenced by START_TEST().

◆ test_dmo()

static void test_dmo ( void  )
static

Definition at line 490 of file devenum.c.

491{
492 static const WCHAR name[] = {'d','e','v','e','n','u','m',' ','t','e','s','t',0};
494 IPropertyBag *prop_bag;
495 WCHAR buffer[200];
496 IMoniker *mon;
497 VARIANT var;
498 HRESULT hr;
499
500 hr = CoCreateInstance(&CLSID_CDeviceMoniker, NULL, CLSCTX_INPROC, &IID_IParseDisplayName, (void **)&parser);
501 ok(hr == S_OK, "Failed to create ParseDisplayName: %#x\n", hr);
502
505 StringFromGUID2(&CLSID_TestFilter, buffer + lstrlenW(buffer), CHARS_IN_GUID);
506 StringFromGUID2(&CLSID_AudioRendererCategory, buffer + lstrlenW(buffer), CHARS_IN_GUID);
508
509 ok(!find_moniker(&CLSID_AudioRendererCategory, mon), "DMO should not be registered\n");
510
511 hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&prop_bag);
512 ok(hr == S_OK, "got %#x\n", hr);
513
515 hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
516 ok(hr == E_FAIL, "got %#x\n", hr);
517
518 V_VT(&var) = VT_BSTR;
520 hr = IPropertyBag_Write(prop_bag, friendly_name, &var);
521 ok(hr == E_ACCESSDENIED, "Write failed: %#x\n", hr);
522
523 hr = DMORegister(name, &CLSID_TestFilter, &CLSID_AudioRendererCategory, 0, 0, NULL, 0, NULL);
524 if (hr != E_FAIL)
525 {
526 ok(hr == S_OK, "got %#x\n", hr);
527
528 ok(find_moniker(&CLSID_AudioRendererCategory, mon), "DMO should be registered\n");
529
531 hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
532 ok(hr == S_OK, "got %#x\n", hr);
533 ok(!lstrcmpW(V_BSTR(&var), name), "got %s\n", wine_dbgstr_w(V_BSTR(&var)));
534
536 V_VT(&var) = VT_BSTR;
538 hr = IPropertyBag_Write(prop_bag, friendly_name, &var);
539 ok(hr == E_ACCESSDENIED, "Write failed: %#x\n", hr);
540
542 hr = IPropertyBag_Read(prop_bag, clsidW, &var, NULL);
543 ok(hr == HRESULT_FROM_WIN32(ERROR_NOT_FOUND), "got %#x\n", hr);
544
545 hr = DMOUnregister(&CLSID_TestFilter, &CLSID_AudioRendererCategory);
546 ok(hr == S_OK, "got %#x\n", hr);
547 }
548 IPropertyBag_Release(prop_bag);
549 IMoniker_Release(mon);
550 IParseDisplayName_Release(parser);
551}
#define E_FAIL
Definition: ddrawi.h:102
HRESULT WINAPI DMORegister(LPCWSTR szName, REFCLSID clsidDMO, REFGUID guidCategory, DWORD dwFlags, DWORD cInTypes, const DMO_PARTIAL_MEDIATYPE *pInTypes, DWORD cOutTypes, const DMO_PARTIAL_MEDIATYPE *pOutTypes)
Definition: dmoreg.c:183
HRESULT WINAPI DMOUnregister(REFCLSID dmo, REFGUID category)
Definition: dmoreg.c:290
static const WCHAR dmoW[]
Definition: devenum.c:44
Definition: name.c:39
#define ERROR_NOT_FOUND
Definition: winerror.h:690

Referenced by START_TEST().

◆ test_dsound()

static BOOL CALLBACK test_dsound ( GUID guid,
const WCHAR desc,
const WCHAR module,
void context 
)
static

Definition at line 618 of file devenum.c.

619{
620 static const WCHAR defaultW[] = {'D','e','f','a','u','l','t',' ','D','i','r','e','c','t','S','o','u','n','d',' ','D','e','v','i','c','e',0};
621 static const WCHAR directsoundW[] = {'D','i','r','e','c','t','S','o','u','n','d',':',' ',0};
622 static const WCHAR dsguidW[] = {'D','S','G','u','i','d',0};
624 IPropertyBag *prop_bag;
625 IMoniker *mon;
626 WCHAR buffer[200];
627 WCHAR name[200];
628 VARIANT var;
629 HRESULT hr;
630
631 if (guid)
632 {
633 lstrcpyW(name, directsoundW);
635 }
636 else
637 {
639 guid = (GUID *)&GUID_NULL;
640 }
641
642 hr = CoCreateInstance(&CLSID_CDeviceMoniker, NULL, CLSCTX_INPROC, &IID_IParseDisplayName, (void **)&parser);
643 ok(hr == S_OK, "Failed to create ParseDisplayName: %#x\n", hr);
644
647 StringFromGUID2(&CLSID_AudioRendererCategory, buffer + lstrlenW(buffer), CHARS_IN_GUID);
650
652
653 hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&prop_bag);
654 ok(hr == S_OK, "BindToStorage failed: %#x\n", hr);
655
657 hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
659 {
660 /* Win8+ uses the GUID instead of the device name */
661 IPropertyBag_Release(prop_bag);
662 IMoniker_Release(mon);
663
666 StringFromGUID2(&CLSID_AudioRendererCategory, buffer + lstrlenW(buffer), CHARS_IN_GUID);
668 lstrcatW(buffer, directsoundW);
670
672
673 hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&prop_bag);
674 ok(hr == S_OK, "BindToStorage failed: %#x\n", hr);
675
677 hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
678 }
679 ok(hr == S_OK, "Read failed: %#x\n", hr);
680
681 ok(!lstrcmpW(name, V_BSTR(&var)), "expected %s, got %s\n",
683
685 hr = IPropertyBag_Read(prop_bag, clsidW, &var, NULL);
686 ok(hr == S_OK, "Read failed: %#x\n", hr);
687
688 StringFromGUID2(&CLSID_DSoundRender, buffer, CHARS_IN_GUID);
689 ok(!lstrcmpW(buffer, V_BSTR(&var)), "expected %s, got %s\n",
691
693 hr = IPropertyBag_Read(prop_bag, dsguidW, &var, NULL);
694 ok(hr == S_OK, "Read failed: %#x\n", hr);
695
697 ok(!lstrcmpW(buffer, V_BSTR(&var)), "expected %s, got %s\n",
699
701 IPropertyBag_Release(prop_bag);
702 IMoniker_Release(mon);
703 IParseDisplayName_Release(parser);
704 return TRUE;
705}
#define GUID_NULL
Definition: ks.h:106
const GUID * guid
static const WCHAR desc[]
Definition: protectdata.c:36
static const WCHAR backslashW[]
Definition: devenum.c:47
static const WCHAR defaultW[]
Definition: lex.c:42

Referenced by START_TEST().

◆ test_legacy_filter()

static void test_legacy_filter ( void  )
static

Definition at line 553 of file devenum.c.

554{
555 static const WCHAR nameW[] = {'t','e','s','t',0};
557 IPropertyBag *prop_bag;
558 IFilterMapper *mapper;
559 IMoniker *mon;
560 WCHAR buffer[200];
561 VARIANT var;
562 HRESULT hr;
563
564 hr = CoCreateInstance(&CLSID_CDeviceMoniker, NULL, CLSCTX_INPROC, &IID_IParseDisplayName, (void **)&parser);
565 ok(hr == S_OK, "Failed to create ParseDisplayName: %#x\n", hr);
566
567 hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC, &IID_IFilterMapper, (void **)&mapper);
568 ok(hr == S_OK, "Failed to create FilterMapper: %#x\n", hr);
569
570 hr = IFilterMapper_RegisterFilter(mapper, CLSID_TestFilter, nameW, 0xdeadbeef);
571 if (hr == VFW_E_BAD_KEY)
572 {
573 win_skip("not enough permissions to register filters\n");
574 goto end;
575 }
576 ok(hr == S_OK, "RegisterFilter failed: %#x\n", hr);
577
580 StringFromGUID2(&CLSID_LegacyAmFilterCategory, buffer + lstrlenW(buffer), CHARS_IN_GUID);
582 StringFromGUID2(&CLSID_TestFilter, buffer + lstrlenW(buffer), CHARS_IN_GUID);
583
585 ok(find_moniker(&CLSID_LegacyAmFilterCategory, mon), "filter should be registered\n");
586
587 hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&prop_bag);
588 ok(hr == S_OK, "BindToStorage failed: %#x\n", hr);
589
591 hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
592 ok(hr == S_OK, "Read failed: %#x\n", hr);
593
594 StringFromGUID2(&CLSID_TestFilter, buffer, CHARS_IN_GUID);
595 ok(!lstrcmpW(buffer, V_BSTR(&var)), "expected %s, got %s\n",
597
599 hr = IPropertyBag_Read(prop_bag, clsidW, &var, NULL);
600 ok(hr == S_OK, "Read failed: %#x\n", hr);
601 ok(!lstrcmpW(buffer, V_BSTR(&var)), "expected %s, got %s\n",
603
605 IPropertyBag_Release(prop_bag);
606
607 hr = IFilterMapper_UnregisterFilter(mapper, CLSID_TestFilter);
608 ok(hr == S_OK, "UnregisterFilter failed: %#x\n", hr);
609
610 ok(!find_moniker(&CLSID_LegacyAmFilterCategory, mon), "filter should not be registered\n");
611 IMoniker_Release(mon);
612
613end:
614 IFilterMapper_Release(mapper);
615 IParseDisplayName_Release(parser);
616}
static const WCHAR nameW[]
Definition: main.c:49
GLuint GLuint end
Definition: gl.h:1545
#define win_skip
Definition: test.h:163
#define VFW_E_BAD_KEY
Definition: vfwmsgs.h:170

Referenced by START_TEST().

◆ test_midiout()

static void test_midiout ( void  )
static

Definition at line 886 of file devenum.c.

887{
888 static const WCHAR defaultW[] = {'D','e','f','a','u','l','t',' ','M','i','d','i','O','u','t',' ','D','e','v','i','c','e',0};
889 static const WCHAR midioutidW[] = {'M','i','d','i','O','u','t','I','d',0};
891 IPropertyBag *prop_bag;
892 IMoniker *mon;
893 MIDIOUTCAPSW caps;
894 WCHAR buffer[200];
895 const WCHAR *name;
896 int count, i;
897 VARIANT var;
898 HRESULT hr;
899
900 hr = CoCreateInstance(&CLSID_CDeviceMoniker, NULL, CLSCTX_INPROC, &IID_IParseDisplayName, (void **)&parser);
901 ok(hr == S_OK, "Failed to create ParseDisplayName: %#x\n", hr);
902
904
905 for (i = -1; i < count; i++)
906 {
907 midiOutGetDevCapsW(i, &caps, sizeof(caps));
908
909 if (i == -1) /* MIDI_MAPPER */
910 name = defaultW;
911 else
912 name = caps.szPname;
913
916 StringFromGUID2(&CLSID_MidiRendererCategory, buffer + lstrlenW(buffer), CHARS_IN_GUID);
919
921
922 hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&prop_bag);
923 ok(hr == S_OK, "BindToStorage failed: %#x\n", hr);
924
926 hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
927 ok(hr == S_OK, "Read failed: %#x\n", hr);
928
929 ok(!lstrcmpW(name, V_BSTR(&var)), "expected %s, got %s\n",
931
933 hr = IPropertyBag_Read(prop_bag, clsidW, &var, NULL);
934 ok(hr == S_OK, "Read failed: %#x\n", hr);
935
936 StringFromGUID2(&CLSID_AVIMIDIRender, buffer, CHARS_IN_GUID);
937 ok(!lstrcmpW(buffer, V_BSTR(&var)), "expected %s, got %s\n",
939
941 hr = IPropertyBag_Read(prop_bag, midioutidW, &var, NULL);
942 ok(hr == S_OK, "Read failed: %#x\n", hr);
943
944 ok(V_I4(&var) == i, "expected %d, got %d\n", i, V_I4(&var));
945
946 IPropertyBag_Release(prop_bag);
947 IMoniker_Release(mon);
948 }
949
950 IParseDisplayName_Release(parser);
951}
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
#define V_I4(A)
Definition: oleauto.h:247
WCHAR szPname[MAXPNAMELEN]
Definition: mmsystem.h:1126
UINT WINAPI midiOutGetNumDevs(void)
Definition: winmm.c:806
UINT WINAPI midiOutGetDevCapsW(UINT_PTR uDeviceID, LPMIDIOUTCAPSW lpCaps, UINT uSize)
Definition: winmm.c:814

Referenced by START_TEST().

◆ test_moniker_isequal()

static void test_moniker_isequal ( void  )
static

Definition at line 154 of file devenum.c.

155{
156 HRESULT res;
157 ICreateDevEnum *create_devenum = NULL;
158 IEnumMoniker *enum_moniker0 = NULL, *enum_moniker1 = NULL;
159 IMoniker *moniker0 = NULL, *moniker1 = NULL;
160
161 res = CoCreateInstance(&CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC,
162 &IID_ICreateDevEnum, (LPVOID*)&create_devenum);
163 if (FAILED(res))
164 {
165 skip("Cannot create SystemDeviceEnum object (%x)\n", res);
166 return;
167 }
168
169 res = ICreateDevEnum_CreateClassEnumerator(create_devenum, &CLSID_LegacyAmFilterCategory, &enum_moniker0, 0);
170 ok(SUCCEEDED(res), "Cannot create enum moniker (res = %x)\n", res);
171 if (SUCCEEDED(res))
172 {
173 if (IEnumMoniker_Next(enum_moniker0, 1, &moniker0, NULL) == S_OK &&
174 IEnumMoniker_Next(enum_moniker0, 1, &moniker1, NULL) == S_OK)
175 {
176 res = IMoniker_IsEqual(moniker0, moniker1);
177 ok(res == S_FALSE, "IMoniker_IsEqual should fail (res = %x)\n", res);
178
179 res = IMoniker_IsEqual(moniker1, moniker0);
180 ok(res == S_FALSE, "IMoniker_IsEqual should fail (res = %x)\n", res);
181
182 IMoniker_Release(moniker0);
183 IMoniker_Release(moniker1);
184 }
185 else
186 skip("Cannot get moniker for testing.\n");
187 }
188 IEnumMoniker_Release(enum_moniker0);
189
190 res = ICreateDevEnum_CreateClassEnumerator(create_devenum, &CLSID_LegacyAmFilterCategory, &enum_moniker0, 0);
191 ok(SUCCEEDED(res), "Cannot create enum moniker (res = %x)\n", res);
192 res = ICreateDevEnum_CreateClassEnumerator(create_devenum, &CLSID_AudioRendererCategory, &enum_moniker1, 0);
193 ok(SUCCEEDED(res), "Cannot create enum moniker (res = %x)\n", res);
194 if (SUCCEEDED(res))
195 {
196 if (IEnumMoniker_Next(enum_moniker0, 1, &moniker0, NULL) == S_OK &&
197 IEnumMoniker_Next(enum_moniker1, 1, &moniker1, NULL) == S_OK)
198 {
199 res = IMoniker_IsEqual(moniker0, moniker1);
200 ok(res == S_FALSE, "IMoniker_IsEqual should failed (res = %x)\n", res);
201
202 res = IMoniker_IsEqual(moniker1, moniker0);
203 ok(res == S_FALSE, "IMoniker_IsEqual should failed (res = %x)\n", res);
204
205 IMoniker_Release(moniker0);
206 IMoniker_Release(moniker1);
207 }
208 else
209 skip("Cannot get moniker for testing.\n");
210 }
211 IEnumMoniker_Release(enum_moniker0);
212 IEnumMoniker_Release(enum_moniker1);
213
214 res = ICreateDevEnum_CreateClassEnumerator(create_devenum, &CLSID_LegacyAmFilterCategory, &enum_moniker0, 0);
215 ok(SUCCEEDED(res), "Cannot create enum moniker (res = %x)\n", res);
216 res = ICreateDevEnum_CreateClassEnumerator(create_devenum, &CLSID_LegacyAmFilterCategory, &enum_moniker1, 0);
217 ok(SUCCEEDED(res), "Cannot create enum moniker (res = %x)\n", res);
218 if (SUCCEEDED(res))
219 {
220 if (IEnumMoniker_Next(enum_moniker0, 1, &moniker0, NULL) == S_OK &&
221 IEnumMoniker_Next(enum_moniker1, 1, &moniker1, NULL) == S_OK)
222 {
223 res = IMoniker_IsEqual(moniker0, moniker1);
224 ok(res == S_OK, "IMoniker_IsEqual failed (res = %x)\n", res);
225
226 res = IMoniker_IsEqual(moniker1, moniker0);
227 ok(res == S_OK, "IMoniker_IsEqual failed (res = %x)\n", res);
228
229 IMoniker_Release(moniker0);
230 IMoniker_Release(moniker1);
231 }
232 else
233 skip("Cannot get moniker for testing.\n");
234 }
235 IEnumMoniker_Release(enum_moniker0);
236 IEnumMoniker_Release(enum_moniker1);
237
238 ICreateDevEnum_Release(create_devenum);
239
240 return;
241}
#define skip(...)
Definition: atltest.h:64
#define FAILED(hr)
Definition: intsafe.h:51
#define S_FALSE
Definition: winerror.h:2357

Referenced by START_TEST().

◆ test_register_filter()

static void test_register_filter ( void  )
static

Definition at line 267 of file devenum.c.

268{
269 static const WCHAR name[] = {'d','e','v','e','n','u','m',' ','t','e','s','t',0};
270 IFilterMapper2 *mapper2;
271 IMoniker *mon = NULL;
272 REGFILTER2 rgf2 = {0};
273 HRESULT hr;
274
275 hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC, &IID_IFilterMapper2, (void **)&mapper2);
276 ok(hr == S_OK, "Failed to create FilterMapper2: %#x\n", hr);
277
278 rgf2.dwVersion = 2;
279 rgf2.dwMerit = MERIT_UNLIKELY;
280 S2(U(rgf2)).cPins2 = 0;
281
282 hr = IFilterMapper2_RegisterFilter(mapper2, &CLSID_TestFilter, name, &mon, NULL, NULL, &rgf2);
283 if (hr == E_ACCESSDENIED)
284 {
285 skip("Not enough permissions to register filters\n");
286 IFilterMapper2_Release(mapper2);
287 return;
288 }
289 ok(hr == S_OK, "RegisterFilter failed: %#x\n", hr);
290
291 ok(find_moniker(&CLSID_LegacyAmFilterCategory, mon), "filter should be registered\n");
292
293 hr = IFilterMapper2_UnregisterFilter(mapper2, NULL, NULL, &CLSID_TestFilter);
294 ok(hr == S_OK, "UnregisterFilter failed: %#x\n", hr);
295
296 ok(!find_moniker(&CLSID_LegacyAmFilterCategory, mon), "filter should not be registered\n");
297 IMoniker_Release(mon);
298
299 mon = NULL;
300 hr = IFilterMapper2_RegisterFilter(mapper2, &CLSID_TestFilter, name, &mon, &CLSID_AudioRendererCategory, NULL, &rgf2);
301 ok(hr == S_OK, "RegisterFilter failed: %#x\n", hr);
302
303 ok(find_moniker(&CLSID_AudioRendererCategory, mon), "filter should be registered\n");
304
305 hr = IFilterMapper2_UnregisterFilter(mapper2, &CLSID_AudioRendererCategory, NULL, &CLSID_TestFilter);
306 ok(hr == S_OK, "UnregisterFilter failed: %#x\n", hr);
307
308 ok(!find_moniker(&CLSID_AudioRendererCategory, mon), "filter should not be registered\n");
309 IMoniker_Release(mon);
310
311 IFilterMapper2_Release(mapper2);
312}
#define U(x)
Definition: wordpad.c:45
#define S2(x)
Definition: test.h:222
DWORD dwVersion
Definition: axextend.idl:236
DWORD dwMerit
Definition: axextend.idl:237

Referenced by START_TEST().

◆ test_vfw()

static void test_vfw ( void  )
static

Definition at line 953 of file devenum.c.

954{
955 static const WCHAR fcchandlerW[] = {'F','c','c','H','a','n','d','l','e','r',0};
957 IPropertyBag *prop_bag;
958 IMoniker *mon;
959 WCHAR buffer[200];
960 ICINFO info;
961 VARIANT var;
962 HRESULT hr;
963 int i = 0;
964 HIC hic;
965
966 if (broken(sizeof(void *) == 8))
967 {
968 win_skip("VFW codecs are not enumerated on 64-bit Windows\n");
969 return;
970 }
971
972 hr = CoCreateInstance(&CLSID_CDeviceMoniker, NULL, CLSCTX_INPROC, &IID_IParseDisplayName, (void **)&parser);
973 ok(hr == S_OK, "Failed to create ParseDisplayName: %#x\n", hr);
974
975 while (ICInfo(ICTYPE_VIDEO, i++, &info))
976 {
977 WCHAR name[5] = {LOBYTE(LOWORD(info.fccHandler)), HIBYTE(LOWORD(info.fccHandler)),
978 LOBYTE(HIWORD(info.fccHandler)), HIBYTE(HIWORD(info.fccHandler))};
979
980 hic = ICOpen(ICTYPE_VIDEO, info.fccHandler, ICMODE_QUERY);
981 ICGetInfo(hic, &info, sizeof(info));
982 ICClose(hic);
983
986 StringFromGUID2(&CLSID_VideoCompressorCategory, buffer + lstrlenW(buffer), CHARS_IN_GUID);
989
991
992 hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&prop_bag);
993 ok(hr == S_OK, "BindToStorage failed: %#x\n", hr);
994
996 hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
997 ok(hr == S_OK, "Read failed: %#x\n", hr);
998
999 ok(!lstrcmpW(info.szDescription, V_BSTR(&var)), "expected %s, got %s\n",
1000 wine_dbgstr_w(info.szDescription), wine_dbgstr_w(V_BSTR(&var)));
1001
1002 VariantClear(&var);
1003 hr = IPropertyBag_Read(prop_bag, clsidW, &var, NULL);
1004 ok(hr == S_OK, "Read failed: %#x\n", hr);
1005
1006 StringFromGUID2(&CLSID_AVICo, buffer, CHARS_IN_GUID);
1007 ok(!lstrcmpW(buffer, V_BSTR(&var)), "expected %s, got %s\n",
1009
1010 VariantClear(&var);
1011 hr = IPropertyBag_Read(prop_bag, fcchandlerW, &var, NULL);
1012 ok(hr == S_OK, "Read failed: %#x\n", hr);
1013 ok(!lstrcmpW(name, V_BSTR(&var)), "expected %s, got %s\n",
1015
1016 VariantClear(&var);
1017 IPropertyBag_Release(prop_bag);
1018 IMoniker_Release(mon);
1019 }
1020
1021 IParseDisplayName_Release(parser);
1022}
#define broken(x)
Definition: atltest.h:178
#define LOBYTE(W)
Definition: jmemdos.c:487
#define HIBYTE(W)
Definition: jmemdos.c:486
#define ICTYPE_VIDEO
Definition: mmreg.h:531
HIC VFWAPI ICOpen(DWORD fccType, DWORD fccHandler, UINT wMode)
Definition: msvideo_main.c:441
LRESULT VFWAPI ICGetInfo(HIC hic, ICINFO *picinfo, DWORD cb)
Definition: msvideo_main.c:594
BOOL VFWAPI ICInfo(DWORD type, DWORD handler, ICINFO *info)
Definition: msvideo_main.c:270
LRESULT WINAPI ICClose(HIC hic)
#define LOWORD(l)
Definition: pedump.c:82
Definition: vfw.h:280
#define HIWORD(l)
Definition: typedefs.h:247
#define ICMODE_QUERY
Definition: vfw.h:271

Referenced by START_TEST().

◆ test_wavein()

static void test_wavein ( void  )
static

Definition at line 800 of file devenum.c.

801{
802 static const WCHAR waveinidW[] = {'W','a','v','e','I','n','I','d',0};
804 IPropertyBag *prop_bag;
805 IMoniker *mon;
806 WCHAR endpoint[200];
807 WCHAR buffer[200];
808 WAVEINCAPSW caps;
809 MMRESULT mmr;
810 int count, i;
811 VARIANT var;
812 HRESULT hr;
813
814 hr = CoCreateInstance(&CLSID_CDeviceMoniker, NULL, CLSCTX_INPROC, &IID_IParseDisplayName, (void **)&parser);
815 ok(hr == S_OK, "Failed to create ParseDisplayName: %#x\n", hr);
816
818
819 for (i = 0; i < count; i++)
820 {
821 waveInGetDevCapsW(i, &caps, sizeof(caps));
822
825 StringFromGUID2(&CLSID_AudioInputDeviceCategory, buffer + lstrlenW(buffer), CHARS_IN_GUID);
827 lstrcatW(buffer, caps.szPname);
828
830
831 hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&prop_bag);
832 ok(hr == S_OK, "BindToStorage failed: %#x\n", hr);
833
835 hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
837 {
838 IPropertyBag_Release(prop_bag);
839 IMoniker_Release(mon);
840
841 /* Win8+ uses the endpoint GUID instead of the device name */
843 (DWORD_PTR) endpoint, sizeof(endpoint));
844 ok(!mmr, "waveInMessage failed: %u\n", mmr);
845
848 StringFromGUID2(&CLSID_AudioInputDeviceCategory, buffer + lstrlenW(buffer), CHARS_IN_GUID);
851 lstrcatW(buffer, strchrW(endpoint, '}') + 2);
852
854
855 hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&prop_bag);
856 ok(hr == S_OK, "BindToStorage failed: %#x\n", hr);
857
858 hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
859 }
860 ok(hr == S_OK, "Read failed: %#x\n", hr);
861
862 ok(!strncmpW(caps.szPname, V_BSTR(&var), lstrlenW(caps.szPname)), "expected %s, got %s\n",
864
866 hr = IPropertyBag_Read(prop_bag, clsidW, &var, NULL);
867 ok(hr == S_OK, "Read failed: %#x\n", hr);
868
869 StringFromGUID2(&CLSID_AudioRecord, buffer, CHARS_IN_GUID);
870 ok(!lstrcmpW(buffer, V_BSTR(&var)), "expected %s, got %s\n",
872
874 hr = IPropertyBag_Read(prop_bag, waveinidW, &var, NULL);
875 ok(hr == S_OK, "Read failed: %#x\n", hr);
876
877 ok(V_I4(&var) == i, "expected %d, got %d\n", i, V_I4(&var));
878
879 IPropertyBag_Release(prop_bag);
880 IMoniker_Release(mon);
881 }
882
883 IParseDisplayName_Release(parser);
884}
UINT MMRESULT
Definition: mmsystem.h:962
static const WCHAR waveW[]
Definition: devenum.c:43
#define strchrW(s, c)
Definition: unicode.h:40
#define strncmpW(s1, s2, n)
Definition: unicode.h:42
#define DRV_QUERYFUNCTIONINSTANCEID
Definition: mmddk.h:98
Definition: nis.h:10
WCHAR szPname[MAXPNAMELEN]
Definition: mmsystem.h:1060
uint32_t DWORD_PTR
Definition: typedefs.h:65
UINT WINAPI waveInGetNumDevs(void)
Definition: winmm.c:2565
UINT WINAPI waveInMessage(HWAVEIN hWaveIn, UINT uMessage, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
Definition: winmm.c:2813
UINT WINAPI waveInGetDevCapsW(UINT_PTR uDeviceID, LPWAVEINCAPSW lpCaps, UINT uSize)
Definition: winmm.c:2573

Referenced by START_TEST().

◆ test_waveout()

static void test_waveout ( void  )
static

Definition at line 707 of file devenum.c.

708{
709 static const WCHAR defaultW[] = {'D','e','f','a','u','l','t',' ','W','a','v','e','O','u','t',' ','D','e','v','i','c','e',0};
710 static const WCHAR waveoutidW[] = {'W','a','v','e','O','u','t','I','d',0};
712 IPropertyBag *prop_bag;
713 IMoniker *mon;
714 WCHAR endpoint[200];
715 WAVEOUTCAPSW caps;
716 WCHAR buffer[200];
717 const WCHAR *name;
718 MMRESULT mmr;
719 int count, i;
720 VARIANT var;
721 HRESULT hr;
722
723 hr = CoCreateInstance(&CLSID_CDeviceMoniker, NULL, CLSCTX_INPROC, &IID_IParseDisplayName, (void **)&parser);
724 ok(hr == S_OK, "Failed to create ParseDisplayName: %#x\n", hr);
725
727
728 for (i = -1; i < count; i++)
729 {
730 waveOutGetDevCapsW(i, &caps, sizeof(caps));
731
732 if (i == -1) /* WAVE_MAPPER */
733 name = defaultW;
734 else
735 name = caps.szPname;
736
739 StringFromGUID2(&CLSID_AudioRendererCategory, buffer + lstrlenW(buffer), CHARS_IN_GUID);
742
744
745 hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&prop_bag);
746 ok(hr == S_OK, "BindToStorage failed: %#x\n", hr);
747
749 hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
751 {
752 IPropertyBag_Release(prop_bag);
753 IMoniker_Release(mon);
754
755 /* Win8+ uses the endpoint GUID instead of the device name */
757 (DWORD_PTR) endpoint, sizeof(endpoint));
758 ok(!mmr, "waveOutMessage failed: %u\n", mmr);
759
762 StringFromGUID2(&CLSID_AudioRendererCategory, buffer + lstrlenW(buffer), CHARS_IN_GUID);
765 lstrcatW(buffer, strchrW(endpoint, '}') + 2);
766
768
769 hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&prop_bag);
770 ok(hr == S_OK, "BindToStorage failed: %#x\n", hr);
771
772 hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
773 }
774 ok(hr == S_OK, "Read failed: %#x\n", hr);
775
776 ok(!strncmpW(name, V_BSTR(&var), lstrlenW(name)), "expected %s, got %s\n",
778
780 hr = IPropertyBag_Read(prop_bag, clsidW, &var, NULL);
781 ok(hr == S_OK, "Read failed: %#x\n", hr);
782
783 StringFromGUID2(&CLSID_AudioRender, buffer, CHARS_IN_GUID);
784 ok(!lstrcmpW(buffer, V_BSTR(&var)), "expected %s, got %s\n",
786
788 hr = IPropertyBag_Read(prop_bag, waveoutidW, &var, NULL);
789 ok(hr == S_OK, "Read failed: %#x\n", hr);
790
791 ok(V_I4(&var) == i, "expected %d, got %d\n", i, V_I4(&var));
792
793 IPropertyBag_Release(prop_bag);
794 IMoniker_Release(mon);
795 }
796
797 IParseDisplayName_Release(parser);
798}
WCHAR szPname[MAXPNAMELEN]
Definition: mmsystem.h:1039
UINT WINAPI waveOutGetNumDevs(void)
Definition: winmm.c:2137
UINT WINAPI waveOutGetDevCapsW(UINT_PTR uDeviceID, LPWAVEOUTCAPSW lpCaps, UINT uSize)
Definition: winmm.c:2173
UINT WINAPI waveOutMessage(HWAVEOUT hWaveOut, UINT uMessage, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
Definition: winmm.c:2538

Referenced by START_TEST().

Variable Documentation

◆ backslashW

const WCHAR backslashW[] = {'\\',0}
static

◆ clsidW

const WCHAR clsidW[] = {'C','L','S','I','D',0}
static

◆ cmW

const WCHAR cmW[] = {'c','m',':',0}
static

◆ deviceW

const WCHAR deviceW[] = {'@','d','e','v','i','c','e',':',0}
static

◆ dmoW

const WCHAR dmoW[] = {'d','m','o',':',0}
static

Definition at line 44 of file devenum.c.

Referenced by test_dmo().

◆ friendly_name

◆ swW

const WCHAR swW[] = {'s','w',':',0}
static

Definition at line 45 of file devenum.c.

Referenced by test_directshow_filter().

◆ waveW

const WCHAR waveW[] = {'w','a','v','e',':',0}
static

Definition at line 43 of file devenum.c.

Referenced by test_wavein(), and test_waveout().