From: Brendan Shanks bshanks@codeweavers.com
--- dlls/winecoreaudio.drv/coreaudio.c | 35 ++++++++++++++++++------------ 1 file changed, 21 insertions(+), 14 deletions(-)
diff --git a/dlls/winecoreaudio.drv/coreaudio.c b/dlls/winecoreaudio.drv/coreaudio.c index 1e712a624cb..fcf02401429 100644 --- a/dlls/winecoreaudio.drv/coreaudio.c +++ b/dlls/winecoreaudio.drv/coreaudio.c @@ -103,6 +103,8 @@ struct coreaudio_stream static const REFERENCE_TIME def_period = 100000; static const REFERENCE_TIME min_period = 50000;
+static ULONG_PTR zero_bits = 0; + static NTSTATUS unix_not_implemented(void *args) { return STATUS_SUCCESS; @@ -196,6 +198,20 @@ static BOOL device_has_channels(AudioDeviceID device, EDataFlow flow) return ret; }
+static NTSTATUS unix_process_attach(void *args) +{ +#ifdef _WIN64 + if (NtCurrentTeb()->WowTebOffset) + { + SYSTEM_BASIC_INFORMATION info; + + NtQuerySystemInformation(SystemEmulationBasicInformation, &info, sizeof(info), NULL); + zero_bits = (ULONG_PTR)info.HighestUserAddress | 0x7fffffff; + } +#endif + return STATUS_SUCCESS; +} + static NTSTATUS unix_main_loop(void *args) { struct main_loop_params *params = args; @@ -639,15 +655,6 @@ static HRESULT ca_setup_audiounit(EDataFlow dataflow, AudioComponentInstance uni return S_OK; }
-static ULONG_PTR zero_bits(void) -{ -#ifdef _WIN64 - return !NtCurrentTeb()->WowTebOffset ? 0 : 0x7fffffff; -#else - return 0; -#endif -} - static AudioDeviceID dev_id_from_device(const char *device) { return strtoul(device, NULL, 10); @@ -757,7 +764,7 @@ static NTSTATUS unix_create_stream(void *args) }
size = stream->bufsize_frames * stream->fmt->nBlockAlign; - if(NtAllocateVirtualMemory(GetCurrentProcess(), (void **)&stream->local_buffer, zero_bits(), + if(NtAllocateVirtualMemory(GetCurrentProcess(), (void **)&stream->local_buffer, zero_bits, &size, MEM_COMMIT, PAGE_READWRITE)){ params->result = E_OUTOFMEMORY; goto end; @@ -1497,7 +1504,7 @@ static NTSTATUS unix_get_render_buffer(void *args) stream->tmp_buffer = NULL; } size = params->frames * stream->fmt->nBlockAlign; - if(NtAllocateVirtualMemory(GetCurrentProcess(), (void **)&stream->tmp_buffer, zero_bits(), + if(NtAllocateVirtualMemory(GetCurrentProcess(), (void **)&stream->tmp_buffer, zero_bits, &size, MEM_COMMIT, PAGE_READWRITE)){ stream->tmp_buffer_frames = 0; params->result = E_OUTOFMEMORY; @@ -1595,7 +1602,7 @@ static NTSTATUS unix_get_capture_buffer(void *args) chunk_bytes = chunk_frames * stream->fmt->nBlockAlign; if(!stream->tmp_buffer){ size = stream->period_frames * stream->fmt->nBlockAlign; - NtAllocateVirtualMemory(GetCurrentProcess(), (void **)&stream->tmp_buffer, zero_bits(), + NtAllocateVirtualMemory(GetCurrentProcess(), (void **)&stream->tmp_buffer, zero_bits, &size, MEM_COMMIT, PAGE_READWRITE); } *params->data = stream->tmp_buffer; @@ -1782,7 +1789,7 @@ static NTSTATUS unix_set_event_handle(void *args)
unixlib_entry_t __wine_unix_call_funcs[] = { - unix_not_implemented, + unix_process_attach, unix_not_implemented, unix_main_loop, unix_get_endpoint_ids, @@ -2177,7 +2184,7 @@ static NTSTATUS unix_wow64_set_event_handle(void *args)
unixlib_entry_t __wine_unix_call_wow64_funcs[] = { - unix_not_implemented, + unix_process_attach, unix_not_implemented, unix_wow64_main_loop, unix_wow64_get_endpoint_ids,
From: Brendan Shanks bshanks@codeweavers.com
--- dlls/winealsa.drv/alsa.c | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-)
diff --git a/dlls/winealsa.drv/alsa.c b/dlls/winealsa.drv/alsa.c index 0f2211d77e7..17737012579 100644 --- a/dlls/winealsa.drv/alsa.c +++ b/dlls/winealsa.drv/alsa.c @@ -91,6 +91,8 @@ static const WCHAR drv_keyW[] = {'S','o','f','t','w','a','r','e','\', 'W','i','n','e','\','D','r','i','v','e','r','s','\', 'w','i','n','e','a','l','s','a','.','d','r','v'};
+static ULONG_PTR zero_bits = 0; + static NTSTATUS alsa_not_implemented(void *args) { return STATUS_SUCCESS; @@ -476,6 +478,20 @@ static WCHAR *alsa_get_card_name(int card) return ret; }
+static NTSTATUS alsa_process_attach(void *args) +{ +#ifdef _WIN64 + if (NtCurrentTeb()->WowTebOffset) + { + SYSTEM_BASIC_INFORMATION info; + + NtQuerySystemInformation(SystemEmulationBasicInformation, &info, sizeof(info), NULL); + zero_bits = (ULONG_PTR)info.HighestUserAddress | 0x7fffffff; + } +#endif + return STATUS_SUCCESS; +} + static NTSTATUS alsa_main_loop(void *args) { struct main_loop_params *params = args; @@ -781,15 +797,6 @@ static void silence_buffer(struct alsa_stream *stream, BYTE *buffer, UINT32 fram memset(buffer, 0, frames * stream->fmt->nBlockAlign); }
-static ULONG_PTR zero_bits(void) -{ -#ifdef _WIN64 - return !NtCurrentTeb()->WowTebOffset ? 0 : 0x7fffffff; -#else - return 0; -#endif -} - static NTSTATUS alsa_create_stream(void *args) { struct create_stream_params *params = args; @@ -1004,7 +1011,7 @@ static NTSTATUS alsa_create_stream(void *args) stream->fmt = &fmtex->Format;
size = stream->bufsize_frames * params->fmt->nBlockAlign; - if(NtAllocateVirtualMemory(GetCurrentProcess(), (void **)&stream->local_buffer, zero_bits(), &size, + if(NtAllocateVirtualMemory(GetCurrentProcess(), (void **)&stream->local_buffer, zero_bits, &size, MEM_COMMIT, PAGE_READWRITE)){ params->result = E_OUTOFMEMORY; goto exit; @@ -1718,7 +1725,7 @@ static NTSTATUS alsa_get_render_buffer(void *args) stream->tmp_buffer = NULL; } size = frames * stream->fmt->nBlockAlign; - if(NtAllocateVirtualMemory(GetCurrentProcess(), (void **)&stream->tmp_buffer, zero_bits(), &size, + if(NtAllocateVirtualMemory(GetCurrentProcess(), (void **)&stream->tmp_buffer, zero_bits, &size, MEM_COMMIT, PAGE_READWRITE)){ stream->tmp_buffer_frames = 0; return alsa_unlock_result(stream, ¶ms->result, E_OUTOFMEMORY); @@ -1821,7 +1828,7 @@ static NTSTATUS alsa_get_capture_buffer(void *args) stream->tmp_buffer = NULL; } size = *frames * stream->fmt->nBlockAlign; - if(NtAllocateVirtualMemory(GetCurrentProcess(), (void **)&stream->tmp_buffer, zero_bits(), &size, + if(NtAllocateVirtualMemory(GetCurrentProcess(), (void **)&stream->tmp_buffer, zero_bits, &size, MEM_COMMIT, PAGE_READWRITE)){ stream->tmp_buffer_frames = 0; return alsa_unlock_result(stream, ¶ms->result, E_OUTOFMEMORY); @@ -2499,7 +2506,7 @@ static NTSTATUS alsa_get_prop_value(void *args)
unixlib_entry_t __wine_unix_call_funcs[] = { - alsa_not_implemented, + alsa_process_attach, alsa_not_implemented, alsa_main_loop, alsa_get_endpoint_ids, @@ -2953,7 +2960,7 @@ static NTSTATUS alsa_wow64_get_prop_value(void *args)
unixlib_entry_t __wine_unix_call_wow64_funcs[] = { - alsa_not_implemented, + alsa_process_attach, alsa_not_implemented, alsa_wow64_main_loop, alsa_wow64_get_endpoint_ids,
From: Brendan Shanks bshanks@codeweavers.com
--- dlls/wineoss.drv/oss.c | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-)
diff --git a/dlls/wineoss.drv/oss.c b/dlls/wineoss.drv/oss.c index 2097137f749..097e048d03b 100644 --- a/dlls/wineoss.drv/oss.c +++ b/dlls/wineoss.drv/oss.c @@ -72,6 +72,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(oss); static const REFERENCE_TIME def_period = 100000; static const REFERENCE_TIME min_period = 50000;
+static ULONG_PTR zero_bits = 0; + static NTSTATUS oss_not_implemented(void *args) { return STATUS_SUCCESS; @@ -221,6 +223,20 @@ static void get_default_device(EDataFlow flow, char device[OSS_DEVNODE_SIZE]) return; }
+static NTSTATUS oss_process_attach(void *args) +{ +#ifdef _WIN64 + if (NtCurrentTeb()->WowTebOffset) + { + SYSTEM_BASIC_INFORMATION info; + + NtQuerySystemInformation(SystemEmulationBasicInformation, &info, sizeof(info), NULL); + zero_bits = (ULONG_PTR)info.HighestUserAddress | 0x7fffffff; + } +#endif + return STATUS_SUCCESS; +} + static NTSTATUS oss_main_loop(void *args) { struct main_loop_params *params = args; @@ -550,15 +566,6 @@ static HRESULT setup_oss_device(AUDCLNT_SHAREMODE share, int fd, return ret; }
-static ULONG_PTR zero_bits(void) -{ -#ifdef _WIN64 - return !NtCurrentTeb()->WowTebOffset ? 0 : 0x7fffffff; -#else - return 0; -#endif -} - static NTSTATUS oss_create_stream(void *args) { struct create_stream_params *params = args; @@ -653,7 +660,7 @@ static NTSTATUS oss_create_stream(void *args) if(params->share == AUDCLNT_SHAREMODE_EXCLUSIVE) stream->bufsize_frames -= stream->bufsize_frames % stream->period_frames; size = stream->bufsize_frames * params->fmt->nBlockAlign; - if(NtAllocateVirtualMemory(GetCurrentProcess(), (void **)&stream->local_buffer, zero_bits(), + if(NtAllocateVirtualMemory(GetCurrentProcess(), (void **)&stream->local_buffer, zero_bits, &size, MEM_COMMIT, PAGE_READWRITE)){ params->result = E_OUTOFMEMORY; goto exit; @@ -988,7 +995,7 @@ static NTSTATUS oss_get_render_buffer(void *args) stream->tmp_buffer = NULL; } size = frames * stream->fmt->nBlockAlign; - if(NtAllocateVirtualMemory(GetCurrentProcess(), (void **)&stream->tmp_buffer, zero_bits(), + if(NtAllocateVirtualMemory(GetCurrentProcess(), (void **)&stream->tmp_buffer, zero_bits, &size, MEM_COMMIT, PAGE_READWRITE)){ stream->tmp_buffer_frames = 0; return oss_unlock_result(stream, ¶ms->result, E_OUTOFMEMORY); @@ -1098,7 +1105,7 @@ static NTSTATUS oss_get_capture_buffer(void *args) stream->tmp_buffer = NULL; } size = *frames * stream->fmt->nBlockAlign; - if(NtAllocateVirtualMemory(GetCurrentProcess(), (void **)&stream->tmp_buffer, zero_bits(), + if(NtAllocateVirtualMemory(GetCurrentProcess(), (void **)&stream->tmp_buffer, zero_bits, &size, MEM_COMMIT, PAGE_READWRITE)){ stream->tmp_buffer_frames = 0; return oss_unlock_result(stream, ¶ms->result, E_OUTOFMEMORY); @@ -1690,7 +1697,7 @@ static NTSTATUS oss_aux_message(void *args)
unixlib_entry_t __wine_unix_call_funcs[] = { - oss_not_implemented, + oss_process_attach, oss_not_implemented, oss_main_loop, oss_get_endpoint_ids, @@ -2127,7 +2134,7 @@ static NTSTATUS oss_wow64_aux_message(void *args)
unixlib_entry_t __wine_unix_call_wow64_funcs[] = { - oss_not_implemented, + oss_process_attach, oss_not_implemented, oss_wow64_main_loop, oss_wow64_get_endpoint_ids,
From: Brendan Shanks bshanks@codeweavers.com
--- dlls/winepulse.drv/pulse.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-)
diff --git a/dlls/winepulse.drv/pulse.c b/dlls/winepulse.drv/pulse.c index ab49a4cc320..0e587033a6d 100644 --- a/dlls/winepulse.drv/pulse.c +++ b/dlls/winepulse.drv/pulse.c @@ -119,6 +119,8 @@ static const REFERENCE_TIME DefaultPeriod = 100000; static pthread_mutex_t pulse_mutex; static pthread_cond_t pulse_cond = PTHREAD_COND_INITIALIZER;
+static ULONG_PTR zero_bits = 0; + static NTSTATUS pulse_not_implemented(void *args) { return STATUS_SUCCESS; @@ -237,6 +239,16 @@ static NTSTATUS pulse_process_attach(void *args) if (pthread_mutex_init(&pulse_mutex, &attr) != 0) pthread_mutex_init(&pulse_mutex, NULL);
+#ifdef _WIN64 + if (NtCurrentTeb()->WowTebOffset) + { + SYSTEM_BASIC_INFORMATION info; + + NtQuerySystemInformation(SystemEmulationBasicInformation, &info, sizeof(info), NULL); + zero_bits = (ULONG_PTR)info.HighestUserAddress | 0x7fffffff; + } +#endif + return STATUS_SUCCESS; }
@@ -1077,15 +1089,6 @@ static HRESULT pulse_stream_connect(struct pulse_stream *stream, const char *pul return S_OK; }
-static ULONG_PTR zero_bits(void) -{ -#ifdef _WIN64 - return !NtCurrentTeb()->WowTebOffset ? 0 : 0x7fffffff; -#else - return 0; -#endif -} - static HRESULT get_device_period_helper(EDataFlow flow, const char *pulse_name, REFERENCE_TIME *def, REFERENCE_TIME *min) { struct list *list = (flow == eRender) ? &g_phys_speakers : &g_phys_sources; @@ -1183,7 +1186,7 @@ static NTSTATUS pulse_create_stream(void *args) size = stream->real_bufsize_bytes = stream->bufsize_frames * 2 * pa_frame_size(&stream->ss); if (NtAllocateVirtualMemory(GetCurrentProcess(), (void **)&stream->local_buffer, - zero_bits(), &size, MEM_COMMIT, PAGE_READWRITE)) + zero_bits, &size, MEM_COMMIT, PAGE_READWRITE)) hr = E_OUTOFMEMORY; } else { UINT32 i, capture_packets; @@ -1197,7 +1200,7 @@ static NTSTATUS pulse_create_stream(void *args)
size = stream->real_bufsize_bytes + capture_packets * sizeof(ACPacket); if (NtAllocateVirtualMemory(GetCurrentProcess(), (void **)&stream->local_buffer, - zero_bits(), &size, MEM_COMMIT, PAGE_READWRITE)) + zero_bits, &size, MEM_COMMIT, PAGE_READWRITE)) hr = E_OUTOFMEMORY; else { ACPacket *cur_packet = (ACPacket*)((char*)stream->local_buffer + stream->real_bufsize_bytes); @@ -1841,7 +1844,7 @@ static BOOL alloc_tmp_buffer(struct pulse_stream *stream, SIZE_T bytes) stream->tmp_buffer_bytes = 0; } if (NtAllocateVirtualMemory(GetCurrentProcess(), (void **)&stream->tmp_buffer, - zero_bits(), &bytes, MEM_COMMIT, PAGE_READWRITE)) + zero_bits, &bytes, MEM_COMMIT, PAGE_READWRITE)) return FALSE;
stream->tmp_buffer_bytes = bytes;
This merge request was approved by Huw Davies.