mirror of
https://github.com/reactos/reactos.git
synced 2025-04-04 20:50:41 +00:00
[DEVENUM_WINETEST] Sync with Wine Staging 4.18. CORE-16441
This commit is contained in:
parent
c1585bb868
commit
8cc0d363dc
2 changed files with 97 additions and 28 deletions
|
@ -1,5 +1,5 @@
|
|||
|
||||
add_executable(devenum_winetest devenum.c testlist.c)
|
||||
set_module_type(devenum_winetest win32cui)
|
||||
add_importlibs(devenum_winetest advapi32 dsound msvfw32 oleaut32 ole32 winmm msvcrt kernel32)
|
||||
add_importlibs(devenum_winetest advapi32 dsound msvfw32 oleaut32 ole32 winmm msdmo msvcrt kernel32)
|
||||
add_rostests_file(TARGET devenum_winetest)
|
||||
|
|
|
@ -32,15 +32,16 @@
|
|||
#include "dsound.h"
|
||||
#include "mmddk.h"
|
||||
#include "vfw.h"
|
||||
#include "dmoreg.h"
|
||||
#include "setupapi.h"
|
||||
|
||||
DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
|
||||
|
||||
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 dmoW[] = {'d','m','o',':',0};
|
||||
static const WCHAR swW[] = {'s','w',':',0};
|
||||
static const WCHAR cmW[] = {'c','m',':',0};
|
||||
static const WCHAR backslashW[] = {'\\',0};
|
||||
|
@ -64,10 +65,11 @@ static void test_devenum(IBindCtx *bind_ctx)
|
|||
ICreateDevEnum* create_devenum;
|
||||
IPropertyBag *prop_bag;
|
||||
IMoniker *moniker;
|
||||
BOOL have_mrle = FALSE;
|
||||
GUID cat_guid, clsid;
|
||||
WCHAR *displayname;
|
||||
VARIANT var;
|
||||
HRESULT hr;
|
||||
int count;
|
||||
|
||||
hr = CoCreateInstance(&CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC,
|
||||
&IID_ICreateDevEnum, (LPVOID*)&create_devenum);
|
||||
|
@ -82,19 +84,20 @@ static void test_devenum(IBindCtx *bind_ctx)
|
|||
ok(hr == S_OK, "IMoniker_BindToStorage failed: %#x\n", hr);
|
||||
|
||||
VariantInit(&var);
|
||||
hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
|
||||
ok(hr == S_OK, "Failed to read FriendlyName: %#x\n", hr);
|
||||
|
||||
if (winetest_debug > 1)
|
||||
trace("%s:\n", wine_dbgstr_w(V_BSTR(&var)));
|
||||
|
||||
VariantClear(&var);
|
||||
hr = IPropertyBag_Read(prop_bag, clsidW, &var, NULL);
|
||||
ok(hr == S_OK, "Failed to read CLSID: %#x\n", hr);
|
||||
|
||||
hr = CLSIDFromString(V_BSTR(&var), &cat_guid);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
|
||||
VariantClear(&var);
|
||||
hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
|
||||
ok(hr == S_OK, "Failed to read FriendlyName: %#x\n", hr);
|
||||
|
||||
if (winetest_debug > 1)
|
||||
trace("%s %s:\n", wine_dbgstr_guid(&cat_guid), wine_dbgstr_w(V_BSTR(&var)));
|
||||
|
||||
VariantClear(&var);
|
||||
IPropertyBag_Release(prop_bag);
|
||||
IMoniker_Release(moniker);
|
||||
|
||||
|
@ -103,8 +106,13 @@ static void test_devenum(IBindCtx *bind_ctx)
|
|||
|
||||
if (hr == S_OK)
|
||||
{
|
||||
count = 0;
|
||||
|
||||
while (IEnumMoniker_Next(enum_moniker, 1, &moniker, NULL) == S_OK)
|
||||
{
|
||||
hr = IMoniker_GetDisplayName(moniker, NULL, NULL, &displayname);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
|
||||
hr = IMoniker_GetClassID(moniker, NULL);
|
||||
ok(hr == E_INVALIDARG, "IMoniker_GetClassID should failed %x\n", hr);
|
||||
|
||||
|
@ -118,38 +126,31 @@ static void test_devenum(IBindCtx *bind_ctx)
|
|||
ok(hr == S_OK, "IMoniker_BindToStorage failed with error %x\n", hr);
|
||||
|
||||
hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
|
||||
ok(hr == S_OK, "IPropertyBag_Read failed: %#x\n", hr);
|
||||
ok((hr == S_OK) | (hr == ERROR_KEY_DOES_NOT_EXIST),
|
||||
"IPropertyBag_Read failed: %#x\n", hr);
|
||||
|
||||
if (winetest_debug > 1)
|
||||
trace(" %s\n", wine_dbgstr_w(V_BSTR(&var)));
|
||||
|
||||
if (IsEqualGUID(&CLSID_VideoCompressorCategory, &cat_guid)) {
|
||||
/* Test well known compressor to ensure that we really enumerate codecs */
|
||||
hr = IPropertyBag_Read(prop_bag, fcc_handlerW, &var, NULL);
|
||||
if (SUCCEEDED(hr)) {
|
||||
ok(V_VT(&var) == VT_BSTR, "V_VT(var) = %d\n", V_VT(&var));
|
||||
if(!lstrcmpW(V_BSTR(&var), mrleW))
|
||||
have_mrle = TRUE;
|
||||
VariantClear(&var);
|
||||
}
|
||||
}
|
||||
trace(" %s %s\n", wine_dbgstr_w(displayname), wine_dbgstr_w(V_BSTR(&var)));
|
||||
|
||||
hr = IMoniker_BindToObject(moniker, bind_ctx, NULL, &IID_IUnknown, NULL);
|
||||
ok(hr == E_POINTER, "got %#x\n", hr);
|
||||
|
||||
VariantClear(&var);
|
||||
CoTaskMemFree(displayname);
|
||||
IPropertyBag_Release(prop_bag);
|
||||
IMoniker_Release(moniker);
|
||||
count++;
|
||||
}
|
||||
IEnumMoniker_Release(enum_moniker);
|
||||
|
||||
ok(count > 0, "CreateClassEnumerator() returned S_OK but no devices were enumerated.\n");
|
||||
}
|
||||
}
|
||||
|
||||
IEnumMoniker_Release(enum_cat);
|
||||
ICreateDevEnum_Release(create_devenum);
|
||||
|
||||
/* 64-bit windows are missing mrle codec */
|
||||
if(sizeof(void*) == 4)
|
||||
ok(have_mrle, "mrle codec not found\n");
|
||||
}
|
||||
|
||||
static void test_moniker_isequal(void)
|
||||
{
|
||||
HRESULT res;
|
||||
|
@ -476,6 +477,7 @@ static void test_codec(void)
|
|||
* enumerating them will destroy the key */
|
||||
ok(!find_moniker(&CLSID_AudioRendererCategory, mon), "codec should not be registered\n");
|
||||
|
||||
VariantClear(&var);
|
||||
hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
|
||||
ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "got %#x\n", hr);
|
||||
|
||||
|
@ -485,6 +487,69 @@ static void test_codec(void)
|
|||
IParseDisplayName_Release(parser);
|
||||
}
|
||||
|
||||
static void test_dmo(void)
|
||||
{
|
||||
static const WCHAR name[] = {'d','e','v','e','n','u','m',' ','t','e','s','t',0};
|
||||
IParseDisplayName *parser;
|
||||
IPropertyBag *prop_bag;
|
||||
WCHAR buffer[200];
|
||||
IMoniker *mon;
|
||||
VARIANT var;
|
||||
HRESULT hr;
|
||||
|
||||
hr = CoCreateInstance(&CLSID_CDeviceMoniker, NULL, CLSCTX_INPROC, &IID_IParseDisplayName, (void **)&parser);
|
||||
ok(hr == S_OK, "Failed to create ParseDisplayName: %#x\n", hr);
|
||||
|
||||
lstrcpyW(buffer, deviceW);
|
||||
lstrcatW(buffer, dmoW);
|
||||
StringFromGUID2(&CLSID_TestFilter, buffer + lstrlenW(buffer), CHARS_IN_GUID);
|
||||
StringFromGUID2(&CLSID_AudioRendererCategory, buffer + lstrlenW(buffer), CHARS_IN_GUID);
|
||||
mon = check_display_name(parser, buffer);
|
||||
|
||||
ok(!find_moniker(&CLSID_AudioRendererCategory, mon), "DMO should not be registered\n");
|
||||
|
||||
hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&prop_bag);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
|
||||
VariantInit(&var);
|
||||
hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
|
||||
ok(hr == E_FAIL, "got %#x\n", hr);
|
||||
|
||||
V_VT(&var) = VT_BSTR;
|
||||
V_BSTR(&var) = SysAllocString(name);
|
||||
hr = IPropertyBag_Write(prop_bag, friendly_name, &var);
|
||||
ok(hr == E_ACCESSDENIED, "Write failed: %#x\n", hr);
|
||||
|
||||
hr = DMORegister(name, &CLSID_TestFilter, &CLSID_AudioRendererCategory, 0, 0, NULL, 0, NULL);
|
||||
if (hr != E_FAIL)
|
||||
{
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
|
||||
ok(find_moniker(&CLSID_AudioRendererCategory, mon), "DMO should be registered\n");
|
||||
|
||||
VariantClear(&var);
|
||||
hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(!lstrcmpW(V_BSTR(&var), name), "got %s\n", wine_dbgstr_w(V_BSTR(&var)));
|
||||
|
||||
VariantClear(&var);
|
||||
V_VT(&var) = VT_BSTR;
|
||||
V_BSTR(&var) = SysAllocString(name);
|
||||
hr = IPropertyBag_Write(prop_bag, friendly_name, &var);
|
||||
ok(hr == E_ACCESSDENIED, "Write failed: %#x\n", hr);
|
||||
|
||||
VariantClear(&var);
|
||||
hr = IPropertyBag_Read(prop_bag, clsidW, &var, NULL);
|
||||
ok(hr == HRESULT_FROM_WIN32(ERROR_NOT_FOUND), "got %#x\n", hr);
|
||||
|
||||
hr = DMOUnregister(&CLSID_TestFilter, &CLSID_AudioRendererCategory);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
}
|
||||
IPropertyBag_Release(prop_bag);
|
||||
IMoniker_Release(mon);
|
||||
IParseDisplayName_Release(parser);
|
||||
}
|
||||
|
||||
static void test_legacy_filter(void)
|
||||
{
|
||||
static const WCHAR nameW[] = {'t','e','s','t',0};
|
||||
|
@ -536,6 +601,7 @@ static void test_legacy_filter(void)
|
|||
ok(!lstrcmpW(buffer, V_BSTR(&var)), "expected %s, got %s\n",
|
||||
wine_dbgstr_w(buffer), wine_dbgstr_w(V_BSTR(&var)));
|
||||
|
||||
VariantClear(&var);
|
||||
IPropertyBag_Release(prop_bag);
|
||||
|
||||
hr = IFilterMapper_UnregisterFilter(mapper, CLSID_TestFilter);
|
||||
|
@ -631,6 +697,7 @@ static BOOL CALLBACK test_dsound(GUID *guid, const WCHAR *desc, const WCHAR *mod
|
|||
ok(!lstrcmpW(buffer, V_BSTR(&var)), "expected %s, got %s\n",
|
||||
wine_dbgstr_w(buffer), wine_dbgstr_w(V_BSTR(&var)));
|
||||
|
||||
VariantClear(&var);
|
||||
IPropertyBag_Release(prop_bag);
|
||||
IMoniker_Release(mon);
|
||||
IParseDisplayName_Release(parser);
|
||||
|
@ -946,6 +1013,7 @@ static void test_vfw(void)
|
|||
ok(!lstrcmpW(name, V_BSTR(&var)), "expected %s, got %s\n",
|
||||
wine_dbgstr_w(name), wine_dbgstr_w(V_BSTR(&var)));
|
||||
|
||||
VariantClear(&var);
|
||||
IPropertyBag_Release(prop_bag);
|
||||
IMoniker_Release(mon);
|
||||
}
|
||||
|
@ -974,6 +1042,7 @@ START_TEST(devenum)
|
|||
test_register_filter();
|
||||
test_directshow_filter();
|
||||
test_codec();
|
||||
test_dmo();
|
||||
|
||||
test_legacy_filter();
|
||||
hr = DirectSoundEnumerateW(test_dsound, NULL);
|
||||
|
|
Loading…
Reference in a new issue