dsound: Make GlobalHandle() for the sound buffer failed.
Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com> Signed-off-by: Andrew Eikum <aeikum@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
e28638afcc
commit
70aeb7e4b0
|
@ -999,6 +999,7 @@ HRESULT secondarybuffer_create(DirectSoundDevice *device, const DSBUFFERDESC *ds
|
||||||
LPWAVEFORMATEX wfex = dsbd->lpwfxFormat;
|
LPWAVEFORMATEX wfex = dsbd->lpwfxFormat;
|
||||||
HRESULT err = DS_OK;
|
HRESULT err = DS_OK;
|
||||||
DWORD capf = 0;
|
DWORD capf = 0;
|
||||||
|
size_t bufsize;
|
||||||
|
|
||||||
TRACE("(%p,%p,%p)\n", device, dsbd, buffer);
|
TRACE("(%p,%p,%p)\n", device, dsbd, buffer);
|
||||||
|
|
||||||
|
@ -1054,19 +1055,15 @@ HRESULT secondarybuffer_create(DirectSoundDevice *device, const DSBUFFERDESC *ds
|
||||||
TRACE("capf = 0x%08x, device->drvcaps.dwFlags = 0x%08x\n", capf, device->drvcaps.dwFlags);
|
TRACE("capf = 0x%08x, device->drvcaps.dwFlags = 0x%08x\n", capf, device->drvcaps.dwFlags);
|
||||||
|
|
||||||
/* Allocate an empty buffer */
|
/* Allocate an empty buffer */
|
||||||
dsb->buffer = HeapAlloc(GetProcessHeap(),0,sizeof(*(dsb->buffer)));
|
bufsize = (sizeof(*(dsb->buffer)) + sizeof(void *) - 1) & ~(sizeof(void *) - 1);
|
||||||
|
dsb->buffer = HeapAlloc(GetProcessHeap(),0,bufsize + dsb->buflen);
|
||||||
if (!dsb->buffer) {
|
if (!dsb->buffer) {
|
||||||
IDirectSoundBuffer8_Release(&dsb->IDirectSoundBuffer8_iface);
|
IDirectSoundBuffer8_Release(&dsb->IDirectSoundBuffer8_iface);
|
||||||
return DSERR_OUTOFMEMORY;
|
return DSERR_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate system memory for buffer */
|
/* Allocate system memory for buffer */
|
||||||
dsb->buffer->memory = HeapAlloc(GetProcessHeap(),0,dsb->buflen);
|
dsb->buffer->memory = (BYTE *)dsb->buffer + bufsize;
|
||||||
if (!dsb->buffer->memory) {
|
|
||||||
WARN("out of memory\n");
|
|
||||||
IDirectSoundBuffer8_Release(&dsb->IDirectSoundBuffer8_iface);
|
|
||||||
return DSERR_OUTOFMEMORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
dsb->buffer->ref = 1;
|
dsb->buffer->ref = 1;
|
||||||
dsb->buffer->lockedbytes = 0;
|
dsb->buffer->lockedbytes = 0;
|
||||||
|
@ -1136,10 +1133,8 @@ void secondarybuffer_destroy(IDirectSoundBufferImpl *This)
|
||||||
|
|
||||||
This->buffer->ref--;
|
This->buffer->ref--;
|
||||||
list_remove(&This->entry);
|
list_remove(&This->entry);
|
||||||
if (This->buffer->ref == 0) {
|
if (This->buffer->ref == 0)
|
||||||
HeapFree(GetProcessHeap(), 0, This->buffer->memory);
|
|
||||||
HeapFree(GetProcessHeap(), 0, This->buffer);
|
HeapFree(GetProcessHeap(), 0, This->buffer);
|
||||||
}
|
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, This->notifies);
|
HeapFree(GetProcessHeap(), 0, This->notifies);
|
||||||
HeapFree(GetProcessHeap(), 0, This->pwfx);
|
HeapFree(GetProcessHeap(), 0, This->pwfx);
|
||||||
|
|
|
@ -1161,7 +1161,7 @@ static HRESULT test_duplicate(LPGUID lpGuid)
|
||||||
/* broken apps like Asuka 120% Return BURNING Fest,
|
/* broken apps like Asuka 120% Return BURNING Fest,
|
||||||
pass the pointer to GlobalHandle. */
|
pass the pointer to GlobalHandle. */
|
||||||
HGLOBAL hmem = GlobalHandle(buf);
|
HGLOBAL hmem = GlobalHandle(buf);
|
||||||
todo_wine ok(!hmem,"GlobalHandle should return NULL "
|
ok(!hmem,"GlobalHandle should return NULL "
|
||||||
"for buffer %p, got %p\n",buf,hmem);
|
"for buffer %p, got %p\n",buf,hmem);
|
||||||
}
|
}
|
||||||
ZeroMemory(buf,bufsize);
|
ZeroMemory(buf,bufsize);
|
||||||
|
|
Loading…
Reference in New Issue