In v2, remove an unreliable conformance test. It crashes on x64 Windows.
I think GlobalHandle() does the right thing here because it should succeed if the buffer is allocated by GlobalAlloc(GMEM_FIXED) or HeapAlloc(). Therefore, dsound needs to be fixed.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48635 Signed-off-by: Akihiro Sagawa sagawa.aki@gmail.com --- dlls/dsound/buffer.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-)
On Wed, Feb 26, 2020 at 09:43:03PM +0900, Akihiro Sagawa wrote:
In v2, remove an unreliable conformance test. It crashes on x64 Windows.
Would it be possible to add the test for 32-bit only? Without a test I worry we could lose this change in a future patch.
diff --git a/dlls/dsound/buffer.c b/dlls/dsound/buffer.c index 8d4a3b9..b019b0d 100644 --- a/dlls/dsound/buffer.c +++ b/dlls/dsound/buffer.c @@ -1054,19 +1054,15 @@ HRESULT secondarybuffer_create(DirectSoundDevice *device, const DSBUFFERDESC *ds TRACE("capf = 0x%08x, device->drvcaps.dwFlags = 0x%08x\n", capf, device->drvcaps.dwFlags);
/* Allocate an empty buffer */
- dsb->buffer = HeapAlloc(GetProcessHeap(),0,sizeof(*(dsb->buffer)));
- dsb->buffer = HeapAlloc(GetProcessHeap(),0,sizeof(*(dsb->buffer)) + dsb->buflen); if (!dsb->buffer) { IDirectSoundBuffer8_Release(&dsb->IDirectSoundBuffer8_iface); return DSERR_OUTOFMEMORY; }
- /* Allocate system memory for buffer */
- dsb->buffer->memory = HeapAlloc(GetProcessHeap(),0,dsb->buflen);
if (!dsb->buffer->memory) {
WARN("out of memory\n");
IDirectSoundBuffer8_Release(&dsb->IDirectSoundBuffer8_iface);
return DSERR_OUTOFMEMORY;
- }
- /* Assign subsequent memory for buffer
to make GlobalHandle(dsb->buffer->memory) call fail */
- dsb->buffer->memory = (LPBYTE)dsb->buffer + sizeof(*(dsb->buffer));
I think we need to make sure memory is aligned -- e.g. round up the size of dst->buffer to nearest alignment. Or, some other solution might be more elegant; Zeb suggested VirtualAlloc might solve this?
Andrew