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
ec2a7a32
Commit
ec2a7a32
authored
Sep 04, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
Sep 06, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dmsynth: Move constructor parameter checks to class factory.
parent
8ee23728
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
30 deletions
+32
-30
dmsynth_main.c
dlls/dmsynth/dmsynth_main.c
+17
-11
dmsynth_private.h
dlls/dmsynth/dmsynth_private.h
+2
-2
synth.c
dlls/dmsynth/synth.c
+7
-9
synthsink.c
dlls/dmsynth/synthsink.c
+6
-8
No files found.
dlls/dmsynth/dmsynth_main.c
View file @
ec2a7a32
...
...
@@ -27,7 +27,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(dmsynth);
typedef
struct
{
IClassFactory
IClassFactory_iface
;
HRESULT
(
*
fnCreateInstance
)(
REFIID
riid
,
void
**
ppv
);
HRESULT
(
*
create_instance
)(
IUnknown
**
ret_iface
);
}
IClassFactoryImpl
;
/******************************************************************
...
...
@@ -68,17 +68,24 @@ static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
return
1
;
/* non-heap based object */
}
static
HRESULT
WINAPI
ClassFactory_CreateInstance
(
IClassFactory
*
iface
,
IUnknown
*
pUnkO
uter
,
REFIID
riid
,
void
**
ppv
)
static
HRESULT
WINAPI
ClassFactory_CreateInstance
(
IClassFactory
*
iface
,
IUnknown
*
unk_o
uter
,
REFIID
riid
,
void
**
ret_iface
)
{
IClassFactoryImpl
*
This
=
impl_from_IClassFactory
(
iface
);
IClassFactoryImpl
*
This
=
impl_from_IClassFactory
(
iface
);
IUnknown
*
object
;
HRESULT
hr
;
TRACE
(
"(%p, %s, %p)
\n
"
,
pUnkOuter
,
debugstr_dmguid
(
riid
),
ppv
);
TRACE
(
"(%p, %s, %p)
\n
"
,
unk_outer
,
debugstr_dmguid
(
riid
),
ret_iface
);
if
(
pUnkOuter
)
return
CLASS_E_NOAGGREGATION
;
*
ret_iface
=
NULL
;
if
(
unk_outer
)
return
CLASS_E_NOAGGREGATION
;
if
(
SUCCEEDED
(
hr
=
This
->
create_instance
(
&
object
)))
{
hr
=
IUnknown_QueryInterface
(
object
,
riid
,
ret_iface
);
IUnknown_Release
(
object
);
}
return
This
->
fnCreateInstance
(
riid
,
ppv
)
;
return
hr
;
}
static
HRESULT
WINAPI
ClassFactory_LockServer
(
IClassFactory
*
iface
,
BOOL
dolock
)
...
...
@@ -95,9 +102,8 @@ static const IClassFactoryVtbl classfactory_vtbl = {
ClassFactory_LockServer
};
static
IClassFactoryImpl
Synth_CF
=
{{
&
classfactory_vtbl
},
DMUSIC_CreateDirectMusicSynthImpl
};
static
IClassFactoryImpl
SynthSink_CF
=
{{
&
classfactory_vtbl
},
DMUSIC_CreateDirectMusicSynthSinkImpl
};
static
IClassFactoryImpl
Synth_CF
=
{{
&
classfactory_vtbl
},
synth_create
};
static
IClassFactoryImpl
SynthSink_CF
=
{{
&
classfactory_vtbl
},
synth_sink_create
};
/******************************************************************
...
...
dlls/dmsynth/dmsynth_private.h
View file @
ec2a7a32
...
...
@@ -43,8 +43,8 @@
/*****************************************************************************
* ClassFactory
*/
extern
HRESULT
DMUSIC_CreateDirectMusicSynthImpl
(
REFIID
riid
,
void
**
ppobj
);
extern
HRESULT
DMUSIC_CreateDirectMusicSynthSinkImpl
(
REFIID
riid
,
void
**
ppobj
);
extern
HRESULT
synth_create
(
IUnknown
**
ret_iface
);
extern
HRESULT
synth_sink_create
(
IUnknown
**
ret_iface
);
/*****************************************************************************
* Misc.
...
...
dlls/dmsynth/synth.c
View file @
ec2a7a32
...
...
@@ -737,19 +737,18 @@ static const IKsControlVtbl synth_control_vtbl =
synth_control_KsEvent
,
};
HRESULT
DMUSIC_CreateDirectMusicSynthImpl
(
REFIID
riid
,
void
**
ppobj
)
HRESULT
synth_create
(
IUnknown
**
ret_iface
)
{
struct
synth
*
obj
;
HRESULT
hr
;
TRACE
(
"(%
s, %p)
\n
"
,
debugstr_guid
(
riid
),
ppobj
);
TRACE
(
"(%
p)
\n
"
,
ret_iface
);
*
ppobj
=
NULL
;
*
ret_iface
=
NULL
;
if
(
!
(
obj
=
calloc
(
1
,
sizeof
(
*
obj
))))
return
E_OUTOFMEMORY
;
obj
->
IDirectMusicSynth8_iface
.
lpVtbl
=
&
synth_vtbl
;
obj
->
IKsControl_iface
.
lpVtbl
=
&
synth_control_vtbl
;
obj
->
ref
=
1
;
/* fill in caps */
obj
->
caps
.
dwSize
=
sizeof
(
DMUS_PORTCAPS
);
obj
->
caps
.
dwFlags
=
DMUS_PC_DLS
|
DMUS_PC_SOFTWARESYNTH
|
DMUS_PC_DIRECTSOUND
|
DMUS_PC_DLS2
|
DMUS_PC_AUDIOPATH
|
DMUS_PC_WAVE
;
obj
->
caps
.
guidPort
=
CLSID_DirectMusicSynth
;
...
...
@@ -762,8 +761,7 @@ HRESULT DMUSIC_CreateDirectMusicSynthImpl(REFIID riid, void **ppobj)
obj
->
caps
.
dwEffectFlags
=
DMUS_EFFECT_REVERB
;
lstrcpyW
(
obj
->
caps
.
wszDescription
,
L"Microsoft Synthesizer"
);
hr
=
IDirectMusicSynth8_QueryInterface
(
&
obj
->
IDirectMusicSynth8_iface
,
riid
,
ppobj
);
IDirectMusicSynth8_Release
(
&
obj
->
IDirectMusicSynth8_iface
);
return
hr
;
TRACE
(
"Created DirectMusicSynth %p
\n
"
,
obj
);
*
ret_iface
=
(
IUnknown
*
)
&
obj
->
IDirectMusicSynth8_iface
;
return
S_OK
;
}
dlls/dmsynth/synthsink.c
View file @
ec2a7a32
...
...
@@ -371,29 +371,27 @@ static const IKsControlVtbl synth_sink_control =
synth_sink_control_KsEvent
,
};
HRESULT
DMUSIC_CreateDirectMusicSynthSinkImpl
(
REFIID
riid
,
void
**
ret_iface
)
HRESULT
synth_sink_create
(
IUnknown
**
ret_iface
)
{
struct
synth_sink
*
obj
;
HRESULT
hr
;
TRACE
(
"(%
s, %p)
\n
"
,
debugstr_guid
(
riid
)
,
ret_iface
);
TRACE
(
"(%
p)
\n
"
,
ret_iface
);
*
ret_iface
=
NULL
;
if
(
!
(
obj
=
calloc
(
1
,
sizeof
(
*
obj
))))
return
E_OUTOFMEMORY
;
obj
->
IDirectMusicSynthSink_iface
.
lpVtbl
=
&
synth_sink_vtbl
;
obj
->
IKsControl_iface
.
lpVtbl
=
&
synth_sink_control
;
obj
->
ref
=
1
;
hr
=
CoCreateInstance
(
&
CLSID_SystemClock
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IReferenceClock
,
(
LPVOID
*
)
&
obj
->
latency_clock
);
hr
=
CoCreateInstance
(
&
CLSID_SystemClock
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IReferenceClock
,
(
void
*
*
)
&
obj
->
latency_clock
);
if
(
FAILED
(
hr
))
{
free
(
obj
);
return
hr
;
}
hr
=
IDirectMusicSynthSink_QueryInterface
(
&
obj
->
IDirectMusicSynthSink_iface
,
riid
,
ret_iface
);
IDirectMusicSynthSink_Release
(
&
obj
->
IDirectMusicSynthSink_iface
);
return
hr
;
TRACE
(
"Created DirectMusicSynthSink %p
\n
"
,
obj
);
*
ret_iface
=
(
IUnknown
*
)
&
obj
->
IDirectMusicSynthSink_iface
;
return
S_OK
;
}
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