Commit 5199420f authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

winepulse: Return offsets rather than ptrs to the strings.

This will make the Wow64 syscall rather simpler. Signed-off-by: 's avatarHuw Davies <huw@codeweavers.com> Signed-off-by: 's avatarJacek Caban <jacek@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 94d3e2b3
...@@ -457,13 +457,16 @@ HRESULT WINAPI AUDDRV_GetEndpointIDs(EDataFlow flow, WCHAR ***ids_out, GUID **ke ...@@ -457,13 +457,16 @@ HRESULT WINAPI AUDDRV_GetEndpointIDs(EDataFlow flow, WCHAR ***ids_out, GUID **ke
} }
for (i = 0; i < params.num; i++) { 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 *pulse_name = (char *)params.endpoints + params.endpoints[i].pulse_name;
unsigned int size = (wcslen(name) + 1) * sizeof(WCHAR);
if (!(ids[i] = HeapAlloc(GetProcessHeap(), 0, size))) { if (!(ids[i] = HeapAlloc(GetProcessHeap(), 0, size))) {
params.result = E_OUTOFMEMORY; params.result = E_OUTOFMEMORY;
break; break;
} }
memcpy(ids[i], params.endpoints[i].name, size); memcpy(ids[i], name, size);
get_device_guid(drv_key, flow, params.endpoints[i].pulse_name, &guids[i]); get_device_guid(drv_key, flow, pulse_name, &guids[i]);
} }
if (drv_key) if (drv_key)
RegCloseKey(drv_key); RegCloseKey(drv_key);
......
...@@ -253,12 +253,11 @@ static NTSTATUS pulse_get_endpoint_ids(void *args) ...@@ -253,12 +253,11 @@ static NTSTATUS pulse_get_endpoint_ids(void *args)
struct list *list = (params->flow == eRender) ? &g_phys_speakers : &g_phys_sources; struct list *list = (params->flow == eRender) ? &g_phys_speakers : &g_phys_sources;
struct endpoint *endpoint = params->endpoints; struct endpoint *endpoint = params->endpoints;
DWORD len, name_len, needed; DWORD len, name_len, needed;
unsigned int offset;
PhysDevice *dev; PhysDevice *dev;
char *ptr;
params->num = list_count(list); params->num = list_count(list);
needed = params->num * sizeof(*params->endpoints); offset = needed = params->num * sizeof(*params->endpoints);
ptr = (char*)(endpoint + params->num);
LIST_FOR_EACH_ENTRY(dev, list, PhysDevice, entry) { LIST_FOR_EACH_ENTRY(dev, list, PhysDevice, entry) {
name_len = lstrlenW(dev->name) + 1; name_len = lstrlenW(dev->name) + 1;
...@@ -266,12 +265,12 @@ static NTSTATUS pulse_get_endpoint_ids(void *args) ...@@ -266,12 +265,12 @@ static NTSTATUS pulse_get_endpoint_ids(void *args)
needed += name_len * sizeof(WCHAR) + ((len + 1) & ~1); needed += name_len * sizeof(WCHAR) + ((len + 1) & ~1);
if (needed <= params->size) { if (needed <= params->size) {
endpoint->name = (WCHAR*)ptr; endpoint->name = offset;
memcpy(endpoint->name, dev->name, name_len * sizeof(WCHAR)); memcpy((char *)params->endpoints + offset, dev->name, name_len * sizeof(WCHAR));
ptr += name_len * sizeof(WCHAR); offset += name_len * sizeof(WCHAR);
endpoint->pulse_name = ptr; endpoint->pulse_name = offset;
memcpy(endpoint->pulse_name, dev->pulse_name, len); memcpy((char *)params->endpoints + offset, dev->pulse_name, len);
ptr += (len + 1) & ~1; offset += (len + 1) & ~1;
endpoint++; endpoint++;
} }
} }
......
...@@ -41,8 +41,8 @@ struct pulse_config ...@@ -41,8 +41,8 @@ struct pulse_config
struct endpoint struct endpoint
{ {
WCHAR *name; unsigned int name;
char *pulse_name; unsigned int pulse_name;
}; };
struct main_loop_params struct main_loop_params
......
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