Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexey Alyaev
wine
Commits
03c75b9c
Commit
03c75b9c
authored
12 years ago
by
Christian Costa
Committed by
Alexandre Julliard
12 years ago
Browse files
Options
Downloads
Patches
Plain Diff
dmusic: COM cleanup of IDirectMusicInstrument and get rid of separated IUnknown interface.
parent
8ed11d8b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
dlls/dmusic/collection.c
+2
-2
2 additions, 2 deletions
dlls/dmusic/collection.c
dlls/dmusic/dmusic_private.h
+6
-2
6 additions, 2 deletions
dlls/dmusic/dmusic_private.h
dlls/dmusic/instrument.c
+63
-73
63 additions, 73 deletions
dlls/dmusic/instrument.c
with
71 additions
and
77 deletions
dlls/dmusic/collection.c
+
2
−
2
View file @
03c75b9c
...
...
@@ -142,7 +142,7 @@ static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicCollection_EnumInst
LIST_FOR_EACH
(
listEntry
,
&
This
->
Instruments
)
{
tmpEntry
=
LIST_ENTRY
(
listEntry
,
DMUS_PRIVATE_INSTRUMENTENTRY
,
entry
);
if
(
r
==
dwIndex
)
{
ICOM_NAME_MULTI
(
IDirectMusicInstrumentImpl
,
Instrument
Vtbl
,
tmpEntry
->
pInstrument
,
pInstrument
);
IDirectMusicInstrumentImpl
*
p
Instrument
=
impl_from_IDirectMusicInstrument
(
tmpEntry
->
pInstrument
);
IDirectMusicInstrument_GetPatch
(
tmpEntry
->
pInstrument
,
pdwPatch
);
if
(
pwszName
)
{
dwLen
=
min
(
strlenW
(
pInstrument
->
wszName
),
dwNameLen
-
1
);
...
...
@@ -606,7 +606,7 @@ static HRESULT WINAPI IDirectMusicCollectionImpl_IPersistStream_Load (LPPERSISTS
TRACE_
(
dmfile
)(
": instrument list
\n
"
);
DMUSIC_CreateDirectMusicInstrumentImpl
(
&
IID_IDirectMusicInstrument
,
(
LPVOID
*
)
&
pNewInstrument
->
pInstrument
,
NULL
);
/* only way to create this one... even M$ does it discretely */
{
ICOM_NAME_MULTI
(
IDirectMusicInstrumentImpl
,
Instrument
Vtbl
,
pNew
Instrument
->
p
Instrument
,
pInstrument
);
IDirectMusicInstrumentImpl
*
p
Instrument
=
impl_from_IDirectMusic
Instrument
(
pNew
Instrument
->
pInstrument
);
liMove
.
QuadPart
=
0
;
IStream_Seek
(
pStm
,
liMove
,
STREAM_SEEK_CUR
,
&
dlibInstrumentPosition
);
pInstrument
->
liInstrumentPosition
.
QuadPart
=
dlibInstrumentPosition
.
QuadPart
-
(
2
*
sizeof
(
FOURCC
)
+
sizeof
(
DWORD
));
/* store offset, it'll be needed later */
...
...
This diff is collapsed.
Click to expand it.
dlls/dmusic/dmusic_private.h
+
6
−
2
View file @
03c75b9c
...
...
@@ -214,8 +214,7 @@ struct IDirectMusicCollectionImpl {
*/
struct
IDirectMusicInstrumentImpl
{
/* IUnknown fields */
const
IUnknownVtbl
*
UnknownVtbl
;
const
IDirectMusicInstrumentVtbl
*
InstrumentVtbl
;
IDirectMusicInstrument
IDirectMusicInstrument_iface
;
LONG
ref
;
/* IDirectMusicInstrumentImpl fields */
...
...
@@ -226,6 +225,11 @@ struct IDirectMusicInstrumentImpl {
/* instrument data */
};
static
inline
IDirectMusicInstrumentImpl
*
impl_from_IDirectMusicInstrument
(
IDirectMusicInstrument
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
IDirectMusicInstrumentImpl
,
IDirectMusicInstrument_iface
);
}
/* custom :) */
extern
HRESULT
IDirectMusicInstrumentImpl_Custom_Load
(
LPDIRECTMUSICINSTRUMENT
iface
,
LPSTREAM
pStm
)
DECLSPEC_HIDDEN
;
...
...
This diff is collapsed.
Click to expand it.
dlls/dmusic/instrument.c
+
63
−
73
View file @
03c75b9c
/* IDirectMusicInstrument Implementation
/*
* IDirectMusicInstrument Implementation
*
* Copyright (C) 2003-2004 Rok Mandeljc
*
...
...
@@ -21,41 +22,42 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
dmusic
);
static
const
GUID
IID_IDirectMusicInstrumentPRIVATE
=
{
0xbcb20080
,
0xa40c
,
0x11d1
,{
0x86
,
0xbc
,
0x00
,
0xc0
,
0x4f
,
0xbf
,
0x8f
,
0xef
}};
static
ULONG
WINAPI
IDirectMusicInstrumentImpl_IUnknown_AddRef
(
LPUNKNOWN
iface
);
static
ULONG
WINAPI
IDirectMusicInstrumentImpl_IDirectMusicInstrument_AddRef
(
LPDIRECTMUSICINSTRUMENT
iface
);
static
const
GUID
IID_IDirectMusicInstrumentPRIVATE
=
{
0xbcb20080
,
0xa40c
,
0x11d1
,
{
0x86
,
0xbc
,
0x00
,
0xc0
,
0x4f
,
0xbf
,
0x8f
,
0xef
}
};
/* IDirectMusicInstrument IUnknown part: */
static
HRESULT
WINAPI
IDirectMusicInstrumentImpl_IUnknown_QueryInterface
(
LPUNKNOWN
iface
,
REFIID
riid
,
LPVOID
*
ppobj
)
{
ICOM_THIS_MULTI
(
IDirectMusicInstrumentImpl
,
UnknownVtbl
,
iface
);
TRACE
(
"(%p, %s, %p)
\n
"
,
This
,
debugstr_dmguid
(
riid
),
ppobj
);
if
(
IsEqualIID
(
riid
,
&
IID_IUnknown
))
{
*
ppobj
=
&
This
->
UnknownVtbl
;
IDirectMusicInstrumentImpl_IUnknown_AddRef
((
LPUNKNOWN
)
&
This
->
UnknownVtbl
);
return
S_OK
;
}
else
if
(
IsEqualIID
(
riid
,
&
IID_IDirectMusicInstrument
))
{
*
ppobj
=
&
This
->
InstrumentVtbl
;
IDirectMusicInstrumentImpl_IDirectMusicInstrument_AddRef
((
LPDIRECTMUSICINSTRUMENT
)
&
This
->
InstrumentVtbl
);
return
S_OK
;
}
else
if
(
IsEqualIID
(
riid
,
&
IID_IDirectMusicInstrumentPRIVATE
))
{
/* it seems to me that this interface is only basic IUnknown, without any
other inherited functions... *sigh* this is the worst scenario, since it means
that whoever calls it knows the layout of original implementation table and therefore
tries to get data by direct access... expect crashes */
FIXME
(
"*sigh*... requested private/unspecified interface
\n
"
);
*
ppobj
=
&
This
->
UnknownVtbl
;
IDirectMusicInstrumentImpl_IUnknown_AddRef
((
LPUNKNOWN
)
&
This
->
UnknownVtbl
);
return
S_OK
;
}
WARN
(
"(%p, %s, %p): not found
\n
"
,
This
,
debugstr_dmguid
(
riid
),
ppobj
);
return
E_NOINTERFACE
;
static
HRESULT
WINAPI
IDirectMusicInstrumentImpl_QueryInterface
(
LPDIRECTMUSICINSTRUMENT
iface
,
REFIID
riid
,
LPVOID
*
ret_iface
)
{
TRACE
(
"(%p)->(%s, %p)
\n
"
,
iface
,
debugstr_dmguid
(
riid
),
ret_iface
);
if
(
IsEqualIID
(
riid
,
&
IID_IUnknown
)
||
IsEqualIID
(
riid
,
&
IID_IDirectMusicInstrument
))
{
*
ret_iface
=
iface
;
IDirectMusicInstrument_AddRef
(
iface
);
return
S_OK
;
}
else
if
(
IsEqualIID
(
riid
,
&
IID_IDirectMusicInstrumentPRIVATE
))
{
/* it seems to me that this interface is only basic IUnknown, without any
* other inherited functions... *sigh* this is the worst scenario, since it means
* that whoever calls it knows the layout of original implementation table and therefore
* tries to get data by direct access... expect crashes
*/
FIXME
(
"*sigh*... requested private/unspecified interface
\n
"
);
*
ret_iface
=
iface
;
IDirectMusicInstrument_AddRef
(
iface
);
return
S_OK
;
}
WARN
(
"(%p)->(%s, %p): not found
\n
"
,
iface
,
debugstr_dmguid
(
riid
),
ret_iface
);
return
E_NOINTERFACE
;
}
static
ULONG
WINAPI
IDirectMusicInstrumentImpl_IUnknown_AddRef
(
LPUNKNOWN
iface
)
{
ICOM_THIS_MULTI
(
IDirectMusicInstrumentImpl
,
UnknownVtbl
,
iface
);
static
ULONG
WINAPI
IDirectMusicInstrumentImpl_AddRef
(
LPDIRECTMUSICINSTRUMENT
iface
)
{
IDirectMusicInstrumentImpl
*
This
=
impl_from_IDirectMusicInstrument
(
iface
);
ULONG
refCount
=
InterlockedIncrement
(
&
This
->
ref
);
TRACE
(
"(%p)->(ref before=%u)
\n
"
,
This
,
refCount
-
1
);
...
...
@@ -65,8 +67,9 @@ static ULONG WINAPI IDirectMusicInstrumentImpl_IUnknown_AddRef (LPUNKNOWN iface)
return
refCount
;
}
static
ULONG
WINAPI
IDirectMusicInstrumentImpl_IUnknown_Release
(
LPUNKNOWN
iface
)
{
ICOM_THIS_MULTI
(
IDirectMusicInstrumentImpl
,
UnknownVtbl
,
iface
);
static
ULONG
WINAPI
IDirectMusicInstrumentImpl_Release
(
LPDIRECTMUSICINSTRUMENT
iface
)
{
IDirectMusicInstrumentImpl
*
This
=
impl_from_IDirectMusicInstrument
(
iface
);
ULONG
refCount
=
InterlockedDecrement
(
&
This
->
ref
);
TRACE
(
"(%p)->(ref before=%u)
\n
"
,
This
,
refCount
+
1
);
...
...
@@ -80,48 +83,36 @@ static ULONG WINAPI IDirectMusicInstrumentImpl_IUnknown_Release (LPUNKNOWN iface
return
refCount
;
}
static
const
IUnknownVtbl
DirectMusicInstrument_Unknown_Vtbl
=
{
IDirectMusicInstrumentImpl_IUnknown_QueryInterface
,
IDirectMusicInstrumentImpl_IUnknown_AddRef
,
IDirectMusicInstrumentImpl_IUnknown_Release
};
/* IDirectMusicInstrumentImpl IDirectMusicInstrument part: */
static
HRESULT
WINAPI
IDirectMusicInstrumentImpl_IDirectMusicInstrument_QueryInterface
(
LPDIRECTMUSICINSTRUMENT
iface
,
REFIID
riid
,
LPVOID
*
ppobj
)
{
ICOM_THIS_MULTI
(
IDirectMusicInstrumentImpl
,
InstrumentVtbl
,
iface
);
return
IDirectMusicInstrumentImpl_IUnknown_QueryInterface
((
LPUNKNOWN
)
&
This
->
UnknownVtbl
,
riid
,
ppobj
);
}
static
HRESULT
WINAPI
IDirectMusicInstrumentImpl_GetPatch
(
LPDIRECTMUSICINSTRUMENT
iface
,
DWORD
*
pdwPatch
)
{
IDirectMusicInstrumentImpl
*
This
=
impl_from_IDirectMusicInstrument
(
iface
);
static
ULONG
WINAPI
IDirectMusicInstrumentImpl_IDirectMusicInstrument_AddRef
(
LPDIRECTMUSICINSTRUMENT
iface
)
{
ICOM_THIS_MULTI
(
IDirectMusicInstrumentImpl
,
InstrumentVtbl
,
iface
);
return
IDirectMusicInstrumentImpl_IUnknown_AddRef
((
LPUNKNOWN
)
&
This
->
UnknownVtbl
);
}
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
pdwPatch
);
static
ULONG
WINAPI
IDirectMusicInstrumentImpl_IDirectMusicInstrument_Release
(
LPDIRECTMUSICINSTRUMENT
iface
)
{
ICOM_THIS_MULTI
(
IDirectMusicInstrumentImpl
,
InstrumentVtbl
,
iface
);
return
IDirectMusicInstrumentImpl_IUnknown_Release
((
LPUNKNOWN
)
&
This
->
UnknownVtbl
);
}
*
pdwPatch
=
MIDILOCALE2Patch
(
&
This
->
pHeader
->
Locale
);
static
HRESULT
WINAPI
IDirectMusicInstrumentImpl_IDirectMusicInstrument_GetPatch
(
LPDIRECTMUSICINSTRUMENT
iface
,
DWORD
*
pdwPatch
)
{
ICOM_THIS_MULTI
(
IDirectMusicInstrumentImpl
,
InstrumentVtbl
,
iface
);
TRACE
(
"(%p, %p)
\n
"
,
This
,
pdwPatch
);
*
pdwPatch
=
MIDILOCALE2Patch
(
&
This
->
pHeader
->
Locale
);
return
S_OK
;
return
S_OK
;
}
static
HRESULT
WINAPI
IDirectMusicInstrumentImpl_IDirectMusicInstrument_SetPatch
(
LPDIRECTMUSICINSTRUMENT
iface
,
DWORD
dwPatch
)
{
ICOM_THIS_MULTI
(
IDirectMusicInstrumentImpl
,
InstrumentVtbl
,
iface
);
TRACE
(
"(%p, %d): stub
\n
"
,
This
,
dwPatch
);
Patch2MIDILOCALE
(
dwPatch
,
&
This
->
pHeader
->
Locale
);
return
S_OK
;
static
HRESULT
WINAPI
IDirectMusicInstrumentImpl_SetPatch
(
LPDIRECTMUSICINSTRUMENT
iface
,
DWORD
dwPatch
)
{
IDirectMusicInstrumentImpl
*
This
=
impl_from_IDirectMusicInstrument
(
iface
);
TRACE
(
"(%p)->(%d): stub
\n
"
,
This
,
dwPatch
);
Patch2MIDILOCALE
(
dwPatch
,
&
This
->
pHeader
->
Locale
);
return
S_OK
;
}
static
const
IDirectMusicInstrumentVtbl
DirectMusicInstrument_Instrument_Vtbl
=
{
IDirectMusicInstrumentImpl_IDirectMusicInstrument_QueryInterface
,
IDirectMusicInstrumentImpl_IDirectMusicInstrument_AddRef
,
IDirectMusicInstrumentImpl_IDirectMusicInstrument_Release
,
IDirectMusicInstrumentImpl_IDirectMusicInstrument_GetPatch
,
IDirectMusicInstrumentImpl_IDirectMusicInstrument_SetPatch
static
const
IDirectMusicInstrumentVtbl
DirectMusicInstrument_Vtbl
=
{
IDirectMusicInstrumentImpl_QueryInterface
,
IDirectMusicInstrumentImpl_AddRef
,
IDirectMusicInstrumentImpl_Release
,
IDirectMusicInstrumentImpl_GetPatch
,
IDirectMusicInstrumentImpl_SetPatch
};
/* for ClassFactory */
...
...
@@ -133,11 +124,10 @@ HRESULT DMUSIC_CreateDirectMusicInstrumentImpl (LPCGUID lpcGUID, LPVOID* ppobj,
*
ppobj
=
NULL
;
return
E_OUTOFMEMORY
;
}
dminst
->
UnknownVtbl
=
&
DirectMusicInstrument_Unknown_Vtbl
;
dminst
->
InstrumentVtbl
=
&
DirectMusicInstrument_Instrument_Vtbl
;
dminst
->
IDirectMusicInstrument_iface
.
lpVtbl
=
&
DirectMusicInstrument_Vtbl
;
dminst
->
ref
=
0
;
/* will be inited by QueryInterface */
return
IDirectMusicInstrument
Impl_IUnknown
_QueryInterface
((
LPUNKNOWN
)
&
dminst
->
UnknownVtbl
,
lpcGUID
,
ppobj
);
return
IDirectMusicInstrument_QueryInterface
(
&
dminst
->
IDirectMusicInstrument_iface
,
lpcGUID
,
ppobj
);
}
static
HRESULT
read_from_stream
(
IStream
*
stream
,
void
*
data
,
ULONG
size
)
...
...
@@ -238,9 +228,9 @@ static HRESULT load_instrument(IDirectMusicInstrumentImpl *This, IStream *stream
/* aux. function that completely loads instrument; my tests indicate that it's
called somewhere around IDirectMusicCollection_GetInstrument */
HRESULT
IDirectMusicInstrumentImpl_Custom_Load
(
LPDIRECTMUSICINSTRUMENT
iface
,
LPSTREAM
stream
)
HRESULT
IDirectMusicInstrumentImpl_Custom_Load
(
LPDIRECTMUSICINSTRUMENT
iface
,
LPSTREAM
stream
)
{
ICOM_THIS_MULTI
(
IDirectMusicInstrumentImpl
,
Instrument
Vtbl
,
iface
);
IDirectMusicInstrumentImpl
*
This
=
impl_from_IDirectMusic
Instrument
(
iface
);
LARGE_INTEGER
move
;
FOURCC
fourcc
;
DWORD
bytes
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment