ReactOS  0.4.13-dev-961-g238ea69
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 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_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 fcc_handlerW [] = {'F','c','c','H','a','n','d','l','e','r',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 mrleW [] = {'m','r','l','e',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 331 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 313 of file devenum.c.

314 {
315  IMoniker *mon;
316  ULONG eaten;
317  HRESULT hr;
318  WCHAR *str;
319 
320  hr = IParseDisplayName_ParseDisplayName(parser, NULL, buffer, &eaten, &mon);
321  ok_(__FILE__, line)(hr == S_OK, "ParseDisplayName failed: %#x\n", hr);
322 
323  hr = IMoniker_GetDisplayName(mon, NULL, NULL, &str);
324  ok_(__FILE__, line)(hr == S_OK, "GetDisplayName failed: %#x\n", hr);
325  ok_(__FILE__, line)(!lstrcmpW(str, buffer), "got %s\n", wine_dbgstr_w(str));
326 
328 
329  return mon;
330 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
HRESULT hr
Definition: shlfolder.c:183
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
GLuint buffer
Definition: glext.h:5915
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
Definition: parser.c:48
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
Definition: import.c:86
unsigned int ULONG
Definition: retypes.h:1
#define ok_(x1, x2)
Definition: atltest.h:61

◆ DEFINE_GUID() [1/2]

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

◆ DEFINE_GUID() [2/2]

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

◆ find_moniker()

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

Definition at line 242 of file devenum.c.

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

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

◆ START_TEST()

START_TEST ( devenum  )

Definition at line 956 of file devenum.c.

957 {
958  IBindCtx *bind_ctx = NULL;
959  HRESULT hr;
960 
962 
964 
965  /* IBindCtx is allowed in IMoniker_BindToStorage (IMediaCatMoniker_BindToStorage) */
966  hr = CreateBindCtx(0, &bind_ctx);
967  ok(hr == S_OK, "Cannot create BindCtx: (res = 0x%x)\n", hr);
968  if (bind_ctx) {
969  test_devenum(bind_ctx);
970  IBindCtx_Release(bind_ctx);
971  }
972 
976  test_codec();
977 
980  ok(hr == S_OK, "got %#x\n", hr);
981  test_waveout();
982  test_wavein();
983  test_midiout();
984  test_vfw();
985 
986  CoUninitialize();
987 }
HRESULT hr
Definition: shlfolder.c:183
static void test_midiout(void)
Definition: devenum.c:819
static BOOL CALLBACK test_dsound(GUID *guid, const WCHAR *desc, const WCHAR *module, void *context)
Definition: devenum.c:552
static void test_devenum(IBindCtx *bind_ctx)
Definition: devenum.c:61
static void test_directshow_filter(void)
Definition: devenum.c:333
smooth NULL
Definition: ftsmooth.c:416
static void test_legacy_filter(void)
Definition: devenum.c:488
HRESULT WINAPI CreateBindCtx(DWORD reserved, LPBC *ppbc)
Definition: bindctx.c:556
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI DirectSoundEnumerateW(LPDSENUMCALLBACKW lpDSEnumCallback, LPVOID lpContext)
Definition: enum.c:210
static void test_wavein(void)
Definition: devenum.c:733
static void test_vfw(void)
Definition: devenum.c:886
static void test_waveout(void)
Definition: devenum.c:640
static void test_moniker_isequal(void)
Definition: devenum.c:153
#define S_OK
Definition: intsafe.h:59
static void test_register_filter(void)
Definition: devenum.c:266
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1991
#define ok(value,...)
Definition: atltest.h:57
static void test_codec(void)
Definition: devenum.c:435
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1897

◆ strchrW()

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

Definition at line 48 of file devenum.c.

49 {
50  do { if (*str == ch) return (WCHAR *)str; } while (*str++);
51  return NULL;
52 }
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by test_wavein(), and test_waveout().

◆ strncmpW()

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

Definition at line 54 of file devenum.c.

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

Referenced by test_wavein(), and test_waveout().

◆ test_codec()

static void test_codec ( void  )
static

Definition at line 435 of file devenum.c.

436 {
437  static WCHAR testW[] = {'\\','t','e','s','t',0};
439  IPropertyBag *prop_bag;
440  IMoniker *mon;
441  WCHAR buffer[200];
442  VARIANT var;
443  HRESULT hr;
444 
445  /* Test ParseDisplayName and GetDisplayName */
446  hr = CoCreateInstance(&CLSID_CDeviceMoniker, NULL, CLSCTX_INPROC, &IID_IParseDisplayName, (void **)&parser);
447  ok(hr == S_OK, "Failed to create ParseDisplayName: %#x\n", hr);
448 
450  lstrcatW(buffer, cmW);
451  StringFromGUID2(&CLSID_AudioRendererCategory, buffer + lstrlenW(buffer), CHARS_IN_GUID);
454 
455  /* Test writing and reading from the property bag */
456  ok(!find_moniker(&CLSID_AudioRendererCategory, mon), "codec should not be registered\n");
457 
458  hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&prop_bag);
459  ok(hr == S_OK, "BindToStorage failed: %#x\n", hr);
460 
461  VariantInit(&var);
462  hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
463  ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "got %#x\n", hr);
464 
465  V_VT(&var) = VT_BSTR;
466  V_BSTR(&var) = SysAllocString(testW);
467  hr = IPropertyBag_Write(prop_bag, friendly_name, &var);
468  ok(hr == S_OK, "Write failed: %#x\n", hr);
469 
470  VariantClear(&var);
471  hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
472  ok(hr == S_OK, "Read failed: %#x\n", hr);
473  ok(!lstrcmpW(V_BSTR(&var), testW), "got %s\n", wine_dbgstr_w(V_BSTR(&var)));
474 
475  /* unlike DirectShow filters, these are automatically generated, so
476  * enumerating them will destroy the key */
477  ok(!find_moniker(&CLSID_AudioRendererCategory, mon), "codec should not be registered\n");
478 
479  hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
480  ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "got %#x\n", hr);
481 
482  IPropertyBag_Release(prop_bag);
483  IMoniker_Release(mon);
484 
485  IParseDisplayName_Release(parser);
486 }
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
HRESULT hr
Definition: shlfolder.c:183
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
#define CHARS_IN_GUID
GLuint buffer
Definition: glext.h:5915
void WINAPI VariantInit(VARIANTARG *pVarg)
Definition: variant.c:571
static const WCHAR deviceW[]
Definition: devenum.c:40
#define lstrlenW
Definition: compat.h:407
static const WCHAR cmW[]
Definition: devenum.c:45
smooth NULL
Definition: ftsmooth.c:416
const GUID IID_IPropertyBag
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:241
const GUID IID_IParseDisplayName
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define check_display_name(parser, buffer)
Definition: devenum.c:331
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2343
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:651
#define V_VT(A)
Definition: oleauto.h:211
#define V_BSTR(A)
Definition: oleauto.h:226
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3234
#define S_OK
Definition: intsafe.h:59
#define lstrcpyW
Definition: compat.h:406
static BOOL find_moniker(const GUID *class, IMoniker *needle)
Definition: devenum.c:242
static const WCHAR friendly_name[]
Definition: devenum.c:38
#define ok(value,...)
Definition: atltest.h:57
Definition: import.c:86
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
static const WCHAR testW[]
Definition: jsregexp.c:44

