Huw Davies : winepulse: Limit Wow64 buffer allocations to 32-bit addresses.
Module: wine Branch: master Commit: 27cb3324df31af00be16f9262780e3a538a68cc2 URL: https://source.winehq.org/git/wine.git/?a=commit;h=27cb3324df31af00be16f9262... Author: Huw Davies <huw(a)codeweavers.com> Date: Thu Apr 21 15:51:57 2022 +0100 winepulse: Limit Wow64 buffer allocations to 32-bit addresses. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winepulse.drv/pulse.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/dlls/winepulse.drv/pulse.c b/dlls/winepulse.drv/pulse.c index 06047a21944..9a205915b70 100644 --- a/dlls/winepulse.drv/pulse.c +++ b/dlls/winepulse.drv/pulse.c @@ -981,6 +981,15 @@ 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 NTSTATUS pulse_create_stream(void *args) { struct create_stream_params *params = args; @@ -1039,7 +1048,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, - 0, &size, MEM_COMMIT, PAGE_READWRITE)) + zero_bits(), &size, MEM_COMMIT, PAGE_READWRITE)) hr = E_OUTOFMEMORY; } else { UINT32 i, capture_packets; @@ -1053,7 +1062,7 @@ static NTSTATUS pulse_create_stream(void *args) size = stream->real_bufsize_bytes + capture_packets * sizeof(ACPacket); if (NtAllocateVirtualMemory(GetCurrentProcess(), (void **)&stream->local_buffer, - 0, &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); @@ -1697,7 +1706,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, - 0, &bytes, MEM_COMMIT, PAGE_READWRITE)) + zero_bits(), &bytes, MEM_COMMIT, PAGE_READWRITE)) return FALSE; stream->tmp_buffer_bytes = bytes;
participants (1)
-
Alexandre Julliard