This will make the Wow64 syscall rather simpler.
Signed-off-by: Huw Davies huw@codeweavers.com --- dlls/winealsa.drv/alsa.c | 26 +++++++++++++++----------- dlls/winealsa.drv/mmdevdrv.c | 9 ++++++--- dlls/winealsa.drv/unixlib.h | 4 ++-- 3 files changed, 23 insertions(+), 16 deletions(-)
diff --git a/dlls/winealsa.drv/alsa.c b/dlls/winealsa.drv/alsa.c index 9cf99f5b459..0e86185e441 100644 --- a/dlls/winealsa.drv/alsa.c +++ b/dlls/winealsa.drv/alsa.c @@ -291,10 +291,16 @@ static WCHAR *construct_device_id(EDataFlow flow, const WCHAR *chunk1, const WCH return ret; }
+struct endpt +{ + WCHAR *name; + char *device; +}; + struct endpoints_info { unsigned int num, size; - struct endpoint *endpoints; + struct endpt *endpoints; };
static void endpoints_add(struct endpoints_info *endpoints, WCHAR *name, char *device) @@ -467,10 +473,9 @@ static NTSTATUS get_endpoint_ids(void *args) static const WCHAR defaultW[] = {'d','e','f','a','u','l','t',0}; struct get_endpoint_ids_params *params = args; struct endpoints_info endpoints_info; - unsigned int i, needed, name_len, device_len; + unsigned int i, needed, name_len, device_len, offset; struct endpoint *endpoint; int err, card; - char *ptr;
card = -1;
@@ -505,9 +510,8 @@ static NTSTATUS get_endpoint_ids(void *args) if(err != 0) WARN("Got a failure during card enumeration: %d (%s)\n", err, snd_strerror(err));
- needed = endpoints_info.num * sizeof(*params->endpoints); + offset = needed = endpoints_info.num * sizeof(*params->endpoints); endpoint = params->endpoints; - ptr = (char *)(endpoint + endpoints_info.num);
for(i = 0; i < endpoints_info.num; i++){ name_len = wcslen(endpoints_info.endpoints[i].name) + 1; @@ -515,12 +519,12 @@ static NTSTATUS get_endpoint_ids(void *args) needed += name_len * sizeof(WCHAR) + ((device_len + 1) & ~1);
if(needed <= params->size){ - endpoint->name = (WCHAR *)ptr; - memcpy(endpoint->name, endpoints_info.endpoints[i].name, name_len * sizeof(WCHAR)); - ptr += name_len * sizeof(WCHAR); - endpoint->device = ptr; - memcpy(endpoint->device, endpoints_info.endpoints[i].device, device_len); - ptr += (device_len + 1) & ~1; + endpoint->name = offset; + memcpy((char *)params->endpoints + offset, endpoints_info.endpoints[i].name, name_len * sizeof(WCHAR)); + offset += name_len * sizeof(WCHAR); + endpoint->device = offset; + memcpy((char *)params->endpoints + offset, endpoints_info.endpoints[i].device, device_len); + offset += (device_len + 1) & ~1; endpoint++; } free(endpoints_info.endpoints[i].name); diff --git a/dlls/winealsa.drv/mmdevdrv.c b/dlls/winealsa.drv/mmdevdrv.c index 24e778db931..1a99f0ac26c 100644 --- a/dlls/winealsa.drv/mmdevdrv.c +++ b/dlls/winealsa.drv/mmdevdrv.c @@ -366,14 +366,17 @@ HRESULT WINAPI AUDDRV_GetEndpointIDs(EDataFlow flow, WCHAR ***ids_out, GUID **gu }
for(i = 0; i < params.num; i++){ - unsigned int size = (wcslen(params.endpoints[i].name) + 1) * sizeof(WCHAR); + WCHAR *name = (WCHAR *)((char *)params.endpoints + params.endpoints[i].name); + char *device = (char *)params.endpoints + params.endpoints[i].device; + unsigned int size = (wcslen(name) + 1) * sizeof(WCHAR); + ids[i] = HeapAlloc(GetProcessHeap(), 0, size); if(!ids[i]){ params.result = E_OUTOFMEMORY; goto end; } - memcpy(ids[i], params.endpoints[i].name, size); - get_device_guid(flow, params.endpoints[i].device, guids + i); + memcpy(ids[i], name, size); + get_device_guid(flow, device, guids + i); } *def_index = params.default_idx;
diff --git a/dlls/winealsa.drv/unixlib.h b/dlls/winealsa.drv/unixlib.h index ed769d81948..56507ef9f0a 100644 --- a/dlls/winealsa.drv/unixlib.h +++ b/dlls/winealsa.drv/unixlib.h @@ -22,8 +22,8 @@ typedef UINT64 stream_handle;
struct endpoint { - WCHAR *name; - char *device; + unsigned int name; + unsigned int device; };
struct get_endpoint_ids_params