Referenced by START_TEST().

◆ test_devenum()

static void test_devenum ( IBindCtx bind_ctx)
static

Definition at line 61 of file devenum.c.

62 {
63  IEnumMoniker *enum_cat, *enum_moniker;
64  ICreateDevEnum* create_devenum;
65  IPropertyBag *prop_bag;
67  BOOL have_mrle = FALSE;
68  GUID cat_guid, clsid;
69  VARIANT var;
70  HRESULT hr;
71 
72  hr = CoCreateInstance(&CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC,
73  &IID_ICreateDevEnum, (LPVOID*)&create_devenum);
74  ok(hr == S_OK, "Failed to create devenum: %#x\n", hr);
75 
76  hr = ICreateDevEnum_CreateClassEnumerator(create_devenum, &CLSID_ActiveMovieCategories, &enum_cat, 0);
77  ok(hr == S_OK, "Failed to enum categories: %#x\n", hr);
78 
79  while (IEnumMoniker_Next(enum_cat, 1, &moniker, NULL) == S_OK)
80  {
81  hr = IMoniker_BindToStorage(moniker, bind_ctx, NULL, &IID_IPropertyBag, (void **)&prop_bag);
82  ok(hr == S_OK, "IMoniker_BindToStorage failed: %#x\n", hr);
83 
84  VariantInit(&var);
85  hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
86  ok(hr == S_OK, "Failed to read FriendlyName: %#x\n", hr);
87 
88  if (winetest_debug > 1)
89  trace("%s:\n", wine_dbgstr_w(V_BSTR(&var)));
90 
91  VariantClear(&var);
92  hr = IPropertyBag_Read(prop_bag, clsidW, &var, NULL);
93  ok(hr == S_OK, "Failed to read CLSID: %#x\n", hr);
94 
95  hr = CLSIDFromString(V_BSTR(&var), &cat_guid);
96  ok(hr == S_OK, "got %#x\n", hr);
97 
98  IPropertyBag_Release(prop_bag);
99  IMoniker_Release(moniker);
100 
101  hr = ICreateDevEnum_CreateClassEnumerator(create_devenum, &cat_guid, &enum_moniker, 0);
102  ok(SUCCEEDED(hr), "Failed to enum devices: %#x\n", hr);
103 
104  if (hr == S_OK)
105  {
106  while (IEnumMoniker_Next(enum_moniker, 1, &moniker, NULL) == S_OK)
107  {
108  hr = IMoniker_GetClassID(moniker, NULL);
109  ok(hr == E_INVALIDARG, "IMoniker_GetClassID should failed %x\n", hr);
110 
111  hr = IMoniker_GetClassID(moniker, &clsid);
112  ok(hr == S_OK, "IMoniker_GetClassID failed with error %x\n", hr);
113  ok(IsEqualGUID(&clsid, &CLSID_CDeviceMoniker),
114  "Expected CLSID_CDeviceMoniker got %s\n", wine_dbgstr_guid(&clsid));
115 
116  VariantInit(&var);
117  hr = IMoniker_BindToStorage(moniker, bind_ctx, NULL, &IID_IPropertyBag, (LPVOID*)&prop_bag);
118  ok(hr == S_OK, "IMoniker_BindToStorage failed with error %x\n", hr);
119 
120  hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
121  ok(hr == S_OK, "IPropertyBag_Read failed: %#x\n", hr);
122 
123  if (winetest_debug > 1)
124  trace(" %s\n", wine_dbgstr_w(V_BSTR(&var)));
125 
126  if (IsEqualGUID(&CLSID_VideoCompressorCategory, &cat_guid)) {
127  /* Test well known compressor to ensure that we really enumerate codecs */
128  hr = IPropertyBag_Read(prop_bag, fcc_handlerW, &var, NULL);
129  if (SUCCEEDED(hr)) {
130  ok(V_VT(&var) == VT_BSTR, "V_VT(var) = %d\n", V_VT(&var));
131  if(!lstrcmpW(V_BSTR(&var), mrleW))
132  have_mrle = TRUE;
133  VariantClear(&var);
134  }
135  }
136 
137  hr = IMoniker_BindToObject(moniker, bind_ctx, NULL, &IID_IUnknown, NULL);
138  ok(hr == E_POINTER, "got %#x\n", hr);
139 
140  IPropertyBag_Release(prop_bag);
141  IMoniker_Release(moniker);
142  }
143  IEnumMoniker_Release(enum_moniker);
144  }
145  }
146 
147  ICreateDevEnum_Release(create_devenum);
148 
149  /* 64-bit windows are missing mrle codec */
150  if(sizeof(void*) == 4)
151  ok(have_mrle, "mrle codec not found\n");
152 }
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
static const WCHAR clsidW[]
Definition: devenum.c:41
const char * wine_dbgstr_guid(const GUID *guid)
void WINAPI VariantInit(VARIANTARG *pVarg)
Definition: variant.c:571
int winetest_debug
unsigned int BOOL
Definition: ntddk_ex.h:94
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
const GUID IID_IPropertyBag
static const WCHAR mrleW[]
Definition: devenum.c:43
#define trace
Definition: atltest.h:70
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IUnknown
REFCLSID clsid
Definition: msctf.c:84
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:651
#define V_VT(A)
Definition: oleauto.h:211
#define V_BSTR(A)
Definition: oleauto.h:226
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3234
#define S_OK
Definition: intsafe.h:59
static const WCHAR friendly_name[]
Definition: devenum.c:38
#define ok(value,...)
Definition: atltest.h:57
static const WCHAR fcc_handlerW[]
Definition: devenum.c:39
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
Definition: main.c:41
HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id)
Definition: compobj.c:2247
#define E_POINTER
Definition: winerror.h:2365
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by START_TEST().

◆ test_directshow_filter()

static void test_directshow_filter ( void  )
static

Definition at line 333 of file devenum.c.

334 {
335  static const WCHAR instanceW[] = {'\\','I','n','s','t','a','n','c','e',0};
336  static const WCHAR clsidW[] = {'C','L','S','I','D','\\',0};
337  static WCHAR testW[] = {'\\','t','e','s','t',0};
339  IPropertyBag *prop_bag;
340  IMoniker *mon;
341  WCHAR buffer[200];
342  LRESULT res;
343  VARIANT var;
344  HRESULT hr;
345 
346  /* Test ParseDisplayName and GetDisplayName */
347  hr = CoCreateInstance(&CLSID_CDeviceMoniker, NULL, CLSCTX_INPROC, &IID_IParseDisplayName, (void **)&parser);
348  ok(hr == S_OK, "Failed to create ParseDisplayName: %#x\n", hr);
349 
351  lstrcatW(buffer, swW);
352  StringFromGUID2(&CLSID_AudioRendererCategory, buffer + lstrlenW(buffer), CHARS_IN_GUID);
355 
356  /* Test writing and reading from the property bag */
357  ok(!find_moniker(&CLSID_AudioRendererCategory, mon), "filter should not be registered\n");
358 
359  hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&prop_bag);
360  ok(hr == S_OK, "BindToStorage failed: %#x\n", hr);
361 
362  VariantInit(&var);
363  hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
364  ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "got %#x\n", hr);
365 
366  /* writing causes the key to be created */
367  V_VT(&var) = VT_BSTR;
368  V_BSTR(&var) = SysAllocString(testW);
369  hr = IPropertyBag_Write(prop_bag, friendly_name, &var);
370  if (hr != E_ACCESSDENIED)
371  {
372  ok(hr == S_OK, "Write failed: %#x\n", hr);
373 
374  ok(find_moniker(&CLSID_AudioRendererCategory, mon), "filter should be registered\n");
375 
376  VariantClear(&var);
377  hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
378  ok(hr == S_OK, "Read failed: %#x\n", hr);
379  ok(!lstrcmpW(V_BSTR(&var), testW), "got %s\n", wine_dbgstr_w(V_BSTR(&var)));
380 
381  IMoniker_Release(mon);
382 
383  /* devenum doesn't give us a way to unregisterówe have to do that manually */
385  StringFromGUID2(&CLSID_AudioRendererCategory, buffer + lstrlenW(buffer), CHARS_IN_GUID);
389  ok(!res, "RegDeleteKey failed: %lu\n", res);
390  }
391 
392  VariantClear(&var);
393  IPropertyBag_Release(prop_bag);
394 
395  /* name can be anything */
396 
398  lstrcatW(buffer, swW);
399  lstrcatW(buffer, testW+1);
401 
402  hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&prop_bag);
403  ok(hr == S_OK, "BindToStorage failed: %#x\n", hr);
404 
405  VariantClear(&var);
406  hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
407  ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "got %#x\n", hr);
408 
409  V_VT(&var) = VT_BSTR;
410  V_BSTR(&var) = SysAllocString(testW);
411  hr = IPropertyBag_Write(prop_bag, friendly_name, &var);
412  if (hr != E_ACCESSDENIED)
413  {
414  ok(hr == S_OK, "Write failed: %#x\n", hr);
415 
416  VariantClear(&var);
417  hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
418  ok(hr == S_OK, "Read failed: %#x\n", hr);
419  ok(!lstrcmpW(V_BSTR(&var), testW), "got %s\n", wine_dbgstr_w(V_BSTR(&var)));
420 
421  IMoniker_Release(mon);
422 
423  /* vista+ stores it inside the Instance key */
424  RegDeleteKeyA(HKEY_CLASSES_ROOT, "CLSID\\test\\Instance");
425 
426  res = RegDeleteKeyA(HKEY_CLASSES_ROOT, "CLSID\\test");
427  ok(!res, "RegDeleteKey failed: %lu\n", res);
428  }
429 
430  VariantClear(&var);
431  IPropertyBag_Release(prop_bag);
432  IParseDisplayName_Release(parser);
433 }
#define E_ACCESSDENIED
Definition: winerror.h:2849
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
HRESULT hr
Definition: shlfolder.c:183
static const WCHAR instanceW[]
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
static const WCHAR swW[]
Definition: devenum.c:44
static const WCHAR clsidW[]
Definition: devenum.c:41
#define CHARS_IN_GUID
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1237
GLuint buffer
Definition: glext.h:5915
void WINAPI VariantInit(VARIANTARG *pVarg)
Definition: variant.c:571
static const WCHAR deviceW[]
Definition: devenum.c:40
#define lstrlenW
Definition: compat.h:407
smooth NULL
Definition: ftsmooth.c:416
const GUID IID_IPropertyBag
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:241
const GUID IID_IParseDisplayName
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define check_display_name(parser, buffer)
Definition: devenum.c:331
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2343
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:651
#define V_VT(A)
Definition: oleauto.h:211
#define V_BSTR(A)
Definition: oleauto.h:226
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3234
LONG WINAPI RegDeleteKeyA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey)
Definition: reg.c:1222
#define S_OK
Definition: intsafe.h:59
#define lstrcpyW
Definition: compat.h:406
static BOOL find_moniker(const GUID *class, IMoniker *needle)
Definition: devenum.c:242
static const WCHAR friendly_name[]
Definition: devenum.c:38
#define ok(value,...)
Definition: atltest.h:57
Definition: import.c:86
GLuint res
Definition: glext.h:9613
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
LONG_PTR LRESULT
Definition: windef.h:209
static const WCHAR testW[]
Definition: jsregexp.c:44

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 552 of file devenum.c.

