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
January 2009
----- 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
30 participants
755 discussions
Start a n
N
ew thread
[silverblade] 38519: Implemented device instance tracking list. Also fixed problem with NULL initialisation of the function table.
by silverblade@svn.reactos.org
Author: silverblade Date: Fri Jan 2 23:20:07 2009 New Revision: 38519 URL:
http://svn.reactos.org/svn/reactos?rev=38519&view=rev
Log: Implemented device instance tracking list. Also fixed problem with NULL initialisation of the function table. Modified: branches/silverblade-audio/include/reactos/libs/sound/mmebuddy.h branches/silverblade-audio/lib/drivers/sound/mmebuddy/deviceinstance.c branches/silverblade-audio/lib/drivers/sound/mmebuddy/devicelist.c branches/silverblade-audio/lib/drivers/sound/mmebuddy/functiontable.c Modified: branches/silverblade-audio/include/reactos/libs/sound/mmebuddy.h URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/include/react…
============================================================================== --- branches/silverblade-audio/include/reactos/libs/sound/mmebuddy.h [iso-8859-1] (original) +++ branches/silverblade-audio/include/reactos/libs/sound/mmebuddy.h [iso-8859-1] Fri Jan 2 23:20:07 2009 @@ -60,6 +60,7 @@ ExitProcess(1); \ } \ } + #else #define SND_ERR(...) while ( 0 ) do {} #define SND_WARN(...) while ( 0 ) do {} @@ -124,6 +125,9 @@ } \ } +#define MMSUCCESS(result) \ + ( result == MMSYSERR_NOERROR ) + /* Types and Structures @@ -188,6 +192,8 @@ typedef struct _SOUND_DEVICE { struct _SOUND_DEVICE* Next; + struct _SOUND_DEVICE_INSTANCE* HeadInstance; + struct _SOUND_DEVICE_INSTANCE* TailInstance; MMDEVICE_TYPE Type; PVOID Identifier; /* Path for NT4 drivers */ /*PWSTR Path;*/ @@ -196,6 +202,7 @@ typedef struct _SOUND_DEVICE_INSTANCE { + struct _SOUND_DEVICE_INSTANCE* Next; struct _SOUND_DEVICE* Device; PVOID Handle; @@ -324,7 +331,7 @@ MMRESULT SetSoundDeviceFunctionTable( IN PSOUND_DEVICE SoundDevice, - IN PMMFUNCTION_TABLE FunctionTable); + IN PMMFUNCTION_TABLE FunctionTable OPTIONAL); MMRESULT GetSoundDeviceFunctionTable( Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/deviceinstance.c URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/deviceinstance.c [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/deviceinstance.c [iso-8859-1] Fri Jan 2 23:20:07 2009 @@ -37,7 +37,9 @@ FreeSoundDeviceInstance( IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance) { - SND_ASSERT( IsValidSoundDeviceInstance(SoundDeviceInstance) ); + /* This won't work as the device is no longer valid by this point! */ + /*SND_ASSERT( IsValidSoundDeviceInstance(SoundDeviceInstance) );*/ + ZeroMemory(SoundDeviceInstance, sizeof(SOUND_DEVICE_INSTANCE)); FreeMemory(SoundDeviceInstance); } @@ -45,8 +47,27 @@ IsValidSoundDeviceInstance( IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance) { - /* TODO - do this better */ - return ( SoundDeviceInstance != NULL ); + PSOUND_DEVICE SoundDevice; + PSOUND_DEVICE_INSTANCE CurrentInstance; + + if ( ! SoundDeviceInstance ) + return FALSE; + + /* GetSoundDeviceFromInstance would send us into a recursive loop... */ + SoundDevice = SoundDeviceInstance->Device; + SND_ASSERT(SoundDevice); + + CurrentInstance = SoundDevice->HeadInstance; + + while ( CurrentInstance ) + { + if ( CurrentInstance == SoundDeviceInstance ) + return TRUE; + + CurrentInstance = CurrentInstance->Next; + } + + return FALSE; } MMRESULT @@ -54,14 +75,72 @@ IN PSOUND_DEVICE SoundDevice, IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance) { - return MMSYSERR_NOTSUPPORTED; + VALIDATE_MMSYS_PARAMETER( IsValidSoundDevice(SoundDevice) ); + VALIDATE_MMSYS_PARAMETER( SoundDeviceInstance ); + + SND_TRACE(L"Listing sound device instance\n"); + + if ( ! SoundDevice->HeadInstance ) + { + /* First entry - assign to head and tail */ + SoundDevice->HeadInstance = SoundDeviceInstance; + SoundDevice->TailInstance = SoundDeviceInstance; + } + else + { + /* Attach to the end */ + SoundDevice->TailInstance->Next = SoundDeviceInstance; + SoundDevice->TailInstance = SoundDeviceInstance; + } + + return MMSYSERR_NOERROR; } MMRESULT UnlistSoundDeviceInstance( IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance) { - return MMSYSERR_NOTSUPPORTED; + MMRESULT Result; + PSOUND_DEVICE SoundDevice; + PSOUND_DEVICE_INSTANCE CurrentInstance, PreviousInstance; + + VALIDATE_MMSYS_PARAMETER( IsValidSoundDeviceInstance(SoundDeviceInstance) ); + + SND_TRACE(L"Unlisting sound device instance\n"); + + Result = GetSoundDeviceFromInstance(SoundDeviceInstance, &SoundDevice); + SND_ASSERT( MMSUCCESS(Result) ); + + PreviousInstance = NULL; + CurrentInstance = SoundDevice->HeadInstance; + + while ( CurrentInstance ) + { + if ( CurrentInstance == SoundDeviceInstance ) + { + if ( ! PreviousInstance ) + { + /* This is the head node */ + SoundDevice->HeadInstance = SoundDevice->HeadInstance->Next; + } + else + { + /* There are nodes before this one - cut ours out */ + PreviousInstance->Next = CurrentInstance->Next; + } + + if ( ! CurrentInstance->Next ) + { + /* This is the tail node */ + SoundDevice->TailInstance = PreviousInstance; + } + } + + PreviousInstance = CurrentInstance; + CurrentInstance = CurrentInstance->Next; + } + + return MMSYSERR_NOERROR; } MMRESULT @@ -97,17 +176,31 @@ } /* Set up the members of the structure */ + (*SoundDeviceInstance)->Next = NULL; (*SoundDeviceInstance)->Device = SoundDevice; + (*SoundDeviceInstance)->Handle = NULL; + + (*SoundDeviceInstance)->WinMM.Handle = NULL; + (*SoundDeviceInstance)->WinMM.ClientCallback = 0; + (*SoundDeviceInstance)->WinMM.ClientCallbackInstanceData = 0; + (*SoundDeviceInstance)->WinMM.Flags = 0; + + /* Add the instance to the list */ + Result = ListSoundDeviceInstance(SoundDevice, *SoundDeviceInstance); + if ( ! MMSUCCESS(Result) ) + { + FreeSoundDeviceInstance(*SoundDeviceInstance); + return TranslateInternalMmResult(Result); + } /* Try and open the device */ Result = FunctionTable->Open(SoundDevice, (&(*SoundDeviceInstance)->Handle)); - if ( Result != MMSYSERR_NOERROR ) - { + if ( ! MMSUCCESS(Result) ) + { + UnlistSoundDeviceInstance(*SoundDeviceInstance); FreeSoundDeviceInstance(*SoundDeviceInstance); return TranslateInternalMmResult(Result); } - - /* TODO: List device */ return MMSYSERR_NOERROR; } @@ -126,18 +219,16 @@ VALIDATE_MMSYS_PARAMETER( IsValidSoundDeviceInstance(SoundDeviceInstance) ); Result = GetSoundDeviceFromInstance(SoundDeviceInstance, &SoundDevice); - if ( Result != MMSYSERR_NOERROR ) - return TranslateInternalMmResult(Result); - - /* TODO: Unlist */ + if ( ! MMSUCCESS(Result) ) + return TranslateInternalMmResult(Result); Result = GetSoundDeviceInstanceHandle(SoundDeviceInstance, &Handle); - if ( Result != MMSYSERR_NOERROR ) + if ( ! MMSUCCESS(Result) ) return TranslateInternalMmResult(Result); /* Get the "close" routine from the function table, and validate it */ Result = GetSoundDeviceFunctionTable(SoundDevice, &FunctionTable); - if ( Result != MMSYSERR_NOERROR ) + if ( ! MMSUCCESS(Result) ) return TranslateInternalMmResult(Result); SND_ASSERT( FunctionTable->Close ); @@ -149,7 +240,12 @@ /* Try and close the device */ Result = FunctionTable->Close(SoundDeviceInstance, Handle); - if ( Result != MMSYSERR_NOERROR ) + if ( ! MMSUCCESS(Result) ) + return TranslateInternalMmResult(Result); + + /* Drop it from the list */ + Result = UnlistSoundDeviceInstance(SoundDeviceInstance); + if ( ! MMSUCCESS(Result) ) return TranslateInternalMmResult(Result); FreeSoundDeviceInstance(SoundDeviceInstance); Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/devicelist.c URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/devicelist.c [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/devicelist.c [iso-8859-1] Fri Jan 2 23:20:07 2009 @@ -172,6 +172,8 @@ /* Set up other members of the structure */ NewDevice->Identifier = Identifier; + NewDevice->HeadInstance = NULL; + NewDevice->TailInstance = NULL; /* Fill in the caller's PSOUND_DEVICE */ if ( SoundDevice ) Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/functiontable.c URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/functiontable.c [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/functiontable.c [iso-8859-1] Fri Jan 2 23:20:07 2009 @@ -24,18 +24,20 @@ MMRESULT SetSoundDeviceFunctionTable( IN PSOUND_DEVICE SoundDevice, - IN PMMFUNCTION_TABLE FunctionTable) + IN PMMFUNCTION_TABLE FunctionTable OPTIONAL) { VALIDATE_MMSYS_PARAMETER( IsValidSoundDevice(SoundDevice) ); - VALIDATE_MMSYS_PARAMETER( FunctionTable ); /* Zero out the existing function table (if present) */ ZeroMemory(&SoundDevice->FunctionTable, sizeof(MMFUNCTION_TABLE)); - /* Fill in the client-supplied functions */ - CopyMemory(&SoundDevice->FunctionTable, - FunctionTable, - sizeof(MMFUNCTION_TABLE)); + if ( FunctionTable ) + { + /* Fill in the client-supplied functions */ + CopyMemory(&SoundDevice->FunctionTable, + FunctionTable, + sizeof(MMFUNCTION_TABLE)); + } return MMSYSERR_NOERROR; }
15 years, 11 months
1
0
0
0
[jimtabor] 38518: - Removed SEH abuse and add notes for the hook code, in NtUserDefSetText. - Update NtUserCallHwndLock subfunctions.
by jimtabor@svn.reactos.org
Author: jimtabor Date: Fri Jan 2 22:02:54 2009 New Revision: 38518 URL:
http://svn.reactos.org/svn/reactos?rev=38518&view=rev
Log: - Removed SEH abuse and add notes for the hook code, in NtUserDefSetText. - Update NtUserCallHwndLock subfunctions. Modified: trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c trunk/reactos/subsystems/win32/win32k/ntuser/window.c Modified: trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c [iso-8859-1] Fri Jan 2 22:02:54 2009 @@ -713,7 +713,7 @@ DPRINT("Enter NtUserCallHwndLock\n"); UserEnterExclusive(); - if (!(Window = UserGetWindowObject(hWnd))) + if (!(Window = UserGetWindowObject(hWnd)) || !Window->Wnd) { RETURN( FALSE); } @@ -742,15 +742,45 @@ Menu->MenuInfo.WndOwner = hWnd; Menu->MenuInfo.Height = 0; - co_WinPosSetWindowPos(Window, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | - SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED ); + co_WinPosSetWindowPos( Window, + HWND_DESKTOP, + 0,0,0,0, + SWP_NOSIZE| + SWP_NOMOVE| + SWP_NOZORDER| + SWP_NOACTIVATE| + SWP_FRAMECHANGED ); Ret = TRUE; break; } case HWNDLOCK_ROUTINE_REDRAWFRAME: - /* FIXME */ + co_WinPosSetWindowPos( Window, + HWND_DESKTOP, + 0,0,0,0, + SWP_NOSIZE| + SWP_NOMOVE| + SWP_NOZORDER| + SWP_NOACTIVATE| + SWP_FRAMECHANGED ); + Ret = TRUE; + break; + + case HWNDLOCK_ROUTINE_REDRAWFRAMEANDHOOK: + co_WinPosSetWindowPos( Window, + HWND_DESKTOP, + 0,0,0,0, + SWP_NOSIZE| + SWP_NOMOVE| + SWP_NOZORDER| + SWP_NOACTIVATE| + SWP_FRAMECHANGED ); + if (!IntGetOwner(Window) && !IntGetParent(Window)) + { + co_IntShellHookNotify(HSHELL_REDRAW, (LPARAM) hWnd); + } + Ret = TRUE; break; case HWNDLOCK_ROUTINE_SETFOREGROUNDWINDOW: @@ -758,7 +788,7 @@ break; case HWNDLOCK_ROUTINE_UPDATEWINDOW: - /* FIXME */ + Ret = co_UserRedrawWindow( Window, NULL, 0, RDW_UPDATENOW | RDW_ALLCHILDREN); break; } Modified: trunk/reactos/subsystems/win32/win32k/ntuser/window.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] Fri Jan 2 22:02:54 2009 @@ -4569,57 +4569,47 @@ } Wnd = Window->Wnd; - if(SafeText.Length != 0) - { - _SEH2_TRY - { - if (Wnd->WindowName.MaximumLength > 0 && - SafeText.Length <= Wnd->WindowName.MaximumLength - sizeof(UNICODE_NULL)) - { - ASSERT(Wnd->WindowName.Buffer != NULL); - - Wnd->WindowName.Length = SafeText.Length; - Wnd->WindowName.Buffer[SafeText.Length / sizeof(WCHAR)] = L'\0'; - RtlCopyMemory(Wnd->WindowName.Buffer, - SafeText.Buffer, - SafeText.Length); - } - else - { - PWCHAR buf; - Wnd->WindowName.MaximumLength = Wnd->WindowName.Length = 0; - buf = Wnd->WindowName.Buffer; - Wnd->WindowName.Buffer = NULL; - if (buf != NULL) - { - DesktopHeapFree(Wnd->pdesktop, - buf); - } - - Wnd->WindowName.Buffer = DesktopHeapAlloc(Wnd->pdesktop, - SafeText.Length + sizeof(UNICODE_NULL)); - if (Wnd->WindowName.Buffer != NULL) - { - Wnd->WindowName.Buffer[SafeText.Length / sizeof(WCHAR)] = L'\0'; - RtlCopyMemory(Wnd->WindowName.Buffer, - SafeText.Buffer, - SafeText.Length); - Wnd->WindowName.MaximumLength = SafeText.Length + sizeof(UNICODE_NULL); - Wnd->WindowName.Length = SafeText.Length; - } - else - { - SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY); - Ret = FALSE; - } - } - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - SetLastNtError(_SEH2_GetExceptionCode()); - Ret = FALSE; - } - _SEH2_END; + if (SafeText.Length != 0) + { + if (Wnd->WindowName.MaximumLength > 0 && + SafeText.Length <= Wnd->WindowName.MaximumLength - sizeof(UNICODE_NULL)) + { + ASSERT(Wnd->WindowName.Buffer != NULL); + + Wnd->WindowName.Length = SafeText.Length; + Wnd->WindowName.Buffer[SafeText.Length / sizeof(WCHAR)] = L'\0'; + RtlCopyMemory(Wnd->WindowName.Buffer, + SafeText.Buffer, + SafeText.Length); + } + else + { + PWCHAR buf; + Wnd->WindowName.MaximumLength = Wnd->WindowName.Length = 0; + buf = Wnd->WindowName.Buffer; + Wnd->WindowName.Buffer = NULL; + if (buf != NULL) + { + DesktopHeapFree(Wnd->pdesktop, buf); + } + + Wnd->WindowName.Buffer = DesktopHeapAlloc(Wnd->pdesktop, + SafeText.Length + sizeof(UNICODE_NULL)); + if (Wnd->WindowName.Buffer != NULL) + { + Wnd->WindowName.Buffer[SafeText.Length / sizeof(WCHAR)] = L'\0'; + RtlCopyMemory(Wnd->WindowName.Buffer, + SafeText.Buffer, + SafeText.Length); + Wnd->WindowName.MaximumLength = SafeText.Length + sizeof(UNICODE_NULL); + Wnd->WindowName.Length = SafeText.Length; + } + else + { + SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY); + Ret = FALSE; + } + } } else { @@ -4628,6 +4618,9 @@ Wnd->WindowName.Buffer[0] = L'\0'; } + // HAX! FIXME! Windows does not do this in here! + // In User32, these are called after: NotifyWinEvent EVENT_OBJECT_NAMECHANGE than + // RepaintButton, StaticRepaint, NtUserCallHwndLock HWNDLOCK_ROUTINE_REDRAWFRAMEANDHOOK, etc. /* Send shell notifications */ if (!IntGetOwner(Window) && !IntGetParent(Window)) {
15 years, 11 months
1
0
0
0
[jimtabor] 38517: - Add check for null Wnd, see bug 3995.
by jimtabor@svn.reactos.org
Author: jimtabor Date: Fri Jan 2 20:20:50 2009 New Revision: 38517 URL:
http://svn.reactos.org/svn/reactos?rev=38517&view=rev
Log: - Add check for null Wnd, see bug 3995. Modified: trunk/reactos/subsystems/win32/win32k/ntuser/window.c Modified: trunk/reactos/subsystems/win32/win32k/ntuser/window.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] Fri Jan 2 20:20:50 2009 @@ -4562,7 +4562,7 @@ UserEnterExclusive(); - if(!(Window = UserGetWindowObject(hWnd))) + if(!(Window = UserGetWindowObject(hWnd)) || !Window->Wnd) { UserLeave(); return FALSE;
15 years, 11 months
1
0
0
0
[silverblade] 38516: Implemented callback mechanism, wired this up to the wave device opening and closing routines. Media Player on Windows NT can now open and close the device and will exit properly, letting go of the device now.
by silverblade@svn.reactos.org
Author: silverblade Date: Fri Jan 2 19:59:50 2009 New Revision: 38516 URL:
http://svn.reactos.org/svn/reactos?rev=38516&view=rev
Log: Implemented callback mechanism, wired this up to the wave device opening and closing routines. Media Player on Windows NT can now open and close the device and will exit properly, letting go of the device now. Modified: branches/silverblade-audio/include/reactos/libs/sound/mmebuddy.h branches/silverblade-audio/lib/drivers/sound/mmebuddy/deviceinstance.c branches/silverblade-audio/lib/drivers/sound/mmebuddy/mmewrap.c branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/wodMessage.c Modified: branches/silverblade-audio/include/reactos/libs/sound/mmebuddy.h URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/include/react…
============================================================================== --- branches/silverblade-audio/include/reactos/libs/sound/mmebuddy.h [iso-8859-1] (original) +++ branches/silverblade-audio/include/reactos/libs/sound/mmebuddy.h [iso-8859-1] Fri Jan 2 19:59:50 2009 @@ -198,6 +198,15 @@ { struct _SOUND_DEVICE* Device; PVOID Handle; + + /* Stuff generously donated to us from WinMM */ + struct + { + HDRVR Handle; + DWORD Flags; + DWORD ClientCallback; + DWORD ClientCallbackInstanceData; + } WinMM; } SOUND_DEVICE_INSTANCE, *PSOUND_DEVICE_INSTANCE; @@ -223,6 +232,12 @@ /* mme.c */ + +VOID +NotifyMmeClient( + IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, + IN DWORD Message, + IN DWORD Parameter); MMRESULT MmeGetSoundDeviceCapabilities( @@ -347,6 +362,14 @@ GetSoundDeviceInstanceHandle( IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, OUT PVOID* Handle); + +MMRESULT +SetSoundDeviceInstanceMmeData( + IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, + IN HDRVR MmeHandle, + IN DWORD ClientCallback, + IN DWORD ClientCallbackData, + IN DWORD Flags); /* @@ -613,14 +636,6 @@ HANDLE Handle; /* PSOUND_THREAD Thread;*/ - /* Stuff generously donated to us from WinMM */ - struct - { - HDRVR Handle; - DWORD Flags; - DWORD ClientCallback; - DWORD ClientCallbackInstanceData; - } WinMM; /* Device-specific parameters */ union Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/deviceinstance.c URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/deviceinstance.c [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/deviceinstance.c [iso-8859-1] Fri Jan 2 19:59:50 2009 @@ -189,3 +189,24 @@ return MMSYSERR_NOERROR; } + +MMRESULT +SetSoundDeviceInstanceMmeData( + IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, + IN HDRVR MmeHandle, + IN DWORD ClientCallback, + IN DWORD ClientCallbackData, + IN DWORD Flags) +{ + VALIDATE_MMSYS_PARAMETER( IsValidSoundDeviceInstance(SoundDeviceInstance) ); + + SND_TRACE(L"Setting MME data - handle %x, callback %x, instance data %x, flags %x\n", + MmeHandle, ClientCallback, ClientCallbackData, Flags); + + SoundDeviceInstance->WinMM.Handle = MmeHandle; + SoundDeviceInstance->WinMM.ClientCallback = ClientCallback; + SoundDeviceInstance->WinMM.ClientCallbackInstanceData = ClientCallbackData; + SoundDeviceInstance->WinMM.Flags = Flags; + + return MMSYSERR_NOERROR; +} Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/mmewrap.c URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/mmewrap.c [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/mmewrap.c [iso-8859-1] Fri Jan 2 19:59:50 2009 @@ -14,6 +14,35 @@ #include <ntddk.h> #include <ntddsnd.h> #include <mmebuddy.h> + +/* + Call the client application when something interesting happens (MME API + defines "interesting things" as device open, close, and buffer + completion.) +*/ +VOID +NotifyMmeClient( + IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, + IN DWORD Message, + IN DWORD Parameter) +{ + ASSERT( SoundDeviceInstance ); + + SND_TRACE(L"MME client callback - message %d, parameter %d\n", + (int) Message, + (int) Parameter); + + if ( SoundDeviceInstance->WinMM.ClientCallback ) + { + DriverCallback(SoundDeviceInstance->WinMM.ClientCallback, + HIWORD(SoundDeviceInstance->WinMM.Flags), + SoundDeviceInstance->WinMM.Handle, + Message, + SoundDeviceInstance->WinMM.ClientCallbackInstanceData, + Parameter, + 0); + } +} /* This is a helper function to alleviate some of the repetition involved with @@ -101,9 +130,19 @@ /* Store the device instance pointer in the private handle - is DWORD safe here? */ *PrivateHandle = (DWORD) SoundDeviceInstance; - /* TODO: Call the client application back to say the device is open */ + /* Store the additional information we were given - FIXME: Need flags! */ + SetSoundDeviceInstanceMmeData(SoundDeviceInstance, + (HDRVR)OpenParameters->hWave, + OpenParameters->dwCallback, + OpenParameters->dwInstance, + Flags); + + /* Let the application know the device is open */ ReleaseEntrypointMutex(DeviceType); - /* ... */ + NotifyMmeClient(SoundDeviceInstance, + DeviceType == WAVE_OUT_DEVICE_TYPE ? WOM_OPEN : WIM_OPEN, + 0); + AcquireEntrypointMutex(DeviceType); SND_TRACE(L"Wave device now open\n"); @@ -118,12 +157,28 @@ /* FIXME - Where do we call the callback?? */ MMRESULT Result; PSOUND_DEVICE_INSTANCE SoundDeviceInstance; + PSOUND_DEVICE SoundDevice; + MMDEVICE_TYPE DeviceType; SND_TRACE(L"Closing wave device (WIDM_CLOSE / WODM_CLOSE)\n"); VALIDATE_MMSYS_PARAMETER( PrivateHandle ); SoundDeviceInstance = (PSOUND_DEVICE_INSTANCE) PrivateHandle; + Result = GetSoundDeviceFromInstance(SoundDeviceInstance, &SoundDevice); + if ( Result != MMSYSERR_NOERROR ) + return TranslateInternalMmResult(Result); + + Result = GetSoundDeviceType(SoundDevice, &DeviceType); + if ( Result != MMSYSERR_NOERROR ) + return TranslateInternalMmResult(Result); + + ReleaseEntrypointMutex(DeviceType); + NotifyMmeClient(SoundDeviceInstance, + DeviceType == WAVE_OUT_DEVICE_TYPE ? WOM_CLOSE : WIM_CLOSE, + 0); + AcquireEntrypointMutex(DeviceType); + Result = DestroySoundDeviceInstance(SoundDeviceInstance); return Result; Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/wodMessage.c URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/wodMessage.c [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/wodMessage.c [iso-8859-1] Fri Jan 2 19:59:50 2009 @@ -64,14 +64,18 @@ case WODM_CLOSE : { - /* - What should happen here? - - Validate the sound device instance - - Destroy it - */ Result = MmeCloseDevice(PrivateHandle); break; + } + + case WODM_PREPARE : + { + /*Result = MmeWavePrepare(*/ + } + + case WODM_UNPREPARE : + { } }
15 years, 11 months
1
0
0
0
[silverblade] 38515: Move MME interface-wrapping code into its own file (mmewrap.c), implement device closure code. Still need to list/unlist instances but for now this seems to work.
by silverblade@svn.reactos.org
Author: silverblade Date: Fri Jan 2 19:23:15 2009 New Revision: 38515 URL:
http://svn.reactos.org/svn/reactos?rev=38515&view=rev
Log: Move MME interface-wrapping code into its own file (mmewrap.c), implement device closure code. Still need to list/unlist instances but for now this seems to work. Added: branches/silverblade-audio/lib/drivers/sound/mmebuddy/mmewrap.c (with props) Modified: branches/silverblade-audio/dll/win32/sndblst/sndblst.c branches/silverblade-audio/include/reactos/libs/sound/mmebuddy.h branches/silverblade-audio/include/reactos/libs/sound/mment4.h branches/silverblade-audio/lib/drivers/sound/mmebuddy/capabilities.c branches/silverblade-audio/lib/drivers/sound/mmebuddy/deviceinstance.c branches/silverblade-audio/lib/drivers/sound/mmebuddy/mmebuddy.rbuild branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/format.c branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/wodMessage.c branches/silverblade-audio/lib/drivers/sound/mment4/control.c Modified: branches/silverblade-audio/dll/win32/sndblst/sndblst.c URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/dll/win32/snd…
============================================================================== --- branches/silverblade-audio/dll/win32/sndblst/sndblst.c [iso-8859-1] (original) +++ branches/silverblade-audio/dll/win32/sndblst/sndblst.c [iso-8859-1] Fri Jan 2 19:23:15 2009 @@ -101,6 +101,7 @@ FuncTable.QueryWaveFormatSupport = QueryNt4WaveDeviceFormatSupport; FuncTable.SetWaveFormat = SetNt4WaveDeviceFormat; FuncTable.Open = OpenNt4SoundDevice; + FuncTable.Close = CloseNt4SoundDevice; SetSoundDeviceFunctionTable(SoundDevice, &FuncTable); Modified: branches/silverblade-audio/include/reactos/libs/sound/mmebuddy.h URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/include/react…
============================================================================== --- branches/silverblade-audio/include/reactos/libs/sound/mmebuddy.h [iso-8859-1] (original) +++ branches/silverblade-audio/include/reactos/libs/sound/mmebuddy.h [iso-8859-1] Fri Jan 2 19:23:15 2009 @@ -164,7 +164,7 @@ OUT PVOID* Handle); typedef MMRESULT (*MMCLOSE_FUNC)( - IN struct _SOUND_DEVICE* SoundDevice, + IN struct _SOUND_DEVICE_INSTANCE* SoundDeviceInstance, IN PVOID Handle); /* not sure about this */ typedef struct _MMFUNCTION_TABLE @@ -221,7 +221,7 @@ /* - capabilities.c + mme.c */ MMRESULT @@ -230,139 +230,6 @@ IN DWORD DeviceId, IN PVOID Capabilities, IN DWORD CapabilitiesSize); - -MMRESULT -GetSoundDeviceCapabilities( - IN PSOUND_DEVICE SoundDevice, - OUT PVOID Capabilities, - IN DWORD CapabilitiesSize); - - -/* - devicelist.c -*/ - -ULONG -GetSoundDeviceCount( - IN MMDEVICE_TYPE DeviceType); - -BOOLEAN -IsValidSoundDevice( - IN PSOUND_DEVICE SoundDevice); - -MMRESULT -ListSoundDevice( - IN MMDEVICE_TYPE DeviceType, - IN PVOID Identifier OPTIONAL, - OUT PSOUND_DEVICE* SoundDevice OPTIONAL); - -MMRESULT -UnlistSoundDevice( - IN MMDEVICE_TYPE DeviceType, - IN PSOUND_DEVICE SoundDevice); - -MMRESULT -UnlistSoundDevices( - IN MMDEVICE_TYPE DeviceType); - -VOID -UnlistAllSoundDevices(); - -MMRESULT -GetSoundDevice( - IN MMDEVICE_TYPE DeviceType, - IN DWORD DeviceIndex, - OUT PSOUND_DEVICE* Device); - -MMRESULT -GetSoundDeviceIdentifier( - IN PSOUND_DEVICE SoundDevice, - OUT PVOID* Identifier); - -MMRESULT -GetSoundDeviceType( - IN PSOUND_DEVICE SoundDevice, - OUT PMMDEVICE_TYPE DeviceType); - - -/* - functiontable.c -*/ - -MMRESULT -SetSoundDeviceFunctionTable( - IN PSOUND_DEVICE SoundDevice, - IN PMMFUNCTION_TABLE FunctionTable); - -MMRESULT -GetSoundDeviceFunctionTable( - IN PSOUND_DEVICE SoundDevice, - OUT PMMFUNCTION_TABLE* FunctionTable); - - -/* - deviceinstance.c -*/ - -BOOLEAN -IsValidSoundDeviceInstance( - IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance); - -MMRESULT -CreateSoundDeviceInstance( - IN PSOUND_DEVICE SoundDevice, - OUT PSOUND_DEVICE_INSTANCE* SoundDeviceInstance); - -MMRESULT -DestroySoundDeviceInstance( - IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance); - -MMRESULT -DestroyAllSoundDeviceInstances( - IN PSOUND_DEVICE SoundDevice); - -MMRESULT -GetSoundDeviceFromInstance( - IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, - OUT PSOUND_DEVICE* SoundDevice); - -MMRESULT -GetSoundDeviceInstanceHandle( - IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, - OUT PVOID* Handle); - - -/* - utility.c -*/ - -PVOID -AllocateMemory( - IN UINT Size); - -VOID -FreeMemory( - IN PVOID Pointer); - -UINT -GetMemoryAllocationCount(); - -UINT -GetDigitCount( - IN UINT Number); - -MMRESULT -Win32ErrorToMmResult( - IN UINT ErrorCode); - -MMRESULT -TranslateInternalMmResult( - IN MMRESULT Result); - - -/* - wave/format.c -*/ MMRESULT MmeOpenWaveDevice( @@ -371,6 +238,148 @@ IN LPWAVEOPENDESC OpenParameters, IN DWORD Flags, OUT DWORD* PrivateHandle); + +MMRESULT +MmeCloseDevice( + IN DWORD PrivateHandle); + + +/* + capabilities.c +*/ + +MMRESULT +GetSoundDeviceCapabilities( + IN PSOUND_DEVICE SoundDevice, + OUT PVOID Capabilities, + IN DWORD CapabilitiesSize); + + +/* + devicelist.c +*/ + +ULONG +GetSoundDeviceCount( + IN MMDEVICE_TYPE DeviceType); + +BOOLEAN +IsValidSoundDevice( + IN PSOUND_DEVICE SoundDevice); + +MMRESULT +ListSoundDevice( + IN MMDEVICE_TYPE DeviceType, + IN PVOID Identifier OPTIONAL, + OUT PSOUND_DEVICE* SoundDevice OPTIONAL); + +MMRESULT +UnlistSoundDevice( + IN MMDEVICE_TYPE DeviceType, + IN PSOUND_DEVICE SoundDevice); + +MMRESULT +UnlistSoundDevices( + IN MMDEVICE_TYPE DeviceType); + +VOID +UnlistAllSoundDevices(); + +MMRESULT +GetSoundDevice( + IN MMDEVICE_TYPE DeviceType, + IN DWORD DeviceIndex, + OUT PSOUND_DEVICE* Device); + +MMRESULT +GetSoundDeviceIdentifier( + IN PSOUND_DEVICE SoundDevice, + OUT PVOID* Identifier); + +MMRESULT +GetSoundDeviceType( + IN PSOUND_DEVICE SoundDevice, + OUT PMMDEVICE_TYPE DeviceType); + + +/* + functiontable.c +*/ + +MMRESULT +SetSoundDeviceFunctionTable( + IN PSOUND_DEVICE SoundDevice, + IN PMMFUNCTION_TABLE FunctionTable); + +MMRESULT +GetSoundDeviceFunctionTable( + IN PSOUND_DEVICE SoundDevice, + OUT PMMFUNCTION_TABLE* FunctionTable); + + +/* + deviceinstance.c +*/ + +BOOLEAN +IsValidSoundDeviceInstance( + IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance); + +MMRESULT +CreateSoundDeviceInstance( + IN PSOUND_DEVICE SoundDevice, + OUT PSOUND_DEVICE_INSTANCE* SoundDeviceInstance); + +MMRESULT +DestroySoundDeviceInstance( + IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance); + +MMRESULT +DestroyAllSoundDeviceInstances( + IN PSOUND_DEVICE SoundDevice); + +MMRESULT +GetSoundDeviceFromInstance( + IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, + OUT PSOUND_DEVICE* SoundDevice); + +MMRESULT +GetSoundDeviceInstanceHandle( + IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, + OUT PVOID* Handle); + + +/* + utility.c +*/ + +PVOID +AllocateMemory( + IN UINT Size); + +VOID +FreeMemory( + IN PVOID Pointer); + +UINT +GetMemoryAllocationCount(); + +UINT +GetDigitCount( + IN UINT Number); + +MMRESULT +Win32ErrorToMmResult( + IN UINT ErrorCode); + +MMRESULT +TranslateInternalMmResult( + IN MMRESULT Result); + + +/* + wave/format.c +*/ MMRESULT QueryWaveDeviceFormatSupport( Modified: branches/silverblade-audio/include/reactos/libs/sound/mment4.h URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/include/react…
============================================================================== --- branches/silverblade-audio/include/reactos/libs/sound/mment4.h [iso-8859-1] (original) +++ branches/silverblade-audio/include/reactos/libs/sound/mment4.h [iso-8859-1] Fri Jan 2 19:23:15 2009 @@ -82,7 +82,7 @@ MMRESULT CloseNt4SoundDevice( - IN PSOUND_DEVICE SoundDevice, + IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, IN PVOID Handle); #endif Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/capabilities.c URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/capabilities.c [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/capabilities.c [iso-8859-1] Fri Jan 2 19:23:15 2009 @@ -14,37 +14,6 @@ #include <ntddk.h> #include <ntddsnd.h> #include <mmebuddy.h> - -/* - This is a helper function to alleviate some of the repetition involved with - implementing the various MME message functions. -*/ -MMRESULT -MmeGetSoundDeviceCapabilities( - IN MMDEVICE_TYPE DeviceType, - IN DWORD DeviceId, - IN PVOID Capabilities, - IN DWORD CapabilitiesSize) -{ - PSOUND_DEVICE SoundDevice; - MMRESULT Result; - - SND_TRACE(L"MME *_GETCAPS for device %d of type %d\n", DeviceId, DeviceType); - - /* FIXME: Validate device type and ID */ - VALIDATE_MMSYS_PARAMETER( Capabilities ); - VALIDATE_MMSYS_PARAMETER( CapabilitiesSize > 0 ); - - /* Our parameter checks are done elsewhere */ - Result = GetSoundDevice(DeviceType, DeviceId, &SoundDevice); - - if ( Result != MMSYSERR_NOERROR ) - return Result; - - return GetSoundDeviceCapabilities(SoundDevice, - Capabilities, - CapabilitiesSize); -} /* Obtains the capabilities of a sound device. This routine ensures that the Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/deviceinstance.c URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/deviceinstance.c [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/deviceinstance.c [iso-8859-1] Fri Jan 2 19:23:15 2009 @@ -37,7 +37,7 @@ FreeSoundDeviceInstance( IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance) { - SND_ASSERT( SoundDeviceInstance ); + SND_ASSERT( IsValidSoundDeviceInstance(SoundDeviceInstance) ); FreeMemory(SoundDeviceInstance); } @@ -107,6 +107,8 @@ return TranslateInternalMmResult(Result); } + /* TODO: List device */ + return MMSYSERR_NOERROR; } @@ -114,7 +116,45 @@ DestroySoundDeviceInstance( IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance) { - return MMSYSERR_NOTSUPPORTED; + MMRESULT Result; + PMMFUNCTION_TABLE FunctionTable; + PSOUND_DEVICE SoundDevice; + PVOID Handle; + + SND_TRACE(L"Destroying a sound device instance\n"); + + VALIDATE_MMSYS_PARAMETER( IsValidSoundDeviceInstance(SoundDeviceInstance) ); + + Result = GetSoundDeviceFromInstance(SoundDeviceInstance, &SoundDevice); + if ( Result != MMSYSERR_NOERROR ) + return TranslateInternalMmResult(Result); + + /* TODO: Unlist */ + + Result = GetSoundDeviceInstanceHandle(SoundDeviceInstance, &Handle); + if ( Result != MMSYSERR_NOERROR ) + return TranslateInternalMmResult(Result); + + /* Get the "close" routine from the function table, and validate it */ + Result = GetSoundDeviceFunctionTable(SoundDevice, &FunctionTable); + if ( Result != MMSYSERR_NOERROR ) + return TranslateInternalMmResult(Result); + + SND_ASSERT( FunctionTable->Close ); + if ( FunctionTable->Close == NULL ) + { + /* Bad practice, really! If you can open, why not close?! */ + return MMSYSERR_NOTSUPPORTED; + } + + /* Try and close the device */ + Result = FunctionTable->Close(SoundDeviceInstance, Handle); + if ( Result != MMSYSERR_NOERROR ) + return TranslateInternalMmResult(Result); + + FreeSoundDeviceInstance(SoundDeviceInstance); + + return MMSYSERR_NOERROR; } MMRESULT Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/mmebuddy.rbuild URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/mmebuddy.rbuild [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/mmebuddy.rbuild [iso-8859-1] Fri Jan 2 19:23:15 2009 @@ -7,6 +7,7 @@ <file>devicelist.c</file> <file>deviceinstance.c</file> <file>functiontable.c</file> + <file>mmewrap.c</file> <file>reentrancy.c</file> <file>utility.c</file> <file>kernel.c</file> Added: branches/silverblade-audio/lib/drivers/sound/mmebuddy/mmewrap.c URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/mmewrap.c (added) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/mmewrap.c [iso-8859-1] Fri Jan 2 19:23:15 2009 @@ -1,0 +1,130 @@ +/* + * PROJECT: ReactOS Sound System "MME Buddy" Library + * LICENSE: GPL - See COPYING in the top level directory + * FILE: lib/sound/mmebuddy/mmewrap.c + * + * PURPOSE: Interface between MME functions and MME Buddy's own. + * + * PROGRAMMERS: Andrew Greenwood (silverblade(a)reactos.org) +*/ + +#include <windows.h> +#include <mmsystem.h> +#include <mmddk.h> +#include <ntddk.h> +#include <ntddsnd.h> +#include <mmebuddy.h> + +/* + This is a helper function to alleviate some of the repetition involved with + implementing the various MME message functions. +*/ +MMRESULT +MmeGetSoundDeviceCapabilities( + IN MMDEVICE_TYPE DeviceType, + IN DWORD DeviceId, + IN PVOID Capabilities, + IN DWORD CapabilitiesSize) +{ + PSOUND_DEVICE SoundDevice; + MMRESULT Result; + + SND_TRACE(L"MME *_GETCAPS for device %d of type %d\n", DeviceId, DeviceType); + + /* FIXME: Validate device type and ID */ + VALIDATE_MMSYS_PARAMETER( Capabilities ); + VALIDATE_MMSYS_PARAMETER( CapabilitiesSize > 0 ); + + /* Our parameter checks are done elsewhere */ + Result = GetSoundDevice(DeviceType, DeviceId, &SoundDevice); + + if ( Result != MMSYSERR_NOERROR ) + return Result; + + return GetSoundDeviceCapabilities(SoundDevice, + Capabilities, + CapabilitiesSize); +} + +MMRESULT +MmeOpenWaveDevice( + IN MMDEVICE_TYPE DeviceType, + IN DWORD DeviceId, + IN LPWAVEOPENDESC OpenParameters, + IN DWORD Flags, + OUT DWORD* PrivateHandle) +{ + MMRESULT Result; + + PSOUND_DEVICE SoundDevice; + PSOUND_DEVICE_INSTANCE SoundDeviceInstance; + LPWAVEFORMATEX Format; + + SND_TRACE(L"Opening wave device (WIDM_OPEN / WODM_OPEN)"); + + VALIDATE_MMSYS_PARAMETER( IS_WAVE_DEVICE_TYPE(DeviceType) ); /* FIXME? wave in too? */ + VALIDATE_MMSYS_PARAMETER( OpenParameters ); + + Format = OpenParameters->lpFormat; + + Result = GetSoundDevice(DeviceType, DeviceId, &SoundDevice); + if ( Result != MMSYSERR_NOERROR ) + return TranslateInternalMmResult(Result); + + /* Does this device support the format? */ + Result = QueryWaveDeviceFormatSupport(SoundDevice, Format, sizeof(WAVEFORMATEX)); + if ( Result != MMSYSERR_NOERROR ) + { + SND_ERR(L"Format not supported\n"); + return TranslateInternalMmResult(Result); + } + + /* If the caller just wanted to know if a format is supported, end here */ + if ( Flags & WAVE_FORMAT_QUERY ) + return MMSYSERR_NOERROR; + + /* Check that winmm gave us a private handle to fill */ + VALIDATE_MMSYS_PARAMETER( PrivateHandle ); + + /* Create a sound device instance and open the sound device */ + Result = CreateSoundDeviceInstance(SoundDevice, &SoundDeviceInstance); + if ( Result != MMSYSERR_NOERROR ) + return TranslateInternalMmResult(Result); + + Result = SetWaveDeviceFormat(SoundDeviceInstance, Format, sizeof(WAVEFORMATEX)); + if ( Result != MMSYSERR_NOERROR ) + { + /* TODO: Destroy sound instance */ + return TranslateInternalMmResult(Result); + } + + /* Store the device instance pointer in the private handle - is DWORD safe here? */ + *PrivateHandle = (DWORD) SoundDeviceInstance; + + /* TODO: Call the client application back to say the device is open */ + ReleaseEntrypointMutex(DeviceType); + /* ... */ + AcquireEntrypointMutex(DeviceType); + + SND_TRACE(L"Wave device now open\n"); + + return MMSYSERR_NOERROR; +} + +MMRESULT +MmeCloseDevice( + IN DWORD PrivateHandle) +{ + /* FIXME - Where do we call the callback?? */ + MMRESULT Result; + PSOUND_DEVICE_INSTANCE SoundDeviceInstance; + + SND_TRACE(L"Closing wave device (WIDM_CLOSE / WODM_CLOSE)\n"); + + VALIDATE_MMSYS_PARAMETER( PrivateHandle ); + SoundDeviceInstance = (PSOUND_DEVICE_INSTANCE) PrivateHandle; + + Result = DestroySoundDeviceInstance(SoundDeviceInstance); + + return Result; +} Propchange: branches/silverblade-audio/lib/drivers/sound/mmebuddy/mmewrap.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/format.c URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/format.c [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/format.c [iso-8859-1] Fri Jan 2 19:23:15 2009 @@ -14,72 +14,6 @@ #include <ntddk.h> #include <ntddsnd.h> #include <mmebuddy.h> - -/* Adapted from MmeQueryWaveFormat... TODO: Move elsewhere */ -MMRESULT -MmeOpenWaveDevice( - IN MMDEVICE_TYPE DeviceType, - IN DWORD DeviceId, - IN LPWAVEOPENDESC OpenParameters, - IN DWORD Flags, - OUT DWORD* PrivateHandle) -{ - MMRESULT Result; - - PSOUND_DEVICE SoundDevice; - PSOUND_DEVICE_INSTANCE SoundDeviceInstance; - LPWAVEFORMATEX Format; - - SND_TRACE(L"Opening wave device (WIM_OPEN / WOM_OPEN)"); - - VALIDATE_MMSYS_PARAMETER( IS_WAVE_DEVICE_TYPE(DeviceType) ); /* FIXME? wave in too? */ - VALIDATE_MMSYS_PARAMETER( OpenParameters ); - - Format = OpenParameters->lpFormat; - - Result = GetSoundDevice(DeviceType, DeviceId, &SoundDevice); - if ( Result != MMSYSERR_NOERROR ) - return TranslateInternalMmResult(Result); - - /* Does this device support the format? */ - Result = QueryWaveDeviceFormatSupport(SoundDevice, Format, sizeof(WAVEFORMATEX)); - if ( Result != MMSYSERR_NOERROR ) - { - SND_ERR(L"Format not supported\n"); - return TranslateInternalMmResult(Result); - } - - /* If the caller just wanted to know if a format is supported, end here */ - if ( Flags & WAVE_FORMAT_QUERY ) - return MMSYSERR_NOERROR; - - /* Check that winmm gave us a private handle to fill */ - VALIDATE_MMSYS_PARAMETER( PrivateHandle ); - - /* Create a sound device instance and open the sound device */ - Result = CreateSoundDeviceInstance(SoundDevice, &SoundDeviceInstance); - if ( Result != MMSYSERR_NOERROR ) - return TranslateInternalMmResult(Result); - - Result = SetWaveDeviceFormat(SoundDeviceInstance, Format, sizeof(WAVEFORMATEX)); - if ( Result != MMSYSERR_NOERROR ) - { - /* TODO: Destroy sound instance */ - return TranslateInternalMmResult(Result); - } - - /* Store the device instance pointer in the private handle - is DWORD safe here? */ - *PrivateHandle = (DWORD) SoundDeviceInstance; - - /* TODO: Call the client application back to say the device is open */ - ReleaseEntrypointMutex(DeviceType); - /* ... */ - AcquireEntrypointMutex(DeviceType); - - SND_TRACE(L"Wave device now open\n"); - - return MMSYSERR_NOERROR; -} MMRESULT QueryWaveDeviceFormatSupport( Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/wodMessage.c URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/wodMessage.c [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/wodMessage.c [iso-8859-1] Fri Jan 2 19:23:15 2009 @@ -59,97 +59,6 @@ (LPWAVEOPENDESC) Parameter1, Parameter2, (DWORD*) PrivateHandle); -#if 0 - PSOUND_DEVICE SoundDevice; - PSOUND_DEVICE_INSTANCE SoundDeviceInstance; - LPWAVEOPENDESC OpenDescriptor = (LPWAVEOPENDESC) Parameter1; - - /* FIXME? Do we need the 2nd parameter to go to this routine? */ - Result = MmeQueryWaveDeviceFormatSupport(WAVE_OUT_DEVICE_TYPE, - DeviceId, - OpenDescriptor); - - if ( ( Parameter2 & WAVE_FORMAT_QUERY ) || - ( Result == MMSYSERR_NOTSUPPORTED) ) - { - /* Nothing more to be done */ - break; - } - - /* The MME API should provide us with a place to store a handle */ - if ( ! PrivateHandle ) - { - /* Not so much an invalid parameter as something messed up!! */ - SND_ERR(L"MME API supplied a NULL private handle pointer!\n"); - Result = MMSYSERR_ERROR; - break; - } - - /* Spawn an instance of the sound device */ - /*Result = MmeOpenWaveDevice(WAVE_OUT_DEVICE_TYPE, DeviceId, OpenDescriptor);*/ - /*GetSoundDevice(WAVE_OUT_DEVICE_TYPE, DeviceId, &SoundDevice); - Result = CreateSoundDeviceInstance(SoundDevice, &SoundDeviceInstance);*/ - - /* TODO... */ -#endif -#if 0 - PSOUND_DEVICE SoundDevice; - PSOUND_DEVICE_INSTANCE SoundDeviceInstance; - LPWAVEOPENDESC OpenParameters = (LPWAVEOPENDESC) Parameter1; - - /* Obtain the sound device */ - Result = GetSoundDevice(WAVE_OUT_DEVICE_TYPE, DeviceId, &SoundDevice); - - if ( Result != MMSYSERR_NOERROR ) - { - Result = TranslateInternalMmResult(Result); - break; - } - - /* See if the device supports this format */ - Result = QueryWaveDeviceFormatSupport(SoundDevice, - OpenParameters->lpFormat, - sizeof(WAVEFORMATEX)); - - if ( Parameter2 & WAVE_FORMAT_QUERY ) - { - /* Nothing more to be done - keep the result */ - Result = TranslateInternalMmResult(Result); - break; - } - - - SND_ASSERT( PrivateHandle ); - if ( ! PrivateHandle ) - { - /* Not so much an invalid parameter as something messed up!! */ - SND_ERR(L"MME API supplied a NULL private handle pointer!\n"); - Result = MMSYSERR_ERROR; - break; - } - - /* Spawn an instance of the sound device */ - Result = CreateSoundDeviceInstance(SoundDevice, &SoundDeviceInstance); - - if ( Result != MMSYSERR_NOERROR ) - { - SND_ERR(L"Failed to create sound device instance\n"); - break; - } - - /* Set the sample rate, bits per sample, etc. */ - Result = SetWaveDeviceFormat(SoundDeviceInstance, - OpenParameters->lpFormat, - sizeof(WAVEFORMATEX)); - - if ( Result != MMSYSERR_NOERROR ) - { - SND_ERR(L"Failed to set wave device format\n"); - DestroySoundDeviceInstance(SoundDeviceInstance); - break; - } - -#endif break; } @@ -160,6 +69,8 @@ - Validate the sound device instance - Destroy it */ + Result = MmeCloseDevice(PrivateHandle); + break; } } Modified: branches/silverblade-audio/lib/drivers/sound/mment4/control.c URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mment4/control.c [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mment4/control.c [iso-8859-1] Fri Jan 2 19:23:15 2009 @@ -64,12 +64,12 @@ MMRESULT CloseNt4SoundDevice( - IN PSOUND_DEVICE SoundDevice, + IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, IN PVOID Handle) { SND_TRACE(L"Closing NT4 style sound device\n"); - VALIDATE_MMSYS_PARAMETER( IsValidSoundDevice(SoundDevice) ); + VALIDATE_MMSYS_PARAMETER( IsValidSoundDeviceInstance(SoundDeviceInstance) ); return CloseKernelSoundDevice((HANDLE) Handle); }
15 years, 11 months
1
0
0
0
[silverblade] 38514: Split NT4-specific part of MME-Buddy off into its own support library (using NT4 audio driver IOCTLs for unspecified functions was a stupid idea.) Reimplemented routines for querying wave format, setting wave format, and opening/closing devices. The new implementation can cater for multiple instances of a sound device.
by silverblade@svn.reactos.org
Author: silverblade Date: Fri Jan 2 18:36:19 2009 New Revision: 38514 URL:
http://svn.reactos.org/svn/reactos?rev=38514&view=rev
Log: Split NT4-specific part of MME-Buddy off into its own support library (using NT4 audio driver IOCTLs for unspecified functions was a stupid idea.) Reimplemented routines for querying wave format, setting wave format, and opening/closing devices. The new implementation can cater for multiple instances of a sound device. Added: branches/silverblade-audio/include/reactos/libs/sound/mment4.h (with props) branches/silverblade-audio/lib/drivers/sound/mment4/ branches/silverblade-audio/lib/drivers/sound/mment4/control.c (with props) branches/silverblade-audio/lib/drivers/sound/mment4/detect.c (with props) branches/silverblade-audio/lib/drivers/sound/mment4/mment4.rbuild (with props) branches/silverblade-audio/lib/drivers/sound/mment4/registry.c (with props) Removed: branches/silverblade-audio/lib/drivers/sound/mmebuddy/nt4.c Modified: branches/silverblade-audio/dll/win32/sndblst/sndblst.c branches/silverblade-audio/dll/win32/sndblst/sndblst.rbuild branches/silverblade-audio/include/reactos/libs/sound/mmebuddy.h branches/silverblade-audio/lib/drivers/sound/mmebuddy/capabilities.c branches/silverblade-audio/lib/drivers/sound/mmebuddy/deviceinstance.c branches/silverblade-audio/lib/drivers/sound/mmebuddy/devicelist.c branches/silverblade-audio/lib/drivers/sound/mmebuddy/functiontable.c branches/silverblade-audio/lib/drivers/sound/mmebuddy/kernel.c branches/silverblade-audio/lib/drivers/sound/mmebuddy/mmebuddy.rbuild branches/silverblade-audio/lib/drivers/sound/mmebuddy/reentrancy.c branches/silverblade-audio/lib/drivers/sound/mmebuddy/utility.c branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/format.c branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/wodMessage.c branches/silverblade-audio/lib/drivers/sound/sound.rbuild Modified: branches/silverblade-audio/dll/win32/sndblst/sndblst.c URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/dll/win32/snd…
============================================================================== --- branches/silverblade-audio/dll/win32/sndblst/sndblst.c [iso-8859-1] (original) +++ branches/silverblade-audio/dll/win32/sndblst/sndblst.c [iso-8859-1] Fri Jan 2 18:36:19 2009 @@ -18,6 +18,7 @@ #include <ntddsnd.h> #include <mmddk.h> #include <mmebuddy.h> +#include <mment4.h> //#include <debug.h> PWSTR SBWaveOutDeviceName = L"ROS Sound Blaster Out"; @@ -42,9 +43,9 @@ SND_ASSERT( Result == MMSYSERR_NOERROR ); /* Use the default method of obtaining device capabilities */ - Result = DefaultGetSoundDeviceCapabilities(SoundDevice, - Capabilities, - CapabilitiesSize); + Result = GetNt4SoundDeviceCapabilities(SoundDevice, + Capabilities, + CapabilitiesSize); if ( Result != MMSYSERR_NOERROR ) return Result; @@ -68,7 +69,6 @@ return MMSYSERR_NOERROR; } - BOOLEAN FoundDevice( UCHAR DeviceType, @@ -77,26 +77,31 @@ MMRESULT Result; PSOUND_DEVICE SoundDevice = NULL; MMFUNCTION_TABLE FuncTable; - - SND_TRACE(L"Callback received: %wS\n", DevicePath); - + PWSTR PathCopy; + + SND_TRACE(L"(Callback) Found device: %wS\n", DevicePath); + + PathCopy = AllocateWideString(wcslen(DevicePath)); + + if ( ! PathCopy ) + return FALSE; + + CopyWideString(PathCopy, DevicePath); + + Result = ListSoundDevice(DeviceType, (PVOID) PathCopy, &SoundDevice); + + if ( Result != MMSYSERR_NOERROR ) + { + return TranslateInternalMmResult(Result); + return FALSE; + } + + /* Set up our function table */ FuncTable.GetCapabilities = GetSoundBlasterDeviceCapabilities; - -/* - - ZeroMemory(&FuncTable, sizeof(MMFUNCTION_TABLE)); - - FuncTable.GetCapabilities = GetSoundBlasterDeviceCapabilities; -*/ - - Result = ListSoundDevice(DeviceType, DevicePath, &SoundDevice); - - if ( Result != MMSYSERR_NOERROR ) - { - return FALSE; - } - - /* TODO: Set up function table */ + FuncTable.QueryWaveFormatSupport = QueryNt4WaveDeviceFormatSupport; + FuncTable.SetWaveFormat = SetNt4WaveDeviceFormat; + FuncTable.Open = OpenNt4SoundDevice; + SetSoundDeviceFunctionTable(SoundDevice, &FuncTable); return TRUE; @@ -153,6 +158,7 @@ { SND_TRACE(L"DRV_FREE\n"); + /* TODO: Clean up the path names! */ UnlistAllSoundDevices(); CleanupEntrypointMutexes(); Modified: branches/silverblade-audio/dll/win32/sndblst/sndblst.rbuild URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/dll/win32/snd…
============================================================================== --- branches/silverblade-audio/dll/win32/sndblst/sndblst.rbuild [iso-8859-1] (original) +++ branches/silverblade-audio/dll/win32/sndblst/sndblst.rbuild [iso-8859-1] Fri Jan 2 18:36:19 2009 @@ -5,6 +5,7 @@ <include base="ReactOS">include/reactos/libs/sound</include> <include base="sndblst">.</include> <define name="DEBUG_NT4" /> + <library>mment4</library> <library>mmebuddy</library> <library>ntdll</library> <library>kernel32</library> Modified: branches/silverblade-audio/include/reactos/libs/sound/mmebuddy.h URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/include/react…
============================================================================== --- branches/silverblade-audio/include/reactos/libs/sound/mmebuddy.h [iso-8859-1] (original) +++ branches/silverblade-audio/include/reactos/libs/sound/mmebuddy.h [iso-8859-1] Fri Jan 2 18:36:19 2009 @@ -7,6 +7,7 @@ History: 4 July 2008 - Created + 31 Dec 2008 - Split off NT4-specific code into a separate library Notes: MME Buddy was the best name I could come up with... @@ -60,7 +61,10 @@ } \ } #else - /* TODO */ + #define SND_ERR(...) while ( 0 ) do {} + #define SND_WARN(...) while ( 0 ) do {} + #define SND_TRACE(...) while ( 0 ) do {} + #define SND_ASSERT(condition) while ( 0 ) do {} #endif /* @@ -155,6 +159,14 @@ IN PWAVEFORMATEX WaveFormat, IN DWORD WaveFormatSize); +typedef MMRESULT (*MMOPEN_FUNC)( + IN struct _SOUND_DEVICE* SoundDevice, + OUT PVOID* Handle); + +typedef MMRESULT (*MMCLOSE_FUNC)( + IN struct _SOUND_DEVICE* SoundDevice, + IN PVOID Handle); /* not sure about this */ + typedef struct _MMFUNCTION_TABLE { union @@ -166,6 +178,9 @@ MMGETMIDIINCAPS_FUNC GetMidiInCapabilities; }; + MMOPEN_FUNC Open; + MMCLOSE_FUNC Close; + MMWAVEQUERYFORMATSUPPORT_FUNC QueryWaveFormatSupport; MMWAVESETFORMAT_FUNC SetWaveFormat; } MMFUNCTION_TABLE, *PMMFUNCTION_TABLE; @@ -174,13 +189,15 @@ { struct _SOUND_DEVICE* Next; MMDEVICE_TYPE Type; - PWSTR Path; + PVOID Identifier; /* Path for NT4 drivers */ + /*PWSTR Path;*/ MMFUNCTION_TABLE FunctionTable; } SOUND_DEVICE, *PSOUND_DEVICE; typedef struct _SOUND_DEVICE_INSTANCE { - HANDLE KernelDeviceHandle; + struct _SOUND_DEVICE* Device; + PVOID Handle; } SOUND_DEVICE_INSTANCE, *PSOUND_DEVICE_INSTANCE; @@ -220,12 +237,6 @@ OUT PVOID Capabilities, IN DWORD CapabilitiesSize); -MMRESULT -DefaultGetSoundDeviceCapabilities( - IN PSOUND_DEVICE SoundDevice, - OUT PVOID Capabilities, - IN DWORD CapabilitiesSize); - /* devicelist.c @@ -242,7 +253,7 @@ MMRESULT ListSoundDevice( IN MMDEVICE_TYPE DeviceType, - IN LPWSTR DevicePath OPTIONAL, + IN PVOID Identifier OPTIONAL, OUT PSOUND_DEVICE* SoundDevice OPTIONAL); MMRESULT @@ -264,9 +275,9 @@ OUT PSOUND_DEVICE* Device); MMRESULT -GetSoundDevicePath( - IN PSOUND_DEVICE SoundDevice, - OUT LPWSTR* DevicePath); +GetSoundDeviceIdentifier( + IN PSOUND_DEVICE SoundDevice, + OUT PVOID* Identifier); MMRESULT GetSoundDeviceType( @@ -281,7 +292,7 @@ MMRESULT SetSoundDeviceFunctionTable( IN PSOUND_DEVICE SoundDevice, - IN PMMFUNCTION_TABLE FunctionTable OPTIONAL); + IN PMMFUNCTION_TABLE FunctionTable); MMRESULT GetSoundDeviceFunctionTable( @@ -315,37 +326,10 @@ IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, OUT PSOUND_DEVICE* SoundDevice); - -/* - nt4.c -*/ - -typedef BOOLEAN (*SOUND_DEVICE_DETECTED_PROC)( - UCHAR DeviceType, - PWSTR DevicePath); - -MMRESULT -OpenSoundDriverParametersRegKey( - IN LPWSTR ServiceName, - OUT PHKEY KeyHandle); - -MMRESULT -OpenSoundDeviceRegKey( - IN LPWSTR ServiceName, - IN DWORD DeviceIndex, - OUT PHKEY KeyHandle); - -MMRESULT -EnumerateNt4ServiceSoundDevices( - IN LPWSTR ServiceName, - IN MMDEVICE_TYPE DeviceType, - IN SOUND_DEVICE_DETECTED_PROC SoundDeviceDetectedProc); - -MMRESULT -DetectNt4SoundDevices( - IN MMDEVICE_TYPE DeviceType, - IN PWSTR BaseDeviceName, - IN SOUND_DEVICE_DETECTED_PROC SoundDeviceDetectedProc); +MMRESULT +GetSoundDeviceInstanceHandle( + IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, + OUT PVOID* Handle); /* @@ -381,13 +365,15 @@ */ MMRESULT +MmeOpenWaveDevice( + IN MMDEVICE_TYPE DeviceType, + IN DWORD DeviceId, + IN LPWAVEOPENDESC OpenParameters, + IN DWORD Flags, + OUT DWORD* PrivateHandle); + +MMRESULT QueryWaveDeviceFormatSupport( - IN PSOUND_DEVICE SoundDevice, - IN LPWAVEFORMATEX Format, - IN DWORD FormatSize); - -MMRESULT -DefaultQueryWaveDeviceFormatSupport( IN PSOUND_DEVICE SoundDevice, IN LPWAVEFORMATEX Format, IN DWORD FormatSize); @@ -398,17 +384,12 @@ IN LPWAVEFORMATEX Format, IN DWORD FormatSize); -MMRESULT -DefaultSetWaveDeviceFormat( - IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, - IN LPWAVEFORMATEX Format, - IN DWORD FormatSize); - /* kernel.c */ +#if 0 #define QueryDevice(h, ctl, o, o_size, xfer, ovl) \ Win32ErrorToMmResult( \ DeviceIoControl(h, ctl, NULL, 0, o, o_size, xfer, ovl) != 0 \ @@ -426,6 +407,7 @@ #define ControlSoundDevice(sd, ctl, i, i_size, xfer) \ SoundDeviceIoControl(sd, ctl, i, i_size, NULL, 0, xfer) +#endif MMRESULT OpenKernelSoundDeviceByName( @@ -434,12 +416,18 @@ OUT PHANDLE Handle); MMRESULT +OpenKernelSoundDevice( + IN PSOUND_DEVICE SoundDevice, + IN BOOLEAN ReadOnly, + OUT PHANDLE Handle); + +MMRESULT CloseKernelSoundDevice( IN HANDLE Handle); MMRESULT -SoundDeviceIoControl( - IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, +SyncOverlappedDeviceIoControl( + IN HANDLE SoundDeviceInstance, IN DWORD IoControlCode, IN LPVOID InBuffer, IN DWORD InBufferSize, Added: branches/silverblade-audio/include/reactos/libs/sound/mment4.h URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/include/react…
============================================================================== --- branches/silverblade-audio/include/reactos/libs/sound/mment4.h (added) +++ branches/silverblade-audio/include/reactos/libs/sound/mment4.h [iso-8859-1] Fri Jan 2 18:36:19 2009 @@ -1,0 +1,88 @@ +/* + ReactOS Sound System + MME Support Helper (NT4 Specific Parts) + + Author: + Andrew Greenwood (silverblade(a)reactos.org) + + History: + 31 December 2008 - Created + + Notes: + This is intended for use in building NT4 compatible audio device + drivers. Include mmebuddy.h first. +*/ + +#ifndef ROS_AUDIO_MMENT4_H +#define ROS_AUDIO_MMENT4_H + +/* + detect.c +*/ + +typedef BOOLEAN (*SOUND_DEVICE_DETECTED_PROC)( + UCHAR DeviceType, + PWSTR DevicePath); + +MMRESULT +EnumerateNt4ServiceSoundDevices( + IN LPWSTR ServiceName, + IN MMDEVICE_TYPE DeviceType, + IN SOUND_DEVICE_DETECTED_PROC SoundDeviceDetectedProc); + +MMRESULT +DetectNt4SoundDevices( + IN MMDEVICE_TYPE DeviceType, + IN PWSTR BaseDeviceName, + IN SOUND_DEVICE_DETECTED_PROC SoundDeviceDetectedProc); + + +/* + registry.c +*/ + +MMRESULT +OpenSoundDriverParametersRegKey( + IN LPWSTR ServiceName, + OUT PHKEY KeyHandle); + +MMRESULT +OpenSoundDeviceRegKey( + IN LPWSTR ServiceName, + IN DWORD DeviceIndex, + OUT PHKEY KeyHandle); + + +/* + general.c - UNSORTED +*/ + +MMRESULT +GetNt4SoundDeviceCapabilities( + IN PSOUND_DEVICE SoundDevice, + OUT PVOID Capabilities, + IN DWORD CapabilitiesSize); + +MMRESULT +QueryNt4WaveDeviceFormatSupport( + IN PSOUND_DEVICE SoundDevice, + IN LPWAVEFORMATEX Format, + IN DWORD FormatSize); + +MMRESULT +SetNt4WaveDeviceFormat( + IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, + IN LPWAVEFORMATEX Format, + IN DWORD FormatSize); + +MMRESULT +OpenNt4SoundDevice( + IN PSOUND_DEVICE SoundDevice, + OUT PVOID* Handle); + +MMRESULT +CloseNt4SoundDevice( + IN PSOUND_DEVICE SoundDevice, + IN PVOID Handle); + +#endif Propchange: branches/silverblade-audio/include/reactos/libs/sound/mment4.h ------------------------------------------------------------------------------ svn:eol-style = native Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/capabilities.c URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/capabilities.c [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/capabilities.c [iso-8859-1] Fri Jan 2 18:36:19 2009 @@ -10,6 +10,7 @@ #include <windows.h> #include <mmsystem.h> +#include <mmddk.h> #include <ntddk.h> #include <ntddsnd.h> #include <mmebuddy.h> @@ -29,6 +30,10 @@ MMRESULT Result; SND_TRACE(L"MME *_GETCAPS for device %d of type %d\n", DeviceId, DeviceType); + + /* FIXME: Validate device type and ID */ + VALIDATE_MMSYS_PARAMETER( Capabilities ); + VALIDATE_MMSYS_PARAMETER( CapabilitiesSize > 0 ); /* Our parameter checks are done elsewhere */ Result = GetSoundDevice(DeviceType, DeviceId, &SoundDevice); @@ -126,82 +131,3 @@ Capabilities, CapabilitiesSize); } - -/* - Provides a default implementation for the "get capabilities" request, - using the standard IOCTLs used by NT4 sound drivers. -*/ -MMRESULT -DefaultGetSoundDeviceCapabilities( - IN PSOUND_DEVICE SoundDevice, - OUT PVOID Capabilities, - IN DWORD CapabilitiesSize) -{ - MMRESULT Result; - MMDEVICE_TYPE DeviceType; - PWSTR DevicePath; - DWORD IoCtl; - DWORD BytesTransferred; - HANDLE DeviceHandle; - - /* If these are bad there's an internal error with MME-Buddy! */ - SND_ASSERT( SoundDevice ); - SND_ASSERT( Capabilities ); - SND_ASSERT( CapabilitiesSize > 0 ); - - SND_TRACE(L"Default get-capabilities routine called\n"); - - /* Get the device type */ - Result = GetSoundDeviceType(SoundDevice, &DeviceType); - SND_ASSERT( Result == MMSYSERR_NOERROR ); - - if ( Result != MMSYSERR_NOERROR ); - return TranslateInternalMmResult(Result); - - /* Get the device path */ - Result = GetSoundDevicePath(SoundDevice, &DevicePath); - SND_ASSERT( Result == MMSYSERR_NOERROR ); - - if ( Result != MMSYSERR_NOERROR ); - return TranslateInternalMmResult(Result); - - /* Choose the appropriate IOCTL */ - if ( IS_WAVE_DEVICE_TYPE(DeviceType) ) - { - IoCtl = IOCTL_WAVE_GET_CAPABILITIES; - } - else if ( IS_MIDI_DEVICE_TYPE(DeviceType) ) - { - IoCtl = IOCTL_MIDI_GET_CAPABILITIES; - } - else - { - /* TODO */ - SND_ASSERT( FALSE ); - } - - /* Get the capabilities information from the driver */ - Result = OpenKernelSoundDeviceByName(DevicePath, TRUE, &DeviceHandle); - - if ( Result != MMSYSERR_NOERROR ) - { - SND_ERR(L"Failed to open %wS\n", DevicePath); - return TranslateInternalMmResult(Result); - } - - Result = QueryDevice(DeviceHandle, - IoCtl, - Capabilities, - CapabilitiesSize, - &BytesTransferred, - NULL); - - CloseKernelSoundDevice(DeviceHandle); - - if ( Result != MMSYSERR_NOERROR ) - { - SND_ERR(L"Retrieval of capabilities information failed\n"); - } - - return Result; -} Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/deviceinstance.c URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/deviceinstance.c [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/deviceinstance.c [iso-8859-1] Fri Jan 2 18:36:19 2009 @@ -10,6 +10,7 @@ #include <windows.h> #include <mmsystem.h> +#include <mmddk.h> #include <mmebuddy.h> MMRESULT @@ -68,7 +69,45 @@ IN PSOUND_DEVICE SoundDevice, OUT PSOUND_DEVICE_INSTANCE* SoundDeviceInstance) { - return MMSYSERR_NOTSUPPORTED; + MMRESULT Result; + PMMFUNCTION_TABLE FunctionTable; + + SND_TRACE(L"Creating a sound device instance\n"); + + VALIDATE_MMSYS_PARAMETER( IsValidSoundDevice(SoundDevice) ); + VALIDATE_MMSYS_PARAMETER( SoundDeviceInstance != NULL ); + + Result = AllocateSoundDeviceInstance(SoundDeviceInstance); + + if ( Result != MMSYSERR_NOERROR ) + return TranslateInternalMmResult(Result); + + /* Get the "open" routine from the function table, and validate it */ + Result = GetSoundDeviceFunctionTable(SoundDevice, &FunctionTable); + if ( Result != MMSYSERR_NOERROR ) + { + FreeSoundDeviceInstance(*SoundDeviceInstance); + return TranslateInternalMmResult(Result); + } + + if ( FunctionTable->Open == NULL ) + { + FreeSoundDeviceInstance(*SoundDeviceInstance); + return MMSYSERR_NOTSUPPORTED; + } + + /* Set up the members of the structure */ + (*SoundDeviceInstance)->Device = SoundDevice; + + /* Try and open the device */ + Result = FunctionTable->Open(SoundDevice, (&(*SoundDeviceInstance)->Handle)); + if ( Result != MMSYSERR_NOERROR ) + { + FreeSoundDeviceInstance(*SoundDeviceInstance); + return TranslateInternalMmResult(Result); + } + + return MMSYSERR_NOERROR; } MMRESULT @@ -90,5 +129,23 @@ IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, OUT PSOUND_DEVICE* SoundDevice) { - return MMSYSERR_NOTSUPPORTED; + VALIDATE_MMSYS_PARAMETER( IsValidSoundDeviceInstance(SoundDeviceInstance) ); + VALIDATE_MMSYS_PARAMETER( SoundDevice ); + + *SoundDevice = SoundDeviceInstance->Device; + + return MMSYSERR_NOERROR; } + +MMRESULT +GetSoundDeviceInstanceHandle( + IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, + OUT PVOID* Handle) +{ + VALIDATE_MMSYS_PARAMETER( IsValidSoundDeviceInstance(SoundDeviceInstance) ); + VALIDATE_MMSYS_PARAMETER( Handle ); + + *Handle = SoundDeviceInstance->Handle; + + return MMSYSERR_NOERROR; +} Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/devicelist.c URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/devicelist.c [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/devicelist.c [iso-8859-1] Fri Jan 2 18:36:19 2009 @@ -9,6 +9,8 @@ */ #include <windows.h> +#include <mmsystem.h> +#include <mmddk.h> #include <ntddsnd.h> #include <mmebuddy.h> @@ -22,7 +24,6 @@ MMRESULT AllocateSoundDevice( IN MMDEVICE_TYPE DeviceType, - IN PWSTR DevicePath OPTIONAL, OUT PSOUND_DEVICE* SoundDevice) { PSOUND_DEVICE NewDevice; @@ -30,7 +31,7 @@ SND_ASSERT( IsValidSoundDeviceType(DeviceType) ); SND_ASSERT( SoundDevice ); - SND_TRACE(L"Allocating SOUND_DEVICE for %wS\n", DevicePath); + SND_TRACE(L"Allocating a SOUND_DEVICE structure\n"); NewDevice = AllocateStruct(SOUND_DEVICE); @@ -38,21 +39,6 @@ return MMSYSERR_NOMEM; NewDevice->Type = DeviceType; - - /* Only copy the device path if one was actually passed in */ - if ( DevicePath ) - { - NewDevice->Path = AllocateWideString(wcslen(DevicePath)); - - if ( ! NewDevice->Path ) - { - FreeMemory(NewDevice); - NewDevice = NULL; - return MMSYSERR_NOMEM; - } - - CopyWideString(NewDevice->Path, DevicePath); - } /* Return the new structure to the caller and report success */ *SoundDevice = NewDevice; @@ -69,12 +55,7 @@ { SND_ASSERT( SoundDevice ); - SND_TRACE(L"Freeing SOUND_DEVICE for %wS\n", SoundDevice->Path); - - if ( SoundDevice->Path ) - { - FreeMemory(SoundDevice->Path); - } + SND_TRACE(L"Freeing a SOUND_DEVICE structure"); /* For safety the whole struct gets zeroed */ ZeroMemory(SoundDevice, sizeof(SOUND_DEVICE)); @@ -153,7 +134,7 @@ MMRESULT ListSoundDevice( IN MMDEVICE_TYPE DeviceType, - IN LPWSTR DevicePath OPTIONAL, + IN PVOID Identifier OPTIONAL, OUT PSOUND_DEVICE* SoundDevice OPTIONAL) { MMRESULT Result; @@ -162,7 +143,7 @@ VALIDATE_MMSYS_PARAMETER( IsValidSoundDeviceType(DeviceType) ); - Result = AllocateSoundDevice(DeviceType, DevicePath, &NewDevice); + Result = AllocateSoundDevice(DeviceType, &NewDevice); if ( Result != MMSYSERR_NOERROR ) { @@ -188,6 +169,9 @@ /* Set up the default function table */ SetSoundDeviceFunctionTable(NewDevice, NULL); + + /* Set up other members of the structure */ + NewDevice->Identifier = Identifier; /* Fill in the caller's PSOUND_DEVICE */ if ( SoundDevice ) @@ -343,15 +327,15 @@ driver. */ MMRESULT -GetSoundDevicePath( +GetSoundDeviceIdentifier( IN PSOUND_DEVICE SoundDevice, - OUT LPWSTR* DevicePath) + OUT PVOID* Identifier) { VALIDATE_MMSYS_PARAMETER( SoundDevice ); - VALIDATE_MMSYS_PARAMETER( DevicePath ); + VALIDATE_MMSYS_PARAMETER( Identifier ); /* The caller should not modify this! */ - *DevicePath = SoundDevice->Path; + *Identifier = SoundDevice->Identifier; return MMSYSERR_NOERROR; } Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/functiontable.c URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/functiontable.c [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/functiontable.c [iso-8859-1] Fri Jan 2 18:36:19 2009 @@ -11,6 +11,8 @@ */ #include <windows.h> +#include <mmsystem.h> +#include <mmddk.h> #include <mmebuddy.h> /* @@ -22,40 +24,18 @@ MMRESULT SetSoundDeviceFunctionTable( IN PSOUND_DEVICE SoundDevice, - IN PMMFUNCTION_TABLE FunctionTable OPTIONAL) + IN PMMFUNCTION_TABLE FunctionTable) { VALIDATE_MMSYS_PARAMETER( IsValidSoundDevice(SoundDevice) ); - /*VALIDATE_MMSYS_PARAMETER( FunctionTable );*/ + VALIDATE_MMSYS_PARAMETER( FunctionTable ); /* Zero out the existing function table (if present) */ ZeroMemory(&SoundDevice->FunctionTable, sizeof(MMFUNCTION_TABLE)); - /* Fill in the client-supplied functions, if provided */ - if ( FunctionTable ) - { - CopyMemory(&SoundDevice->FunctionTable, - FunctionTable, - sizeof(MMFUNCTION_TABLE)); - } - - /* Plug any gaps in the function table */ - if ( ! SoundDevice->FunctionTable.GetCapabilities ) - { - SoundDevice->FunctionTable.GetCapabilities = - DefaultGetSoundDeviceCapabilities; - } - - if ( ! SoundDevice->FunctionTable.QueryWaveFormatSupport ) - { - SoundDevice->FunctionTable.QueryWaveFormatSupport = - DefaultQueryWaveDeviceFormatSupport; - } - - if ( ! SoundDevice->FunctionTable.SetWaveFormat ) - { - SoundDevice->FunctionTable.SetWaveFormat = - DefaultSetWaveDeviceFormat; - } + /* Fill in the client-supplied functions */ + CopyMemory(&SoundDevice->FunctionTable, + FunctionTable, + sizeof(MMFUNCTION_TABLE)); return MMSYSERR_NOERROR; } Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/kernel.c URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/kernel.c [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/kernel.c [iso-8859-1] Fri Jan 2 18:36:19 2009 @@ -11,6 +11,7 @@ #include <windows.h> #include <mmsystem.h> +#include <mmddk.h> #include <ntddsnd.h> #include <mmebuddy.h> @@ -33,8 +34,9 @@ VALIDATE_MMSYS_PARAMETER( DevicePath ); VALIDATE_MMSYS_PARAMETER( Handle ); - AccessRights = ReadOnly ? GENERIC_READ : GENERIC_WRITE; + AccessRights = ReadOnly ? GENERIC_READ : GENERIC_READ | GENERIC_WRITE; + SND_TRACE(L"OpenKernelSoundDeviceByName: %wS\n", DevicePath); *Handle = CreateFile(DevicePath, AccessRights, FILE_SHARE_WRITE, /* FIXME? Should be read also? */ @@ -45,11 +47,13 @@ if ( *Handle == INVALID_HANDLE_VALUE ) { + SND_ERR(L"CreateFile filed - winerror %d\n", GetLastError()); return Win32ErrorToMmResult(GetLastError()); } return MMSYSERR_NOERROR; } + /* Just a wrapped around CloseHandle. @@ -67,13 +71,12 @@ /* This is a wrapper around DeviceIoControl which provides control over - instantiated sound devices. It takes a sound device instance rather than - a handle, and waits for I/O to complete (since an instantiated sound - device is opened in overlapped mode, this is necessary). + instantiated sound devices. It waits for I/O to complete (since an + instantiated sound device is opened in overlapped mode, this is necessary). */ MMRESULT -SoundDeviceIoControl( - IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, +SyncOverlappedDeviceIoControl( + IN HANDLE Handle, IN DWORD IoControlCode, IN LPVOID InBuffer, IN DWORD InBufferSize, @@ -85,8 +88,6 @@ BOOLEAN IoResult; DWORD Transferred; - VALIDATE_MMSYS_PARAMETER( IsValidSoundDeviceInstance(SoundDeviceInstance) ); - /* Overlapped I/O is done here - this is used for waiting for completion */ ZeroMemory(&Overlapped, sizeof(OVERLAPPED)); Overlapped.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); @@ -95,7 +96,7 @@ return Win32ErrorToMmResult(GetLastError()); /* Talk to the device */ - IoResult = DeviceIoControl(SoundDeviceInstance->KernelDeviceHandle, + IoResult = DeviceIoControl(Handle, IoControlCode, InBuffer, InBufferSize, @@ -115,7 +116,7 @@ } /* Wait for the I/O to complete */ - IoResult = GetOverlappedResult(SoundDeviceInstance->KernelDeviceHandle, + IoResult = GetOverlappedResult(Handle, &Overlapped, &Transferred, TRUE); Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/mmebuddy.rbuild URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/mmebuddy.rbuild [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/mmebuddy.rbuild [iso-8859-1] Fri Jan 2 18:36:19 2009 @@ -9,11 +9,11 @@ <file>functiontable.c</file> <file>reentrancy.c</file> <file>utility.c</file> - <file>nt4.c</file> <file>kernel.c</file> <directory name="wave"> <file>widMessage.c</file> <file>wodMessage.c</file> + <file>format.c</file> </directory> <directory name="midi"> <file>midMessage.c</file> @@ -25,4 +25,4 @@ <directory name="auxiliary"> <file>auxMessage.c</file> </directory> -</module> +</module> Removed: branches/silverblade-audio/lib/drivers/sound/mmebuddy/nt4.c URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/nt4.c [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/nt4.c (removed) @@ -1,317 +1,0 @@ -/* - * PROJECT: ReactOS Sound System "MME Buddy" Library - * LICENSE: GPL - See COPYING in the top level directory - * FILE: lib/sound/mmebuddy/nt4.c - * - * PURPOSE: Assists in locating Windows NT4 compatible sound devices, - * which mostly use the same device naming convention and/or - * store their created device names within their service key - * within the registry. - * - * PROGRAMMERS: Andrew Greenwood (silverblade(a)reactos.org) -*/ - -#include <windows.h> -#include <mmsystem.h> -#include <ntddsnd.h> - -#include <mmebuddy.h> - -/* - Open the parameters key of a sound driver. - NT4 only. -*/ -MMRESULT -OpenSoundDriverParametersRegKey( - IN LPWSTR ServiceName, - OUT PHKEY KeyHandle) -{ - ULONG KeyLength; - PWCHAR ParametersKeyName; - - VALIDATE_MMSYS_PARAMETER( ServiceName ); - VALIDATE_MMSYS_PARAMETER( KeyHandle ); - - /* Work out how long the string will be */ - KeyLength = wcslen(REG_SERVICES_KEY_NAME_U) + 1 - + wcslen(ServiceName) + 1 - + wcslen(REG_PARAMETERS_KEY_NAME_U); - - /* Allocate memory for the string */ - ParametersKeyName = AllocateWideString(KeyLength); - - if ( ! ParametersKeyName ) - return MMSYSERR_NOMEM; - - /* Construct the registry path */ - wsprintf(ParametersKeyName, - L"%s\\%s\\%s", - REG_SERVICES_KEY_NAME_U, - ServiceName, - REG_PARAMETERS_KEY_NAME_U); - - SND_TRACE(L"Opening reg key: %wS\n", ParametersKeyName); - - /* Perform the open */ - if ( RegOpenKeyEx(HKEY_LOCAL_MACHINE, - ParametersKeyName, - 0, - KEY_READ, - KeyHandle) != ERROR_SUCCESS ) - { - /* Couldn't open the key */ - SND_ERR(L"Failed to open reg key: %wS\n", ParametersKeyName); - FreeMemory(ParametersKeyName); - return MMSYSERR_ERROR; - } - - FreeMemory(ParametersKeyName); - - return MMSYSERR_NOERROR; -} - -/* - Open one of the Device sub-keys belonging to the sound driver. - NT4 only. -*/ -MMRESULT -OpenSoundDeviceRegKey( - IN LPWSTR ServiceName, - IN DWORD DeviceIndex, - OUT PHKEY KeyHandle) -{ - DWORD PathLength; - PWCHAR RegPath; - - VALIDATE_MMSYS_PARAMETER( ServiceName ); - VALIDATE_MMSYS_PARAMETER( KeyHandle ); - - /* - Work out the space required to hold the path: - - HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ - sndblst\ - Parameters\ - Device123\ - */ - PathLength = wcslen(REG_SERVICES_KEY_NAME_U) + 1 - + wcslen(ServiceName) + 1 - + wcslen(REG_PARAMETERS_KEY_NAME_U) + 1 - + wcslen(REG_DEVICE_KEY_NAME_U) - + GetDigitCount(DeviceIndex); - - /* Allocate storage for the string */ - RegPath = AllocateWideString(PathLength); - - if ( ! RegPath ) - { - return MMSYSERR_NOMEM; - } - - /* Write the path */ - wsprintf(RegPath, - L"%ls\\%ls\\%ls\\%ls%d", - REG_SERVICES_KEY_NAME_U, - ServiceName, - REG_PARAMETERS_KEY_NAME_U, - REG_DEVICE_KEY_NAME_U, - DeviceIndex); - - SND_TRACE(L"Opening reg key: %wS\n", RegPath); - - /* Perform the open */ - if ( RegOpenKeyEx(HKEY_LOCAL_MACHINE, - RegPath, - 0, - KEY_READ, - KeyHandle) != ERROR_SUCCESS ) - { - /* Couldn't open the key */ - SND_ERR(L"Failed to open reg key: %wS\n", RegPath); - FreeMemory(RegPath); - return MMSYSERR_ERROR; - } - - FreeMemory(RegPath); - - return MMSYSERR_NOERROR; -} - -/* - This is the "nice" way to discover audio devices in NT4 - go into the - service registry key and enumerate the Parameters\Device*\Devices - values. The value names represent the device name, whereas the data - assigned to them identifies the type of device. -*/ -MMRESULT -EnumerateNt4ServiceSoundDevices( - IN LPWSTR ServiceName, - IN MMDEVICE_TYPE DeviceType, - IN SOUND_DEVICE_DETECTED_PROC SoundDeviceDetectedProc) -{ - HKEY Key; - DWORD KeyIndex = 0; - - VALIDATE_MMSYS_PARAMETER( ServiceName ); - - /* Device type zero means "all" */ - VALIDATE_MMSYS_PARAMETER( IsValidSoundDeviceType(DeviceType) || - DeviceType == 0 ); - - while ( OpenSoundDeviceRegKey(ServiceName, KeyIndex, &Key) == MMSYSERR_NOERROR ) - { - HKEY DevicesKey; - DWORD ValueType = REG_NONE, ValueIndex = 0; - DWORD MaxNameLength = 0, ValueNameLength = 0; - PWSTR DevicePath = NULL, ValueName = NULL; - DWORD ValueDataLength = sizeof(DWORD); - DWORD ValueData; - - if ( RegOpenKeyEx(Key, - REG_DEVICES_KEY_NAME_U, - 0, - KEY_READ, - &DevicesKey) == ERROR_SUCCESS ) - { - /* Find out how much memory is needed for the key name */ - if ( RegQueryInfoKey(DevicesKey, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, - &MaxNameLength, - NULL, NULL, NULL) != ERROR_SUCCESS ) - { - SND_ERR(L"Failed to query registry key information\n"); - RegCloseKey(DevicesKey); - RegCloseKey(Key); - - return MMSYSERR_ERROR; - } - - DevicePath = AllocateWideString(MaxNameLength + - strlen("\\\\.\\")); - - /* Check that the memory allocation was successful */ - if ( ! DevicePath ) - { - /* There's no point in going further */ - RegCloseKey(DevicesKey); - RegCloseKey(Key); - - return MMSYSERR_NOMEM; - } - - /* Insert the device path prefix */ - wsprintf(DevicePath, L"\\\\.\\"); - - /* The offset of the string following this prefix */ - ValueName = DevicePath + strlen("\\\\.\\"); - - /* Copy this so that it may be overwritten - include NULL */ - ValueNameLength = MaxNameLength + sizeof(WCHAR); - - while ( RegEnumValue(DevicesKey, - ValueIndex, - ValueName, - &ValueNameLength, - NULL, - &ValueType, - (LPBYTE) &ValueData, - &ValueDataLength) == ERROR_SUCCESS ) - { - /* Device types are stored as DWORDs */ - if ( ( ValueType == REG_DWORD ) && - ( ValueDataLength == sizeof(DWORD) ) ) - { - if ( ( DeviceType == 0 ) || - ( DeviceType == ValueData ) ) - { - SND_TRACE(L"Found device: %wS\n", DevicePath); - SoundDeviceDetectedProc(ValueData, DevicePath); - } - } - - /* Reset variables for the next iteration */ - ValueNameLength = MaxNameLength + sizeof(WCHAR); - ZeroMemory(ValueName, (MaxNameLength+1)*sizeof(WCHAR)); - /*ZeroWideString(ValueName);*/ - ValueDataLength = sizeof(DWORD); - ValueData = 0; - ValueType = REG_NONE; - - ++ ValueIndex; - } - - FreeMemory(DevicePath); - - RegCloseKey(DevicesKey); - } - - ++ KeyIndex; - - RegCloseKey(Key); - } - - return MMSYSERR_NOERROR; -} - -/* - Brute-force device detection, using a base device name (eg: \\.\WaveOut). - - This will add the device number as a suffix to the end of the string and - attempt to open the device based on that name. On success, it will - increment the device number and repeat this process. - - When it runs out of devices, it will give up. -*/ -MMRESULT -DetectNt4SoundDevices( - IN MMDEVICE_TYPE DeviceType, - IN PWSTR BaseDeviceName, - IN SOUND_DEVICE_DETECTED_PROC SoundDeviceDetectedProc) -{ - ULONG DeviceNameLength = 0; - PWSTR DeviceName = NULL; - ULONG Index = 0; - HANDLE DeviceHandle; - BOOLEAN DoSearch = TRUE; - - VALIDATE_MMSYS_PARAMETER( IsValidSoundDeviceType(DeviceType) ); - - DeviceNameLength = wcslen(BaseDeviceName); - /* Consider the length of the number */ - DeviceNameLength += GetDigitCount(Index); - - DeviceName = AllocateWideString(DeviceNameLength); - - if ( ! DeviceName ) - { - return MMSYSERR_NOMEM; - } - - while ( DoSearch ) - { - /* Nothing like a nice clean device name */ - ZeroWideString(DeviceName); - wsprintf(DeviceName, L"%ls%d", BaseDeviceName, Index); - - if ( OpenKernelSoundDeviceByName(DeviceName, - TRUE, - &DeviceHandle) == MMSYSERR_NOERROR ) - { - /* Notify the callback function */ - SND_TRACE(L"Found device: %wS\n", DeviceName); - SoundDeviceDetectedProc(DeviceType, DeviceName); - - CloseHandle(DeviceHandle); - - ++ Index; - } - else - { - DoSearch = FALSE; - } - } - - FreeMemory(DeviceName); - - return MMSYSERR_NOERROR; -} Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/reentrancy.c URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/reentrancy.c [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/reentrancy.c [iso-8859-1] Fri Jan 2 18:36:19 2009 @@ -9,6 +9,8 @@ */ #include <windows.h> +#include <mmsystem.h> +#include <mmddk.h> #include <ntddk.h> #include <ntddsnd.h> #include <mmebuddy.h> Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/utility.c URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/utility.c [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/utility.c [iso-8859-1] Fri Jan 2 18:36:19 2009 @@ -10,6 +10,7 @@ #include <windows.h> #include <mmsystem.h> +#include <mmddk.h> #include <mmebuddy.h> Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/format.c URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/format.c [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/format.c [iso-8859-1] Fri Jan 2 18:36:19 2009 @@ -10,9 +10,76 @@ #include <windows.h> #include <mmsystem.h> +#include <mmddk.h> #include <ntddk.h> #include <ntddsnd.h> #include <mmebuddy.h> + +/* Adapted from MmeQueryWaveFormat... TODO: Move elsewhere */ +MMRESULT +MmeOpenWaveDevice( + IN MMDEVICE_TYPE DeviceType, + IN DWORD DeviceId, + IN LPWAVEOPENDESC OpenParameters, + IN DWORD Flags, + OUT DWORD* PrivateHandle) +{ + MMRESULT Result; + + PSOUND_DEVICE SoundDevice; + PSOUND_DEVICE_INSTANCE SoundDeviceInstance; + LPWAVEFORMATEX Format; + + SND_TRACE(L"Opening wave device (WIM_OPEN / WOM_OPEN)"); + + VALIDATE_MMSYS_PARAMETER( IS_WAVE_DEVICE_TYPE(DeviceType) ); /* FIXME? wave in too? */ + VALIDATE_MMSYS_PARAMETER( OpenParameters ); + + Format = OpenParameters->lpFormat; + + Result = GetSoundDevice(DeviceType, DeviceId, &SoundDevice); + if ( Result != MMSYSERR_NOERROR ) + return TranslateInternalMmResult(Result); + + /* Does this device support the format? */ + Result = QueryWaveDeviceFormatSupport(SoundDevice, Format, sizeof(WAVEFORMATEX)); + if ( Result != MMSYSERR_NOERROR ) + { + SND_ERR(L"Format not supported\n"); + return TranslateInternalMmResult(Result); + } + + /* If the caller just wanted to know if a format is supported, end here */ + if ( Flags & WAVE_FORMAT_QUERY ) + return MMSYSERR_NOERROR; + + /* Check that winmm gave us a private handle to fill */ + VALIDATE_MMSYS_PARAMETER( PrivateHandle ); + + /* Create a sound device instance and open the sound device */ + Result = CreateSoundDeviceInstance(SoundDevice, &SoundDeviceInstance); + if ( Result != MMSYSERR_NOERROR ) + return TranslateInternalMmResult(Result); + + Result = SetWaveDeviceFormat(SoundDeviceInstance, Format, sizeof(WAVEFORMATEX)); + if ( Result != MMSYSERR_NOERROR ) + { + /* TODO: Destroy sound instance */ + return TranslateInternalMmResult(Result); + } + + /* Store the device instance pointer in the private handle - is DWORD safe here? */ + *PrivateHandle = (DWORD) SoundDeviceInstance; + + /* TODO: Call the client application back to say the device is open */ + ReleaseEntrypointMutex(DeviceType); + /* ... */ + AcquireEntrypointMutex(DeviceType); + + SND_TRACE(L"Wave device now open\n"); + + return MMSYSERR_NOERROR; +} MMRESULT QueryWaveDeviceFormatSupport( @@ -22,7 +89,7 @@ { MMRESULT Result; MMDEVICE_TYPE DeviceType; - MMFUNCTION_TABLE FunctionTable; + PMMFUNCTION_TABLE FunctionTable; SND_TRACE(L"Querying wave format support\n"); @@ -33,7 +100,7 @@ Result = GetSoundDeviceType(SoundDevice, &DeviceType); SND_ASSERT( Result == MMSYSERR_NOERROR ); - /* Ensure we have a wave device (TODO: check if wavein as well) */ + /* Ensure we have a wave device (TODO: check if this applies to wavein as well) */ VALIDATE_MMSYS_PARAMETER( IS_WAVE_DEVICE_TYPE(DeviceType) ); /* Obtain the function table */ @@ -43,7 +110,8 @@ if ( Result != MMSYSERR_NOERROR ) return TranslateInternalMmResult(Result); - SND_ASSERT( FunctionTable->QueryWaveFormatSupport ); + if ( ! FunctionTable->QueryWaveFormatSupport ) + return MMSYSERR_NOTSUPPORTED; return FunctionTable->QueryWaveFormatSupport(SoundDevice, Format, FormatSize); } @@ -54,6 +122,36 @@ IN LPWAVEFORMATEX Format, IN DWORD FormatSize) { + MMRESULT Result; + MMDEVICE_TYPE DeviceType; + PMMFUNCTION_TABLE FunctionTable; + PSOUND_DEVICE SoundDevice; + SND_TRACE(L"Setting wave format\n"); - return MMSYSERR_NOTSUPPORTED; + + VALIDATE_MMSYS_PARAMETER( IsValidSoundDeviceInstance(SoundDeviceInstance) ); + VALIDATE_MMSYS_PARAMETER( Format ); + VALIDATE_MMSYS_PARAMETER( FormatSize >= sizeof(WAVEFORMATEX) ); + + Result = GetSoundDeviceFromInstance(SoundDeviceInstance, &SoundDevice); + if ( Result != MMSYSERR_NOERROR ) + return TranslateInternalMmResult(Result); + + Result = GetSoundDeviceType(SoundDevice, &DeviceType); + SND_ASSERT( Result == MMSYSERR_NOERROR ); + + /* Ensure we have a wave device (TODO: check if this applies to wavein as well) */ + VALIDATE_MMSYS_PARAMETER( IS_WAVE_DEVICE_TYPE(DeviceType) ); + + /* Obtain the function table */ + Result = GetSoundDeviceFunctionTable(SoundDevice, &FunctionTable); + SND_ASSERT( Result == MMSYSERR_NOERROR ); + + if ( Result != MMSYSERR_NOERROR ) + return TranslateInternalMmResult(Result); + + if ( ! FunctionTable->SetWaveFormat ) + return MMSYSERR_NOTSUPPORTED; + + return FunctionTable->SetWaveFormat(SoundDeviceInstance, Format, FormatSize); } Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/wodMessage.c URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/wodMessage.c [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/wodMessage.c [iso-8859-1] Fri Jan 2 18:36:19 2009 @@ -54,6 +54,45 @@ case WODM_OPEN : { + Result = MmeOpenWaveDevice(WAVE_OUT_DEVICE_TYPE, + DeviceId, + (LPWAVEOPENDESC) Parameter1, + Parameter2, + (DWORD*) PrivateHandle); +#if 0 + PSOUND_DEVICE SoundDevice; + PSOUND_DEVICE_INSTANCE SoundDeviceInstance; + LPWAVEOPENDESC OpenDescriptor = (LPWAVEOPENDESC) Parameter1; + + /* FIXME? Do we need the 2nd parameter to go to this routine? */ + Result = MmeQueryWaveDeviceFormatSupport(WAVE_OUT_DEVICE_TYPE, + DeviceId, + OpenDescriptor); + + if ( ( Parameter2 & WAVE_FORMAT_QUERY ) || + ( Result == MMSYSERR_NOTSUPPORTED) ) + { + /* Nothing more to be done */ + break; + } + + /* The MME API should provide us with a place to store a handle */ + if ( ! PrivateHandle ) + { + /* Not so much an invalid parameter as something messed up!! */ + SND_ERR(L"MME API supplied a NULL private handle pointer!\n"); + Result = MMSYSERR_ERROR; + break; + } + + /* Spawn an instance of the sound device */ + /*Result = MmeOpenWaveDevice(WAVE_OUT_DEVICE_TYPE, DeviceId, OpenDescriptor);*/ + /*GetSoundDevice(WAVE_OUT_DEVICE_TYPE, DeviceId, &SoundDevice); + Result = CreateSoundDeviceInstance(SoundDevice, &SoundDeviceInstance);*/ + + /* TODO... */ +#endif +#if 0 PSOUND_DEVICE SoundDevice; PSOUND_DEVICE_INSTANCE SoundDeviceInstance; LPWAVEOPENDESC OpenParameters = (LPWAVEOPENDESC) Parameter1; @@ -61,8 +100,11 @@ /* Obtain the sound device */ Result = GetSoundDevice(WAVE_OUT_DEVICE_TYPE, DeviceId, &SoundDevice); - if ( Result != MMSYSERR_NOERROR ); + if ( Result != MMSYSERR_NOERROR ) + { + Result = TranslateInternalMmResult(Result); break; + } /* See if the device supports this format */ Result = QueryWaveDeviceFormatSupport(SoundDevice, @@ -72,10 +114,11 @@ if ( Parameter2 & WAVE_FORMAT_QUERY ) { /* Nothing more to be done - keep the result */ + Result = TranslateInternalMmResult(Result); break; } - /* The MME API should provide us with a place to store a handle */ + SND_ASSERT( PrivateHandle ); if ( ! PrivateHandle ) { @@ -106,11 +149,17 @@ break; } +#endif break; } case WODM_CLOSE : { + /* + What should happen here? + - Validate the sound device instance + - Destroy it + */ break; } } Added: branches/silverblade-audio/lib/drivers/sound/mment4/control.c URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mment4/control.c (added) +++ branches/silverblade-audio/lib/drivers/sound/mment4/control.c [iso-8859-1] Fri Jan 2 18:36:19 2009 @@ -1,0 +1,231 @@ +/* + * PROJECT: ReactOS Sound System "MME Buddy" NT4 Library + * LICENSE: GPL - See COPYING in the top level directory + * FILE: lib/sound/mment4/control.c + * + * PURPOSE: Device control for NT4 audio devices + * + * PROGRAMMERS: Andrew Greenwood (silverblade(a)reactos.org) +*/ + +#include <windows.h> +#include <mmsystem.h> +#include <mmddk.h> +#include <ntddk.h> +#include <ntddsnd.h> +#include <mmebuddy.h> +#include <mment4.h> + +/* + Convenience routine for getting the path of a device and opening it. +*/ +MMRESULT +OpenNt4KernelSoundDevice( + IN PSOUND_DEVICE SoundDevice, + IN BOOLEAN ReadOnly, + OUT PHANDLE Handle) +{ + PWSTR Path; + MMRESULT Result; + + VALIDATE_MMSYS_PARAMETER( IsValidSoundDevice(SoundDevice) ); + VALIDATE_MMSYS_PARAMETER( Handle ); + + Result = GetSoundDeviceIdentifier(SoundDevice, (PVOID*) &Path); + if ( Result != MMSYSERR_NOERROR ) + { + SND_ERR(L"Unable to get sound device path"); + return TranslateInternalMmResult(Result); + } + + SND_ASSERT( Path ); + + return OpenKernelSoundDeviceByName(Path, ReadOnly, Handle); +} + +/* + Device open/close. These are basically wrappers for the MME-Buddy + open and close routines, which provide a Windows device handle. + These may seem simple but as you can return pretty much anything + as the handle, we could just as easily return a structure etc. +*/ +MMRESULT +OpenNt4SoundDevice( + IN PSOUND_DEVICE SoundDevice, + OUT PVOID* Handle) +{ + SND_TRACE(L"Opening NT4 style sound device\n"); + + VALIDATE_MMSYS_PARAMETER( IsValidSoundDevice(SoundDevice) ); + VALIDATE_MMSYS_PARAMETER( Handle ); + + return OpenNt4KernelSoundDevice(SoundDevice, FALSE, Handle); +} + +MMRESULT +CloseNt4SoundDevice( + IN PSOUND_DEVICE SoundDevice, + IN PVOID Handle) +{ + SND_TRACE(L"Closing NT4 style sound device\n"); + + VALIDATE_MMSYS_PARAMETER( IsValidSoundDevice(SoundDevice) ); + return CloseKernelSoundDevice((HANDLE) Handle); +} + +/* + Provides an implementation for the "get capabilities" request, + using the standard IOCTLs used by NT4 sound drivers. +*/ +MMRESULT +GetNt4SoundDeviceCapabilities( + IN PSOUND_DEVICE SoundDevice, + OUT PVOID Capabilities, + IN DWORD CapabilitiesSize) +{ + MMRESULT Result; + MMDEVICE_TYPE DeviceType; + DWORD IoCtl; + HANDLE DeviceHandle; + + /* If these are bad there's an internal error with MME-Buddy! */ + SND_ASSERT( SoundDevice ); + SND_ASSERT( Capabilities ); + SND_ASSERT( CapabilitiesSize > 0 ); + + SND_TRACE(L"NT4 get-capabilities routine called\n"); + + /* Get the device type */ + Result = GetSoundDeviceType(SoundDevice, &DeviceType); + SND_ASSERT( Result == MMSYSERR_NOERROR ); + + if ( Result != MMSYSERR_NOERROR ); + return TranslateInternalMmResult(Result); + + /* Choose the appropriate IOCTL */ + if ( IS_WAVE_DEVICE_TYPE(DeviceType) ) + { + IoCtl = IOCTL_WAVE_GET_CAPABILITIES; + } + else if ( IS_MIDI_DEVICE_TYPE(DeviceType) ) + { + IoCtl = IOCTL_MIDI_GET_CAPABILITIES; + } + else + { + /* FIXME - need to support AUX and mixer devices */ + SND_ASSERT( FALSE ); + } + + /* Get the capabilities information from the driver */ + Result = OpenNt4KernelSoundDevice(SoundDevice, TRUE, &DeviceHandle); + + if ( Result != MMSYSERR_NOERROR ) + { + SND_ERR(L"Failed to open device"); + return TranslateInternalMmResult(Result); + } + + Result = SyncOverlappedDeviceIoControl(DeviceHandle, + IoCtl, + Capabilities, + CapabilitiesSize, + NULL, + 0, + NULL); + + CloseKernelSoundDevice(DeviceHandle); + + if ( Result != MMSYSERR_NOERROR ) + { + SND_ERR(L"Retrieval of capabilities information failed\n"); + Result = TranslateInternalMmResult(Result); + } + + return Result; +} + +/* + Querying/setting the format of a wave device. Querying format support + requires us to first open the device, whereas setting format is done + on an already opened device. +*/ +MMRESULT +QueryNt4WaveDeviceFormatSupport( + IN PSOUND_DEVICE SoundDevice, + IN LPWAVEFORMATEX Format, + IN DWORD FormatSize) +{ + MMRESULT Result; + HANDLE Handle; + + SND_TRACE(L"NT4 wave format support querying routine called\n"); + + VALIDATE_MMSYS_PARAMETER( IsValidSoundDevice(SoundDevice) ); + VALIDATE_MMSYS_PARAMETER( Format ); + VALIDATE_MMSYS_PARAMETER( FormatSize >= sizeof(WAVEFORMATEX) ); + + /* Get the device path */ + Result = OpenNt4KernelSoundDevice(SoundDevice, + FALSE, + &Handle); + + if ( Result != MMSYSERR_NOERROR ) + { + SND_ERR(L"Unable to open kernel sound device\n"); + return TranslateInternalMmResult(Result); + } + + Result = SyncOverlappedDeviceIoControl(Handle, + IOCTL_WAVE_QUERY_FORMAT, + (LPVOID) Format, + FormatSize, + NULL, + 0, + NULL); + + if ( Result != MMSYSERR_NOERROR ) + { + SND_ERR(L"Sync overlapped I/O failed - MMSYS_ERROR %d\n", Result); + Result = TranslateInternalMmResult(Result); + } + + CloseKernelSoundDevice(Handle); + + return MMSYSERR_NOERROR; +} + +MMRESULT +SetNt4WaveDeviceFormat( + IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, + IN LPWAVEFORMATEX Format, + IN DWORD FormatSize) +{ + MMRESULT Result; + HANDLE Handle; + + VALIDATE_MMSYS_PARAMETER( IsValidSoundDeviceInstance(SoundDeviceInstance) ); + VALIDATE_MMSYS_PARAMETER( Format ); + VALIDATE_MMSYS_PARAMETER( FormatSize >= sizeof(WAVEFORMATEX) ); + + Result = GetSoundDeviceInstanceHandle(SoundDeviceInstance, &Handle); + + if ( Result != MMSYSERR_NOERROR ) + return TranslateInternalMmResult(Result); + + SND_TRACE(L"Setting wave device format on handle %x\n", Handle); + + Result = SyncOverlappedDeviceIoControl(Handle, + IOCTL_WAVE_SET_FORMAT, + (LPVOID) Format, + FormatSize, + NULL, + 0, + NULL); + + if ( Result != MMSYSERR_NOERROR ) + return TranslateInternalMmResult(Result); + + return MMSYSERR_NOERROR; +} + Propchange: branches/silverblade-audio/lib/drivers/sound/mment4/control.c ------------------------------------------------------------------------------ svn:eol-style = native Added: branches/silverblade-audio/lib/drivers/sound/mment4/detect.c URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mment4/detect.c (added) +++ branches/silverblade-audio/lib/drivers/sound/mment4/detect.c [iso-8859-1] Fri Jan 2 18:36:19 2009 @@ -1,0 +1,205 @@ +/* + * PROJECT: ReactOS Sound System "MME Buddy" NT4 Library + * LICENSE: GPL - See COPYING in the top level directory + * FILE: lib/sound/mment4/detect.c + * + * PURPOSE: Assists in locating Windows NT4 compatible sound devices, + * which mostly use the same device naming convention and/or + * store their created device names within their service key + * within the registry. + * + * PROGRAMMERS: Andrew Greenwood (silverblade(a)reactos.org) +*/ + +#include <windows.h> +#include <mmsystem.h> +#include <mmddk.h> +#include <ntddsnd.h> + +#include <mmebuddy.h> +#include <mment4.h> + +/* + This is the "nice" way to discover audio devices in NT4 - go into the + service registry key and enumerate the Parameters\Device*\Devices + values. The value names represent the device name, whereas the data + assigned to them identifies the type of device. +*/ +MMRESULT +EnumerateNt4ServiceSoundDevices( + IN LPWSTR ServiceName, + IN MMDEVICE_TYPE DeviceType, + IN SOUND_DEVICE_DETECTED_PROC SoundDeviceDetectedProc) +{ + HKEY Key; + DWORD KeyIndex = 0; + + VALIDATE_MMSYS_PARAMETER( ServiceName ); + + /* Device type zero means "all" */ + VALIDATE_MMSYS_PARAMETER( IsValidSoundDeviceType(DeviceType) || + DeviceType == 0 ); + + while ( OpenSoundDeviceRegKey(ServiceName, KeyIndex, &Key) == MMSYSERR_NOERROR ) + { + HKEY DevicesKey; + DWORD ValueType = REG_NONE, ValueIndex = 0; + DWORD MaxNameLength = 0, ValueNameLength = 0; + PWSTR DevicePath = NULL, ValueName = NULL; + DWORD ValueDataLength = sizeof(DWORD); + DWORD ValueData; + + if ( RegOpenKeyEx(Key, + REG_DEVICES_KEY_NAME_U, + 0, + KEY_READ, + &DevicesKey) == ERROR_SUCCESS ) + { + /* Find out how much memory is needed for the key name */ + if ( RegQueryInfoKey(DevicesKey, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, + &MaxNameLength, + NULL, NULL, NULL) != ERROR_SUCCESS ) + { + SND_ERR(L"Failed to query registry key information\n"); + RegCloseKey(DevicesKey); + RegCloseKey(Key); + + return MMSYSERR_ERROR; + } + + DevicePath = AllocateWideString(MaxNameLength + + strlen("\\\\.\\")); + + /* Check that the memory allocation was successful */ + if ( ! DevicePath ) + { + /* There's no point in going further */ + RegCloseKey(DevicesKey); + RegCloseKey(Key); + + return MMSYSERR_NOMEM; + } + + /* Insert the device path prefix */ + wsprintf(DevicePath, L"\\\\.\\"); + + /* The offset of the string following this prefix */ + ValueName = DevicePath + strlen("\\\\.\\"); + + /* Copy this so that it may be overwritten - include NULL */ + ValueNameLength = MaxNameLength + sizeof(WCHAR); + + SND_TRACE(L"Interested in devices beginning with %wS\n", DevicePath); + + while ( RegEnumValue(DevicesKey, + ValueIndex, + ValueName, + &ValueNameLength, + NULL, + &ValueType, + (LPBYTE) &ValueData, + &ValueDataLength) == ERROR_SUCCESS ) + { + /* Device types are stored as DWORDs */ + if ( ( ValueType == REG_DWORD ) && + ( ValueDataLength == sizeof(DWORD) ) ) + { + if ( ( DeviceType == 0 ) || + ( DeviceType == ValueData ) ) + { + SND_TRACE(L"Found device: %wS\n", DevicePath); + SoundDeviceDetectedProc(ValueData, DevicePath); + } + } + + /* Reset variables for the next iteration */ + ValueNameLength = MaxNameLength + sizeof(WCHAR); + ZeroMemory(ValueName, (MaxNameLength+1)*sizeof(WCHAR)); + /*ZeroWideString(ValueName);*/ + ValueDataLength = sizeof(DWORD); + ValueData = 0; + ValueType = REG_NONE; + + ++ ValueIndex; + } + + FreeMemory(DevicePath); + + RegCloseKey(DevicesKey); + } + else + { + SND_WARN(L"Unable to open the Devices key!\n"); + } + + ++ KeyIndex; + + RegCloseKey(Key); + } + + return MMSYSERR_NOERROR; +} + +/* + Brute-force device detection, using a base device name (eg: \\.\WaveOut). + + This will add the device number as a suffix to the end of the string and + attempt to open the device based on that name. On success, it will + increment the device number and repeat this process. + + When it runs out of devices, it will give up. +*/ +MMRESULT +DetectNt4SoundDevices( + IN MMDEVICE_TYPE DeviceType, + IN PWSTR BaseDeviceName, + IN SOUND_DEVICE_DETECTED_PROC SoundDeviceDetectedProc) +{ + ULONG DeviceNameLength = 0; + PWSTR DeviceName = NULL; + ULONG Index = 0; + HANDLE DeviceHandle; + BOOLEAN DoSearch = TRUE; + + VALIDATE_MMSYS_PARAMETER( IsValidSoundDeviceType(DeviceType) ); + + DeviceNameLength = wcslen(BaseDeviceName); + /* Consider the length of the number */ + DeviceNameLength += GetDigitCount(Index); + + DeviceName = AllocateWideString(DeviceNameLength); + + if ( ! DeviceName ) + { + return MMSYSERR_NOMEM; + } + + while ( DoSearch ) + { + /* Nothing like a nice clean device name */ + ZeroWideString(DeviceName); + wsprintf(DeviceName, L"%ls%d", BaseDeviceName, Index); + + if ( OpenKernelSoundDeviceByName(DeviceName, + TRUE, + &DeviceHandle) == MMSYSERR_NOERROR ) + { + /* Notify the callback function */ + SND_TRACE(L"Found device: %wS\n", DeviceName); + SoundDeviceDetectedProc(DeviceType, DeviceName); + + CloseHandle(DeviceHandle); + + ++ Index; + } + else + { + DoSearch = FALSE; + } + } + + FreeMemory(DeviceName); + + return MMSYSERR_NOERROR; +} Propchange: branches/silverblade-audio/lib/drivers/sound/mment4/detect.c ------------------------------------------------------------------------------ svn:eol-style = native Added: branches/silverblade-audio/lib/drivers/sound/mment4/mment4.rbuild URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mment4/mment4.rbuild (added) +++ branches/silverblade-audio/lib/drivers/sound/mment4/mment4.rbuild [iso-8859-1] Fri Jan 2 18:36:19 2009 @@ -1,0 +1,9 @@ +<?xml version="1.0"?> +<!DOCTYPE module SYSTEM "../../../../tools/rbuild/project.dtd"> +<module name="mment4" type="staticlibrary" allowwarnings="false" unicode="yes"> + <include base="ReactOS">include/reactos/libs/sound</include> + <define name="DEBUG_NT4">1</define> + <file>detect.c</file> + <file>registry.c</file> + <file>control.c</file> +</module> Propchange: branches/silverblade-audio/lib/drivers/sound/mment4/mment4.rbuild ------------------------------------------------------------------------------ svn:eol-style = native Added: branches/silverblade-audio/lib/drivers/sound/mment4/registry.c URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
============================================================================== --- branches/silverblade-audio/lib/drivers/sound/mment4/registry.c (added) +++ branches/silverblade-audio/lib/drivers/sound/mment4/registry.c [iso-8859-1] Fri Jan 2 18:36:19 2009 @@ -1,0 +1,137 @@ +/* + * PROJECT: ReactOS Sound System "MME Buddy" NT4 Library + * LICENSE: GPL - See COPYING in the top level directory + * FILE: lib/sound/mment4/registry.c + * + * PURPOSE: Registry operation helper for audio device drivers. + * + * PROGRAMMERS: Andrew Greenwood (silverblade(a)reactos.org) +*/ + +#include <windows.h> +#include <mmsystem.h> +#include <mmddk.h> +#include <ntddsnd.h> + +#include <mmebuddy.h> +#include <mment4.h> + +/* + Open the parameters key of a sound driver. + NT4 only. +*/ +MMRESULT +OpenSoundDriverParametersRegKey( + IN LPWSTR ServiceName, + OUT PHKEY KeyHandle) +{ + ULONG KeyLength; + PWCHAR ParametersKeyName; + + VALIDATE_MMSYS_PARAMETER( ServiceName ); + VALIDATE_MMSYS_PARAMETER( KeyHandle ); + + /* Work out how long the string will be */ + KeyLength = wcslen(REG_SERVICES_KEY_NAME_U) + 1 + + wcslen(ServiceName) + 1 + + wcslen(REG_PARAMETERS_KEY_NAME_U); + + /* Allocate memory for the string */ + ParametersKeyName = AllocateWideString(KeyLength); + + if ( ! ParametersKeyName ) + return MMSYSERR_NOMEM; + + /* Construct the registry path */ + wsprintf(ParametersKeyName, + L"%s\\%s\\%s", + REG_SERVICES_KEY_NAME_U, + ServiceName, + REG_PARAMETERS_KEY_NAME_U); + + SND_TRACE(L"Opening reg key: %wS\n", ParametersKeyName); + + /* Perform the open */ + if ( RegOpenKeyEx(HKEY_LOCAL_MACHINE, + ParametersKeyName, + 0, + KEY_READ, + KeyHandle) != ERROR_SUCCESS ) + { + /* Couldn't open the key */ + SND_ERR(L"Failed to open reg key: %wS\n", ParametersKeyName); + FreeMemory(ParametersKeyName); + return MMSYSERR_ERROR; + } + + FreeMemory(ParametersKeyName); + + return MMSYSERR_NOERROR; +} + +/* + Open one of the Device sub-keys belonging to the sound driver. + NT4 only. +*/ +MMRESULT +OpenSoundDeviceRegKey( + IN LPWSTR ServiceName, + IN DWORD DeviceIndex, + OUT PHKEY KeyHandle) +{ + DWORD PathLength; + PWCHAR RegPath; + + VALIDATE_MMSYS_PARAMETER( ServiceName ); + VALIDATE_MMSYS_PARAMETER( KeyHandle ); + + /* + Work out the space required to hold the path: + + HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ + sndblst\ + Parameters\ + Device123\ + */ + PathLength = wcslen(REG_SERVICES_KEY_NAME_U) + 1 + + wcslen(ServiceName) + 1 + + wcslen(REG_PARAMETERS_KEY_NAME_U) + 1 + + wcslen(REG_DEVICE_KEY_NAME_U) + + GetDigitCount(DeviceIndex); + + /* Allocate storage for the string */ + RegPath = AllocateWideString(PathLength); + + if ( ! RegPath ) + { + return MMSYSERR_NOMEM; + } + + /* Write the path */ + wsprintf(RegPath, + L"%ls\\%ls\\%ls\\%ls%d", + REG_SERVICES_KEY_NAME_U, + ServiceName, + REG_PARAMETERS_KEY_NAME_U, + REG_DEVICE_KEY_NAME_U, + DeviceIndex); + + SND_TRACE(L"Opening reg key: %wS\n", RegPath); + + /* Perform the open */ + if ( RegOpenKeyEx(HKEY_LOCAL_MACHINE, + RegPath, + 0, + KEY_READ, + KeyHandle) != ERROR_SUCCESS ) + { + /* Couldn't open the key */ + SND_ERR(L"Failed to open reg key: %wS\n", RegPath); + FreeMemory(RegPath); + return MMSYSERR_ERROR; + } + + FreeMemory(RegPath); + + return MMSYSERR_NOERROR; +} Propchange: branches/silverblade-audio/lib/drivers/sound/mment4/registry.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: branches/silverblade-audio/lib/drivers/sound/sound.rbuild URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
============================================================================== --- branches/silverblade-audio/lib/drivers/sound/sound.rbuild [iso-8859-1] (original) +++ branches/silverblade-audio/lib/drivers/sound/sound.rbuild [iso-8859-1] Fri Jan 2 18:36:19 2009 @@ -16,4 +16,7 @@ <directory name="mmebuddy"> <xi:include href="mmebuddy/mmebuddy.rbuild" /> </directory> + <directory name="mment4"> + <xi:include href="mment4/mment4.rbuild" /> + </directory> </group>
15 years, 11 months
1
0
0
0
[sginsberg] 38508: - Add Wine's GetPrivateObjectSecurity and use it instead of our that uses the unimplemented RtlQuerySecurityObject routine
by sginsberg@svn.reactos.org
Author: sginsberg Date: Fri Jan 2 11:14:42 2009 New Revision: 38508 URL:
http://svn.reactos.org/svn/reactos?rev=38508&view=rev
Log: - Add Wine's GetPrivateObjectSecurity and use it instead of our that uses the unimplemented RtlQuerySecurityObject routine Modified: trunk/reactos/dll/win32/advapi32/sec/misc.c Modified: trunk/reactos/dll/win32/advapi32/sec/misc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/sec/mis…
============================================================================== --- trunk/reactos/dll/win32/advapi32/sec/misc.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/advapi32/sec/misc.c [iso-8859-1] Fri Jan 2 11:14:42 2009 @@ -2250,19 +2250,25 @@ } +#if 0 +// +// Use when RtlQuerySecurityObject is implemented +// + /* * @implemented */ BOOL WINAPI -GetPrivateObjectSecurity(PSECURITY_DESCRIPTOR ObjectDescriptor, - SECURITY_INFORMATION SecurityInformation, - PSECURITY_DESCRIPTOR ResultantDescriptor, - DWORD DescriptorLength, - PDWORD ReturnLength) +GetPrivateObjectSecurity(IN PSECURITY_DESCRIPTOR ObjectDescriptor, + IN SECURITY_INFORMATION SecurityInformation, + OUT PSECURITY_DESCRIPTOR ResultantDescriptor OPTIONAL, + IN DWORD DescriptorLength, + OUT PDWORD ReturnLength) { NTSTATUS Status; + /* Call RTL */ Status = RtlQuerySecurityObject(ObjectDescriptor, SecurityInformation, ResultantDescriptor, @@ -2270,12 +2276,73 @@ ReturnLength); if (!NT_SUCCESS(Status)) { + /* Fail */ SetLastError(RtlNtStatusToDosError(Status)); return FALSE; } + /* Success */ return TRUE; } +#else +// +// Wine's implementation (as of December 30th 2008) +// + +/* + * @implemented + */ +BOOL +WINAPI +GetPrivateObjectSecurity(IN PSECURITY_DESCRIPTOR ObjectDescriptor, + IN SECURITY_INFORMATION SecurityInformation, + OUT PSECURITY_DESCRIPTOR ResultantDescriptor OPTIONAL, + IN DWORD DescriptorLength, + OUT PDWORD ReturnLength) +{ + SECURITY_DESCRIPTOR desc; + BOOL defaulted, present; + PACL pacl; + PSID psid; + + TRACE("(%p,0x%08x,%p,0x%08x,%p)\n", ObjectDescriptor, SecurityInformation, + ResultantDescriptor, DescriptorLength, ReturnLength); + + if (!InitializeSecurityDescriptor(&desc, SECURITY_DESCRIPTOR_REVISION)) + return FALSE; + + if (SecurityInformation & OWNER_SECURITY_INFORMATION) + { + if (!GetSecurityDescriptorOwner(ObjectDescriptor, &psid, &defaulted)) + return FALSE; + SetSecurityDescriptorOwner(&desc, psid, defaulted); + } + + if (SecurityInformation & GROUP_SECURITY_INFORMATION) + { + if (!GetSecurityDescriptorGroup(ObjectDescriptor, &psid, &defaulted)) + return FALSE; + SetSecurityDescriptorGroup(&desc, psid, defaulted); + } + + if (SecurityInformation & DACL_SECURITY_INFORMATION) + { + if (!GetSecurityDescriptorDacl(ObjectDescriptor, &present, &pacl, &defaulted)) + return FALSE; + SetSecurityDescriptorDacl(&desc, present, pacl, defaulted); + } + + if (SecurityInformation & SACL_SECURITY_INFORMATION) + { + if (!GetSecurityDescriptorSacl(ObjectDescriptor, &present, &pacl, &defaulted)) + return FALSE; + SetSecurityDescriptorSacl(&desc, present, pacl, defaulted); + } + + *ReturnLength = DescriptorLength; + return MakeSelfRelativeSD(&desc, ResultantDescriptor, ReturnLength); +} +#endif /*
15 years, 11 months
2
1
0
0
[jimtabor] 38513: - Implement RtlQuerySecurityObject.
by jimtabor@svn.reactos.org
Author: jimtabor Date: Fri Jan 2 17:52:37 2009 New Revision: 38513 URL:
http://svn.reactos.org/svn/reactos?rev=38513&view=rev
Log: - Implement RtlQuerySecurityObject. Modified: trunk/reactos/lib/rtl/security.c Modified: trunk/reactos/lib/rtl/security.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/security.c?rev=385…
============================================================================== --- trunk/reactos/lib/rtl/security.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/security.c [iso-8859-1] Fri Jan 2 17:52:37 2009 @@ -228,8 +228,49 @@ IN ULONG DescriptorLength, OUT PULONG ReturnLength) { - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; + NTSTATUS Status; + SECURITY_DESCRIPTOR desc; + BOOLEAN defaulted, present; + PACL pacl; + PSID psid; + + Status = RtlCreateSecurityDescriptor(&desc, SECURITY_DESCRIPTOR_REVISION); + if (!NT_SUCCESS(Status)) return Status; + + if (SecurityInformation & OWNER_SECURITY_INFORMATION) + { + Status = RtlGetOwnerSecurityDescriptor(ObjectDescriptor, &psid, &defaulted); + if (!NT_SUCCESS(Status)) return Status; + Status = RtlSetOwnerSecurityDescriptor(&desc, psid, defaulted); + if (!NT_SUCCESS(Status)) return Status; + } + + if (SecurityInformation & GROUP_SECURITY_INFORMATION) + { + Status = RtlGetGroupSecurityDescriptor(ObjectDescriptor, &psid, &defaulted); + if (!NT_SUCCESS(Status)) return Status; + Status = RtlSetGroupSecurityDescriptor(&desc, psid, defaulted); + if (!NT_SUCCESS(Status)) return Status; + } + + if (SecurityInformation & DACL_SECURITY_INFORMATION) + { + Status = RtlGetDaclSecurityDescriptor(ObjectDescriptor, &present, &pacl, &defaulted); + if (!NT_SUCCESS(Status)) return Status; + Status = RtlSetDaclSecurityDescriptor(&desc, present, pacl, defaulted); + if (!NT_SUCCESS(Status)) return Status; + } + + if (SecurityInformation & SACL_SECURITY_INFORMATION) + { + Status = RtlGetSaclSecurityDescriptor(ObjectDescriptor, &present, &pacl, &defaulted); + if (!NT_SUCCESS(Status)) return Status; + Status = RtlSetSaclSecurityDescriptor(&desc, present, pacl, defaulted); + if (!NT_SUCCESS(Status)) return Status; + } + + *ReturnLength = DescriptorLength; + return RtlAbsoluteToSelfRelativeSD(&desc, ResultantDescriptor, ReturnLength); }
15 years, 11 months
1
0
0
0
[hpoussin] 38512: Fix serial devices detection Thanks at Maciej Bialas (bjauy at o2.pl) for testing
by hpoussin@svn.reactos.org
Author: hpoussin Date: Fri Jan 2 16:12:48 2009 New Revision: 38512 URL:
http://svn.reactos.org/svn/reactos?rev=38512&view=rev
Log: Fix serial devices detection Thanks at Maciej Bialas (bjauy at o2.pl) for testing Modified: trunk/reactos/drivers/input/sermouse/detect.c trunk/reactos/drivers/serial/serenum/detect.c trunk/reactos/drivers/serial/serial/rw.c Modified: trunk/reactos/drivers/input/sermouse/detect.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/input/sermouse/det…
============================================================================== --- trunk/reactos/drivers/input/sermouse/detect.c [iso-8859-1] (original) +++ trunk/reactos/drivers/input/sermouse/detect.c [iso-8859-1] Fri Jan 2 16:12:48 2009 @@ -132,7 +132,7 @@ /* Open port */ Status = ObOpenObjectByPointer( LowerDevice, - OBJ_EXCLUSIVE | OBJ_KERNEL_HANDLE, + OBJ_KERNEL_HANDLE, NULL, 0, NULL, Modified: trunk/reactos/drivers/serial/serenum/detect.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/serial/serenum/det…
============================================================================== --- trunk/reactos/drivers/serial/serenum/detect.c [iso-8859-1] (original) +++ trunk/reactos/drivers/serial/serenum/detect.c [iso-8859-1] Fri Jan 2 16:12:48 2009 @@ -467,7 +467,7 @@ /* Open port */ Status = ObOpenObjectByPointer( LowerDevice, - OBJ_EXCLUSIVE | OBJ_KERNEL_HANDLE, + OBJ_KERNEL_HANDLE, NULL, 0, NULL, Modified: trunk/reactos/drivers/serial/serial/rw.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/serial/serial/rw.c…
============================================================================== --- trunk/reactos/drivers/serial/serial/rw.c [iso-8859-1] (original) +++ trunk/reactos/drivers/serial/serial/rw.c [iso-8859-1] Fri Jan 2 16:12:48 2009 @@ -225,8 +225,8 @@ if (WorkItem) { WorkItemData->IoWorkItem = WorkItem; + IoMarkIrpPending(Irp); IoQueueWorkItem(WorkItem, SerialReadWorkItem, DelayedWorkQueue, WorkItemData); - IoMarkIrpPending(Irp); return STATUS_PENDING; }
15 years, 11 months
1
0
0
0
[tkreuzer] 38511: Use the bitmap's palette, not the DC one's in NtGdiGetDIBitsInternal. Fixes Firefox colors going nots after 60 sec. See issue #3854 for more details.
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Fri Jan 2 16:08:09 2009 New Revision: 38511 URL:
http://svn.reactos.org/svn/reactos?rev=38511&view=rev
Log: Use the bitmap's palette, not the DC one's in NtGdiGetDIBitsInternal. Fixes Firefox colors going nots after 60 sec. See issue #3854 for more details. Modified: trunk/reactos/subsystems/win32/win32k/objects/dibobj.c Modified: trunk/reactos/subsystems/win32/win32k/objects/dibobj.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/dibobj.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/dibobj.c [iso-8859-1] Fri Jan 2 16:08:09 2009 @@ -622,7 +622,6 @@ return 0; } - /* Get handle for the palette in DC. */ Dc = DC_LockDc(hDC); if (Dc == NULL) return 0; if (Dc->DC_Type == DC_TYPE_INFO) @@ -630,14 +629,18 @@ DC_UnlockDc(Dc); return 0; } - /* Source palette obtained from the windows hdc */ - hSourcePalette = Dc->DcLevel.hpal; DC_UnlockDc(Dc); /* Get a pointer to the source bitmap object */ BitmapObj = BITMAPOBJ_LockBitmap(hBitmap); if (BitmapObj == NULL) return 0; + + hSourcePalette = BitmapObj->hDIBPalette; + if (!hSourcePalette) + { + hSourcePalette = pPrimarySurface->DevInfo.hpalDefault; + } ColorPtr = ((PBYTE)Info + Info->bmiHeader.biSize); rgbQuads = (RGBQUAD *)ColorPtr;
15 years, 11 months
1
0
0
0
← Newer
1
...
71
72
73
74
75
76
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
Results per page:
10
25
50
100
200