Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
f6f8123c
Commit
f6f8123c
authored
Aug 16, 2012
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Aug 16, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dsound: Cleanup error handling in IDirectSoundFullDuplex::Initialize().
parent
885e205a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
38 deletions
+46
-38
duplex.c
dlls/dsound/duplex.c
+42
-38
duplex.c
dlls/dsound/tests/duplex.c
+4
-0
No files found.
dlls/dsound/duplex.c
View file @
f6f8123c
...
...
@@ -530,75 +530,79 @@ IDirectSoundFullDuplexImpl_Release( LPDIRECTSOUNDFULLDUPLEX iface )
return
ref
;
}
static
HRESULT
WINAPI
IDirectSoundFullDuplexImpl_Initialize
(
LPDIRECTSOUNDFULLDUPLEX
iface
,
LPCGUID
pCaptureGuid
,
LPCGUID
pRendererGuid
,
LPCDSCBUFFERDESC
lpDscBufferDesc
,
LPCDSBUFFERDESC
lpDsBufferDesc
,
HWND
hWnd
,
DWORD
dwLevel
,
LPLPDIRECTSOUNDCAPTUREBUFFER8
lplpDirectSoundCaptureBuffer8
,
LPLPDIRECTSOUNDBUFFER8
lplpDirectSoundBuffer8
)
static
HRESULT
WINAPI
IDirectSoundFullDuplexImpl_Initialize
(
IDirectSoundFullDuplex
*
iface
,
const
GUID
*
capture_dev
,
const
GUID
*
render_dev
,
const
DSCBUFFERDESC
*
cbufdesc
,
const
DSBUFFERDESC
*
bufdesc
,
HWND
hwnd
,
DWORD
level
,
IDirectSoundCaptureBuffer8
**
dscb8
,
IDirectSoundBuffer8
**
dsb8
)
{
HRESULT
hr
;
IDirectSoundFullDuplexImpl
*
This
=
(
IDirectSoundFullDuplexImpl
*
)
iface
;
TRACE
(
"(%p,%s,%s,%p,%p,%p,%x,%p,%p)
\n
"
,
This
,
debugstr_guid
(
pCaptureGuid
),
debugstr_guid
(
pRendererGuid
),
lpDscBufferDesc
,
lpDsBufferDesc
,
hWnd
,
dwLevel
,
lplpDirectSoundCaptureBuffer8
,
lplpDirectSoundBuffer8
);
TRACE
(
"(%p,%s,%s,%p,%p,%p,%x,%p,%p)
\n
"
,
This
,
debugstr_guid
(
capture_dev
),
debugstr_guid
(
render_dev
),
cbufdesc
,
bufdesc
,
hwnd
,
level
,
dscb8
,
dsb8
);
if
(
!
dscb8
||
!
dsb8
)
return
E_INVALIDARG
;
*
dscb8
=
NULL
;
*
dsb8
=
NULL
;
if
(
This
->
renderer_device
!=
NULL
||
This
->
capture_device
!=
NULL
)
{
WARN
(
"already initialized
\n
"
);
*
lplpDirectSoundCaptureBuffer8
=
NULL
;
*
lplpDirectSoundBuffer8
=
NULL
;
return
DSERR_ALREADYINITIALIZED
;
}
hr
=
DSOUND_Create8
(
&
IID_IDirectSound8
,
(
void
**
)
&
This
->
renderer_device
);
if
(
SUCCEEDED
(
hr
))
hr
=
IDirectSound_Initialize
(
This
->
renderer_device
,
pRendererGuid
);
hr
=
IDirectSound_Initialize
(
This
->
renderer_device
,
render_dev
);
if
(
hr
!=
DS_OK
)
{
WARN
(
"DirectSoundDevice_Initialize() failed
\n
"
);
*
lplpDirectSoundCaptureBuffer8
=
NULL
;
*
lplpDirectSoundBuffer8
=
NULL
;
return
hr
;
goto
error
;
}
IDirectSound8_SetCooperativeLevel
(
This
->
renderer_device
,
h
Wnd
,
dwL
evel
);
IDirectSound8_SetCooperativeLevel
(
This
->
renderer_device
,
h
wnd
,
l
evel
);
hr
=
IDirectSound8_CreateSoundBuffer
(
This
->
renderer_device
,
lpDsBufferD
esc
,
(
IDirectSoundBuffer
**
)
lplpDirectSoundBuffer
8
,
NULL
);
hr
=
IDirectSound8_CreateSoundBuffer
(
This
->
renderer_device
,
bufd
esc
,
(
IDirectSoundBuffer
**
)
dsb
8
,
NULL
);
if
(
hr
!=
DS_OK
)
{
WARN
(
"IDirectSoundBufferImpl_Create() failed
\n
"
);
*
lplpDirectSoundCaptureBuffer8
=
NULL
;
*
lplpDirectSoundBuffer8
=
NULL
;
return
hr
;
goto
error
;
}
hr
=
DSOUND_CaptureCreate8
(
&
IID_IDirectSoundCapture8
,
(
void
**
)
&
This
->
capture_device
);
if
(
SUCCEEDED
(
hr
))
hr
=
IDirectSoundCapture_Initialize
(
This
->
capture_device
,
pCaptureGuid
);
hr
=
IDirectSoundCapture_Initialize
(
This
->
capture_device
,
capture_dev
);
if
(
hr
!=
DS_OK
)
{
WARN
(
"DirectSoundCaptureDevice_Initialize() failed
\n
"
);
*
lplpDirectSoundCaptureBuffer8
=
NULL
;
*
lplpDirectSoundBuffer8
=
NULL
;
return
hr
;
goto
error
;
}
hr
=
IDirectSoundCapture_CreateCaptureBuffer
(
This
->
capture_device
,
lpDscBufferDesc
,
(
IDirectSoundCaptureBuffer
**
)
lplpDirectSoundCaptureBuffer8
,
NULL
);
hr
=
IDirectSoundCapture_CreateCaptureBuffer
(
This
->
capture_device
,
cbufdesc
,
(
IDirectSoundCaptureBuffer
**
)
dscb8
,
NULL
);
if
(
hr
!=
DS_OK
)
{
WARN
(
"IDirectSoundCaptureBufferImpl_Create() failed
\n
"
);
*
lplpDirectSoundCaptureBuffer8
=
NULL
;
*
lplpDirectSoundBuffer8
=
NULL
;
return
hr
;
goto
error
;
}
return
DS_OK
;
error:
if
(
*
dsb8
)
{
IDirectSoundBuffer8_Release
(
*
dsb8
);
*
dsb8
=
NULL
;
}
if
(
This
->
renderer_device
)
{
IDirectSound8_Release
(
This
->
renderer_device
);
This
->
renderer_device
=
NULL
;
}
if
(
*
dscb8
)
{
IDirectSoundCaptureBuffer8_Release
(
*
dscb8
);
*
dscb8
=
NULL
;
}
if
(
This
->
capture_device
)
{
IDirectSoundCapture_Release
(
This
->
capture_device
);
This
->
capture_device
=
NULL
;
}
return
hr
;
}
...
...
dlls/dsound/tests/duplex.c
View file @
f6f8123c
...
...
@@ -280,6 +280,10 @@ static void test_COM(void)
cbufdesc
.
dwBufferBytes
=
wfx
.
nAvgBytesPerSec
;
cbufdesc
.
lpwfxFormat
=
&
wfx
;
hr
=
IDirectSoundFullDuplex_Initialize
(
dsfd
,
NULL
,
NULL
,
&
cbufdesc
,
&
bufdesc
,
get_hwnd
(),
DSSCL_EXCLUSIVE
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"IDirectSoundFullDuplex_Initialize failed: %08x, expected E_INVALIDARG
\n
"
,
hr
);
hr
=
IDirectSoundFullDuplex_Initialize
(
dsfd
,
NULL
,
NULL
,
&
cbufdesc
,
&
bufdesc
,
get_hwnd
(),
DSSCL_EXCLUSIVE
,
&
dscb8
,
&
dsb8
);
if
(
hr
==
DSERR_NODRIVER
)
{
skip
(
"No driver
\n
"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment