Follow-up to !600.
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/winepulse.drv/mmdevdrv.c | 2 +- dlls/winepulse.drv/pulse.c | 2 +- dlls/winepulse.drv/unixlib.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c index 446354fb9a5..39f15cde4b4 100644 --- a/dlls/winepulse.drv/mmdevdrv.c +++ b/dlls/winepulse.drv/mmdevdrv.c @@ -456,7 +456,7 @@ HRESULT WINAPI AUDDRV_GetEndpointIDs(EDataFlow flow, WCHAR ***ids_out, GUID **ke
for (i = 0; i < params.num; i++) { WCHAR *name = (WCHAR *)((char *)params.endpoints + params.endpoints[i].name); - char *pulse_name = (char *)params.endpoints + params.endpoints[i].pulse_name; + char *pulse_name = (char *)params.endpoints + params.endpoints[i].device; unsigned int size = (wcslen(name) + 1) * sizeof(WCHAR);
if (!(ids[i] = HeapAlloc(GetProcessHeap(), 0, size))) { diff --git a/dlls/winepulse.drv/pulse.c b/dlls/winepulse.drv/pulse.c index bd918b6f260..dfda96a47f2 100644 --- a/dlls/winepulse.drv/pulse.c +++ b/dlls/winepulse.drv/pulse.c @@ -268,7 +268,7 @@ static NTSTATUS pulse_get_endpoint_ids(void *args) endpoint->name = offset; memcpy((char *)params->endpoints + offset, dev->name, name_len * sizeof(WCHAR)); offset += name_len * sizeof(WCHAR); - endpoint->pulse_name = offset; + endpoint->device = offset; memcpy((char *)params->endpoints + offset, dev->pulse_name, len); offset += (len + 1) & ~1; endpoint++; diff --git a/dlls/winepulse.drv/unixlib.h b/dlls/winepulse.drv/unixlib.h index 1481a5db4b8..c6fd5d55bf7 100644 --- a/dlls/winepulse.drv/unixlib.h +++ b/dlls/winepulse.drv/unixlib.h @@ -32,7 +32,7 @@ enum phys_device_bus_type { struct endpoint { unsigned int name; - unsigned int pulse_name; + unsigned int device; };
struct main_loop_params
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/winepulse.drv/mmdevdrv.c | 6 +++--- dlls/winepulse.drv/pulse.c | 20 ++++++++++---------- dlls/winepulse.drv/unixlib.h | 6 +++--- 3 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c index 39f15cde4b4..7d17b624411 100644 --- a/dlls/winepulse.drv/mmdevdrv.c +++ b/dlls/winepulse.drv/mmdevdrv.c @@ -875,9 +875,9 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient3 *iface, }
params.name = name = get_application_name(TRUE); - params.pulse_name = This->pulse_name; - params.dataflow = This->dataflow; - params.mode = mode; + params.device = This->pulse_name; + params.flow = This->dataflow; + params.share = mode; params.flags = flags; params.duration = duration; params.fmt = fmt; diff --git a/dlls/winepulse.drv/pulse.c b/dlls/winepulse.drv/pulse.c index dfda96a47f2..c73c17ca114 100644 --- a/dlls/winepulse.drv/pulse.c +++ b/dlls/winepulse.drv/pulse.c @@ -1108,7 +1108,7 @@ static NTSTATUS pulse_create_stream(void *args) return STATUS_SUCCESS; }
- stream->dataflow = params->dataflow; + stream->dataflow = params->flow; for (i = 0; i < ARRAY_SIZE(stream->vol); ++i) stream->vol[i] = 1.f;
@@ -1119,7 +1119,7 @@ static NTSTATUS pulse_create_stream(void *args) goto exit;
period = 0; - hr = get_device_period_helper(params->dataflow, params->pulse_name, &period, NULL); + hr = get_device_period_helper(params->flow, params->device, &period, NULL); if (FAILED(hr)) goto exit;
@@ -1134,9 +1134,9 @@ static NTSTATUS pulse_create_stream(void *args) bufsize_bytes = stream->bufsize_frames * pa_frame_size(&stream->ss); stream->mmdev_period_usec = period / 10;
- stream->share = params->mode; + stream->share = params->share; stream->flags = params->flags; - hr = pulse_stream_connect(stream, params->pulse_name, stream->period_bytes); + hr = pulse_stream_connect(stream, params->device, stream->period_bytes); if (SUCCEEDED(hr)) { UINT32 unalign; const pa_buffer_attr *attr = pa_stream_get_buffer_attr(stream->stream); @@ -2417,9 +2417,9 @@ static NTSTATUS pulse_wow64_create_stream(void *args) struct { PTR32 name; - PTR32 pulse_name; - EDataFlow dataflow; - AUDCLNT_SHAREMODE mode; + PTR32 device; + EDataFlow flow; + AUDCLNT_SHAREMODE share; DWORD flags; REFERENCE_TIME duration; PTR32 fmt; @@ -2430,9 +2430,9 @@ static NTSTATUS pulse_wow64_create_stream(void *args) struct create_stream_params params = { .name = ULongToPtr(params32->name), - .pulse_name = ULongToPtr(params32->pulse_name), - .dataflow = params32->dataflow, - .mode = params32->mode, + .device = ULongToPtr(params32->device), + .flow = params32->flow, + .share = params32->share, .flags = params32->flags, .duration = params32->duration, .fmt = ULongToPtr(params32->fmt), diff --git a/dlls/winepulse.drv/unixlib.h b/dlls/winepulse.drv/unixlib.h index c6fd5d55bf7..fd3ff2cbf0c 100644 --- a/dlls/winepulse.drv/unixlib.h +++ b/dlls/winepulse.drv/unixlib.h @@ -53,9 +53,9 @@ struct get_endpoint_ids_params struct create_stream_params { const char *name; - const char *pulse_name; - EDataFlow dataflow; - AUDCLNT_SHAREMODE mode; + const char *device; + EDataFlow flow; + AUDCLNT_SHAREMODE share; DWORD flags; REFERENCE_TIME duration; const WAVEFORMATEX *fmt;
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/winepulse.drv/mmdevdrv.c | 4 ++-- dlls/winepulse.drv/pulse.c | 10 +++++----- dlls/winepulse.drv/unixlib.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c index 7d17b624411..d3d8d58e2f7 100644 --- a/dlls/winepulse.drv/mmdevdrv.c +++ b/dlls/winepulse.drv/mmdevdrv.c @@ -229,8 +229,8 @@ static void pulse_call(enum unix_funcs code, void *params) static void pulse_release_stream(stream_handle stream, HANDLE timer) { struct release_stream_params params; - params.stream = stream; - params.timer = timer; + params.stream = stream; + params.timer_thread = timer; pulse_call(release_stream, ¶ms); }
diff --git a/dlls/winepulse.drv/pulse.c b/dlls/winepulse.drv/pulse.c index c73c17ca114..5e7ed5a4280 100644 --- a/dlls/winepulse.drv/pulse.c +++ b/dlls/winepulse.drv/pulse.c @@ -1203,10 +1203,10 @@ static NTSTATUS pulse_release_stream(void *args) struct pulse_stream *stream = handle_get_stream(params->stream); SIZE_T size;
- if(params->timer) { + if(params->timer_thread) { stream->please_quit = TRUE; - NtWaitForSingleObject(params->timer, FALSE, NULL); - NtClose(params->timer); + NtWaitForSingleObject(params->timer_thread, FALSE, NULL); + NtClose(params->timer_thread); }
pulse_lock(); @@ -2449,13 +2449,13 @@ static NTSTATUS pulse_wow64_release_stream(void *args) struct { stream_handle stream; - PTR32 timer; + PTR32 timer_thread; HRESULT result; } *params32 = args; struct release_stream_params params = { .stream = params32->stream, - .timer = ULongToHandle(params32->timer) + .timer_thread = ULongToHandle(params32->timer_thread) }; pulse_release_stream(¶ms); params32->result = params.result; diff --git a/dlls/winepulse.drv/unixlib.h b/dlls/winepulse.drv/unixlib.h index fd3ff2cbf0c..5c2cf0b9c99 100644 --- a/dlls/winepulse.drv/unixlib.h +++ b/dlls/winepulse.drv/unixlib.h @@ -67,7 +67,7 @@ struct create_stream_params struct release_stream_params { stream_handle stream; - HANDLE timer; + HANDLE timer_thread; HRESULT result; };
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/winepulse.drv/unixlib.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/winepulse.drv/unixlib.h b/dlls/winepulse.drv/unixlib.h index 5c2cf0b9c99..7e095c21568 100644 --- a/dlls/winepulse.drv/unixlib.h +++ b/dlls/winepulse.drv/unixlib.h @@ -106,7 +106,7 @@ struct release_render_buffer_params { stream_handle stream; UINT32 written_frames; - DWORD flags; + UINT flags; HRESULT result; };
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/winepulse.drv/mmdevdrv.c | 2 +- dlls/winepulse.drv/unixlib.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c index d3d8d58e2f7..00ba6132f99 100644 --- a/dlls/winepulse.drv/mmdevdrv.c +++ b/dlls/winepulse.drv/mmdevdrv.c @@ -1562,7 +1562,7 @@ static HRESULT WINAPI AudioCaptureClient_GetBuffer(IAudioCaptureClient *iface, params.stream = This->pulse_stream; params.data = data; params.frames = frames; - params.flags = flags; + params.flags = (UINT*)flags; params.devpos = devpos; params.qpcpos = qpcpos; pulse_call(get_capture_buffer, ¶ms); diff --git a/dlls/winepulse.drv/unixlib.h b/dlls/winepulse.drv/unixlib.h index 7e095c21568..e3ee3700321 100644 --- a/dlls/winepulse.drv/unixlib.h +++ b/dlls/winepulse.drv/unixlib.h @@ -116,7 +116,7 @@ struct get_capture_buffer_params HRESULT result; BYTE **data; UINT32 *frames; - DWORD *flags; + UINT *flags; UINT64 *devpos; UINT64 *qpcpos; };
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/winepulse.drv/mmdevdrv.c | 2 +- dlls/winepulse.drv/pulse.c | 6 +++--- dlls/winepulse.drv/unixlib.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c index 00ba6132f99..5fe0e806dfd 100644 --- a/dlls/winepulse.drv/mmdevdrv.c +++ b/dlls/winepulse.drv/mmdevdrv.c @@ -1141,7 +1141,7 @@ static HRESULT WINAPI AudioClient_GetMixFormat(IAudioClient3 *iface, return E_POINTER; *pwfx = NULL;
- params.pulse_name = This->pulse_name; + params.device = This->pulse_name; params.flow = This->dataflow; params.fmt = CoTaskMemAlloc(sizeof(WAVEFORMATEXTENSIBLE)); if (!params.fmt) diff --git a/dlls/winepulse.drv/pulse.c b/dlls/winepulse.drv/pulse.c index 5e7ed5a4280..343156f6126 100644 --- a/dlls/winepulse.drv/pulse.c +++ b/dlls/winepulse.drv/pulse.c @@ -2055,7 +2055,7 @@ static NTSTATUS pulse_get_mix_format(void *args) PhysDevice *dev;
LIST_FOR_EACH_ENTRY(dev, list, PhysDevice, entry) { - if (strcmp(params->pulse_name, dev->pulse_name)) + if (strcmp(params->device, dev->pulse_name)) continue;
*params->fmt = dev->fmt; @@ -2516,14 +2516,14 @@ static NTSTATUS pulse_wow64_get_mix_format(void *args) { struct { - PTR32 pulse_name; + PTR32 device; EDataFlow flow; PTR32 fmt; HRESULT result; } *params32 = args; struct get_mix_format_params params = { - .pulse_name = ULongToPtr(params32->pulse_name), + .device = ULongToPtr(params32->device), .flow = params32->flow, .fmt = ULongToPtr(params32->fmt), }; diff --git a/dlls/winepulse.drv/unixlib.h b/dlls/winepulse.drv/unixlib.h index e3ee3700321..5dd6a9b2b8b 100644 --- a/dlls/winepulse.drv/unixlib.h +++ b/dlls/winepulse.drv/unixlib.h @@ -130,7 +130,7 @@ struct release_capture_buffer_params
struct get_mix_format_params { - const char *pulse_name; + const char *device; EDataFlow flow; WAVEFORMATEXTENSIBLE *fmt; HRESULT result;
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/winepulse.drv/mmdevdrv.c | 2 +- dlls/winepulse.drv/pulse.c | 6 +++--- dlls/winepulse.drv/unixlib.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c index 5fe0e806dfd..20e4b27990c 100644 --- a/dlls/winepulse.drv/mmdevdrv.c +++ b/dlls/winepulse.drv/mmdevdrv.c @@ -1171,7 +1171,7 @@ static HRESULT WINAPI AudioClient_GetDevicePeriod(IAudioClient3 *iface, return E_POINTER;
params.flow = This->dataflow; - params.pulse_name = This->pulse_name; + params.device = This->pulse_name; params.def_period = defperiod; params.min_period = minperiod;
diff --git a/dlls/winepulse.drv/pulse.c b/dlls/winepulse.drv/pulse.c index 343156f6126..4613a0b905d 100644 --- a/dlls/winepulse.drv/pulse.c +++ b/dlls/winepulse.drv/pulse.c @@ -2072,7 +2072,7 @@ static NTSTATUS pulse_get_device_period(void *args) { struct get_device_period_params *params = args;
- params->result = get_device_period_helper(params->flow, params->pulse_name, params->def_period, params->min_period); + params->result = get_device_period_helper(params->flow, params->device, params->def_period, params->min_period); return STATUS_SUCCESS; }
@@ -2536,7 +2536,7 @@ static NTSTATUS pulse_wow64_get_device_period(void *args) { struct { - PTR32 pulse_name; + PTR32 device; EDataFlow flow; HRESULT result; PTR32 def_period; @@ -2544,7 +2544,7 @@ static NTSTATUS pulse_wow64_get_device_period(void *args) } *params32 = args; struct get_device_period_params params = { - .pulse_name = ULongToPtr(params32->pulse_name), + .device = ULongToPtr(params32->device), .flow = params32->flow, .def_period = ULongToPtr(params32->def_period), .min_period = ULongToPtr(params32->min_period), diff --git a/dlls/winepulse.drv/unixlib.h b/dlls/winepulse.drv/unixlib.h index 5dd6a9b2b8b..6c934b23fa8 100644 --- a/dlls/winepulse.drv/unixlib.h +++ b/dlls/winepulse.drv/unixlib.h @@ -138,7 +138,7 @@ struct get_mix_format_params
struct get_device_period_params { - const char *pulse_name; + const char *device; EDataFlow flow; HRESULT result; REFERENCE_TIME *def_period;
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/winepulse.drv/mmdevdrv.c | 2 +- dlls/winepulse.drv/pulse.c | 2 +- dlls/winepulse.drv/unixlib.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c index 20e4b27990c..6bca1f3660a 100644 --- a/dlls/winepulse.drv/mmdevdrv.c +++ b/dlls/winepulse.drv/mmdevdrv.c @@ -2020,7 +2020,7 @@ static HRESULT WINAPI AudioSessionControl_GetState(IAudioSessionControl2 *iface,
params.stream = client->pulse_stream; pulse_call(is_started, ¶ms); - if (params.started) { + if (params.result == S_OK) { *state = AudioSessionStateActive; goto out; } diff --git a/dlls/winepulse.drv/pulse.c b/dlls/winepulse.drv/pulse.c index 4613a0b905d..df68b3200f8 100644 --- a/dlls/winepulse.drv/pulse.c +++ b/dlls/winepulse.drv/pulse.c @@ -2258,7 +2258,7 @@ static NTSTATUS pulse_is_started(void *args) struct pulse_stream *stream = handle_get_stream(params->stream);
pulse_lock(); - params->started = pulse_stream_valid(stream) && stream->started; + params->result = pulse_stream_valid(stream) && stream->started ? S_OK : S_FALSE; pulse_unlock();
return STATUS_SUCCESS; diff --git a/dlls/winepulse.drv/unixlib.h b/dlls/winepulse.drv/unixlib.h index 6c934b23fa8..37c7b414594 100644 --- a/dlls/winepulse.drv/unixlib.h +++ b/dlls/winepulse.drv/unixlib.h @@ -213,7 +213,7 @@ struct test_connect_params struct is_started_params { stream_handle stream; - BOOL started; + HRESULT result; };
struct get_prop_value_params
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/winepulse.drv/mmdevdrv.c | 35 ++++++++--------- dlls/winepulse.drv/pulse.c | 73 +++++++++++++++++++++++------------ dlls/winepulse.drv/unixlib.h | 13 +++---- 3 files changed, 71 insertions(+), 50 deletions(-)
diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c index 6bca1f3660a..8a88befeef1 100644 --- a/dlls/winepulse.drv/mmdevdrv.c +++ b/dlls/winepulse.drv/mmdevdrv.c @@ -2,6 +2,7 @@ * Copyright 2011-2012 Maarten Lankhorst * Copyright 2010-2011 Maarten Lankhorst for CodeWeavers * Copyright 2011 Andrew Eikum for CodeWeavers + * Copyright 2022 Huw Davies * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -2659,35 +2660,33 @@ HRESULT WINAPI AUDDRV_GetPropValue(GUID *guid, const PROPERTYKEY *prop, PROPVARI { struct get_prop_value_params params; char pulse_name[MAX_PULSE_NAME_LEN]; - DWORD size; + unsigned int size = 0;
TRACE("%s, (%s,%lu), %p\n", wine_dbgstr_guid(guid), wine_dbgstr_guid(&prop->fmtid), prop->pid, out);
if (!get_pulse_name_by_guid(guid, pulse_name, ¶ms.flow)) return E_FAIL;
- params.pulse_name = pulse_name; + params.device = pulse_name; params.guid = guid; params.prop = prop; - pulse_call(get_prop_value, ¶ms); + params.value = out; + params.buffer = NULL; + params.buffer_size = &size;
- if (params.result != S_OK) - return params.result; + while(1) { + pulse_call(get_prop_value, ¶ms);
- switch (params.vt) { - case VT_LPWSTR: - size = (wcslen(params.wstr) + 1) * sizeof(WCHAR); - if (!(out->pwszVal = CoTaskMemAlloc(size))) + if(params.result != E_NOT_SUFFICIENT_BUFFER) + break; + + CoTaskMemFree(params.buffer); + params.buffer = CoTaskMemAlloc(*params.buffer_size); + if(!params.buffer) return E_OUTOFMEMORY; - memcpy(out->pwszVal, params.wstr, size); - break; - case VT_UI4: - out->ulVal = params.ulVal; - break; - default: - assert(0); } - out->vt = params.vt; + if(FAILED(params.result)) + CoTaskMemFree(params.buffer);
- return S_OK; + return params.result; } diff --git a/dlls/winepulse.drv/pulse.c b/dlls/winepulse.drv/pulse.c index df68b3200f8..434ae75531b 100644 --- a/dlls/winepulse.drv/pulse.c +++ b/dlls/winepulse.drv/pulse.c @@ -2,6 +2,7 @@ * Copyright 2011-2012 Maarten Lankhorst * Copyright 2010-2011 Maarten Lankhorst for CodeWeavers * Copyright 2011 Andrew Eikum for CodeWeavers + * Copyright 2022 Huw Davies * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -2267,6 +2268,7 @@ static NTSTATUS pulse_is_started(void *args) static BOOL get_device_path(PhysDevice *dev, struct get_prop_value_params *params) { const GUID *guid = params->guid; + PROPVARIANT *out = params->value; UINT serial_number; char path[128]; int len; @@ -2288,9 +2290,19 @@ static BOOL get_device_path(PhysDevice *dev, struct get_prop_value_params *param break; }
- ntdll_umbstowcs(path, len + 1, params->wstr, ARRAY_SIZE(params->wstr)); + if (*params->buffer_size < ++len * sizeof(WCHAR)) { + params->result = E_NOT_SUFFICIENT_BUFFER; + *params->buffer_size = len * sizeof(WCHAR); + return FALSE; + } + + out->vt = VT_LPWSTR; + out->pwszVal = params->buffer; + + ntdll_umbstowcs(path, len, out->pwszVal, len); + + params->result = S_OK;
- params->vt = VT_LPWSTR; return TRUE; }
@@ -2308,7 +2320,7 @@ static NTSTATUS pulse_get_prop_value(void *args)
params->result = S_OK; LIST_FOR_EACH_ENTRY(dev, list, PhysDevice, entry) { - if (strcmp(params->pulse_name, dev->pulse_name)) + if (strcmp(params->device, dev->pulse_name)) continue; if (IsEqualPropertyKey(*params->prop, devicepath_key)) { if (!get_device_path(dev, params)) @@ -2317,20 +2329,20 @@ static NTSTATUS pulse_get_prop_value(void *args) } else if (IsEqualGUID(¶ms->prop->fmtid, &PKEY_AudioEndpoint_GUID)) { switch (params->prop->pid) { case 0: /* FormFactor */ - params->vt = VT_UI4; - params->ulVal = dev->form; + params->value->vt = VT_UI4; + params->value->ulVal = dev->form; return STATUS_SUCCESS; case 3: /* PhysicalSpeakers */ if (!dev->channel_mask) goto fail; - params->vt = VT_UI4; - params->ulVal = dev->channel_mask; + params->value->vt = VT_UI4; + params->value->ulVal = dev->channel_mask; return STATUS_SUCCESS; default: - break; + params->result = E_NOTIMPL; } } - params->result = E_NOTIMPL; + return STATUS_SUCCESS; }
@@ -2721,42 +2733,55 @@ static NTSTATUS pulse_wow64_test_connect(void *args)
static NTSTATUS pulse_wow64_get_prop_value(void *args) { - struct + struct propvariant32 { - PTR32 pulse_name; - PTR32 guid; - PTR32 prop; - EDataFlow flow; - HRESULT result; - VARTYPE vt; + WORD vt; + WORD pad1, pad2, pad3; union { - WCHAR wstr[128]; ULONG ulVal; + PTR32 ptr; + ULARGE_INTEGER uhVal; }; + } *value32; + struct + { + PTR32 device; + EDataFlow flow; + PTR32 guid; + PTR32 prop; + HRESULT result; + PTR32 value; + PTR32 buffer; /* caller allocated buffer to hold value's strings */ + PTR32 buffer_size; } *params32 = args; + PROPVARIANT value; struct get_prop_value_params params = { - .pulse_name = ULongToPtr(params32->pulse_name), + .device = ULongToPtr(params32->device), + .flow = params32->flow, .guid = ULongToPtr(params32->guid), .prop = ULongToPtr(params32->prop), - .flow = params32->flow, + .value = &value, + .buffer = ULongToPtr(params32->buffer), + .buffer_size = ULongToPtr(params32->buffer_size) }; pulse_get_prop_value(¶ms); params32->result = params.result; - params32->vt = params.vt; if (SUCCEEDED(params.result)) { - switch (params.vt) + value32 = UlongToPtr(params32->value); + value32->vt = value.vt; + switch (value.vt) { case VT_UI4: - params32->ulVal = params.ulVal; + value32->ulVal = value.ulVal; break; case VT_LPWSTR: - wcscpy(params32->wstr, params.wstr); + value32->ptr = params32->buffer; break; default: - FIXME("Unhandled vt %04x\n", params.vt); + FIXME("Unhandled vt %04x\n", value.vt); } } return STATUS_SUCCESS; diff --git a/dlls/winepulse.drv/unixlib.h b/dlls/winepulse.drv/unixlib.h index 37c7b414594..3516d6085eb 100644 --- a/dlls/winepulse.drv/unixlib.h +++ b/dlls/winepulse.drv/unixlib.h @@ -218,17 +218,14 @@ struct is_started_params
struct get_prop_value_params { - const char *pulse_name; + const char *device; + EDataFlow flow; const GUID *guid; const PROPERTYKEY *prop; - EDataFlow flow; HRESULT result; - VARTYPE vt; - union - { - WCHAR wstr[128]; - ULONG ulVal; - }; + PROPVARIANT *value; + void *buffer; /* caller allocated buffer to hold value's strings */ + unsigned int *buffer_size; };
enum unix_funcs
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/winepulse.drv/mmdevdrv.c | 5 +- dlls/winepulse.drv/pulse.c | 22 ++- dlls/winepulse.drv/unixlib.h | 260 ---------------------------------- 3 files changed, 24 insertions(+), 263 deletions(-) delete mode 100644 dlls/winepulse.drv/unixlib.h
diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c index 8a88befeef1..c212d3e68b5 100644 --- a/dlls/winepulse.drv/mmdevdrv.c +++ b/dlls/winepulse.drv/mmdevdrv.c @@ -29,6 +29,7 @@ #include "winternl.h" #include "wine/debug.h" #include "wine/list.h" +#include "wine/unixlib.h"
#include "ole2.h" #include "mimeole.h" @@ -45,12 +46,14 @@ #include "endpointvolume.h" #include "audiopolicy.h"
-#include "unixlib.h" +#include "../mmdevapi/unixlib.h"
WINE_DEFAULT_DEBUG_CHANNEL(pulse);
static unixlib_handle_t pulse_handle;
+#define MAX_PULSE_NAME_LEN 256 + #define NULL_PTR_ERR MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, RPC_X_NULL_REF_POINTER)
/* From <dlls/mmdevapi/mmdevapi.h> */ diff --git a/dlls/winepulse.drv/pulse.c b/dlls/winepulse.drv/pulse.c index 434ae75531b..9ff5cc9b78f 100644 --- a/dlls/winepulse.drv/pulse.c +++ b/dlls/winepulse.drv/pulse.c @@ -38,12 +38,20 @@ #include "initguid.h" #include "audioclient.h"
-#include "unixlib.h" - #include "wine/debug.h" +#include "wine/list.h" +#include "wine/unixlib.h" + +#include "../mmdevapi/unixlib.h"
WINE_DEFAULT_DEBUG_CHANNEL(pulse);
+enum phys_device_bus_type { + phys_device_bus_invalid = -1, + phys_device_bus_pci, + phys_device_bus_usb +}; + struct pulse_stream { EDataFlow dataflow; @@ -2367,6 +2375,7 @@ const unixlib_entry_t __wine_unix_call_funcs[] = pulse_release_render_buffer, pulse_get_capture_buffer, pulse_release_capture_buffer, + NULL, pulse_get_mix_format, pulse_get_device_period, pulse_get_buffer_size, @@ -2380,6 +2389,10 @@ const unixlib_entry_t __wine_unix_call_funcs[] = pulse_test_connect, pulse_is_started, pulse_get_prop_value, + NULL, + NULL, + NULL, + NULL, };
#ifdef _WIN64 @@ -2803,6 +2816,7 @@ const unixlib_entry_t __wine_unix_call_wow64_funcs[] = pulse_release_render_buffer, pulse_wow64_get_capture_buffer, pulse_release_capture_buffer, + NULL, pulse_wow64_get_mix_format, pulse_wow64_get_device_period, pulse_wow64_get_buffer_size, @@ -2816,6 +2830,10 @@ const unixlib_entry_t __wine_unix_call_wow64_funcs[] = pulse_wow64_test_connect, pulse_is_started, pulse_wow64_get_prop_value, + NULL, + NULL, + NULL, + NULL, };
#endif /* _WIN64 */ diff --git a/dlls/winepulse.drv/unixlib.h b/dlls/winepulse.drv/unixlib.h deleted file mode 100644 index 3516d6085eb..00000000000 --- a/dlls/winepulse.drv/unixlib.h +++ /dev/null @@ -1,260 +0,0 @@ -/* - * Copyright 2021 Jacek Caban 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 - */ - -#include "wine/list.h" -#include "wine/unixlib.h" - -#define MAX_PULSE_NAME_LEN 256 - -typedef UINT64 stream_handle; - -enum phys_device_bus_type { - phys_device_bus_invalid = -1, - phys_device_bus_pci, - phys_device_bus_usb -}; - -struct endpoint -{ - unsigned int name; - unsigned int device; -}; - -struct main_loop_params -{ - HANDLE event; -}; - -struct get_endpoint_ids_params -{ - EDataFlow flow; - struct endpoint *endpoints; - unsigned int size; - HRESULT result; - unsigned int num; - unsigned int default_idx; -}; - -struct create_stream_params -{ - const char *name; - const char *device; - EDataFlow flow; - AUDCLNT_SHAREMODE share; - DWORD flags; - REFERENCE_TIME duration; - const WAVEFORMATEX *fmt; - HRESULT result; - UINT32 *channel_count; - stream_handle *stream; -}; - -struct release_stream_params -{ - stream_handle stream; - HANDLE timer_thread; - HRESULT result; -}; - -struct start_params -{ - stream_handle stream; - HRESULT result; -}; - -struct stop_params -{ - stream_handle stream; - HRESULT result; -}; - -struct reset_params -{ - stream_handle stream; - HRESULT result; -}; - -struct timer_loop_params -{ - stream_handle stream; -}; - -struct get_render_buffer_params -{ - stream_handle stream; - UINT32 frames; - HRESULT result; - BYTE **data; -}; - -struct release_render_buffer_params -{ - stream_handle stream; - UINT32 written_frames; - UINT flags; - HRESULT result; -}; - -struct get_capture_buffer_params -{ - stream_handle stream; - HRESULT result; - BYTE **data; - UINT32 *frames; - UINT *flags; - UINT64 *devpos; - UINT64 *qpcpos; -}; - -struct release_capture_buffer_params -{ - stream_handle stream; - BOOL done; - HRESULT result; -}; - -struct get_mix_format_params -{ - const char *device; - EDataFlow flow; - WAVEFORMATEXTENSIBLE *fmt; - HRESULT result; -}; - -struct get_device_period_params -{ - const char *device; - EDataFlow flow; - HRESULT result; - REFERENCE_TIME *def_period; - REFERENCE_TIME *min_period; -}; - -struct get_buffer_size_params -{ - stream_handle stream; - HRESULT result; - UINT32 *size; -}; - -struct get_latency_params -{ - stream_handle stream; - HRESULT result; - REFERENCE_TIME *latency; -}; - -struct get_current_padding_params -{ - stream_handle stream; - HRESULT result; - UINT32 *padding; -}; - -struct get_next_packet_size_params -{ - stream_handle stream; - HRESULT result; - UINT32 *frames; -}; - -struct get_frequency_params -{ - stream_handle stream; - HRESULT result; - UINT64 *freq; -}; - -struct get_position_params -{ - stream_handle stream; - BOOL device; - HRESULT result; - UINT64 *pos; - UINT64 *qpctime; -}; - -struct set_volumes_params -{ - stream_handle stream; - float master_volume; - const float *volumes; - const float *session_volumes; -}; - -struct set_event_handle_params -{ - stream_handle stream; - HANDLE event; - HRESULT result; -}; - -struct test_connect_params -{ - const char *name; - HRESULT result; -}; - -struct is_started_params -{ - stream_handle stream; - HRESULT result; -}; - -struct get_prop_value_params -{ - const char *device; - EDataFlow flow; - const GUID *guid; - const PROPERTYKEY *prop; - HRESULT result; - PROPVARIANT *value; - void *buffer; /* caller allocated buffer to hold value's strings */ - unsigned int *buffer_size; -}; - -enum unix_funcs -{ - process_attach, - process_detach, - main_loop, - get_endpoint_ids, - create_stream, - release_stream, - start, - stop, - reset, - timer_loop, - get_render_buffer, - release_render_buffer, - get_capture_buffer, - release_capture_buffer, - get_mix_format, - get_device_period, - get_buffer_size, - get_latency, - get_current_padding, - get_next_packet_size, - get_frequency, - get_position, - set_volumes, - set_event_handle, - test_connect, - is_started, - get_prop_value, -};
@huw Let me know whether you would like me to defer the last commit to a dedicated MR, as I mentioned in https://gitlab.winehq.org/wine/wine/-/merge_requests/600#note_6073.
Huw Davies (@huw) commented about dlls/winepulse.drv/unixlib.h:
struct create_stream_params { const char *name;
- const char *pulse_name;
- EDataFlow dataflow;
- AUDCLNT_SHAREMODE mode;
- const char *device;
- EDataFlow flow;
- AUDCLNT_SHAREMODE share; DWORD flags; REFERENCE_TIME duration; const WAVEFORMATEX *fmt;
This is missing the additon of a `period` element.
This becomes evident after the final commit in this MR when the (new style) wow64 32-bit tests fail. Please try to test those in the future.
This is missing the additon of a `period` element.
Sorry, I'll add and initialize it (as I did in !600 for ALSA).
This becomes evident after the final commit in this MR when the (new style) wow64 32-bit tests fail. Please try to test those in the future.
Which tests would those be?
On Wed Aug 17 18:37:44 2022 +0000, Davide Beatrici wrote:
This is missing the additon of a `period` element.
Sorry, I'll add and initialize it (as I did in !600 for ALSA).
This becomes evident after the final commit in this MR when the (new
style) wow64 32-bit tests fail. Please try to test those in the future. Which tests would those be?
The 32-bit mmdevapi tests run with the "new" wow64 mode. See https://www.winehq.org/pipermail/wine-devel/2022-April/213620.html (not the series, just the cover letter).
On Wed Aug 17 19:00:57 2022 +0000, Huw Davies wrote:
The 32-bit mmdevapi tests run with the "new" wow64 mode. See https://www.winehq.org/pipermail/wine-devel/2022-April/213620.html (not the series, just the cover letter).
Thank you. Unfortunately there seems to be an issue; after applying your patch:
``` 0024:err:module:load_wow64_ntdll failed to load L"\??\C:\windows\syswow64\ntdll.dll" error 4000000e 0024:err:virtual:virtual_setup_exception stack overflow 1808 bytes in thread 0024 addr 0x1700339b4 stack 0x4408f0 (0x440000-0x441000-0x53fd20) ```
On Thu Aug 18 04:04:50 2022 +0000, Davide Beatrici wrote:
Thank you. Unfortunately there seems to be an issue; after applying your patch:
0024:err:module:load_wow64_ntdll failed to load L"\\??\\C:\\windows\\syswow64\\ntdll.dll" error 4000000e 0024:err:virtual:virtual_setup_exception stack overflow 1808 bytes in thread 0024 addr 0x1700339b4 stack 0x4408f0 (0x440000-0x441000-0x53fd20)
You need to `make install` both builds to the same location and then run `wine64` from within that location.
On Thu Aug 18 05:09:30 2022 +0000, Huw Davies wrote:
You need to `make install` both builds to the same location and then run `wine64` from within that location.
``` wine: created the configuration directory '/home/user/.wine' wine: '/home/user/.wine' is a 32-bit installation, it cannot support 64-bit applications. ```
When attempting to run anything through `wine64`, even 32 bit binaries.
On Thu Aug 18 05:50:44 2022 +0000, Davide Beatrici wrote:
wine: created the configuration directory '/home/user/.wine' wine: '/home/user/.wine' is a 32-bit installation, it cannot support 64-bit applications.
When attempting to run anything through `wine64`, even 32 bit binaries. If I create a 64 bit prefix another way, this is the output:
wine: '/home/user/.wine' is a 64-bit installation, it cannot be used with a 32-bit wineserver.
Either remove the existing `~/.wine` or use something `WINEPREFIX=~/.wine-wow64 wine64 foo.exe` to point Wine at a new wineprefix.
On Thu Aug 18 06:32:56 2022 +0000, Huw Davies wrote:
Either remove the existing `~/.wine` or use something like `WINEPREFIX=~/.wine-wow64 wine64 foo.exe` to point Wine at a new wineprefix.
I nuked the prefix several times, there's a bitness misdetection somewhere.
On Thu Aug 18 07:24:44 2022 +0000, Davide Beatrici wrote:
I nuked the prefix several times, there's a bitness mismatch somewhere. https://gitlab.winehq.org/wine/wine/-/blob/4a3c7e2758ac10b7947e859015f2a755d... `native_machine` is set to `IMAGE_FILE_MACHINE_I386`. `current_machine` is set to `IMAGE_FILE_MACHINE_AMD64`. Found the issue: I first installed the 64 bit build and then the other one, resulting in a 32 bit `wineserver`. I got confused by the fact that you first have to build 64 bit and then 32 bit.
`ALSA lib conf.c:4004:(snd_config_hooks_call) Cannot open shared library libasound_module_conf_pulse.so (/usr/lib/i386-linux-gnu/alsa-lib/libasound_module_conf_pulse.so: cannot open shared object file: No such file or directory)`
Isn't it supposed to load 64 bit libraries?