ReactOS.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
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
List overview
Download
Ros-diffs
September 2014
----- 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
ros-diffs@reactos.org
16 participants
413 discussions
Start a n
N
ew thread
[akhaldi] 64300: [DMUSIC] * Sync with Wine 1.7.27. CORE-8540
by akhaldi@svn.reactos.org
Author: akhaldi Date: Fri Sep 26 09:19:09 2014 New Revision: 64300 URL:
http://svn.reactos.org/svn/reactos?rev=64300&view=rev
Log: [DMUSIC] * Sync with Wine 1.7.27. CORE-8540 Added: trunk/reactos/dll/directx/wine/dmusic/dmobject.c (with props) trunk/reactos/dll/directx/wine/dmusic/dmobject.h (with props) Modified: trunk/reactos/dll/directx/wine/dmusic/CMakeLists.txt trunk/reactos/dll/directx/wine/dmusic/buffer.c trunk/reactos/dll/directx/wine/dmusic/clock.c trunk/reactos/dll/directx/wine/dmusic/collection.c trunk/reactos/dll/directx/wine/dmusic/dmusic.c trunk/reactos/dll/directx/wine/dmusic/dmusic_private.h trunk/reactos/dll/directx/wine/dmusic/download.c trunk/reactos/dll/directx/wine/dmusic/instrument.c trunk/reactos/dll/directx/wine/dmusic/port.c trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/dll/directx/wine/dmusic/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/dmusic/CM…
============================================================================== --- trunk/reactos/dll/directx/wine/dmusic/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/directx/wine/dmusic/CMakeLists.txt [iso-8859-1] Fri Sep 26 09:19:09 2014 @@ -7,6 +7,7 @@ buffer.c clock.c collection.c + dmobject.c dmusic.c dmusic_main.c download.c Modified: trunk/reactos/dll/directx/wine/dmusic/buffer.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/dmusic/bu…
============================================================================== --- trunk/reactos/dll/directx/wine/dmusic/buffer.c [iso-8859-1] (original) +++ trunk/reactos/dll/directx/wine/dmusic/buffer.c [iso-8859-1] Fri Sep 26 09:19:09 2014 @@ -55,8 +55,6 @@ TRACE("(%p)->(): new ref = %u\n", iface, ref); - DMUSIC_LockModule(); - return ref; } @@ -70,9 +68,8 @@ if (!ref) { HeapFree(GetProcessHeap(), 0, This->data); HeapFree(GetProcessHeap(), 0, This); + DMUSIC_UnlockModule(); } - - DMUSIC_UnlockModule(); return ref; } @@ -277,7 +274,6 @@ HRESULT DMUSIC_CreateDirectMusicBufferImpl(LPDMUS_BUFFERDESC desc, LPVOID* ret_iface) { IDirectMusicBufferImpl* dmbuffer; - HRESULT hr; TRACE("(%p, %p)\n", desc, ret_iface); @@ -288,7 +284,7 @@ return E_OUTOFMEMORY; dmbuffer->IDirectMusicBuffer_iface.lpVtbl = &DirectMusicBuffer_Vtbl; - dmbuffer->ref = 0; /* Will be inited by QueryInterface */ + dmbuffer->ref = 1; if (IsEqualGUID(&desc->guidBufferFormat, &GUID_NULL)) dmbuffer->format = KSDATAFORMAT_SUBTYPE_MIDI; @@ -302,12 +298,8 @@ return E_OUTOFMEMORY; } - hr = IDirectMusicBufferImpl_QueryInterface((LPDIRECTMUSICBUFFER)dmbuffer, &IID_IDirectMusicBuffer, ret_iface); - if (FAILED(hr)) - { - HeapFree(GetProcessHeap(), 0, dmbuffer->data); - HeapFree(GetProcessHeap(), 0, dmbuffer); - } - - return hr; -} + DMUSIC_LockModule(); + *ret_iface = &dmbuffer->IDirectMusicBuffer_iface; + + return S_OK; +} Modified: trunk/reactos/dll/directx/wine/dmusic/clock.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/dmusic/cl…
============================================================================== --- trunk/reactos/dll/directx/wine/dmusic/clock.c [iso-8859-1] (original) +++ trunk/reactos/dll/directx/wine/dmusic/clock.c [iso-8859-1] Fri Sep 26 09:19:09 2014 @@ -48,8 +48,6 @@ TRACE("(%p)->(): new ref = %u\n", This, ref); - DMUSIC_LockModule(); - return ref; } @@ -60,10 +58,10 @@ TRACE("(%p)->(): new ref = %u\n", This, ref); - if (!ref) + if (!ref) { HeapFree(GetProcessHeap(), 0, This); - - DMUSIC_UnlockModule(); + DMUSIC_UnlockModule(); + } return ref; } @@ -121,6 +119,7 @@ HRESULT DMUSIC_CreateReferenceClockImpl(LPCGUID riid, LPVOID* ret_iface, LPUNKNOWN unkouter) { IReferenceClockImpl* clock; + HRESULT hr; TRACE("(%p,%p,%p)\n", riid, ret_iface, unkouter); @@ -131,9 +130,13 @@ } clock->IReferenceClock_iface.lpVtbl = &ReferenceClock_Vtbl; - clock->ref = 0; /* Will be inited by QueryInterface */ + clock->ref = 1; clock->rtTime = 0; clock->pClockInfo.dwSize = sizeof (DMUS_CLOCKINFO); - return IReferenceClockImpl_QueryInterface((IReferenceClock*)clock, riid, ret_iface); + DMUSIC_LockModule(); + hr = IReferenceClockImpl_QueryInterface(&clock->IReferenceClock_iface, riid, ret_iface); + IReferenceClockImpl_Release(&clock->IReferenceClock_iface); + + return hr; } Modified: trunk/reactos/dll/directx/wine/dmusic/collection.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/dmusic/co…
============================================================================== --- trunk/reactos/dll/directx/wine/dmusic/collection.c [iso-8859-1] (original) +++ trunk/reactos/dll/directx/wine/dmusic/collection.c [iso-8859-1] Fri Sep 26 09:19:09 2014 @@ -24,26 +24,44 @@ WINE_DECLARE_DEBUG_CHANNEL(dmfile); -static inline IDirectMusicCollectionImpl *impl_from_IDirectMusicCollection(IDirectMusicCollection *iface) -{ - return CONTAINING_RECORD(iface, IDirectMusicCollectionImpl, IDirectMusicCollection_iface); -} - -static inline IDirectMusicCollectionImpl *impl_from_IDirectMusicObject(IDirectMusicObject *iface) -{ - return CONTAINING_RECORD(iface, IDirectMusicCollectionImpl, IDirectMusicObject_iface); -} - -static inline IDirectMusicCollectionImpl *impl_from_IPersistStream(IPersistStream *iface) -{ - return CONTAINING_RECORD(iface, IDirectMusicCollectionImpl, IPersistStream_iface); -} - /***************************************************************************** * IDirectMusicCollectionImpl implementation */ +typedef struct IDirectMusicCollectionImpl { + IDirectMusicCollection IDirectMusicCollection_iface; + struct dmobject dmobj; + LONG ref; + /* IDirectMusicCollectionImpl fields */ + IStream *pStm; /* stream from which we load collection and later instruments */ + LARGE_INTEGER liCollectionPosition; /* offset in a stream where collection was loaded from */ + LARGE_INTEGER liWavePoolTablePosition; /* offset in a stream where wave pool table can be found */ + CHAR *szCopyright; /* FIXME: should probably be placed somewhere else */ + DLSHEADER *pHeader; + /* pool table */ + POOLTABLE *pPoolTable; + POOLCUE *pPoolCues; + /* instruments */ + struct list Instruments; +} IDirectMusicCollectionImpl; + +static inline IDirectMusicCollectionImpl *impl_from_IDirectMusicCollection(IDirectMusicCollection *iface) +{ + return CONTAINING_RECORD(iface, IDirectMusicCollectionImpl, IDirectMusicCollection_iface); +} + +static inline struct dmobject *impl_from_IDirectMusicObject(IDirectMusicObject *iface) +{ + return CONTAINING_RECORD(iface, struct dmobject, IDirectMusicObject_iface); +} + +static inline IDirectMusicCollectionImpl *impl_from_IPersistStream(IPersistStream *iface) +{ + return CONTAINING_RECORD(iface, IDirectMusicCollectionImpl, dmobj.IPersistStream_iface); +} + /* IDirectMusicCollectionImpl IUnknown part: */ -static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicCollection_QueryInterface(LPDIRECTMUSICCOLLECTION iface, REFIID riid, LPVOID *ret_iface) +static HRESULT WINAPI IDirectMusicCollectionImpl_QueryInterface(IDirectMusicCollection *iface, + REFIID riid, void **ret_iface) { IDirectMusicCollectionImpl *This = impl_from_IDirectMusicCollection(iface); @@ -54,9 +72,9 @@ if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IDirectMusicCollection)) *ret_iface = iface; else if (IsEqualIID(riid, &IID_IDirectMusicObject)) - *ret_iface = &This->IDirectMusicObject_iface; + *ret_iface = &This->dmobj.IDirectMusicObject_iface; else if (IsEqualIID(riid, &IID_IPersistStream)) - *ret_iface = &This->IPersistStream_iface; + *ret_iface = &This->dmobj.IPersistStream_iface; else { WARN("(%p/%p)->(%s, %p): not found\n", iface, This, debugstr_dmguid(riid), ret_iface); @@ -67,35 +85,34 @@ return S_OK; } -static ULONG WINAPI IDirectMusicCollectionImpl_IDirectMusicCollection_AddRef(LPDIRECTMUSICCOLLECTION iface) +static ULONG WINAPI IDirectMusicCollectionImpl_AddRef(IDirectMusicCollection *iface) { IDirectMusicCollectionImpl *This = impl_from_IDirectMusicCollection(iface); ULONG ref = InterlockedIncrement(&This->ref); TRACE("(%p/%p)->(): new ref = %u\n", iface, This, ref); - DMUSIC_LockModule(); - return ref; } -static ULONG WINAPI IDirectMusicCollectionImpl_IDirectMusicCollection_Release(LPDIRECTMUSICCOLLECTION iface) +static ULONG WINAPI IDirectMusicCollectionImpl_Release(IDirectMusicCollection *iface) { IDirectMusicCollectionImpl *This = impl_from_IDirectMusicCollection(iface); ULONG ref = InterlockedDecrement(&This->ref); TRACE("(%p/%p)->(): new ref = %u\n", iface, This, ref); - if (!ref) + if (!ref) { HeapFree(GetProcessHeap(), 0, This); - - DMUSIC_UnlockModule(); + DMUSIC_UnlockModule(); + } return ref; } /* IDirectMusicCollection Interface follows: */ -static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicCollection_GetInstrument(LPDIRECTMUSICCOLLECTION iface, DWORD patch, IDirectMusicInstrument** instrument) +static HRESULT WINAPI IDirectMusicCollectionImpl_GetInstrument(IDirectMusicCollection *iface, + DWORD patch, IDirectMusicInstrument **instrument) { IDirectMusicCollectionImpl *This = impl_from_IDirectMusicCollection(iface); DMUS_PRIVATE_INSTRUMENTENTRY *inst_entry; @@ -121,7 +138,8 @@ return DMUS_E_INVALIDPATCH; } -static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicCollection_EnumInstrument(LPDIRECTMUSICCOLLECTION iface, DWORD index, DWORD* patch, LPWSTR name, DWORD name_length) +static HRESULT WINAPI IDirectMusicCollectionImpl_EnumInstrument(IDirectMusicCollection *iface, + DWORD index, DWORD *patch, LPWSTR name, DWORD name_length) { IDirectMusicCollectionImpl *This = impl_from_IDirectMusicCollection(iface); DWORD i = 0; @@ -150,96 +168,14 @@ } static const IDirectMusicCollectionVtbl DirectMusicCollection_Collection_Vtbl = { - IDirectMusicCollectionImpl_IDirectMusicCollection_QueryInterface, - IDirectMusicCollectionImpl_IDirectMusicCollection_AddRef, - IDirectMusicCollectionImpl_IDirectMusicCollection_Release, - IDirectMusicCollectionImpl_IDirectMusicCollection_GetInstrument, - IDirectMusicCollectionImpl_IDirectMusicCollection_EnumInstrument + IDirectMusicCollectionImpl_QueryInterface, + IDirectMusicCollectionImpl_AddRef, + IDirectMusicCollectionImpl_Release, + IDirectMusicCollectionImpl_GetInstrument, + IDirectMusicCollectionImpl_EnumInstrument }; /* IDirectMusicCollectionImpl IDirectMusicObject part: */ -static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_QueryInterface(LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ret_iface) -{ - IDirectMusicCollectionImpl *This = impl_from_IDirectMusicObject(iface); - return IDirectMusicCollection_QueryInterface(&This->IDirectMusicCollection_iface, riid, ret_iface); -} - -static ULONG WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_AddRef(LPDIRECTMUSICOBJECT iface) -{ - IDirectMusicCollectionImpl *This = impl_from_IDirectMusicObject(iface); - return IDirectMusicCollection_AddRef(&This->IDirectMusicCollection_iface); -} - -static ULONG WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_Release(LPDIRECTMUSICOBJECT iface) -{ - IDirectMusicCollectionImpl *This = impl_from_IDirectMusicObject(iface); - return IDirectMusicCollection_Release(&This->IDirectMusicCollection_iface); -} - -static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_GetDescriptor(LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) -{ - IDirectMusicCollectionImpl *This = impl_from_IDirectMusicObject(iface); - - TRACE("(%p/%p)->(%p)\n", iface, This, pDesc); - - if (!pDesc) - return E_POINTER; - - memcpy (pDesc, This->pDesc, This->pDesc->dwSize); - - return S_OK; -} - -static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_SetDescriptor(LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) -{ - IDirectMusicCollectionImpl *This = impl_from_IDirectMusicObject(iface); - HRESULT ret = S_OK; - - - TRACE("(%p, %p)\n", iface, pDesc); - - if (!pDesc) - return E_POINTER; - - if (TRACE_ON(dmusic)) - { - TRACE("Setting descriptor:\n"); - dump_DMUS_OBJECTDESC(pDesc); - } - - /* According to MSDN, we should copy only given values, not whole struct */ - if (pDesc->dwValidData & DMUS_OBJ_OBJECT) - This->pDesc->guidObject = pDesc->guidObject; - if (pDesc->dwValidData & DMUS_OBJ_CLASS) - { - pDesc->dwValidData &= ~DMUS_OBJ_CLASS; - ret = S_FALSE; - } - if (pDesc->dwValidData & DMUS_OBJ_NAME) - lstrcpynW(This->pDesc->wszName, pDesc->wszName, DMUS_MAX_NAME); - if (pDesc->dwValidData & DMUS_OBJ_CATEGORY) - lstrcpynW(This->pDesc->wszCategory, pDesc->wszCategory, DMUS_MAX_CATEGORY); - if (pDesc->dwValidData & DMUS_OBJ_FILENAME) - lstrcpynW(This->pDesc->wszFileName, pDesc->wszFileName, DMUS_MAX_FILENAME); - if (pDesc->dwValidData & DMUS_OBJ_VERSION) - This->pDesc->vVersion = pDesc->vVersion; - if (pDesc->dwValidData & DMUS_OBJ_DATE) - This->pDesc->ftDate = pDesc->ftDate; - if (pDesc->dwValidData & DMUS_OBJ_MEMORY) { - This->pDesc->llMemLength = pDesc->llMemLength; - memcpy (This->pDesc->pbMemData, pDesc->pbMemData, pDesc->llMemLength); - } - if (pDesc->dwValidData & DMUS_OBJ_STREAM) { - /* according to MSDN, we copy the stream */ - IStream_Clone (pDesc->pStream, &This->pDesc->pStream); - } - - /* add new flags */ - This->pDesc->dwValidData |= pDesc->dwValidData; - - return ret; -} - static HRESULT read_from_stream(IStream *stream, void *data, ULONG size) { ULONG read; @@ -258,9 +194,10 @@ return S_OK; } -static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_ParseDescriptor(LPDIRECTMUSICOBJECT iface, LPSTREAM stream, LPDMUS_OBJECTDESC desc) -{ - IDirectMusicCollectionImpl *This = impl_from_IDirectMusicObject(iface); +static HRESULT WINAPI IDirectMusicObjectImpl_ParseDescriptor(IDirectMusicObject *iface, + IStream *stream, DMUS_OBJECTDESC *desc) +{ + struct dmobject *This = impl_from_IDirectMusicObject(iface); DMUS_PRIVATE_CHUNK chunk; DWORD StreamSize, StreamCount, ListSize[1], ListCount[1]; LARGE_INTEGER liMove; /* used when skipping chunks */ @@ -270,7 +207,7 @@ /* FIXME: should this be determined from stream? */ desc->dwValidData |= DMUS_OBJ_CLASS; - desc->guidClass = This->pDesc->guidClass; + desc->guidClass = This->desc.guidClass; hr = read_from_stream(stream, &chunk, sizeof(FOURCC) + sizeof(DWORD)); if (FAILED(hr)) @@ -446,45 +383,18 @@ return S_OK; } -static const IDirectMusicObjectVtbl DirectMusicCollection_Object_Vtbl = { - IDirectMusicCollectionImpl_IDirectMusicObject_QueryInterface, - IDirectMusicCollectionImpl_IDirectMusicObject_AddRef, - IDirectMusicCollectionImpl_IDirectMusicObject_Release, - IDirectMusicCollectionImpl_IDirectMusicObject_GetDescriptor, - IDirectMusicCollectionImpl_IDirectMusicObject_SetDescriptor, - IDirectMusicCollectionImpl_IDirectMusicObject_ParseDescriptor +static const IDirectMusicObjectVtbl dmobject_vtbl = { + dmobj_IDirectMusicObject_QueryInterface, + dmobj_IDirectMusicObject_AddRef, + dmobj_IDirectMusicObject_Release, + dmobj_IDirectMusicObject_GetDescriptor, + dmobj_IDirectMusicObject_SetDescriptor, + IDirectMusicObjectImpl_ParseDescriptor }; /* IDirectMusicCollectionImpl IPersistStream part: */ -static HRESULT WINAPI IDirectMusicCollectionImpl_IPersistStream_QueryInterface(LPPERSISTSTREAM iface, REFIID riid, LPVOID *ret_iface) -{ - IDirectMusicCollectionImpl *This = impl_from_IPersistStream(iface); - return IDirectMusicCollection_QueryInterface(&This->IDirectMusicCollection_iface, riid, ret_iface); -} - -static ULONG WINAPI IDirectMusicCollectionImpl_IPersistStream_AddRef (LPPERSISTSTREAM iface) -{ - IDirectMusicCollectionImpl *This = impl_from_IPersistStream(iface); - return IDirectMusicCollection_AddRef(&This->IDirectMusicCollection_iface); -} - -static ULONG WINAPI IDirectMusicCollectionImpl_IPersistStream_Release (LPPERSISTSTREAM iface) -{ - IDirectMusicCollectionImpl *This = impl_from_IPersistStream(iface); - return IDirectMusicCollection_Release(&This->IDirectMusicCollection_iface); -} - -static HRESULT WINAPI IDirectMusicCollectionImpl_IPersistStream_GetClassID(LPPERSISTSTREAM iface, CLSID* pClassID) -{ - return E_NOTIMPL; -} - -static HRESULT WINAPI IDirectMusicCollectionImpl_IPersistStream_IsDirty(LPPERSISTSTREAM iface) -{ - return E_NOTIMPL; -} - -static HRESULT WINAPI IDirectMusicCollectionImpl_IPersistStream_Load(LPPERSISTSTREAM iface, IStream* stream) +static HRESULT WINAPI IPersistStreamImpl_Load(IPersistStream *iface, + IStream *stream) { IDirectMusicCollectionImpl *This = impl_from_IPersistStream(iface); DMUS_PRIVATE_CHUNK chunk; @@ -534,14 +444,14 @@ } case FOURCC_DLID: { TRACE_(dmfile)(": DLID (GUID) chunk\n"); - This->pDesc->dwValidData |= DMUS_OBJ_OBJECT; - IStream_Read(stream, &This->pDesc->guidObject, chunk.dwSize, NULL); + This->dmobj.desc.dwValidData |= DMUS_OBJ_OBJECT; + IStream_Read(stream, &This->dmobj.desc.guidObject, chunk.dwSize, NULL); break; } case FOURCC_VERS: { TRACE_(dmfile)(": version chunk\n"); - This->pDesc->dwValidData |= DMUS_OBJ_VERSION; - IStream_Read(stream, &This->pDesc->vVersion, chunk.dwSize, NULL); + This->dmobj.desc.dwValidData |= DMUS_OBJ_VERSION; + IStream_Read(stream, &This->dmobj.desc.vVersion, chunk.dwSize, NULL); break; } case FOURCC_PTBL: { @@ -569,9 +479,9 @@ case mmioFOURCC('I','N','A','M'): { CHAR szName[DMUS_MAX_NAME]; TRACE_(dmfile)(": name chunk\n"); - This->pDesc->dwValidData |= DMUS_OBJ_NAME; + This->dmobj.desc.dwValidData |= DMUS_OBJ_NAME; IStream_Read(stream, szName, chunk.dwSize, NULL); - MultiByteToWideChar(CP_ACP, 0, szName, -1, This->pDesc->wszName, DMUS_MAX_NAME); + MultiByteToWideChar(CP_ACP, 0, szName, -1, This->dmobj.desc.wszName, DMUS_MAX_NAME); if (even_or_odd(chunk.dwSize)) { ListCount[0]++; liMove.QuadPart = 1; @@ -765,13 +675,13 @@ struct list *listEntry; TRACE("*** IDirectMusicCollection (%p) ***\n", &This->IDirectMusicCollection_iface); - if (This->pDesc->dwValidData & DMUS_OBJ_OBJECT) - TRACE(" - GUID = %s\n", debugstr_dmguid(&This->pDesc->guidObject)); - if (This->pDesc->dwValidData & DMUS_OBJ_VERSION) - TRACE(" - Version = %i,%i,%i,%i\n", (This->pDesc->vVersion.dwVersionMS >> 8) & 0x0000FFFF, This->pDesc->vVersion.dwVersionMS & 0x0000FFFF, - (This->pDesc->vVersion.dwVersionLS >> 8) & 0x0000FFFF, This->pDesc->vVersion.dwVersionLS & 0x0000FFFF); - if (This->pDesc->dwValidData & DMUS_OBJ_NAME) - TRACE(" - Name = %s\n", debugstr_w(This->pDesc->wszName)); + if (This->dmobj.desc.dwValidData & DMUS_OBJ_OBJECT) + TRACE(" - GUID = %s\n", debugstr_dmguid(&This->dmobj.desc.guidObject)); + if (This->dmobj.desc.dwValidData & DMUS_OBJ_VERSION) + TRACE(" - Version = %i,%i,%i,%i\n", (This->dmobj.desc.vVersion.dwVersionMS >> 8) & 0x0000FFFF, This->dmobj.desc.vVersion.dwVersionMS & 0x0000FFFF, + (This->dmobj.desc.vVersion.dwVersionLS >> 8) & 0x0000FFFF, This->dmobj.desc.vVersion.dwVersionLS & 0x0000FFFF); + if (This->dmobj.desc.dwValidData & DMUS_OBJ_NAME) + TRACE(" - Name = %s\n", debugstr_w(This->dmobj.desc.wszName)); TRACE(" - Collection header:\n"); TRACE(" - cInstruments: %d\n", This->pHeader->cInstruments); @@ -787,29 +697,18 @@ return S_OK; } -static HRESULT WINAPI IDirectMusicCollectionImpl_IPersistStream_Save(LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) -{ - return E_NOTIMPL; -} - -static HRESULT WINAPI IDirectMusicCollectionImpl_IPersistStream_GetSizeMax(LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) -{ - return E_NOTIMPL; -} - -static const IPersistStreamVtbl DirectMusicCollection_PersistStream_Vtbl = { - IDirectMusicCollectionImpl_IPersistStream_QueryInterface, - IDirectMusicCollectionImpl_IPersistStream_AddRef, - IDirectMusicCollectionImpl_IPersistStream_Release, - IDirectMusicCollectionImpl_IPersistStream_GetClassID, - IDirectMusicCollectionImpl_IPersistStream_IsDirty, - IDirectMusicCollectionImpl_IPersistStream_Load, - IDirectMusicCollectionImpl_IPersistStream_Save, - IDirectMusicCollectionImpl_IPersistStream_GetSizeMax +static const IPersistStreamVtbl persiststream_vtbl = { + dmobj_IPersistStream_QueryInterface, + dmobj_IPersistStream_AddRef, + dmobj_IPersistStream_Release, + unimpl_IPersistStream_GetClassID, + unimpl_IPersistStream_IsDirty, + IPersistStreamImpl_Load, + unimpl_IPersistStream_Save, + unimpl_IPersistStream_GetSizeMax }; -/* for ClassFactory */ HRESULT WINAPI DMUSIC_CreateDirectMusicCollectionImpl(LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) { IDirectMusicCollectionImpl* obj; @@ -824,15 +723,15 @@ return E_OUTOFMEMORY; obj->IDirectMusicCollection_iface.lpVtbl = &DirectMusicCollection_Collection_Vtbl; - obj->IDirectMusicObject_iface.lpVtbl = &DirectMusicCollection_Object_Vtbl; - obj->IPersistStream_iface.lpVtbl = &DirectMusicCollection_PersistStream_Vtbl; - obj->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC)); - DM_STRUCT_INIT(obj->pDesc); - obj->pDesc->dwValidData |= DMUS_OBJ_CLASS; - obj->pDesc->guidClass = CLSID_DirectMusicCollection; obj->ref = 1; + dmobject_init(&obj->dmobj, &CLSID_DirectMusicCollection, + (IUnknown*)&obj->IDirectMusicCollection_iface); + obj->dmobj.IDirectMusicObject_iface.lpVtbl = &dmobject_vtbl; + obj->dmobj.IPersistStream_iface.lpVtbl = &persiststream_vtbl; + list_init (&obj->Instruments); + DMUSIC_LockModule(); hr = IDirectMusicCollection_QueryInterface(&obj->IDirectMusicCollection_iface, lpcGUID, ppobj); IDirectMusicCollection_Release(&obj->IDirectMusicCollection_iface); Added: trunk/reactos/dll/directx/wine/dmusic/dmobject.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/dmusic/dm…
============================================================================== --- trunk/reactos/dll/directx/wine/dmusic/dmobject.c (added) +++ trunk/reactos/dll/directx/wine/dmusic/dmobject.c [iso-8859-1] Fri Sep 26 09:19:09 2014 @@ -0,0 +1,164 @@ +/* + * Base IDirectMusicObject Implementation + * + * Copyright (C) 2003-2004 Rok Mandeljc + * Copyright (C) 2014 Michael Stefaniuc + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "dmusic_private.h" + +/* Generic IDirectMusicObject methods */ +static inline struct dmobject *impl_from_IDirectMusicObject(IDirectMusicObject *iface) +{ + return CONTAINING_RECORD(iface, struct dmobject, IDirectMusicObject_iface); +} + +HRESULT WINAPI dmobj_IDirectMusicObject_QueryInterface(IDirectMusicObject *iface, REFIID riid, + void **ret_iface) +{ + struct dmobject *This = impl_from_IDirectMusicObject(iface); + return IUnknown_QueryInterface(This->outer_unk, riid, ret_iface); +} + +ULONG WINAPI dmobj_IDirectMusicObject_AddRef(IDirectMusicObject *iface) +{ + struct dmobject *This = impl_from_IDirectMusicObject(iface); + return IUnknown_AddRef(This->outer_unk); +} + +ULONG WINAPI dmobj_IDirectMusicObject_Release(IDirectMusicObject *iface) +{ + struct dmobject *This = impl_from_IDirectMusicObject(iface); + return IUnknown_Release(This->outer_unk); +} + +HRESULT WINAPI dmobj_IDirectMusicObject_GetDescriptor(IDirectMusicObject *iface, + DMUS_OBJECTDESC *desc) +{ + struct dmobject *This = impl_from_IDirectMusicObject(iface); + + TRACE("(%p/%p)->(%p)\n", iface, This, desc); + + if (!desc) + return E_POINTER; + + memcpy(desc, &This->desc, This->desc.dwSize); + + return S_OK; +} + +HRESULT WINAPI dmobj_IDirectMusicObject_SetDescriptor(IDirectMusicObject *iface, + DMUS_OBJECTDESC *desc) +{ + struct dmobject *This = impl_from_IDirectMusicObject(iface); + HRESULT ret = S_OK; + + TRACE("(%p, %p)\n", iface, desc); + + if (!desc) + return E_POINTER; + + /* Immutable property */ + if (desc->dwValidData & DMUS_OBJ_CLASS) + { + desc->dwValidData &= ~DMUS_OBJ_CLASS; + ret = S_FALSE; + } + /* Set only valid fields */ + if (desc->dwValidData & DMUS_OBJ_OBJECT) + This->desc.guidObject = desc->guidObject; + if (desc->dwValidData & DMUS_OBJ_NAME) + lstrcpynW(This->desc.wszName, desc->wszName, DMUS_MAX_NAME); + if (desc->dwValidData & DMUS_OBJ_CATEGORY) + lstrcpynW(This->desc.wszCategory, desc->wszCategory, DMUS_MAX_CATEGORY); + if (desc->dwValidData & DMUS_OBJ_FILENAME) + lstrcpynW(This->desc.wszFileName, desc->wszFileName, DMUS_MAX_FILENAME); + if (desc->dwValidData & DMUS_OBJ_VERSION) + This->desc.vVersion = desc->vVersion; + if (desc->dwValidData & DMUS_OBJ_DATE) + This->desc.ftDate = desc->ftDate; + if (desc->dwValidData & DMUS_OBJ_MEMORY) { + This->desc.llMemLength = desc->llMemLength; + memcpy(This->desc.pbMemData, desc->pbMemData, desc->llMemLength); + } + if (desc->dwValidData & DMUS_OBJ_STREAM) + IStream_Clone(desc->pStream, &This->desc.pStream); + + This->desc.dwValidData |= desc->dwValidData; + + return ret; +} + +/* Generic IPersistStream methods */ +static inline struct dmobject *impl_from_IPersistStream(IPersistStream *iface) +{ + return CONTAINING_RECORD(iface, struct dmobject, IPersistStream_iface); +} + +HRESULT WINAPI dmobj_IPersistStream_QueryInterface(IPersistStream *iface, REFIID riid, + void **ret_iface) +{ + struct dmobject *This = impl_from_IPersistStream(iface); + return IUnknown_QueryInterface(This->outer_unk, riid, ret_iface); +} + +ULONG WINAPI dmobj_IPersistStream_AddRef(IPersistStream *iface) +{ + struct dmobject *This = impl_from_IPersistStream(iface); + return IUnknown_AddRef(This->outer_unk); +} + +ULONG WINAPI dmobj_IPersistStream_Release(IPersistStream *iface) +{ + struct dmobject *This = impl_from_IPersistStream(iface); + return IUnknown_Release(This->outer_unk); +} + +/* IPersistStream methods not implemented in native */ +HRESULT WINAPI unimpl_IPersistStream_GetClassID(IPersistStream *iface, CLSID *class) +{ + TRACE("(%p, %p): method not implemented\n", iface, class); + return E_NOTIMPL; +} + +HRESULT WINAPI unimpl_IPersistStream_IsDirty(IPersistStream *iface) +{ + TRACE("(%p): method not implemented, always returning S_FALSE\n", iface); + return S_FALSE; +} + +HRESULT WINAPI unimpl_IPersistStream_Save(IPersistStream *iface, IStream *stream, + BOOL clear_dirty) +{ + TRACE("(%p, %p, %d): method not implemented\n", iface, stream, clear_dirty); + return E_NOTIMPL; +} + +HRESULT WINAPI unimpl_IPersistStream_GetSizeMax(IPersistStream *iface, ULARGE_INTEGER *size) +{ + TRACE("(%p, %p): method not implemented\n", iface, size); + return E_NOTIMPL; +} + + +void dmobject_init(struct dmobject *dmobj, const GUID *class, IUnknown *outer_unk) +{ + dmobj->outer_unk = outer_unk; + dmobj->desc.dwSize = sizeof(dmobj->desc); + dmobj->desc.dwValidData = DMUS_OBJ_CLASS; + dmobj->desc.guidClass = *class; +} Propchange: trunk/reactos/dll/directx/wine/dmusic/dmobject.c ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/reactos/dll/directx/wine/dmusic/dmobject.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/dmusic/dm…
============================================================================== --- trunk/reactos/dll/directx/wine/dmusic/dmobject.h (added) +++ trunk/reactos/dll/directx/wine/dmusic/dmobject.h [iso-8859-1] Fri Sep 26 09:19:09 2014 @@ -0,0 +1,55 @@ +/* + * Base IDirectMusicObject Implementation + * + * Copyright (C) 2014 Michael Stefaniuc + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#pragma once + +struct dmobject { + IDirectMusicObject IDirectMusicObject_iface; + IPersistStream IPersistStream_iface; + IUnknown *outer_unk; + DMUS_OBJECTDESC desc; +}; + +void dmobject_init(struct dmobject *dmobj, const GUID *class, IUnknown *outer_unk) DECLSPEC_HIDDEN; + +/* Generic IDirectMusicObject methods */ +HRESULT WINAPI dmobj_IDirectMusicObject_QueryInterface(IDirectMusicObject *iface, REFIID riid, + void **ret_iface) DECLSPEC_HIDDEN; +ULONG WINAPI dmobj_IDirectMusicObject_AddRef(IDirectMusicObject *iface) DECLSPEC_HIDDEN; +ULONG WINAPI dmobj_IDirectMusicObject_Release(IDirectMusicObject *iface) DECLSPEC_HIDDEN; +HRESULT WINAPI dmobj_IDirectMusicObject_GetDescriptor(IDirectMusicObject *iface, + DMUS_OBJECTDESC *desc) DECLSPEC_HIDDEN; +HRESULT WINAPI dmobj_IDirectMusicObject_SetDescriptor(IDirectMusicObject *iface, + DMUS_OBJECTDESC *desc) DECLSPEC_HIDDEN; + +/* Generic IPersistStream methods */ +HRESULT WINAPI dmobj_IPersistStream_QueryInterface(IPersistStream *iface, REFIID riid, + void **ret_iface) DECLSPEC_HIDDEN; +ULONG WINAPI dmobj_IPersistStream_AddRef(IPersistStream *iface) DECLSPEC_HIDDEN; +ULONG WINAPI dmobj_IPersistStream_Release(IPersistStream *iface) DECLSPEC_HIDDEN; + +/* IPersistStream methods not implemented in native */ +HRESULT WINAPI unimpl_IPersistStream_GetClassID(IPersistStream *iface, + CLSID *class) DECLSPEC_HIDDEN; +HRESULT WINAPI unimpl_IPersistStream_IsDirty(IPersistStream *iface) DECLSPEC_HIDDEN; +HRESULT WINAPI unimpl_IPersistStream_Save(IPersistStream *iface, IStream *stream, + BOOL clear_dirty) DECLSPEC_HIDDEN; +HRESULT WINAPI unimpl_IPersistStream_GetSizeMax(IPersistStream *iface, + ULARGE_INTEGER *size) DECLSPEC_HIDDEN; Propchange: trunk/reactos/dll/directx/wine/dmusic/dmobject.h ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/dll/directx/wine/dmusic/dmusic.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/dmusic/dm…
============================================================================== --- trunk/reactos/dll/directx/wine/dmusic/dmusic.c [iso-8859-1] (original) +++ trunk/reactos/dll/directx/wine/dmusic/dmusic.c [iso-8859-1] Fri Sep 26 09:19:09 2014 @@ -59,8 +59,6 @@ TRACE("(%p)->(): new ref = %u\n", This, ref); - DMUSIC_LockModule(); - return ref; } @@ -72,12 +70,12 @@ TRACE("(%p)->(): new ref = %u\n", This, ref); if (!ref) { + IReferenceClock_Release(&This->pMasterClock->IReferenceClock_iface); HeapFree(GetProcessHeap(), 0, This->system_ports); HeapFree(GetProcessHeap(), 0, This->ppPorts); HeapFree(GetProcessHeap(), 0, This); - } - - DMUSIC_UnlockModule(); + DMUSIC_UnlockModule(); + } return ref; } @@ -210,8 +208,10 @@ if (guid_clock) *guid_clock = This->pMasterClock->pClockInfo.guidClock; - if (reference_clock) - *reference_clock = (IReferenceClock*)This->pMasterClock; + if (reference_clock) { + *reference_clock = &This->pMasterClock->IReferenceClock_iface; + IReferenceClock_AddRef(*reference_clock); + } return S_OK; } @@ -414,7 +414,7 @@ return E_OUTOFMEMORY; dmusic->IDirectMusic8_iface.lpVtbl = &DirectMusic8_Vtbl; - dmusic->ref = 0; /* Will be inited by QueryInterface */ + dmusic->ref = 1; dmusic->pMasterClock = NULL; dmusic->ppPorts = NULL; dmusic->nrofports = 0; @@ -424,14 +424,11 @@ return ret; } + create_system_ports_list(dmusic); + + DMUSIC_LockModule(); ret = IDirectMusic8Impl_QueryInterface(&dmusic->IDirectMusic8_iface, riid, ret_iface); - if (FAILED(ret)) { - IReferenceClock_Release(&dmusic->pMasterClock->IReferenceClock_iface); - HeapFree(GetProcessHeap(), 0, dmusic); - return ret; - } - - create_system_ports_list(dmusic); - - return S_OK; -} + IDirectMusic8Impl_Release(&dmusic->IDirectMusic8_iface); + + return ret; +} Modified: trunk/reactos/dll/directx/wine/dmusic/dmusic_private.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/dmusic/dm…
============================================================================== --- trunk/reactos/dll/directx/wine/dmusic/dmusic_private.h [iso-8859-1] (original) +++ trunk/reactos/dll/directx/wine/dmusic/dmusic_private.h [iso-8859-1] Fri Sep 26 09:19:09 2014 @@ -22,7 +22,7 @@ #ifndef __WINE_DMUSIC_PRIVATE_H #define __WINE_DMUSIC_PRIVATE_H -#include <config.h> +#include <wine/config.h> #include <stdarg.h> @@ -42,6 +42,8 @@ #include <wine/list.h> #include <wine/unicode.h> +#include "dmobject.h" + WINE_DEFAULT_DEBUG_CHANNEL(dmusic); /***************************************************************************** @@ -53,7 +55,6 @@ typedef struct IDirectMusicDownloadImpl IDirectMusicDownloadImpl; typedef struct IReferenceClockImpl IReferenceClockImpl; -typedef struct IDirectMusicCollectionImpl IDirectMusicCollectionImpl; typedef struct IDirectMusicInstrumentImpl IDirectMusicInstrumentImpl; typedef struct SynthPortImpl SynthPortImpl; @@ -210,30 +211,6 @@ typedef struct _DMUS_PRIVATE_POOLCUE { struct list entry; /* for listing elements */ } DMUS_PRIVATE_POOLCUE, *LPDMUS_PRIVATE_POOLCUE; - -/***************************************************************************** - * IDirectMusicCollectionImpl implementation structure - */ -struct IDirectMusicCollectionImpl { - /* IUnknown fields */ - IDirectMusicCollection IDirectMusicCollection_iface; - IDirectMusicObject IDirectMusicObject_iface; - IPersistStream IPersistStream_iface; - LONG ref; - - /* IDirectMusicCollectionImpl fields */ - IStream *pStm; /* stream from which we load collection and later instruments */ - LARGE_INTEGER liCollectionPosition; /* offset in a stream where collection was loaded from */ - LARGE_INTEGER liWavePoolTablePosition; /* offset in a stream where wave pool table can be found */ - LPDMUS_OBJECTDESC pDesc; - CHAR* szCopyright; /* FIXME: should probably placed somewhere else */ - LPDLSHEADER pHeader; - /* pool table */ - LPPOOLTABLE pPoolTable; - LPPOOLCUE pPoolCues; - /* instruments */ - struct list Instruments; -}; /***************************************************************************** * IDirectMusicInstrumentImpl implementation structure @@ -296,13 +273,6 @@ const char* name; } guid_info; -/* used for initialising structs (primarily for DMUS_OBJECTDESC) */ -#define DM_STRUCT_INIT(x) \ - do { \ - memset((x), 0, sizeof(*(x))); \ - (x)->dwSize = sizeof(*x); \ - } while (0) - #define FE(x) { x, #x } #define GE(x) { &x, #x } Modified: trunk/reactos/dll/directx/wine/dmusic/download.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/dmusic/do…
============================================================================== --- trunk/reactos/dll/directx/wine/dmusic/download.c [iso-8859-1] (original) +++ trunk/reactos/dll/directx/wine/dmusic/download.c [iso-8859-1] Fri Sep 26 09:19:09 2014 @@ -50,8 +50,6 @@ TRACE("(%p)->(): new ref = %u\n", iface, ref); - DMUSIC_LockModule(); - return ref; } @@ -62,10 +60,10 @@ TRACE("(%p)->(): new ref = %u\n", iface, ref); - if (!ref) + if (!ref) { HeapFree(GetProcessHeap(), 0, This); - - DMUSIC_UnlockModule(); + DMUSIC_UnlockModule(); + } return ref; } @@ -100,5 +98,7 @@ download->IDirectMusicDownload_iface.lpVtbl = &DirectMusicDownload_Vtbl; download->ref = 1; *ret_iface = download; + + DMUSIC_LockModule(); return S_OK; } Modified: trunk/reactos/dll/directx/wine/dmusic/instrument.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/dmusic/in…
============================================================================== --- trunk/reactos/dll/directx/wine/dmusic/instrument.c [iso-8859-1] (original) +++ trunk/reactos/dll/directx/wine/dmusic/instrument.c [iso-8859-1] Fri Sep 26 09:19:09 2014 @@ -60,8 +60,6 @@ TRACE("(%p)->(): new ref = %u\n", iface, ref); - DMUSIC_LockModule(); - return ref; } @@ -81,9 +79,8 @@ HeapFree(GetProcessHeap(), 0, This->articulations->connections); HeapFree(GetProcessHeap(), 0, This->articulations); HeapFree(GetProcessHeap(), 0, This); - } - - DMUSIC_UnlockModule(); + DMUSIC_UnlockModule(); + } return ref; } @@ -123,16 +120,22 @@ /* for ClassFactory */ HRESULT DMUSIC_CreateDirectMusicInstrumentImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) { IDirectMusicInstrumentImpl* dminst; - + HRESULT hr; + dminst = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicInstrumentImpl)); if (NULL == dminst) { *ppobj = NULL; return E_OUTOFMEMORY; } dminst->IDirectMusicInstrument_iface.lpVtbl = &DirectMusicInstrument_Vtbl; - dminst->ref = 0; /* will be inited by QueryInterface */ - - return IDirectMusicInstrument_QueryInterface(&dminst->IDirectMusicInstrument_iface, lpcGUID, ppobj); + dminst->ref = 1; + + DMUSIC_LockModule(); + hr = IDirectMusicInstrument_QueryInterface(&dminst->IDirectMusicInstrument_iface, lpcGUID, + ppobj); + IDirectMusicInstrument_Release(&dminst->IDirectMusicInstrument_iface); + + return hr; } static HRESULT read_from_stream(IStream *stream, void *data, ULONG size) Modified: trunk/reactos/dll/directx/wine/dmusic/port.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/dmusic/po…
============================================================================== --- trunk/reactos/dll/directx/wine/dmusic/port.c [iso-8859-1] (original) +++ trunk/reactos/dll/directx/wine/dmusic/port.c [iso-8859-1] Fri Sep 26 09:19:09 2014 @@ -69,8 +69,6 @@ TRACE("(%p)->(): new ref = %u\n", iface, ref); - DMUSIC_LockModule(); - return ref; } @@ -85,9 +83,8 @@ { HeapFree(GetProcessHeap(), 0, This->data); HeapFree(GetProcessHeap(), 0, This); - } - - DMUSIC_UnlockModule(); + DMUSIC_UnlockModule(); + } return ref; } @@ -122,6 +119,7 @@ object->ref = 1; *instrument = &object->IDirectMusicDownloadedInstrument_iface; + DMUSIC_LockModule(); return S_OK; } Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Fri Sep 26 09:19:09 2014 @@ -37,7 +37,7 @@ reactos/dll/directx/wine/devenum # Synced to Wine-1.7.27 reactos/dll/directx/wine/dinput # Synced to Wine-1.7.27 reactos/dll/directx/wine/dinput8 # Synced to Wine-1.7.27 -reactos/dll/directx/wine/dmusic # Synced to Wine-1.7.17 +reactos/dll/directx/wine/dmusic # Synced to Wine-1.7.27 reactos/dll/directx/wine/dplay # Synced to Wine-1.7.17 reactos/dll/directx/wine/dplayx # Synced to Wine-1.7.17 reactos/dll/directx/wine/dsound # Synced to Wine-1.5.26
10 years, 3 months
1
0
0
0
[akhaldi] 64299: [DINPUT8] * Sync with Wine 1.7.27. CORE-8540
by akhaldi@svn.reactos.org
Author: akhaldi Date: Fri Sep 26 09:07:14 2014 New Revision: 64299 URL:
http://svn.reactos.org/svn/reactos?rev=64299&view=rev
Log: [DINPUT8] * Sync with Wine 1.7.27. CORE-8540 Modified: trunk/reactos/dll/directx/wine/dinput8/dinput8_main.c trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/dll/directx/wine/dinput8/dinput8_main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/dinput8/d…
============================================================================== --- trunk/reactos/dll/directx/wine/dinput8/dinput8_main.c [iso-8859-1] (original) +++ trunk/reactos/dll/directx/wine/dinput8/dinput8_main.c [iso-8859-1] Fri Sep 26 09:07:14 2014 @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include <config.h> +#include <wine/config.h> //#include <assert.h> //#include <stdarg.h> //#include <string.h> Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Fri Sep 26 09:07:14 2014 @@ -36,7 +36,7 @@ reactos/dll/directx/wine/ddraw # Synced to Wine-1.7.27 reactos/dll/directx/wine/devenum # Synced to Wine-1.7.27 reactos/dll/directx/wine/dinput # Synced to Wine-1.7.27 -reactos/dll/directx/wine/dinput8 # Synced to Wine-1.7.17 +reactos/dll/directx/wine/dinput8 # Synced to Wine-1.7.27 reactos/dll/directx/wine/dmusic # Synced to Wine-1.7.17 reactos/dll/directx/wine/dplay # Synced to Wine-1.7.17 reactos/dll/directx/wine/dplayx # Synced to Wine-1.7.17
10 years, 3 months
1
0
0
0
[akhaldi] 64298: [DINPUT_WINETEST] * Sync with Wine 1.7.27. CORE-8540
by akhaldi@svn.reactos.org
Author: akhaldi Date: Fri Sep 26 09:04:18 2014 New Revision: 64298 URL:
http://svn.reactos.org/svn/reactos?rev=64298&view=rev
Log: [DINPUT_WINETEST] * Sync with Wine 1.7.27. CORE-8540 Modified: trunk/rostests/winetests/dinput/dinput.c Modified: trunk/rostests/winetests/dinput/dinput.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/dinput/dinput.c…
============================================================================== --- trunk/rostests/winetests/dinput/dinput.c [iso-8859-1] (original) +++ trunk/rostests/winetests/dinput/dinput.c [iso-8859-1] Fri Sep 26 09:04:18 2014 @@ -608,6 +608,7 @@ "IDirectInput_CreateDevice failed with guid from GetConfig hr = 0x%08x\n", hr); } + IDirectInput_Release(pDI); } START_TEST(dinput)
10 years, 3 months
1
0
0
0
[akhaldi] 64297: [DINPUT] * Sync with Wine 1.7.27. CORE-8540
by akhaldi@svn.reactos.org
Author: akhaldi Date: Fri Sep 26 09:03:58 2014 New Revision: 64297 URL:
http://svn.reactos.org/svn/reactos?rev=64297&view=rev
Log: [DINPUT] * Sync with Wine 1.7.27. CORE-8540 Modified: trunk/reactos/dll/directx/wine/dinput/joystick.c trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/dll/directx/wine/dinput/joystick.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/dinput/jo…
============================================================================== --- trunk/reactos/dll/directx/wine/dinput/joystick.c [iso-8859-1] (original) +++ trunk/reactos/dll/directx/wine/dinput/joystick.c [iso-8859-1] Fri Sep 26 09:03:58 2014 @@ -403,7 +403,6 @@ TRACE("dwSize: %d\n", lpDIDevCaps->dwSize); TRACE("dwFlags: %08x\n", lpDIDevCaps->dwFlags); TRACE("dwDevType: %08x %s\n", lpDIDevCaps->dwDevType, - lpDIDevCaps->dwDevType == DIDEVTYPE_DEVICE ? "DIDEVTYPE_DEVICE" : lpDIDevCaps->dwDevType == DIDEVTYPE_DEVICE ? "DIDEVTYPE_DEVICE" : lpDIDevCaps->dwDevType == DIDEVTYPE_MOUSE ? "DIDEVTYPE_MOUSE" : lpDIDevCaps->dwDevType == DIDEVTYPE_KEYBOARD ? "DIDEVTYPE_KEYBOARD" : Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Fri Sep 26 09:03:58 2014 @@ -35,7 +35,7 @@ reactos/dll/directx/wine/d3dxof # Synced to Wine-1.7.27 reactos/dll/directx/wine/ddraw # Synced to Wine-1.7.27 reactos/dll/directx/wine/devenum # Synced to Wine-1.7.27 -reactos/dll/directx/wine/dinput # Synced to Wine-1.7.17 +reactos/dll/directx/wine/dinput # Synced to Wine-1.7.27 reactos/dll/directx/wine/dinput8 # Synced to Wine-1.7.17 reactos/dll/directx/wine/dmusic # Synced to Wine-1.7.17 reactos/dll/directx/wine/dplay # Synced to Wine-1.7.17
10 years, 3 months
1
0
0
0
[akhaldi] 64296: [DEVENUM_WINETEST] * Sync with Wine 1.7.27. CORE-8540
by akhaldi@svn.reactos.org
Author: akhaldi Date: Fri Sep 26 08:56:56 2014 New Revision: 64296 URL:
http://svn.reactos.org/svn/reactos?rev=64296&view=rev
Log: [DEVENUM_WINETEST] * Sync with Wine 1.7.27. CORE-8540 Modified: trunk/rostests/winetests/devenum/devenum.c Modified: trunk/rostests/winetests/devenum/devenum.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/devenum/devenum…
============================================================================== --- trunk/rostests/winetests/devenum/devenum.c [iso-8859-1] (original) +++ trunk/rostests/winetests/devenum/devenum.c [iso-8859-1] Fri Sep 26 08:56:56 2014 @@ -97,7 +97,7 @@ if (SUCCEEDED(hr)) { if (winetest_debug > 1) - trace(" %s\n", wine_dbgstr_w(V_UNION(&var, bstrVal))); + trace(" %s\n", wine_dbgstr_w(V_BSTR(&var))); VariantClear(&var); } else
10 years, 3 months
1
0
0
0
[akhaldi] 64295: [DEVENUM] * Sync with Wine 1.7.27. CORE-8540
by akhaldi@svn.reactos.org
Author: akhaldi Date: Fri Sep 26 08:56:44 2014 New Revision: 64295 URL:
http://svn.reactos.org/svn/reactos?rev=64295&view=rev
Log: [DEVENUM] * Sync with Wine 1.7.27. CORE-8540 Modified: trunk/reactos/dll/directx/wine/devenum/createdevenum.c trunk/reactos/dll/directx/wine/devenum/devenum_main.c trunk/reactos/dll/directx/wine/devenum/mediacatenum.c trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/dll/directx/wine/devenum/createdevenum.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/devenum/c…
============================================================================== --- trunk/reactos/dll/directx/wine/devenum/createdevenum.c [iso-8859-1] (original) +++ trunk/reactos/dll/directx/wine/devenum/createdevenum.c [iso-8859-1] Fri Sep 26 08:56:44 2014 @@ -756,7 +756,7 @@ VARIANT var; V_VT(&var) = VT_I4; - V_UNION(&var, ulVal) = i; + V_I4(&var) = i; res = IMoniker_BindToStorage(pMoniker, NULL, NULL, &IID_IPropertyBag, (LPVOID)&pPropBag); if (SUCCEEDED(res)) res = IPropertyBag_Write(pPropBag, wszWaveOutID, &var); @@ -764,7 +764,7 @@ pPropBag = NULL; V_VT(&var) = VT_LPWSTR; - V_UNION(&var, bstrVal) = wocaps.szPname; + V_BSTR(&var) = wocaps.szPname; if (SUCCEEDED(res)) res = IPropertyBag_Write(pPropBag, wszFriendlyName, &var); if (pPropBag) @@ -837,7 +837,7 @@ VARIANT var; V_VT(&var) = VT_I4; - V_UNION(&var, ulVal) = i; + V_I4(&var) = i; res = IMoniker_BindToStorage(pMoniker, NULL, NULL, &IID_IPropertyBag, (LPVOID)&pPropBag); if (SUCCEEDED(res)) res = IPropertyBag_Write(pPropBag, wszWaveInID, &var); @@ -845,7 +845,7 @@ pPropBag = NULL; V_VT(&var) = VT_LPWSTR; - V_UNION(&var, bstrVal) = wicaps.szPname; + V_BSTR(&var) = wicaps.szPname; if (SUCCEEDED(res)) res = IPropertyBag_Write(pPropBag, wszFriendlyName, &var); @@ -947,7 +947,7 @@ OLECHAR wszVfwIndex[] = { 'V','F','W','I','n','d','e','x',0 }; VARIANT var; V_VT(&var) = VT_I4; - V_UNION(&var, ulVal) = i; + V_I4(&var) = i; res = IMoniker_BindToStorage(pMoniker, NULL, NULL, &IID_IPropertyBag, (LPVOID)&pPropBag); if (SUCCEEDED(res)) { res = IPropertyBag_Write(pPropBag, wszVfwIndex, &var); Modified: trunk/reactos/dll/directx/wine/devenum/devenum_main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/devenum/d…
============================================================================== --- trunk/reactos/dll/directx/wine/devenum/devenum_main.c [iso-8859-1] (original) +++ trunk/reactos/dll/directx/wine/devenum/devenum_main.c [iso-8859-1] Fri Sep 26 08:56:44 2014 @@ -33,7 +33,9 @@ BOOL instance; } register_info; +#ifdef __REACTOS__ static void DEVENUM_RegisterQuartz(void); +#endif /*********************************************************************** * Global string constant definitions @@ -96,8 +98,10 @@ res = __wine_register_resources( DEVENUM_hInstance ); +#ifdef __REACTOS__ /* Quartz is needed for IFilterMapper2 */ DEVENUM_RegisterQuartz(); +#endif /*** ActiveMovieFilter Categories ***/ @@ -146,6 +150,8 @@ return __wine_unregister_resources( DEVENUM_hInstance ); } +#ifdef __REACTOS__ + typedef HRESULT (WINAPI *DllRegisterServer_func)(void); /* calls DllRegisterServer() for the Quartz DLL */ @@ -162,3 +168,5 @@ ERR("Failed to register Quartz. Error was 0x%x)\n", hr); } } + +#endif Modified: trunk/reactos/dll/directx/wine/devenum/mediacatenum.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/devenum/m…
============================================================================== --- trunk/reactos/dll/directx/wine/devenum/mediacatenum.c [iso-8859-1] (original) +++ trunk/reactos/dll/directx/wine/devenum/mediacatenum.c [iso-8859-1] Fri Sep 26 08:56:44 2014 @@ -146,15 +146,15 @@ switch (V_VT(pVar)) { case VT_LPWSTR: - V_UNION(pVar, bstrVal) = CoTaskMemAlloc(received); - memcpy(V_UNION(pVar, bstrVal), pData, received); + V_BSTR(pVar) = CoTaskMemAlloc(received); + memcpy(V_BSTR(pVar), pData, received); res = S_OK; break; case VT_EMPTY: V_VT(pVar) = VT_BSTR; /* fall through */ case VT_BSTR: - V_UNION(pVar, bstrVal) = SysAllocStringLen(pData, received/sizeof(WCHAR) - 1); + V_BSTR(pVar) = SysAllocStringLen(pData, received/sizeof(WCHAR) - 1); res = S_OK; break; } @@ -168,7 +168,7 @@ /* fall through */ case VT_I4: case VT_UI4: - V_UNION(pVar, ulVal) = *(DWORD *)pData; + V_I4(pVar) = *(DWORD *)pData; res = S_OK; break; } @@ -186,7 +186,7 @@ V_VT(pVar) = VT_ARRAY | VT_UI1; /* fall through */ case VT_ARRAY | VT_UI1: - if (!(V_UNION(pVar, parray) = SafeArrayCreate(VT_UI1, 1, &bound))) + if (!(V_ARRAY(pVar) = SafeArrayCreate(VT_UI1, 1, &bound))) res = E_OUTOFMEMORY; else res = S_OK; @@ -196,12 +196,12 @@ if (res == E_INVALIDARG) break; - res = SafeArrayAccessData(V_UNION(pVar, parray), &pArrayElements); + res = SafeArrayAccessData(V_ARRAY(pVar), &pArrayElements); if (FAILED(res)) break; CopyMemory(pArrayElements, pData, received); - res = SafeArrayUnaccessData(V_UNION(pVar, parray)); + res = SafeArrayUnaccessData(V_ARRAY(pVar)); break; } } @@ -232,15 +232,15 @@ { case VT_BSTR: case VT_LPWSTR: - TRACE("writing %s\n", debugstr_w(V_UNION(pVar, bstrVal))); - lpData = V_UNION(pVar, bstrVal); + TRACE("writing %s\n", debugstr_w(V_BSTR(pVar))); + lpData = V_BSTR(pVar); dwType = REG_SZ; - cbData = (lstrlenW(V_UNION(pVar, bstrVal)) + 1) * sizeof(WCHAR); + cbData = (lstrlenW(V_BSTR(pVar)) + 1) * sizeof(WCHAR); break; case VT_I4: case VT_UI4: - TRACE("writing %u\n", V_UNION(pVar, ulVal)); - lpData = &V_UNION(pVar, ulVal); + TRACE("writing %u\n", V_UI4(pVar)); + lpData = &V_UI4(pVar); dwType = REG_DWORD; cbData = sizeof(DWORD); break; @@ -249,11 +249,11 @@ LONG lUbound = 0; LONG lLbound = 0; dwType = REG_BINARY; - res = SafeArrayGetLBound(V_UNION(pVar, parray), 1, &lLbound); - res = SafeArrayGetUBound(V_UNION(pVar, parray), 1, &lUbound); + res = SafeArrayGetLBound(V_ARRAY(pVar), 1, &lLbound); + res = SafeArrayGetUBound(V_ARRAY(pVar), 1, &lUbound); cbData = (lUbound - lLbound + 1) /* * sizeof(BYTE)*/; TRACE("cbData: %d\n", cbData); - res = SafeArrayAccessData(V_UNION(pVar, parray), &lpData); + res = SafeArrayAccessData(V_ARRAY(pVar), &lpData); break; } default: @@ -267,7 +267,7 @@ res = E_FAIL; if (V_VT(pVar) & VT_ARRAY) - res = SafeArrayUnaccessData(V_UNION(pVar, parray)); + res = SafeArrayUnaccessData(V_ARRAY(pVar)); return res; } @@ -418,8 +418,8 @@ } if (SUCCEEDED(res)) { - res = CLSIDFromString(V_UNION(&var,bstrVal), &clsID); - CoTaskMemFree(V_UNION(&var, bstrVal)); + res = CLSIDFromString(V_BSTR(&var), &clsID); + CoTaskMemFree(V_BSTR(&var)); } if (SUCCEEDED(res)) { Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Fri Sep 26 08:56:44 2014 @@ -34,7 +34,7 @@ reactos/dll/directx/wine/d3dx9_24 => 43 # Synced to Wine-1.7.27 reactos/dll/directx/wine/d3dxof # Synced to Wine-1.7.27 reactos/dll/directx/wine/ddraw # Synced to Wine-1.7.27 -reactos/dll/directx/wine/devenum # Synced to Wine-1.7.17 +reactos/dll/directx/wine/devenum # Synced to Wine-1.7.27 reactos/dll/directx/wine/dinput # Synced to Wine-1.7.17 reactos/dll/directx/wine/dinput8 # Synced to Wine-1.7.17 reactos/dll/directx/wine/dmusic # Synced to Wine-1.7.17
10 years, 3 months
1
0
0
0
[pschweitzer] 64294: [NTFS] - Divert NtfsReadSectors() into NtfsReadDisk() - Reimplement NtfsReadSectors() using NtfsReadDisk()
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Fri Sep 26 06:41:51 2014 New Revision: 64294 URL:
http://svn.reactos.org/svn/reactos?rev=64294&view=rev
Log: [NTFS] - Divert NtfsReadSectors() into NtfsReadDisk() - Reimplement NtfsReadSectors() using NtfsReadDisk() Modified: trunk/reactos/drivers/filesystems/ntfs/blockdev.c trunk/reactos/drivers/filesystems/ntfs/ntfs.h Modified: trunk/reactos/drivers/filesystems/ntfs/blockdev.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/ntfs/b…
============================================================================== --- trunk/reactos/drivers/filesystems/ntfs/blockdev.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/ntfs/blockdev.c [iso-8859-1] Fri Sep 26 06:41:51 2014 @@ -33,39 +33,32 @@ /* FUNCTIONS ****************************************************************/ NTSTATUS -NtfsReadSectors(IN PDEVICE_OBJECT DeviceObject, - IN ULONG DiskSector, - IN ULONG SectorCount, - IN ULONG SectorSize, - IN OUT PUCHAR Buffer, - IN BOOLEAN Override) +NtfsReadDisk(IN PDEVICE_OBJECT DeviceObject, + IN LONGLONG StartingOffset, + IN ULONG Length, + IN OUT PUCHAR Buffer, + IN BOOLEAN Override) { PIO_STACK_LOCATION Stack; IO_STATUS_BLOCK IoStatus; LARGE_INTEGER Offset; - ULONG BlockSize; KEVENT Event; PIRP Irp; NTSTATUS Status; + + DPRINT("NtfsReadDisk(%p, %I64x, %u, %p, %d)\n", DeviceObject, StartingOffset, Length, Buffer, Override); KeInitializeEvent(&Event, NotificationEvent, FALSE); - Offset.QuadPart = (LONGLONG)DiskSector * (LONGLONG)SectorSize; - BlockSize = SectorCount * SectorSize; - - DPRINT("NtfsReadSectors(DeviceObject %p, DiskSector %d, Buffer %p)\n", - DeviceObject, DiskSector, Buffer); - DPRINT("Offset %I64x BlockSize %ld\n", - Offset.QuadPart, - BlockSize); + Offset.QuadPart = StartingOffset; DPRINT("Building synchronous FSD Request...\n"); Irp = IoBuildSynchronousFsdRequest(IRP_MJ_READ, DeviceObject, Buffer, - BlockSize, + Length, &Offset, &Event, &IoStatus); @@ -93,9 +86,26 @@ Status = IoStatus.Status; } - DPRINT("NtfsReadSectors() done (Status %x)\n", Status); + DPRINT("NtfsReadDisk() done (Status %x)\n", Status); return Status; +} + +NTSTATUS +NtfsReadSectors(IN PDEVICE_OBJECT DeviceObject, + IN ULONG DiskSector, + IN ULONG SectorCount, + IN ULONG SectorSize, + IN OUT PUCHAR Buffer, + IN BOOLEAN Override) +{ + LONGLONG Offset; + ULONG BlockSize; + + Offset = (LONGLONG)DiskSector * (LONGLONG)SectorSize; + BlockSize = SectorCount * SectorSize; + + return NtfsReadDisk(DeviceObject, Offset, BlockSize, Buffer, Override); } Modified: trunk/reactos/drivers/filesystems/ntfs/ntfs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/ntfs/n…
============================================================================== --- trunk/reactos/drivers/filesystems/ntfs/ntfs.h [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/ntfs/ntfs.h [iso-8859-1] Fri Sep 26 06:41:51 2014 @@ -386,6 +386,13 @@ /* blockdev.c */ NTSTATUS +NtfsReadDisk(IN PDEVICE_OBJECT DeviceObject, + IN LONGLONG StartingOffset, + IN ULONG Length, + IN OUT PUCHAR Buffer, + IN BOOLEAN Override); + +NTSTATUS NtfsReadSectors(IN PDEVICE_OBJECT DeviceObject, IN ULONG DiskSector, IN ULONG SectorCount,
10 years, 3 months
1
0
0
0
[hbelusca] 64293: [DHCPCSVC]: Forgot this code formatting in my previous commit.
by hbelusca@svn.reactos.org
Author: hbelusca Date: Thu Sep 25 23:45:30 2014 New Revision: 64293 URL:
http://svn.reactos.org/svn/reactos?rev=64293&view=rev
Log: [DHCPCSVC]: Forgot this code formatting in my previous commit. Modified: trunk/reactos/dll/win32/dhcpcsvc/CMakeLists.txt trunk/reactos/dll/win32/dhcpcsvc/dhcpcsvc.c Modified: trunk/reactos/dll/win32/dhcpcsvc/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/dhcpcsvc/CMakeLi…
============================================================================== --- trunk/reactos/dll/win32/dhcpcsvc/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/dhcpcsvc/CMakeLists.txt [iso-8859-1] Thu Sep 25 23:45:30 2014 @@ -28,10 +28,6 @@ ${CMAKE_CURRENT_BINARY_DIR}/dhcpcsvc.def) set_module_type(dhcpcsvc win32dll) - add_importlibs(dhcpcsvc ws2_32 iphlpapi advapi32 msvcrt kernel32 ntdll) - - add_pch(dhcpcsvc include/rosdhcp.h SOURCE) - add_cd_file(TARGET dhcpcsvc DESTINATION reactos/system32 FOR all) Modified: trunk/reactos/dll/win32/dhcpcsvc/dhcpcsvc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/dhcpcsvc/dhcpcsv…
============================================================================== --- trunk/reactos/dll/win32/dhcpcsvc/dhcpcsvc.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/dhcpcsvc/dhcpcsvc.c [iso-8859-1] Thu Sep 25 23:45:30 2014 @@ -419,15 +419,15 @@ UpdateServiceStatus(SERVICE_STOPPED); } -INT WINAPI -DllMain(PVOID hinstDll, - ULONG dwReason, - PVOID reserved) -{ - switch (dwReason) +BOOL WINAPI +DllMain(HINSTANCE hinstDLL, + DWORD fdwReason, + LPVOID lpvReserved) +{ + switch (fdwReason) { case DLL_PROCESS_ATTACH: - DisableThreadLibraryCalls(hinstDll); + DisableThreadLibraryCalls(hinstDLL); break; case DLL_PROCESS_DETACH:
10 years, 3 months
1
0
0
0
[hbelusca] 64292: [UMPNPMGR] - Turn the user-mode PnP Manager into a dll, as it is in Windows. However, on Windows 2k/XP/2k3, the dll is managed by services.exe (the SC Manager) (and its entry poin...
by hbelusca@svn.reactos.org
Author: hbelusca Date: Thu Sep 25 23:44:28 2014 New Revision: 64292 URL:
http://svn.reactos.org/svn/reactos?rev=64292&view=rev
Log: [UMPNPMGR] - Turn the user-mode PnP Manager into a dll, as it is in Windows. However, on Windows 2k/XP/2k3, the dll is managed by services.exe (the SC Manager) (and its entry point name hardcoded in it), whereas on Vista/7+ it is managed by svchost.exe . Since we do not support external dll hardcoded services management in services.exe, make it svchost-compatible instead. - In the .spec file, we mention that a few API set is exported (in stdcall), but we use it also for RPC, and therefore one has to fix somewhere the calling conventions. - Add/modify the registry entries accordingly. Added: trunk/reactos/base/services/umpnpmgr/umpnpmgr.spec (with props) Modified: trunk/reactos/base/services/umpnpmgr/CMakeLists.txt trunk/reactos/base/services/umpnpmgr/umpnpmgr.c trunk/reactos/base/services/umpnpmgr/umpnpmgr.rc trunk/reactos/boot/bootdata/hivesft.inf trunk/reactos/boot/bootdata/hivesys.inf Modified: trunk/reactos/base/services/umpnpmgr/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/umpnpmgr/CMa…
============================================================================== --- trunk/reactos/base/services/umpnpmgr/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/base/services/umpnpmgr/CMakeLists.txt [iso-8859-1] Thu Sep 25 23:44:28 2014 @@ -3,16 +3,19 @@ add_rpc_files(server ${REACTOS_SOURCE_DIR}/include/reactos/idl/pnp.idl) +spec2def(umpnpmgr.dll umpnpmgr.spec ADD_IMPORTLIB) -add_executable(umpnpmgr +add_library(umpnpmgr SHARED umpnpmgr.c umpnpmgr.rc - ${CMAKE_CURRENT_BINARY_DIR}/pnp_s.c) + ${CMAKE_CURRENT_BINARY_DIR}/pnp_s.c + ${CMAKE_CURRENT_BINARY_DIR}/umpnpmgr_stubs.c + ${CMAKE_CURRENT_BINARY_DIR}/umpnpmgr.def) target_link_libraries(umpnpmgr wdmguid ${PSEH_LIB}) -set_module_type(umpnpmgr win32cui UNICODE) +set_module_type(umpnpmgr win32dll UNICODE) add_importlibs(umpnpmgr advapi32 rpcrt4 userenv shlwapi msvcrt kernel32 ntdll) add_cd_file(TARGET umpnpmgr DESTINATION reactos/system32 FOR all) Modified: trunk/reactos/base/services/umpnpmgr/umpnpmgr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/umpnpmgr/ump…
============================================================================== --- trunk/reactos/base/services/umpnpmgr/umpnpmgr.c [iso-8859-1] (original) +++ trunk/reactos/base/services/umpnpmgr/umpnpmgr.c [iso-8859-1] Thu Sep 25 23:44:28 2014 @@ -27,6 +27,7 @@ */ /* INCLUDES *****************************************************************/ + //#define HAVE_SLIST_ENTRY_IMPLEMENTED #define WIN32_NO_STATUS #define _INC_WINDOWS @@ -52,13 +53,7 @@ /* GLOBALS ******************************************************************/ -static VOID CALLBACK ServiceMain(DWORD argc, LPWSTR *argv); static WCHAR ServiceName[] = L"PlugPlay"; -static SERVICE_TABLE_ENTRYW ServiceTable[] = -{ - {ServiceName, ServiceMain}, - {NULL, NULL} -}; static SERVICE_STATUS_HANDLE ServiceStatusHandle; static SERVICE_STATUS ServiceStatus; @@ -102,7 +97,7 @@ DPRINT("RpcServerThread() called\n"); #if 0 - /* XP-compatible protocol sequence/endpoint */ + /* 2k/XP/2k3-compatible protocol sequence/endpoint */ Status = RpcServerUseProtseqEpW(L"ncacn_np", 20, L"\\pipe\\ntsvcs", @@ -113,7 +108,7 @@ DPRINT1("RpcServerUseProtseqEpW() failed (Status %lx)\n", Status); #endif - /* Vista-compatible protocol sequence/endpoint */ + /* Vista/7-compatible protocol sequence/endpoint */ Status = RpcServerUseProtseqEpW(L"ncacn_np", 20, L"\\pipe\\plugplay", @@ -1333,7 +1328,7 @@ } } -done:; +done: if (ret == CR_SUCCESS) *pulTransferLen = *pulLength; @@ -1438,7 +1433,7 @@ ret = CR_REGISTRY_ERROR; } -done:; +done: if (hPropKey != NULL) RegCloseKey(hPropKey); @@ -2642,7 +2637,7 @@ } } -done:; +done: if (ret == CR_SUCCESS) *pulTransferLen = *pulLength; @@ -2792,7 +2787,9 @@ /* Function 73 */ DWORD PNP_SetActiveService( - handle_t hBinding) + handle_t hBinding, + LPWSTR pszFilter, + DWORD ulFlags) { UNIMPLEMENTED; return CR_CALL_NOT_IMPLEMENTED; @@ -3309,7 +3306,7 @@ } -static VOID CALLBACK +VOID WINAPI ServiceMain(DWORD argc, LPTSTR *argv) { HANDLE hThread; @@ -3363,22 +3360,18 @@ DPRINT("ServiceMain() done\n"); } - -int -wmain(int argc, WCHAR *argv[]) +static DWORD +InitializePnPManager(VOID) { BOOLEAN OldValue; DWORD dwError; - UNREFERENCED_PARAMETER(argc); - UNREFERENCED_PARAMETER(argv); - - DPRINT("Umpnpmgr: main() started\n"); + DPRINT("UMPNPMGR: InitializePnPManager() started\n"); /* We need this privilege for using CreateProcessAsUserW */ RtlAdjustPrivilege(SE_ASSIGNPRIMARYTOKEN_PRIVILEGE, TRUE, FALSE, &OldValue); - hInstallEvent = CreateEvent(NULL, TRUE, SetupIsActive()/*FALSE*/, NULL); + hInstallEvent = CreateEventW(NULL, TRUE, SetupIsActive()/*FALSE*/, NULL); if (hInstallEvent == NULL) { dwError = GetLastError(); @@ -3386,7 +3379,7 @@ return dwError; } - hDeviceInstallListNotEmpty = CreateEvent(NULL, FALSE, FALSE, NULL); + hDeviceInstallListNotEmpty = CreateEventW(NULL, FALSE, FALSE, NULL); if (hDeviceInstallListNotEmpty == NULL) { dwError = GetLastError(); @@ -3433,13 +3426,28 @@ return dwError; } - StartServiceCtrlDispatcher(ServiceTable); - - DPRINT("Umpnpmgr: main() done\n"); - - ExitThread(0); + DPRINT("UMPNPMGR: InitializePnPManager() done\n"); return 0; } +BOOL WINAPI +DllMain(HINSTANCE hinstDLL, + DWORD fdwReason, + LPVOID lpvReserved) +{ + switch (fdwReason) + { + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls(hinstDLL); + InitializePnPManager(); + break; + + case DLL_PROCESS_DETACH: + break; + } + + return TRUE; +} + /* EOF */ Modified: trunk/reactos/base/services/umpnpmgr/umpnpmgr.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/umpnpmgr/ump…
============================================================================== --- trunk/reactos/base/services/umpnpmgr/umpnpmgr.rc [iso-8859-1] (original) +++ trunk/reactos/base/services/umpnpmgr/umpnpmgr.rc [iso-8859-1] Thu Sep 25 23:44:28 2014 @@ -1,4 +1,5 @@ -#define REACTOS_STR_FILE_DESCRIPTION "User-Mode Plug and Play manager" +#define REACTOS_VERSION_DLL +#define REACTOS_STR_FILE_DESCRIPTION "User-Mode Plug and Play Manager" #define REACTOS_STR_INTERNAL_NAME "Umpnpmgr" -#define REACTOS_STR_ORIGINAL_FILENAME "Umpnpmgr.exe" +#define REACTOS_STR_ORIGINAL_FILENAME "umpnpmgr.dll" #include <reactos/version.rc> Added: trunk/reactos/base/services/umpnpmgr/umpnpmgr.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/umpnpmgr/ump…
============================================================================== --- trunk/reactos/base/services/umpnpmgr/umpnpmgr.spec (added) +++ trunk/reactos/base/services/umpnpmgr/umpnpmgr.spec [iso-8859-1] Thu Sep 25 23:44:28 2014 @@ -0,0 +1,15 @@ +@ stub DeleteServicePlugPlayRegKeys + +;;; FIXME: Windows UMPNPMGR exports those APIs. +;;; Fix their calling convention before enabling these exports!! + +;@ stdcall PNP_GetDeviceList(long ptr ptr ptr long) +;@ stdcall PNP_GetDeviceListSize(long ptr ptr long) +;@ stdcall PNP_GetDeviceRegProp(long ptr long ptr ptr ptr ptr long) +;@ stdcall PNP_HwProfFlags(long long ptr long ptr ptr ptr long long) +;@ stdcall PNP_SetActiveService(long ptr long) + +@ stub RegisterScmCallback +@ stub RegisterServiceNotification +@ stdcall ServiceMain(long ptr) ;; If using SvcHost.exe (Vista+) +;@ stdcall SvcEntry_PlugPlay(long long long long) ;; If using services.exe (<= 2k3) Propchange: trunk/reactos/base/services/umpnpmgr/umpnpmgr.spec ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/boot/bootdata/hivesft.inf URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/hivesft.inf?…
============================================================================== --- trunk/reactos/boot/bootdata/hivesft.inf [iso-8859-1] (original) +++ trunk/reactos/boot/bootdata/hivesft.inf [iso-8859-1] Thu Sep 25 23:44:28 2014 @@ -1588,7 +1588,8 @@ ; SvcHost services HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SvcHost",,0x00000012 -HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SvcHost", "netsvcs",0x00010000,"DHCP","BITS" +HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SvcHost","DcomLaunch",0x00010000,"PlugPlay" +HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SvcHost","netsvcs",0x00010000,"DHCP","BITS" ; Win32 config HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows",,0x00000012 Modified: trunk/reactos/boot/bootdata/hivesys.inf URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/hivesys.inf?…
============================================================================== --- trunk/reactos/boot/bootdata/hivesys.inf [iso-8859-1] (original) +++ trunk/reactos/boot/bootdata/hivesys.inf [iso-8859-1] Thu Sep 25 23:44:28 2014 @@ -1841,12 +1841,13 @@ ; Plug and Play manager HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","DisplayName",0x00000000,"Plug and Play" HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","Description",0x00000000,"Detects hardware changes and installs needed software if possible" -HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","ErrorControl",0x00010001,0x00000000 +HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","ErrorControl",0x00010001,0x00000001 HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","Group",0x00000000,"PlugPlay" -HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","ImagePath",0x00020000,"%SystemRoot%\system32\umpnpmgr.exe" +HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","ImagePath",0x00020000,"%SystemRoot%\system32\svchost.exe -k DcomLaunch" HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","ObjectName",0x00000000,"LocalSystem" -HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","Start",0x00010001,0x00000004 -HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","Type",0x00010001,0x00000010 +HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","Start",0x00010001,0x00000002 +HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","Type",0x00010001,0x00000020 +HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay\Parameters","ServiceDll",0x00020000,"%SystemRoot%\system32\umpnpmgr.dll" ; RPC service HKLM,"SYSTEM\CurrentControlSet\Services\Rpcss","DisplayName",0x00000000,"Remote Procedure Call"
10 years, 3 months
1
0
0
0
[hbelusca] 64291: [DHCPCSVC] - Code formatting - Move ROS service functionalities from BSD module to where it really belongs.
by hbelusca@svn.reactos.org
Author: hbelusca Date: Thu Sep 25 22:01:42 2014 New Revision: 64291 URL:
http://svn.reactos.org/svn/reactos?rev=64291&view=rev
Log: [DHCPCSVC] - Code formatting - Move ROS service functionalities from BSD module to where it really belongs. Modified: trunk/reactos/dll/win32/dhcpcsvc/dhcp/dhclient.c trunk/reactos/dll/win32/dhcpcsvc/dhcpcsvc.c trunk/reactos/dll/win32/dhcpcsvc/include/rosdhcp.h Modified: trunk/reactos/dll/win32/dhcpcsvc/dhcp/dhclient.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/dhcpcsvc/dhcp/dh…
============================================================================== --- trunk/reactos/dll/win32/dhcpcsvc/dhcp/dhclient.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/dhcpcsvc/dhcp/dhclient.c [iso-8859-1] Thu Sep 25 22:01:42 2014 @@ -55,8 +55,6 @@ #include <rosdhcp.h> -#include <winsvc.h> - #define PERIOD 0x2e #define hyphenchar(c) ((c) == 0x2d) #define bslashchar(c) ((c) == 0x5c) @@ -108,95 +106,10 @@ time_t scripttime; -static WCHAR ServiceName[] = L"DHCP"; - -SERVICE_STATUS_HANDLE ServiceStatusHandle = 0; -SERVICE_STATUS ServiceStatus; - - -/* XXX Implement me */ -int check_arp( struct interface_info *ip, struct client_lease *lp ) { - return 1; -} - - -static VOID -UpdateServiceStatus(DWORD dwState) -{ - ServiceStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS; - ServiceStatus.dwCurrentState = dwState; - - ServiceStatus.dwControlsAccepted = 0; - - ServiceStatus.dwWin32ExitCode = 0; - ServiceStatus.dwServiceSpecificExitCode = 0; - ServiceStatus.dwCheckPoint = 0; - - if (dwState == SERVICE_START_PENDING || - dwState == SERVICE_STOP_PENDING || - dwState == SERVICE_PAUSE_PENDING || - dwState == SERVICE_CONTINUE_PENDING) - ServiceStatus.dwWaitHint = 10000; - else - ServiceStatus.dwWaitHint = 0; - - SetServiceStatus(ServiceStatusHandle, - &ServiceStatus); -} - - -static DWORD WINAPI -ServiceControlHandler(DWORD dwControl, - DWORD dwEventType, - LPVOID lpEventData, - LPVOID lpContext) -{ - switch (dwControl) - { - case SERVICE_CONTROL_STOP: - UpdateServiceStatus(SERVICE_STOP_PENDING); - UpdateServiceStatus(SERVICE_STOPPED); - return ERROR_SUCCESS; - - case SERVICE_CONTROL_PAUSE: - UpdateServiceStatus(SERVICE_PAUSED); - return ERROR_SUCCESS; - - case SERVICE_CONTROL_CONTINUE: - UpdateServiceStatus(SERVICE_START_PENDING); - UpdateServiceStatus(SERVICE_RUNNING); - return ERROR_SUCCESS; - - case SERVICE_CONTROL_INTERROGATE: - SetServiceStatus(ServiceStatusHandle, - &ServiceStatus); - return ERROR_SUCCESS; - - case SERVICE_CONTROL_SHUTDOWN: - UpdateServiceStatus(SERVICE_STOP_PENDING); - UpdateServiceStatus(SERVICE_STOPPED); - return ERROR_SUCCESS; - - default : - return ERROR_CALL_NOT_IMPLEMENTED; - } -} - - -VOID NTAPI -ServiceMain(DWORD argc, LPWSTR *argv) -{ - ServiceStatusHandle = RegisterServiceCtrlHandlerExW(ServiceName, - ServiceControlHandler, - NULL); - if (!ServiceStatusHandle) - { - DbgPrint("DHCPCSVC: Unable to register service control handler (%lx)\n", GetLastError()); - return; - } - - UpdateServiceStatus(SERVICE_START_PENDING); - + +int +init_client(void) +{ ApiInit(); AdapterInit(); @@ -214,26 +127,23 @@ DbgPrint("DHCPCSVC: PipeInit() failed!\n"); AdapterStop(); ApiFree(); - UpdateServiceStatus(SERVICE_STOPPED); + return 0; // FALSE } - DH_DbgPrint(MID_TRACE,("DHCP Service Started\n")); - - UpdateServiceStatus(SERVICE_RUNNING); - - DH_DbgPrint(MID_TRACE,("Going into dispatch()\n")); - - DH_DbgPrint(MID_TRACE, ("DHCPCSVC: DHCP service is starting up\n")); - - dispatch(); - - DbgPrint("DHCPCSVC: DHCP service is shutting down\n"); - - //AdapterStop(); - //ApiFree(); + return 1; // TRUE +} + +void +stop_client(void) +{ + // AdapterStop(); + // ApiFree(); /* FIXME: Close pipe and kill pipe thread */ - - UpdateServiceStatus(SERVICE_STOPPED); +} + +/* XXX Implement me */ +int check_arp( struct interface_info *ip, struct client_lease *lp ) { + return 1; } /* Modified: trunk/reactos/dll/win32/dhcpcsvc/dhcpcsvc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/dhcpcsvc/dhcpcsv…
============================================================================== --- trunk/reactos/dll/win32/dhcpcsvc/dhcpcsvc.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/dhcpcsvc/dhcpcsvc.c [iso-8859-1] Thu Sep 25 22:01:42 2014 @@ -7,68 +7,76 @@ */ #include <rosdhcp.h> +#include <winsvc.h> #define NDEBUG #include <debug.h> +static WCHAR ServiceName[] = L"DHCP"; + +SERVICE_STATUS_HANDLE ServiceStatusHandle = 0; +SERVICE_STATUS ServiceStatus; + static HANDLE PipeHandle = INVALID_HANDLE_VALUE; -DWORD APIENTRY DhcpCApiInitialize(LPDWORD Version) { +DWORD APIENTRY +DhcpCApiInitialize(LPDWORD Version) +{ DWORD PipeMode; /* Wait for the pipe to be available */ - if (WaitNamedPipeW(DHCP_PIPE_NAME, NMPWAIT_USE_DEFAULT_WAIT)) - { - /* It's available, let's try to open it */ - PipeHandle = CreateFileW(DHCP_PIPE_NAME, - GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, - NULL, - OPEN_EXISTING, - 0, - NULL); - - /* Check if we succeeded in opening the pipe */ - if (PipeHandle == INVALID_HANDLE_VALUE) - { - /* We didn't */ - return GetLastError(); - } - else - { - /* Change the pipe into message mode */ - PipeMode = PIPE_READMODE_MESSAGE; - if (!SetNamedPipeHandleState(PipeHandle, &PipeMode, NULL, NULL)) - { - /* Mode change failed */ - CloseHandle(PipeHandle); - PipeHandle = INVALID_HANDLE_VALUE; - return GetLastError(); - } - else - { - /* We're good to go */ - *Version = 2; - return NO_ERROR; - } - } - } - else + if (!WaitNamedPipeW(DHCP_PIPE_NAME, NMPWAIT_USE_DEFAULT_WAIT)) { /* No good, we failed */ return GetLastError(); } -} - -VOID APIENTRY DhcpCApiCleanup() { + + /* It's available, let's try to open it */ + PipeHandle = CreateFileW(DHCP_PIPE_NAME, + GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, + NULL, + OPEN_EXISTING, + 0, + NULL); + + /* Check if we succeeded in opening the pipe */ + if (PipeHandle == INVALID_HANDLE_VALUE) + { + /* We didn't */ + return GetLastError(); + } + + /* Change the pipe into message mode */ + PipeMode = PIPE_READMODE_MESSAGE; + if (!SetNamedPipeHandleState(PipeHandle, &PipeMode, NULL, NULL)) + { + /* Mode change failed */ + CloseHandle(PipeHandle); + PipeHandle = INVALID_HANDLE_VALUE; + return GetLastError(); + } + else + { + /* We're good to go */ + *Version = 2; + return NO_ERROR; + } +} + +VOID APIENTRY +DhcpCApiCleanup(VOID) +{ CloseHandle(PipeHandle); PipeHandle = INVALID_HANDLE_VALUE; } -DWORD APIENTRY DhcpQueryHWInfo( DWORD AdapterIndex, - PDWORD MediaType, - PDWORD Mtu, - PDWORD Speed ) { +DWORD APIENTRY +DhcpQueryHWInfo(DWORD AdapterIndex, + PDWORD MediaType, + PDWORD Mtu, + PDWORD Speed) +{ COMM_DHCP_REQ Req; COMM_DHCP_REPLY Reply; DWORD BytesRead; @@ -89,16 +97,18 @@ return 0; } - if( !Reply.Reply ) return 0; - else { - *MediaType = Reply.QueryHWInfo.MediaType; - *Mtu = Reply.QueryHWInfo.Mtu; - *Speed = Reply.QueryHWInfo.Speed; - return 1; - } -} - -DWORD APIENTRY DhcpLeaseIpAddress( DWORD AdapterIndex ) { + if (Reply.Reply == 0) + return 0; + + *MediaType = Reply.QueryHWInfo.MediaType; + *Mtu = Reply.QueryHWInfo.Mtu; + *Speed = Reply.QueryHWInfo.Speed; + return 1; +} + +DWORD APIENTRY +DhcpLeaseIpAddress(DWORD AdapterIndex) +{ COMM_DHCP_REQ Req; COMM_DHCP_REPLY Reply; DWORD BytesRead; @@ -122,7 +132,9 @@ return Reply.Reply; } -DWORD APIENTRY DhcpReleaseIpAddressLease( DWORD AdapterIndex ) { +DWORD APIENTRY +DhcpReleaseIpAddressLease(DWORD AdapterIndex) +{ COMM_DHCP_REQ Req; COMM_DHCP_REPLY Reply; DWORD BytesRead; @@ -146,7 +158,9 @@ return Reply.Reply; } -DWORD APIENTRY DhcpRenewIpAddressLease( DWORD AdapterIndex ) { +DWORD APIENTRY +DhcpRenewIpAddressLease(DWORD AdapterIndex) +{ COMM_DHCP_REQ Req; COMM_DHCP_REPLY Reply; DWORD BytesRead; @@ -170,9 +184,11 @@ return Reply.Reply; } -DWORD APIENTRY DhcpStaticRefreshParams( DWORD AdapterIndex, - DWORD Address, - DWORD Netmask ) { +DWORD APIENTRY +DhcpStaticRefreshParams(DWORD AdapterIndex, + DWORD Address, + DWORD Netmask) +{ COMM_DHCP_REQ Req; COMM_DHCP_REPLY Reply; DWORD BytesRead; @@ -232,9 +248,9 @@ DWORD IpIndex, DWORD IpAddress, DWORD SubnetMask, - int DhcpAction) -{ - DbgPrint("DHCPCSVC: DhcpNotifyConfigChange not implemented yet\n"); + INT DhcpAction) +{ + DPRINT1("DHCPCSVC: DhcpNotifyConfigChange not implemented yet\n"); return 0; } @@ -262,11 +278,12 @@ * * \remarks This is a ReactOS-only routine */ -DWORD APIENTRY DhcpRosGetAdapterInfo( DWORD AdapterIndex, - PBOOL DhcpEnabled, - PDWORD DhcpServer, - time_t *LeaseObtained, - time_t *LeaseExpires ) +DWORD APIENTRY +DhcpRosGetAdapterInfo(DWORD AdapterIndex, + PBOOL DhcpEnabled, + PDWORD DhcpServer, + time_t* LeaseObtained, + time_t* LeaseExpires) { COMM_DHCP_REQ Req; COMM_DHCP_REPLY Reply; @@ -283,16 +300,19 @@ &Reply, sizeof(Reply), &BytesRead, NULL); - if ( 0 != Result && 0 != Reply.Reply ) { + if (Result && Reply.Reply != 0) *DhcpEnabled = Reply.GetAdapterInfo.DhcpEnabled; - } else { + else *DhcpEnabled = FALSE; - } - if ( *DhcpEnabled ) { + + if (*DhcpEnabled) + { *DhcpServer = Reply.GetAdapterInfo.DhcpServer; *LeaseObtained = Reply.GetAdapterInfo.LeaseObtained; *LeaseExpires = Reply.GetAdapterInfo.LeaseExpires; - } else { + } + else + { *DhcpServer = INADDR_NONE; *LeaseObtained = 0; *LeaseExpires = 0; @@ -301,22 +321,120 @@ return Reply.Reply; } + +static VOID +UpdateServiceStatus(DWORD dwState) +{ + ServiceStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS; + ServiceStatus.dwCurrentState = dwState; + + ServiceStatus.dwControlsAccepted = 0; + + ServiceStatus.dwWin32ExitCode = 0; + ServiceStatus.dwServiceSpecificExitCode = 0; + ServiceStatus.dwCheckPoint = 0; + + if (dwState == SERVICE_START_PENDING || + dwState == SERVICE_STOP_PENDING || + dwState == SERVICE_PAUSE_PENDING || + dwState == SERVICE_CONTINUE_PENDING) + ServiceStatus.dwWaitHint = 10000; + else + ServiceStatus.dwWaitHint = 0; + + SetServiceStatus(ServiceStatusHandle, + &ServiceStatus); +} + +static DWORD WINAPI +ServiceControlHandler(DWORD dwControl, + DWORD dwEventType, + LPVOID lpEventData, + LPVOID lpContext) +{ + switch (dwControl) + { + case SERVICE_CONTROL_STOP: + UpdateServiceStatus(SERVICE_STOP_PENDING); + UpdateServiceStatus(SERVICE_STOPPED); + return ERROR_SUCCESS; + + case SERVICE_CONTROL_PAUSE: + UpdateServiceStatus(SERVICE_PAUSED); + return ERROR_SUCCESS; + + case SERVICE_CONTROL_CONTINUE: + UpdateServiceStatus(SERVICE_START_PENDING); + UpdateServiceStatus(SERVICE_RUNNING); + return ERROR_SUCCESS; + + case SERVICE_CONTROL_INTERROGATE: + SetServiceStatus(ServiceStatusHandle, + &ServiceStatus); + return ERROR_SUCCESS; + + case SERVICE_CONTROL_SHUTDOWN: + UpdateServiceStatus(SERVICE_STOP_PENDING); + UpdateServiceStatus(SERVICE_STOPPED); + return ERROR_SUCCESS; + + default : + return ERROR_CALL_NOT_IMPLEMENTED; + } +} + +VOID WINAPI +ServiceMain(DWORD argc, LPWSTR* argv) +{ + ServiceStatusHandle = RegisterServiceCtrlHandlerExW(ServiceName, + ServiceControlHandler, + NULL); + if (!ServiceStatusHandle) + { + DPRINT1("DHCPCSVC: Unable to register service control handler (%lx)\n", GetLastError()); + return; + } + + UpdateServiceStatus(SERVICE_START_PENDING); + + if (!init_client()) + { + DPRINT1("DHCPCSVC: init_client() failed!\n"); + UpdateServiceStatus(SERVICE_STOPPED); + return; + } + + DH_DbgPrint(MID_TRACE,("DHCP Service Started\n")); + + UpdateServiceStatus(SERVICE_RUNNING); + + DH_DbgPrint(MID_TRACE,("Going into dispatch()\n")); + DH_DbgPrint(MID_TRACE,("DHCPCSVC: DHCP service is starting up\n")); + + dispatch(); + + DH_DbgPrint(MID_TRACE,("DHCPCSVC: DHCP service is shutting down\n")); + stop_client(); + + UpdateServiceStatus(SERVICE_STOPPED); +} + INT WINAPI DllMain(PVOID hinstDll, - ULONG dwReason, - PVOID reserved) -{ - switch (dwReason) - { - case DLL_PROCESS_ATTACH: - DisableThreadLibraryCalls(hinstDll); - break; - - case DLL_PROCESS_DETACH: - break; - } - - return TRUE; + ULONG dwReason, + PVOID reserved) +{ + switch (dwReason) + { + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls(hinstDll); + break; + + case DLL_PROCESS_DETACH: + break; + } + + return TRUE; } /* EOF */ Modified: trunk/reactos/dll/win32/dhcpcsvc/include/rosdhcp.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/dhcpcsvc/include…
============================================================================== --- trunk/reactos/dll/win32/dhcpcsvc/include/rosdhcp.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/dhcpcsvc/include/rosdhcp.h [iso-8859-1] Thu Sep 25 22:01:42 2014 @@ -81,6 +81,9 @@ #define random rand #define srandom srand +int init_client(void); +void stop_client(void); + void AdapterInit(VOID); HANDLE StartAdapterDiscovery(VOID); void AdapterStop(VOID);
10 years, 3 months
1
0
0
0
← Newer
1
...
11
12
13
14
15
16
17
...
42
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
Results per page:
10
25
50
100
200