mirror of
https://github.com/reactos/reactos.git
synced 2024-06-29 01:12:06 +00:00
[MMDEVAPI_WINETEST]
* Import from Wine 1.7.1. CORE-7469 svn path=/trunk/; revision=60477
This commit is contained in:
parent
f225fe10dd
commit
b29bfab7a1
|
@ -42,6 +42,7 @@ add_subdirectory(localui)
|
|||
add_subdirectory(lz32)
|
||||
add_subdirectory(mapi32)
|
||||
add_subdirectory(mlang)
|
||||
add_subdirectory(mmdevapi)
|
||||
add_subdirectory(mpr)
|
||||
add_subdirectory(msacm32)
|
||||
add_subdirectory(mscms)
|
||||
|
|
13
rostests/winetests/mmdevapi/CMakeLists.txt
Normal file
13
rostests/winetests/mmdevapi/CMakeLists.txt
Normal file
|
@ -0,0 +1,13 @@
|
|||
|
||||
add_executable(mmdevapi_winetest
|
||||
capture.c
|
||||
dependency.c
|
||||
mmdevenum.c
|
||||
propstore.c
|
||||
render.c
|
||||
testlist.c)
|
||||
|
||||
set_module_type(mmdevapi_winetest win32cui)
|
||||
target_link_libraries(mmdevapi_winetest uuid)
|
||||
add_importlibs(mmdevapi_winetest ole32 user32 msvcrt kernel32 ntdll)
|
||||
add_cd_file(TARGET mmdevapi_winetest DESTINATION reactos/bin FOR all)
|
1112
rostests/winetests/mmdevapi/capture.c
Normal file
1112
rostests/winetests/mmdevapi/capture.c
Normal file
File diff suppressed because it is too large
Load diff
109
rostests/winetests/mmdevapi/dependency.c
Normal file
109
rostests/winetests/mmdevapi/dependency.c
Normal file
|
@ -0,0 +1,109 @@
|
|||
/*
|
||||
* Copyright 2009 Maarten Lankhorst
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "wine/test.h"
|
||||
|
||||
#define COBJMACROS
|
||||
|
||||
#ifdef STANDALONE
|
||||
#include "initguid.h"
|
||||
#endif
|
||||
|
||||
#include "unknwn.h"
|
||||
#include "uuids.h"
|
||||
#include "mmdeviceapi.h"
|
||||
#include "dshow.h"
|
||||
#include "dsound.h"
|
||||
|
||||
static inline const char *dump_guid( const GUID *id )
|
||||
{
|
||||
static char data[39];
|
||||
if (!id) return "(null)";
|
||||
wsprintfA( data, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
|
||||
id->Data1, id->Data2, id->Data3,
|
||||
id->Data4[0], id->Data4[1], id->Data4[2], id->Data4[3],
|
||||
id->Data4[4], id->Data4[5], id->Data4[6], id->Data4[7] );
|
||||
return data;
|
||||
}
|
||||
|
||||
START_TEST(dependency)
|
||||
{
|
||||
HRESULT hr;
|
||||
IMMDeviceEnumerator *mme = NULL;
|
||||
IMMDevice *dev = NULL;
|
||||
IDirectSound8 *ds8 = NULL;
|
||||
IBaseFilter *bf = NULL;
|
||||
|
||||
CoInitializeEx(NULL, COINIT_MULTITHREADED);
|
||||
hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_INPROC_SERVER, &IID_IMMDeviceEnumerator, (void**)&mme);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
skip("mmdevapi not available: 0x%08x\n", hr);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
hr = IMMDeviceEnumerator_GetDefaultAudioEndpoint(mme, eRender, eMultimedia, &dev);
|
||||
ok(hr == S_OK || hr == E_NOTFOUND, "GetDefaultAudioEndpoint failed: 0x%08x\n", hr);
|
||||
if (hr != S_OK)
|
||||
{
|
||||
if (hr == E_NOTFOUND)
|
||||
skip("No sound card available\n");
|
||||
else
|
||||
skip("GetDefaultAudioEndpoint returns 0x%08x\n", hr);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
ok(!GetModuleHandle("dsound.dll"), "dsound.dll was already loaded!\n");
|
||||
|
||||
hr = IMMDevice_Activate(dev, &IID_IDirectSound8, CLSCTX_INPROC_SERVER, NULL, (void**)&ds8);
|
||||
ok(hr == S_OK, "Activating ds8 interface failed: 0x%08x\n", hr);
|
||||
if (hr == S_OK)
|
||||
{
|
||||
ok(GetModuleHandle("dsound.dll") != NULL, "dsound.dll not loaded!\n");
|
||||
ok(ds8 != NULL, "ds8 pointer is null\n");
|
||||
}
|
||||
if (ds8)
|
||||
IDirectSound8_Release(ds8);
|
||||
|
||||
ok(!GetModuleHandle("quartz.dll"), "quartz.dll was already loaded!\n");
|
||||
hr = IMMDevice_Activate(dev, &IID_IBaseFilter, CLSCTX_INPROC_SERVER, NULL, (void**)&bf);
|
||||
ok(hr == S_OK, "Activating bf failed: 0x%08x\n", hr);
|
||||
if (hr == S_OK)
|
||||
{
|
||||
ok(GetModuleHandle("quartz.dll") != NULL, "quartz.dll not loaded!\n");
|
||||
ok(bf != NULL, "bf pointer is null\n");
|
||||
if (bf)
|
||||
{
|
||||
CLSID clsid;
|
||||
hr = IBaseFilter_GetClassID(bf, &clsid);
|
||||
ok(hr == S_OK, "GetClassId failed with 0x%08x\n", hr);
|
||||
if (hr == S_OK)
|
||||
ok(IsEqualCLSID(&clsid, &CLSID_DSoundRender), "Wrong class id %s\n", dump_guid(&clsid));
|
||||
}
|
||||
}
|
||||
|
||||
cleanup:
|
||||
if (bf)
|
||||
IBaseFilter_Release(bf);
|
||||
if (dev)
|
||||
IMMDevice_Release(dev);
|
||||
if (mme)
|
||||
IMMDeviceEnumerator_Release(mme);
|
||||
|
||||
CoUninitialize();
|
||||
}
|
287
rostests/winetests/mmdevapi/mmdevenum.c
Normal file
287
rostests/winetests/mmdevapi/mmdevenum.c
Normal file
|
@ -0,0 +1,287 @@
|
|||
/*
|
||||
* Copyright 2009 Maarten Lankhorst
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "wine/test.h"
|
||||
|
||||
#define COBJMACROS
|
||||
|
||||
#include "initguid.h"
|
||||
#include "mmdeviceapi.h"
|
||||
#include "audioclient.h"
|
||||
#include "audiopolicy.h"
|
||||
#include "dshow.h"
|
||||
#include "dsound.h"
|
||||
#include "devpkey.h"
|
||||
|
||||
DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
|
||||
|
||||
/* Some of the QueryInterface tests are really just to check if I got the IIDs right :) */
|
||||
|
||||
/* IMMDeviceCollection appears to have no QueryInterface method and instead forwards to mme */
|
||||
static void test_collection(IMMDeviceEnumerator *mme, IMMDeviceCollection *col)
|
||||
{
|
||||
IMMDeviceCollection *col2;
|
||||
IMMDeviceEnumerator *mme2;
|
||||
IUnknown *unk;
|
||||
HRESULT hr;
|
||||
ULONG ref;
|
||||
UINT numdev;
|
||||
IMMDevice *dev;
|
||||
|
||||
/* collection doesn't keep a ref on parent */
|
||||
IMMDeviceEnumerator_AddRef(mme);
|
||||
ref = IMMDeviceEnumerator_Release(mme);
|
||||
ok(ref == 2, "Reference count on parent is %u\n", ref);
|
||||
|
||||
ref = IMMDeviceCollection_AddRef(col);
|
||||
IMMDeviceCollection_Release(col);
|
||||
ok(ref == 2, "Invalid reference count %u on collection\n", ref);
|
||||
|
||||
hr = IMMDeviceCollection_QueryInterface(col, &IID_IUnknown, NULL);
|
||||
ok(hr == E_POINTER, "Null ppv returns %08x\n", hr);
|
||||
|
||||
hr = IMMDeviceCollection_QueryInterface(col, &IID_IUnknown, (void**)&unk);
|
||||
ok(hr == S_OK, "Cannot query for IID_IUnknown: 0x%08x\n", hr);
|
||||
if (hr == S_OK)
|
||||
{
|
||||
ok((IUnknown*)col == unk, "Pointers are not identical %p/%p/%p\n", col, unk, mme);
|
||||
IUnknown_Release(unk);
|
||||
}
|
||||
|
||||
hr = IMMDeviceCollection_QueryInterface(col, &IID_IMMDeviceCollection, (void**)&col2);
|
||||
ok(hr == S_OK, "Cannot query for IID_IMMDeviceCollection: 0x%08x\n", hr);
|
||||
if (hr == S_OK)
|
||||
IMMDeviceCollection_Release(col2);
|
||||
|
||||
hr = IMMDeviceCollection_QueryInterface(col, &IID_IMMDeviceEnumerator, (void**)&mme2);
|
||||
ok(hr == E_NOINTERFACE, "Query for IID_IMMDeviceEnumerator returned: 0x%08x\n", hr);
|
||||
if (hr == S_OK)
|
||||
IMMDeviceEnumerator_Release(mme2);
|
||||
|
||||
hr = IMMDeviceCollection_GetCount(col, NULL);
|
||||
ok(hr == E_POINTER, "GetCount returned 0x%08x\n", hr);
|
||||
|
||||
hr = IMMDeviceCollection_GetCount(col, &numdev);
|
||||
ok(hr == S_OK, "GetCount returned 0x%08x\n", hr);
|
||||
|
||||
dev = (void*)(LONG_PTR)0x12345678;
|
||||
hr = IMMDeviceCollection_Item(col, numdev, &dev);
|
||||
ok(hr == E_INVALIDARG, "Asking for too high device returned 0x%08x\n", hr);
|
||||
ok(dev == NULL, "Returned non-null device\n");
|
||||
|
||||
if (numdev)
|
||||
{
|
||||
hr = IMMDeviceCollection_Item(col, 0, NULL);
|
||||
ok(hr == E_POINTER, "Query with null pointer returned 0x%08x\n", hr);
|
||||
|
||||
hr = IMMDeviceCollection_Item(col, 0, &dev);
|
||||
ok(hr == S_OK, "Valid Item returned 0x%08x\n", hr);
|
||||
ok(dev != NULL, "Device is null!\n");
|
||||
if (dev != NULL)
|
||||
{
|
||||
char temp[128];
|
||||
WCHAR *id = NULL;
|
||||
if (IMMDevice_GetId(dev, &id) == S_OK)
|
||||
{
|
||||
IMMDevice *dev2;
|
||||
|
||||
temp[sizeof(temp)-1] = 0;
|
||||
WideCharToMultiByte(CP_ACP, 0, id, -1, temp, sizeof(temp)-1, NULL, NULL);
|
||||
trace("Device found: %s\n", temp);
|
||||
|
||||
hr = IMMDeviceEnumerator_GetDevice(mme, id, &dev2);
|
||||
ok(hr == S_OK, "GetDevice failed: %08x\n", hr);
|
||||
|
||||
IMMDevice_Release(dev2);
|
||||
|
||||
CoTaskMemFree(id);
|
||||
}
|
||||
}
|
||||
if (dev)
|
||||
IMMDevice_Release(dev);
|
||||
}
|
||||
IMMDeviceCollection_Release(col);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI notif_QueryInterface(IMMNotificationClient *iface,
|
||||
const GUID *riid, void **obj)
|
||||
{
|
||||
ok(0, "Unexpected QueryInterface call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static ULONG WINAPI notif_AddRef(IMMNotificationClient *iface)
|
||||
{
|
||||
ok(0, "Unexpected AddRef call\n");
|
||||
return 2;
|
||||
}
|
||||
|
||||
static ULONG WINAPI notif_Release(IMMNotificationClient *iface)
|
||||
{
|
||||
ok(0, "Unexpected Release call\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI notif_OnDeviceStateChanged(IMMNotificationClient *iface,
|
||||
const WCHAR *device_id, DWORD new_state)
|
||||
{
|
||||
ok(0, "Unexpected OnDeviceStateChanged call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI notif_OnDeviceAdded(IMMNotificationClient *iface,
|
||||
const WCHAR *device_id)
|
||||
{
|
||||
ok(0, "Unexpected OnDeviceAdded call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI notif_OnDeviceRemoved(IMMNotificationClient *iface,
|
||||
const WCHAR *device_id)
|
||||
{
|
||||
ok(0, "Unexpected OnDeviceRemoved call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI notif_OnDefaultDeviceChanged(IMMNotificationClient *iface,
|
||||
EDataFlow flow, ERole role, const WCHAR *device_id)
|
||||
{
|
||||
ok(0, "Unexpected OnDefaultDeviceChanged call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI notif_OnPropertyValueChanged(IMMNotificationClient *iface,
|
||||
const WCHAR *device_id, const PROPERTYKEY key)
|
||||
{
|
||||
ok(0, "Unexpected OnPropertyValueChanged call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static IMMNotificationClientVtbl notif_vtbl = {
|
||||
notif_QueryInterface,
|
||||
notif_AddRef,
|
||||
notif_Release,
|
||||
notif_OnDeviceStateChanged,
|
||||
notif_OnDeviceAdded,
|
||||
notif_OnDeviceRemoved,
|
||||
notif_OnDefaultDeviceChanged,
|
||||
notif_OnPropertyValueChanged
|
||||
};
|
||||
|
||||
static IMMNotificationClient notif = { ¬if_vtbl };
|
||||
|
||||
/* Only do parameter tests here, the actual MMDevice testing should be a separate test */
|
||||
START_TEST(mmdevenum)
|
||||
{
|
||||
static const WCHAR not_a_deviceW[] = {'n','o','t','a','d','e','v','i','c','e',0};
|
||||
|
||||
HRESULT hr;
|
||||
IUnknown *unk = NULL;
|
||||
IMMDeviceEnumerator *mme, *mme2;
|
||||
ULONG ref;
|
||||
IMMDeviceCollection *col;
|
||||
IMMDevice *dev;
|
||||
|
||||
CoInitializeEx(NULL, COINIT_MULTITHREADED);
|
||||
hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_INPROC_SERVER, &IID_IMMDeviceEnumerator, (void**)&mme);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
skip("mmdevapi not available: 0x%08x\n", hr);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Odd behavior.. bug? */
|
||||
ref = IMMDeviceEnumerator_AddRef(mme);
|
||||
ok(ref == 3, "Invalid reference count after incrementing: %u\n", ref);
|
||||
IMMDeviceEnumerator_Release(mme);
|
||||
|
||||
hr = IMMDeviceEnumerator_QueryInterface(mme, &IID_IUnknown, (void**)&unk);
|
||||
ok(hr == S_OK, "returned 0x%08x\n", hr);
|
||||
if (hr != S_OK) return;
|
||||
|
||||
ok( (LONG_PTR)mme == (LONG_PTR)unk, "Pointers are unequal %p/%p\n", unk, mme);
|
||||
IUnknown_Release(unk);
|
||||
|
||||
/* Proving that it is static.. */
|
||||
hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_INPROC_SERVER, &IID_IMMDeviceEnumerator, (void**)&mme2);
|
||||
ok(hr == S_OK, "CoCreateInstance failed: 0x%08x\n", hr);
|
||||
IMMDeviceEnumerator_Release(mme2);
|
||||
ok(mme == mme2, "Pointers are not equal!\n");
|
||||
|
||||
hr = IMMDeviceEnumerator_QueryInterface(mme, &IID_IUnknown, NULL);
|
||||
ok(hr == E_POINTER, "Null pointer on QueryInterface returned %08x\n", hr);
|
||||
|
||||
hr = IMMDeviceEnumerator_QueryInterface(mme, &GUID_NULL, (void**)&unk);
|
||||
ok(!unk, "Unk not reset to null after invalid QI\n");
|
||||
ok(hr == E_NOINTERFACE, "Invalid hr %08x returned on IID_NULL\n", hr);
|
||||
|
||||
hr = IMMDeviceEnumerator_GetDevice(mme, not_a_deviceW, NULL);
|
||||
ok(hr == E_POINTER, "GetDevice gave wrong error: %08x\n", hr);
|
||||
|
||||
hr = IMMDeviceEnumerator_GetDevice(mme, NULL, &dev);
|
||||
ok(hr == E_POINTER, "GetDevice gave wrong error: %08x\n", hr);
|
||||
|
||||
hr = IMMDeviceEnumerator_GetDevice(mme, not_a_deviceW, &dev);
|
||||
ok(hr == E_INVALIDARG, "GetDevice gave wrong error: %08x\n", hr);
|
||||
|
||||
col = (void*)(LONG_PTR)0x12345678;
|
||||
hr = IMMDeviceEnumerator_EnumAudioEndpoints(mme, 0xffff, DEVICE_STATEMASK_ALL, &col);
|
||||
ok(hr == E_INVALIDARG, "Setting invalid data flow returned 0x%08x\n", hr);
|
||||
ok(col == NULL, "Collection pointer non-null on failure\n");
|
||||
|
||||
hr = IMMDeviceEnumerator_EnumAudioEndpoints(mme, eAll, DEVICE_STATEMASK_ALL+1, &col);
|
||||
ok(hr == E_INVALIDARG, "Setting invalid mask returned 0x%08x\n", hr);
|
||||
|
||||
hr = IMMDeviceEnumerator_EnumAudioEndpoints(mme, eAll, DEVICE_STATEMASK_ALL, NULL);
|
||||
ok(hr == E_POINTER, "Invalid pointer returned: 0x%08x\n", hr);
|
||||
|
||||
hr = IMMDeviceEnumerator_EnumAudioEndpoints(mme, eAll, DEVICE_STATEMASK_ALL, &col);
|
||||
ok(hr == S_OK, "Valid EnumAudioEndpoints returned 0x%08x\n", hr);
|
||||
if (hr == S_OK)
|
||||
{
|
||||
ok(!!col, "Returned null pointer\n");
|
||||
if (col)
|
||||
test_collection(mme, col);
|
||||
}
|
||||
|
||||
hr = IMMDeviceEnumerator_RegisterEndpointNotificationCallback(mme, NULL);
|
||||
ok(hr == E_POINTER, "RegisterEndpointNotificationCallback failed: %08x\n", hr);
|
||||
|
||||
hr = IMMDeviceEnumerator_RegisterEndpointNotificationCallback(mme, ¬if);
|
||||
ok(hr == S_OK, "RegisterEndpointNotificationCallback failed: %08x\n", hr);
|
||||
|
||||
hr = IMMDeviceEnumerator_RegisterEndpointNotificationCallback(mme, ¬if);
|
||||
ok(hr == S_OK, "RegisterEndpointNotificationCallback failed: %08x\n", hr);
|
||||
|
||||
hr = IMMDeviceEnumerator_UnregisterEndpointNotificationCallback(mme, NULL);
|
||||
ok(hr == E_POINTER, "UnregisterEndpointNotificationCallback failed: %08x\n", hr);
|
||||
|
||||
hr = IMMDeviceEnumerator_UnregisterEndpointNotificationCallback(mme, (IMMNotificationClient*)0xdeadbeef);
|
||||
ok(hr == E_NOTFOUND, "UnregisterEndpointNotificationCallback failed: %08x\n", hr);
|
||||
|
||||
hr = IMMDeviceEnumerator_UnregisterEndpointNotificationCallback(mme, ¬if);
|
||||
ok(hr == S_OK, "UnregisterEndpointNotificationCallback failed: %08x\n", hr);
|
||||
|
||||
hr = IMMDeviceEnumerator_UnregisterEndpointNotificationCallback(mme, ¬if);
|
||||
ok(hr == S_OK, "UnregisterEndpointNotificationCallback failed: %08x\n", hr);
|
||||
|
||||
hr = IMMDeviceEnumerator_UnregisterEndpointNotificationCallback(mme, ¬if);
|
||||
ok(hr == E_NOTFOUND, "UnregisterEndpointNotificationCallback failed: %08x\n", hr);
|
||||
|
||||
IMMDeviceEnumerator_Release(mme);
|
||||
}
|
137
rostests/winetests/mmdevapi/propstore.c
Normal file
137
rostests/winetests/mmdevapi/propstore.c
Normal file
|
@ -0,0 +1,137 @@
|
|||
/*
|
||||
* Copyright 2010 Maarten Lankhorst for CodeWeavers
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#define NONAMELESSUNION
|
||||
#include "wine/test.h"
|
||||
|
||||
#define COBJMACROS
|
||||
|
||||
#ifdef STANDALONE
|
||||
#include "initguid.h"
|
||||
#endif
|
||||
|
||||
#include "unknwn.h"
|
||||
#include "uuids.h"
|
||||
#include "mmdeviceapi.h"
|
||||
#include "devpkey.h"
|
||||
|
||||
static void test_propertystore(IPropertyStore *store)
|
||||
{
|
||||
HRESULT hr;
|
||||
PROPVARIANT pv;
|
||||
char temp[128];
|
||||
temp[sizeof(temp)-1] = 0;
|
||||
|
||||
pv.vt = VT_EMPTY;
|
||||
hr = IPropertyStore_GetValue(store, &PKEY_AudioEndpoint_GUID, &pv);
|
||||
ok(hr == S_OK, "Failed with %08x\n", hr);
|
||||
ok(pv.vt == VT_LPWSTR, "Value should be %i, is %i\n", VT_LPWSTR, pv.vt);
|
||||
if (hr == S_OK && pv.vt == VT_LPWSTR)
|
||||
{
|
||||
WideCharToMultiByte(CP_ACP, 0, pv.u.pwszVal, -1, temp, sizeof(temp)-1, NULL, NULL);
|
||||
trace("guid: %s\n", temp);
|
||||
CoTaskMemFree(pv.u.pwszVal);
|
||||
}
|
||||
|
||||
pv.vt = VT_EMPTY;
|
||||
hr = IPropertyStore_GetValue(store, (const PROPERTYKEY*)&DEVPKEY_DeviceInterface_FriendlyName, &pv);
|
||||
ok(hr == S_OK, "Failed with %08x\n", hr);
|
||||
ok(pv.vt == VT_EMPTY, "Key should not be found\n");
|
||||
|
||||
pv.vt = VT_EMPTY;
|
||||
hr = IPropertyStore_GetValue(store, (const PROPERTYKEY*)&DEVPKEY_DeviceInterface_Enabled, &pv);
|
||||
ok(hr == S_OK, "Failed with %08x\n", hr);
|
||||
ok(pv.vt == VT_EMPTY, "Key should not be found\n");
|
||||
|
||||
pv.vt = VT_EMPTY;
|
||||
hr = IPropertyStore_GetValue(store, (const PROPERTYKEY*)&DEVPKEY_DeviceInterface_ClassGuid, &pv);
|
||||
ok(hr == S_OK, "Failed with %08x\n", hr);
|
||||
ok(pv.vt == VT_EMPTY, "Key should not be found\n");
|
||||
}
|
||||
|
||||
static void test_deviceinterface(IPropertyStore *store)
|
||||
{
|
||||
HRESULT hr;
|
||||
PROPVARIANT pv;
|
||||
|
||||
static const PROPERTYKEY deviceinterface_key = {
|
||||
{0x233164c8, 0x1b2c, 0x4c7d, {0xbc, 0x68, 0xb6, 0x71, 0x68, 0x7a, 0x25, 0x67}}, 1
|
||||
};
|
||||
|
||||
pv.vt = VT_EMPTY;
|
||||
hr = IPropertyStore_GetValue(store, &deviceinterface_key, &pv);
|
||||
ok(hr == S_OK, "GetValue failed: %08x\n", hr);
|
||||
ok(pv.vt == VT_LPWSTR, "Got wrong variant type: 0x%x\n", pv.vt);
|
||||
trace("device interface: %s\n", wine_dbgstr_w(pv.u.pwszVal));
|
||||
CoTaskMemFree(pv.u.pwszVal);
|
||||
}
|
||||
|
||||
START_TEST(propstore)
|
||||
{
|
||||
HRESULT hr;
|
||||
IMMDeviceEnumerator *mme = NULL;
|
||||
IMMDevice *dev = NULL;
|
||||
IPropertyStore *store;
|
||||
|
||||
CoInitializeEx(NULL, COINIT_MULTITHREADED);
|
||||
hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_INPROC_SERVER, &IID_IMMDeviceEnumerator, (void**)&mme);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
skip("mmdevapi not available: 0x%08x\n", hr);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
hr = IMMDeviceEnumerator_GetDefaultAudioEndpoint(mme, eRender, eMultimedia, &dev);
|
||||
ok(hr == S_OK || hr == E_NOTFOUND, "GetDefaultAudioEndpoint failed: 0x%08x\n", hr);
|
||||
if (hr != S_OK)
|
||||
{
|
||||
if (hr == E_NOTFOUND)
|
||||
skip("No sound card available\n");
|
||||
else
|
||||
skip("GetDefaultAudioEndpoint returns 0x%08x\n", hr);
|
||||
goto cleanup;
|
||||
}
|
||||
store = NULL;
|
||||
hr = IMMDevice_OpenPropertyStore(dev, 3, &store);
|
||||
ok(hr == E_INVALIDARG, "Wrong hr returned: %08x\n", hr);
|
||||
if (hr != S_OK)
|
||||
/* It seems on windows returning with E_INVALIDARG doesn't
|
||||
* set store to NULL, so just don't set store to non-null
|
||||
* before calling this function
|
||||
*/
|
||||
ok(!store, "Store set to non-NULL on failure: %p/%08x\n", store, hr);
|
||||
else if (store)
|
||||
IPropertyStore_Release(store);
|
||||
hr = IMMDevice_OpenPropertyStore(dev, STGM_READ, NULL);
|
||||
ok(hr == E_POINTER, "Wrong hr returned: %08x\n", hr);
|
||||
|
||||
store = NULL;
|
||||
hr = IMMDevice_OpenPropertyStore(dev, STGM_READ, &store);
|
||||
ok(hr == S_OK, "Opening valid store returned %08x\n", hr);
|
||||
if (store)
|
||||
{
|
||||
test_propertystore(store);
|
||||
test_deviceinterface(store);
|
||||
IPropertyStore_Release(store);
|
||||
}
|
||||
IMMDevice_Release(dev);
|
||||
cleanup:
|
||||
if (mme)
|
||||
IMMDeviceEnumerator_Release(mme);
|
||||
CoUninitialize();
|
||||
}
|
2277
rostests/winetests/mmdevapi/render.c
Normal file
2277
rostests/winetests/mmdevapi/render.c
Normal file
File diff suppressed because it is too large
Load diff
20
rostests/winetests/mmdevapi/testlist.c
Normal file
20
rostests/winetests/mmdevapi/testlist.c
Normal file
|
@ -0,0 +1,20 @@
|
|||
/* Automatically generated file; DO NOT EDIT!! */
|
||||
|
||||
#define STANDALONE
|
||||
#include <wine/test.h>
|
||||
|
||||
extern void func_capture(void);
|
||||
extern void func_dependency(void);
|
||||
extern void func_mmdevenum(void);
|
||||
extern void func_propstore(void);
|
||||
extern void func_render(void);
|
||||
|
||||
const struct test winetest_testlist[] =
|
||||
{
|
||||
{ "capture", func_capture },
|
||||
{ "dependency", func_dependency },
|
||||
{ "mmdevenum", func_mmdevenum },
|
||||
{ "propstore", func_propstore },
|
||||
{ "render", func_render },
|
||||
{ 0, 0 }
|
||||
};
|
Loading…
Reference in a new issue