From 919ee6b699815f9d105184462643222a7bb67221 Mon Sep 17 00:00:00 2001 From: Robert Reif Date: Mon, 27 Feb 2006 07:34:01 -0500 Subject: [PATCH] dsound: Fix duplex create bug. --- dlls/dsound/duplex.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/dlls/dsound/duplex.c b/dlls/dsound/duplex.c index 7ba0eb6874c..3a10babd496 100644 --- a/dlls/dsound/duplex.c +++ b/dlls/dsound/duplex.c @@ -258,6 +258,12 @@ HRESULT IDirectSoundFullDuplex_IDirectSound_Create( return DSERR_INVALIDPARAM; } + if (((IDirectSoundFullDuplexImpl*)pdsfd)->renderer_device == NULL) { + WARN("not initialized\n"); + *ppds = NULL; + return DSERR_UNINITIALIZED; + } + pdsfdds = HeapAlloc(GetProcessHeap(),0,sizeof(*pdsfdds)); if (pdsfdds == NULL) { WARN("out of memory\n"); @@ -417,6 +423,12 @@ HRESULT IDirectSoundFullDuplex_IDirectSound8_Create( return DSERR_INVALIDPARAM; } + if (((IDirectSoundFullDuplexImpl*)pdsfd)->renderer_device == NULL) { + WARN("not initialized\n"); + *ppds8 = NULL; + return DSERR_UNINITIALIZED; + } + pdsfdds8 = HeapAlloc(GetProcessHeap(),0,sizeof(*pdsfdds8)); if (pdsfdds8 == NULL) { WARN("out of memory\n"); @@ -525,6 +537,12 @@ HRESULT IDirectSoundFullDuplex_IDirectSoundCapture_Create( return DSERR_INVALIDPARAM; } + if (((IDirectSoundFullDuplexImpl*)pdsfd)->capture_device == NULL) { + WARN("not initialized\n"); + *ppdsc8 = NULL; + return DSERR_UNINITIALIZED; + } + pdsfddsc = HeapAlloc(GetProcessHeap(),0,sizeof(*pdsfddsc)); if (pdsfddsc == NULL) { WARN("out of memory\n"); @@ -774,6 +792,8 @@ HRESULT DSOUND_FullDuplexCreate(LPDIRECTSOUNDFULLDUPLEX* ppDSFD, IUnknown *pUnkO This->capture_device = NULL; This->renderer_device = NULL; + *ppDSFD = (LPDIRECTSOUNDFULLDUPLEX)This; + return DS_OK; }