winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
July 2015
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
567 discussions
Start a n
N
ew thread
Michael Stefaniuc : dmstyle: COM cleanup for IDirectMusicTrack8 of DMStyleTrack.
by Alexandre Julliard
01 Jul '15
01 Jul '15
Module: wine Branch: master Commit: 465753e9472c1aad200c9af6d2ccfde2bff8ac1e URL:
http://source.winehq.org/git/wine.git/?a=commit;h=465753e9472c1aad200c9af6d…
Author: Michael Stefaniuc <mstefani(a)redhat.de> Date: Wed Jul 1 09:24:49 2015 +0200 dmstyle: COM cleanup for IDirectMusicTrack8 of DMStyleTrack. --- dlls/dmstyle/styletrack.c | 149 ++++++++++++++++++++++++++++------------------ 1 file changed, 90 insertions(+), 59 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=465753e9472c1aad200c9…
1
0
0
0
Michael Stefaniuc : dmstyle: Use the generic IPersistStream for DMChordTrack.
by Alexandre Julliard
01 Jul '15
01 Jul '15
Module: wine Branch: master Commit: 0248befa254577f4b90b482b47965b450060eee4 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=0248befa254577f4b90b482b4…
Author: Michael Stefaniuc <mstefani(a)redhat.de> Date: Wed Jul 1 09:22:32 2015 +0200 dmstyle: Use the generic IPersistStream for DMChordTrack. --- dlls/dmstyle/chordtrack.c | 84 +++++++++++++++-------------------------------- 1 file changed, 27 insertions(+), 57 deletions(-) diff --git a/dlls/dmstyle/chordtrack.c b/dlls/dmstyle/chordtrack.c index fa7ad58..db4befc 100644 --- a/dlls/dmstyle/chordtrack.c +++ b/dlls/dmstyle/chordtrack.c @@ -19,6 +19,7 @@ */ #include "dmstyle_private.h" +#include "dmobject.h" WINE_DEFAULT_DEBUG_CHANNEL(dmstyle); WINE_DECLARE_DEBUG_CHANNEL(dmfile); @@ -28,9 +29,8 @@ WINE_DECLARE_DEBUG_CHANNEL(dmfile); */ typedef struct IDirectMusicChordTrack { IDirectMusicTrack8 IDirectMusicTrack8_iface; - const IPersistStreamVtbl *PersistStreamVtbl; + struct dmobject dmobj; /* IPersistStream only */ LONG ref; - DMUS_OBJECTDESC *pDesc; DWORD dwScale; } IDirectMusicChordTrack; @@ -53,7 +53,7 @@ static HRESULT WINAPI IDirectMusicTrack8Impl_QueryInterface(IDirectMusicTrack8 * IsEqualIID(riid, &IID_IDirectMusicTrack8)) *ret_iface = iface; else if (IsEqualIID(riid, &IID_IPersistStream)) - *ret_iface = &This->PersistStreamVtbl; + *ret_iface = &This->dmobj.IPersistStream_iface; else { WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ret_iface); return E_NOINTERFACE; @@ -249,35 +249,6 @@ static const IDirectMusicTrack8Vtbl dmtrack8_vtbl = { IDirectMusicTrack8Impl_Join }; -/* IDirectMusicChordTrack IPersistStream part: */ -static HRESULT WINAPI IDirectMusicChordTrack_IPersistStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) { - ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface); - return IDirectMusicTrack8_QueryInterface(&This->IDirectMusicTrack8_iface, riid, ppobj); -} - -static ULONG WINAPI IDirectMusicChordTrack_IPersistStream_AddRef (LPPERSISTSTREAM iface) { - ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface); - return IDirectMusicTrack8_AddRef(&This->IDirectMusicTrack8_iface); -} - -static ULONG WINAPI IDirectMusicChordTrack_IPersistStream_Release (LPPERSISTSTREAM iface) { - ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface); - return IDirectMusicTrack8_Release(&This->IDirectMusicTrack8_iface); -} - -static HRESULT WINAPI IDirectMusicChordTrack_IPersistStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) { - ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface); - TRACE("(%p, %p)\n", This, pClassID); - *pClassID = CLSID_DirectMusicChordTrack; - return S_OK; -} - -static HRESULT WINAPI IDirectMusicChordTrack_IPersistStream_IsDirty (LPPERSISTSTREAM iface) { - ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface); - FIXME("(%p): stub, always S_FALSE\n", This); - return S_FALSE; -} - static HRESULT parse_chordtrack_list(IDirectMusicChordTrack *This, DMUS_PRIVATE_CHUNK *pChunk, IStream *pStm) { @@ -354,9 +325,14 @@ static HRESULT parse_chordtrack_list(IDirectMusicChordTrack *This, DMUS_PRIVATE_ return S_OK; } -static HRESULT WINAPI IDirectMusicChordTrack_IPersistStream_Load (LPPERSISTSTREAM iface, IStream* pStm) { - ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface); - +static inline IDirectMusicChordTrack *impl_from_IPersistStream(IPersistStream *iface) +{ + return CONTAINING_RECORD(iface, IDirectMusicChordTrack, dmobj.IPersistStream_iface); +} + +static HRESULT WINAPI IPersistStreamImpl_Load(IPersistStream *iface, IStream *pStm) +{ + IDirectMusicChordTrack *This = impl_from_IPersistStream(iface); DMUS_PRIVATE_CHUNK Chunk; LARGE_INTEGER liMove; HRESULT hr; @@ -397,27 +373,23 @@ static HRESULT WINAPI IDirectMusicChordTrack_IPersistStream_Load (LPPERSISTSTREA return S_OK; } -static HRESULT WINAPI IDirectMusicChordTrack_IPersistStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) { - ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface); +static HRESULT WINAPI IPersistStreamImpl_Save(IPersistStream *iface, IStream *stream, + BOOL cleardirty) +{ + IDirectMusicChordTrack *This = impl_from_IPersistStream(iface); FIXME("(%p): Saving not implemented yet\n", This); return E_NOTIMPL; } -static HRESULT WINAPI IDirectMusicChordTrack_IPersistStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) { - ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface); - FIXME("(%p, %p): stub\n", This, pcbSize); - return E_NOTIMPL; -} - -static const IPersistStreamVtbl DirectMusicChordTrack_PersistStream_Vtbl = { - IDirectMusicChordTrack_IPersistStream_QueryInterface, - IDirectMusicChordTrack_IPersistStream_AddRef, - IDirectMusicChordTrack_IPersistStream_Release, - IDirectMusicChordTrack_IPersistStream_GetClassID, - IDirectMusicChordTrack_IPersistStream_IsDirty, - IDirectMusicChordTrack_IPersistStream_Load, - IDirectMusicChordTrack_IPersistStream_Save, - IDirectMusicChordTrack_IPersistStream_GetSizeMax +static const IPersistStreamVtbl persiststream_vtbl = { + dmobj_IPersistStream_QueryInterface, + dmobj_IPersistStream_AddRef, + dmobj_IPersistStream_Release, + dmobj_IPersistStream_GetClassID, + unimpl_IPersistStream_IsDirty, + IPersistStreamImpl_Load, + IPersistStreamImpl_Save, + unimpl_IPersistStream_GetSizeMax }; /* for ClassFactory */ @@ -432,12 +404,10 @@ HRESULT WINAPI create_dmchordtrack(REFIID lpcGUID, void **ppobj) return E_OUTOFMEMORY; } track->IDirectMusicTrack8_iface.lpVtbl = &dmtrack8_vtbl; - track->PersistStreamVtbl = &DirectMusicChordTrack_PersistStream_Vtbl; - track->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC)); - DM_STRUCT_INIT(track->pDesc); - track->pDesc->dwValidData |= DMUS_OBJ_CLASS; - track->pDesc->guidClass = CLSID_DirectMusicChordTrack; track->ref = 1; + dmobject_init(&track->dmobj, &CLSID_DirectMusicChordTrack, + (IUnknown *)&track->IDirectMusicTrack8_iface); + track->dmobj.IPersistStream_iface.lpVtbl = &persiststream_vtbl; DMSTYLE_LockModule(); hr = IDirectMusicTrack8_QueryInterface(&track->IDirectMusicTrack8_iface, lpcGUID, ppobj);
1
0
0
0
Michael Stefaniuc : dmstyle: Remove the extraneous IUnknown from DMChordTrack.
by Alexandre Julliard
01 Jul '15
01 Jul '15
Module: wine Branch: master Commit: 9a653533d31729c0d1296ca7b9205066b8240813 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=9a653533d31729c0d1296ca7b…
Author: Michael Stefaniuc <mstefani(a)redhat.de> Date: Wed Jul 1 09:21:32 2015 +0200 dmstyle: Remove the extraneous IUnknown from DMChordTrack. Also lock/unlock the module only on creation/destruction of the object. --- dlls/dmstyle/chordtrack.c | 127 ++++++++++++++++++---------------------------- 1 file changed, 50 insertions(+), 77 deletions(-) diff --git a/dlls/dmstyle/chordtrack.c b/dlls/dmstyle/chordtrack.c index 0156695..fa7ad58 100644 --- a/dlls/dmstyle/chordtrack.c +++ b/dlls/dmstyle/chordtrack.c @@ -23,14 +23,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(dmstyle); WINE_DECLARE_DEBUG_CHANNEL(dmfile); -static ULONG WINAPI IDirectMusicChordTrack_IUnknown_AddRef (LPUNKNOWN iface); -static ULONG WINAPI IDirectMusicChordTrack_IPersistStream_AddRef (LPPERSISTSTREAM iface); - /***************************************************************************** * IDirectMusicChordTrack implementation */ typedef struct IDirectMusicChordTrack { - const IUnknownVtbl *UnknownVtbl; IDirectMusicTrack8 IDirectMusicTrack8_iface; const IPersistStreamVtbl *PersistStreamVtbl; LONG ref; @@ -38,62 +34,6 @@ typedef struct IDirectMusicChordTrack { DWORD dwScale; } IDirectMusicChordTrack; -/* IDirectMusicChordTrack IUnknown part: */ -static HRESULT WINAPI IDirectMusicChordTrack_IUnknown_QueryInterface (LPUNKNOWN iface, REFIID riid, LPVOID *ppobj) { - ICOM_THIS_MULTI(IDirectMusicChordTrack, UnknownVtbl, iface); - TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj); - - if (IsEqualIID (riid, &IID_IUnknown)) { - *ppobj = &This->UnknownVtbl; - IDirectMusicChordTrack_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl); - return S_OK; - } else if (IsEqualIID (riid, &IID_IDirectMusicTrack) - || IsEqualIID (riid, &IID_IDirectMusicTrack8)) { - *ppobj = &This->IDirectMusicTrack8_iface; - IDirectMusicTrack8_AddRef (&This->IDirectMusicTrack8_iface); - return S_OK; - } else if (IsEqualIID (riid, &IID_IPersistStream)) { - *ppobj = &This->PersistStreamVtbl; - IDirectMusicChordTrack_IPersistStream_AddRef ((LPPERSISTSTREAM)&This->PersistStreamVtbl); - return S_OK; - } - - WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj); - return E_NOINTERFACE; -} - -static ULONG WINAPI IDirectMusicChordTrack_IUnknown_AddRef (LPUNKNOWN iface) { - ICOM_THIS_MULTI(IDirectMusicChordTrack, UnknownVtbl, iface); - ULONG ref = InterlockedIncrement(&This->ref); - - TRACE("(%p): AddRef from %d\n", This, ref - 1); - - DMSTYLE_LockModule(); - - return ref; -} - -static ULONG WINAPI IDirectMusicChordTrack_IUnknown_Release (LPUNKNOWN iface) { - ICOM_THIS_MULTI(IDirectMusicChordTrack, UnknownVtbl, iface); - ULONG ref = InterlockedDecrement(&This->ref); - - TRACE("(%p): ReleaseRef to %d\n", This, ref); - - if (ref == 0) { - HeapFree(GetProcessHeap(), 0, This); - } - - DMSTYLE_UnlockModule(); - - return ref; -} - -static const IUnknownVtbl DirectMusicChordTrack_Unknown_Vtbl = { - IDirectMusicChordTrack_IUnknown_QueryInterface, - IDirectMusicChordTrack_IUnknown_AddRef, - IDirectMusicChordTrack_IUnknown_Release -}; - /* IDirectMusicChordTrack IDirectMusicTrack8 part: */ static inline IDirectMusicChordTrack *impl_from_IDirectMusicTrack8(IDirectMusicTrack8 *iface) { @@ -101,22 +41,51 @@ static inline IDirectMusicChordTrack *impl_from_IDirectMusicTrack8(IDirectMusicT } static HRESULT WINAPI IDirectMusicTrack8Impl_QueryInterface(IDirectMusicTrack8 *iface, REFIID riid, - void **ppobj) + void **ret_iface) { IDirectMusicChordTrack *This = impl_from_IDirectMusicTrack8(iface); - return IDirectMusicChordTrack_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj); + + TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ret_iface); + + *ret_iface = NULL; + + if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IDirectMusicTrack) || + IsEqualIID(riid, &IID_IDirectMusicTrack8)) + *ret_iface = iface; + else if (IsEqualIID(riid, &IID_IPersistStream)) + *ret_iface = &This->PersistStreamVtbl; + else { + WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ret_iface); + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown*)*ret_iface); + return S_OK; } static ULONG WINAPI IDirectMusicTrack8Impl_AddRef(IDirectMusicTrack8 *iface) { IDirectMusicChordTrack *This = impl_from_IDirectMusicTrack8(iface); - return IDirectMusicChordTrack_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl); + LONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) ref=%d\n", This, ref); + + return ref; } static ULONG WINAPI IDirectMusicTrack8Impl_Release(IDirectMusicTrack8 *iface) { IDirectMusicChordTrack *This = impl_from_IDirectMusicTrack8(iface); - return IDirectMusicChordTrack_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl); + LONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) ref=%d\n", This, ref); + + if (!ref) { + HeapFree(GetProcessHeap(), 0, This); + DMSTYLE_UnlockModule(); + } + + return ref; } static HRESULT WINAPI IDirectMusicTrack8Impl_Init(IDirectMusicTrack8 *iface, @@ -283,17 +252,17 @@ static const IDirectMusicTrack8Vtbl dmtrack8_vtbl = { /* IDirectMusicChordTrack IPersistStream part: */ static HRESULT WINAPI IDirectMusicChordTrack_IPersistStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) { ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface); - return IDirectMusicChordTrack_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj); + return IDirectMusicTrack8_QueryInterface(&This->IDirectMusicTrack8_iface, riid, ppobj); } static ULONG WINAPI IDirectMusicChordTrack_IPersistStream_AddRef (LPPERSISTSTREAM iface) { ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface); - return IDirectMusicChordTrack_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl); + return IDirectMusicTrack8_AddRef(&This->IDirectMusicTrack8_iface); } static ULONG WINAPI IDirectMusicChordTrack_IPersistStream_Release (LPPERSISTSTREAM iface) { ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface); - return IDirectMusicChordTrack_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl); + return IDirectMusicTrack8_Release(&This->IDirectMusicTrack8_iface); } static HRESULT WINAPI IDirectMusicChordTrack_IPersistStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) { @@ -454,21 +423,25 @@ static const IPersistStreamVtbl DirectMusicChordTrack_PersistStream_Vtbl = { /* for ClassFactory */ HRESULT WINAPI create_dmchordtrack(REFIID lpcGUID, void **ppobj) { - IDirectMusicChordTrack* track; - - track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicChordTrack)); - if (NULL == track) { - *ppobj = NULL; - return E_OUTOFMEMORY; - } - track->UnknownVtbl = &DirectMusicChordTrack_Unknown_Vtbl; + IDirectMusicChordTrack *track; + HRESULT hr; + + track = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*track)); + if (!track) { + *ppobj = NULL; + return E_OUTOFMEMORY; + } track->IDirectMusicTrack8_iface.lpVtbl = &dmtrack8_vtbl; track->PersistStreamVtbl = &DirectMusicChordTrack_PersistStream_Vtbl; track->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC)); DM_STRUCT_INIT(track->pDesc); track->pDesc->dwValidData |= DMUS_OBJ_CLASS; track->pDesc->guidClass = CLSID_DirectMusicChordTrack; - track->ref = 0; /* will be inited by QueryInterface */ + track->ref = 1; + + DMSTYLE_LockModule(); + hr = IDirectMusicTrack8_QueryInterface(&track->IDirectMusicTrack8_iface, lpcGUID, ppobj); + IDirectMusicTrack8_Release(&track->IDirectMusicTrack8_iface); - return IDirectMusicChordTrack_IUnknown_QueryInterface ((LPUNKNOWN)&track->UnknownVtbl, lpcGUID, ppobj); + return hr; }
1
0
0
0
Michael Stefaniuc : dmstyle: COM cleanup for IDirectMusicTrack8 of DMChordTrack.
by Alexandre Julliard
01 Jul '15
01 Jul '15
Module: wine Branch: master Commit: 6495c2b6581f80d8e1c4d1543c71661b76812561 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=6495c2b6581f80d8e1c4d1543…
Author: Michael Stefaniuc <mstefani(a)redhat.de> Date: Wed Jul 1 09:19:21 2015 +0200 dmstyle: COM cleanup for IDirectMusicTrack8 of DMChordTrack. --- dlls/dmstyle/chordtrack.c | 150 ++++++++++++++++++++++++++++------------------ 1 file changed, 91 insertions(+), 59 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=6495c2b6581f80d8e1c4d…
1
0
0
0
Michael Stefaniuc : dmstyle: Use the generic IPersistStream for DMCommandTrack.
by Alexandre Julliard
01 Jul '15
01 Jul '15
Module: wine Branch: master Commit: 819d25a71789cda62ea8122bcbcf41d593e1137f URL:
http://source.winehq.org/git/wine.git/?a=commit;h=819d25a71789cda62ea8122bc…
Author: Michael Stefaniuc <mstefani(a)redhat.de> Date: Wed Jul 1 09:16:52 2015 +0200 dmstyle: Use the generic IPersistStream for DMCommandTrack. --- dlls/dmstyle/commandtrack.c | 72 +++++++++++++++----------------------------- dlls/dmstyle/tests/dmstyle.c | 33 +++++++------------- 2 files changed, 36 insertions(+), 69 deletions(-) diff --git a/dlls/dmstyle/commandtrack.c b/dlls/dmstyle/commandtrack.c index 8d33fd6..9f798e7 100644 --- a/dlls/dmstyle/commandtrack.c +++ b/dlls/dmstyle/commandtrack.c @@ -18,6 +18,7 @@ */ #include "dmstyle_private.h" +#include "dmobject.h" WINE_DEFAULT_DEBUG_CHANNEL(dmstyle); WINE_DECLARE_DEBUG_CHANNEL(dmfile); @@ -27,9 +28,8 @@ WINE_DECLARE_DEBUG_CHANNEL(dmfile); */ typedef struct IDirectMusicCommandTrack { IDirectMusicTrack8 IDirectMusicTrack8_iface; - const IPersistStreamVtbl *PersistStreamVtbl; + struct dmobject dmobj; /* IPersistStream only */ LONG ref; - DMUS_OBJECTDESC *pDesc; struct list Commands; } IDirectMusicCommandTrack; @@ -52,7 +52,7 @@ static HRESULT WINAPI IDirectMusicTrack8Impl_QueryInterface(IDirectMusicTrack8 * IsEqualIID(riid, &IID_IDirectMusicTrack8)) *ret_iface = iface; else if (IsEqualIID(riid, &IID_IPersistStream)) - *ret_iface = &This->PersistStreamVtbl; + *ret_iface = &This->dmobj.IPersistStream_iface; else { WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ret_iface); return E_NOINTERFACE; @@ -249,32 +249,14 @@ static const IDirectMusicTrack8Vtbl dmtrack8_vtbl = { IDirectMusicTrack8Impl_Join }; -/* IDirectMusicCommandTrack IPersistStream part: */ -static HRESULT WINAPI IDirectMusicCommandTrack_IPersistStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) { - ICOM_THIS_MULTI(IDirectMusicCommandTrack, PersistStreamVtbl, iface); - return IDirectMusicTrack8_QueryInterface(&This->IDirectMusicTrack8_iface, riid, ppobj); -} - -static ULONG WINAPI IDirectMusicCommandTrack_IPersistStream_AddRef (LPPERSISTSTREAM iface) { - ICOM_THIS_MULTI(IDirectMusicCommandTrack, PersistStreamVtbl, iface); - return IDirectMusicTrack8_AddRef(&This->IDirectMusicTrack8_iface); -} - -static ULONG WINAPI IDirectMusicCommandTrack_IPersistStream_Release (LPPERSISTSTREAM iface) { - ICOM_THIS_MULTI(IDirectMusicCommandTrack, PersistStreamVtbl, iface); - return IDirectMusicTrack8_Release(&This->IDirectMusicTrack8_iface); -} - -static HRESULT WINAPI IDirectMusicCommandTrack_IPersistStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) { - return E_NOTIMPL; -} - -static HRESULT WINAPI IDirectMusicCommandTrack_IPersistStream_IsDirty (LPPERSISTSTREAM iface) { - return E_NOTIMPL; +static inline IDirectMusicCommandTrack *impl_from_IPersistStream(IPersistStream *iface) +{ + return CONTAINING_RECORD(iface, IDirectMusicCommandTrack, dmobj.IPersistStream_iface); } -static HRESULT WINAPI IDirectMusicCommandTrack_IPersistStream_Load (LPPERSISTSTREAM iface, IStream* pStm) { - ICOM_THIS_MULTI(IDirectMusicCommandTrack, PersistStreamVtbl, iface); +static HRESULT WINAPI IPersistStreamImpl_Load(IPersistStream *iface, IStream *pStm) +{ + IDirectMusicCommandTrack *This = impl_from_IPersistStream(iface); FOURCC chunkID; DWORD chunkSize, dwSizeOfStruct, nrCommands; LARGE_INTEGER liMove; /* used when skipping chunks */ @@ -299,7 +281,7 @@ static HRESULT WINAPI IDirectMusicCommandTrack_IPersistStream_Load (LPPERSISTSTR list_add_tail (&This->Commands, &pNewCommand->entry); } TRACE_(dmfile)(": reading finished\n"); - This->pDesc->dwValidData |= DMUS_OBJ_LOADED; + This->dmobj.desc.dwValidData |= DMUS_OBJ_LOADED; break; } default: { @@ -334,23 +316,21 @@ static HRESULT WINAPI IDirectMusicCommandTrack_IPersistStream_Load (LPPERSISTSTR return S_OK; } -static HRESULT WINAPI IDirectMusicCommandTrack_IPersistStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) { - return E_NOTIMPL; -} - -static HRESULT WINAPI IDirectMusicCommandTrack_IPersistStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) { +static HRESULT WINAPI IPersistStreamImpl_Save(IPersistStream *iface, IStream *stream, + BOOL cleardirty) +{ return E_NOTIMPL; } -static const IPersistStreamVtbl DirectMusicCommandTrack_PersistStream_Vtbl = { - IDirectMusicCommandTrack_IPersistStream_QueryInterface, - IDirectMusicCommandTrack_IPersistStream_AddRef, - IDirectMusicCommandTrack_IPersistStream_Release, - IDirectMusicCommandTrack_IPersistStream_GetClassID, - IDirectMusicCommandTrack_IPersistStream_IsDirty, - IDirectMusicCommandTrack_IPersistStream_Load, - IDirectMusicCommandTrack_IPersistStream_Save, - IDirectMusicCommandTrack_IPersistStream_GetSizeMax +static const IPersistStreamVtbl persiststream_vtbl = { + dmobj_IPersistStream_QueryInterface, + dmobj_IPersistStream_AddRef, + dmobj_IPersistStream_Release, + dmobj_IPersistStream_GetClassID, + unimpl_IPersistStream_IsDirty, + IPersistStreamImpl_Load, + IPersistStreamImpl_Save, + unimpl_IPersistStream_GetSizeMax }; /* for ClassFactory */ @@ -365,12 +345,10 @@ HRESULT WINAPI create_dmcommandtrack(REFIID lpcGUID, void **ppobj) return E_OUTOFMEMORY; } track->IDirectMusicTrack8_iface.lpVtbl = &dmtrack8_vtbl; - track->PersistStreamVtbl = &DirectMusicCommandTrack_PersistStream_Vtbl; - track->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC)); - DM_STRUCT_INIT(track->pDesc); - track->pDesc->dwValidData |= DMUS_OBJ_CLASS; - track->pDesc->guidClass = CLSID_DirectMusicCommandTrack; track->ref = 1; + dmobject_init(&track->dmobj, &CLSID_DirectMusicCommandTrack, + (IUnknown *)&track->IDirectMusicTrack8_iface); + track->dmobj.IPersistStream_iface.lpVtbl = &persiststream_vtbl; list_init (&track->Commands); DMSTYLE_LockModule(); diff --git a/dlls/dmstyle/tests/dmstyle.c b/dlls/dmstyle/tests/dmstyle.c index e98b29c..9468c39 100644 --- a/dlls/dmstyle/tests/dmstyle.c +++ b/dlls/dmstyle/tests/dmstyle.c @@ -252,14 +252,13 @@ static void test_track(void) const char *name; BOOL has_save; BOOL has_join; - BOOL todo; } class[] = { - { X(DirectMusicAuditionTrack), TRUE, FALSE, FALSE }, - { X(DirectMusicChordTrack), TRUE, TRUE, FALSE }, - { X(DirectMusicCommandTrack), TRUE, TRUE, TRUE }, - { X(DirectMusicMotifTrack), FALSE, FALSE, FALSE }, - { X(DirectMusicMuteTrack), TRUE, FALSE, FALSE }, - { X(DirectMusicStyleTrack), FALSE, TRUE, FALSE }, + { X(DirectMusicAuditionTrack), TRUE, FALSE }, + { X(DirectMusicChordTrack), TRUE, TRUE }, + { X(DirectMusicCommandTrack), TRUE, TRUE }, + { X(DirectMusicMotifTrack), FALSE, FALSE }, + { X(DirectMusicMuteTrack), TRUE, FALSE }, + { X(DirectMusicStyleTrack), FALSE, TRUE }, }; #undef X unsigned int i; @@ -329,21 +328,11 @@ static void test_track(void) hr = IDirectMusicTrack8_QueryInterface(dmt8, &IID_IPersistStream, (void**)&ps); ok(hr == S_OK, "QueryInterface for IID_IPersistStream failed: %08x\n", hr); hr = IPersistStream_GetClassID(ps, &classid); - if (class[i].todo) { - todo_wine { - ok(hr == S_OK, "IPersistStream_GetClassID failed: %08x\n", hr); - ok(IsEqualGUID(&classid, class[i].clsid), - "Expected class %s got %s\n", class[i].name, wine_dbgstr_guid(&classid)); - hr = IPersistStream_IsDirty(ps); - ok(hr == S_FALSE, "IPersistStream_IsDirty failed: %08x\n", hr); - } - } else { - ok(hr == S_OK, "IPersistStream_GetClassID failed: %08x\n", hr); - ok(IsEqualGUID(&classid, class[i].clsid), - "Expected class %s got %s\n", class[i].name, wine_dbgstr_guid(&classid)); - hr = IPersistStream_IsDirty(ps); - ok(hr == S_FALSE, "IPersistStream_IsDirty failed: %08x\n", hr); - } + ok(hr == S_OK, "IPersistStream_GetClassID failed: %08x\n", hr); + ok(IsEqualGUID(&classid, class[i].clsid), + "Expected class %s got %s\n", class[i].name, wine_dbgstr_guid(&classid)); + hr = IPersistStream_IsDirty(ps); + ok(hr == S_FALSE, "IPersistStream_IsDirty failed: %08x\n", hr); hr = IPersistStream_GetSizeMax(ps, &size); ok(hr == E_NOTIMPL, "IPersistStream_GetSizeMax failed: %08x\n", hr);
1
0
0
0
Michael Stefaniuc : dmstyle: Remove the extraneous IUnknown from DMCommandTrack.
by Alexandre Julliard
01 Jul '15
01 Jul '15
Module: wine Branch: master Commit: 28b606b0f3226337b3d1c68f2b9c3559a2f23dc8 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=28b606b0f3226337b3d1c68f2…
Author: Michael Stefaniuc <mstefani(a)redhat.de> Date: Wed Jul 1 09:14:13 2015 +0200 dmstyle: Remove the extraneous IUnknown from DMCommandTrack. Also lock/unlock the module only on creation/destruction of the object. --- dlls/dmstyle/commandtrack.c | 130 ++++++++++++++++++-------------------------- 1 file changed, 52 insertions(+), 78 deletions(-) diff --git a/dlls/dmstyle/commandtrack.c b/dlls/dmstyle/commandtrack.c index 0ec9774..8d33fd6 100644 --- a/dlls/dmstyle/commandtrack.c +++ b/dlls/dmstyle/commandtrack.c @@ -22,14 +22,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(dmstyle); WINE_DECLARE_DEBUG_CHANNEL(dmfile); -static ULONG WINAPI IDirectMusicCommandTrack_IUnknown_AddRef (LPUNKNOWN iface); -static ULONG WINAPI IDirectMusicCommandTrack_IPersistStream_AddRef (LPPERSISTSTREAM iface); - /***************************************************************************** * IDirectMusicCommandTrack implementation */ typedef struct IDirectMusicCommandTrack { - const IUnknownVtbl *UnknownVtbl; IDirectMusicTrack8 IDirectMusicTrack8_iface; const IPersistStreamVtbl *PersistStreamVtbl; LONG ref; @@ -37,62 +33,6 @@ typedef struct IDirectMusicCommandTrack { struct list Commands; } IDirectMusicCommandTrack; -/* IDirectMusicCommandTrack IUnknown part: */ -static HRESULT WINAPI IDirectMusicCommandTrack_IUnknown_QueryInterface (LPUNKNOWN iface, REFIID riid, LPVOID *ppobj) { - ICOM_THIS_MULTI(IDirectMusicCommandTrack, UnknownVtbl, iface); - TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj); - - if (IsEqualIID (riid, &IID_IUnknown)) { - *ppobj = &This->UnknownVtbl; - IDirectMusicCommandTrack_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl); - return S_OK; - } else if (IsEqualIID (riid, &IID_IDirectMusicTrack) - || IsEqualIID (riid, &IID_IDirectMusicTrack8)) { - *ppobj = &This->IDirectMusicTrack8_iface; - IDirectMusicTrack8_AddRef (&This->IDirectMusicTrack8_iface); - return S_OK; - } else if (IsEqualIID (riid, &IID_IPersistStream)) { - *ppobj = &This->PersistStreamVtbl; - IDirectMusicCommandTrack_IPersistStream_AddRef ((LPPERSISTSTREAM)&This->PersistStreamVtbl); - return S_OK; - } - - WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj); - return E_NOINTERFACE; -} - -static ULONG WINAPI IDirectMusicCommandTrack_IUnknown_AddRef (LPUNKNOWN iface) { - ICOM_THIS_MULTI(IDirectMusicCommandTrack, UnknownVtbl, iface); - ULONG ref = InterlockedIncrement(&This->ref); - - TRACE("(%p): AddRef from %d\n", This, ref - 1); - - DMSTYLE_LockModule(); - - return ref; -} - -static ULONG WINAPI IDirectMusicCommandTrack_IUnknown_Release (LPUNKNOWN iface) { - ICOM_THIS_MULTI(IDirectMusicCommandTrack, UnknownVtbl, iface); - ULONG ref = InterlockedDecrement(&This->ref); - - TRACE("(%p): ReleaseRef to %d\n", This, ref); - - if (ref == 0) { - HeapFree(GetProcessHeap(), 0, This); - } - - DMSTYLE_UnlockModule(); - - return ref; -} - -static const IUnknownVtbl DirectMusicCommandTrack_Unknown_Vtbl = { - IDirectMusicCommandTrack_IUnknown_QueryInterface, - IDirectMusicCommandTrack_IUnknown_AddRef, - IDirectMusicCommandTrack_IUnknown_Release -}; - /* IDirectMusicCommandTrack IDirectMusicTrack8 part: */ static inline IDirectMusicCommandTrack *impl_from_IDirectMusicTrack8(IDirectMusicTrack8 *iface) { @@ -100,22 +40,51 @@ static inline IDirectMusicCommandTrack *impl_from_IDirectMusicTrack8(IDirectMusi } static HRESULT WINAPI IDirectMusicTrack8Impl_QueryInterface(IDirectMusicTrack8 *iface, REFIID riid, - void **ppobj) + void **ret_iface) { IDirectMusicCommandTrack *This = impl_from_IDirectMusicTrack8(iface); - return IDirectMusicCommandTrack_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj); + + TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ret_iface); + + *ret_iface = NULL; + + if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IDirectMusicTrack) || + IsEqualIID(riid, &IID_IDirectMusicTrack8)) + *ret_iface = iface; + else if (IsEqualIID(riid, &IID_IPersistStream)) + *ret_iface = &This->PersistStreamVtbl; + else { + WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ret_iface); + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown*)*ret_iface); + return S_OK; } static ULONG WINAPI IDirectMusicTrack8Impl_AddRef(IDirectMusicTrack8 *iface) { IDirectMusicCommandTrack *This = impl_from_IDirectMusicTrack8(iface); - return IDirectMusicCommandTrack_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl); + LONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) ref=%d\n", This, ref); + + return ref; } static ULONG WINAPI IDirectMusicTrack8Impl_Release(IDirectMusicTrack8 *iface) { IDirectMusicCommandTrack *This = impl_from_IDirectMusicTrack8(iface); - return IDirectMusicCommandTrack_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl); + LONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) ref=%d\n", This, ref); + + if (!ref) { + HeapFree(GetProcessHeap(), 0, This); + DMSTYLE_UnlockModule(); + } + + return ref; } static HRESULT WINAPI IDirectMusicTrack8Impl_Init(IDirectMusicTrack8 *iface, @@ -283,17 +252,17 @@ static const IDirectMusicTrack8Vtbl dmtrack8_vtbl = { /* IDirectMusicCommandTrack IPersistStream part: */ static HRESULT WINAPI IDirectMusicCommandTrack_IPersistStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) { ICOM_THIS_MULTI(IDirectMusicCommandTrack, PersistStreamVtbl, iface); - return IDirectMusicCommandTrack_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj); + return IDirectMusicTrack8_QueryInterface(&This->IDirectMusicTrack8_iface, riid, ppobj); } static ULONG WINAPI IDirectMusicCommandTrack_IPersistStream_AddRef (LPPERSISTSTREAM iface) { ICOM_THIS_MULTI(IDirectMusicCommandTrack, PersistStreamVtbl, iface); - return IDirectMusicCommandTrack_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl); + return IDirectMusicTrack8_AddRef(&This->IDirectMusicTrack8_iface); } static ULONG WINAPI IDirectMusicCommandTrack_IPersistStream_Release (LPPERSISTSTREAM iface) { ICOM_THIS_MULTI(IDirectMusicCommandTrack, PersistStreamVtbl, iface); - return IDirectMusicCommandTrack_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl); + return IDirectMusicTrack8_Release(&This->IDirectMusicTrack8_iface); } static HRESULT WINAPI IDirectMusicCommandTrack_IPersistStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) { @@ -387,22 +356,27 @@ static const IPersistStreamVtbl DirectMusicCommandTrack_PersistStream_Vtbl = { /* for ClassFactory */ HRESULT WINAPI create_dmcommandtrack(REFIID lpcGUID, void **ppobj) { - IDirectMusicCommandTrack* track; - - track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicCommandTrack)); - if (NULL == track) { - *ppobj = NULL; - return E_OUTOFMEMORY; - } - track->UnknownVtbl = &DirectMusicCommandTrack_Unknown_Vtbl; + IDirectMusicCommandTrack *track; + HRESULT hr; + + track = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*track)); + if (!track) { + *ppobj = NULL; + return E_OUTOFMEMORY; + } track->IDirectMusicTrack8_iface.lpVtbl = &dmtrack8_vtbl; track->PersistStreamVtbl = &DirectMusicCommandTrack_PersistStream_Vtbl; track->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC)); DM_STRUCT_INIT(track->pDesc); track->pDesc->dwValidData |= DMUS_OBJ_CLASS; track->pDesc->guidClass = CLSID_DirectMusicCommandTrack; - track->ref = 0; /* will be inited by QueryInterface */ - list_init (&track->Commands); + track->ref = 1; + list_init (&track->Commands); + + DMSTYLE_LockModule(); + hr = IDirectMusicTrack8_QueryInterface(&track->IDirectMusicTrack8_iface, + lpcGUID, ppobj); + IDirectMusicTrack8_Release(&track->IDirectMusicTrack8_iface); - return IDirectMusicCommandTrack_IUnknown_QueryInterface ((LPUNKNOWN)&track->UnknownVtbl, lpcGUID, ppobj); + return hr; }
1
0
0
0
Michael Stefaniuc : dmstyle: COM cleanup for IDirectMusicTrack8 of DMCommandTrack.
by Alexandre Julliard
01 Jul '15
01 Jul '15
Module: wine Branch: master Commit: 29e9988bf04f26db59d5c2673062ba53e15e636a URL:
http://source.winehq.org/git/wine.git/?a=commit;h=29e9988bf04f26db59d5c2673…
Author: Michael Stefaniuc <mstefani(a)redhat.de> Date: Wed Jul 1 09:13:40 2015 +0200 dmstyle: COM cleanup for IDirectMusicTrack8 of DMCommandTrack. --- dlls/dmstyle/commandtrack.c | 151 ++++++++++++++++++++++++++------------------ 1 file changed, 91 insertions(+), 60 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=29e9988bf04f26db59d5c…
1
0
0
0
Michael Stefaniuc : dmstyle: Pass objects instead of ifaces to helpers.
by Alexandre Julliard
01 Jul '15
01 Jul '15
Module: wine Branch: master Commit: 040b3989976ca390351108d129029eecf0eeeb02 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=040b3989976ca390351108d12…
Author: Michael Stefaniuc <mstefani(a)redhat.de> Date: Wed Jul 1 09:12:22 2015 +0200 dmstyle: Pass objects instead of ifaces to helpers. --- dlls/dmstyle/chordtrack.c | 8 ++++---- dlls/dmstyle/styletrack.c | 18 ++++++++++-------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/dlls/dmstyle/chordtrack.c b/dlls/dmstyle/chordtrack.c index 40f9018..1c7cb97 100644 --- a/dlls/dmstyle/chordtrack.c +++ b/dlls/dmstyle/chordtrack.c @@ -277,9 +277,9 @@ static HRESULT WINAPI IDirectMusicChordTrack_IPersistStream_IsDirty (LPPERSISTST return S_FALSE; } -static HRESULT IDirectMusicChordTrack_IPersistStream_ParseChordTrackList (LPPERSISTSTREAM iface, DMUS_PRIVATE_CHUNK* pChunk, IStream* pStm) { - - ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface); +static HRESULT parse_chordtrack_list(IDirectMusicChordTrack *This, DMUS_PRIVATE_CHUNK *pChunk, + IStream *pStm) +{ DMUS_PRIVATE_CHUNK Chunk; DWORD ListSize[3], ListCount[3]; LARGE_INTEGER liMove; /* used when skipping chunks */ @@ -371,7 +371,7 @@ static HRESULT WINAPI IDirectMusicChordTrack_IPersistStream_Load (LPPERSISTSTREA switch (Chunk.fccID) { case DMUS_FOURCC_CHORDTRACK_LIST: { TRACE_(dmfile)(": Chord track list\n"); - hr = IDirectMusicChordTrack_IPersistStream_ParseChordTrackList (iface, &Chunk, pStm); + hr = parse_chordtrack_list(This, &Chunk, pStm); if (FAILED(hr)) return hr; break; } diff --git a/dlls/dmstyle/styletrack.c b/dlls/dmstyle/styletrack.c index 4678552..8e02783 100644 --- a/dlls/dmstyle/styletrack.c +++ b/dlls/dmstyle/styletrack.c @@ -279,8 +279,9 @@ static HRESULT WINAPI IDirectMusicStyleTrack_IPersistStream_IsDirty (LPPERSISTST return S_FALSE; } -static HRESULT IDirectMusicStyleTrack_IPersistStream_ParseStyleRef (LPPERSISTSTREAM iface, DMUS_PRIVATE_CHUNK* pChunk, IStream* pStm) { - ICOM_THIS_MULTI(IDirectMusicStyleTrack, PersistStreamVtbl, iface); +static HRESULT parse_style_ref(IDirectMusicStyleTrack *This, DMUS_PRIVATE_CHUNK *pChunk, + IStream *pStm) +{ DMUS_PRIVATE_CHUNK Chunk; DWORD ListSize[3], ListCount[3]; LARGE_INTEGER liMove; /* used when skipping chunks */ @@ -325,7 +326,8 @@ static HRESULT IDirectMusicStyleTrack_IPersistStream_ParseStyleRef (LPPERSISTSTR */ case DMUS_FOURCC_REF_LIST: { FIXME_(dmfile)(": DMRF (DM References) list, not yet handled\n"); - hr = IDirectMusicUtils_IPersistStream_ParseReference (iface, &Chunk, pStm, &pObject); + hr = IDirectMusicUtils_IPersistStream_ParseReference((IPersistStream*)&This->PersistStreamVtbl, + &Chunk, pStm, &pObject); if (FAILED(hr)) { ERR(": could not load Reference\n"); return hr; @@ -361,9 +363,9 @@ static HRESULT IDirectMusicStyleTrack_IPersistStream_ParseStyleRef (LPPERSISTSTR return S_OK; } -static HRESULT IDirectMusicStyleTrack_IPersistStream_ParseStyleTrackList (LPPERSISTSTREAM iface, DMUS_PRIVATE_CHUNK* pChunk, IStream* pStm) { - - /*ICOM_THIS_MULTI(IDirectMusicStyleTrack, PersistStreamVtbl, iface);*/ +static HRESULT parse_styletrack_list(IDirectMusicStyleTrack *This, DMUS_PRIVATE_CHUNK *pChunk, + IStream *pStm) +{ DMUS_PRIVATE_CHUNK Chunk; DWORD ListSize[3], ListCount[3]; LARGE_INTEGER liMove; /* used when skipping chunks */ @@ -390,7 +392,7 @@ static HRESULT IDirectMusicStyleTrack_IPersistStream_ParseStyleTrackList (LPPERS switch (Chunk.fccID) { case DMUS_FOURCC_STYLE_REF_LIST: { TRACE_(dmfile)(": STYLE_REF list\n"); - hr = IDirectMusicStyleTrack_IPersistStream_ParseStyleRef (iface, &Chunk, pStm); + hr = parse_style_ref(This, &Chunk, pStm); if (FAILED(hr)) return hr; break; } @@ -434,7 +436,7 @@ static HRESULT WINAPI IDirectMusicStyleTrack_IPersistStream_Load (LPPERSISTSTREA switch (Chunk.fccID) { case DMUS_FOURCC_STYLE_TRACK_LIST: { TRACE_(dmfile)(": Chord track list\n"); - hr = IDirectMusicStyleTrack_IPersistStream_ParseStyleTrackList (iface, &Chunk, pStm); + hr = parse_styletrack_list(This, &Chunk, pStm); if (FAILED(hr)) return hr; break; }
1
0
0
0
Aric Stewart : hid: Implement HidP_GetScaledUsageValue.
by Alexandre Julliard
01 Jul '15
01 Jul '15
Module: wine Branch: master Commit: 098efa1edc254916b7bda0fcd9a38162e5a7ad0e URL:
http://source.winehq.org/git/wine.git/?a=commit;h=098efa1edc254916b7bda0fcd…
Author: Aric Stewart <aric(a)codeweavers.com> Date: Tue Jun 30 07:40:41 2015 -0500 hid: Implement HidP_GetScaledUsageValue. --- dlls/hid/hid.spec | 2 +- dlls/hid/hidp.c | 65 ++++++++++++++++++++++++++++++++++++++++++++--------- include/ddk/hidpi.h | 1 + 3 files changed, 57 insertions(+), 11 deletions(-) diff --git a/dlls/hid/hid.spec b/dlls/hid/hid.spec index 8772a35..c7b056d 100644 --- a/dlls/hid/hid.spec +++ b/dlls/hid/hid.spec @@ -23,7 +23,7 @@ @ stub HidP_GetData @ stub HidP_GetExtendedAttributes @ stub HidP_GetLinkCollectionNodes -@ stub HidP_GetScaledUsageValue +@ stdcall HidP_GetScaledUsageValue(long long long long ptr ptr ptr long) @ stub HidP_GetSpecificButtonCaps @ stub HidP_GetSpecificValueCaps @ stdcall HidP_GetUsageValue(long long long long ptr ptr ptr long) diff --git a/dlls/hid/hidp.c b/dlls/hid/hidp.c index d263880..3d7a12e 100644 --- a/dlls/hid/hidp.c +++ b/dlls/hid/hidp.c @@ -150,22 +150,20 @@ NTSTATUS WINAPI HidP_GetCaps(PHIDP_PREPARSED_DATA PreparsedData, return HIDP_STATUS_SUCCESS; } - -NTSTATUS WINAPI HidP_GetUsageValue(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, - USAGE Usage, PULONG UsageValue, PHIDP_PREPARSED_DATA PreparsedData, - PCHAR Report, ULONG ReportLength) +static NTSTATUS find_value(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, + USAGE Usage, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, + WINE_HID_ELEMENT **element) { PWINE_HIDP_PREPARSED_DATA data = (PWINE_HIDP_PREPARSED_DATA)PreparsedData; WINE_HID_REPORT *report = NULL; USHORT v_count = 0, r_count = 0; int i; - TRACE("(%i, %x, %i, %i, %p, %p, %p, %i)\n", ReportType, UsagePage, LinkCollection, Usage, UsageValue, - PreparsedData, Report, ReportLength); + TRACE("(%i, %x, %i, %i, %p, %p)\n", ReportType, UsagePage, LinkCollection, Usage, + PreparsedData, Report); if (data->magic != HID_MAGIC) return HIDP_STATUS_INVALID_PREPARSED_DATA; - switch(ReportType) { case HidP_Input: @@ -206,15 +204,62 @@ NTSTATUS WINAPI HidP_GetUsageValue(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, report->Elements[i].caps.value.UsagePage == UsagePage && report->Elements[i].caps.value.u.NotRange.Usage == Usage) { - return get_report_data((BYTE*)Report, ReportLength, - report->Elements[i].valueStartBit, - report->Elements[i].bitCount, UsageValue); + *element = &report->Elements[i]; + return HIDP_STATUS_SUCCESS; } } return HIDP_STATUS_USAGE_NOT_FOUND; } +NTSTATUS WINAPI HidP_GetScaledUsageValue(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, + USHORT LinkCollection, USAGE Usage, PLONG UsageValue, + PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength) +{ + NTSTATUS rc; + WINE_HID_ELEMENT *element; + TRACE("(%i, %x, %i, %i, %p, %p, %p, %i)\n", ReportType, UsagePage, LinkCollection, Usage, UsageValue, + PreparsedData, Report, ReportLength); + + rc = find_value(ReportType, UsagePage, LinkCollection, Usage, PreparsedData, Report, &element); + + if (rc == HIDP_STATUS_SUCCESS) + { + ULONG rawValue; + rc = get_report_data((BYTE*)Report, ReportLength, + element->valueStartBit, element->bitCount, &rawValue); + if (rc != HIDP_STATUS_SUCCESS) + return rc; + if (element->caps.value.BitSize == 16) + rawValue = (short)rawValue; + *UsageValue = rawValue; + } + + return rc; +} + + +NTSTATUS WINAPI HidP_GetUsageValue(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, + USAGE Usage, PULONG UsageValue, PHIDP_PREPARSED_DATA PreparsedData, + PCHAR Report, ULONG ReportLength) +{ + WINE_HID_ELEMENT *element; + NTSTATUS rc; + + TRACE("(%i, %x, %i, %i, %p, %p, %p, %i)\n", ReportType, UsagePage, LinkCollection, Usage, UsageValue, + PreparsedData, Report, ReportLength); + + rc = find_value(ReportType, UsagePage, LinkCollection, Usage, PreparsedData, Report, &element); + + if (rc == HIDP_STATUS_SUCCESS) + { + return get_report_data((BYTE*)Report, ReportLength, + element->valueStartBit, element->bitCount, UsageValue); + } + + return rc; +} + NTSTATUS WINAPI HidP_GetUsages(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, PUSAGE UsageList, PULONG UsageLength, PHIDP_PREPARSED_DATA PreparsedData, diff --git a/include/ddk/hidpi.h b/include/ddk/hidpi.h index 40821de..527a966 100644 --- a/include/ddk/hidpi.h +++ b/include/ddk/hidpi.h @@ -143,6 +143,7 @@ NTSTATUS WINAPI HidP_GetUsageValue(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, NTSTATUS WINAPI HidP_GetValueCaps(HIDP_REPORT_TYPE ReportType, PHIDP_VALUE_CAPS ValueCaps, PUSHORT ValueCapsLength, PHIDP_PREPARSED_DATA PreparsedData); NTSTATUS WINAPI HidP_InitializeReportForID(HIDP_REPORT_TYPE ReportType, UCHAR ReportID, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength); ULONG WINAPI HidP_MaxUsageListLength(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, PHIDP_PREPARSED_DATA PreparsedData); +NTSTATUS WINAPI HidP_GetScaledUsageValue(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, USAGE Usage, PLONG UsageValue, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength); #ifndef FACILITY_HID_ERROR_CODE #define FACILITY_HID_ERROR_CODE 0x11
1
0
0
0
Aric Stewart : hid: Implement HidP_MaxUsageListLength.
by Alexandre Julliard
01 Jul '15
01 Jul '15
Module: wine Branch: master Commit: 1174fc63adac9ccb6046898bd33973a33ff2e1db URL:
http://source.winehq.org/git/wine.git/?a=commit;h=1174fc63adac9ccb6046898bd…
Author: Aric Stewart <aric(a)codeweavers.com> Date: Tue Jun 30 07:40:32 2015 -0500 hid: Implement HidP_MaxUsageListLength. --- dlls/hid/hid.spec | 2 +- dlls/hid/hidp.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ include/ddk/hidpi.h | 2 +- 3 files changed, 55 insertions(+), 2 deletions(-) diff --git a/dlls/hid/hid.spec b/dlls/hid/hid.spec index 2dad3c7..8772a35 100644 --- a/dlls/hid/hid.spec +++ b/dlls/hid/hid.spec @@ -33,7 +33,7 @@ @ stdcall HidP_GetValueCaps(long ptr ptr ptr) @ stdcall HidP_InitializeReportForID(long long ptr ptr long) @ stub HidP_MaxDataListLength -@ stub HidP_MaxUsageListLength +@ stdcall HidP_MaxUsageListLength(long long ptr) @ stub HidP_SetData @ stub HidP_SetScaledUsageValue @ stub HidP_SetUsageValue diff --git a/dlls/hid/hidp.c b/dlls/hid/hidp.c index d680f78..d263880 100644 --- a/dlls/hid/hidp.c +++ b/dlls/hid/hidp.c @@ -421,3 +421,56 @@ NTSTATUS WINAPI HidP_InitializeReportForID(HIDP_REPORT_TYPE ReportType, UCHAR Re return HIDP_STATUS_SUCCESS; } + +ULONG WINAPI HidP_MaxUsageListLength(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, PHIDP_PREPARSED_DATA PreparsedData) +{ + PWINE_HIDP_PREPARSED_DATA data = (PWINE_HIDP_PREPARSED_DATA)PreparsedData; + WINE_HID_REPORT *report = NULL; + int r_count; + int i; + int count = 0; + + TRACE("(%i, %x, %p)\n", ReportType, UsagePage, PreparsedData); + + if (data->magic != HID_MAGIC) + return 0; + + switch(ReportType) + { + case HidP_Input: + report = HID_INPUT_REPORTS(data); + r_count = data->dwInputReportCount; + break; + case HidP_Output: + report = HID_OUTPUT_REPORTS(data); + r_count = data->dwOutputReportCount; + break; + case HidP_Feature: + report = HID_FEATURE_REPORTS(data); + r_count = data->dwFeatureReportCount; + break; + default: + return HIDP_STATUS_INVALID_REPORT_TYPE; + } + + if (!r_count || !report) + return 0; + + for (i = 0; i < r_count; i++) + { + int j; + for (j = 0; j < report->elementCount; j++) + { + if (report->Elements[j].caps.button.UsagePage == UsagePage) + { + if (report->Elements[j].caps.button.IsRange) + count += (report->Elements[j].caps.button.u.Range.UsageMax - + report->Elements[j].caps.button.u.Range.UsageMin) + 1; + else + count++; + } + } + report = HID_NEXT_REPORT(data, report); + } + return count; +} diff --git a/include/ddk/hidpi.h b/include/ddk/hidpi.h index f4da89d..40821de 100644 --- a/include/ddk/hidpi.h +++ b/include/ddk/hidpi.h @@ -142,7 +142,7 @@ NTSTATUS WINAPI HidP_GetUsages(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USH NTSTATUS WINAPI HidP_GetUsageValue(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, USAGE Usage, PULONG UsageValue, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength); NTSTATUS WINAPI HidP_GetValueCaps(HIDP_REPORT_TYPE ReportType, PHIDP_VALUE_CAPS ValueCaps, PUSHORT ValueCapsLength, PHIDP_PREPARSED_DATA PreparsedData); NTSTATUS WINAPI HidP_InitializeReportForID(HIDP_REPORT_TYPE ReportType, UCHAR ReportID, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength); - +ULONG WINAPI HidP_MaxUsageListLength(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, PHIDP_PREPARSED_DATA PreparsedData); #ifndef FACILITY_HID_ERROR_CODE #define FACILITY_HID_ERROR_CODE 0x11
1
0
0
0
← Newer
1
...
51
52
53
54
55
56
57
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
Results per page:
10
25
50
100
200