This will make the Wow64 syscall rather simpler.
Signed-off-by: Huw Davies huw@codeweavers.com --- dlls/winecoreaudio.drv/coreaudio.c | 14 +++++++------- dlls/winecoreaudio.drv/mmdevdrv.c | 6 ++++-- dlls/winecoreaudio.drv/unixlib.h | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/dlls/winecoreaudio.drv/coreaudio.c b/dlls/winecoreaudio.drv/coreaudio.c index 901c58e5276..955b7d2afaf 100644 --- a/dlls/winecoreaudio.drv/coreaudio.c +++ b/dlls/winecoreaudio.drv/coreaudio.c @@ -185,7 +185,7 @@ static BOOL device_has_channels(AudioDeviceID device, EDataFlow flow) static NTSTATUS get_endpoint_ids(void *args) { struct get_endpoint_ids_params *params = args; - unsigned int num_devices, i, needed; + unsigned int num_devices, i, needed, offset; AudioDeviceID *devices, default_id; AudioObjectPropertyAddress addr; struct endpoint *endpoint; @@ -196,7 +196,7 @@ static NTSTATUS get_endpoint_ids(void *args) AudioDeviceID id; } *info; OSStatus sc; - WCHAR *ptr; + UniChar *ptr;
params->num = 0; params->default_idx = 0; @@ -262,21 +262,21 @@ static NTSTATUS get_endpoint_ids(void *args) } free(devices);
- needed = sizeof(*endpoint) * params->num; + offset = needed = sizeof(*endpoint) * params->num; endpoint = params->endpoints; - ptr = (WCHAR *)(endpoint + params->num);
for(i = 0; i < params->num; i++){ SIZE_T len = CFStringGetLength(info[i].name); needed += (len + 1) * sizeof(WCHAR);
if(needed <= params->size){ - endpoint->name = ptr; - CFStringGetCharacters(info[i].name, CFRangeMake(0, len), (UniChar*)endpoint->name); + endpoint->name = offset; + ptr = (UniChar *)((char *)params->endpoints + offset); + CFStringGetCharacters(info[i].name, CFRangeMake(0, len), ptr); ptr[len] = 0; endpoint->id = info[i].id; endpoint++; - ptr += len + 1; + offset += (len + 1) * sizeof(WCHAR); } CFRelease(info[i].name); if(info[i].id == default_id) params->default_idx = i; diff --git a/dlls/winecoreaudio.drv/mmdevdrv.c b/dlls/winecoreaudio.drv/mmdevdrv.c index cc7b2e5bf49..acdc0891a11 100644 --- a/dlls/winecoreaudio.drv/mmdevdrv.c +++ b/dlls/winecoreaudio.drv/mmdevdrv.c @@ -341,13 +341,15 @@ HRESULT WINAPI AUDDRV_GetEndpointIDs(EDataFlow flow, WCHAR ***ids_out, }
for(i = 0; i < params.num; i++){ - int size = (wcslen(params.endpoints[i].name) + 1) * sizeof(WCHAR); + WCHAR *name = (WCHAR *)((char *)params.endpoints + params.endpoints[i].name); + int size = (wcslen(name) + 1) * sizeof(WCHAR); + ids[i] = heap_alloc(size); if(!ids[i]){ params.result = E_OUTOFMEMORY; goto end; } - memcpy(ids[i], params.endpoints[i].name, size); + memcpy(ids[i], name, size); get_device_guid(flow, params.endpoints[i].id, guids + i); } *def_index = params.default_idx; diff --git a/dlls/winecoreaudio.drv/unixlib.h b/dlls/winecoreaudio.drv/unixlib.h index 19b14c7f968..56b75a55b4c 100644 --- a/dlls/winecoreaudio.drv/unixlib.h +++ b/dlls/winecoreaudio.drv/unixlib.h @@ -23,7 +23,7 @@ typedef UINT64 stream_handle;
struct endpoint { - WCHAR *name; + unsigned int name; DWORD id; };