Commit 906ad69b authored by Davide Beatrici's avatar Davide Beatrici Committed by Alexandre Julliard

winepulse: Move GetPropValue into mmdevapi.

parent c03170a9
......@@ -240,21 +240,48 @@ static HRESULT MMDevice_SetPropValue(const GUID *devguid, DWORD flow, REFPROPERT
static HRESULT set_driver_prop_value(GUID *id, const EDataFlow flow, const PROPERTYKEY *prop)
{
HRESULT hr;
struct get_prop_value_params params;
PROPVARIANT pv;
char *dev_name;
unsigned int size = 0;
TRACE("%s, (%s,%lu)\n", wine_dbgstr_guid(id), wine_dbgstr_guid(&prop->fmtid), prop->pid);
if (!drvs.pGetPropValue)
return E_NOTIMPL;
if (!drvs.pget_device_name_from_guid(id, &dev_name, &params.flow))
return E_FAIL;
hr = drvs.pGetPropValue(id, prop, &pv);
params.device = dev_name;
params.guid = id;
params.prop = prop;
params.value = &pv;
params.buffer = NULL;
params.buffer_size = &size;
if (SUCCEEDED(hr))
{
while (1) {
__wine_unix_call(drvs.module_unixlib, get_prop_value, &params);
if (params.result != E_NOT_SUFFICIENT_BUFFER)
break;
CoTaskMemFree(params.buffer);
params.buffer = CoTaskMemAlloc(*params.buffer_size);
if (!params.buffer) {
free(dev_name);
return E_OUTOFMEMORY;
}
}
if (FAILED(params.result))
CoTaskMemFree(params.buffer);
free(dev_name);
if (SUCCEEDED(params.result)) {
MMDevice_SetPropValue(id, flow, prop, &pv);
PropVariantClear(&pv);
}
return hr;
return params.result;
}
struct product_name_overrides
......
......@@ -102,9 +102,6 @@ static BOOL load_driver(const WCHAR *name, DriverFuncs *driver)
LDFC(GetEndpointIDs);
#undef LDFC
/* optional - do not fail if not found */
driver->pGetPropValue = (void*)GetProcAddress(driver->module, "GetPropValue");
GetModuleFileNameW(NULL, path, ARRAY_SIZE(path));
params.name = wcsrchr(path, '\\');
params.name = params.name ? params.name + 1 : path;
......
......@@ -50,8 +50,6 @@ typedef struct _DriverFuncs {
* all of the elements in both arrays with HeapFree() */
HRESULT (WINAPI *pGetEndpointIDs)(EDataFlow flow, WCHAR ***ids,
GUID **guids, UINT *num, UINT *default_index);
HRESULT (WINAPI *pGetPropValue)(GUID *guid,
const PROPERTYKEY *prop, PROPVARIANT *out);
} DriverFuncs;
extern DriverFuncs drvs DECLSPEC_HIDDEN;
......
......@@ -311,42 +311,3 @@ BOOL WINAPI get_device_name_from_guid(GUID *guid, char **name, EDataFlow *flow)
WARN("No matching device in registry for GUID %s\n", debugstr_guid(guid));
return FALSE;
}
HRESULT WINAPI AUDDRV_GetPropValue(GUID *guid, const PROPERTYKEY *prop, PROPVARIANT *out)
{
struct get_prop_value_params params;
char *pulse_name;
unsigned int size = 0;
TRACE("%s, (%s,%lu), %p\n", wine_dbgstr_guid(guid), wine_dbgstr_guid(&prop->fmtid), prop->pid, out);
if (!get_device_name_from_guid(guid, &pulse_name, &params.flow))
return E_FAIL;
params.device = pulse_name;
params.guid = guid;
params.prop = prop;
params.value = out;
params.buffer = NULL;
params.buffer_size = &size;
while(1) {
pulse_call(get_prop_value, &params);
if(params.result != E_NOT_SUFFICIENT_BUFFER)
break;
CoTaskMemFree(params.buffer);
params.buffer = CoTaskMemAlloc(*params.buffer_size);
if(!params.buffer) {
free(pulse_name);
return E_OUTOFMEMORY;
}
}
if(FAILED(params.result))
CoTaskMemFree(params.buffer);
free(pulse_name);
return params.result;
}
# MMDevAPI driver functions
@ stdcall -private get_device_name_from_guid(ptr ptr ptr) get_device_name_from_guid
@ stdcall -private GetEndpointIDs(long ptr ptr ptr ptr) AUDDRV_GetEndpointIDs
@ stdcall -private GetPropValue(ptr ptr ptr) AUDDRV_GetPropValue
# WinMM driver functions
@ stdcall -private DriverProc(long long long long long) winealsa.drv.DriverProc
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment