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
August 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
21 participants
654 discussions
Start a n
N
ew thread
[gschneider] 42766: Sync scanf to current wine sources, correct msvcrt cpp sync date
by gschneider@svn.reactos.org
Author: gschneider Date: Tue Aug 18 16:23:51 2009 New Revision: 42766 URL:
http://svn.reactos.org/svn/reactos?rev=42766&view=rev
Log: Sync scanf to current wine sources, correct msvcrt cpp sync date Modified: trunk/reactos/lib/sdk/crt/string/scanf.c trunk/reactos/lib/sdk/crt/string/scanf.h trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/lib/sdk/crt/string/scanf.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/string/scanf.c…
============================================================================== --- trunk/reactos/lib/sdk/crt/string/scanf.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/string/scanf.c [iso-8859-1] Tue Aug 18 16:23:51 2009 @@ -48,10 +48,10 @@ * given base, or -1 if the given character is not a digit of the base. */ static int wchar2digit(wchar_t c, int base) { - if ((c>=L'0') && (c<=L'9') && (c<=L'0'+base-1)) return (c-L'0'); + if ((c>='0') && (c<='9') && (c<='0'+base-1)) return (c-'0'); if (base<=10) return -1; - if ((c>=L'A') && (c<=L'Z') && (c<=L'A'+base-11)) return (c-L'A'+10); - if ((c>=L'a') && (c<=L'z') && (c<=L'a'+base-11)) return (c-L'a'+10); + if ((c>='A') && (c<='Z') && (c<='A'+base-11)) return (c-'A'+10); + if ((c>='a') && (c<='z') && (c<='a'+base-11)) return (c-'a'+10); return -1; } @@ -166,7 +166,7 @@ /********************************************************************* * swscanf (MSVCRT.@) */ -int swscanf(const wchar_t *str, const wchar_t *format, ...) +int CDECL swscanf(const wchar_t *str, const wchar_t *format, ...) { va_list valist; int res; @@ -181,7 +181,7 @@ /********************************************************************* * _cscanf (MSVCRT.@) */ -int _cscanf(const char *format, ...) +int CDECL _cscanf(const char *format, ...) { va_list valist; int res; Modified: trunk/reactos/lib/sdk/crt/string/scanf.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/string/scanf.h…
============================================================================== --- trunk/reactos/lib/sdk/crt/string/scanf.h [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/string/scanf.h [iso-8859-1] Tue Aug 18 16:23:51 2009 @@ -79,7 +79,7 @@ if (!*format) return 0; #ifndef WIDE_SCANF #ifdef CONSOLE - TRACE("(%s): \n", debugstr_a(format)); + TRACE("(%s):\n", debugstr_a(format)); #else /* CONSOLE */ #ifdef STRING TRACE("%s (%s)\n", file, debugstr_a(format)); @@ -151,6 +151,8 @@ switch(*format) { case 'p': case 'P': /* pointer. */ + if (sizeof(void *) == sizeof(LONGLONG)) I64_prefix = 1; + /* fall through */ case 'x': case 'X': /* hexadecimal integer. */ base = 16; @@ -224,7 +226,7 @@ if (!suppress) { #define _SET_NUMBER_(type) *va_arg(ap, type*) = negative ? -cur : cur if (I64_prefix) _SET_NUMBER_(LONGLONG); - else if (l_prefix) _SET_NUMBER_(long int); + else if (l_prefix) _SET_NUMBER_(LONG); else if (h_prefix) _SET_NUMBER_(short int); else _SET_NUMBER_(int); } Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Tue Aug 18 16:23:51 2009 @@ -207,7 +207,7 @@ reactos/dll/win32/advapi32/sec/sid.c # Out of Sync gdi32 - - reactos/dll/win32/gdi32/objects/linedda.c # Synched at 20090410 + reactos/dll/win32/gdi32/objects/linedda.c # Synced at 20090410 kernel32 - reactos/dll/win32/kernel32/misc/errormsg.c # Out of sync @@ -216,9 +216,9 @@ reactos/dll/win32/kernel32/misc/lzexpand.c # Synced to Wine-1_1_23 msvcrt - - reactos/lib/sdk/crt/except/cpp.c # Synced at 20071111 + reactos/lib/sdk/crt/except/cpp.c # Synced at 20080528 reactos/lib/sdk/crt/except/cppexcept.c # Synced at 20071111 - reactos/lib/sdk/crt/strings/scanf.c/h # Synced at 20080604 + reactos/lib/sdk/crt/string/scanf.c/h # Synced to Wine-1_1_27 reactos/lib/sdk/crt/strings/wcs.c # Synced at 20080611 reactos/lib/sdk/crt/wine/heap.c # Synced at 20080529 reactos/lib/sdk/crt/wine/undname.c # Synced at 20081130
15 years, 4 months
1
0
0
0
[gschneider] 42765: - GetConsoleAliasW: Check for invalid target buffer, failed memory allocation + set last error
by gschneider@svn.reactos.org
Author: gschneider Date: Tue Aug 18 15:47:02 2009 New Revision: 42765 URL:
http://svn.reactos.org/svn/reactos?rev=42765&view=rev
Log: - GetConsoleAliasW: Check for invalid target buffer, failed memory allocation + set last error Modified: trunk/reactos/dll/win32/kernel32/misc/console.c Modified: trunk/reactos/dll/win32/kernel32/misc/console.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/misc/co…
============================================================================== --- trunk/reactos/dll/win32/kernel32/misc/console.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/misc/console.c [iso-8859-1] Tue Aug 18 15:47:02 2009 @@ -352,6 +352,12 @@ DPRINT("GetConsoleAliasW entered lpSource %S lpExeName %S\n", lpSource, lpExeName); + if (lpTargetBuffer == NULL) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + CsrRequest = MAKE_CSR_API(GET_CONSOLE_ALIAS, CSR_CONSOLE); ExeLength = wcslen(lpExeName) + 1; @@ -361,11 +367,17 @@ RequestLength = Size + sizeof(CSR_API_MESSAGE); Request = RtlAllocateHeap(GetProcessHeap(), 0, RequestLength); + if (Request == NULL) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return 0; + } CaptureBuffer = CsrAllocateCaptureBuffer(1, TargetBufferLength); if (!CaptureBuffer) { RtlFreeHeap(GetProcessHeap(), 0, Request); + SetLastError(ERROR_NOT_ENOUGH_MEMORY); return 0; }
15 years, 4 months
1
0
0
0
[gschneider] 42764: - GetConsoleAliasA: Check for invalid target buffer, failed memory allocations (3x) - Found by Amine Khaldi
by gschneider@svn.reactos.org
Author: gschneider Date: Tue Aug 18 15:39:28 2009 New Revision: 42764 URL:
http://svn.reactos.org/svn/reactos?rev=42764&view=rev
Log: - GetConsoleAliasA: Check for invalid target buffer, failed memory allocations (3x) - Found by Amine Khaldi Modified: trunk/reactos/dll/win32/kernel32/misc/console.c Modified: trunk/reactos/dll/win32/kernel32/misc/console.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/misc/co…
============================================================================== --- trunk/reactos/dll/win32/kernel32/misc/console.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/misc/console.c [iso-8859-1] Tue Aug 18 15:39:28 2009 @@ -2,7 +2,7 @@ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries - * FILE: lib/kernel32/misc/console.c + * FILE: dll/win32/kernel32/misc/console.c * PURPOSE: Win32 server console functions * PROGRAMMER: James Tabor * <jimtabor(a)adsl-64-217-116-74.dsl.hstntx.swbell.net> @@ -426,15 +426,39 @@ DPRINT("GetConsoleAliasA entered\n"); + if (lpTargetBuffer == NULL) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + dwSourceSize = (strlen(lpSource)+1) * sizeof(WCHAR); lpwSource = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwSourceSize); + if (lpwSource == NULL) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return 0; + } MultiByteToWideChar(CP_ACP, 0, lpSource, -1, lpwSource, dwSourceSize); dwExeNameSize = (strlen(lpExeName)+1) * sizeof(WCHAR); lpwExeName = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwExeNameSize); + if (lpwExeName == NULL) + { + HeapFree(GetProcessHeap(), 0, lpwSource); + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return 0; + } MultiByteToWideChar(CP_ACP, 0, lpExeName, -1, lpwExeName, dwExeNameSize); lpwTargetBuffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, TargetBufferLength * sizeof(WCHAR)); + if (lpwTargetBuffer == NULL) + { + HeapFree(GetProcessHeap(), 0, lpwSource); + HeapFree(GetProcessHeap(), 0, lpwExeName); + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return 0; + } dwResult = GetConsoleAliasW(lpwSource, lpwTargetBuffer, TargetBufferLength * sizeof(WCHAR), lpwExeName);
15 years, 4 months
1
0
0
0
[gschneider] 42763: - Improve pipe client mode for improved QEmu debugging: it now waits for a pipe server, threaded - Remove automatic pipe connection mode, that idea is outdated
by gschneider@svn.reactos.org
Author: gschneider Date: Tue Aug 18 14:45:45 2009 New Revision: 42763 URL:
http://svn.reactos.org/svn/reactos?rev=42763&view=rev
Log: - Improve pipe client mode for improved QEmu debugging: it now waits for a pipe server, threaded - Remove automatic pipe connection mode, that idea is outdated Modified: trunk/tools/reactosdbg/Pipe/namedpipe.cs trunk/tools/reactosdbg/RosDBG/Connect.cs trunk/tools/reactosdbg/RosDBG/Properties/AssemblyInfo.cs Modified: trunk/tools/reactosdbg/Pipe/namedpipe.cs URL:
http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/Pipe/namedpipe.cs…
============================================================================== --- trunk/tools/reactosdbg/Pipe/namedpipe.cs [iso-8859-1] (original) +++ trunk/tools/reactosdbg/Pipe/namedpipe.cs [iso-8859-1] Tue Aug 18 14:45:45 2009 @@ -13,7 +13,6 @@ { MODE_CLIENT = 0x00000000, MODE_SERVER = 0x00000001, - MODE_AUTO = 0x00000002 } public class NamedPipe : Pipe, NPipe @@ -26,6 +25,7 @@ private bool bClientConn; private Thread waitThread; private NamedPipeServerStream sStream; + private NamedPipeClientStream cStream; public event EventHandler ClientConnectedEvent; public event EventHandler ClientDisconnectedEvent; @@ -90,30 +90,49 @@ waitThread.Start(); } + private void WaitForServer() + { + while (true) + { + try + { + cStream.Connect(10); + } + catch (TimeoutException) + { + /* Dismiss timeout, will try again */ + } + catch (Exception) + { + /* Pipe was killed externally */ + return; + } + if (cStream.IsConnected) + { + ioStream = cStream; + signalConnected(); + return; + } + Thread.Sleep(500); + } + } + public bool CreateClientPipe(string name) { - /* try to connect as a client */ + /* Try to connect as a client */ /* (QEMU -serial pipe or VMware in pipe server mode) */ try { - NamedPipeClientStream cStream = new NamedPipeClientStream(".", name, PipeDirection.InOut, PipeOptions.Asynchronous); - cStream.Connect(100); - - if (cStream.IsConnected) - { - ioStream = cStream; - signalConnected(); - return true; - } - else - { - return false; - } + cStream = new NamedPipeClientStream(".", name, PipeDirection.InOut, PipeOptions.Asynchronous); } catch (Exception) { + /* Pipe couldn't be created */ return false; } + waitThread = new Thread(WaitForServer); + waitThread.Start(); + return true; } public bool CreatePipe(string name, ConnectionMode mode) @@ -124,14 +143,6 @@ } switch (mode) { - case ConnectionMode.MODE_AUTO: - //check if pipe exists, if not create server pipe, wait certain time, check if pipe... - //TODO: server-client lookup should time out - CreateClientPipe(name); - CreateServerPipe(name); - - return true; - case ConnectionMode.MODE_CLIENT: CreateClientPipe(name); return true; @@ -153,9 +164,17 @@ /* Wake up the write thread so it can die */ newWriteData.Set(); + /* Close connection streams */ if (waitThread != null) { - sStream.Close(); + if (sStream != null) + { + sStream.Close(); + } + else if (cStream != null) + { + cStream.Close(); + } } } Modified: trunk/tools/reactosdbg/RosDBG/Connect.cs URL:
http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/RosDBG/Connect.cs…
============================================================================== --- trunk/tools/reactosdbg/RosDBG/Connect.cs [iso-8859-1] (original) +++ trunk/tools/reactosdbg/RosDBG/Connect.cs [iso-8859-1] Tue Aug 18 14:45:45 2009 @@ -98,8 +98,6 @@ pipeMode = ConnectionMode.MODE_CLIENT; else if (cType.SelectedItem.ToString().CompareTo("Server") == 0) pipeMode = ConnectionMode.MODE_SERVER; - else if (cType.SelectedItem.ToString().CompareTo("Automatic") == 0) - pipeMode = ConnectionMode.MODE_AUTO; Settings.SelectedConnType = Type; Settings.Mode = cType.SelectedItem.ToString(); Modified: trunk/tools/reactosdbg/RosDBG/Properties/AssemblyInfo.cs URL:
http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/RosDBG/Properties…
============================================================================== --- trunk/tools/reactosdbg/RosDBG/Properties/AssemblyInfo.cs [iso-8859-1] (original) +++ trunk/tools/reactosdbg/RosDBG/Properties/AssemblyInfo.cs [iso-8859-1] Tue Aug 18 14:45:45 2009 @@ -39,5 +39,5 @@ // will be increased as well. MSI installers must not be generated with the same Build Number // otherwise they won't upgrade the old installation! -[assembly: AssemblyVersion("1.0.2.68")] -[assembly: AssemblyFileVersion("1.0.2.68")] +[assembly: AssemblyVersion("1.0.2.69")] +[assembly: AssemblyFileVersion("1.0.2.69")]
15 years, 4 months
1
0
0
0
[janderwald] 42762: - Implement IPortEvents interface for IPortTopology - Fix a bug in the IPortEvents::QueryInterface handler of IPortWaveCyclic & IPortWavePci
by janderwald@svn.reactos.org
Author: janderwald Date: Tue Aug 18 10:24:09 2009 New Revision: 42762 URL:
http://svn.reactos.org/svn/reactos?rev=42762&view=rev
Log: - Implement IPortEvents interface for IPortTopology - Fix a bug in the IPortEvents::QueryInterface handler of IPortWaveCyclic & IPortWavePci Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/port_topology.c trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavecyclic.c trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavepci.c Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/port_topology.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/port_topology.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/port_topology.c [iso-8859-1] Tue Aug 18 10:24:09 2009 @@ -12,6 +12,7 @@ { IPortTopologyVtbl *lpVtbl; ISubdeviceVtbl *lpVtblSubDevice; + IPortEventsVtbl *lpVtblPortEvents; LONG ref; BOOL bInitialized; @@ -66,6 +67,98 @@ } }; +//--------------------------------------------------------------- +// IPortEvents +// + +static +NTSTATUS +NTAPI +IPortEvents_fnQueryInterface( + IPortEvents* iface, + IN REFIID refiid, + OUT PVOID* Output) +{ + IPortTopologyImpl * This = (IPortTopologyImpl*)CONTAINING_RECORD(iface, IPortTopologyImpl, lpVtblPortEvents); + + DPRINT("IPortEvents_fnQueryInterface entered\n"); + + if (IsEqualGUIDAligned(refiid, &IID_IPortEvents) || + IsEqualGUIDAligned(refiid, &IID_IUnknown)) + { + *Output = &This->lpVtblPortEvents; + InterlockedIncrement(&This->ref); + return STATUS_SUCCESS; + } + return STATUS_UNSUCCESSFUL; +} + +static +ULONG +NTAPI +IPortEvents_fnAddRef( + IPortEvents* iface) +{ + IPortTopologyImpl * This = (IPortTopologyImpl*)CONTAINING_RECORD(iface, IPortTopologyImpl, lpVtblPortEvents); + DPRINT("IPortEvents_fnQueryInterface entered\n"); + return InterlockedIncrement(&This->ref); +} + +static +ULONG +NTAPI +IPortEvents_fnRelease( + IPortEvents* iface) +{ + IPortTopologyImpl * This = (IPortTopologyImpl*)CONTAINING_RECORD(iface, IPortTopologyImpl, lpVtblPortEvents); + + DPRINT("IPortEvents_fnRelease entered\n"); + InterlockedDecrement(&This->ref); + + if (This->ref == 0) + { + FreeItem(This, TAG_PORTCLASS); + return 0; + } + /* Return new reference count */ + return This->ref; +} + +static +void +NTAPI +IPortEvents_fnAddEventToEventList( + IPortEvents* iface, + IN PKSEVENT_ENTRY EventEntry) +{ + UNIMPLEMENTED +} + + +static +void +NTAPI +IPortEvents_fnGenerateEventList( + IPortEvents* iface, + IN GUID* Set OPTIONAL, + IN ULONG EventId, + IN BOOL PinEvent, + IN ULONG PinId, + IN BOOL NodeEvent, + IN ULONG NodeId) +{ + UNIMPLEMENTED +} + +static IPortEventsVtbl vt_IPortEvents = +{ + IPortEvents_fnQueryInterface, + IPortEvents_fnAddRef, + IPortEvents_fnRelease, + IPortEvents_fnAddEventToEventList, + IPortEvents_fnGenerateEventList +}; + //--------------------------------------------------------------- // IUnknown interface functions @@ -94,6 +187,12 @@ else if (IsEqualGUIDAligned(refiid, &IID_ISubdevice)) { *Output = &This->lpVtblSubDevice; + InterlockedIncrement(&This->ref); + return STATUS_SUCCESS; + } + else if (IsEqualGUIDAligned(refiid, &IID_IPortEvents)) + { + *Output = &This->lpVtblPortEvents; InterlockedIncrement(&This->ref); return STATUS_SUCCESS; } @@ -707,6 +806,7 @@ This->lpVtbl = &vt_IPortTopology; This->lpVtblSubDevice = &vt_ISubdeviceVtbl; + This->lpVtblPortEvents = &vt_IPortEvents; This->ref = 1; *OutPort = (PPORT)(&This->lpVtbl); DPRINT("NewPortTopology result %p\n", *OutPort); Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavecyclic.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavecyclic.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavecyclic.c [iso-8859-1] Tue Aug 18 10:24:09 2009 @@ -13,9 +13,6 @@ typedef struct { IPortWaveCyclicVtbl *lpVtbl; - IPortEventsVtbl *lpVbtlPortEvents; - IUnregisterSubdeviceVtbl *lpVtblUnregisterSubdevice; - IUnregisterPhysicalConnectionVtbl *lpVtblPhysicalConnection; IPortEventsVtbl *lpVtblPortEvents; ISubdeviceVtbl *lpVtblSubDevice; @@ -111,7 +108,7 @@ if (IsEqualGUIDAligned(refiid, &IID_IPortEvents) || IsEqualGUIDAligned(refiid, &IID_IUnknown)) { - *Output = &This->lpVbtlPortEvents; + *Output = &This->lpVtblPortEvents; InterlockedIncrement(&This->ref); return STATUS_SUCCESS; } Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavepci.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavepci.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavepci.c [iso-8859-1] Tue Aug 18 10:24:09 2009 @@ -93,7 +93,7 @@ if (IsEqualGUIDAligned(refiid, &IID_IPortEvents) || IsEqualGUIDAligned(refiid, &IID_IUnknown)) { - *Output = &This->lpVtblServiceSink; + *Output = &This->lpVtblPortEvents; InterlockedIncrement(&This->ref); return STATUS_SUCCESS; }
15 years, 4 months
1
0
0
0
[janderwald] 42761: - Increment reference count only if resource list was passed - May fix A.8738-4C
by janderwald@svn.reactos.org
Author: janderwald Date: Tue Aug 18 10:03:12 2009 New Revision: 42761 URL:
http://svn.reactos.org/svn/reactos?rev=42761&view=rev
Log: - Increment reference count only if resource list was passed - May fix A.8738-4C Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavecyclic.c Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavecyclic.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavecyclic.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavecyclic.c [iso-8859-1] Tue Aug 18 10:03:12 2009 @@ -336,6 +336,13 @@ This->pDeviceObject = DeviceObject; This->bInitialized = TRUE; This->pResourceList = ResourceList; + + + if (ResourceList) + { + /* increment reference on resource list */ + ResourceList->lpVtbl->AddRef(ResourceList); + } Status = Miniport->lpVtbl->Init(Miniport, UnknownAdapter, ResourceList, iface); if (!NT_SUCCESS(Status)) @@ -397,10 +404,6 @@ This->pPowerNotify = PowerNotify; } - /* increment reference on resource list */ - ResourceList->lpVtbl->AddRef(ResourceList); - - DPRINT("IPortWaveCyclic successfully initialized\n"); return STATUS_SUCCESS; }
15 years, 4 months
1
0
0
0
[spetreolle] 42760: Move IF_OPER_STATUS enum to ifdef.h
by spetreolle@svn.reactos.org
Author: spetreolle Date: Mon Aug 17 21:46:30 2009 New Revision: 42760 URL:
http://svn.reactos.org/svn/reactos?rev=42760&view=rev
Log: Move IF_OPER_STATUS enum to ifdef.h Modified: trunk/reactos/include/psdk/ifdef.h trunk/reactos/include/psdk/iptypes.h Modified: trunk/reactos/include/psdk/ifdef.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/ifdef.h?rev=4…
============================================================================== --- trunk/reactos/include/psdk/ifdef.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/ifdef.h [iso-8859-1] Mon Aug 17 21:46:30 2009 @@ -70,4 +70,14 @@ NET_IF_CONNECTION_MAXIMUM = 4 } NET_IF_CONNECTION_TYPE, *PNET_IF_CONNECTION_TYPE; +typedef enum { + IfOperStatusUp = 1, + IfOperStatusDown, + IfOperStatusTesting, + IfOperStatusUnknown, + IfOperStatusDormant, + IfOperStatusNotPresent, + IfOperStatusLowerLayerDown +} IF_OPER_STATUS; + #endif /* _IFDEF_ */ Modified: trunk/reactos/include/psdk/iptypes.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/iptypes.h?rev…
============================================================================== --- trunk/reactos/include/psdk/iptypes.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/iptypes.h [iso-8859-1] Mon Aug 17 21:46:30 2009 @@ -101,15 +101,6 @@ IpDadStateDeprecated, IpDadStatePreferred, } IP_DAD_STATE; -typedef enum { - IfOperStatusUp = 1, - IfOperStatusDown, - IfOperStatusTesting, - IfOperStatusUnknown, - IfOperStatusDormant, - IfOperStatusNotPresent, - IfOperStatusLowerLayerDown -} IF_OPER_STATUS; typedef struct _IP_ADAPTER_UNICAST_ADDRESS { union { ULONGLONG Alignment;
15 years, 4 months
1
0
0
0
[janderwald] 42759: [WDMAUD.DRV] - Disable traces - Use device name from IOCTL [WDMAUD_KERNEL] - Implement retrieving devicename by looking up in the registry [SYSAUDIO] - Implement KSPROPERTY_SYSAUDIO_DEVICE_INTERFACE_NAME - Audio CPL should now show correct audio device name
by janderwald@svn.reactos.org
Author: janderwald Date: Mon Aug 17 19:23:35 2009 New Revision: 42759 URL:
http://svn.reactos.org/svn/reactos?rev=42759&view=rev
Log: [WDMAUD.DRV] - Disable traces - Use device name from IOCTL [WDMAUD_KERNEL] - Implement retrieving devicename by looking up in the registry [SYSAUDIO] - Implement KSPROPERTY_SYSAUDIO_DEVICE_INTERFACE_NAME - Audio CPL should now show correct audio device name Modified: trunk/reactos/dll/win32/wdmaud.drv/mixer.c trunk/reactos/dll/win32/wdmaud.drv/wdmaud.c trunk/reactos/drivers/wdm/audio/legacy/wdmaud/control.c trunk/reactos/drivers/wdm/audio/legacy/wdmaud/wdmaud.h trunk/reactos/drivers/wdm/audio/sysaudio/control.c Modified: trunk/reactos/dll/win32/wdmaud.drv/mixer.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wdmaud.drv/mixer…
============================================================================== --- trunk/reactos/dll/win32/wdmaud.drv/mixer.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/wdmaud.drv/mixer.c [iso-8859-1] Mon Aug 17 19:23:35 2009 @@ -43,7 +43,7 @@ ULONG NumSamples; ULONG NewSamples; - SND_TRACE(L"PerformSampleRateConversion OldRate %u NewRate %u BytesPerSample %u NumChannels %u\n", OldRate, NewRate, BytesPerSample, NumChannels); + //SND_TRACE(L"PerformSampleRateConversion OldRate %u NewRate %u BytesPerSample %u NumChannels %u\n", OldRate, NewRate, BytesPerSample, NumChannels); ASSERT(BytesPerSample == 1 || BytesPerSample == 2 || BytesPerSample == 4); @@ -281,7 +281,7 @@ Samples = BufferLength / (OldWidth / 8); //DPRINT("Samples %u BufferLength %u\n", Samples, BufferLength); - SND_TRACE(L"PerformQualityConversion OldWidth %u NewWidth %u\n", OldWidth, NewWidth); + //SND_TRACE(L"PerformQualityConversion OldWidth %u NewWidth %u\n", OldWidth, NewWidth); if (OldWidth == 8 && NewWidth == 16) { @@ -292,7 +292,7 @@ for(Index = 0; Index < Samples; Index++) { - Sample = Buffer[Index]; + Sample = Buffer[Index];// & 0xFF); Sample *= 2; #ifdef _X86_ Sample = _byteswap_ushort(Sample); Modified: trunk/reactos/dll/win32/wdmaud.drv/wdmaud.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wdmaud.drv/wdmau…
============================================================================== --- trunk/reactos/dll/win32/wdmaud.drv/wdmaud.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/wdmaud.drv/wdmaud.c [iso-8859-1] Mon Aug 17 19:23:35 2009 @@ -120,6 +120,7 @@ return TranslateInternalMmResult(Result); } + SND_TRACE(L"WDMAUD Name %S\n", DeviceInfo.u.WaveOutCaps.szPname); /* This is pretty much a big hack right now */ switch ( DeviceType ) @@ -131,7 +132,7 @@ WaveOutCaps->wPid = DeviceInfo.u.WaveOutCaps.wPid; WaveOutCaps->vDriverVersion = 0x0001; - CopyWideString(WaveOutCaps->szPname, UnknownWaveOut); + CopyWideString(WaveOutCaps->szPname, DeviceInfo.u.WaveOutCaps.szPname); WaveOutCaps->dwFormats = DeviceInfo.u.WaveOutCaps.dwFormats; WaveOutCaps->wChannels = DeviceInfo.u.WaveOutCaps.wChannels; @@ -141,7 +142,7 @@ case WAVE_IN_DEVICE_TYPE : { LPWAVEINCAPS WaveInCaps = (LPWAVEINCAPS) Capabilities; - CopyWideString(WaveInCaps->szPname, UnknownWaveIn); + CopyWideString(WaveInCaps->szPname, DeviceInfo.u.WaveOutCaps.szPname); /* TODO... other fields */ break; } Modified: trunk/reactos/drivers/wdm/audio/legacy/wdmaud/control.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/legacy/w…
============================================================================== --- trunk/reactos/drivers/wdm/audio/legacy/wdmaud/control.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/legacy/wdmaud/control.c [iso-8859-1] Mon Aug 17 19:23:35 2009 @@ -468,6 +468,212 @@ } +PKEY_VALUE_PARTIAL_INFORMATION +ReadKeyValue( + IN HANDLE hSubKey, + IN PUNICODE_STRING KeyName) +{ + NTSTATUS Status; + ULONG Length; + PKEY_VALUE_PARTIAL_INFORMATION PartialInformation; + + /* now query MatchingDeviceId key */ + Status = ZwQueryValueKey(hSubKey, KeyName, KeyValuePartialInformation, NULL, 0, &Length); + + /* check for success */ + if (Status != STATUS_BUFFER_TOO_SMALL) + return NULL; + + /* allocate a buffer for key data */ + PartialInformation = ExAllocatePool(NonPagedPool, Length); + + if (!PartialInformation) + return NULL; + + + /* now query MatchingDeviceId key */ + Status = ZwQueryValueKey(hSubKey, KeyName, KeyValuePartialInformation, PartialInformation, Length, &Length); + + /* check for success */ + if (!NT_SUCCESS(Status)) + { + ExFreePool(PartialInformation); + return NULL; + } + + if (PartialInformation->Type != REG_SZ) + { + /* invalid key type */ + ExFreePool(PartialInformation); + return NULL; + } + + return PartialInformation; +} + + +NTSTATUS +CompareProductName( + IN HANDLE hSubKey, + IN LPWSTR PnpName, + IN ULONG ProductNameSize, + OUT LPWSTR ProductName) +{ + PKEY_VALUE_PARTIAL_INFORMATION PartialInformation; + UNICODE_STRING DriverDescName = RTL_CONSTANT_STRING(L"DriverDesc"); + UNICODE_STRING MatchingDeviceIdName = RTL_CONSTANT_STRING(L"MatchingDeviceId"); + ULONG Length; + LPWSTR DeviceName; + + /* read MatchingDeviceId value */ + PartialInformation = ReadKeyValue(hSubKey, &MatchingDeviceIdName); + + if (!PartialInformation) + return STATUS_UNSUCCESSFUL; + + + /* extract last '&' */ + DeviceName = wcsrchr((LPWSTR)PartialInformation->Data, L'&'); + ASSERT(DeviceName); + /* terminate it */ + DeviceName[0] = L'\0'; + + Length = wcslen((LPWSTR)PartialInformation->Data); + + DPRINT("DeviceName %S PnpName %S Length %u\n", (LPWSTR)PartialInformation->Data, PnpName, Length); + + if (_wcsnicmp((LPWSTR)PartialInformation->Data, &PnpName[4], Length)) + { + ExFreePool(PartialInformation); + return STATUS_NO_MATCH; + } + + /* free buffer */ + ExFreePool(PartialInformation); + + /* read DriverDescName value */ + PartialInformation = ReadKeyValue(hSubKey, &DriverDescName); + + /* copy key name */ + Length = min(ProductNameSize * sizeof(WCHAR), PartialInformation->DataLength); + RtlMoveMemory(ProductName, (PVOID)PartialInformation->Data, Length); + + /* zero terminate it */ + ProductName[ProductNameSize-1] = L'\0'; + + /* free buffer */ + ExFreePool(PartialInformation); + + return STATUS_SUCCESS; +} + + + +NTSTATUS +FindProductName( + IN LPWSTR PnpName, + IN ULONG ProductNameSize, + OUT LPWSTR ProductName) +{ + UNICODE_STRING KeyName = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Class\\{4D36E96C-E325-11CE-BFC1-08002BE10318}"); + + UNICODE_STRING SubKeyName; + WCHAR SubKey[20]; + OBJECT_ATTRIBUTES ObjectAttributes; + HANDLE hKey, hSubKey; + NTSTATUS Status; + ULONG Length, Index; + PKEY_FULL_INFORMATION KeyInformation; + + for(Index = 0; Index < wcslen(PnpName); Index++) + { + if (PnpName[Index] == '#') + PnpName[Index] = L'\\'; + } + + + /* initialize key attributes */ + InitializeObjectAttributes(&ObjectAttributes, &KeyName, OBJ_CASE_INSENSITIVE | OBJ_OPENIF, NULL, NULL); + + /* open the key */ + Status = ZwOpenKey(&hKey, GENERIC_READ, &ObjectAttributes); + + /* check for success */ + if (!NT_SUCCESS(Status)) + return Status; + + /* query num of subkeys */ + Status = ZwQueryKey(hKey, KeyFullInformation, NULL, 0, &Length); + + if (Status != STATUS_BUFFER_TOO_SMALL) + { + DPRINT1("ZwQueryKey failed with %x\n", Status); + /* failed */ + ZwClose(hKey); + return Status; + } + + /* allocate key information struct */ + KeyInformation = ExAllocatePool(NonPagedPool, Length); + if (!KeyInformation) + { + /* no memory */ + ZwClose(hKey); + return STATUS_INSUFFICIENT_RESOURCES; + } + + /* query num of subkeys */ + Status = ZwQueryKey(hKey, KeyFullInformation, (PVOID)KeyInformation, Length, &Length); + + if (!NT_SUCCESS(Status)) + { + DPRINT1("ZwQueryKey failed with %x\n", Status); + ExFreePool(KeyInformation); + ZwClose(hKey); + return Status; + } + + /* now iterate through all subkeys */ + for(Index = 0; Index < KeyInformation->SubKeys; Index++) + { + /* subkeys are always in the format 0000-XXXX */ + swprintf(SubKey, L"%04u", Index); + + /* initialize subkey name */ + RtlInitUnicodeString(&SubKeyName, SubKey); + + /* initialize key attributes */ + InitializeObjectAttributes(&ObjectAttributes, &SubKeyName, OBJ_CASE_INSENSITIVE | OBJ_OPENIF, hKey, NULL); + + /* open the sub key */ + Status = ZwOpenKey(&hSubKey, GENERIC_READ, &ObjectAttributes); + + /* check for success */ + if (NT_SUCCESS(Status)) + { + /* compare product name */ + Status = CompareProductName(hSubKey, PnpName, ProductNameSize, ProductName); + + /* close subkey */ + ZwClose(hSubKey); + + if (NT_SUCCESS(Status)) + break; + } + } + + /* free buffer */ + ExFreePool(KeyInformation); + + /* close key */ + ZwClose(hKey); + + /* no matching key found */ + return Status; +} + + + NTSTATUS WdmAudCapabilities( IN PDEVICE_OBJECT DeviceObject, @@ -489,6 +695,7 @@ ULONG dwSupport = 0; ULONG FilterId; ULONG PinId; + WCHAR DeviceName[MAX_PATH]; DPRINT("WdmAudCapabilities entered\n"); @@ -512,6 +719,25 @@ { DeviceInfo->u.WaveOutCaps.wMid = ComponentId.Manufacturer.Data1 - 0xd5a47fa7; DeviceInfo->u.WaveOutCaps.vDriverVersion = MAKELONG(ComponentId.Version, ComponentId.Revision); + } + + /* retrieve pnp base name */ + PinProperty.PinId = FilterId; + PinProperty.Property.Set = KSPROPSETID_Sysaudio; + PinProperty.Property.Id = KSPROPERTY_SYSAUDIO_DEVICE_INTERFACE_NAME; + PinProperty.Property.Flags = KSPROPERTY_TYPE_GET; + + Status = KsSynchronousIoControlDevice(DeviceExtension->FileObject, KernelMode, IOCTL_KS_PROPERTY, (PVOID)&PinProperty, sizeof(KSP_PIN), (PVOID)DeviceName, sizeof(DeviceName), &BytesReturned); + if (NT_SUCCESS(Status)) + { + /* find product name */ + Status = FindProductName(DeviceName, MAXPNAMELEN, DeviceInfo->u.WaveOutCaps.szPname); + + /* check for success */ + if (!NT_SUCCESS(Status)) + { + DeviceInfo->u.WaveOutCaps.szPname[0] = L'\0'; + } } PinProperty.Reserved = DeviceInfo->DeviceIndex; @@ -575,10 +801,9 @@ DeviceInfo->u.WaveOutCaps.dwFormats = dwFormats; DeviceInfo->u.WaveOutCaps.dwSupport = dwSupport; DeviceInfo->u.WaveOutCaps.wChannels = wChannels; - DeviceInfo->u.WaveOutCaps.szPname[0] = L'\0'; - ExFreePool(MultipleItem); + return SetIrpIoStatus(Irp, Status, sizeof(WDMAUD_DEVICE_INFO)); } Modified: trunk/reactos/drivers/wdm/audio/legacy/wdmaud/wdmaud.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/legacy/w…
============================================================================== --- trunk/reactos/drivers/wdm/audio/legacy/wdmaud/wdmaud.h [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/legacy/wdmaud/wdmaud.h [iso-8859-1] Mon Aug 17 19:23:35 2009 @@ -9,6 +9,9 @@ #include <debug.h> #include <ksmedia.h> #include <mmsystem.h> +#include <stdlib.h> +#include <stdio.h> +#include <wchar.h> #include "interface.h" Modified: trunk/reactos/drivers/wdm/audio/sysaudio/control.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/sysaudio…
============================================================================== --- trunk/reactos/drivers/wdm/audio/sysaudio/control.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/sysaudio/control.c [iso-8859-1] Mon Aug 17 19:23:35 2009 @@ -351,7 +351,7 @@ PKSOBJECT_CREATE_ITEM CreateItem; UNICODE_STRING GuidString; PKSP_PIN Pin; - + LPWSTR DeviceName; /* access the create item */ CreateItem = KSCREATE_ITEM_IRP_STORAGE(Irp); @@ -394,6 +394,39 @@ } else if (IsEqualGUIDAligned(&Property->Set, &KSPROPSETID_Sysaudio)) { + if (Property->Id == KSPROPERTY_SYSAUDIO_DEVICE_INTERFACE_NAME) + { + if (IoStack->Parameters.DeviceIoControl.InputBufferLength < sizeof(KSPROPERTY) + sizeof(ULONG)) + { + /* invalid request */ + return SetIrpIoStatus(Irp, STATUS_UNSUCCESSFUL, sizeof(KSPROPERTY) + sizeof(ULONG)); + } + Index = (PULONG)(Property + 1); + + if (DeviceExtension->NumberOfKsAudioDevices <= *Index) + { + /* invalid index */ + return SetIrpIoStatus(Irp, STATUS_INVALID_PARAMETER, 0); + } + + Entry = GetListEntry(&DeviceExtension->KsAudioDeviceList, *Index); + ASSERT(Entry != NULL); + + BytesReturned = Entry->DeviceName.Length + sizeof(WCHAR); + if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < BytesReturned) + { + /* too small buffer */ + return SetIrpIoStatus(Irp, STATUS_BUFFER_TOO_SMALL, BytesReturned); + } + + /* copy device name */ + DeviceName = (LPWSTR)Irp->UserBuffer; + + RtlMoveMemory(DeviceName, Entry->DeviceName.Buffer, Entry->DeviceName.Length); + DeviceName[Entry->DeviceName.Length / sizeof(WCHAR)] = L'\0'; + return SetIrpIoStatus(Irp, STATUS_SUCCESS, BytesReturned); + } + if (Property->Id == KSPROPERTY_SYSAUDIO_COMPONENT_ID) { if (IoStack->Parameters.DeviceIoControl.InputBufferLength < sizeof(KSPROPERTY) + sizeof(ULONG))
15 years, 4 months
1
0
0
0
[gschneider] 42758: - Remove duplicate WToA conversion routine, update the kept version to current Wine - Adapt calling functions from BOOL to VOID since they can't fail - Fixes ~two font tests
by gschneider@svn.reactos.org
Author: gschneider Date: Mon Aug 17 19:03:55 2009 New Revision: 42758 URL:
http://svn.reactos.org/svn/reactos?rev=42758&view=rev
Log: - Remove duplicate WToA conversion routine, update the kept version to current Wine - Adapt calling functions from BOOL to VOID since they can't fail - Fixes ~two font tests Modified: trunk/reactos/dll/win32/gdi32/include/gdi32p.h trunk/reactos/dll/win32/gdi32/objects/font.c trunk/reactos/dll/win32/gdi32/objects/text.c Modified: trunk/reactos/dll/win32/gdi32/include/gdi32p.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/include/gd…
============================================================================== --- trunk/reactos/dll/win32/gdi32/include/gdi32p.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/gdi32/include/gdi32p.h [iso-8859-1] Mon Aug 17 19:03:55 2009 @@ -162,21 +162,21 @@ VOID HEAP_free(LPVOID memory); -BOOL -FASTCALL -TextMetricW2A( - TEXTMETRICA *tma, - TEXTMETRICW *tmw -); - -BOOL +VOID +FASTCALL +FONT_TextMetricWToA( + const TEXTMETRICW *ptmW, + LPTEXTMETRICA ptmA +); + +VOID FASTCALL NewTextMetricW2A( NEWTEXTMETRICA *tma, NEWTEXTMETRICW *tmw ); -BOOL +VOID FASTCALL NewTextMetricExW2A( NEWTEXTMETRICEXA *tma, Modified: trunk/reactos/dll/win32/gdi32/objects/font.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/fo…
============================================================================== --- trunk/reactos/dll/win32/gdi32/objects/font.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/gdi32/objects/font.c [iso-8859-1] Mon Aug 17 19:03:55 2009 @@ -62,7 +62,9 @@ /*********************************************************************** * TEXTMETRIC conversion functions. */ -static void FONT_TextMetricWToA(const TEXTMETRICW *ptmW, LPTEXTMETRICA ptmA ) +VOID +FASTCALL +FONT_TextMetricWToA(const TEXTMETRICW *ptmW, LPTEXTMETRICA ptmA ) { ptmA->tmHeight = ptmW->tmHeight; ptmA->tmAscent = ptmW->tmAscent; @@ -75,10 +77,19 @@ ptmA->tmOverhang = ptmW->tmOverhang; ptmA->tmDigitizedAspectX = ptmW->tmDigitizedAspectX; ptmA->tmDigitizedAspectY = ptmW->tmDigitizedAspectY; - ptmA->tmFirstChar = ptmW->tmFirstChar > 255 ? 255 : ptmW->tmFirstChar; - ptmA->tmLastChar = ptmW->tmLastChar > 255 ? 255 : ptmW->tmLastChar; - ptmA->tmDefaultChar = ptmW->tmDefaultChar > 255 ? 255 : ptmW->tmDefaultChar; - ptmA->tmBreakChar = ptmW->tmBreakChar > 255 ? 255 : ptmW->tmBreakChar; + ptmA->tmFirstChar = min(ptmW->tmFirstChar, 255); + if (ptmW->tmCharSet == SYMBOL_CHARSET) + { + ptmA->tmFirstChar = 0x1e; + ptmA->tmLastChar = 0xff; /* win9x behaviour - we need the OS2 table data to calculate correctly */ + } + else + { + ptmA->tmFirstChar = ptmW->tmDefaultChar - 1; + ptmA->tmLastChar = min(ptmW->tmLastChar, 0xff); + } + ptmA->tmDefaultChar = ptmW->tmDefaultChar; + ptmA->tmBreakChar = ptmW->tmBreakChar; ptmA->tmItalic = ptmW->tmItalic; ptmA->tmUnderlined = ptmW->tmUnderlined; ptmA->tmStruckOut = ptmW->tmStruckOut; @@ -114,168 +125,21 @@ return strW; } - -static BOOL FASTCALL -MetricsCharConvert(WCHAR w, UCHAR *b) - { - UNICODE_STRING WString; - WCHAR WBuf[2]; - ANSI_STRING AString; - CHAR ABuf[2]; - NTSTATUS Status; - - if (L'\0' == w) - { - *b = '\0'; - } - else - { - WBuf[0] = w; - WBuf[1] = L'\0'; - RtlInitUnicodeString(&WString, WBuf); - ABuf[0] = '*'; - ABuf[1] = L'\0'; - RtlInitAnsiString(&AString, ABuf); - - Status = RtlUnicodeStringToAnsiString(&AString, &WString, FALSE); - if (! NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - *b = ABuf[0]; - } - - return TRUE; -} - -BOOL FASTCALL -TextMetricW2A(TEXTMETRICA *tma, TEXTMETRICW *tmw) -{ - UNICODE_STRING WString; - WCHAR WBuf[256]; - ANSI_STRING AString; - CHAR ABuf[256]; - UINT Letter; - NTSTATUS Status; - - tma->tmHeight = tmw->tmHeight; - tma->tmAscent = tmw->tmAscent; - tma->tmDescent = tmw->tmDescent; - tma->tmInternalLeading = tmw->tmInternalLeading; - tma->tmExternalLeading = tmw->tmExternalLeading; - tma->tmAveCharWidth = tmw->tmAveCharWidth; - tma->tmMaxCharWidth = tmw->tmMaxCharWidth; - tma->tmWeight = tmw->tmWeight; - tma->tmOverhang = tmw->tmOverhang; - tma->tmDigitizedAspectX = tmw->tmDigitizedAspectX; - tma->tmDigitizedAspectY = tmw->tmDigitizedAspectY; - - /* The Unicode FirstChar/LastChar need not correspond to the ANSI - FirstChar/LastChar. For example, if the font contains glyphs for - letters A-Z and an accented version of the letter e, the Unicode - FirstChar would be A and the Unicode LastChar would be the accented - e. If you just translate those to ANSI, the range would become - letters A-E instead of A-Z. - We translate all possible ANSI chars to Unicode and find the first - and last translated character which fall into the Unicode FirstChar/ - LastChar range and return the corresponding ANSI char. */ - - /* Setup an Ansi string containing all possible letters (note: skip '\0' at - the beginning since that would be interpreted as end-of-string, handle - '\0' special later */ - for (Letter = 1; Letter < 256; Letter++) - { - ABuf[Letter - 1] = (CHAR) Letter; - WBuf[Letter - 1] = L' '; - } - ABuf[255] = '\0'; - WBuf[255] = L'\0'; - RtlInitAnsiString(&AString, ABuf); - RtlInitUnicodeString(&WString, WBuf); - - /* Find the corresponding Unicode characters */ - Status = RtlAnsiStringToUnicodeString(&WString, &AString, FALSE); - if (! NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - /* Scan for the first ANSI character which maps to an Unicode character - in the range */ - tma->tmFirstChar = '\0'; - if (L'\0' != tmw->tmFirstChar) - { - for (Letter = 1; Letter < 256; Letter++) - { - if (tmw->tmFirstChar <= WBuf[Letter - 1] && - WBuf[Letter - 1] <= tmw->tmLastChar) - { - tma->tmFirstChar = (CHAR) Letter; - break; - } - } - } - - /* Scan for the last ANSI character which maps to an Unicode character - in the range */ - tma->tmLastChar = '\0'; - if (L'\0' != tmw->tmLastChar) - { - for (Letter = 255; 0 < Letter; Letter--) - { - if (tmw->tmFirstChar <= WBuf[Letter - 1] && - WBuf[Letter - 1] <= tmw->tmLastChar) - { - tma->tmLastChar = (CHAR) Letter; - break; - } - } - } - - if (! MetricsCharConvert(tmw->tmDefaultChar, &tma->tmDefaultChar) || - ! MetricsCharConvert(tmw->tmBreakChar, &tma->tmBreakChar)) - { - return FALSE; - } - - tma->tmItalic = tmw->tmItalic; - tma->tmUnderlined = tmw->tmUnderlined; - tma->tmStruckOut = tmw->tmStruckOut; - tma->tmPitchAndFamily = tmw->tmPitchAndFamily; - tma->tmCharSet = tmw->tmCharSet; - - return TRUE; -} - -BOOL FASTCALL +VOID FASTCALL NewTextMetricW2A(NEWTEXTMETRICA *tma, NEWTEXTMETRICW *tmw) { - if (! TextMetricW2A((TEXTMETRICA *) tma, (TEXTMETRICW *) tmw)) - { - return FALSE; - } - + FONT_TextMetricWToA((TEXTMETRICW *) tmw, (TEXTMETRICA *) tma); tma->ntmFlags = tmw->ntmFlags; tma->ntmSizeEM = tmw->ntmSizeEM; tma->ntmCellHeight = tmw->ntmCellHeight; tma->ntmAvgWidth = tmw->ntmAvgWidth; - - return TRUE; -} - -BOOL FASTCALL +} + +VOID FASTCALL NewTextMetricExW2A(NEWTEXTMETRICEXA *tma, NEWTEXTMETRICEXW *tmw) { - if (! NewTextMetricW2A(&tma->ntmTm, &tmw->ntmTm)) - { - return FALSE; - } - + NewTextMetricW2A(&tma->ntmTm, &tmw->ntmTm); tma->ntmFontSig = tmw->ntmFontSig; - - return TRUE; } static int FASTCALL Modified: trunk/reactos/dll/win32/gdi32/objects/text.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/te…
============================================================================== --- trunk/reactos/dll/win32/gdi32/objects/text.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/gdi32/objects/text.c [iso-8859-1] Mon Aug 17 19:03:55 2009 @@ -1,5 +1,4 @@ #include "precomp.h" - /* @@ -91,7 +90,6 @@ - /* * @implemented */ @@ -109,7 +107,8 @@ return FALSE; } - return TextMetricW2A(lptm, &tmwi.TextMetric); + FONT_TextMetricWToA(&tmwi.TextMetric, lptm); + return TRUE; }
15 years, 4 months
1
0
0
0
[janderwald] 42757: - Implement usermode mixing support - To enable, see wdmaud rbuild
by janderwald@svn.reactos.org
Author: janderwald Date: Mon Aug 17 15:49:19 2009 New Revision: 42757 URL:
http://svn.reactos.org/svn/reactos?rev=42757&view=rev
Log: - Implement usermode mixing support - To enable, see wdmaud rbuild Added: trunk/reactos/dll/win32/wdmaud.drv/mixer.c (with props) Modified: trunk/reactos/dll/win32/wdmaud.drv/wdmaud.c trunk/reactos/dll/win32/wdmaud.drv/wdmaud.rbuild Added: trunk/reactos/dll/win32/wdmaud.drv/mixer.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wdmaud.drv/mixer…
============================================================================== --- trunk/reactos/dll/win32/wdmaud.drv/mixer.c (added) +++ trunk/reactos/dll/win32/wdmaud.drv/mixer.c [iso-8859-1] Mon Aug 17 15:49:19 2009 @@ -1,0 +1,554 @@ +/* + * PROJECT: ReactOS Sound System + * LICENSE: GPL - See COPYING in the top level directory + * FILE: dll/win32/wdmaud.drv/mixer.c + * + * PURPOSE: WDM Audio Driver (User-mode part) + * PROGRAMMERS: Johannes Anderwald + */ + +#include <windows.h> +#include <ntddsnd.h> +#include <sndtypes.h> +#include <mmddk.h> +#include <mmebuddy.h> + +#include <ks.h> +#include <ksmedia.h> +#include <samplerate.h> +#include <float_cast.h> +#include <debug.h> +#include "interface.h" + + +extern HANDLE KernelHandle; + +DWORD +PerformSampleRateConversion( + PUCHAR Buffer, + ULONG BufferLength, + ULONG OldRate, + ULONG NewRate, + ULONG BytesPerSample, + ULONG NumChannels, + PVOID * Result, + PULONG ResultLength) +{ + ULONG Index; + SRC_STATE * State; + SRC_DATA Data; + PUCHAR ResultOut; + int error; + PFLOAT FloatIn, FloatOut; + ULONG NumSamples; + ULONG NewSamples; + + SND_TRACE(L"PerformSampleRateConversion OldRate %u NewRate %u BytesPerSample %u NumChannels %u\n", OldRate, NewRate, BytesPerSample, NumChannels); + + ASSERT(BytesPerSample == 1 || BytesPerSample == 2 || BytesPerSample == 4); + + NumSamples = BufferLength / (BytesPerSample * NumChannels); + + FloatIn = HeapAlloc(GetProcessHeap(), 0, NumSamples * NumChannels * sizeof(FLOAT)); + if (!FloatIn) + { + return ERROR_NOT_ENOUGH_MEMORY; + } + + NewSamples = lrintf(((FLOAT)NumSamples * ((FLOAT)NewRate / (FLOAT)OldRate))) + 2; + + FloatOut = HeapAlloc(GetProcessHeap(), 0, NewSamples * NumChannels * sizeof(FLOAT)); + if (!FloatOut) + { + HeapFree(GetProcessHeap(), 0,FloatIn); + return ERROR_NOT_ENOUGH_MEMORY; + } + + ResultOut = HeapAlloc(GetProcessHeap(), 0, NewSamples * NumChannels * BytesPerSample); + if (!ResultOut) + { + HeapFree(GetProcessHeap(), 0,FloatIn); + HeapFree(GetProcessHeap(), 0,FloatOut); + return ERROR_NOT_ENOUGH_MEMORY; + } + + State = src_new(SRC_SINC_FASTEST, NumChannels, &error); + if (!State) + { + HeapFree(GetProcessHeap(), 0,FloatIn); + HeapFree(GetProcessHeap(), 0,FloatOut); + HeapFree(GetProcessHeap(), 0,ResultOut); + return ERROR_NOT_ENOUGH_MEMORY; + } + + /* fixme use asm */ + if (BytesPerSample == 1) + { + for(Index = 0; Index < NumSamples * NumChannels; Index++) + FloatIn[Index] = (float)(Buffer[Index] / (1.0 * 0x80)); + } + else if (BytesPerSample == 2) + { + src_short_to_float_array((short*)Buffer, FloatIn, NumSamples * NumChannels); + } + else if (BytesPerSample == 4) + { + src_int_to_float_array((int*)Buffer, FloatIn, NumSamples * NumChannels); + } + + Data.data_in = FloatIn; + Data.data_out = FloatOut; + Data.input_frames = NumSamples; + Data.output_frames = NewSamples; + Data.src_ratio = (double)NewRate / (double)OldRate; + + error = src_process(State, &Data); + if (error) + { + DPRINT1("src_process failed with %x\n", error); + HeapFree(GetProcessHeap(), 0,FloatIn); + HeapFree(GetProcessHeap(), 0,FloatOut); + HeapFree(GetProcessHeap(), 0,ResultOut); + return ERROR_INVALID_DATA; + } + + if (BytesPerSample == 1) + { + /* FIXME perform over/under clipping */ + + for(Index = 0; Index < Data.output_frames_gen * NumChannels; Index++) + ResultOut[Index] = (lrintf(FloatOut[Index]) >> 24); + } + else if (BytesPerSample == 2) + { + PUSHORT Res = (PUSHORT)ResultOut; + + src_float_to_short_array(FloatOut, (short*)Res, Data.output_frames_gen * NumChannels); + } + else if (BytesPerSample == 4) + { + PULONG Res = (PULONG)ResultOut; + + src_float_to_int_array(FloatOut, (int*)Res, Data.output_frames_gen * NumChannels); + } + + + *Result = ResultOut; + *ResultLength = Data.output_frames_gen * BytesPerSample * NumChannels; + HeapFree(GetProcessHeap(), 0,FloatIn); + HeapFree(GetProcessHeap(), 0,FloatOut); + src_delete(State); + return ERROR_SUCCESS; +} + +DWORD +PerformChannelConversion( + PUCHAR Buffer, + ULONG BufferLength, + ULONG OldChannels, + ULONG NewChannels, + ULONG BitsPerSample, + PVOID * Result, + PULONG ResultLength) +{ + ULONG Samples; + ULONG NewIndex, OldIndex; + + Samples = BufferLength / (BitsPerSample / 8) / OldChannels; + + SND_TRACE(L"PerformChannelConversion OldChannels %u NewChannels %u\n", OldChannels, NewChannels); + + if (NewChannels > OldChannels) + { + if (BitsPerSample == 8) + { + PUCHAR BufferOut = HeapAlloc(GetProcessHeap(), 0, Samples * NewChannels); + if (!BufferOut) + return ERROR_NOT_ENOUGH_MEMORY; + + for(NewIndex = 0, OldIndex = 0; OldIndex < Samples * OldChannels; NewIndex += NewChannels, OldIndex += OldChannels) + { + ULONG SubIndex = 0; + + RtlMoveMemory(&BufferOut[NewIndex], &Buffer[OldIndex], OldChannels * sizeof(UCHAR)); + + do + { + /* 2 channel stretched to 4 looks like LRLR */ + BufferOut[NewIndex+OldChannels + SubIndex] = Buffer[OldIndex + (SubIndex % OldChannels)]; + }while(SubIndex++ < NewChannels - OldChannels); + } + *Result = BufferOut; + *ResultLength = Samples * NewChannels; + } + else if (BitsPerSample == 16) + { + PUSHORT BufferOut = HeapAlloc(GetProcessHeap(), 0, Samples * NewChannels); + if (!BufferOut) + return ERROR_NOT_ENOUGH_MEMORY; + + for(NewIndex = 0, OldIndex = 0; OldIndex < Samples * OldChannels; NewIndex += NewChannels, OldIndex += OldChannels) + { + ULONG SubIndex = 0; + + RtlMoveMemory(&BufferOut[NewIndex], &Buffer[OldIndex], OldChannels * sizeof(USHORT)); + + do + { + BufferOut[NewIndex+OldChannels + SubIndex] = Buffer[OldIndex + (SubIndex % OldChannels)]; + }while(SubIndex++ < NewChannels - OldChannels); + } + *Result = BufferOut; + *ResultLength = Samples * NewChannels; + } + else if (BitsPerSample == 24) + { + PUCHAR BufferOut = HeapAlloc(GetProcessHeap(), 0, Samples * NewChannels); + if (!BufferOut) + return ERROR_NOT_ENOUGH_MEMORY; + + for(NewIndex = 0, OldIndex = 0; OldIndex < Samples * OldChannels; NewIndex += NewChannels, OldIndex += OldChannels) + { + ULONG SubIndex = 0; + + RtlMoveMemory(&BufferOut[NewIndex], &Buffer[OldIndex], OldChannels * 3); + + do + { + RtlMoveMemory(&BufferOut[(NewIndex+OldChannels + SubIndex) * 3], &Buffer[(OldIndex + (SubIndex % OldChannels)) * 3], 3); + }while(SubIndex++ < NewChannels - OldChannels); + } + *Result = BufferOut; + *ResultLength = Samples * NewChannels; + } + else if (BitsPerSample == 32) + { + PULONG BufferOut = HeapAlloc(GetProcessHeap(), 0, Samples * NewChannels); + if (!BufferOut) + return ERROR_NOT_ENOUGH_MEMORY; + + for(NewIndex = 0, OldIndex = 0; OldIndex < Samples * OldChannels; NewIndex += NewChannels, OldIndex += OldChannels) + { + ULONG SubIndex = 0; + + RtlMoveMemory(&BufferOut[NewIndex], &Buffer[OldIndex], OldChannels * sizeof(ULONG)); + + do + { + BufferOut[NewIndex+OldChannels + SubIndex] = Buffer[OldIndex + (SubIndex % OldChannels)]; + }while(SubIndex++ < NewChannels - OldChannels); + } + *Result = BufferOut; + *ResultLength = Samples * NewChannels; + } + + } + else + { + PUSHORT BufferOut = HeapAlloc(GetProcessHeap(), 0, Samples * NewChannels); + if (!BufferOut) + return ERROR_NOT_ENOUGH_MEMORY; + + for(NewIndex = 0, OldIndex = 0; OldIndex < Samples * OldChannels; NewIndex += NewChannels, OldIndex += OldChannels) + { + /* TODO + * mix stream instead of just dumping part of it ;) + */ + RtlMoveMemory(&BufferOut[NewIndex], &Buffer[OldIndex], NewChannels * (BitsPerSample/8)); + } + + *Result = BufferOut; + *ResultLength = Samples * NewChannels; + } + return ERROR_SUCCESS; +} + + +DWORD +PerformQualityConversion( + PUCHAR Buffer, + ULONG BufferLength, + ULONG OldWidth, + ULONG NewWidth, + PVOID * Result, + PULONG ResultLength) +{ + ULONG Samples; + ULONG Index; + + ASSERT(OldWidth != NewWidth); + + Samples = BufferLength / (OldWidth / 8); + //DPRINT("Samples %u BufferLength %u\n", Samples, BufferLength); + + SND_TRACE(L"PerformQualityConversion OldWidth %u NewWidth %u\n", OldWidth, NewWidth); + + if (OldWidth == 8 && NewWidth == 16) + { + USHORT Sample; + PUSHORT BufferOut = HeapAlloc(GetProcessHeap(), 0, Samples * sizeof(USHORT)); + if (!BufferOut) + return ERROR_NOT_ENOUGH_MEMORY; + + for(Index = 0; Index < Samples; Index++) + { + Sample = Buffer[Index]; + Sample *= 2; +#ifdef _X86_ + Sample = _byteswap_ushort(Sample); +#endif + BufferOut[Index] = Sample; + } + *Result = BufferOut; + *ResultLength = Samples * sizeof(USHORT); + } + else if (OldWidth == 8 && NewWidth == 32) + { + ULONG Sample; + PULONG BufferOut = HeapAlloc(GetProcessHeap(), 0, Samples * sizeof(ULONG)); + if (!BufferOut) + return ERROR_NOT_ENOUGH_MEMORY; + + for(Index = 0; Index < Samples; Index++) + { + Sample = Buffer[Index]; + Sample *= 16777216; +#ifdef _X86_ + Sample = _byteswap_ulong(Sample); +#endif + BufferOut[Index] = Sample; + } + *Result = BufferOut; + *ResultLength = Samples * sizeof(ULONG); + } + else if (OldWidth == 16 && NewWidth == 32) + { + ULONG Sample; + PUSHORT BufferIn = (PUSHORT)Buffer; + PULONG BufferOut = HeapAlloc(GetProcessHeap(), 0, Samples * sizeof(ULONG)); + if (!BufferOut) + return ERROR_NOT_ENOUGH_MEMORY; + + for(Index = 0; Index < Samples; Index++) + { + Sample = BufferIn[Index]; + Sample *= 65536; +#ifdef _X86_ + Sample = _byteswap_ulong(Sample); +#endif + BufferOut[Index] = Sample; + } + *Result = BufferOut; + *ResultLength = Samples * sizeof(ULONG); + } + + else if (OldWidth == 16 && NewWidth == 8) + { + USHORT Sample; + PUSHORT BufferIn = (PUSHORT)Buffer; + PUCHAR BufferOut = HeapAlloc(GetProcessHeap(), 0, Samples * sizeof(UCHAR)); + if (!BufferOut) + return ERROR_NOT_ENOUGH_MEMORY; + + for(Index = 0; Index < Samples; Index++) + { + Sample = BufferIn[Index]; +#ifdef _X86_ + Sample = _byteswap_ushort(Sample); +#endif + Sample /= 256; + BufferOut[Index] = (Sample & 0xFF); + } + *Result = BufferOut; + *ResultLength = Samples * sizeof(UCHAR); + } + else if (OldWidth == 32 && NewWidth == 8) + { + ULONG Sample; + PULONG BufferIn = (PULONG)Buffer; + PUCHAR BufferOut = HeapAlloc(GetProcessHeap(), 0, Samples * sizeof(UCHAR)); + if (!BufferOut) + return ERROR_NOT_ENOUGH_MEMORY; + + for(Index = 0; Index < Samples; Index++) + { + Sample = BufferIn[Index]; +#ifdef _X86_ + Sample = _byteswap_ulong(Sample); +#endif + Sample /= 16777216; + BufferOut[Index] = (Sample & 0xFF); + } + *Result = BufferOut; + *ResultLength = Samples * sizeof(UCHAR); + } + else if (OldWidth == 32 && NewWidth == 16) + { + USHORT Sample; + PULONG BufferIn = (PULONG)Buffer; + PUSHORT BufferOut = HeapAlloc(GetProcessHeap(), 0, Samples * sizeof(USHORT)); + if (!BufferOut) + return ERROR_NOT_ENOUGH_MEMORY; + + for(Index = 0; Index < Samples; Index++) + { + Sample = BufferIn[Index]; +#ifdef _X86_ + Sample = _byteswap_ulong(Sample); +#endif + Sample /= 65536; + BufferOut[Index] = (Sample & 0xFFFF); + } + *Result = BufferOut; + *ResultLength = Samples * sizeof(USHORT); + } + else + { + DPRINT1("Not implemented conversion OldWidth %u NewWidth %u\n", OldWidth, NewWidth); + return ERROR_NOT_SUPPORTED; + } + + return ERROR_SUCCESS; +} + +VOID +CALLBACK +MixerCompletionRoutine( + IN DWORD dwErrorCode, + IN DWORD dwNumberOfBytesTransferred, + IN LPOVERLAPPED lpOverlapped) +{ + PSOUND_OVERLAPPED Overlap = (PSOUND_OVERLAPPED)lpOverlapped; + + /* Call mmebuddy overlap routine */ + Overlap->OriginalCompletionRoutine(dwErrorCode, Overlap->OriginalBufferSize, lpOverlapped); +} + +MMRESULT +WriteFileEx_Remixer( + IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, + IN PVOID OffsetPtr, + IN DWORD Length, + IN PSOUND_OVERLAPPED Overlap, + IN LPOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine) +{ + HANDLE Handle; + WDMAUD_DEVICE_INFO DeviceInfo; + DWORD BufferLength, BufferLengthTemp; + PVOID BufferOut, BufferOutTemp; + DWORD Status; + BOOL Result; + + VALIDATE_MMSYS_PARAMETER( SoundDeviceInstance ); + VALIDATE_MMSYS_PARAMETER( OffsetPtr ); + VALIDATE_MMSYS_PARAMETER( Overlap ); + VALIDATE_MMSYS_PARAMETER( CompletionRoutine ); + + GetSoundDeviceInstanceHandle(SoundDeviceInstance, &Handle); + + SND_ASSERT(Handle); + + BufferOut = OffsetPtr; + BufferLength = Length; + + if (SoundDeviceInstance->WaveFormatEx.wBitsPerSample != 16) + { + Status = PerformQualityConversion(OffsetPtr, + Length, + SoundDeviceInstance->WaveFormatEx.wBitsPerSample, + 16, + &BufferOut, + &BufferLength); + if (Status) + { + SND_TRACE(L"PerformQualityConversion failed\n"); + return MMSYSERR_NOERROR; + } + } + + if (SoundDeviceInstance->WaveFormatEx.nChannels != 2) + { + Status = PerformChannelConversion(BufferOut, + BufferLength, + SoundDeviceInstance->WaveFormatEx.nChannels, + 2, + 16, + &BufferOutTemp, + &BufferLengthTemp); + + if (BufferOut != OffsetPtr) + { + HeapFree(GetProcessHeap(), 0, BufferOut); + } + + if (Status) + { + SND_TRACE(L"PerformChannelConversion failed\n"); + return MMSYSERR_NOERROR; + } + + BufferOut = BufferOutTemp; + BufferLength = BufferLengthTemp; + } + + if (SoundDeviceInstance->WaveFormatEx.nSamplesPerSec != 44100) + { + Status = PerformSampleRateConversion(BufferOut, + BufferLength, + SoundDeviceInstance->WaveFormatEx.nSamplesPerSec, + 44100, + 2, + 2, + &BufferOutTemp, + &BufferLengthTemp); + + if (BufferOut != OffsetPtr) + { + HeapFree(GetProcessHeap(), 0, BufferOut); + } + + if (Status) + { + SND_TRACE(L"PerformSampleRateConversion failed\n"); + return MMSYSERR_NOERROR; + } + + BufferOut = BufferOutTemp; + BufferLength = BufferLengthTemp; + } + + ZeroMemory(&DeviceInfo, sizeof(WDMAUD_DEVICE_INFO)); + DeviceInfo.hDevice = Handle; + DeviceInfo.DeviceType = WAVE_OUT_DEVICE_TYPE; //FIXME + DeviceInfo.Buffer = BufferOut; + DeviceInfo.BufferSize = BufferLength; + + Overlap->OriginalBufferSize = Length; + Overlap->OriginalCompletionRoutine = CompletionRoutine; + + Overlap->Standard.hEvent = CreateEventW(NULL, FALSE, FALSE, NULL); + + //SND_TRACE(L"OriginalLength %u NewLength %u\n", Length, BufferLength); + +#if 0 + Result = WriteFileEx(KernelHandle, &DeviceInfo, sizeof(WDMAUD_DEVICE_INFO), (LPOVERLAPPED)Overlap, CompletionRoutine); +#else + Result = WriteFileEx(KernelHandle, &DeviceInfo, sizeof(WDMAUD_DEVICE_INFO), (LPOVERLAPPED)Overlap, MixerCompletionRoutine); +#endif + + if ( ! Result ) + { + SND_TRACE(L"WriteFileEx failed with %x\n", GetLastError()); + return MMSYSERR_NOERROR; + } + + WaitForSingleObjectEx (KernelHandle, INFINITE, TRUE); + +#ifdef USERMODE_MIXER + // if (BufferOut != OffsetPtr) + // HeapFree(GetProcessHeap(), 0, BufferOut); +#endif + + + return MMSYSERR_NOERROR; +} Propchange: trunk/reactos/dll/win32/wdmaud.drv/mixer.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/dll/win32/wdmaud.drv/wdmaud.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wdmaud.drv/wdmau…
============================================================================== --- trunk/reactos/dll/win32/wdmaud.drv/wdmaud.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/wdmaud.drv/wdmaud.c [iso-8859-1] Mon Aug 17 15:49:19 2009 @@ -32,6 +32,15 @@ HANDLE KernelHandle = INVALID_HANDLE_VALUE; DWORD OpenCount = 0; +MMRESULT +WriteFileEx_Remixer( + IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, + IN PVOID OffsetPtr, + IN DWORD Length, + IN PSOUND_OVERLAPPED Overlap, + IN LPOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine); + + MMRESULT GetNumWdmDevs( @@ -288,11 +297,19 @@ DeviceInfo.DeviceIndex = DeviceId; DeviceInfo.u.WaveFormatEx.cbSize = WaveFormat->cbSize; DeviceInfo.u.WaveFormatEx.wFormatTag = WaveFormat->wFormatTag; +#ifdef USERMODE_MIXER + DeviceInfo.u.WaveFormatEx.nChannels = 2; + DeviceInfo.u.WaveFormatEx.nSamplesPerSec = 44100; + DeviceInfo.u.WaveFormatEx.nBlockAlign = 4; + DeviceInfo.u.WaveFormatEx.nAvgBytesPerSec = 176400; + DeviceInfo.u.WaveFormatEx.wBitsPerSample = 16; +#else DeviceInfo.u.WaveFormatEx.nChannels = WaveFormat->nChannels; DeviceInfo.u.WaveFormatEx.nSamplesPerSec = WaveFormat->nSamplesPerSec; DeviceInfo.u.WaveFormatEx.nBlockAlign = WaveFormat->nBlockAlign; DeviceInfo.u.WaveFormatEx.nAvgBytesPerSec = WaveFormat->nAvgBytesPerSec; DeviceInfo.u.WaveFormatEx.wBitsPerSample = WaveFormat->wBitsPerSample; +#endif Result = SyncOverlappedDeviceIoControl(KernelHandle, IOCTL_OPEN_WDMAUD, @@ -307,6 +324,16 @@ return TranslateInternalMmResult(Result); } + /* Store format */ + Instance->WaveFormatEx.cbSize = WaveFormat->cbSize; + Instance->WaveFormatEx.wFormatTag = WaveFormat->wFormatTag; + Instance->WaveFormatEx.nChannels = WaveFormat->nChannels; + Instance->WaveFormatEx.nSamplesPerSec = WaveFormat->nSamplesPerSec; + Instance->WaveFormatEx.nBlockAlign = WaveFormat->nBlockAlign; + Instance->WaveFormatEx.nAvgBytesPerSec = WaveFormat->nAvgBytesPerSec; + Instance->WaveFormatEx.wBitsPerSample = WaveFormat->wBitsPerSample; + + /* Store sound device handle instance handle */ Instance->Handle = (PVOID)DeviceInfo.hDevice; /* Now determine framing requirements */ @@ -473,7 +500,11 @@ FuncTable.SetWaveFormat = SetWdmWaveDeviceFormat; FuncTable.Open = OpenWdmSoundDevice; FuncTable.Close = CloseWdmSoundDevice; +#ifndef USERMODE_MIXER FuncTable.CommitWaveBuffer = WriteFileEx_Committer2; +#else + FuncTable.CommitWaveBuffer = WriteFileEx_Remixer; +#endif FuncTable.GetPos = GetWdmPosition; SetSoundDeviceFunctionTable(SoundDevice, &FuncTable); Modified: trunk/reactos/dll/win32/wdmaud.drv/wdmaud.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wdmaud.drv/wdmau…
============================================================================== --- trunk/reactos/dll/win32/wdmaud.drv/wdmaud.rbuild [iso-8859-1] (original) +++ trunk/reactos/dll/win32/wdmaud.drv/wdmaud.rbuild [iso-8859-1] Mon Aug 17 15:49:19 2009 @@ -3,13 +3,18 @@ <include base="wdmaud.drv">.</include> <include base="ReactOS">include/reactos/libs/sound</include> <include base="wdmaud_kernel">.</include> + <include base="libsamplerate">.</include> <define name="DEBUG_NT4" /><!-- Use custom debug routines --> + <!-- <define name="USERMODE_MIXER" /> Enable this line to for usermode mixing support --> <library>mmebuddy</library> <library>ntdll</library> <library>kernel32</library> <library>user32</library> <library>winmm</library> <library>advapi32</library> + <library>libsamplerate</library> + <library>msvcrt</library> <file>wdmaud.c</file> + <file>mixer.c</file> <file>wdmaud.rc</file> </module>
15 years, 4 months
1
0
0
0
← Newer
1
...
19
20
21
22
23
24
25
...
66
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
Results per page:
10
25
50
100
200