Huw Davies : winecoreaudio: Limit Wow64 buffer allocations to 32-bit addresses.
Alexandre Julliard
julliard at winehq.org
Mon Apr 25 16:30:33 CDT 2022
Module: wine
Branch: master
Commit: c4682a0893e3b8dc42d7438afc9fa9b8234302b3
URL: https://source.winehq.org/git/wine.git/?a=commit;h=c4682a0893e3b8dc42d7438afc9fa9b8234302b3
Author: Huw Davies <huw at codeweavers.com>
Date: Mon Apr 25 07:58:36 2022 +0100
winecoreaudio: Limit Wow64 buffer allocations to 32-bit addresses.
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/winecoreaudio.drv/coreaudio.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/dlls/winecoreaudio.drv/coreaudio.c b/dlls/winecoreaudio.drv/coreaudio.c
index 955b7d2afaf..463a330eeda 100644
--- a/dlls/winecoreaudio.drv/coreaudio.c
+++ b/dlls/winecoreaudio.drv/coreaudio.c
@@ -615,6 +615,15 @@ 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 NTSTATUS create_stream(void *args)
{
struct create_stream_params *params = args;
@@ -685,8 +694,8 @@ static NTSTATUS create_stream(void *args)
}
size = stream->bufsize_frames * stream->fmt->nBlockAlign;
- if(NtAllocateVirtualMemory(GetCurrentProcess(), (void **)&stream->local_buffer, 0, &size,
- MEM_COMMIT, PAGE_READWRITE)){
+ if(NtAllocateVirtualMemory(GetCurrentProcess(), (void **)&stream->local_buffer, zero_bits(),
+ &size, MEM_COMMIT, PAGE_READWRITE)){
params->result = E_OUTOFMEMORY;
goto end;
}
@@ -1371,7 +1380,7 @@ static NTSTATUS get_render_buffer(void *args)
stream->tmp_buffer = NULL;
}
size = params->frames * stream->fmt->nBlockAlign;
- if(NtAllocateVirtualMemory(GetCurrentProcess(), (void **)&stream->tmp_buffer, 0,
+ if(NtAllocateVirtualMemory(GetCurrentProcess(), (void **)&stream->tmp_buffer, zero_bits(),
&size, MEM_COMMIT, PAGE_READWRITE)){
stream->tmp_buffer_frames = 0;
params->result = E_OUTOFMEMORY;
@@ -1469,7 +1478,7 @@ static NTSTATUS 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, 0,
+ NtAllocateVirtualMemory(GetCurrentProcess(), (void **)&stream->tmp_buffer, zero_bits(),
&size, MEM_COMMIT, PAGE_READWRITE);
}
*params->data = stream->tmp_buffer;
More information about the wine-cvs
mailing list