553 {
554  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};
555  static const WCHAR directsoundW[] = {'D','i','r','e','c','t','S','o','u','n','d',':',' ',0};
556  static const WCHAR dsguidW[] = {'D','S','G','u','i','d',0};
558  IPropertyBag *prop_bag;
559  IMoniker *mon;
560  WCHAR buffer[200];
561  WCHAR name[200];
562  VARIANT var;
563  HRESULT hr;
564 
565  if (guid)
566  {
567  lstrcpyW(name, directsoundW);
568  lstrcatW(name, desc);
569  }
570  else
571  {
573  guid = (GUID *)&GUID_NULL;
574  }
575 
576  hr = CoCreateInstance(&CLSID_CDeviceMoniker, NULL, CLSCTX_INPROC, &IID_IParseDisplayName, (void **)&parser);
577  ok(hr == S_OK, "Failed to create ParseDisplayName: %#x\n", hr);
578 
580  lstrcatW(buffer, cmW);
581  StringFromGUID2(&CLSID_AudioRendererCategory, buffer + lstrlenW(buffer), CHARS_IN_GUID);
583  lstrcatW(buffer, name);
584 
586 
587  hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&prop_bag);
588  ok(hr == S_OK, "BindToStorage failed: %#x\n", hr);
589 
590  VariantInit(&var);
591  hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
593  {
594  /* Win8+ uses the GUID instead of the device name */
595  IPropertyBag_Release(prop_bag);
596  IMoniker_Release(mon);
597 
599  lstrcatW(buffer, cmW);
600  StringFromGUID2(&CLSID_AudioRendererCategory, buffer + lstrlenW(buffer), CHARS_IN_GUID);
602  lstrcatW(buffer, directsoundW);
604 
606 
607  hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&prop_bag);
608  ok(hr == S_OK, "BindToStorage failed: %#x\n", hr);
609 
610  VariantInit(&var);
611  hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
612  }
613  ok(hr == S_OK, "Read failed: %#x\n", hr);
614 
615  ok(!lstrcmpW(name, V_BSTR(&var)), "expected %s, got %s\n",
617 
618  VariantClear(&var);
619  hr = IPropertyBag_Read(prop_bag, clsidW, &var, NULL);
620  ok(hr == S_OK, "Read failed: %#x\n", hr);
621 
622  StringFromGUID2(&CLSID_DSoundRender, buffer, CHARS_IN_GUID);
623  ok(!lstrcmpW(buffer, V_BSTR(&var)), "expected %s, got %s\n",
625 
626  VariantClear(&var);
627  hr = IPropertyBag_Read(prop_bag, dsguidW, &var, NULL);
628  ok(hr == S_OK, "Read failed: %#x\n", hr);
629 
631  ok(!lstrcmpW(buffer, V_BSTR(&var)), "expected %s, got %s\n",
633 
634  IPropertyBag_Release(prop_bag);
635  IMoniker_Release(mon);
636  IParseDisplayName_Release(parser);
637  return TRUE;
638 }
#define TRUE
Definition: types.h:120
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
HRESULT hr
Definition: shlfolder.c:183
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
static const WCHAR defaultW[]
Definition: lex.c:47
static const WCHAR clsidW[]
Definition: devenum.c:41
#define CHARS_IN_GUID
GLuint buffer
Definition: glext.h:5915
void WINAPI VariantInit(VARIANTARG *pVarg)
Definition: variant.c:571
static const WCHAR deviceW[]
Definition: devenum.c:40
#define lstrlenW
Definition: compat.h:407
static const WCHAR cmW[]
Definition: devenum.c:45
const GUID * guid
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
smooth NULL
Definition: ftsmooth.c:416
const GUID IID_IPropertyBag
const GUID IID_IParseDisplayName
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define check_display_name(parser, buffer)
Definition: devenum.c:331
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2343
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:651
#define GUID_NULL
Definition: ks.h:106
#define V_BSTR(A)
Definition: oleauto.h:226
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3234
static const WCHAR backslashW[]
Definition: devenum.c:46
#define S_OK
Definition: intsafe.h:59
#define lstrcpyW
Definition: compat.h:406
static const WCHAR friendly_name[]
Definition: devenum.c:38
#define ok(value,...)
Definition: atltest.h:57
Definition: import.c:86
Definition: name.c:36
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274

Referenced by START_TEST().

◆ test_legacy_filter()

static void test_legacy_filter ( void  )
static

Definition at line 488 of file devenum.c.

489 {
490  static const WCHAR nameW[] = {'t','e','s','t',0};
492  IPropertyBag *prop_bag;
493  IFilterMapper *mapper;
494  IMoniker *mon;
495  WCHAR buffer[200];
496  VARIANT var;
497  HRESULT hr;
498 
499  hr = CoCreateInstance(&CLSID_CDeviceMoniker, NULL, CLSCTX_INPROC, &IID_IParseDisplayName, (void **)&parser);
500  ok(hr == S_OK, "Failed to create ParseDisplayName: %#x\n", hr);
501 
502  hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC, &IID_IFilterMapper, (void **)&mapper);
503  ok(hr == S_OK, "Failed to create FilterMapper: %#x\n", hr);
504 
505  hr = IFilterMapper_RegisterFilter(mapper, CLSID_TestFilter, nameW, 0xdeadbeef);
506  if (hr == VFW_E_BAD_KEY)
507  {
508  win_skip("not enough permissions to register filters\n");
509  goto end;
510  }
511  ok(hr == S_OK, "RegisterFilter failed: %#x\n", hr);
512 
514  lstrcatW(buffer, cmW);
515  StringFromGUID2(&CLSID_LegacyAmFilterCategory, buffer + lstrlenW(buffer), CHARS_IN_GUID);
517  StringFromGUID2(&CLSID_TestFilter, buffer + lstrlenW(buffer), CHARS_IN_GUID);
518 
520  ok(find_moniker(&CLSID_LegacyAmFilterCategory, mon), "filter should be registered\n");
521 
522  hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&prop_bag);
523  ok(hr == S_OK, "BindToStorage failed: %#x\n", hr);
524 
525  VariantInit(&var);
526  hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
527  ok(hr == S_OK, "Read failed: %#x\n", hr);
528 
529  StringFromGUID2(&CLSID_TestFilter, buffer, CHARS_IN_GUID);
530  ok(!lstrcmpW(buffer, V_BSTR(&var)), "expected %s, got %s\n",
532 
533  VariantClear(&var);
534  hr = IPropertyBag_Read(prop_bag, clsidW, &var, NULL);
535  ok(hr == S_OK, "Read failed: %#x\n", hr);
536  ok(!lstrcmpW(buffer, V_BSTR(&var)), "expected %s, got %s\n",
538 
539  IPropertyBag_Release(prop_bag);
540 
541  hr = IFilterMapper_UnregisterFilter(mapper, CLSID_TestFilter);
542  ok(hr == S_OK, "UnregisterFilter failed: %#x\n", hr);
543 
544  ok(!find_moniker(&CLSID_LegacyAmFilterCategory, mon), "filter should not be registered\n");
545  IMoniker_Release(mon);
546 
547 end:
548  IFilterMapper_Release(mapper);
549  IParseDisplayName_Release(parser);
550 }
HRESULT hr
Definition: shlfolder.c:183
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
static const WCHAR clsidW[]
Definition: devenum.c:41
#define CHARS_IN_GUID
GLuint buffer
Definition: glext.h:5915
GLuint GLuint end
Definition: gl.h:1545
void WINAPI VariantInit(VARIANTARG *pVarg)
Definition: variant.c:571
static const WCHAR deviceW[]
Definition: devenum.c:40
#define lstrlenW
Definition: compat.h:407
static const WCHAR cmW[]
Definition: devenum.c:45
smooth NULL
Definition: ftsmooth.c:416
const GUID IID_IPropertyBag
const GUID IID_IParseDisplayName
static const WCHAR nameW[]
Definition: main.c:46
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define check_display_name(parser, buffer)
Definition: devenum.c:331
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2343
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:651
#define V_BSTR(A)
Definition: oleauto.h:226
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3234
static const WCHAR backslashW[]
Definition: devenum.c:46
#define S_OK
Definition: intsafe.h:59
#define lstrcpyW
Definition: compat.h:406
static BOOL find_moniker(const GUID *class, IMoniker *needle)
Definition: devenum.c:242
static const WCHAR friendly_name[]
Definition: devenum.c:38
#define ok(value,...)
Definition: atltest.h:57
Definition: import.c:86
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
#define VFW_E_BAD_KEY
Definition: vfwmsgs.h:170
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test_midiout()

static void test_midiout ( void  )
static

Definition at line 819 of file devenum.c.

820 {
821  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};
822  static const WCHAR midioutidW[] = {'M','i','d','i','O','u','t','I','d',0};
824  IPropertyBag *prop_bag;
825  IMoniker *mon;
826  MIDIOUTCAPSW caps;
827  WCHAR buffer[200];
828  const WCHAR *name;
829  int count, i;
830  VARIANT var;
831  HRESULT hr;
832 
833  hr = CoCreateInstance(&CLSID_CDeviceMoniker, NULL, CLSCTX_INPROC, &IID_IParseDisplayName, (void **)&parser);
834  ok(hr == S_OK, "Failed to create ParseDisplayName: %#x\n", hr);
835 
837 
838  for (i = -1; i < count; i++)
839  {
840  midiOutGetDevCapsW(i, &caps, sizeof(caps));
841 
842  if (i == -1) /* MIDI_MAPPER */
843  name = defaultW;
844  else
845  name = caps.szPname;
846 
848  lstrcatW(buffer, cmW);
849  StringFromGUID2(&CLSID_MidiRendererCategory, buffer + lstrlenW(buffer), CHARS_IN_GUID);
851  lstrcatW(buffer, name);
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  VariantInit(&var);
859  hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
860  ok(hr == S_OK, "Read failed: %#x\n", hr);
861 
862  ok(!lstrcmpW(name, V_BSTR(&var)), "expected %s, got %s\n",
864 
865  VariantClear(&var);
866  hr = IPropertyBag_Read(prop_bag, clsidW, &var, NULL);
867  ok(hr == S_OK, "Read failed: %#x\n", hr);
868 
869  StringFromGUID2(&CLSID_AVIMIDIRender, buffer, CHARS_IN_GUID);
870  ok(!lstrcmpW(buffer, V_BSTR(&var)), "expected %s, got %s\n",
872 
873  VariantClear(&var);
874  hr = IPropertyBag_Read(prop_bag, midioutidW, &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 }
HRESULT hr
Definition: shlfolder.c:183
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
GLuint GLuint GLsizei count
Definition: gl.h:1545
static const WCHAR defaultW[]
Definition: lex.c:47
static const WCHAR clsidW[]
Definition: devenum.c:41
#define CHARS_IN_GUID
GLuint buffer
Definition: glext.h:5915
void WINAPI VariantInit(VARIANTARG *pVarg)
Definition: variant.c:571
static const WCHAR deviceW[]
Definition: devenum.c:40
#define lstrlenW
Definition: compat.h:407
static const WCHAR cmW[]
Definition: devenum.c:45
#define V_I4(A)
Definition: oleauto.h:247
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
smooth NULL
Definition: ftsmooth.c:416
const GUID IID_IPropertyBag
const GUID IID_IParseDisplayName
WCHAR szPname[MAXPNAMELEN]
Definition: mmsystem.h:1126
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define check_display_name(parser, buffer)
Definition: devenum.c:331
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2343
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:651
#define V_BSTR(A)
Definition: oleauto.h:226
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3234
static const WCHAR backslashW[]
Definition: devenum.c:46
#define S_OK
Definition: intsafe.h:59
#define lstrcpyW
Definition: compat.h:406
static const WCHAR friendly_name[]
Definition: devenum.c:38
#define ok(value,...)
Definition: atltest.h:57
UINT WINAPI midiOutGetDevCapsW(UINT_PTR uDeviceID, LPMIDIOUTCAPSW lpCaps, UINT uSize)
Definition: winmm.c:817
Definition: import.c:86
Definition: name.c:36
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
UINT WINAPI midiOutGetNumDevs(void)
Definition: winmm.c:809
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by START_TEST().

◆ test_moniker_isequal()

static void test_moniker_isequal ( void  )
static

Definition at line 153 of file devenum.c.

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

Referenced by START_TEST().

◆ test_register_filter()

static void test_register_filter ( void  )
static

Definition at line 266 of file devenum.c.

267 {
268  static const WCHAR name[] = {'d','e','v','e','n','u','m',' ','t','e','s','t',0};
269  IFilterMapper2 *mapper2;
270  IMoniker *mon = NULL;
271  REGFILTER2 rgf2 = {0};
272  HRESULT hr;
273 
274  hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC, &IID_IFilterMapper2, (void **)&mapper2);
275  ok(hr == S_OK, "Failed to create FilterMapper2: %#x\n", hr);
276 
277  rgf2.dwVersion = 2;
278  rgf2.dwMerit = MERIT_UNLIKELY;
279  S2(U(rgf2)).cPins2 = 0;
280 
281  hr = IFilterMapper2_RegisterFilter(mapper2, &CLSID_TestFilter, name, &mon, NULL, NULL, &rgf2);
282  if (hr == E_ACCESSDENIED)
283  {
284  skip("Not enough permissions to register filters\n");
285  IFilterMapper2_Release(mapper2);
286  return;
287  }
288  ok(hr == S_OK, "RegisterFilter failed: %#x\n", hr);
289 
290  ok(find_moniker(&CLSID_LegacyAmFilterCategory, mon), "filter should be registered\n");
291 
292  hr = IFilterMapper2_UnregisterFilter(mapper2, NULL, NULL, &CLSID_TestFilter);
293  ok(hr == S_OK, "UnregisterFilter failed: %#x\n", hr);
294 
295  ok(!find_moniker(&CLSID_LegacyAmFilterCategory, mon), "filter should not be registered\n");
296  IMoniker_Release(mon);
297 
298  mon = NULL;
299  hr = IFilterMapper2_RegisterFilter(mapper2, &CLSID_TestFilter, name, &mon, &CLSID_AudioRendererCategory, NULL, &rgf2);
300  ok(hr == S_OK, "RegisterFilter failed: %#x\n", hr);
301 
302  ok(find_moniker(&CLSID_AudioRendererCategory, mon), "filter should be registered\n");
303 
304  hr = IFilterMapper2_UnregisterFilter(mapper2, &CLSID_AudioRendererCategory, NULL, &CLSID_TestFilter);
305  ok(hr == S_OK, "UnregisterFilter failed: %#x\n", hr);
306 
307  ok(!find_moniker(&CLSID_AudioRendererCategory, mon), "filter should not be registered\n");
308  IMoniker_Release(mon);
309 
310  IFilterMapper2_Release(mapper2);
311 }
#define E_ACCESSDENIED
Definition: winerror.h:2849
HRESULT hr
Definition: shlfolder.c:183
#define U(x)
Definition: wordpad.c:44
#define S2(x)
Definition: test.h:192
DWORD dwMerit
Definition: axextend.idl:232
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3234
#define S_OK
Definition: intsafe.h:59
static BOOL find_moniker(const GUID *class, IMoniker *needle)
Definition: devenum.c:242
DWORD dwVersion
Definition: axextend.idl:231
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
Definition: name.c:36

Referenced by START_TEST().

◆ test_vfw()

static void test_vfw ( void  )
static

Definition at line 886 of file devenum.c.

887 {
888  static const WCHAR fcchandlerW[] = {'F','c','c','H','a','n','d','l','e','r',0};
890  IPropertyBag *prop_bag;
891  IMoniker *mon;
892  WCHAR buffer[200];
893  ICINFO info;
894  VARIANT var;
895  HRESULT hr;
896  int i = 0;
897  HIC hic;
898 
899  if (broken(sizeof(void *) == 8))
900  {
901  win_skip("VFW codecs are not enumerated on 64-bit Windows\n");
902  return;
903  }
904 
905  hr = CoCreateInstance(&CLSID_CDeviceMoniker, NULL, CLSCTX_INPROC, &IID_IParseDisplayName, (void **)&parser);
906  ok(hr == S_OK, "Failed to create ParseDisplayName: %#x\n", hr);
907 
908  while (ICInfo(ICTYPE_VIDEO, i++, &info))
909  {
910  WCHAR name[5] = {LOBYTE(LOWORD(info.fccHandler)), HIBYTE(LOWORD(info.fccHandler)),
911  LOBYTE(HIWORD(info.fccHandler)), HIBYTE(HIWORD(info.fccHandler))};
912 
913  hic = ICOpen(ICTYPE_VIDEO, info.fccHandler, ICMODE_QUERY);
914  ICGetInfo(hic, &info, sizeof(info));
915  ICClose(hic);
916 
918  lstrcatW(buffer, cmW);
919  StringFromGUID2(&CLSID_VideoCompressorCategory, buffer + lstrlenW(buffer), CHARS_IN_GUID);
921  lstrcatW(buffer, name);
922 
924 
925  hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&prop_bag);
926  ok(hr == S_OK, "BindToStorage failed: %#x\n", hr);
927 
928  VariantInit(&var);
929  hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
930  ok(hr == S_OK, "Read failed: %#x\n", hr);
931 
932  ok(!lstrcmpW(info.szDescription, V_BSTR(&var)), "expected %s, got %s\n",
933  wine_dbgstr_w(info.szDescription), wine_dbgstr_w(V_BSTR(&var)));
934 
935  VariantClear(&var);
936  hr = IPropertyBag_Read(prop_bag, clsidW, &var, NULL);
937  ok(hr == S_OK, "Read failed: %#x\n", hr);
938 
939  StringFromGUID2(&CLSID_AVICo, buffer, CHARS_IN_GUID);
940  ok(!lstrcmpW(buffer, V_BSTR(&var)), "expected %s, got %s\n",
942 
943  VariantClear(&var);
944  hr = IPropertyBag_Read(prop_bag, fcchandlerW, &var, NULL);
945  ok(hr == S_OK, "Read failed: %#x\n", hr);
946  ok(!lstrcmpW(name, V_BSTR(&var)), "expected %s, got %s\n",
948 
949  IPropertyBag_Release(prop_bag);
950  IMoniker_Release(mon);
951  }
952 
953  IParseDisplayName_Release(parser);
954 }
HIC VFWAPI ICOpen(DWORD fccType, DWORD fccHandler, UINT wMode)
Definition: msvideo_main.c:437
HRESULT hr
Definition: shlfolder.c:183
#define LOBYTE(W)
Definition: jmemdos.c:487
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
static const WCHAR clsidW[]
Definition: devenum.c:41
#define CHARS_IN_GUID
#define HIBYTE(W)
Definition: jmemdos.c:486
GLuint buffer
Definition: glext.h:5915
void WINAPI VariantInit(VARIANTARG *pVarg)
Definition: variant.c:571
static const WCHAR deviceW[]
Definition: devenum.c:40
#define lstrlenW
Definition: compat.h:407
BOOL VFWAPI ICInfo(DWORD fccType, DWORD fccHandler, ICINFO *lpicinfo)
Definition: msvideo_main.c:337
static const WCHAR cmW[]
Definition: devenum.c:45
#define ICMODE_QUERY
Definition: vfw.h:271
struct _test_info info[]
Definition: SetCursorPos.c:19
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
LRESULT WINAPI ICClose(HIC hic)
smooth NULL
Definition: ftsmooth.c:416
const GUID IID_IPropertyBag
const GUID IID_IParseDisplayName
LRESULT VFWAPI ICGetInfo(HIC hic, ICINFO *picinfo, DWORD cb)
Definition: msvideo_main.c:601
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define check_display_name(parser, buffer)
Definition: devenum.c:331
#define ICTYPE_VIDEO
Definition: mmreg.h:531
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2343
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:651
#define V_BSTR(A)
Definition: oleauto.h:226
#define broken(x)
Definition: _sntprintf.h:21
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3234
static const WCHAR backslashW[]
Definition: devenum.c:46
Definition: vfw.h:280
#define S_OK
Definition: intsafe.h:59
#define lstrcpyW
Definition: compat.h:406
static const WCHAR friendly_name[]
Definition: devenum.c:38
#define ok(value,...)
Definition: atltest.h:57
Definition: import.c:86
Definition: name.c:36
#define HIWORD(l)
Definition: typedefs.h:246
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
#define win_skip
Definition: test.h:141
#define LOWORD(l)
Definition: pedump.c:82

Referenced by START_TEST().

◆ test_wavein()

static void test_wavein ( void  )
static

Definition at line 733 of file devenum.c.

734 {
735  static const WCHAR waveinidW[] = {'W','a','v','e','I','n','I','d',0};
737  IPropertyBag *prop_bag;
738  IMoniker *mon;
739  WCHAR endpoint[200];
740  WCHAR buffer[200];
741  WAVEINCAPSW caps;
742  MMRESULT mmr;
743  int count, i;
744  VARIANT var;
745  HRESULT hr;
746 
747  hr = CoCreateInstance(&CLSID_CDeviceMoniker, NULL, CLSCTX_INPROC, &IID_IParseDisplayName, (void **)&parser);
748  ok(hr == S_OK, "Failed to create ParseDisplayName: %#x\n", hr);
749 
751 
752  for (i = 0; i < count; i++)
753  {
754  waveInGetDevCapsW(i, &caps, sizeof(caps));
755 
757  lstrcatW(buffer, cmW);
758  StringFromGUID2(&CLSID_AudioInputDeviceCategory, buffer + lstrlenW(buffer), CHARS_IN_GUID);
760  lstrcatW(buffer, caps.szPname);
761 
763 
764  hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&prop_bag);
765  ok(hr == S_OK, "BindToStorage failed: %#x\n", hr);
766 
767  VariantInit(&var);
768  hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
770  {
771  IPropertyBag_Release(prop_bag);
772  IMoniker_Release(mon);
773 
774  /* Win8+ uses the endpoint GUID instead of the device name */
776  (DWORD_PTR) endpoint, sizeof(endpoint));
777  ok(!mmr, "waveInMessage failed: %u\n", mmr);
778 
780  lstrcatW(buffer, cmW);
781  StringFromGUID2(&CLSID_AudioInputDeviceCategory, buffer + lstrlenW(buffer), CHARS_IN_GUID);
784  lstrcatW(buffer, strchrW(endpoint, '}') + 2);
785 
787 
788  hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&prop_bag);
789  ok(hr == S_OK, "BindToStorage failed: %#x\n", hr);
790 
791  hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
792  }
793  ok(hr == S_OK, "Read failed: %#x\n", hr);
794 
795  ok(!strncmpW(caps.szPname, V_BSTR(&var), lstrlenW(caps.szPname)), "expected %s, got %s\n",
796  wine_dbgstr_w(caps.szPname), wine_dbgstr_w(V_BSTR(&var)));
797 
798  VariantClear(&var);
799  hr = IPropertyBag_Read(prop_bag, clsidW, &var, NULL);
800  ok(hr == S_OK, "Read failed: %#x\n", hr);
801 
802  StringFromGUID2(&CLSID_AudioRecord, buffer, CHARS_IN_GUID);
803  ok(!lstrcmpW(buffer, V_BSTR(&var)), "expected %s, got %s\n",
805 
806  VariantClear(&var);
807  hr = IPropertyBag_Read(prop_bag, waveinidW, &var, NULL);
808  ok(hr == S_OK, "Read failed: %#x\n", hr);
809 
810  ok(V_I4(&var) == i, "expected %d, got %d\n", i, V_I4(&var));
811 
812  IPropertyBag_Release(prop_bag);
813  IMoniker_Release(mon);
814  }
815 
816  IParseDisplayName_Release(parser);
817 }
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
HRESULT hr
Definition: shlfolder.c:183
WCHAR szPname[MAXPNAMELEN]
Definition: mmsystem.h:1060
#define DRV_QUERYFUNCTIONINSTANCEID
Definition: mmddk.h:94
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
GLuint GLuint GLsizei count
Definition: gl.h:1545
static const WCHAR waveW[]
Definition: devenum.c:42
static const WCHAR clsidW[]
Definition: devenum.c:41
#define CHARS_IN_GUID
UINT MMRESULT
Definition: mmsystem.h:962
GLuint buffer
Definition: glext.h:5915
static int strncmpW(const WCHAR *str1, const WCHAR *str2, int n)
Definition: devenum.c:54
void WINAPI VariantInit(VARIANTARG *pVarg)
Definition: variant.c:571
static const WCHAR deviceW[]
Definition: devenum.c:40
#define lstrlenW
Definition: compat.h:407
static const WCHAR cmW[]
Definition: devenum.c:45
UINT WINAPI waveInMessage(HWAVEIN hWaveIn, UINT uMessage, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
Definition: winmm.c:2816
#define V_I4(A)
Definition: oleauto.h:247
UINT WINAPI waveInGetDevCapsW(UINT_PTR uDeviceID, LPWAVEINCAPSW lpCaps, UINT uSize)
Definition: winmm.c:2576
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
smooth NULL
Definition: ftsmooth.c:416
const GUID IID_IPropertyBag
const GUID IID_IParseDisplayName
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define check_display_name(parser, buffer)
Definition: devenum.c:331
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2343
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:651
uint32_t DWORD_PTR
Definition: typedefs.h:63
static WCHAR * strchrW(const WCHAR *str, WCHAR ch)
Definition: devenum.c:48
#define V_BSTR(A)
Definition: oleauto.h:226
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3234
static const WCHAR backslashW[]
Definition: devenum.c:46
#define S_OK
Definition: intsafe.h:59
Definition: nis.h:10
#define lstrcpyW
Definition: compat.h:406
static const WCHAR friendly_name[]
Definition: devenum.c:38
#define ok(value,...)
Definition: atltest.h:57
Definition: import.c:86
UINT WINAPI waveInGetNumDevs(void)
Definition: winmm.c:2568
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274

Referenced by START_TEST().

◆ test_waveout()

static void test_waveout ( void  )
static

Definition at line 640 of file devenum.c.

641 {
642  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};
643  static const WCHAR waveoutidW[] = {'W','a','v','e','O','u','t','I','d',0};
645  IPropertyBag *prop_bag;
646  IMoniker *mon;
647  WCHAR endpoint[200];
648  WAVEOUTCAPSW caps;
649  WCHAR buffer[200];
650  const WCHAR *name;
651  MMRESULT mmr;
652  int count, i;
653  VARIANT var;
654  HRESULT hr;
655 
656  hr = CoCreateInstance(&CLSID_CDeviceMoniker, NULL, CLSCTX_INPROC, &IID_IParseDisplayName, (void **)&parser);
657  ok(hr == S_OK, "Failed to create ParseDisplayName: %#x\n", hr);
658 
660 
661  for (i = -1; i < count; i++)
662  {
663  waveOutGetDevCapsW(i, &caps, sizeof(caps));
664 
665  if (i == -1) /* WAVE_MAPPER */
666  name = defaultW;
667  else
668  name = caps.szPname;
669 
671  lstrcatW(buffer, cmW);
672  StringFromGUID2(&CLSID_AudioRendererCategory, buffer + lstrlenW(buffer), CHARS_IN_GUID);
674  lstrcatW(buffer, name);
675 
677 
678  hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&prop_bag);
679  ok(hr == S_OK, "BindToStorage failed: %#x\n", hr);
680 
681  VariantInit(&var);
682  hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
684  {
685  IPropertyBag_Release(prop_bag);
686  IMoniker_Release(mon);
687 
688  /* Win8+ uses the endpoint GUID instead of the device name */
690  (DWORD_PTR) endpoint, sizeof(endpoint));
691  ok(!mmr, "waveOutMessage failed: %u\n", mmr);
692 
694  lstrcatW(buffer, cmW);
695  StringFromGUID2(&CLSID_AudioRendererCategory, buffer + lstrlenW(buffer), CHARS_IN_GUID);
698  lstrcatW(buffer, strchrW(endpoint, '}') + 2);
699 
701 
702  hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&prop_bag);
703  ok(hr == S_OK, "BindToStorage failed: %#x\n", hr);
704 
705  hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
706  }
707  ok(hr == S_OK, "Read failed: %#x\n", hr);
708 
709  ok(!strncmpW(name, V_BSTR(&var), lstrlenW(name)), "expected %s, got %s\n",
711 
712  VariantClear(&var);
713  hr = IPropertyBag_Read(prop_bag, clsidW, &var, NULL);
714  ok(hr == S_OK, "Read failed: %#x\n", hr);
715 
716  StringFromGUID2(&CLSID_AudioRender, buffer, CHARS_IN_GUID);
717  ok(!lstrcmpW(buffer, V_BSTR(&var)), "expected %s, got %s\n",
719 
720  VariantClear(&var);
721  hr = IPropertyBag_Read(prop_bag, waveoutidW, &var, NULL);
722  ok(hr == S_OK, "Read failed: %#x\n", hr);
723 
724  ok(V_I4(&var) == i, "expected %d, got %d\n", i, V_I4(&var));
725 
726  IPropertyBag_Release(prop_bag);
727  IMoniker_Release(mon);
728  }
729 
730  IParseDisplayName_Release(parser);
731 }
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
HRESULT hr
Definition: shlfolder.c:183
UINT WINAPI waveOutMessage(HWAVEOUT hWaveOut, UINT uMessage, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
Definition: winmm.c:2541
#define DRV_QUERYFUNCTIONINSTANCEID
Definition: mmddk.h:94
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
GLuint GLuint GLsizei count
Definition: gl.h:1545
static const WCHAR defaultW[]
Definition: lex.c:47
static const WCHAR waveW[]
Definition: devenum.c:42
static const WCHAR clsidW[]
Definition: devenum.c:41
#define CHARS_IN_GUID
UINT MMRESULT
Definition: mmsystem.h:962
GLuint buffer
Definition: glext.h:5915
static int strncmpW(const WCHAR *str1, const WCHAR *str2, int n)
Definition: devenum.c:54
void WINAPI VariantInit(VARIANTARG *pVarg)
Definition: variant.c:571
static const WCHAR deviceW[]
Definition: devenum.c:40
#define lstrlenW
Definition: compat.h:407
static const WCHAR cmW[]
Definition: devenum.c:45
#define V_I4(A)
Definition: oleauto.h:247
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
UINT WINAPI waveOutGetDevCapsW(UINT_PTR uDeviceID, LPWAVEOUTCAPSW lpCaps, UINT uSize)
Definition: winmm.c:2176
smooth NULL
Definition: ftsmooth.c:416
const GUID IID_IPropertyBag
const GUID IID_IParseDisplayName
UINT WINAPI waveOutGetNumDevs(void)
Definition: winmm.c:2140
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define check_display_name(parser, buffer)
Definition: devenum.c:331
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2343
WCHAR szPname[MAXPNAMELEN]
Definition: mmsystem.h:1039
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:651
uint32_t DWORD_PTR
Definition: typedefs.h:63
static WCHAR * strchrW(const WCHAR *str, WCHAR ch)
Definition: devenum.c:48
#define V_BSTR(A)
Definition: oleauto.h:226
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3234
static const WCHAR backslashW[]
Definition: devenum.c:46
#define S_OK
Definition: intsafe.h:59
Definition: nis.h:10
#define lstrcpyW
Definition: compat.h:406
static const WCHAR friendly_name[]
Definition: devenum.c:38
#define ok(value,...)
Definition: atltest.h:57
Definition: import.c:86
Definition: name.c:36
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by START_TEST().

Variable Documentation

◆ backslashW

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

◆ clsidW

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

◆ cmW

◆ deviceW

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

◆ fcc_handlerW

const WCHAR fcc_handlerW[] = {'F','c','c','H','a','n','d','l','e','r',0}
static

Definition at line 39 of file devenum.c.

Referenced by test_devenum().

◆ friendly_name

◆ mrleW

const WCHAR mrleW[] = {'m','r','l','e',0}
static

Definition at line 43 of file devenum.c.

Referenced by test_devenum().

◆ swW

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

Definition at line 44 of file devenum.c.

Referenced by DEVENUM_IMediaCatMoniker_GetDisplayName(), and test_directshow_filter().

◆ waveW

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

Definition at line 42 of file devenum.c.

Referenced by test_wavein(), and test_waveout().