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
June 2013
----- 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
14 participants
274 discussions
Start a n
N
ew thread
[akhaldi] 59324: [WBEMPROX] * Import from Wine 1.5.26
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sun Jun 23 20:41:42 2013 New Revision: 59324 URL:
http://svn.reactos.org/svn/reactos?rev=59324&view=rev
Log: [WBEMPROX] * Import from Wine 1.5.26 Added: trunk/reactos/dll/win32/wbemprox/ trunk/reactos/dll/win32/wbemprox/CMakeLists.txt (with props) trunk/reactos/dll/win32/wbemprox/builtin.c (with props) trunk/reactos/dll/win32/wbemprox/class.c (with props) trunk/reactos/dll/win32/wbemprox/main.c (with props) trunk/reactos/dll/win32/wbemprox/process.c (with props) trunk/reactos/dll/win32/wbemprox/qualifier.c (with props) trunk/reactos/dll/win32/wbemprox/query.c (with props) trunk/reactos/dll/win32/wbemprox/reg.c (with props) trunk/reactos/dll/win32/wbemprox/service.c (with props) trunk/reactos/dll/win32/wbemprox/services.c (with props) trunk/reactos/dll/win32/wbemprox/table.c (with props) trunk/reactos/dll/win32/wbemprox/wbemlocator.c (with props) trunk/reactos/dll/win32/wbemprox/wbemprox.idl (with props) trunk/reactos/dll/win32/wbemprox/wbemprox.rc (with props) trunk/reactos/dll/win32/wbemprox/wbemprox.rgs (with props) trunk/reactos/dll/win32/wbemprox/wbemprox.spec (with props) trunk/reactos/dll/win32/wbemprox/wbemprox_private.h (with props) trunk/reactos/dll/win32/wbemprox/wql.tab.c (with props) trunk/reactos/dll/win32/wbemprox/wql.y (with props) trunk/reactos/include/psdk/d3d10.idl (with props) trunk/reactos/include/psdk/d3d10effect.h (with props) trunk/reactos/include/psdk/d3d10misc.h (with props) trunk/reactos/include/psdk/d3d10shader.h (with props) trunk/reactos/include/psdk/d3dcommon.idl (with props) trunk/reactos/include/psdk/wbemprov.idl (with props) Modified: trunk/reactos/boot/bootdata/packages/reactos.dff.in trunk/reactos/cmake/CMakeMacros.cmake trunk/reactos/dll/win32/CMakeLists.txt trunk/reactos/include/psdk/CMakeLists.txt trunk/reactos/include/psdk/ipifcons.h trunk/reactos/include/psdk/iptypes.h trunk/reactos/include/psdk/wbemcli.idl trunk/reactos/include/psdk/winternl.h trunk/reactos/media/doc/README.WINE trunk/reactos/media/inf/syssetup.inf [This mail would be too long, it was shortened to contain the URLs only.] Modified: trunk/reactos/boot/bootdata/packages/reactos.dff.in URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/packages/rea…
Modified: trunk/reactos/cmake/CMakeMacros.cmake URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/cmake/CMakeMacros.cmake?re…
Modified: trunk/reactos/dll/win32/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/CMakeLists.txt?r…
Added: trunk/reactos/dll/win32/wbemprox/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wbemprox/CMakeLi…
Added: trunk/reactos/dll/win32/wbemprox/builtin.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wbemprox/builtin…
Added: trunk/reactos/dll/win32/wbemprox/class.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wbemprox/class.c…
Added: trunk/reactos/dll/win32/wbemprox/main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wbemprox/main.c?…
Added: trunk/reactos/dll/win32/wbemprox/process.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wbemprox/process…
Added: trunk/reactos/dll/win32/wbemprox/qualifier.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wbemprox/qualifi…
Added: trunk/reactos/dll/win32/wbemprox/query.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wbemprox/query.c…
Added: trunk/reactos/dll/win32/wbemprox/reg.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wbemprox/reg.c?r…
Added: trunk/reactos/dll/win32/wbemprox/service.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wbemprox/service…
Added: trunk/reactos/dll/win32/wbemprox/services.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wbemprox/service…
Added: trunk/reactos/dll/win32/wbemprox/table.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wbemprox/table.c…
Added: trunk/reactos/dll/win32/wbemprox/wbemlocator.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wbemprox/wbemloc…
Added: trunk/reactos/dll/win32/wbemprox/wbemprox.idl URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wbemprox/wbempro…
Added: trunk/reactos/dll/win32/wbemprox/wbemprox.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wbemprox/wbempro…
Added: trunk/reactos/dll/win32/wbemprox/wbemprox.rgs URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wbemprox/wbempro…
Added: trunk/reactos/dll/win32/wbemprox/wbemprox.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wbemprox/wbempro…
Added: trunk/reactos/dll/win32/wbemprox/wbemprox_private.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wbemprox/wbempro…
Added: trunk/reactos/dll/win32/wbemprox/wql.tab.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wbemprox/wql.tab…
Added: trunk/reactos/dll/win32/wbemprox/wql.y URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wbemprox/wql.y?r…
Modified: trunk/reactos/include/psdk/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/CMakeLists.tx…
Added: trunk/reactos/include/psdk/d3d10.idl URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/d3d10.idl?rev…
Added: trunk/reactos/include/psdk/d3d10effect.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/d3d10effect.h…
Added: trunk/reactos/include/psdk/d3d10misc.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/d3d10misc.h?r…
Added: trunk/reactos/include/psdk/d3d10shader.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/d3d10shader.h…
Added: trunk/reactos/include/psdk/d3dcommon.idl URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/d3dcommon.idl…
Modified: trunk/reactos/include/psdk/ipifcons.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/ipifcons.h?re…
Modified: trunk/reactos/include/psdk/iptypes.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/iptypes.h?rev…
Modified: trunk/reactos/include/psdk/wbemcli.idl URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/wbemcli.idl?r…
Added: trunk/reactos/include/psdk/wbemprov.idl URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/wbemprov.idl?…
Modified: trunk/reactos/include/psdk/winternl.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winternl.h?re…
Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
Modified: trunk/reactos/media/inf/syssetup.inf URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/inf/syssetup.inf?rev…
11 years, 6 months
1
0
0
0
[akhaldi] 59323: [DXGI] * Import from Wine 1.5.26.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sun Jun 23 19:14:50 2013 New Revision: 59323 URL:
http://svn.reactos.org/svn/reactos?rev=59323&view=rev
Log: [DXGI] * Import from Wine 1.5.26. Added: trunk/reactos/dll/directx/dxgi/ trunk/reactos/dll/directx/dxgi/CMakeLists.txt (with props) trunk/reactos/dll/directx/dxgi/adapter.c (with props) trunk/reactos/dll/directx/dxgi/device.c (with props) trunk/reactos/dll/directx/dxgi/dxgi.spec (with props) trunk/reactos/dll/directx/dxgi/dxgi_main.c (with props) trunk/reactos/dll/directx/dxgi/dxgi_private.h (with props) trunk/reactos/dll/directx/dxgi/factory.c (with props) trunk/reactos/dll/directx/dxgi/output.c (with props) trunk/reactos/dll/directx/dxgi/surface.c (with props) trunk/reactos/dll/directx/dxgi/swapchain.c (with props) trunk/reactos/dll/directx/dxgi/utils.c (with props) trunk/reactos/dll/directx/dxgi/version.rc (with props) trunk/reactos/include/psdk/dxgi.idl (with props) trunk/reactos/include/psdk/dxgiformat.h (with props) trunk/reactos/include/psdk/dxgitype.h (with props) trunk/reactos/include/reactos/wine/winedxgi.idl (with props) Modified: trunk/reactos/dll/directx/CMakeLists.txt trunk/reactos/include/psdk/CMakeLists.txt trunk/reactos/include/reactos/wine/CMakeLists.txt trunk/reactos/media/doc/README.WINE [This mail would be too long, it was shortened to contain the URLs only.] Modified: trunk/reactos/dll/directx/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/CMakeLists.txt…
Added: trunk/reactos/dll/directx/dxgi/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/dxgi/CMakeList…
Added: trunk/reactos/dll/directx/dxgi/adapter.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/dxgi/adapter.c…
Added: trunk/reactos/dll/directx/dxgi/device.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/dxgi/device.c?…
Added: trunk/reactos/dll/directx/dxgi/dxgi.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/dxgi/dxgi.spec…
Added: trunk/reactos/dll/directx/dxgi/dxgi_main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/dxgi/dxgi_main…
Added: trunk/reactos/dll/directx/dxgi/dxgi_private.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/dxgi/dxgi_priv…
Added: trunk/reactos/dll/directx/dxgi/factory.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/dxgi/factory.c…
Added: trunk/reactos/dll/directx/dxgi/output.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/dxgi/output.c?…
Added: trunk/reactos/dll/directx/dxgi/surface.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/dxgi/surface.c…
Added: trunk/reactos/dll/directx/dxgi/swapchain.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/dxgi/swapchain…
Added: trunk/reactos/dll/directx/dxgi/utils.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/dxgi/utils.c?r…
Added: trunk/reactos/dll/directx/dxgi/version.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/dxgi/version.r…
Modified: trunk/reactos/include/psdk/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/CMakeLists.tx…
Added: trunk/reactos/include/psdk/dxgi.idl URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/dxgi.idl?rev=…
Added: trunk/reactos/include/psdk/dxgiformat.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/dxgiformat.h?…
Added: trunk/reactos/include/psdk/dxgitype.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/dxgitype.h?re…
Modified: trunk/reactos/include/reactos/wine/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/wine/CMake…
Added: trunk/reactos/include/reactos/wine/winedxgi.idl URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/wine/wined…
Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
11 years, 6 months
1
0
0
0
[hbelusca] 59322: [CONSRV] Finish to move some text functions to condrv.
by hbelusca@svn.reactos.org
Author: hbelusca Date: Sun Jun 23 18:20:39 2013 New Revision: 59322 URL:
http://svn.reactos.org/svn/reactos?rev=59322&view=rev
Log: [CONSRV] Finish to move some text functions to condrv. Modified: trunk/reactos/win32ss/user/consrv/condrv/text.c trunk/reactos/win32ss/user/consrv/conoutput.c Modified: trunk/reactos/win32ss/user/consrv/condrv/text.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/consrv/condrv…
============================================================================== --- trunk/reactos/win32ss/user/consrv/condrv/text.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/consrv/condrv/text.c [iso-8859-1] Sun Jun 23 18:20:39 2013 @@ -438,7 +438,7 @@ } static VOID FASTCALL -ConioNextLine(PTEXTMODE_SCREEN_BUFFER Buff, SMALL_RECT* UpdateRect, UINT *ScrolledLines) +ConioNextLine(PTEXTMODE_SCREEN_BUFFER Buff, PSMALL_RECT UpdateRect, PUINT ScrolledLines) { /* If we hit bottom, slide the viewable screen */ if (++Buff->CursorPosition.Y == Buff->ScreenBufferSize.Y) @@ -1099,157 +1099,144 @@ return STATUS_SUCCESS; } - - -CSR_API(SrvGetConsoleScreenBufferInfo) +NTSTATUS NTAPI +ConDrvGetConsoleScreenBufferInfo(IN PCONSOLE Console, + IN PTEXTMODE_SCREEN_BUFFER Buffer, + OUT PCONSOLE_SCREEN_BUFFER_INFO ScreenBufferInfo) +{ + if (Console == NULL || Buffer == NULL || ScreenBufferInfo == NULL) + return STATUS_INVALID_PARAMETER; + + /* Validity check */ + ASSERT(Console == Buffer->Header.Console); + + ScreenBufferInfo->dwSize = Buffer->ScreenBufferSize; + ScreenBufferInfo->dwCursorPosition = Buffer->CursorPosition; + ScreenBufferInfo->wAttributes = Buffer->ScreenDefaultAttrib; + ScreenBufferInfo->srWindow.Left = Buffer->ViewOrigin.X; + ScreenBufferInfo->srWindow.Top = Buffer->ViewOrigin.Y; + ScreenBufferInfo->srWindow.Right = Buffer->ViewOrigin.X + Buffer->ViewSize.X - 1; + ScreenBufferInfo->srWindow.Bottom = Buffer->ViewOrigin.Y + Buffer->ViewSize.Y - 1; + + // FIXME: Refine the computation + ScreenBufferInfo->dwMaximumWindowSize = Buffer->ScreenBufferSize; + + return STATUS_SUCCESS; +} + +NTSTATUS NTAPI +ConDrvSetConsoleTextAttribute(IN PCONSOLE Console, + IN PTEXTMODE_SCREEN_BUFFER Buffer, + IN WORD Attribute) +{ + if (Console == NULL || Buffer == NULL) + return STATUS_INVALID_PARAMETER; + + /* Validity check */ + ASSERT(Console == Buffer->Header.Console); + + Buffer->ScreenDefaultAttrib = Attribute; + return STATUS_SUCCESS; +} + +NTSTATUS NTAPI +ConDrvSetConsoleScreenBufferSize(IN PCONSOLE Console, + IN PTEXTMODE_SCREEN_BUFFER Buffer, + IN PCOORD Size) { NTSTATUS Status; - PCONSOLE_GETSCREENBUFFERINFO ScreenBufferInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ScreenBufferInfoRequest; - // PCONSOLE Console; - PTEXTMODE_SCREEN_BUFFER Buff; - PCONSOLE_SCREEN_BUFFER_INFO pInfo = &ScreenBufferInfoRequest->Info; - - DPRINT("SrvGetConsoleScreenBufferInfo\n"); - - Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), ScreenBufferInfoRequest->OutputHandle, &Buff, GENERIC_READ, TRUE); - if (!NT_SUCCESS(Status)) return Status; - - // Console = Buff->Header.Console; - - pInfo->dwSize = Buff->ScreenBufferSize; - pInfo->dwCursorPosition = Buff->CursorPosition; - pInfo->wAttributes = Buff->ScreenDefaultAttrib; - pInfo->srWindow.Left = Buff->ViewOrigin.X; - pInfo->srWindow.Top = Buff->ViewOrigin.Y; - pInfo->srWindow.Right = Buff->ViewOrigin.X + Buff->ViewSize.X - 1; - pInfo->srWindow.Bottom = Buff->ViewOrigin.Y + Buff->ViewSize.Y - 1; - pInfo->dwMaximumWindowSize = Buff->ScreenBufferSize; // TODO: Refine the computation - - ConSrvReleaseScreenBuffer(Buff, TRUE); - return STATUS_SUCCESS; -} - -CSR_API(SrvSetConsoleTextAttribute) -{ - NTSTATUS Status; - PCONSOLE_SETTEXTATTRIB SetTextAttribRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetTextAttribRequest; - PTEXTMODE_SCREEN_BUFFER Buff; - - DPRINT("SrvSetConsoleTextAttribute\n"); - - Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), SetTextAttribRequest->OutputHandle, &Buff, GENERIC_WRITE, TRUE); - if (!NT_SUCCESS(Status)) return Status; - - Buff->ScreenDefaultAttrib = SetTextAttribRequest->Attrib; - - ConSrvReleaseScreenBuffer(Buff, TRUE); - return STATUS_SUCCESS; -} - -CSR_API(SrvSetConsoleScreenBufferSize) -{ - NTSTATUS Status; - PCONSOLE_SETSCREENBUFFERSIZE SetScreenBufferSizeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetScreenBufferSizeRequest; - PCONSOLE Console; - PTEXTMODE_SCREEN_BUFFER Buff; - - Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), SetScreenBufferSizeRequest->OutputHandle, &Buff, GENERIC_WRITE, TRUE); - if (!NT_SUCCESS(Status)) return Status; - - Console = Buff->Header.Console; - - Status = ConioResizeBuffer(Console, Buff, SetScreenBufferSizeRequest->Size); + + if (Console == NULL || Buffer == NULL || Size == NULL) + return STATUS_INVALID_PARAMETER; + + /* Validity check */ + ASSERT(Console == Buffer->Header.Console); + + Status = ConioResizeBuffer(Console, Buffer, *Size); if (NT_SUCCESS(Status)) ConioResizeTerminal(Console); - ConSrvReleaseScreenBuffer(Buff, TRUE); return Status; } -CSR_API(SrvScrollConsoleScreenBuffer) -{ - PCONSOLE_SCROLLSCREENBUFFER ScrollScreenBufferRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ScrollScreenBufferRequest; - PCONSOLE Console; - PTEXTMODE_SCREEN_BUFFER Buff; +NTSTATUS NTAPI +ConDrvScrollConsoleScreenBuffer(IN PCONSOLE Console, + IN PTEXTMODE_SCREEN_BUFFER Buffer, + IN BOOL Unicode, + IN PSMALL_RECT ScrollRectangle, + IN BOOL UseClipRectangle, + IN PSMALL_RECT ClipRectangle OPTIONAL, + IN PCOORD DestinationOrigin, + IN CHAR_INFO FillChar) +{ + COORD CapturedDestinationOrigin; SMALL_RECT ScreenBuffer; SMALL_RECT SrcRegion; SMALL_RECT DstRegion; SMALL_RECT UpdateRegion; - SMALL_RECT ScrollRectangle; - SMALL_RECT ClipRectangle; - NTSTATUS Status; - HANDLE OutputHandle; - BOOLEAN UseClipRectangle; - COORD DestinationOrigin; - CHAR_INFO FillChar; - - DPRINT("SrvScrollConsoleScreenBuffer\n"); - - OutputHandle = ScrollScreenBufferRequest->OutputHandle; - UseClipRectangle = ScrollScreenBufferRequest->UseClipRectangle; - DestinationOrigin = ScrollScreenBufferRequest->DestinationOrigin; - FillChar = ScrollScreenBufferRequest->Fill; - - Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), OutputHandle, &Buff, GENERIC_WRITE, TRUE); - if (!NT_SUCCESS(Status)) return Status; - - Console = Buff->Header.Console; - - ScrollRectangle = ScrollScreenBufferRequest->ScrollRectangle; - - /* Make sure source rectangle is inside the screen buffer */ - ConioInitRect(&ScreenBuffer, 0, 0, Buff->ScreenBufferSize.Y - 1, Buff->ScreenBufferSize.X - 1); - if (!ConioGetIntersection(&SrcRegion, &ScreenBuffer, &ScrollRectangle)) - { - ConSrvReleaseScreenBuffer(Buff, TRUE); + SMALL_RECT CapturedClipRectangle; + + if (Console == NULL || Buffer == NULL || ScrollRectangle == NULL || + (UseClipRectangle ? ClipRectangle == NULL : FALSE) || DestinationOrigin == NULL) + { + return STATUS_INVALID_PARAMETER; + } + + /* Validity check */ + ASSERT(Console == Buffer->Header.Console); + + CapturedDestinationOrigin = *DestinationOrigin; + + /* Make sure the source rectangle is inside the screen buffer */ + ConioInitRect(&ScreenBuffer, 0, 0, Buffer->ScreenBufferSize.Y - 1, Buffer->ScreenBufferSize.X - 1); + if (!ConioGetIntersection(&SrcRegion, &ScreenBuffer, ScrollRectangle)) + { return STATUS_SUCCESS; } /* If the source was clipped on the left or top, adjust the destination accordingly */ - if (ScrollRectangle.Left < 0) - { - DestinationOrigin.X -= ScrollRectangle.Left; - } - if (ScrollRectangle.Top < 0) - { - DestinationOrigin.Y -= ScrollRectangle.Top; + if (ScrollRectangle->Left < 0) + { + CapturedDestinationOrigin.X -= ScrollRectangle->Left; + } + if (ScrollRectangle->Top < 0) + { + CapturedDestinationOrigin.Y -= ScrollRectangle->Top; } if (UseClipRectangle) { - ClipRectangle = ScrollScreenBufferRequest->ClipRectangle; - if (!ConioGetIntersection(&ClipRectangle, &ClipRectangle, &ScreenBuffer)) - { - ConSrvReleaseScreenBuffer(Buff, TRUE); + CapturedClipRectangle = *ClipRectangle; + if (!ConioGetIntersection(&CapturedClipRectangle, &CapturedClipRectangle, &ScreenBuffer)) + { return STATUS_SUCCESS; } } else { - ClipRectangle = ScreenBuffer; + CapturedClipRectangle = ScreenBuffer; } ConioInitRect(&DstRegion, - DestinationOrigin.Y, - DestinationOrigin.X, - DestinationOrigin.Y + ConioRectHeight(&SrcRegion) - 1, - DestinationOrigin.X + ConioRectWidth(&SrcRegion) - 1); - - if (!ScrollScreenBufferRequest->Unicode) + CapturedDestinationOrigin.Y, + CapturedDestinationOrigin.X, + CapturedDestinationOrigin.Y + ConioRectHeight(&SrcRegion) - 1, + CapturedDestinationOrigin.X + ConioRectWidth(&SrcRegion ) - 1); + + if (!Unicode) ConsoleAnsiCharToUnicodeChar(Console, &FillChar.Char.UnicodeChar, &FillChar.Char.AsciiChar); - ConioMoveRegion(Buff, &SrcRegion, &DstRegion, &ClipRectangle, FillChar); - - if ((PCONSOLE_SCREEN_BUFFER)Buff == Console->ActiveBuffer) + ConioMoveRegion(Buffer, &SrcRegion, &DstRegion, &CapturedClipRectangle, FillChar); + + if ((PCONSOLE_SCREEN_BUFFER)Buffer == Console->ActiveBuffer) { ConioGetUnion(&UpdateRegion, &SrcRegion, &DstRegion); - if (ConioGetIntersection(&UpdateRegion, &UpdateRegion, &ClipRectangle)) + if (ConioGetIntersection(&UpdateRegion, &UpdateRegion, &CapturedClipRectangle)) { /* Draw update region */ ConioDrawRegion(Console, &UpdateRegion); } } - ConSrvReleaseScreenBuffer(Buff, TRUE); return STATUS_SUCCESS; } Modified: trunk/reactos/win32ss/user/consrv/conoutput.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/consrv/conout…
============================================================================== --- trunk/reactos/win32ss/user/consrv/conoutput.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/consrv/conoutput.c [iso-8859-1] Sun Jun 23 18:20:39 2013 @@ -684,160 +684,114 @@ return Status; } -#if 0000 - +NTSTATUS NTAPI +ConDrvGetConsoleScreenBufferInfo(IN PCONSOLE Console, + IN PTEXTMODE_SCREEN_BUFFER Buffer, + OUT PCONSOLE_SCREEN_BUFFER_INFO ScreenBufferInfo); CSR_API(SrvGetConsoleScreenBufferInfo) { NTSTATUS Status; PCONSOLE_GETSCREENBUFFERINFO ScreenBufferInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ScreenBufferInfoRequest; - // PCONSOLE Console; - PTEXTMODE_SCREEN_BUFFER Buff; - PCONSOLE_SCREEN_BUFFER_INFO pInfo = &ScreenBufferInfoRequest->Info; + PTEXTMODE_SCREEN_BUFFER Buffer; DPRINT("SrvGetConsoleScreenBufferInfo\n"); - Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), ScreenBufferInfoRequest->OutputHandle, &Buff, GENERIC_READ, TRUE); - if (!NT_SUCCESS(Status)) return Status; - - // Console = Buff->Header.Console; - - pInfo->dwSize = Buff->ScreenBufferSize; - pInfo->dwCursorPosition = Buff->CursorPosition; - pInfo->wAttributes = Buff->ScreenDefaultAttrib; - pInfo->srWindow.Left = Buff->ViewOrigin.X; - pInfo->srWindow.Top = Buff->ViewOrigin.Y; - pInfo->srWindow.Right = Buff->ViewOrigin.X + Buff->ViewSize.X - 1; - pInfo->srWindow.Bottom = Buff->ViewOrigin.Y + Buff->ViewSize.Y - 1; - pInfo->dwMaximumWindowSize = Buff->ScreenBufferSize; // TODO: Refine the computation - - ConSrvReleaseScreenBuffer(Buff, TRUE); - return STATUS_SUCCESS; -} - + Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), + ScreenBufferInfoRequest->OutputHandle, + &Buffer, GENERIC_READ, TRUE); + if (!NT_SUCCESS(Status)) return Status; + + Status = ConDrvGetConsoleScreenBufferInfo(Buffer->Header.Console, + Buffer, + &ScreenBufferInfoRequest->Info); + + ConSrvReleaseScreenBuffer(Buffer, TRUE); + return Status; +} + +NTSTATUS NTAPI +ConDrvSetConsoleTextAttribute(IN PCONSOLE Console, + IN PTEXTMODE_SCREEN_BUFFER Buffer, + IN WORD Attribute); CSR_API(SrvSetConsoleTextAttribute) { NTSTATUS Status; PCONSOLE_SETTEXTATTRIB SetTextAttribRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetTextAttribRequest; - PTEXTMODE_SCREEN_BUFFER Buff; + PTEXTMODE_SCREEN_BUFFER Buffer; DPRINT("SrvSetConsoleTextAttribute\n"); - Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), SetTextAttribRequest->OutputHandle, &Buff, GENERIC_WRITE, TRUE); - if (!NT_SUCCESS(Status)) return Status; - - Buff->ScreenDefaultAttrib = SetTextAttribRequest->Attrib; - - ConSrvReleaseScreenBuffer(Buff, TRUE); - return STATUS_SUCCESS; -} - + Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), + SetTextAttribRequest->OutputHandle, + &Buffer, GENERIC_WRITE, TRUE); + if (!NT_SUCCESS(Status)) return Status; + + Status = ConDrvSetConsoleTextAttribute(Buffer->Header.Console, + Buffer, + SetTextAttribRequest->Attrib); + + ConSrvReleaseScreenBuffer(Buffer, TRUE); + return Status; +} + +NTSTATUS NTAPI +ConDrvSetConsoleScreenBufferSize(IN PCONSOLE Console, + IN PTEXTMODE_SCREEN_BUFFER Buffer, + IN PCOORD Size); CSR_API(SrvSetConsoleScreenBufferSize) { NTSTATUS Status; PCONSOLE_SETSCREENBUFFERSIZE SetScreenBufferSizeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetScreenBufferSizeRequest; - PCONSOLE Console; - PTEXTMODE_SCREEN_BUFFER Buff; - - Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), SetScreenBufferSizeRequest->OutputHandle, &Buff, GENERIC_WRITE, TRUE); - if (!NT_SUCCESS(Status)) return Status; - - Console = Buff->Header.Console; - - Status = ConioResizeBuffer(Console, Buff, SetScreenBufferSizeRequest->Size); - if (NT_SUCCESS(Status)) ConioResizeTerminal(Console); - - ConSrvReleaseScreenBuffer(Buff, TRUE); - return Status; -} - + PTEXTMODE_SCREEN_BUFFER Buffer; + + DPRINT("SrvSetConsoleScreenBufferSize\n"); + + Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), + SetScreenBufferSizeRequest->OutputHandle, + &Buffer, GENERIC_WRITE, TRUE); + if (!NT_SUCCESS(Status)) return Status; + + Status = ConDrvSetConsoleScreenBufferSize(Buffer->Header.Console, + Buffer, + &SetScreenBufferSizeRequest->Size); + + ConSrvReleaseScreenBuffer(Buffer, TRUE); + return Status; +} + +NTSTATUS NTAPI +ConDrvScrollConsoleScreenBuffer(IN PCONSOLE Console, + IN PTEXTMODE_SCREEN_BUFFER Buffer, + IN BOOL Unicode, + IN PSMALL_RECT ScrollRectangle, + IN BOOL UseClipRectangle, + IN PSMALL_RECT ClipRectangle OPTIONAL, + IN PCOORD DestinationOrigin, + IN CHAR_INFO FillChar); CSR_API(SrvScrollConsoleScreenBuffer) { + NTSTATUS Status; PCONSOLE_SCROLLSCREENBUFFER ScrollScreenBufferRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ScrollScreenBufferRequest; - PCONSOLE Console; - PTEXTMODE_SCREEN_BUFFER Buff; - SMALL_RECT ScreenBuffer; - SMALL_RECT SrcRegion; - SMALL_RECT DstRegion; - SMALL_RECT UpdateRegion; - SMALL_RECT ScrollRectangle; - SMALL_RECT ClipRectangle; - NTSTATUS Status; - HANDLE OutputHandle; - BOOLEAN UseClipRectangle; - COORD DestinationOrigin; - CHAR_INFO FillChar; + PTEXTMODE_SCREEN_BUFFER Buffer; DPRINT("SrvScrollConsoleScreenBuffer\n"); - OutputHandle = ScrollScreenBufferRequest->OutputHandle; - UseClipRectangle = ScrollScreenBufferRequest->UseClipRectangle; - DestinationOrigin = ScrollScreenBufferRequest->DestinationOrigin; - FillChar = ScrollScreenBufferRequest->Fill; - - Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), OutputHandle, &Buff, GENERIC_WRITE, TRUE); - if (!NT_SUCCESS(Status)) return Status; - - Console = Buff->Header.Console; - - ScrollRectangle = ScrollScreenBufferRequest->ScrollRectangle; - - /* Make sure source rectangle is inside the screen buffer */ - ConioInitRect(&ScreenBuffer, 0, 0, Buff->ScreenBufferSize.Y - 1, Buff->ScreenBufferSize.X - 1); - if (!ConioGetIntersection(&SrcRegion, &ScreenBuffer, &ScrollRectangle)) - { - ConSrvReleaseScreenBuffer(Buff, TRUE); - return STATUS_SUCCESS; - } - - /* If the source was clipped on the left or top, adjust the destination accordingly */ - if (ScrollRectangle.Left < 0) - { - DestinationOrigin.X -= ScrollRectangle.Left; - } - if (ScrollRectangle.Top < 0) - { - DestinationOrigin.Y -= ScrollRectangle.Top; - } - - if (UseClipRectangle) - { - ClipRectangle = ScrollScreenBufferRequest->ClipRectangle; - if (!ConioGetIntersection(&ClipRectangle, &ClipRectangle, &ScreenBuffer)) - { - ConSrvReleaseScreenBuffer(Buff, TRUE); - return STATUS_SUCCESS; - } - } - else - { - ClipRectangle = ScreenBuffer; - } - - ConioInitRect(&DstRegion, - DestinationOrigin.Y, - DestinationOrigin.X, - DestinationOrigin.Y + ConioRectHeight(&SrcRegion) - 1, - DestinationOrigin.X + ConioRectWidth(&SrcRegion) - 1); - - if (!ScrollScreenBufferRequest->Unicode) - ConsoleAnsiCharToUnicodeChar(Console, &FillChar.Char.UnicodeChar, &FillChar.Char.AsciiChar); - - ConioMoveRegion(Buff, &SrcRegion, &DstRegion, &ClipRectangle, FillChar); - - if ((PCONSOLE_SCREEN_BUFFER)Buff == Console->ActiveBuffer) - { - ConioGetUnion(&UpdateRegion, &SrcRegion, &DstRegion); - if (ConioGetIntersection(&UpdateRegion, &UpdateRegion, &ClipRectangle)) - { - /* Draw update region */ - ConioDrawRegion(Console, &UpdateRegion); - } - } - - ConSrvReleaseScreenBuffer(Buff, TRUE); - return STATUS_SUCCESS; -} - -#endif + Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), + ScrollScreenBufferRequest->OutputHandle, + &Buffer, GENERIC_WRITE, TRUE); + if (!NT_SUCCESS(Status)) return Status; + + Status = ConDrvScrollConsoleScreenBuffer(Buffer->Header.Console, + Buffer, + ScrollScreenBufferRequest->Unicode, + &ScrollScreenBufferRequest->ScrollRectangle, + ScrollScreenBufferRequest->UseClipRectangle, + &ScrollScreenBufferRequest->ClipRectangle, + &ScrollScreenBufferRequest->DestinationOrigin, + ScrollScreenBufferRequest->Fill); + + ConSrvReleaseScreenBuffer(Buffer, TRUE); + return Status; +} /* EOF */
11 years, 6 months
1
0
0
0
[hbelusca] 59321: [CONSRV] Continue to move some (text) functions to condrv.
by hbelusca@svn.reactos.org
Author: hbelusca Date: Sun Jun 23 17:19:08 2013 New Revision: 59321 URL:
http://svn.reactos.org/svn/reactos?rev=59321&view=rev
Log: [CONSRV] Continue to move some (text) functions to condrv. Modified: trunk/reactos/win32ss/user/consrv/condrv/text.c trunk/reactos/win32ss/user/consrv/conoutput.c Modified: trunk/reactos/win32ss/user/consrv/condrv/text.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/consrv/condrv…
============================================================================== --- trunk/reactos/win32ss/user/consrv/condrv/text.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/consrv/condrv/text.c [iso-8859-1] Sun Jun 23 17:19:08 2013 @@ -756,22 +756,33 @@ return STATUS_NOT_IMPLEMENTED; } -CSR_API(SrvReadConsoleOutputString) -{ - NTSTATUS Status; - PCONSOLE_READOUTPUTCODE ReadOutputCodeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ReadOutputCodeRequest; - PCONSOLE Console; - PTEXTMODE_SCREEN_BUFFER Buff; - USHORT CodeType; +NTSTATUS NTAPI +ConDrvReadConsoleOutputString(IN PCONSOLE Console, + IN PTEXTMODE_SCREEN_BUFFER Buffer, + IN CODE_TYPE CodeType, + OUT PVOID StringBuffer, + IN ULONG NumCodesToRead, + IN PCOORD ReadCoord, + OUT PCOORD EndCoord, + OUT PULONG CodesRead) +{ SHORT Xpos, Ypos; PVOID ReadBuffer; - DWORD i; + ULONG i; ULONG CodeSize; PCHAR_INFO Ptr; - DPRINT("SrvReadConsoleOutputString\n"); - - CodeType = ReadOutputCodeRequest->CodeType; + if (Console == NULL || Buffer == NULL || + ReadCoord == NULL || EndCoord == NULL || CodesRead == NULL) + { + return STATUS_INVALID_PARAMETER; + } + + /* Validity checks */ + ASSERT(Console == Buffer->Header.Console); + ASSERT( (StringBuffer != NULL && NumCodesToRead >= 0) || + (StringBuffer == NULL && NumCodesToRead == 0) ); + switch (CodeType) { case CODE_ASCII: @@ -790,26 +801,9 @@ return STATUS_INVALID_PARAMETER; } - if (!CsrValidateMessageBuffer(ApiMessage, - (PVOID*)&ReadOutputCodeRequest->pCode.pCode, - ReadOutputCodeRequest->NumCodesToRead, - CodeSize)) - { - return STATUS_INVALID_PARAMETER; - } - - Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), - ReadOutputCodeRequest->OutputHandle, - &Buff, - GENERIC_READ, - TRUE); - if (!NT_SUCCESS(Status)) return Status; - - Console = Buff->Header.Console; - - ReadBuffer = ReadOutputCodeRequest->pCode.pCode; - Xpos = ReadOutputCodeRequest->ReadCoord.X; - Ypos = (ReadOutputCodeRequest->ReadCoord.Y + Buff->VirtualY) % Buff->ScreenBufferSize.Y; + ReadBuffer = StringBuffer; + Xpos = ReadCoord->X; + Ypos = (ReadCoord->Y + Buffer->VirtualY) % Buffer->ScreenBufferSize.Y; /* * MSDN (ReadConsoleOutputAttribute and ReadConsoleOutputCharacter) : @@ -824,11 +818,11 @@ * TODO: Do NOT loop up to NumCodesToRead, but stop before * if we are going to overflow... */ - // Ptr = ConioCoordToPointer(Buff, Xpos, Ypos); // Doesn't work - for (i = 0; i < min(ReadOutputCodeRequest->NumCodesToRead, Buff->ScreenBufferSize.X * Buff->ScreenBufferSize.Y); ++i) - { - // Ptr = ConioCoordToPointer(Buff, Xpos, Ypos); // Doesn't work either - Ptr = &Buff->Buffer[Xpos + Ypos * Buff->ScreenBufferSize.X]; + // Ptr = ConioCoordToPointer(Buffer, Xpos, Ypos); // Doesn't work + for (i = 0; i < min(NumCodesToRead, Buffer->ScreenBufferSize.X * Buffer->ScreenBufferSize.Y); ++i) + { + // Ptr = ConioCoordToPointer(Buffer, Xpos, Ypos); // Doesn't work either + Ptr = &Buffer->Buffer[Xpos + Ypos * Buffer->ScreenBufferSize.X]; switch (CodeType) { @@ -849,12 +843,12 @@ Xpos++; - if (Xpos == Buff->ScreenBufferSize.X) + if (Xpos == Buffer->ScreenBufferSize.X) { Xpos = 0; Ypos++; - if (Ypos == Buff->ScreenBufferSize.Y) + if (Ypos == Buffer->ScreenBufferSize.Y) { Ypos = 0; } @@ -876,34 +870,44 @@ // break; // } - ReadOutputCodeRequest->EndCoord.X = Xpos; - ReadOutputCodeRequest->EndCoord.Y = (Ypos - Buff->VirtualY + Buff->ScreenBufferSize.Y) % Buff->ScreenBufferSize.Y; - - ConSrvReleaseScreenBuffer(Buff, TRUE); - - ReadOutputCodeRequest->CodesRead = (DWORD)((ULONG_PTR)ReadBuffer - (ULONG_PTR)ReadOutputCodeRequest->pCode.pCode) / CodeSize; - // <= ReadOutputCodeRequest->NumCodesToRead + EndCoord->X = Xpos; + EndCoord->Y = (Ypos - Buffer->VirtualY + Buffer->ScreenBufferSize.Y) % Buffer->ScreenBufferSize.Y; + + *CodesRead = (ULONG)((ULONG_PTR)ReadBuffer - (ULONG_PTR)StringBuffer) / CodeSize; + // <= NumCodesToRead return STATUS_SUCCESS; } -CSR_API(SrvWriteConsoleOutputString) -{ - NTSTATUS Status; - PCONSOLE_WRITEOUTPUTCODE WriteOutputCodeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.WriteOutputCodeRequest; - PCONSOLE Console; - PTEXTMODE_SCREEN_BUFFER Buff; - USHORT CodeType; - PVOID ReadBuffer = NULL; +NTSTATUS NTAPI +ConDrvWriteConsoleOutputString(IN PCONSOLE Console, + IN PTEXTMODE_SCREEN_BUFFER Buffer, + IN CODE_TYPE CodeType, + IN PVOID StringBuffer, + IN ULONG NumCodesToWrite, + IN PCOORD WriteCoord /*, + OUT PCOORD EndCoord, + OUT PULONG CodesWritten */) +{ + NTSTATUS Status = STATUS_SUCCESS; + PVOID WriteBuffer = NULL; PWCHAR tmpString = NULL; DWORD X, Y, Length; // , Written = 0; ULONG CodeSize; SMALL_RECT UpdateRect; PCHAR_INFO Ptr; - DPRINT("SrvWriteConsoleOutputString\n"); - - CodeType = WriteOutputCodeRequest->CodeType; + if (Console == NULL || Buffer == NULL || + WriteCoord == NULL /* || EndCoord == NULL || CodesWritten == NULL */) + { + return STATUS_INVALID_PARAMETER; + } + + /* Validity checks */ + ASSERT(Console == Buffer->Header.Console); + ASSERT( (StringBuffer != NULL && NumCodesToWrite >= 0) || + (StringBuffer == NULL && NumCodesToWrite == 0) ); + switch (CodeType) { case CODE_ASCII: @@ -922,37 +926,20 @@ return STATUS_INVALID_PARAMETER; } - if (!CsrValidateMessageBuffer(ApiMessage, - (PVOID*)&WriteOutputCodeRequest->pCode.pCode, - WriteOutputCodeRequest->Length, - CodeSize)) - { - return STATUS_INVALID_PARAMETER; - } - - Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), - WriteOutputCodeRequest->OutputHandle, - &Buff, - GENERIC_WRITE, - TRUE); - if (!NT_SUCCESS(Status)) return Status; - - Console = Buff->Header.Console; - if (CodeType == CODE_ASCII) { /* Convert the ASCII string into Unicode before writing it to the console */ Length = MultiByteToWideChar(Console->OutputCodePage, 0, - WriteOutputCodeRequest->pCode.AsciiChar, - WriteOutputCodeRequest->Length, + (PCHAR)StringBuffer, + NumCodesToWrite, NULL, 0); - tmpString = ReadBuffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, Length * sizeof(WCHAR)); - if (ReadBuffer) + tmpString = WriteBuffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, Length * sizeof(WCHAR)); + if (WriteBuffer) { MultiByteToWideChar(Console->OutputCodePage, 0, - WriteOutputCodeRequest->pCode.AsciiChar, - WriteOutputCodeRequest->Length, - (PWCHAR)ReadBuffer, Length); + (PCHAR)StringBuffer, + NumCodesToWrite, + (PWCHAR)WriteBuffer, Length); } else { @@ -962,124 +949,120 @@ else { /* For CODE_UNICODE or CODE_ATTRIBUTE, we are already OK */ - ReadBuffer = WriteOutputCodeRequest->pCode.pCode; - } - - if (ReadBuffer == NULL || !NT_SUCCESS(Status)) goto Cleanup; - - X = WriteOutputCodeRequest->Coord.X; - Y = (WriteOutputCodeRequest->Coord.Y + Buff->VirtualY) % Buff->ScreenBufferSize.Y; - Length = WriteOutputCodeRequest->Length; - // Ptr = ConioCoordToPointer(Buff, X, Y); // Doesn't work - // Ptr = &Buff->Buffer[X + Y * Buff->ScreenBufferSize.X]; // May work + WriteBuffer = StringBuffer; + } + + if (WriteBuffer == NULL || !NT_SUCCESS(Status)) goto Cleanup; + + X = WriteCoord->X; + Y = (WriteCoord->Y + Buffer->VirtualY) % Buffer->ScreenBufferSize.Y; + Length = NumCodesToWrite; + // Ptr = ConioCoordToPointer(Buffer, X, Y); // Doesn't work + // Ptr = &Buffer->Buffer[X + Y * Buffer->ScreenBufferSize.X]; // May work while (Length--) { - // Ptr = ConioCoordToPointer(Buff, X, Y); // Doesn't work either - Ptr = &Buff->Buffer[X + Y * Buff->ScreenBufferSize.X]; + // Ptr = ConioCoordToPointer(Buffer, X, Y); // Doesn't work either + Ptr = &Buffer->Buffer[X + Y * Buffer->ScreenBufferSize.X]; switch (CodeType) { case CODE_ASCII: case CODE_UNICODE: - Ptr->Char.UnicodeChar = *(PWCHAR)ReadBuffer; + Ptr->Char.UnicodeChar = *(PWCHAR)WriteBuffer; break; case CODE_ATTRIBUTE: - Ptr->Attributes = *(PWORD)ReadBuffer; + Ptr->Attributes = *(PWORD)WriteBuffer; break; } - ReadBuffer = (PVOID)((ULONG_PTR)ReadBuffer + CodeSize); + WriteBuffer = (PVOID)((ULONG_PTR)WriteBuffer + CodeSize); // ++Ptr; // Written++; - if (++X == Buff->ScreenBufferSize.X) + if (++X == Buffer->ScreenBufferSize.X) { X = 0; - if (++Y == Buff->ScreenBufferSize.Y) + if (++Y == Buffer->ScreenBufferSize.Y) { Y = 0; } } } - if ((PCONSOLE_SCREEN_BUFFER)Buff == Console->ActiveBuffer) - { - ConioComputeUpdateRect(Buff, &UpdateRect, &WriteOutputCodeRequest->Coord, - WriteOutputCodeRequest->Length); + if ((PCONSOLE_SCREEN_BUFFER)Buffer == Console->ActiveBuffer) + { + ConioComputeUpdateRect(Buffer, &UpdateRect, WriteCoord, NumCodesToWrite); ConioDrawRegion(Console, &UpdateRect); } - // WriteOutputCodeRequest->EndCoord.X = X; - // WriteOutputCodeRequest->EndCoord.Y = (Y + Buff->ScreenBufferSize.Y - Buff->VirtualY) % Buff->ScreenBufferSize.Y; + // EndCoord->X = X; + // EndCoord->Y = (Y + Buffer->ScreenBufferSize.Y - Buffer->VirtualY) % Buffer->ScreenBufferSize.Y; Cleanup: - if (tmpString) - RtlFreeHeap(RtlGetProcessHeap(), 0, tmpString); - - ConSrvReleaseScreenBuffer(Buff, TRUE); - - // WriteOutputCodeRequest->NrCharactersWritten = Written; + if (tmpString) RtlFreeHeap(RtlGetProcessHeap(), 0, tmpString); + + // CodesWritten = Written; return Status; } -CSR_API(SrvFillConsoleOutput) -{ - NTSTATUS Status; - PCONSOLE_FILLOUTPUTCODE FillOutputRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.FillOutputRequest; - PCONSOLE Console; - PTEXTMODE_SCREEN_BUFFER Buff; +NTSTATUS NTAPI +ConDrvFillConsoleOutput(IN PCONSOLE Console, + IN PTEXTMODE_SCREEN_BUFFER Buffer, + IN CODE_TYPE CodeType, + IN PVOID Code, + IN ULONG NumCodesToWrite, + IN PCOORD WriteCoord /*, + OUT PULONG CodesWritten */) +{ DWORD X, Y, Length; // , Written = 0; - USHORT CodeType; - PVOID Code = NULL; PCHAR_INFO Ptr; SMALL_RECT UpdateRect; - DPRINT("SrvFillConsoleOutput\n"); - - CodeType = FillOutputRequest->CodeType; - if ( (CodeType != CODE_ASCII ) && - (CodeType != CODE_UNICODE ) && - (CodeType != CODE_ATTRIBUTE) ) + if (Console == NULL || Buffer == NULL || Code == NULL || + WriteCoord == NULL /* || CodesWritten == NULL */) { return STATUS_INVALID_PARAMETER; } - Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), - FillOutputRequest->OutputHandle, - &Buff, - GENERIC_WRITE, - TRUE); - if (!NT_SUCCESS(Status)) return Status; - - Console = Buff->Header.Console; - + /* Validity check */ + ASSERT(Console == Buffer->Header.Console); + +#if 0 switch (CodeType) { case CODE_ASCII: /* On-place conversion from the ASCII char to the UNICODE char */ - ConsoleAnsiCharToUnicodeChar(Console, &FillOutputRequest->Code.UnicodeChar, &FillOutputRequest->Code.AsciiChar); + ConsoleAnsiCharToUnicodeChar(Console, &Code->UnicodeChar, &Code->AsciiChar); /* Fall through */ case CODE_UNICODE: - Code = &FillOutputRequest->Code.UnicodeChar; + Code = &Code->UnicodeChar; break; case CODE_ATTRIBUTE: - Code = &FillOutputRequest->Code.Attribute; + Code = &Code->Attribute; break; } - - X = FillOutputRequest->Coord.X; - Y = (FillOutputRequest->Coord.Y + Buff->VirtualY) % Buff->ScreenBufferSize.Y; - Length = FillOutputRequest->Length; - // Ptr = ConioCoordToPointer(Buff, X, Y); // Doesn't work - // Ptr = &Buff->Buffer[X + Y * Buff->ScreenBufferSize.X]; // May work +#else + if (CodeType == CODE_ASCII) + { + /* On-place conversion from the ASCII char to the UNICODE char */ + // FIXME: What if Code points to an invalid memory zone ?? + ConsoleAnsiCharToUnicodeChar(Console, (PWCHAR)Code, (PCHAR)Code); + } +#endif + + X = WriteCoord->X; + Y = (WriteCoord->Y + Buffer->VirtualY) % Buffer->ScreenBufferSize.Y; + Length = NumCodesToWrite; + // Ptr = ConioCoordToPointer(Buffer, X, Y); // Doesn't work + // Ptr = &Buffer->Buffer[X + Y * Buffer->ScreenBufferSize.X]; // May work while (Length--) { - // Ptr = ConioCoordToPointer(Buff, X, Y); // Doesn't work either - Ptr = &Buff->Buffer[X + Y * Buff->ScreenBufferSize.X]; + // Ptr = ConioCoordToPointer(Buffer, X, Y); // Doesn't work either + Ptr = &Buffer->Buffer[X + Y * Buffer->ScreenBufferSize.X]; switch (CodeType) { @@ -1095,31 +1078,28 @@ // ++Ptr; // Written++; - if (++X == Buff->ScreenBufferSize.X) + if (++X == Buffer->ScreenBufferSize.X) { X = 0; - if (++Y == Buff->ScreenBufferSize.Y) + if (++Y == Buffer->ScreenBufferSize.Y) { Y = 0; } } } - if ((PCONSOLE_SCREEN_BUFFER)Buff == Console->ActiveBuffer) - { - ConioComputeUpdateRect(Buff, &UpdateRect, &FillOutputRequest->Coord, - FillOutputRequest->Length); + if ((PCONSOLE_SCREEN_BUFFER)Buffer == Console->ActiveBuffer) + { + ConioComputeUpdateRect(Buffer, &UpdateRect, WriteCoord, NumCodesToWrite); ConioDrawRegion(Console, &UpdateRect); } - ConSrvReleaseScreenBuffer(Buff, TRUE); -/* - Length = FillOutputRequest->Length; - FillOutputRequest->NrCharactersWritten = Length; -*/ + // CodesWritten = Written; // NumCodesToWrite; return STATUS_SUCCESS; } + + CSR_API(SrvGetConsoleScreenBufferInfo) { Modified: trunk/reactos/win32ss/user/consrv/conoutput.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/consrv/conout…
============================================================================== --- trunk/reactos/win32ss/user/consrv/conoutput.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/consrv/conoutput.c [iso-8859-1] Sun Jun 23 17:19:08 2013 @@ -515,25 +515,25 @@ return Status; } -#if 0000 - +NTSTATUS NTAPI +ConDrvReadConsoleOutputString(IN PCONSOLE Console, + IN PTEXTMODE_SCREEN_BUFFER Buffer, + IN CODE_TYPE CodeType, + OUT PVOID StringBuffer, + IN ULONG NumCodesToRead, + IN PCOORD ReadCoord, + OUT PCOORD EndCoord, + OUT PULONG CodesRead); CSR_API(SrvReadConsoleOutputString) { NTSTATUS Status; PCONSOLE_READOUTPUTCODE ReadOutputCodeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ReadOutputCodeRequest; - PCONSOLE Console; - PTEXTMODE_SCREEN_BUFFER Buff; - USHORT CodeType; - SHORT Xpos, Ypos; - PVOID ReadBuffer; - DWORD i; + PTEXTMODE_SCREEN_BUFFER Buffer; ULONG CodeSize; - PCHAR_INFO Ptr; DPRINT("SrvReadConsoleOutputString\n"); - CodeType = ReadOutputCodeRequest->CodeType; - switch (CodeType) + switch (ReadOutputCodeRequest->CodeType) { case CODE_ASCII: CodeSize = sizeof(CHAR); @@ -561,111 +561,41 @@ Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), ReadOutputCodeRequest->OutputHandle, - &Buff, - GENERIC_READ, - TRUE); - if (!NT_SUCCESS(Status)) return Status; - - Console = Buff->Header.Console; - - ReadBuffer = ReadOutputCodeRequest->pCode.pCode; - Xpos = ReadOutputCodeRequest->ReadCoord.X; - Ypos = (ReadOutputCodeRequest->ReadCoord.Y + Buff->VirtualY) % Buff->ScreenBufferSize.Y; - - /* - * MSDN (ReadConsoleOutputAttribute and ReadConsoleOutputCharacter) : - * - * If the number of attributes (resp. characters) to be read from extends - * beyond the end of the specified screen buffer row, attributes (resp. - * characters) are read from the next row. If the number of attributes - * (resp. characters) to be read from extends beyond the end of the console - * screen buffer, attributes (resp. characters) up to the end of the console - * screen buffer are read. - * - * TODO: Do NOT loop up to NumCodesToRead, but stop before - * if we are going to overflow... - */ - // Ptr = ConioCoordToPointer(Buff, Xpos, Ypos); // Doesn't work - for (i = 0; i < min(ReadOutputCodeRequest->NumCodesToRead, Buff->ScreenBufferSize.X * Buff->ScreenBufferSize.Y); ++i) - { - // Ptr = ConioCoordToPointer(Buff, Xpos, Ypos); // Doesn't work either - Ptr = &Buff->Buffer[Xpos + Ypos * Buff->ScreenBufferSize.X]; - - switch (CodeType) - { - case CODE_ASCII: - ConsoleUnicodeCharToAnsiChar(Console, (PCHAR)ReadBuffer, &Ptr->Char.UnicodeChar); - break; - - case CODE_UNICODE: - *(PWCHAR)ReadBuffer = Ptr->Char.UnicodeChar; - break; - - case CODE_ATTRIBUTE: - *(PWORD)ReadBuffer = Ptr->Attributes; - break; - } - ReadBuffer = (PVOID)((ULONG_PTR)ReadBuffer + CodeSize); - // ++Ptr; - - Xpos++; - - if (Xpos == Buff->ScreenBufferSize.X) - { - Xpos = 0; - Ypos++; - - if (Ypos == Buff->ScreenBufferSize.Y) - { - Ypos = 0; - } - } - } - - // switch (CodeType) - // { - // case CODE_UNICODE: - // *(PWCHAR)ReadBuffer = 0; - // break; - - // case CODE_ASCII: - // *(PCHAR)ReadBuffer = 0; - // break; - - // case CODE_ATTRIBUTE: - // *(PWORD)ReadBuffer = 0; - // break; - // } - - ReadOutputCodeRequest->EndCoord.X = Xpos; - ReadOutputCodeRequest->EndCoord.Y = (Ypos - Buff->VirtualY + Buff->ScreenBufferSize.Y) % Buff->ScreenBufferSize.Y; - - ConSrvReleaseScreenBuffer(Buff, TRUE); - - ReadOutputCodeRequest->CodesRead = (DWORD)((ULONG_PTR)ReadBuffer - (ULONG_PTR)ReadOutputCodeRequest->pCode.pCode) / CodeSize; - // <= ReadOutputCodeRequest->NumCodesToRead - - return STATUS_SUCCESS; -} - + &Buffer, GENERIC_READ, TRUE); + if (!NT_SUCCESS(Status)) return Status; + + Status = ConDrvReadConsoleOutputString(Buffer->Header.Console, + Buffer, + ReadOutputCodeRequest->CodeType, + ReadOutputCodeRequest->pCode.pCode, + ReadOutputCodeRequest->NumCodesToRead, + &ReadOutputCodeRequest->ReadCoord, + &ReadOutputCodeRequest->EndCoord, + &ReadOutputCodeRequest->CodesRead); + + ConSrvReleaseScreenBuffer(Buffer, TRUE); + return Status; +} + +NTSTATUS NTAPI +ConDrvWriteConsoleOutputString(IN PCONSOLE Console, + IN PTEXTMODE_SCREEN_BUFFER Buffer, + IN CODE_TYPE CodeType, + IN PVOID StringBuffer, + IN ULONG NumCodesToWrite, + IN PCOORD WriteCoord /*, + OUT PCOORD EndCoord, + OUT PULONG CodesWritten */); CSR_API(SrvWriteConsoleOutputString) { NTSTATUS Status; PCONSOLE_WRITEOUTPUTCODE WriteOutputCodeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.WriteOutputCodeRequest; - PCONSOLE Console; - PTEXTMODE_SCREEN_BUFFER Buff; - USHORT CodeType; - PVOID ReadBuffer = NULL; - PWCHAR tmpString = NULL; - DWORD X, Y, Length; // , Written = 0; + PTEXTMODE_SCREEN_BUFFER Buffer; ULONG CodeSize; - SMALL_RECT UpdateRect; - PCHAR_INFO Ptr; DPRINT("SrvWriteConsoleOutputString\n"); - CodeType = WriteOutputCodeRequest->CodeType; - switch (CodeType) + switch (WriteOutputCodeRequest->CodeType) { case CODE_ASCII: CodeSize = sizeof(CHAR); @@ -693,113 +623,41 @@ Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), WriteOutputCodeRequest->OutputHandle, - &Buff, - GENERIC_WRITE, - TRUE); - if (!NT_SUCCESS(Status)) return Status; - - Console = Buff->Header.Console; - - if (CodeType == CODE_ASCII) - { - /* Convert the ASCII string into Unicode before writing it to the console */ - Length = MultiByteToWideChar(Console->OutputCodePage, 0, - WriteOutputCodeRequest->pCode.AsciiChar, - WriteOutputCodeRequest->Length, - NULL, 0); - tmpString = ReadBuffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, Length * sizeof(WCHAR)); - if (ReadBuffer) - { - MultiByteToWideChar(Console->OutputCodePage, 0, - WriteOutputCodeRequest->pCode.AsciiChar, - WriteOutputCodeRequest->Length, - (PWCHAR)ReadBuffer, Length); - } - else - { - Status = STATUS_NO_MEMORY; - } - } - else - { - /* For CODE_UNICODE or CODE_ATTRIBUTE, we are already OK */ - ReadBuffer = WriteOutputCodeRequest->pCode.pCode; - } - - if (ReadBuffer == NULL || !NT_SUCCESS(Status)) goto Cleanup; - - X = WriteOutputCodeRequest->Coord.X; - Y = (WriteOutputCodeRequest->Coord.Y + Buff->VirtualY) % Buff->ScreenBufferSize.Y; - Length = WriteOutputCodeRequest->Length; - // Ptr = ConioCoordToPointer(Buff, X, Y); // Doesn't work - // Ptr = &Buff->Buffer[X + Y * Buff->ScreenBufferSize.X]; // May work - - while (Length--) - { - // Ptr = ConioCoordToPointer(Buff, X, Y); // Doesn't work either - Ptr = &Buff->Buffer[X + Y * Buff->ScreenBufferSize.X]; - - switch (CodeType) - { - case CODE_ASCII: - case CODE_UNICODE: - Ptr->Char.UnicodeChar = *(PWCHAR)ReadBuffer; - break; - - case CODE_ATTRIBUTE: - Ptr->Attributes = *(PWORD)ReadBuffer; - break; - } - ReadBuffer = (PVOID)((ULONG_PTR)ReadBuffer + CodeSize); - // ++Ptr; - - // Written++; - if (++X == Buff->ScreenBufferSize.X) - { - X = 0; - - if (++Y == Buff->ScreenBufferSize.Y) - { - Y = 0; - } - } - } - - if ((PCONSOLE_SCREEN_BUFFER)Buff == Console->ActiveBuffer) - { - ConioComputeUpdateRect(Buff, &UpdateRect, &WriteOutputCodeRequest->Coord, - WriteOutputCodeRequest->Length); - ConioDrawRegion(Console, &UpdateRect); - } - - // WriteOutputCodeRequest->EndCoord.X = X; - // WriteOutputCodeRequest->EndCoord.Y = (Y + Buff->ScreenBufferSize.Y - Buff->VirtualY) % Buff->ScreenBufferSize.Y; - -Cleanup: - if (tmpString) - RtlFreeHeap(RtlGetProcessHeap(), 0, tmpString); - - ConSrvReleaseScreenBuffer(Buff, TRUE); + &Buffer, GENERIC_WRITE, TRUE); + if (!NT_SUCCESS(Status)) return Status; + + Status = ConDrvWriteConsoleOutputString(Buffer->Header.Console, + Buffer, + WriteOutputCodeRequest->CodeType, + WriteOutputCodeRequest->pCode.pCode, + WriteOutputCodeRequest->Length, // NumCodesToWrite, + &WriteOutputCodeRequest->Coord /*, // WriteCoord, + &WriteOutputCodeRequest->EndCoord, + &WriteOutputCodeRequest->NrCharactersWritten */); // WriteOutputCodeRequest->NrCharactersWritten = Written; - return Status; -} - + + ConSrvReleaseScreenBuffer(Buffer, TRUE); + return Status; +} + +NTSTATUS NTAPI +ConDrvFillConsoleOutput(IN PCONSOLE Console, + IN PTEXTMODE_SCREEN_BUFFER Buffer, + IN CODE_TYPE CodeType, + IN PVOID Code, + IN ULONG NumCodesToWrite, + IN PCOORD WriteCoord /*, + OUT PULONG CodesWritten */); CSR_API(SrvFillConsoleOutput) { NTSTATUS Status; PCONSOLE_FILLOUTPUTCODE FillOutputRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.FillOutputRequest; - PCONSOLE Console; - PTEXTMODE_SCREEN_BUFFER Buff; - DWORD X, Y, Length; // , Written = 0; - USHORT CodeType; - PVOID Code = NULL; - PCHAR_INFO Ptr; - SMALL_RECT UpdateRect; + PTEXTMODE_SCREEN_BUFFER Buffer; + USHORT CodeType = FillOutputRequest->CodeType; DPRINT("SrvFillConsoleOutput\n"); - CodeType = FillOutputRequest->CodeType; if ( (CodeType != CODE_ASCII ) && (CodeType != CODE_UNICODE ) && (CodeType != CODE_ATTRIBUTE) ) @@ -809,78 +667,24 @@ Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), FillOutputRequest->OutputHandle, - &Buff, - GENERIC_WRITE, - TRUE); - if (!NT_SUCCESS(Status)) return Status; - - Console = Buff->Header.Console; - - switch (CodeType) - { - case CODE_ASCII: - /* On-place conversion from the ASCII char to the UNICODE char */ - ConsoleAnsiCharToUnicodeChar(Console, &FillOutputRequest->Code.UnicodeChar, &FillOutputRequest->Code.AsciiChar); - /* Fall through */ - case CODE_UNICODE: - Code = &FillOutputRequest->Code.UnicodeChar; - break; - - case CODE_ATTRIBUTE: - Code = &FillOutputRequest->Code.Attribute; - break; - } - - X = FillOutputRequest->Coord.X; - Y = (FillOutputRequest->Coord.Y + Buff->VirtualY) % Buff->ScreenBufferSize.Y; - Length = FillOutputRequest->Length; - // Ptr = ConioCoordToPointer(Buff, X, Y); // Doesn't work - // Ptr = &Buff->Buffer[X + Y * Buff->ScreenBufferSize.X]; // May work - - while (Length--) - { - // Ptr = ConioCoordToPointer(Buff, X, Y); // Doesn't work either - Ptr = &Buff->Buffer[X + Y * Buff->ScreenBufferSize.X]; - - switch (CodeType) - { - case CODE_ASCII: - case CODE_UNICODE: - Ptr->Char.UnicodeChar = *(PWCHAR)Code; - break; - - case CODE_ATTRIBUTE: - Ptr->Attributes = *(PWORD)Code; - break; - } - // ++Ptr; - - // Written++; - if (++X == Buff->ScreenBufferSize.X) - { - X = 0; - - if (++Y == Buff->ScreenBufferSize.Y) - { - Y = 0; - } - } - } - - if ((PCONSOLE_SCREEN_BUFFER)Buff == Console->ActiveBuffer) - { - ConioComputeUpdateRect(Buff, &UpdateRect, &FillOutputRequest->Coord, - FillOutputRequest->Length); - ConioDrawRegion(Console, &UpdateRect); - } - - ConSrvReleaseScreenBuffer(Buff, TRUE); -/* - Length = FillOutputRequest->Length; - FillOutputRequest->NrCharactersWritten = Length; -*/ - return STATUS_SUCCESS; -} + &Buffer, GENERIC_WRITE, TRUE); + if (!NT_SUCCESS(Status)) return Status; + + Status = ConDrvFillConsoleOutput(Buffer->Header.Console, + Buffer, + CodeType, + &FillOutputRequest->Code, + FillOutputRequest->Length, // NumCodesToWrite, + &FillOutputRequest->Coord /*, // WriteCoord, + &FillOutputRequest->NrCharactersWritten */); + + // FillOutputRequest->NrCharactersWritten = Written; + + ConSrvReleaseScreenBuffer(Buffer, TRUE); + return Status; +} + +#if 0000 CSR_API(SrvGetConsoleScreenBufferInfo) {
11 years, 6 months
1
0
0
0
[ekohl] 59320: [SAMSRV] Remove unused code.
by ekohl@svn.reactos.org
Author: ekohl Date: Sun Jun 23 15:02:31 2013 New Revision: 59320 URL:
http://svn.reactos.org/svn/reactos?rev=59320&view=rev
Log: [SAMSRV] Remove unused code. Modified: trunk/reactos/dll/win32/samsrv/database.c Modified: trunk/reactos/dll/win32/samsrv/database.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samsrv/database.…
============================================================================== --- trunk/reactos/dll/win32/samsrv/database.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/samsrv/database.c [iso-8859-1] Sun Jun 23 15:02:31 2013 @@ -356,7 +356,6 @@ NTSTATUS SampCloseDbObject(PSAM_DB_OBJECT DbObject) { - PSAM_DB_OBJECT ParentObject = NULL; NTSTATUS Status = STATUS_SUCCESS; DbObject->RefCount--; @@ -369,9 +368,6 @@ if (DbObject->MembersKeyHandle != NULL) SampRegCloseKey(DbObject->MembersKeyHandle); - - if (DbObject->ParentObject != NULL) - ParentObject = DbObject->ParentObject; if (DbObject->Name != NULL) RtlFreeHeap(RtlGetProcessHeap(), 0, DbObject->Name);
11 years, 6 months
1
0
0
0
[hbelusca] 59319: [CONSRV] Continue to move some functions to condrv.
by hbelusca@svn.reactos.org
Author: hbelusca Date: Sun Jun 23 14:51:08 2013 New Revision: 59319 URL:
http://svn.reactos.org/svn/reactos?rev=59319&view=rev
Log: [CONSRV] Continue to move some functions to condrv. Added: trunk/reactos/win32ss/user/consrv/condrv/text.c - copied, changed from r59282, trunk/reactos/win32ss/user/consrv/text.c Removed: trunk/reactos/win32ss/user/consrv/text.c Modified: trunk/reactos/win32ss/user/consrv/CMakeLists.txt trunk/reactos/win32ss/user/consrv/conoutput.c Modified: trunk/reactos/win32ss/user/consrv/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/consrv/CMakeL…
============================================================================== --- trunk/reactos/win32ss/user/consrv/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/consrv/CMakeLists.txt [iso-8859-1] Sun Jun 23 14:51:08 2013 @@ -12,7 +12,6 @@ alias.c coninput.c conoutput.c - text.c console.c frontendctl.c handle.c @@ -22,6 +21,7 @@ condrv/conoutput.c condrv/console.c condrv/graphics.c + condrv/text.c frontends/input.c frontends/gui/guiterm.c frontends/gui/guisettings.c Copied: trunk/reactos/win32ss/user/consrv/condrv/text.c (from r59282, trunk/reactos/win32ss/user/consrv/text.c) URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/consrv/condrv…
============================================================================== --- trunk/reactos/win32ss/user/consrv/text.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/consrv/condrv/text.c [iso-8859-1] Sun Jun 23 14:51:08 2013 @@ -152,10 +152,10 @@ } } -static __inline BOOLEAN ConioGetIntersection( - SMALL_RECT* Intersection, - SMALL_RECT* Rect1, - SMALL_RECT* Rect2) +static __inline BOOLEAN +ConioGetIntersection(OUT PSMALL_RECT Intersection, + IN PSMALL_RECT Rect1, + IN PSMALL_RECT Rect2) { if ( ConioIsRectEmpty(Rect1) || ConioIsRectEmpty(Rect2) || @@ -170,18 +170,18 @@ } ConioInitRect(Intersection, - max(Rect1->Top, Rect2->Top), - max(Rect1->Left, Rect2->Left), + max(Rect1->Top , Rect2->Top ), + max(Rect1->Left , Rect2->Left ), min(Rect1->Bottom, Rect2->Bottom), - min(Rect1->Right, Rect2->Right)); + min(Rect1->Right , Rect2->Right )); return TRUE; } -static __inline BOOLEAN ConioGetUnion( - SMALL_RECT* Union, - SMALL_RECT* Rect1, - SMALL_RECT* Rect2) +static __inline BOOLEAN +ConioGetUnion(OUT PSMALL_RECT Union, + IN PSMALL_RECT Rect1, + IN PSMALL_RECT Rect2) { if (ConioIsRectEmpty(Rect1)) { @@ -202,17 +202,20 @@ else { ConioInitRect(Union, - min(Rect1->Top, Rect2->Top), - min(Rect1->Left, Rect2->Left), + min(Rect1->Top , Rect2->Top ), + min(Rect1->Left , Rect2->Left ), max(Rect1->Bottom, Rect2->Bottom), - max(Rect1->Right, Rect2->Right)); + max(Rect1->Right , Rect2->Right )); } return TRUE; } static VOID FASTCALL -ConioComputeUpdateRect(PTEXTMODE_SCREEN_BUFFER Buff, SMALL_RECT* UpdateRect, PCOORD Start, UINT Length) +ConioComputeUpdateRect(IN PTEXTMODE_SCREEN_BUFFER Buff, + IN OUT PSMALL_RECT UpdateRect, + IN PCOORD Start, + IN UINT Length) { if (Buff->ScreenBufferSize.X <= Start->X + Length) { @@ -244,9 +247,9 @@ */ static VOID FASTCALL ConioMoveRegion(PTEXTMODE_SCREEN_BUFFER ScreenBuffer, - SMALL_RECT* SrcRegion, - SMALL_RECT* DstRegion, - SMALL_RECT* ClipRegion, + PSMALL_RECT SrcRegion, + PSMALL_RECT DstRegion, + PSMALL_RECT ClipRegion, CHAR_INFO FillChar) { int Width = ConioRectWidth(SrcRegion); @@ -597,208 +600,66 @@ return STATUS_SUCCESS; } -static NTSTATUS -DoWriteConsole(IN PCSR_API_MESSAGE ApiMessage, - IN PCSR_THREAD ClientThread, - IN BOOL CreateWaitBlock OPTIONAL); - -// Wait function CSR_WAIT_FUNCTION -static BOOLEAN -WriteConsoleThread(IN PLIST_ENTRY WaitList, - IN PCSR_THREAD WaitThread, - IN PCSR_API_MESSAGE WaitApiMessage, - IN PVOID WaitContext, - IN PVOID WaitArgument1, - IN PVOID WaitArgument2, - IN ULONG WaitFlags) -{ - NTSTATUS Status; - - DPRINT("WriteConsoleThread - WaitContext = 0x%p, WaitArgument1 = 0x%p, WaitArgument2 = 0x%p, WaitFlags = %lu\n", WaitContext, WaitArgument1, WaitArgument2, WaitFlags); - - /* - * If we are notified of the process termination via a call - * to CsrNotifyWaitBlock triggered by CsrDestroyProcess or - * CsrDestroyThread, just return. - */ - if (WaitFlags & CsrProcessTerminating) - { - Status = STATUS_THREAD_IS_TERMINATING; - goto Quit; - } - - Status = DoWriteConsole(WaitApiMessage, - WaitThread, - FALSE); - -Quit: - if (Status != STATUS_PENDING) - { - WaitApiMessage->Status = Status; - } - - return (Status == STATUS_PENDING ? FALSE : TRUE); -} - -static NTSTATUS -DoWriteConsole(IN PCSR_API_MESSAGE ApiMessage, - IN PCSR_THREAD ClientThread, - IN BOOL CreateWaitBlock OPTIONAL) -{ - NTSTATUS Status = STATUS_SUCCESS; - PCONSOLE_WRITECONSOLE WriteConsoleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.WriteConsoleRequest; - PCONSOLE Console; - PTEXTMODE_SCREEN_BUFFER Buff; - PVOID Buffer; - DWORD Written = 0; - ULONG Length; - - Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(ClientThread->Process), WriteConsoleRequest->OutputHandle, &Buff, GENERIC_WRITE, FALSE); - if (!NT_SUCCESS(Status)) return Status; - - Console = Buff->Header.Console; - - // if (Console->PauseFlags & (PAUSED_FROM_KEYBOARD | PAUSED_FROM_SCROLLBAR | PAUSED_FROM_SELECTION)) - if (Console->PauseFlags && Console->UnpauseEvent != NULL) - { - if (CreateWaitBlock) - { - if (!CsrCreateWait(&Console->WriteWaitQueue, - WriteConsoleThread, - ClientThread, - ApiMessage, - NULL, - NULL)) - { - /* Fail */ - ConSrvReleaseScreenBuffer(Buff, FALSE); - return STATUS_NO_MEMORY; - } - } - - /* Wait until we un-pause the console */ - Status = STATUS_PENDING; - } - else - { - if (WriteConsoleRequest->Unicode) - { - Buffer = WriteConsoleRequest->Buffer; - } - else - { - Length = MultiByteToWideChar(Console->OutputCodePage, 0, - (PCHAR)WriteConsoleRequest->Buffer, - WriteConsoleRequest->NrCharactersToWrite, - NULL, 0); - Buffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, Length * sizeof(WCHAR)); - if (Buffer) - { - MultiByteToWideChar(Console->OutputCodePage, 0, - (PCHAR)WriteConsoleRequest->Buffer, - WriteConsoleRequest->NrCharactersToWrite, - (PWCHAR)Buffer, Length); - } - else - { - Status = STATUS_NO_MEMORY; - } - } - - if (Buffer) - { - if (NT_SUCCESS(Status)) - { - Status = ConioWriteConsole(Console, - Buff, - Buffer, - WriteConsoleRequest->NrCharactersToWrite, - TRUE); - if (NT_SUCCESS(Status)) - { - Written = WriteConsoleRequest->NrCharactersToWrite; - } - } - - if (!WriteConsoleRequest->Unicode) - RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer); - } - - WriteConsoleRequest->NrCharactersWritten = Written; - } - - ConSrvReleaseScreenBuffer(Buff, FALSE); - return Status; -} - /* PUBLIC SERVER APIS *********************************************************/ -CSR_API(SrvReadConsoleOutput) -{ - PCONSOLE_READOUTPUT ReadOutputRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ReadOutputRequest; - PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process); - PCHAR_INFO CharInfo; +NTSTATUS NTAPI +ConDrvReadConsoleOutput(IN PCONSOLE Console, + IN PTEXTMODE_SCREEN_BUFFER Buffer, + IN BOOL Unicode, + OUT PCHAR_INFO CharInfo/*Buffer*/, + IN PCOORD BufferSize, + IN PCOORD BufferCoord, + IN OUT PSMALL_RECT ReadRegion) +{ PCHAR_INFO CurCharInfo; - PTEXTMODE_SCREEN_BUFFER Buff; SHORT SizeX, SizeY; - NTSTATUS Status; - COORD BufferSize; - COORD BufferCoord; - SMALL_RECT ReadRegion; + SMALL_RECT CapturedReadRegion; SMALL_RECT ScreenRect; DWORD i; PCHAR_INFO Ptr; LONG X, Y; UINT CodePage; - DPRINT("SrvReadConsoleOutput\n"); - - CharInfo = ReadOutputRequest->CharInfo; - ReadRegion = ReadOutputRequest->ReadRegion; - BufferSize = ReadOutputRequest->BufferSize; - BufferCoord = ReadOutputRequest->BufferCoord; - - if (!CsrValidateMessageBuffer(ApiMessage, - (PVOID*)&ReadOutputRequest->CharInfo, - BufferSize.X * BufferSize.Y, - sizeof(CHAR_INFO))) + if (Console == NULL || Buffer == NULL || CharInfo == NULL || + BufferSize == NULL || BufferCoord == NULL || ReadRegion == NULL) { return STATUS_INVALID_PARAMETER; } - Status = ConSrvGetTextModeBuffer(ProcessData, ReadOutputRequest->OutputHandle, &Buff, GENERIC_READ, TRUE); - if (!NT_SUCCESS(Status)) return Status; + /* Validity check */ + ASSERT(Console == Buffer->Header.Console); + + CapturedReadRegion = *ReadRegion; /* FIXME: Is this correct? */ - CodePage = ProcessData->Console->OutputCodePage; - - SizeY = min(BufferSize.Y - BufferCoord.Y, ConioRectHeight(&ReadRegion)); - SizeX = min(BufferSize.X - BufferCoord.X, ConioRectWidth(&ReadRegion)); - ReadRegion.Bottom = ReadRegion.Top + SizeY; - ReadRegion.Right = ReadRegion.Left + SizeX; - - ConioInitRect(&ScreenRect, 0, 0, Buff->ScreenBufferSize.Y, Buff->ScreenBufferSize.X); - if (!ConioGetIntersection(&ReadRegion, &ScreenRect, &ReadRegion)) - { - ConSrvReleaseScreenBuffer(Buff, TRUE); + CodePage = Console->OutputCodePage; + + SizeX = min(BufferSize->X - BufferCoord->X, ConioRectWidth(&CapturedReadRegion)); + SizeY = min(BufferSize->Y - BufferCoord->Y, ConioRectHeight(&CapturedReadRegion)); + CapturedReadRegion.Right = CapturedReadRegion.Left + SizeX; + CapturedReadRegion.Bottom = CapturedReadRegion.Top + SizeY; + + ConioInitRect(&ScreenRect, 0, 0, Buffer->ScreenBufferSize.Y, Buffer->ScreenBufferSize.X); + if (!ConioGetIntersection(&CapturedReadRegion, &ScreenRect, &CapturedReadRegion)) + { return STATUS_SUCCESS; } - for (i = 0, Y = ReadRegion.Top; Y < ReadRegion.Bottom; ++i, ++Y) - { - CurCharInfo = CharInfo + (i * BufferSize.X); - - Ptr = ConioCoordToPointer(Buff, ReadRegion.Left, Y); - for (X = ReadRegion.Left; X < ReadRegion.Right; ++X) - { - if (ReadOutputRequest->Unicode) + for (i = 0, Y = CapturedReadRegion.Top; Y < CapturedReadRegion.Bottom; ++i, ++Y) + { + CurCharInfo = CharInfo + (i * BufferSize->X); + + Ptr = ConioCoordToPointer(Buffer, CapturedReadRegion.Left, Y); + for (X = CapturedReadRegion.Left; X < CapturedReadRegion.Right; ++X) + { + if (Unicode) { CurCharInfo->Char.UnicodeChar = Ptr->Char.UnicodeChar; } else { - // ConsoleUnicodeCharToAnsiChar(ProcessData->Console, &CurCharInfo->Char.AsciiChar, &Ptr->Char.UnicodeChar); + // ConsoleUnicodeCharToAnsiChar(Console, &CurCharInfo->Char.AsciiChar, &Ptr->Char.UnicodeChar); WideCharToMultiByte(CodePage, 0, &Ptr->Char.UnicodeChar, 1, &CurCharInfo->Char.AsciiChar, 1, NULL, NULL); } @@ -808,81 +669,64 @@ } } - ConSrvReleaseScreenBuffer(Buff, TRUE); - - ReadOutputRequest->ReadRegion.Right = ReadRegion.Left + SizeX - 1; - ReadOutputRequest->ReadRegion.Bottom = ReadRegion.Top + SizeY - 1; - ReadOutputRequest->ReadRegion.Left = ReadRegion.Left; - ReadOutputRequest->ReadRegion.Top = ReadRegion.Top; + ReadRegion->Left = CapturedReadRegion.Left; + ReadRegion->Top = CapturedReadRegion.Top ; + ReadRegion->Right = CapturedReadRegion.Left + SizeX - 1; + ReadRegion->Bottom = CapturedReadRegion.Top + SizeY - 1; return STATUS_SUCCESS; } -CSR_API(SrvWriteConsoleOutput) -{ - PCONSOLE_WRITEOUTPUT WriteOutputRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.WriteOutputRequest; - PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process); +NTSTATUS NTAPI +ConDrvWriteConsoleOutput(IN PCONSOLE Console, + IN PTEXTMODE_SCREEN_BUFFER Buffer, + IN BOOL Unicode, + IN PCHAR_INFO CharInfo/*Buffer*/, + IN PCOORD BufferSize, + IN PCOORD BufferCoord, + IN OUT PSMALL_RECT WriteRegion) +{ SHORT i, X, Y, SizeX, SizeY; - PCONSOLE Console; - PTEXTMODE_SCREEN_BUFFER Buff; SMALL_RECT ScreenBuffer; PCHAR_INFO CurCharInfo; - SMALL_RECT WriteRegion; - PCHAR_INFO CharInfo; - COORD BufferCoord; - COORD BufferSize; - NTSTATUS Status; + SMALL_RECT CapturedWriteRegion; PCHAR_INFO Ptr; - DPRINT("SrvWriteConsoleOutput\n"); - - BufferSize = WriteOutputRequest->BufferSize; - BufferCoord = WriteOutputRequest->BufferCoord; - CharInfo = WriteOutputRequest->CharInfo; - - if (!CsrValidateMessageBuffer(ApiMessage, - (PVOID*)&WriteOutputRequest->CharInfo, - BufferSize.X * BufferSize.Y, - sizeof(CHAR_INFO))) + if (Console == NULL || Buffer == NULL || CharInfo == NULL || + BufferSize == NULL || BufferCoord == NULL || WriteRegion == NULL) { return STATUS_INVALID_PARAMETER; } - Status = ConSrvGetTextModeBuffer(ProcessData, - WriteOutputRequest->OutputHandle, - &Buff, - GENERIC_WRITE, - TRUE); - if (!NT_SUCCESS(Status)) return Status; - - Console = Buff->Header.Console; - - WriteRegion = WriteOutputRequest->WriteRegion; - - SizeY = min(BufferSize.Y - BufferCoord.Y, ConioRectHeight(&WriteRegion)); - SizeX = min(BufferSize.X - BufferCoord.X, ConioRectWidth(&WriteRegion)); - WriteRegion.Bottom = WriteRegion.Top + SizeY - 1; - WriteRegion.Right = WriteRegion.Left + SizeX - 1; + /* Validity check */ + ASSERT(Console == Buffer->Header.Console); + + CapturedWriteRegion = *WriteRegion; + + SizeX = min(BufferSize->X - BufferCoord->X, ConioRectWidth(&CapturedWriteRegion)); + SizeY = min(BufferSize->Y - BufferCoord->Y, ConioRectHeight(&CapturedWriteRegion)); + CapturedWriteRegion.Right = CapturedWriteRegion.Left + SizeX - 1; + CapturedWriteRegion.Bottom = CapturedWriteRegion.Top + SizeY - 1; /* Make sure WriteRegion is inside the screen buffer */ - ConioInitRect(&ScreenBuffer, 0, 0, Buff->ScreenBufferSize.Y - 1, Buff->ScreenBufferSize.X - 1); - if (!ConioGetIntersection(&WriteRegion, &ScreenBuffer, &WriteRegion)) - { - ConSrvReleaseScreenBuffer(Buff, TRUE); - - /* It is okay to have a WriteRegion completely outside the screen buffer. - No data is written then. */ + ConioInitRect(&ScreenBuffer, 0, 0, Buffer->ScreenBufferSize.Y - 1, Buffer->ScreenBufferSize.X - 1); + if (!ConioGetIntersection(&CapturedWriteRegion, &ScreenBuffer, &CapturedWriteRegion)) + { + /* + * It is okay to have a WriteRegion completely outside + * the screen buffer. No data is written then. + */ return STATUS_SUCCESS; } - for (i = 0, Y = WriteRegion.Top; Y <= WriteRegion.Bottom; i++, Y++) - { - CurCharInfo = CharInfo + (i + BufferCoord.Y) * BufferSize.X + BufferCoord.X; - - Ptr = ConioCoordToPointer(Buff, WriteRegion.Left, Y); - for (X = WriteRegion.Left; X <= WriteRegion.Right; X++) - { - if (WriteOutputRequest->Unicode) + for (i = 0, Y = CapturedWriteRegion.Top; Y <= CapturedWriteRegion.Bottom; i++, Y++) + { + CurCharInfo = CharInfo + (i + BufferCoord->Y) * BufferSize->X + BufferCoord->X; + + Ptr = ConioCoordToPointer(Buffer, CapturedWriteRegion.Left, Y); + for (X = CapturedWriteRegion.Left; X <= CapturedWriteRegion.Right; X++) + { + if (Unicode) { Ptr->Char.UnicodeChar = CurCharInfo->Char.UnicodeChar; } @@ -896,41 +740,20 @@ } } - ConioDrawRegion(Console, &WriteRegion); - - ConSrvReleaseScreenBuffer(Buff, TRUE); - - WriteOutputRequest->WriteRegion.Right = WriteRegion.Left + SizeX - 1; - WriteOutputRequest->WriteRegion.Bottom = WriteRegion.Top + SizeY - 1; - WriteOutputRequest->WriteRegion.Left = WriteRegion.Left; - WriteOutputRequest->WriteRegion.Top = WriteRegion.Top; + ConioDrawRegion(Console, &CapturedWriteRegion); + + WriteRegion->Left = CapturedWriteRegion.Left; + WriteRegion->Top = CapturedWriteRegion.Top ; + WriteRegion->Right = CapturedWriteRegion.Left + SizeX - 1; + WriteRegion->Bottom = CapturedWriteRegion.Top + SizeY - 1; return STATUS_SUCCESS; } -CSR_API(SrvWriteConsole) -{ - NTSTATUS Status; - PCONSOLE_WRITECONSOLE WriteConsoleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.WriteConsoleRequest; - - DPRINT("SrvWriteConsole\n"); - - if (!CsrValidateMessageBuffer(ApiMessage, - (PVOID)&WriteConsoleRequest->Buffer, - WriteConsoleRequest->BufferSize, - sizeof(BYTE))) - { - return STATUS_INVALID_PARAMETER; - } - - Status = DoWriteConsole(ApiMessage, - CsrGetClientThread(), - TRUE); - - if (Status == STATUS_PENDING) - *ReplyCode = CsrReplyPending; - - return Status; +NTSTATUS NTAPI +ConDrvWriteConsole(IN PCONSOLE Console) +{ + return STATUS_NOT_IMPLEMENTED; } CSR_API(SrvReadConsoleOutputString) Modified: trunk/reactos/win32ss/user/consrv/conoutput.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/consrv/conout…
============================================================================== --- trunk/reactos/win32ss/user/consrv/conoutput.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/consrv/conoutput.c [iso-8859-1] Sun Jun 23 14:51:08 2013 @@ -269,7 +269,771 @@ } +/* CSR THREADS FOR WriteConsole ***********************************************/ + +static NTSTATUS +DoWriteConsole(IN PCSR_API_MESSAGE ApiMessage, + IN PCSR_THREAD ClientThread, + IN BOOL CreateWaitBlock OPTIONAL); + +// Wait function CSR_WAIT_FUNCTION +static BOOLEAN +WriteConsoleThread(IN PLIST_ENTRY WaitList, + IN PCSR_THREAD WaitThread, + IN PCSR_API_MESSAGE WaitApiMessage, + IN PVOID WaitContext, + IN PVOID WaitArgument1, + IN PVOID WaitArgument2, + IN ULONG WaitFlags) +{ + NTSTATUS Status; + + DPRINT("WriteConsoleThread - WaitContext = 0x%p, WaitArgument1 = 0x%p, WaitArgument2 = 0x%p, WaitFlags = %lu\n", WaitContext, WaitArgument1, WaitArgument2, WaitFlags); + + /* + * If we are notified of the process termination via a call + * to CsrNotifyWaitBlock triggered by CsrDestroyProcess or + * CsrDestroyThread, just return. + */ + if (WaitFlags & CsrProcessTerminating) + { + Status = STATUS_THREAD_IS_TERMINATING; + goto Quit; + } + + Status = DoWriteConsole(WaitApiMessage, + WaitThread, + FALSE); + +Quit: + if (Status != STATUS_PENDING) + { + WaitApiMessage->Status = Status; + } + + return (Status == STATUS_PENDING ? FALSE : TRUE); +} + +static NTSTATUS +DoWriteConsole(IN PCSR_API_MESSAGE ApiMessage, + IN PCSR_THREAD ClientThread, + IN BOOL CreateWaitBlock OPTIONAL) +{ + NTSTATUS Status = STATUS_SUCCESS; + PCONSOLE_WRITECONSOLE WriteConsoleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.WriteConsoleRequest; + PCONSOLE Console; + PTEXTMODE_SCREEN_BUFFER Buff; + PVOID Buffer; + DWORD Written = 0; + ULONG Length; + + Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(ClientThread->Process), WriteConsoleRequest->OutputHandle, &Buff, GENERIC_WRITE, FALSE); + if (!NT_SUCCESS(Status)) return Status; + + Console = Buff->Header.Console; + + // if (Console->PauseFlags & (PAUSED_FROM_KEYBOARD | PAUSED_FROM_SCROLLBAR | PAUSED_FROM_SELECTION)) + if (Console->PauseFlags && Console->UnpauseEvent != NULL) + { + if (CreateWaitBlock) + { + if (!CsrCreateWait(&Console->WriteWaitQueue, + WriteConsoleThread, + ClientThread, + ApiMessage, + NULL, + NULL)) + { + /* Fail */ + ConSrvReleaseScreenBuffer(Buff, FALSE); + return STATUS_NO_MEMORY; + } + } + + /* Wait until we un-pause the console */ + Status = STATUS_PENDING; + } + else + { + if (WriteConsoleRequest->Unicode) + { + Buffer = WriteConsoleRequest->Buffer; + } + else + { + Length = MultiByteToWideChar(Console->OutputCodePage, 0, + (PCHAR)WriteConsoleRequest->Buffer, + WriteConsoleRequest->NrCharactersToWrite, + NULL, 0); + Buffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, Length * sizeof(WCHAR)); + if (Buffer) + { + MultiByteToWideChar(Console->OutputCodePage, 0, + (PCHAR)WriteConsoleRequest->Buffer, + WriteConsoleRequest->NrCharactersToWrite, + (PWCHAR)Buffer, Length); + } + else + { + Status = STATUS_NO_MEMORY; + } + } + + if (Buffer) + { + if (NT_SUCCESS(Status)) + { + Status = ConioWriteConsole(Console, + Buff, + Buffer, + WriteConsoleRequest->NrCharactersToWrite, + TRUE); + if (NT_SUCCESS(Status)) + { + Written = WriteConsoleRequest->NrCharactersToWrite; + } + } + + if (!WriteConsoleRequest->Unicode) + RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer); + } + + WriteConsoleRequest->NrCharactersWritten = Written; + } + + ConSrvReleaseScreenBuffer(Buff, FALSE); + return Status; +} + + /* TEXT OUTPUT APIS ***********************************************************/ +NTSTATUS NTAPI +ConDrvReadConsoleOutput(IN PCONSOLE Console, + IN PTEXTMODE_SCREEN_BUFFER Buffer, + IN BOOL Unicode, + OUT PCHAR_INFO CharInfo/*Buffer*/, + IN PCOORD BufferSize, + IN PCOORD BufferCoord, + IN OUT PSMALL_RECT ReadRegion); +CSR_API(SrvReadConsoleOutput) +{ + NTSTATUS Status; + PCONSOLE_READOUTPUT ReadOutputRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ReadOutputRequest; + PTEXTMODE_SCREEN_BUFFER Buffer; + + DPRINT("SrvReadConsoleOutput\n"); + + if (!CsrValidateMessageBuffer(ApiMessage, + (PVOID*)&ReadOutputRequest->CharInfo, + ReadOutputRequest->BufferSize.X * ReadOutputRequest->BufferSize.Y, + sizeof(CHAR_INFO))) + { + return STATUS_INVALID_PARAMETER; + } + + Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), + ReadOutputRequest->OutputHandle, + &Buffer, GENERIC_READ, TRUE); + if (!NT_SUCCESS(Status)) return Status; + + Status = ConDrvReadConsoleOutput(Buffer->Header.Console, + Buffer, + ReadOutputRequest->Unicode, + ReadOutputRequest->CharInfo, + &ReadOutputRequest->BufferSize, + &ReadOutputRequest->BufferCoord, + &ReadOutputRequest->ReadRegion); + + ConSrvReleaseScreenBuffer(Buffer, TRUE); + return Status; +} + +NTSTATUS NTAPI +ConDrvWriteConsoleOutput(IN PCONSOLE Console, + IN PTEXTMODE_SCREEN_BUFFER Buffer, + IN BOOL Unicode, + IN PCHAR_INFO CharInfo/*Buffer*/, + IN PCOORD BufferSize, + IN PCOORD BufferCoord, + IN OUT PSMALL_RECT WriteRegion); +CSR_API(SrvWriteConsoleOutput) +{ + NTSTATUS Status; + PCONSOLE_WRITEOUTPUT WriteOutputRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.WriteOutputRequest; + PTEXTMODE_SCREEN_BUFFER Buffer; + + DPRINT("SrvWriteConsoleOutput\n"); + + if (!CsrValidateMessageBuffer(ApiMessage, + (PVOID*)&WriteOutputRequest->CharInfo, + WriteOutputRequest->BufferSize.X * WriteOutputRequest->BufferSize.Y, + sizeof(CHAR_INFO))) + { + return STATUS_INVALID_PARAMETER; + } + + Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), + WriteOutputRequest->OutputHandle, + &Buffer, GENERIC_WRITE, TRUE); + if (!NT_SUCCESS(Status)) return Status; + + Status = ConDrvWriteConsoleOutput(Buffer->Header.Console, + Buffer, + WriteOutputRequest->Unicode, + WriteOutputRequest->CharInfo, + &WriteOutputRequest->BufferSize, + &WriteOutputRequest->BufferCoord, + &WriteOutputRequest->WriteRegion); + + ConSrvReleaseScreenBuffer(Buffer, TRUE); + return Status; +} + +CSR_API(SrvWriteConsole) +{ + NTSTATUS Status; + PCONSOLE_WRITECONSOLE WriteConsoleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.WriteConsoleRequest; + + DPRINT("SrvWriteConsole\n"); + + if (!CsrValidateMessageBuffer(ApiMessage, + (PVOID)&WriteConsoleRequest->Buffer, + WriteConsoleRequest->BufferSize, + sizeof(BYTE))) + { + return STATUS_INVALID_PARAMETER; + } + + Status = DoWriteConsole(ApiMessage, + CsrGetClientThread(), + TRUE); + + if (Status == STATUS_PENDING) + *ReplyCode = CsrReplyPending; + + return Status; +} + +#if 0000 + +CSR_API(SrvReadConsoleOutputString) +{ + NTSTATUS Status; + PCONSOLE_READOUTPUTCODE ReadOutputCodeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ReadOutputCodeRequest; + PCONSOLE Console; + PTEXTMODE_SCREEN_BUFFER Buff; + USHORT CodeType; + SHORT Xpos, Ypos; + PVOID ReadBuffer; + DWORD i; + ULONG CodeSize; + PCHAR_INFO Ptr; + + DPRINT("SrvReadConsoleOutputString\n"); + + CodeType = ReadOutputCodeRequest->CodeType; + switch (CodeType) + { + case CODE_ASCII: + CodeSize = sizeof(CHAR); + break; + + case CODE_UNICODE: + CodeSize = sizeof(WCHAR); + break; + + case CODE_ATTRIBUTE: + CodeSize = sizeof(WORD); + break; + + default: + return STATUS_INVALID_PARAMETER; + } + + if (!CsrValidateMessageBuffer(ApiMessage, + (PVOID*)&ReadOutputCodeRequest->pCode.pCode, + ReadOutputCodeRequest->NumCodesToRead, + CodeSize)) + { + return STATUS_INVALID_PARAMETER; + } + + Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), + ReadOutputCodeRequest->OutputHandle, + &Buff, + GENERIC_READ, + TRUE); + if (!NT_SUCCESS(Status)) return Status; + + Console = Buff->Header.Console; + + ReadBuffer = ReadOutputCodeRequest->pCode.pCode; + Xpos = ReadOutputCodeRequest->ReadCoord.X; + Ypos = (ReadOutputCodeRequest->ReadCoord.Y + Buff->VirtualY) % Buff->ScreenBufferSize.Y; + + /* + * MSDN (ReadConsoleOutputAttribute and ReadConsoleOutputCharacter) : + * + * If the number of attributes (resp. characters) to be read from extends + * beyond the end of the specified screen buffer row, attributes (resp. + * characters) are read from the next row. If the number of attributes + * (resp. characters) to be read from extends beyond the end of the console + * screen buffer, attributes (resp. characters) up to the end of the console + * screen buffer are read. + * + * TODO: Do NOT loop up to NumCodesToRead, but stop before + * if we are going to overflow... + */ + // Ptr = ConioCoordToPointer(Buff, Xpos, Ypos); // Doesn't work + for (i = 0; i < min(ReadOutputCodeRequest->NumCodesToRead, Buff->ScreenBufferSize.X * Buff->ScreenBufferSize.Y); ++i) + { + // Ptr = ConioCoordToPointer(Buff, Xpos, Ypos); // Doesn't work either + Ptr = &Buff->Buffer[Xpos + Ypos * Buff->ScreenBufferSize.X]; + + switch (CodeType) + { + case CODE_ASCII: + ConsoleUnicodeCharToAnsiChar(Console, (PCHAR)ReadBuffer, &Ptr->Char.UnicodeChar); + break; + + case CODE_UNICODE: + *(PWCHAR)ReadBuffer = Ptr->Char.UnicodeChar; + break; + + case CODE_ATTRIBUTE: + *(PWORD)ReadBuffer = Ptr->Attributes; + break; + } + ReadBuffer = (PVOID)((ULONG_PTR)ReadBuffer + CodeSize); + // ++Ptr; + + Xpos++; + + if (Xpos == Buff->ScreenBufferSize.X) + { + Xpos = 0; + Ypos++; + + if (Ypos == Buff->ScreenBufferSize.Y) + { + Ypos = 0; + } + } + } + + // switch (CodeType) + // { + // case CODE_UNICODE: + // *(PWCHAR)ReadBuffer = 0; + // break; + + // case CODE_ASCII: + // *(PCHAR)ReadBuffer = 0; + // break; + + // case CODE_ATTRIBUTE: + // *(PWORD)ReadBuffer = 0; + // break; + // } + + ReadOutputCodeRequest->EndCoord.X = Xpos; + ReadOutputCodeRequest->EndCoord.Y = (Ypos - Buff->VirtualY + Buff->ScreenBufferSize.Y) % Buff->ScreenBufferSize.Y; + + ConSrvReleaseScreenBuffer(Buff, TRUE); + + ReadOutputCodeRequest->CodesRead = (DWORD)((ULONG_PTR)ReadBuffer - (ULONG_PTR)ReadOutputCodeRequest->pCode.pCode) / CodeSize; + // <= ReadOutputCodeRequest->NumCodesToRead + + return STATUS_SUCCESS; +} + +CSR_API(SrvWriteConsoleOutputString) +{ + NTSTATUS Status; + PCONSOLE_WRITEOUTPUTCODE WriteOutputCodeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.WriteOutputCodeRequest; + PCONSOLE Console; + PTEXTMODE_SCREEN_BUFFER Buff; + USHORT CodeType; + PVOID ReadBuffer = NULL; + PWCHAR tmpString = NULL; + DWORD X, Y, Length; // , Written = 0; + ULONG CodeSize; + SMALL_RECT UpdateRect; + PCHAR_INFO Ptr; + + DPRINT("SrvWriteConsoleOutputString\n"); + + CodeType = WriteOutputCodeRequest->CodeType; + switch (CodeType) + { + case CODE_ASCII: + CodeSize = sizeof(CHAR); + break; + + case CODE_UNICODE: + CodeSize = sizeof(WCHAR); + break; + + case CODE_ATTRIBUTE: + CodeSize = sizeof(WORD); + break; + + default: + return STATUS_INVALID_PARAMETER; + } + + if (!CsrValidateMessageBuffer(ApiMessage, + (PVOID*)&WriteOutputCodeRequest->pCode.pCode, + WriteOutputCodeRequest->Length, + CodeSize)) + { + return STATUS_INVALID_PARAMETER; + } + + Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), + WriteOutputCodeRequest->OutputHandle, + &Buff, + GENERIC_WRITE, + TRUE); + if (!NT_SUCCESS(Status)) return Status; + + Console = Buff->Header.Console; + + if (CodeType == CODE_ASCII) + { + /* Convert the ASCII string into Unicode before writing it to the console */ + Length = MultiByteToWideChar(Console->OutputCodePage, 0, + WriteOutputCodeRequest->pCode.AsciiChar, + WriteOutputCodeRequest->Length, + NULL, 0); + tmpString = ReadBuffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, Length * sizeof(WCHAR)); + if (ReadBuffer) + { + MultiByteToWideChar(Console->OutputCodePage, 0, + WriteOutputCodeRequest->pCode.AsciiChar, + WriteOutputCodeRequest->Length, + (PWCHAR)ReadBuffer, Length); + } + else + { + Status = STATUS_NO_MEMORY; + } + } + else + { + /* For CODE_UNICODE or CODE_ATTRIBUTE, we are already OK */ + ReadBuffer = WriteOutputCodeRequest->pCode.pCode; + } + + if (ReadBuffer == NULL || !NT_SUCCESS(Status)) goto Cleanup; + + X = WriteOutputCodeRequest->Coord.X; + Y = (WriteOutputCodeRequest->Coord.Y + Buff->VirtualY) % Buff->ScreenBufferSize.Y; + Length = WriteOutputCodeRequest->Length; + // Ptr = ConioCoordToPointer(Buff, X, Y); // Doesn't work + // Ptr = &Buff->Buffer[X + Y * Buff->ScreenBufferSize.X]; // May work + + while (Length--) + { + // Ptr = ConioCoordToPointer(Buff, X, Y); // Doesn't work either + Ptr = &Buff->Buffer[X + Y * Buff->ScreenBufferSize.X]; + + switch (CodeType) + { + case CODE_ASCII: + case CODE_UNICODE: + Ptr->Char.UnicodeChar = *(PWCHAR)ReadBuffer; + break; + + case CODE_ATTRIBUTE: + Ptr->Attributes = *(PWORD)ReadBuffer; + break; + } + ReadBuffer = (PVOID)((ULONG_PTR)ReadBuffer + CodeSize); + // ++Ptr; + + // Written++; + if (++X == Buff->ScreenBufferSize.X) + { + X = 0; + + if (++Y == Buff->ScreenBufferSize.Y) + { + Y = 0; + } + } + } + + if ((PCONSOLE_SCREEN_BUFFER)Buff == Console->ActiveBuffer) + { + ConioComputeUpdateRect(Buff, &UpdateRect, &WriteOutputCodeRequest->Coord, + WriteOutputCodeRequest->Length); + ConioDrawRegion(Console, &UpdateRect); + } + + // WriteOutputCodeRequest->EndCoord.X = X; + // WriteOutputCodeRequest->EndCoord.Y = (Y + Buff->ScreenBufferSize.Y - Buff->VirtualY) % Buff->ScreenBufferSize.Y; + +Cleanup: + if (tmpString) + RtlFreeHeap(RtlGetProcessHeap(), 0, tmpString); + + ConSrvReleaseScreenBuffer(Buff, TRUE); + + // WriteOutputCodeRequest->NrCharactersWritten = Written; + return Status; +} + +CSR_API(SrvFillConsoleOutput) +{ + NTSTATUS Status; + PCONSOLE_FILLOUTPUTCODE FillOutputRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.FillOutputRequest; + PCONSOLE Console; + PTEXTMODE_SCREEN_BUFFER Buff; + DWORD X, Y, Length; // , Written = 0; + USHORT CodeType; + PVOID Code = NULL; + PCHAR_INFO Ptr; + SMALL_RECT UpdateRect; + + DPRINT("SrvFillConsoleOutput\n"); + + CodeType = FillOutputRequest->CodeType; + if ( (CodeType != CODE_ASCII ) && + (CodeType != CODE_UNICODE ) && + (CodeType != CODE_ATTRIBUTE) ) + { + return STATUS_INVALID_PARAMETER; + } + + Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), + FillOutputRequest->OutputHandle, + &Buff, + GENERIC_WRITE, + TRUE); + if (!NT_SUCCESS(Status)) return Status; + + Console = Buff->Header.Console; + + switch (CodeType) + { + case CODE_ASCII: + /* On-place conversion from the ASCII char to the UNICODE char */ + ConsoleAnsiCharToUnicodeChar(Console, &FillOutputRequest->Code.UnicodeChar, &FillOutputRequest->Code.AsciiChar); + /* Fall through */ + case CODE_UNICODE: + Code = &FillOutputRequest->Code.UnicodeChar; + break; + + case CODE_ATTRIBUTE: + Code = &FillOutputRequest->Code.Attribute; + break; + } + + X = FillOutputRequest->Coord.X; + Y = (FillOutputRequest->Coord.Y + Buff->VirtualY) % Buff->ScreenBufferSize.Y; + Length = FillOutputRequest->Length; + // Ptr = ConioCoordToPointer(Buff, X, Y); // Doesn't work + // Ptr = &Buff->Buffer[X + Y * Buff->ScreenBufferSize.X]; // May work + + while (Length--) + { + // Ptr = ConioCoordToPointer(Buff, X, Y); // Doesn't work either + Ptr = &Buff->Buffer[X + Y * Buff->ScreenBufferSize.X]; + + switch (CodeType) + { + case CODE_ASCII: + case CODE_UNICODE: + Ptr->Char.UnicodeChar = *(PWCHAR)Code; + break; + + case CODE_ATTRIBUTE: + Ptr->Attributes = *(PWORD)Code; + break; + } + // ++Ptr; + + // Written++; + if (++X == Buff->ScreenBufferSize.X) + { + X = 0; + + if (++Y == Buff->ScreenBufferSize.Y) + { + Y = 0; + } + } + } + + if ((PCONSOLE_SCREEN_BUFFER)Buff == Console->ActiveBuffer) + { + ConioComputeUpdateRect(Buff, &UpdateRect, &FillOutputRequest->Coord, + FillOutputRequest->Length); + ConioDrawRegion(Console, &UpdateRect); + } + + ConSrvReleaseScreenBuffer(Buff, TRUE); +/* + Length = FillOutputRequest->Length; + FillOutputRequest->NrCharactersWritten = Length; +*/ + return STATUS_SUCCESS; +} + +CSR_API(SrvGetConsoleScreenBufferInfo) +{ + NTSTATUS Status; + PCONSOLE_GETSCREENBUFFERINFO ScreenBufferInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ScreenBufferInfoRequest; + // PCONSOLE Console; + PTEXTMODE_SCREEN_BUFFER Buff; + PCONSOLE_SCREEN_BUFFER_INFO pInfo = &ScreenBufferInfoRequest->Info; + + DPRINT("SrvGetConsoleScreenBufferInfo\n"); + + Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), ScreenBufferInfoRequest->OutputHandle, &Buff, GENERIC_READ, TRUE); + if (!NT_SUCCESS(Status)) return Status; + + // Console = Buff->Header.Console; + + pInfo->dwSize = Buff->ScreenBufferSize; + pInfo->dwCursorPosition = Buff->CursorPosition; + pInfo->wAttributes = Buff->ScreenDefaultAttrib; + pInfo->srWindow.Left = Buff->ViewOrigin.X; + pInfo->srWindow.Top = Buff->ViewOrigin.Y; + pInfo->srWindow.Right = Buff->ViewOrigin.X + Buff->ViewSize.X - 1; + pInfo->srWindow.Bottom = Buff->ViewOrigin.Y + Buff->ViewSize.Y - 1; + pInfo->dwMaximumWindowSize = Buff->ScreenBufferSize; // TODO: Refine the computation + + ConSrvReleaseScreenBuffer(Buff, TRUE); + return STATUS_SUCCESS; +} + +CSR_API(SrvSetConsoleTextAttribute) +{ + NTSTATUS Status; + PCONSOLE_SETTEXTATTRIB SetTextAttribRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetTextAttribRequest; + PTEXTMODE_SCREEN_BUFFER Buff; + + DPRINT("SrvSetConsoleTextAttribute\n"); + + Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), SetTextAttribRequest->OutputHandle, &Buff, GENERIC_WRITE, TRUE); + if (!NT_SUCCESS(Status)) return Status; + + Buff->ScreenDefaultAttrib = SetTextAttribRequest->Attrib; + + ConSrvReleaseScreenBuffer(Buff, TRUE); + return STATUS_SUCCESS; +} + +CSR_API(SrvSetConsoleScreenBufferSize) +{ + NTSTATUS Status; + PCONSOLE_SETSCREENBUFFERSIZE SetScreenBufferSizeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetScreenBufferSizeRequest; + PCONSOLE Console; + PTEXTMODE_SCREEN_BUFFER Buff; + + Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), SetScreenBufferSizeRequest->OutputHandle, &Buff, GENERIC_WRITE, TRUE); + if (!NT_SUCCESS(Status)) return Status; + + Console = Buff->Header.Console; + + Status = ConioResizeBuffer(Console, Buff, SetScreenBufferSizeRequest->Size); + if (NT_SUCCESS(Status)) ConioResizeTerminal(Console); + + ConSrvReleaseScreenBuffer(Buff, TRUE); + return Status; +} + +CSR_API(SrvScrollConsoleScreenBuffer) +{ + PCONSOLE_SCROLLSCREENBUFFER ScrollScreenBufferRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ScrollScreenBufferRequest; + PCONSOLE Console; + PTEXTMODE_SCREEN_BUFFER Buff; + SMALL_RECT ScreenBuffer; + SMALL_RECT SrcRegion; + SMALL_RECT DstRegion; + SMALL_RECT UpdateRegion; + SMALL_RECT ScrollRectangle; + SMALL_RECT ClipRectangle; + NTSTATUS Status; + HANDLE OutputHandle; + BOOLEAN UseClipRectangle; + COORD DestinationOrigin; + CHAR_INFO FillChar; + + DPRINT("SrvScrollConsoleScreenBuffer\n"); + + OutputHandle = ScrollScreenBufferRequest->OutputHandle; + UseClipRectangle = ScrollScreenBufferRequest->UseClipRectangle; + DestinationOrigin = ScrollScreenBufferRequest->DestinationOrigin; + FillChar = ScrollScreenBufferRequest->Fill; + + Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), OutputHandle, &Buff, GENERIC_WRITE, TRUE); + if (!NT_SUCCESS(Status)) return Status; + + Console = Buff->Header.Console; + + ScrollRectangle = ScrollScreenBufferRequest->ScrollRectangle; + + /* Make sure source rectangle is inside the screen buffer */ + ConioInitRect(&ScreenBuffer, 0, 0, Buff->ScreenBufferSize.Y - 1, Buff->ScreenBufferSize.X - 1); + if (!ConioGetIntersection(&SrcRegion, &ScreenBuffer, &ScrollRectangle)) + { + ConSrvReleaseScreenBuffer(Buff, TRUE); + return STATUS_SUCCESS; + } + + /* If the source was clipped on the left or top, adjust the destination accordingly */ + if (ScrollRectangle.Left < 0) + { + DestinationOrigin.X -= ScrollRectangle.Left; + } + if (ScrollRectangle.Top < 0) + { + DestinationOrigin.Y -= ScrollRectangle.Top; + } + + if (UseClipRectangle) + { + ClipRectangle = ScrollScreenBufferRequest->ClipRectangle; + if (!ConioGetIntersection(&ClipRectangle, &ClipRectangle, &ScreenBuffer)) + { + ConSrvReleaseScreenBuffer(Buff, TRUE); + return STATUS_SUCCESS; + } + } + else + { + ClipRectangle = ScreenBuffer; + } + + ConioInitRect(&DstRegion, + DestinationOrigin.Y, + DestinationOrigin.X, + DestinationOrigin.Y + ConioRectHeight(&SrcRegion) - 1, + DestinationOrigin.X + ConioRectWidth(&SrcRegion) - 1); + + if (!ScrollScreenBufferRequest->Unicode) + ConsoleAnsiCharToUnicodeChar(Console, &FillChar.Char.UnicodeChar, &FillChar.Char.AsciiChar); + + ConioMoveRegion(Buff, &SrcRegion, &DstRegion, &ClipRectangle, FillChar); + + if ((PCONSOLE_SCREEN_BUFFER)Buff == Console->ActiveBuffer) + { + ConioGetUnion(&UpdateRegion, &SrcRegion, &DstRegion); + if (ConioGetIntersection(&UpdateRegion, &UpdateRegion, &ClipRectangle)) + { + /* Draw update region */ + ConioDrawRegion(Console, &UpdateRegion); + } + } + + ConSrvReleaseScreenBuffer(Buff, TRUE); + return STATUS_SUCCESS; +} + +#endif /* EOF */ Removed: trunk/reactos/win32ss/user/consrv/text.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/consrv/text.c…
============================================================================== --- trunk/reactos/win32ss/user/consrv/text.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/consrv/text.c (removed) @@ -1,1453 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS Console Server DLL - * FILE: win32ss/user/consrv/text.c - * PURPOSE: Console Output Functions for text-mode screen-buffers - * PROGRAMMERS: Jeffrey Morlan - * Hermes Belusca-Maito (hermes.belusca(a)sfr.fr) - */ - -/* INCLUDES *******************************************************************/ - -#include "consrv.h" -#include "include/conio.h" -#include "conio.h" -#include "conoutput.h" -#include "handle.h" - -#define NDEBUG -#include <debug.h> - -/* -// Define wmemset(...) -#include <wchar.h> -#define HAVE_WMEMSET -*/ - - -/* GLOBALS ********************************************************************/ - -#define TAB_WIDTH 8 - - -/* PRIVATE FUNCTIONS **********************************************************/ - -CONSOLE_IO_OBJECT_TYPE -TEXTMODE_BUFFER_GetType(PCONSOLE_SCREEN_BUFFER This) -{ - // return This->Header.Type; - return TEXTMODE_BUFFER; -} - -static CONSOLE_SCREEN_BUFFER_VTBL TextVtbl = -{ - TEXTMODE_BUFFER_GetType, -}; - - -static VOID FASTCALL -ClearLineBuffer(PTEXTMODE_SCREEN_BUFFER Buff); - - -NTSTATUS -CONSOLE_SCREEN_BUFFER_Initialize(OUT PCONSOLE_SCREEN_BUFFER* Buffer, - IN OUT PCONSOLE Console, - IN SIZE_T Size); -VOID -CONSOLE_SCREEN_BUFFER_Destroy(IN OUT PCONSOLE_SCREEN_BUFFER Buffer); - - -NTSTATUS -TEXTMODE_BUFFER_Initialize(OUT PCONSOLE_SCREEN_BUFFER* Buffer, - IN OUT PCONSOLE Console, - IN PTEXTMODE_BUFFER_INFO TextModeInfo) -{ - NTSTATUS Status = STATUS_SUCCESS; - PTEXTMODE_SCREEN_BUFFER NewBuffer = NULL; - - if (Console == NULL || Buffer == NULL || TextModeInfo == NULL) - return STATUS_INVALID_PARAMETER; - - *Buffer = NULL; - - Status = CONSOLE_SCREEN_BUFFER_Initialize((PCONSOLE_SCREEN_BUFFER*)&NewBuffer, - Console, - sizeof(TEXTMODE_SCREEN_BUFFER)); - if (!NT_SUCCESS(Status)) return Status; - NewBuffer->Header.Type = TEXTMODE_BUFFER; - NewBuffer->Vtbl = &TextVtbl; - - NewBuffer->Buffer = ConsoleAllocHeap(HEAP_ZERO_MEMORY, - TextModeInfo->ScreenBufferSize.X * - TextModeInfo->ScreenBufferSize.Y * - sizeof(CHAR_INFO)); - if (NewBuffer->Buffer == NULL) - { - CONSOLE_SCREEN_BUFFER_Destroy((PCONSOLE_SCREEN_BUFFER)NewBuffer); - return STATUS_INSUFFICIENT_RESOURCES; - } - - NewBuffer->ScreenBufferSize = NewBuffer->OldScreenBufferSize - = TextModeInfo->ScreenBufferSize; - NewBuffer->ViewSize = NewBuffer->OldViewSize - = Console->ConsoleSize; - - NewBuffer->ViewOrigin.X = NewBuffer->ViewOrigin.Y = 0; - NewBuffer->VirtualY = 0; - - NewBuffer->CursorBlinkOn = NewBuffer->ForceCursorOff = FALSE; - NewBuffer->CursorInfo.bVisible = (TextModeInfo->IsCursorVisible && (TextModeInfo->CursorSize != 0)); - NewBuffer->CursorInfo.dwSize = min(max(TextModeInfo->CursorSize, 0), 100); - - NewBuffer->ScreenDefaultAttrib = TextModeInfo->ScreenAttrib; - NewBuffer->PopupDefaultAttrib = TextModeInfo->PopupAttrib; - - /* Initialize buffer to be empty with default attributes */ - for (NewBuffer->CursorPosition.Y = 0 ; NewBuffer->CursorPosition.Y < NewBuffer->ScreenBufferSize.Y; NewBuffer->CursorPosition.Y++) - { - ClearLineBuffer(NewBuffer); - } - NewBuffer->CursorPosition.X = NewBuffer->CursorPosition.Y = 0; - - NewBuffer->Mode = ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT; - - *Buffer = (PCONSOLE_SCREEN_BUFFER)NewBuffer; - return STATUS_SUCCESS; -} - -VOID -TEXTMODE_BUFFER_Destroy(IN OUT PCONSOLE_SCREEN_BUFFER Buffer) -{ - PTEXTMODE_SCREEN_BUFFER Buff = (PTEXTMODE_SCREEN_BUFFER)Buffer; - - /* - * IMPORTANT !! Reinitialize the type so that we don't enter a recursive - * infinite loop when calling CONSOLE_SCREEN_BUFFER_Destroy. - */ - Buffer->Header.Type = SCREEN_BUFFER; - - ConsoleFreeHeap(Buff->Buffer); - - CONSOLE_SCREEN_BUFFER_Destroy(Buffer); -} - - -PCHAR_INFO -ConioCoordToPointer(PTEXTMODE_SCREEN_BUFFER Buff, ULONG X, ULONG Y) -{ - return &Buff->Buffer[((Y + Buff->VirtualY) % Buff->ScreenBufferSize.Y) * Buff->ScreenBufferSize.X + X]; -} - -static VOID FASTCALL -ClearLineBuffer(PTEXTMODE_SCREEN_BUFFER Buff) -{ - PCHAR_INFO Ptr = ConioCoordToPointer(Buff, 0, Buff->CursorPosition.Y); - SHORT Pos; - - for (Pos = 0; Pos < Buff->ScreenBufferSize.X; Pos++, Ptr++) - { - /* Fill the cell */ - Ptr->Char.UnicodeChar = L' '; - Ptr->Attributes = Buff->ScreenDefaultAttrib; - } -} - -static __inline BOOLEAN ConioGetIntersection( - SMALL_RECT* Intersection, - SMALL_RECT* Rect1, - SMALL_RECT* Rect2) -{ - if ( ConioIsRectEmpty(Rect1) || - ConioIsRectEmpty(Rect2) || - (Rect1->Top > Rect2->Bottom) || - (Rect1->Left > Rect2->Right) || - (Rect1->Bottom < Rect2->Top) || - (Rect1->Right < Rect2->Left) ) - { - /* The rectangles do not intersect */ - ConioInitRect(Intersection, 0, -1, 0, -1); - return FALSE; - } - - ConioInitRect(Intersection, - max(Rect1->Top, Rect2->Top), - max(Rect1->Left, Rect2->Left), - min(Rect1->Bottom, Rect2->Bottom), - min(Rect1->Right, Rect2->Right)); - - return TRUE; -} - -static __inline BOOLEAN ConioGetUnion( - SMALL_RECT* Union, - SMALL_RECT* Rect1, - SMALL_RECT* Rect2) -{ - if (ConioIsRectEmpty(Rect1)) - { - if (ConioIsRectEmpty(Rect2)) - { - ConioInitRect(Union, 0, -1, 0, -1); - return FALSE; - } - else - { - *Union = *Rect2; - } - } - else if (ConioIsRectEmpty(Rect2)) - { - *Union = *Rect1; - } - else - { - ConioInitRect(Union, - min(Rect1->Top, Rect2->Top), - min(Rect1->Left, Rect2->Left), - max(Rect1->Bottom, Rect2->Bottom), - max(Rect1->Right, Rect2->Right)); - } - - return TRUE; -} - -static VOID FASTCALL -ConioComputeUpdateRect(PTEXTMODE_SCREEN_BUFFER Buff, SMALL_RECT* UpdateRect, PCOORD Start, UINT Length) -{ - if (Buff->ScreenBufferSize.X <= Start->X + Length) - { - UpdateRect->Left = 0; - } - else - { - UpdateRect->Left = Start->X; - } - if (Buff->ScreenBufferSize.X <= Start->X + Length) - { - UpdateRect->Right = Buff->ScreenBufferSize.X - 1; - } - else - { - UpdateRect->Right = Start->X + Length - 1; - } - UpdateRect->Top = Start->Y; - UpdateRect->Bottom = Start->Y + (Start->X + Length - 1) / Buff->ScreenBufferSize.X; - if (Buff->ScreenBufferSize.Y <= UpdateRect->Bottom) - { - UpdateRect->Bottom = Buff->ScreenBufferSize.Y - 1; - } -} - -/* - * Move from one rectangle to another. We must be careful about the order that - * this is done, to avoid overwriting parts of the source before they are moved. - */ -static VOID FASTCALL -ConioMoveRegion(PTEXTMODE_SCREEN_BUFFER ScreenBuffer, - SMALL_RECT* SrcRegion, - SMALL_RECT* DstRegion, - SMALL_RECT* ClipRegion, - CHAR_INFO FillChar) -{ - int Width = ConioRectWidth(SrcRegion); - int Height = ConioRectHeight(SrcRegion); - int SX, SY; - int DX, DY; - int XDelta, YDelta; - int i, j; - - SY = SrcRegion->Top; - DY = DstRegion->Top; - YDelta = 1; - if (SY < DY) - { - /* Moving down: work from bottom up */ - SY = SrcRegion->Bottom; - DY = DstRegion->Bottom; - YDelta = -1; - } - for (i = 0; i < Height; i++) - { - PCHAR_INFO SRow = ConioCoordToPointer(ScreenBuffer, 0, SY); - PCHAR_INFO DRow = ConioCoordToPointer(ScreenBuffer, 0, DY); - - SX = SrcRegion->Left; - DX = DstRegion->Left; - XDelta = 1; - if (SX < DX) - { - /* Moving right: work from right to left */ - SX = SrcRegion->Right; - DX = DstRegion->Right; - XDelta = -1; - } - for (j = 0; j < Width; j++) - { - CHAR_INFO Cell = SRow[SX]; - if (SX >= ClipRegion->Left && SX <= ClipRegion->Right && - SY >= ClipRegion->Top && SY <= ClipRegion->Bottom) - { - SRow[SX] = FillChar; - } - if (DX >= ClipRegion->Left && DX <= ClipRegion->Right && - DY >= ClipRegion->Top && DY <= ClipRegion->Bottom) - { - DRow[DX] = Cell; - } - SX += XDelta; - DX += XDelta; - } - SY += YDelta; - DY += YDelta; - } -} - -DWORD FASTCALL -ConioEffectiveCursorSize(PCONSOLE Console, DWORD Scale) -{ - DWORD Size = (Console->ActiveBuffer->CursorInfo.dwSize * Scale + 99) / 100; - /* If line input in progress, perhaps adjust for insert toggle */ - if (Console->LineBuffer && !Console->LineComplete && Console->LineInsertToggle) - return (Size * 2 <= Scale) ? (Size * 2) : (Size / 2); - return Size; -} - -NTSTATUS -ConioResizeBuffer(PCONSOLE Console, - PTEXTMODE_SCREEN_BUFFER ScreenBuffer, - COORD Size) -{ - PCHAR_INFO Buffer; - DWORD Offset = 0; - PCHAR_INFO ptr; - USHORT CurrentY; - PCHAR_INFO OldBuffer; -#ifdef HAVE_WMEMSET - USHORT value = MAKEWORD(' ', ScreenBuffer->ScreenDefaultAttrib); -#else - DWORD i; -#endif - DWORD diff; - - /* Buffer size is not allowed to be smaller than the view size */ - if (Size.X < ScreenBuffer->ViewSize.X || Size.Y < ScreenBuffer->ViewSize.Y) - return STATUS_INVALID_PARAMETER; - - if (Size.X == ScreenBuffer->ScreenBufferSize.X && Size.Y == ScreenBuffer->ScreenBufferSize.Y) - { - // FIXME: Trigger a buffer resize event ?? - return STATUS_SUCCESS; - } - - if (Console->FixedSize) - { - /* - * The console is in fixed-size mode, so we cannot resize anything - * at the moment. However, keep those settings somewhere so that - * we can try to set them up when we will be allowed to do so. - */ - ScreenBuffer->OldScreenBufferSize = Size; - return STATUS_NOT_SUPPORTED; // STATUS_SUCCESS - } - - Buffer = ConsoleAllocHeap(HEAP_ZERO_MEMORY, Size.X * Size.Y * sizeof(CHAR_INFO)); - if (!Buffer) return STATUS_NO_MEMORY; - - DPRINT1("Resizing (%d,%d) to (%d,%d)\n", ScreenBuffer->ScreenBufferSize.X, ScreenBuffer->ScreenBufferSize.Y, Size.X, Size.Y); - OldBuffer = ScreenBuffer->Buffer; - - for (CurrentY = 0; CurrentY < ScreenBuffer->ScreenBufferSize.Y && CurrentY < Size.Y; CurrentY++) - { - ptr = ConioCoordToPointer(ScreenBuffer, 0, CurrentY); - if (Size.X <= ScreenBuffer->ScreenBufferSize.X) - { - /* Reduce size */ - RtlCopyMemory(Buffer + Offset, ptr, Size.X * sizeof(CHAR_INFO)); - Offset += Size.X; - } - else - { - /* Enlarge size */ - RtlCopyMemory(Buffer + Offset, ptr, ScreenBuffer->ScreenBufferSize.X * sizeof(CHAR_INFO)); - Offset += ScreenBuffer->ScreenBufferSize.X; - - diff = Size.X - ScreenBuffer->ScreenBufferSize.X; - /* Zero new part of it */ -#ifdef HAVE_WMEMSET - wmemset((PWCHAR)&Buffer[Offset], value, diff); -#else - for (i = 0; i < diff; i++) - { - ptr = Buffer + Offset; - ptr->Char.UnicodeChar = L' '; - ptr->Attributes = ScreenBuffer->ScreenDefaultAttrib; - ++Offset; - } -#endif - } - } - - if (Size.Y > ScreenBuffer->ScreenBufferSize.Y) - { - diff = Size.X * (Size.Y - ScreenBuffer->ScreenBufferSize.Y); -#ifdef HAVE_WMEMSET - wmemset((PWCHAR)&Buffer[Offset], value, diff); -#else - for (i = 0; i < diff; i++) - { - ptr = Buffer + Offset; - ptr->Char.UnicodeChar = L' '; - ptr->Attributes = ScreenBuffer->ScreenDefaultAttrib; - ++Offset; - } -#endif - } - - (void)InterlockedExchangePointer((PVOID volatile*)&ScreenBuffer->Buffer, Buffer); - ConsoleFreeHeap(OldBuffer); - ScreenBuffer->ScreenBufferSize = ScreenBuffer->OldScreenBufferSize = Size; - ScreenBuffer->VirtualY = 0; - - /* Ensure cursor and window are within buffer */ - if (ScreenBuffer->CursorPosition.X >= Size.X) - ScreenBuffer->CursorPosition.X = Size.X - 1; - if (ScreenBuffer->CursorPosition.Y >= Size.Y) - ScreenBuffer->CursorPosition.Y = Size.Y - 1; - if (ScreenBuffer->ViewOrigin.X > Size.X - ScreenBuffer->ViewSize.X) - ScreenBuffer->ViewOrigin.X = Size.X - ScreenBuffer->ViewSize.X; - if (ScreenBuffer->ViewOrigin.Y > Size.Y - ScreenBuffer->ViewSize.Y) - ScreenBuffer->ViewOrigin.Y = Size.Y - ScreenBuffer->ViewSize.Y; - - /* - * Trigger a buffer resize event - */ - if (Console->InputBuffer.Mode & ENABLE_WINDOW_INPUT) - { - INPUT_RECORD er; - - er.EventType = WINDOW_BUFFER_SIZE_EVENT; - er.Event.WindowBufferSizeEvent.dwSize = ScreenBuffer->ScreenBufferSize; - - ConioProcessInputEvent(Console, &er); - } - - return STATUS_SUCCESS; -} - -static VOID FASTCALL -ConioNextLine(PTEXTMODE_SCREEN_BUFFER Buff, SMALL_RECT* UpdateRect, UINT *ScrolledLines) -{ - /* If we hit bottom, slide the viewable screen */ - if (++Buff->CursorPosition.Y == Buff->ScreenBufferSize.Y) - { - Buff->CursorPosition.Y--; - if (++Buff->VirtualY == Buff->ScreenBufferSize.Y) - { - Buff->VirtualY = 0; - } - (*ScrolledLines)++; - ClearLineBuffer(Buff); - if (UpdateRect->Top != 0) - { - UpdateRect->Top--; - } - } - UpdateRect->Left = 0; - UpdateRect->Right = Buff->ScreenBufferSize.X - 1; - UpdateRect->Bottom = Buff->CursorPosition.Y; -} - -NTSTATUS -ConioWriteConsole(PCONSOLE Console, - PTEXTMODE_SCREEN_BUFFER Buff, - PWCHAR Buffer, - DWORD Length, - BOOL Attrib) -{ - UINT i; - PCHAR_INFO Ptr; - SMALL_RECT UpdateRect; - SHORT CursorStartX, CursorStartY; - UINT ScrolledLines; - - CursorStartX = Buff->CursorPosition.X; - CursorStartY = Buff->CursorPosition.Y; - UpdateRect.Left = Buff->ScreenBufferSize.X; - UpdateRect.Top = Buff->CursorPosition.Y; - UpdateRect.Right = -1; - UpdateRect.Bottom = Buff->CursorPosition.Y; - ScrolledLines = 0; - - for (i = 0; i < Length; i++) - { - /* - * If we are in processed mode, interpret special characters and - * display them correctly. Otherwise, just put them into the buffer. - */ - if (Buff->Mode & ENABLE_PROCESSED_OUTPUT) - { - /* --- CR --- */ - if (Buffer[i] == L'\r') - { - Buff->CursorPosition.X = 0; - UpdateRect.Left = min(UpdateRect.Left, Buff->CursorPosition.X); - UpdateRect.Right = max(UpdateRect.Right, Buff->CursorPosition.X); - continue; - } - /* --- LF --- */ - else if (Buffer[i] == L'\n') - { - Buff->CursorPosition.X = 0; - ConioNextLine(Buff, &UpdateRect, &ScrolledLines); - continue; - } - /* --- BS --- */ - else if (Buffer[i] == L'\b') - { - /* Only handle BS if we're not on the first pos of the first line */ - if (0 != Buff->CursorPosition.X || 0 != Buff->CursorPosition.Y) - { - if (0 == Buff->CursorPosition.X) - { - /* slide virtual position up */ - Buff->CursorPosition.X = Buff->ScreenBufferSize.X - 1; - Buff->CursorPosition.Y--; - UpdateRect.Top = min(UpdateRect.Top, Buff->CursorPosition.Y); - } - else - { - Buff->CursorPosition.X--; - } - Ptr = ConioCoordToPointer(Buff, Buff->CursorPosition.X, Buff->CursorPosition.Y); - Ptr->Char.UnicodeChar = L' '; - Ptr->Attributes = Buff->ScreenDefaultAttrib; - UpdateRect.Left = min(UpdateRect.Left, Buff->CursorPosition.X); - UpdateRect.Right = max(UpdateRect.Right, Buff->CursorPosition.X); - } - continue; - } - /* --- TAB --- */ - else if (Buffer[i] == L'\t') - { - UINT EndX; - - UpdateRect.Left = min(UpdateRect.Left, Buff->CursorPosition.X); - EndX = (Buff->CursorPosition.X + TAB_WIDTH) & ~(TAB_WIDTH - 1); - EndX = min(EndX, (UINT)Buff->ScreenBufferSize.X); - Ptr = ConioCoordToPointer(Buff, Buff->CursorPosition.X, Buff->CursorPosition.Y); - while (Buff->CursorPosition.X < EndX) - { - Ptr->Char.UnicodeChar = L' '; - Ptr->Attributes = Buff->ScreenDefaultAttrib; - ++Ptr; - Buff->CursorPosition.X++; - } - UpdateRect.Right = max(UpdateRect.Right, Buff->CursorPosition.X - 1); - if (Buff->CursorPosition.X == Buff->ScreenBufferSize.X) - { - if (Buff->Mode & ENABLE_WRAP_AT_EOL_OUTPUT) - { - Buff->CursorPosition.X = 0; - ConioNextLine(Buff, &UpdateRect, &ScrolledLines); - } - else - { - Buff->CursorPosition.X--; - } - } - continue; - } - // /* --- BEL ---*/ - // else if (Buffer[i] == L'\a') - // { - // // FIXME: This MUST BE moved to the terminal emulator frontend!! - // DPRINT1("Bell\n"); - // // SendNotifyMessage(Console->hWindow, PM_CONSOLE_BEEP, 0, 0); - // continue; - // } - } - UpdateRect.Left = min(UpdateRect.Left, Buff->CursorPosition.X); - UpdateRect.Right = max(UpdateRect.Right, Buff->CursorPosition.X); - - Ptr = ConioCoordToPointer(Buff, Buff->CursorPosition.X, Buff->CursorPosition.Y); - Ptr->Char.UnicodeChar = Buffer[i]; - if (Attrib) Ptr->Attributes = Buff->ScreenDefaultAttrib; - - Buff->CursorPosition.X++; - if (Buff->CursorPosition.X == Buff->ScreenBufferSize.X) - { - if (Buff->Mode & ENABLE_WRAP_AT_EOL_OUTPUT) - { - Buff->CursorPosition.X = 0; - ConioNextLine(Buff, &UpdateRect, &ScrolledLines); - } - else - { - Buff->CursorPosition.X = CursorStartX; - } - } - } - - if (!ConioIsRectEmpty(&UpdateRect) && (PCONSOLE_SCREEN_BUFFER)Buff == Console->ActiveBuffer) - { - ConioWriteStream(Console, &UpdateRect, CursorStartX, CursorStartY, - ScrolledLines, Buffer, Length); - } - - return STATUS_SUCCESS; -} - -static NTSTATUS -DoWriteConsole(IN PCSR_API_MESSAGE ApiMessage, - IN PCSR_THREAD ClientThread, - IN BOOL CreateWaitBlock OPTIONAL); - -// Wait function CSR_WAIT_FUNCTION -static BOOLEAN -WriteConsoleThread(IN PLIST_ENTRY WaitList, - IN PCSR_THREAD WaitThread, - IN PCSR_API_MESSAGE WaitApiMessage, - IN PVOID WaitContext, - IN PVOID WaitArgument1, - IN PVOID WaitArgument2, - IN ULONG WaitFlags) -{ - NTSTATUS Status; - - DPRINT("WriteConsoleThread - WaitContext = 0x%p, WaitArgument1 = 0x%p, WaitArgument2 = 0x%p, WaitFlags = %lu\n", WaitContext, WaitArgument1, WaitArgument2, WaitFlags); - - /* - * If we are notified of the process termination via a call - * to CsrNotifyWaitBlock triggered by CsrDestroyProcess or - * CsrDestroyThread, just return. - */ - if (WaitFlags & CsrProcessTerminating) - { - Status = STATUS_THREAD_IS_TERMINATING; - goto Quit; - } - - Status = DoWriteConsole(WaitApiMessage, - WaitThread, - FALSE); - -Quit: - if (Status != STATUS_PENDING) - { - WaitApiMessage->Status = Status; - } - - return (Status == STATUS_PENDING ? FALSE : TRUE); -} - -static NTSTATUS -DoWriteConsole(IN PCSR_API_MESSAGE ApiMessage, - IN PCSR_THREAD ClientThread, - IN BOOL CreateWaitBlock OPTIONAL) -{ - NTSTATUS Status = STATUS_SUCCESS; - PCONSOLE_WRITECONSOLE WriteConsoleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.WriteConsoleRequest; - PCONSOLE Console; - PTEXTMODE_SCREEN_BUFFER Buff; - PVOID Buffer; - DWORD Written = 0; - ULONG Length; - - Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(ClientThread->Process), WriteConsoleRequest->OutputHandle, &Buff, GENERIC_WRITE, FALSE); - if (!NT_SUCCESS(Status)) return Status; - - Console = Buff->Header.Console; - - // if (Console->PauseFlags & (PAUSED_FROM_KEYBOARD | PAUSED_FROM_SCROLLBAR | PAUSED_FROM_SELECTION)) - if (Console->PauseFlags && Console->UnpauseEvent != NULL) - { - if (CreateWaitBlock) - { - if (!CsrCreateWait(&Console->WriteWaitQueue, - WriteConsoleThread, - ClientThread, - ApiMessage, - NULL, - NULL)) - { - /* Fail */ - ConSrvReleaseScreenBuffer(Buff, FALSE); - return STATUS_NO_MEMORY; - } - } - - /* Wait until we un-pause the console */ - Status = STATUS_PENDING; - } - else - { - if (WriteConsoleRequest->Unicode) - { - Buffer = WriteConsoleRequest->Buffer; - } - else - { - Length = MultiByteToWideChar(Console->OutputCodePage, 0, - (PCHAR)WriteConsoleRequest->Buffer, - WriteConsoleRequest->NrCharactersToWrite, - NULL, 0); - Buffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, Length * sizeof(WCHAR)); - if (Buffer) - { - MultiByteToWideChar(Console->OutputCodePage, 0, - (PCHAR)WriteConsoleRequest->Buffer, - WriteConsoleRequest->NrCharactersToWrite, - (PWCHAR)Buffer, Length); - } - else - { - Status = STATUS_NO_MEMORY; - } - } - - if (Buffer) - { - if (NT_SUCCESS(Status)) - { - Status = ConioWriteConsole(Console, - Buff, - Buffer, - WriteConsoleRequest->NrCharactersToWrite, - TRUE); - if (NT_SUCCESS(Status)) - { - Written = WriteConsoleRequest->NrCharactersToWrite; - } - } - - if (!WriteConsoleRequest->Unicode) - RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer); - } - - WriteConsoleRequest->NrCharactersWritten = Written; - } - - ConSrvReleaseScreenBuffer(Buff, FALSE); - return Status; -} - - -/* PUBLIC SERVER APIS *********************************************************/ - -CSR_API(SrvReadConsoleOutput) -{ - PCONSOLE_READOUTPUT ReadOutputRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ReadOutputRequest; - PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process); - PCHAR_INFO CharInfo; - PCHAR_INFO CurCharInfo; - PTEXTMODE_SCREEN_BUFFER Buff; - SHORT SizeX, SizeY; - NTSTATUS Status; - COORD BufferSize; - COORD BufferCoord; - SMALL_RECT ReadRegion; - SMALL_RECT ScreenRect; - DWORD i; - PCHAR_INFO Ptr; - LONG X, Y; - UINT CodePage; - - DPRINT("SrvReadConsoleOutput\n"); - - CharInfo = ReadOutputRequest->CharInfo; - ReadRegion = ReadOutputRequest->ReadRegion; - BufferSize = ReadOutputRequest->BufferSize; - BufferCoord = ReadOutputRequest->BufferCoord; - - if (!CsrValidateMessageBuffer(ApiMessage, - (PVOID*)&ReadOutputRequest->CharInfo, - BufferSize.X * BufferSize.Y, - sizeof(CHAR_INFO))) - { - return STATUS_INVALID_PARAMETER; - } - - Status = ConSrvGetTextModeBuffer(ProcessData, ReadOutputRequest->OutputHandle, &Buff, GENERIC_READ, TRUE); - if (!NT_SUCCESS(Status)) return Status; - - /* FIXME: Is this correct? */ - CodePage = ProcessData->Console->OutputCodePage; - - SizeY = min(BufferSize.Y - BufferCoord.Y, ConioRectHeight(&ReadRegion)); - SizeX = min(BufferSize.X - BufferCoord.X, ConioRectWidth(&ReadRegion)); - ReadRegion.Bottom = ReadRegion.Top + SizeY; - ReadRegion.Right = ReadRegion.Left + SizeX; - - ConioInitRect(&ScreenRect, 0, 0, Buff->ScreenBufferSize.Y, Buff->ScreenBufferSize.X); - if (!ConioGetIntersection(&ReadRegion, &ScreenRect, &ReadRegion)) - { - ConSrvReleaseScreenBuffer(Buff, TRUE); - return STATUS_SUCCESS; - } - - for (i = 0, Y = ReadRegion.Top; Y < ReadRegion.Bottom; ++i, ++Y) - { - CurCharInfo = CharInfo + (i * BufferSize.X); - - Ptr = ConioCoordToPointer(Buff, ReadRegion.Left, Y); - for (X = ReadRegion.Left; X < ReadRegion.Right; ++X) - { - if (ReadOutputRequest->Unicode) - { - CurCharInfo->Char.UnicodeChar = Ptr->Char.UnicodeChar; - } - else - { - // ConsoleUnicodeCharToAnsiChar(ProcessData->Console, &CurCharInfo->Char.AsciiChar, &Ptr->Char.UnicodeChar); - WideCharToMultiByte(CodePage, 0, &Ptr->Char.UnicodeChar, 1, - &CurCharInfo->Char.AsciiChar, 1, NULL, NULL); - } - CurCharInfo->Attributes = Ptr->Attributes; - ++Ptr; - ++CurCharInfo; - } - } - - ConSrvReleaseScreenBuffer(Buff, TRUE); - - ReadOutputRequest->ReadRegion.Right = ReadRegion.Left + SizeX - 1; - ReadOutputRequest->ReadRegion.Bottom = ReadRegion.Top + SizeY - 1; - ReadOutputRequest->ReadRegion.Left = ReadRegion.Left; - ReadOutputRequest->ReadRegion.Top = ReadRegion.Top; - - return STATUS_SUCCESS; -} - -CSR_API(SrvWriteConsoleOutput) -{ - PCONSOLE_WRITEOUTPUT WriteOutputRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.WriteOutputRequest; - PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process); - SHORT i, X, Y, SizeX, SizeY; - PCONSOLE Console; - PTEXTMODE_SCREEN_BUFFER Buff; - SMALL_RECT ScreenBuffer; - PCHAR_INFO CurCharInfo; - SMALL_RECT WriteRegion; - PCHAR_INFO CharInfo; - COORD BufferCoord; - COORD BufferSize; - NTSTATUS Status; - PCHAR_INFO Ptr; - - DPRINT("SrvWriteConsoleOutput\n"); - - BufferSize = WriteOutputRequest->BufferSize; - BufferCoord = WriteOutputRequest->BufferCoord; - CharInfo = WriteOutputRequest->CharInfo; - - if (!CsrValidateMessageBuffer(ApiMessage, - (PVOID*)&WriteOutputRequest->CharInfo, - BufferSize.X * BufferSize.Y, - sizeof(CHAR_INFO))) - { - return STATUS_INVALID_PARAMETER; - } - - Status = ConSrvGetTextModeBuffer(ProcessData, - WriteOutputRequest->OutputHandle, - &Buff, - GENERIC_WRITE, - TRUE); - if (!NT_SUCCESS(Status)) return Status; - - Console = Buff->Header.Console; - - WriteRegion = WriteOutputRequest->WriteRegion; - - SizeY = min(BufferSize.Y - BufferCoord.Y, ConioRectHeight(&WriteRegion)); - SizeX = min(BufferSize.X - BufferCoord.X, ConioRectWidth(&WriteRegion)); - WriteRegion.Bottom = WriteRegion.Top + SizeY - 1; - WriteRegion.Right = WriteRegion.Left + SizeX - 1; - - /* Make sure WriteRegion is inside the screen buffer */ - ConioInitRect(&ScreenBuffer, 0, 0, Buff->ScreenBufferSize.Y - 1, Buff->ScreenBufferSize.X - 1); - if (!ConioGetIntersection(&WriteRegion, &ScreenBuffer, &WriteRegion)) - { - ConSrvReleaseScreenBuffer(Buff, TRUE); - - /* It is okay to have a WriteRegion completely outside the screen buffer. - No data is written then. */ - return STATUS_SUCCESS; - } - - for (i = 0, Y = WriteRegion.Top; Y <= WriteRegion.Bottom; i++, Y++) - { - CurCharInfo = CharInfo + (i + BufferCoord.Y) * BufferSize.X + BufferCoord.X; - - Ptr = ConioCoordToPointer(Buff, WriteRegion.Left, Y); - for (X = WriteRegion.Left; X <= WriteRegion.Right; X++) - { - if (WriteOutputRequest->Unicode) - { - Ptr->Char.UnicodeChar = CurCharInfo->Char.UnicodeChar; - } - else - { - ConsoleAnsiCharToUnicodeChar(Console, &Ptr->Char.UnicodeChar, &CurCharInfo->Char.AsciiChar); - } - Ptr->Attributes = CurCharInfo->Attributes; - ++Ptr; - ++CurCharInfo; - } - } - - ConioDrawRegion(Console, &WriteRegion); - - ConSrvReleaseScreenBuffer(Buff, TRUE); - - WriteOutputRequest->WriteRegion.Right = WriteRegion.Left + SizeX - 1; - WriteOutputRequest->WriteRegion.Bottom = WriteRegion.Top + SizeY - 1; - WriteOutputRequest->WriteRegion.Left = WriteRegion.Left; - WriteOutputRequest->WriteRegion.Top = WriteRegion.Top; - - return STATUS_SUCCESS; -} - -CSR_API(SrvWriteConsole) -{ - NTSTATUS Status; - PCONSOLE_WRITECONSOLE WriteConsoleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.WriteConsoleRequest; - - DPRINT("SrvWriteConsole\n"); - - if (!CsrValidateMessageBuffer(ApiMessage, - (PVOID)&WriteConsoleRequest->Buffer, - WriteConsoleRequest->BufferSize, - sizeof(BYTE))) - { - return STATUS_INVALID_PARAMETER; - } - - Status = DoWriteConsole(ApiMessage, - CsrGetClientThread(), - TRUE); - - if (Status == STATUS_PENDING) - *ReplyCode = CsrReplyPending; - - return Status; -} - -CSR_API(SrvReadConsoleOutputString) -{ - NTSTATUS Status; - PCONSOLE_READOUTPUTCODE ReadOutputCodeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ReadOutputCodeRequest; - PCONSOLE Console; - PTEXTMODE_SCREEN_BUFFER Buff; - USHORT CodeType; - SHORT Xpos, Ypos; - PVOID ReadBuffer; - DWORD i; - ULONG CodeSize; - PCHAR_INFO Ptr; - - DPRINT("SrvReadConsoleOutputString\n"); - - CodeType = ReadOutputCodeRequest->CodeType; - switch (CodeType) - { - case CODE_ASCII: - CodeSize = sizeof(CHAR); - break; - - case CODE_UNICODE: - CodeSize = sizeof(WCHAR); - break; - - case CODE_ATTRIBUTE: - CodeSize = sizeof(WORD); - break; - - default: - return STATUS_INVALID_PARAMETER; - } - - if (!CsrValidateMessageBuffer(ApiMessage, - (PVOID*)&ReadOutputCodeRequest->pCode.pCode, - ReadOutputCodeRequest->NumCodesToRead, - CodeSize)) - { - return STATUS_INVALID_PARAMETER; - } - - Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), - ReadOutputCodeRequest->OutputHandle, - &Buff, - GENERIC_READ, - TRUE); - if (!NT_SUCCESS(Status)) return Status; - - Console = Buff->Header.Console; - - ReadBuffer = ReadOutputCodeRequest->pCode.pCode; - Xpos = ReadOutputCodeRequest->ReadCoord.X; - Ypos = (ReadOutputCodeRequest->ReadCoord.Y + Buff->VirtualY) % Buff->ScreenBufferSize.Y; - - /* - * MSDN (ReadConsoleOutputAttribute and ReadConsoleOutputCharacter) : - * - * If the number of attributes (resp. characters) to be read from extends - * beyond the end of the specified screen buffer row, attributes (resp. - * characters) are read from the next row. If the number of attributes - * (resp. characters) to be read from extends beyond the end of the console - * screen buffer, attributes (resp. characters) up to the end of the console - * screen buffer are read. - * - * TODO: Do NOT loop up to NumCodesToRead, but stop before - * if we are going to overflow... - */ - // Ptr = ConioCoordToPointer(Buff, Xpos, Ypos); // Doesn't work - for (i = 0; i < min(ReadOutputCodeRequest->NumCodesToRead, Buff->ScreenBufferSize.X * Buff->ScreenBufferSize.Y); ++i) - { - // Ptr = ConioCoordToPointer(Buff, Xpos, Ypos); // Doesn't work either - Ptr = &Buff->Buffer[Xpos + Ypos * Buff->ScreenBufferSize.X]; - - switch (CodeType) - { - case CODE_ASCII: - ConsoleUnicodeCharToAnsiChar(Console, (PCHAR)ReadBuffer, &Ptr->Char.UnicodeChar); - break; - - case CODE_UNICODE: - *(PWCHAR)ReadBuffer = Ptr->Char.UnicodeChar; - break; - - case CODE_ATTRIBUTE: - *(PWORD)ReadBuffer = Ptr->Attributes; - break; - } - ReadBuffer = (PVOID)((ULONG_PTR)ReadBuffer + CodeSize); - // ++Ptr; - - Xpos++; - - if (Xpos == Buff->ScreenBufferSize.X) - { - Xpos = 0; - Ypos++; - - if (Ypos == Buff->ScreenBufferSize.Y) - { - Ypos = 0; - } - } - } - - // switch (CodeType) - // { - // case CODE_UNICODE: - // *(PWCHAR)ReadBuffer = 0; - // break; - - // case CODE_ASCII: - // *(PCHAR)ReadBuffer = 0; - // break; - - // case CODE_ATTRIBUTE: - // *(PWORD)ReadBuffer = 0; - // break; - // } - - ReadOutputCodeRequest->EndCoord.X = Xpos; - ReadOutputCodeRequest->EndCoord.Y = (Ypos - Buff->VirtualY + Buff->ScreenBufferSize.Y) % Buff->ScreenBufferSize.Y; - - ConSrvReleaseScreenBuffer(Buff, TRUE); - - ReadOutputCodeRequest->CodesRead = (DWORD)((ULONG_PTR)ReadBuffer - (ULONG_PTR)ReadOutputCodeRequest->pCode.pCode) / CodeSize; - // <= ReadOutputCodeRequest->NumCodesToRead - - return STATUS_SUCCESS; -} - -CSR_API(SrvWriteConsoleOutputString) -{ - NTSTATUS Status; - PCONSOLE_WRITEOUTPUTCODE WriteOutputCodeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.WriteOutputCodeRequest; - PCONSOLE Console; - PTEXTMODE_SCREEN_BUFFER Buff; - USHORT CodeType; - PVOID ReadBuffer = NULL; - PWCHAR tmpString = NULL; - DWORD X, Y, Length; // , Written = 0; - ULONG CodeSize; - SMALL_RECT UpdateRect; - PCHAR_INFO Ptr; - - DPRINT("SrvWriteConsoleOutputString\n"); - - CodeType = WriteOutputCodeRequest->CodeType; - switch (CodeType) - { - case CODE_ASCII: - CodeSize = sizeof(CHAR); - break; - - case CODE_UNICODE: - CodeSize = sizeof(WCHAR); - break; - - case CODE_ATTRIBUTE: - CodeSize = sizeof(WORD); - break; - - default: - return STATUS_INVALID_PARAMETER; - } - - if (!CsrValidateMessageBuffer(ApiMessage, - (PVOID*)&WriteOutputCodeRequest->pCode.pCode, - WriteOutputCodeRequest->Length, - CodeSize)) - { - return STATUS_INVALID_PARAMETER; - } - - Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), - WriteOutputCodeRequest->OutputHandle, - &Buff, - GENERIC_WRITE, - TRUE); - if (!NT_SUCCESS(Status)) return Status; - - Console = Buff->Header.Console; - - if (CodeType == CODE_ASCII) - { - /* Convert the ASCII string into Unicode before writing it to the console */ - Length = MultiByteToWideChar(Console->OutputCodePage, 0, - WriteOutputCodeRequest->pCode.AsciiChar, - WriteOutputCodeRequest->Length, - NULL, 0); - tmpString = ReadBuffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, Length * sizeof(WCHAR)); - if (ReadBuffer) - { - MultiByteToWideChar(Console->OutputCodePage, 0, - WriteOutputCodeRequest->pCode.AsciiChar, - WriteOutputCodeRequest->Length, - (PWCHAR)ReadBuffer, Length); - } - else - { - Status = STATUS_NO_MEMORY; - } - } - else - { - /* For CODE_UNICODE or CODE_ATTRIBUTE, we are already OK */ - ReadBuffer = WriteOutputCodeRequest->pCode.pCode; - } - - if (ReadBuffer == NULL || !NT_SUCCESS(Status)) goto Cleanup; - - X = WriteOutputCodeRequest->Coord.X; - Y = (WriteOutputCodeRequest->Coord.Y + Buff->VirtualY) % Buff->ScreenBufferSize.Y; - Length = WriteOutputCodeRequest->Length; - // Ptr = ConioCoordToPointer(Buff, X, Y); // Doesn't work - // Ptr = &Buff->Buffer[X + Y * Buff->ScreenBufferSize.X]; // May work - - while (Length--) - { - // Ptr = ConioCoordToPointer(Buff, X, Y); // Doesn't work either - Ptr = &Buff->Buffer[X + Y * Buff->ScreenBufferSize.X]; - - switch (CodeType) - { - case CODE_ASCII: - case CODE_UNICODE: - Ptr->Char.UnicodeChar = *(PWCHAR)ReadBuffer; - break; - - case CODE_ATTRIBUTE: - Ptr->Attributes = *(PWORD)ReadBuffer; - break; - } - ReadBuffer = (PVOID)((ULONG_PTR)ReadBuffer + CodeSize); - // ++Ptr; - - // Written++; - if (++X == Buff->ScreenBufferSize.X) - { - X = 0; - - if (++Y == Buff->ScreenBufferSize.Y) - { - Y = 0; - } - } - } - - if ((PCONSOLE_SCREEN_BUFFER)Buff == Console->ActiveBuffer) - { - ConioComputeUpdateRect(Buff, &UpdateRect, &WriteOutputCodeRequest->Coord, - WriteOutputCodeRequest->Length); - ConioDrawRegion(Console, &UpdateRect); - } - - // WriteOutputCodeRequest->EndCoord.X = X; - // WriteOutputCodeRequest->EndCoord.Y = (Y + Buff->ScreenBufferSize.Y - Buff->VirtualY) % Buff->ScreenBufferSize.Y; - -Cleanup: - if (tmpString) - RtlFreeHeap(RtlGetProcessHeap(), 0, tmpString); - - ConSrvReleaseScreenBuffer(Buff, TRUE); - - // WriteOutputCodeRequest->NrCharactersWritten = Written; - return Status; -} - -CSR_API(SrvFillConsoleOutput) -{ - NTSTATUS Status; - PCONSOLE_FILLOUTPUTCODE FillOutputRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.FillOutputRequest; - PCONSOLE Console; - PTEXTMODE_SCREEN_BUFFER Buff; - DWORD X, Y, Length; // , Written = 0; - USHORT CodeType; - PVOID Code = NULL; - PCHAR_INFO Ptr; - SMALL_RECT UpdateRect; - - DPRINT("SrvFillConsoleOutput\n"); - - CodeType = FillOutputRequest->CodeType; - if ( (CodeType != CODE_ASCII ) && - (CodeType != CODE_UNICODE ) && - (CodeType != CODE_ATTRIBUTE) ) - { - return STATUS_INVALID_PARAMETER; - } - - Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), - FillOutputRequest->OutputHandle, - &Buff, - GENERIC_WRITE, - TRUE); - if (!NT_SUCCESS(Status)) return Status; - - Console = Buff->Header.Console; - - switch (CodeType) - { - case CODE_ASCII: - /* On-place conversion from the ASCII char to the UNICODE char */ - ConsoleAnsiCharToUnicodeChar(Console, &FillOutputRequest->Code.UnicodeChar, &FillOutputRequest->Code.AsciiChar); - /* Fall through */ - case CODE_UNICODE: - Code = &FillOutputRequest->Code.UnicodeChar; - break; - - case CODE_ATTRIBUTE: - Code = &FillOutputRequest->Code.Attribute; - break; - } - - X = FillOutputRequest->Coord.X; - Y = (FillOutputRequest->Coord.Y + Buff->VirtualY) % Buff->ScreenBufferSize.Y; - Length = FillOutputRequest->Length; - // Ptr = ConioCoordToPointer(Buff, X, Y); // Doesn't work - // Ptr = &Buff->Buffer[X + Y * Buff->ScreenBufferSize.X]; // May work - - while (Length--) - { - // Ptr = ConioCoordToPointer(Buff, X, Y); // Doesn't work either - Ptr = &Buff->Buffer[X + Y * Buff->ScreenBufferSize.X]; - - switch (CodeType) - { - case CODE_ASCII: - case CODE_UNICODE: - Ptr->Char.UnicodeChar = *(PWCHAR)Code; - break; - - case CODE_ATTRIBUTE: - Ptr->Attributes = *(PWORD)Code; - break; - } - // ++Ptr; - - // Written++; - if (++X == Buff->ScreenBufferSize.X) - { - X = 0; - - if (++Y == Buff->ScreenBufferSize.Y) - { - Y = 0; - } - } - } - - if ((PCONSOLE_SCREEN_BUFFER)Buff == Console->ActiveBuffer) - { - ConioComputeUpdateRect(Buff, &UpdateRect, &FillOutputRequest->Coord, - FillOutputRequest->Length); - ConioDrawRegion(Console, &UpdateRect); - } - - ConSrvReleaseScreenBuffer(Buff, TRUE); -/* - Length = FillOutputRequest->Length; - FillOutputRequest->NrCharactersWritten = Length; -*/ - return STATUS_SUCCESS; -} - -CSR_API(SrvGetConsoleScreenBufferInfo) -{ - NTSTATUS Status; - PCONSOLE_GETSCREENBUFFERINFO ScreenBufferInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ScreenBufferInfoRequest; - // PCONSOLE Console; - PTEXTMODE_SCREEN_BUFFER Buff; - PCONSOLE_SCREEN_BUFFER_INFO pInfo = &ScreenBufferInfoRequest->Info; - - DPRINT("SrvGetConsoleScreenBufferInfo\n"); - - Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), ScreenBufferInfoRequest->OutputHandle, &Buff, GENERIC_READ, TRUE); - if (!NT_SUCCESS(Status)) return Status; - - // Console = Buff->Header.Console; - - pInfo->dwSize = Buff->ScreenBufferSize; - pInfo->dwCursorPosition = Buff->CursorPosition; - pInfo->wAttributes = Buff->ScreenDefaultAttrib; - pInfo->srWindow.Left = Buff->ViewOrigin.X; - pInfo->srWindow.Top = Buff->ViewOrigin.Y; - pInfo->srWindow.Right = Buff->ViewOrigin.X + Buff->ViewSize.X - 1; - pInfo->srWindow.Bottom = Buff->ViewOrigin.Y + Buff->ViewSize.Y - 1; - pInfo->dwMaximumWindowSize = Buff->ScreenBufferSize; // TODO: Refine the computation - - ConSrvReleaseScreenBuffer(Buff, TRUE); - return STATUS_SUCCESS; -} - -CSR_API(SrvSetConsoleTextAttribute) -{ - NTSTATUS Status; - PCONSOLE_SETTEXTATTRIB SetTextAttribRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetTextAttribRequest; - PTEXTMODE_SCREEN_BUFFER Buff; - - DPRINT("SrvSetConsoleTextAttribute\n"); - - Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), SetTextAttribRequest->OutputHandle, &Buff, GENERIC_WRITE, TRUE); - if (!NT_SUCCESS(Status)) return Status; - - Buff->ScreenDefaultAttrib = SetTextAttribRequest->Attrib; - - ConSrvReleaseScreenBuffer(Buff, TRUE); - return STATUS_SUCCESS; -} - -CSR_API(SrvSetConsoleScreenBufferSize) -{ - NTSTATUS Status; - PCONSOLE_SETSCREENBUFFERSIZE SetScreenBufferSizeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetScreenBufferSizeRequest; - PCONSOLE Console; - PTEXTMODE_SCREEN_BUFFER Buff; - - Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), SetScreenBufferSizeRequest->OutputHandle, &Buff, GENERIC_WRITE, TRUE); - if (!NT_SUCCESS(Status)) return Status; - - Console = Buff->Header.Console; - - Status = ConioResizeBuffer(Console, Buff, SetScreenBufferSizeRequest->Size); - if (NT_SUCCESS(Status)) ConioResizeTerminal(Console); - - ConSrvReleaseScreenBuffer(Buff, TRUE); - return Status; -} - -CSR_API(SrvScrollConsoleScreenBuffer) -{ - PCONSOLE_SCROLLSCREENBUFFER ScrollScreenBufferRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ScrollScreenBufferRequest; - PCONSOLE Console; - PTEXTMODE_SCREEN_BUFFER Buff; - SMALL_RECT ScreenBuffer; - SMALL_RECT SrcRegion; - SMALL_RECT DstRegion; - SMALL_RECT UpdateRegion; - SMALL_RECT ScrollRectangle; - SMALL_RECT ClipRectangle; - NTSTATUS Status; - HANDLE OutputHandle; - BOOLEAN UseClipRectangle; - COORD DestinationOrigin; - CHAR_INFO FillChar; - - DPRINT("SrvScrollConsoleScreenBuffer\n"); - - OutputHandle = ScrollScreenBufferRequest->OutputHandle; - UseClipRectangle = ScrollScreenBufferRequest->UseClipRectangle; - DestinationOrigin = ScrollScreenBufferRequest->DestinationOrigin; - FillChar = ScrollScreenBufferRequest->Fill; - - Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process), OutputHandle, &Buff, GENERIC_WRITE, TRUE); - if (!NT_SUCCESS(Status)) return Status; - - Console = Buff->Header.Console; - - ScrollRectangle = ScrollScreenBufferRequest->ScrollRectangle; - - /* Make sure source rectangle is inside the screen buffer */ - ConioInitRect(&ScreenBuffer, 0, 0, Buff->ScreenBufferSize.Y - 1, Buff->ScreenBufferSize.X - 1); - if (!ConioGetIntersection(&SrcRegion, &ScreenBuffer, &ScrollRectangle)) - { - ConSrvReleaseScreenBuffer(Buff, TRUE); - return STATUS_SUCCESS; - } - - /* If the source was clipped on the left or top, adjust the destination accordingly */ - if (ScrollRectangle.Left < 0) - { - DestinationOrigin.X -= ScrollRectangle.Left; - } - if (ScrollRectangle.Top < 0) - { - DestinationOrigin.Y -= ScrollRectangle.Top; - } - - if (UseClipRectangle) - { - ClipRectangle = ScrollScreenBufferRequest->ClipRectangle; - if (!ConioGetIntersection(&ClipRectangle, &ClipRectangle, &ScreenBuffer)) - { - ConSrvReleaseScreenBuffer(Buff, TRUE); - return STATUS_SUCCESS; - } - } - else - { - ClipRectangle = ScreenBuffer; - } - - ConioInitRect(&DstRegion, - DestinationOrigin.Y, - DestinationOrigin.X, - DestinationOrigin.Y + ConioRectHeight(&SrcRegion) - 1, - DestinationOrigin.X + ConioRectWidth(&SrcRegion) - 1); - - if (!ScrollScreenBufferRequest->Unicode) - ConsoleAnsiCharToUnicodeChar(Console, &FillChar.Char.UnicodeChar, &FillChar.Char.AsciiChar); - - ConioMoveRegion(Buff, &SrcRegion, &DstRegion, &ClipRectangle, FillChar); - - if ((PCONSOLE_SCREEN_BUFFER)Buff == Console->ActiveBuffer) - { - ConioGetUnion(&UpdateRegion, &SrcRegion, &DstRegion); - if (ConioGetIntersection(&UpdateRegion, &UpdateRegion, &ClipRectangle)) - { - /* Draw update region */ - ConioDrawRegion(Console, &UpdateRegion); - } - } - - ConSrvReleaseScreenBuffer(Buff, TRUE); - return STATUS_SUCCESS; -} - -/* EOF */
11 years, 6 months
1
0
0
0
[hbelusca] 59318: "Seccurity" --> "Security"
by hbelusca@svn.reactos.org
Author: hbelusca Date: Sun Jun 23 14:34:30 2013 New Revision: 59318 URL:
http://svn.reactos.org/svn/reactos?rev=59318&view=rev
Log: "Seccurity" --> "Security" Modified: trunk/reactos/dll/win32/samsrv/security.c Modified: trunk/reactos/dll/win32/samsrv/security.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samsrv/security.…
============================================================================== --- trunk/reactos/dll/win32/samsrv/security.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/samsrv/security.c [iso-8859-1] Sun Jun 23 14:34:30 2013 @@ -2,7 +2,7 @@ * COPYRIGHT: See COPYING in the top level directory * PROJECT: Security Account Manager (SAM) Server * FILE: reactos/dll/win32/samsrv/security.c - * PURPOSE: Seccurity descriptor functions + * PURPOSE: Security descriptor functions * * PROGRAMMERS: Eric Kohl */
11 years, 6 months
1
0
0
0
[ekohl] 59317: [SAMSRV] Create and store a security descriptor for the server object.
by ekohl@svn.reactos.org
Author: ekohl Date: Sun Jun 23 14:26:18 2013 New Revision: 59317 URL:
http://svn.reactos.org/svn/reactos?rev=59317&view=rev
Log: [SAMSRV] Create and store a security descriptor for the server object. Added: trunk/reactos/dll/win32/samsrv/security.c (with props) Modified: trunk/reactos/dll/win32/samsrv/CMakeLists.txt trunk/reactos/dll/win32/samsrv/samsrv.h trunk/reactos/dll/win32/samsrv/setup.c Modified: trunk/reactos/dll/win32/samsrv/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samsrv/CMakeList…
============================================================================== --- trunk/reactos/dll/win32/samsrv/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/samsrv/CMakeLists.txt [iso-8859-1] Sun Jun 23 14:26:18 2013 @@ -15,6 +15,7 @@ registry.c samrpc.c samsrv.c + security.c setup.c user.c utils.c Modified: trunk/reactos/dll/win32/samsrv/samsrv.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samsrv/samsrv.h?…
============================================================================== --- trunk/reactos/dll/win32/samsrv/samsrv.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/samsrv/samsrv.h [iso-8859-1] Sun Jun 23 14:26:18 2013 @@ -300,6 +300,13 @@ SampStartRpcServer(VOID); +/* security.c */ + +NTSTATUS +SampCreateServerSD(OUT PSECURITY_DESCRIPTOR *ServerSd, + OUT PULONG Size); + + /* setup.c */ BOOL Added: trunk/reactos/dll/win32/samsrv/security.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samsrv/security.…
============================================================================== --- trunk/reactos/dll/win32/samsrv/security.c (added) +++ trunk/reactos/dll/win32/samsrv/security.c [iso-8859-1] Sun Jun 23 14:26:18 2013 @@ -0,0 +1,286 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: Security Account Manager (SAM) Server + * FILE: reactos/dll/win32/samsrv/security.c + * PURPOSE: Seccurity descriptor functions + * + * PROGRAMMERS: Eric Kohl + */ + +/* INCLUDES ****************************************************************/ + +#include "samsrv.h" + +WINE_DEFAULT_DEBUG_CHANNEL(samsrv); + + +/* GLOBALS *****************************************************************/ + +static SID_IDENTIFIER_AUTHORITY WorldAuthority = {SECURITY_WORLD_SID_AUTHORITY}; +static SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY}; + + +/* FUNCTIONS ***************************************************************/ + +NTSTATUS +SampCreateServerSD(OUT PSECURITY_DESCRIPTOR *ServerSd, + OUT PULONG Size) +{ + PSECURITY_DESCRIPTOR AbsSD = NULL; + PSECURITY_DESCRIPTOR RelSD = NULL; + PSID EveryoneSid = NULL; + PSID AnonymousSid = NULL; + PSID AdministratorsSid = NULL; + PACL Dacl = NULL; + PACL Sacl = NULL; + ULONG DaclSize; + ULONG SaclSize; + ULONG RelSDSize = 0; + NTSTATUS Status = STATUS_SUCCESS; + + + /* Create the Everyone SID */ + Status = RtlAllocateAndInitializeSid(&WorldAuthority, + 1, + SECURITY_WORLD_RID, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + &EveryoneSid); + ASSERT(NT_SUCCESS(Status)); + if (!NT_SUCCESS(Status)) + goto done; + + /* Create the Anonymous SID */ + Status = RtlAllocateAndInitializeSid(&NtAuthority, + 1, + SECURITY_ANONYMOUS_LOGON_RID, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + &AnonymousSid); + ASSERT(NT_SUCCESS(Status)); + if (!NT_SUCCESS(Status)) + goto done; + + /* Create the Administrators SID */ + Status = RtlAllocateAndInitializeSid(&NtAuthority, + 2, + SECURITY_BUILTIN_DOMAIN_RID, + DOMAIN_ALIAS_RID_ADMINS, + 0, + 0, + 0, + 0, + 0, + 0, + &AdministratorsSid); + ASSERT(NT_SUCCESS(Status)); + if (!NT_SUCCESS(Status)) + goto done; + + + /* Allocate a buffer for the absolute SD */ + AbsSD = RtlAllocateHeap(RtlGetProcessHeap(), + HEAP_ZERO_MEMORY, + sizeof(SECURITY_DESCRIPTOR)); + if (AbsSD == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + ASSERT(Status == STATUS_SUCCESS); + goto done; + } + + /* Create the absolute SD */ + Status = RtlCreateSecurityDescriptor(AbsSD, + SECURITY_DESCRIPTOR_REVISION); + ASSERT(NT_SUCCESS(Status)); + if (!NT_SUCCESS(Status)) + goto done; + + /* allocate and create the DACL */ + DaclSize = sizeof(ACL) + + 2 * sizeof(ACE) + + RtlLengthSid(EveryoneSid) + + RtlLengthSid(AdministratorsSid); + + Dacl = RtlAllocateHeap(RtlGetProcessHeap(), + HEAP_ZERO_MEMORY, + DaclSize); + if (Dacl == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + ASSERT(Status == STATUS_SUCCESS); + goto done; + } + + Status = RtlCreateAcl(Dacl, + DaclSize, + ACL_REVISION); + ASSERT(NT_SUCCESS(Status)); + if (!NT_SUCCESS(Status)) + goto done; + + Status = RtlAddAccessAllowedAce(Dacl, + ACL_REVISION, + SAM_SERVER_READ | SAM_SERVER_EXECUTE, + EveryoneSid); + ASSERT(NT_SUCCESS(Status)); + if (!NT_SUCCESS(Status)) + goto done; + + Status = RtlAddAccessAllowedAce(Dacl, + ACL_REVISION, + SAM_SERVER_ALL_ACCESS, + AdministratorsSid); + ASSERT(Status == STATUS_SUCCESS); + if (!NT_SUCCESS(Status)) + goto done; + + /* Set the DACL */ + Status = RtlSetDaclSecurityDescriptor(AbsSD, + TRUE, + Dacl, + FALSE); + ASSERT(Status == STATUS_SUCCESS); + if (!NT_SUCCESS(Status)) + goto done; + + /* allocate and create the SACL */ + SaclSize = sizeof(ACL) + + 2 * sizeof(ACE) + + RtlLengthSid(EveryoneSid) + + RtlLengthSid(AnonymousSid); + + Sacl = RtlAllocateHeap(RtlGetProcessHeap(), + HEAP_ZERO_MEMORY, + DaclSize); + if (Sacl == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + ASSERT(Status == STATUS_SUCCESS); + goto done; + } + + Status = RtlCreateAcl(Sacl, + SaclSize, + ACL_REVISION); + ASSERT(Status == STATUS_SUCCESS); + if (!NT_SUCCESS(Status)) + goto done; + + Status = RtlAddAuditAccessAce(Sacl, + ACL_REVISION, + ACCESS_SYSTEM_SECURITY | WRITE_DAC | DELETE | + SAM_SERVER_CREATE_DOMAIN | SAM_SERVER_INITIALIZE | + SAM_SERVER_SHUTDOWN, + EveryoneSid, + TRUE, + TRUE); + ASSERT(Status == STATUS_SUCCESS); + if (!NT_SUCCESS(Status)) + goto done; + + Status = RtlAddAuditAccessAce(Sacl, + ACL_REVISION, + STANDARD_RIGHTS_ALL | SPECIFIC_RIGHTS_ALL, + AnonymousSid, + TRUE, + TRUE); + ASSERT(Status == STATUS_SUCCESS); + if (!NT_SUCCESS(Status)) + goto done; + + /* Set the SACL */ + Status = RtlSetSaclSecurityDescriptor(AbsSD, + TRUE, + Sacl, + FALSE); + ASSERT(Status == STATUS_SUCCESS); + if (!NT_SUCCESS(Status)) + goto done; + + /* Set the owner SID */ + Status = RtlSetOwnerSecurityDescriptor(AbsSD, + AdministratorsSid, + FALSE); + ASSERT(Status == STATUS_SUCCESS); + if (!NT_SUCCESS(Status)) + goto done; + + /* Set the group SID */ + Status = RtlSetGroupSecurityDescriptor(AbsSD, + AdministratorsSid, + FALSE); + ASSERT(Status == STATUS_SUCCESS); + if (!NT_SUCCESS(Status)) + goto done; + + /* Get the reqired buffer size for the self-relative SD */ + Status = RtlAbsoluteToSelfRelativeSD(AbsSD, + NULL, + &RelSDSize); + if (Status != STATUS_BUFFER_TOO_SMALL) + goto done; + + /* Allocate a buffer for the self-relative SD */ + RelSD = RtlAllocateHeap(RtlGetProcessHeap(), + HEAP_ZERO_MEMORY, + RelSDSize); + if (RelSD == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + ASSERT(Status == STATUS_SUCCESS); + goto done; + } + + /* Convert the absolute SD to self-relative format */ + Status = RtlAbsoluteToSelfRelativeSD(AbsSD, + RelSD, + &RelSDSize); + if (Status == STATUS_BUFFER_TOO_SMALL) + { + ASSERT(Status == STATUS_SUCCESS); + goto done; + } + + *ServerSd = RelSD; + *Size = RelSDSize; + +done: + if (!NT_SUCCESS(Status)) + { + if (RelSD != NULL) + RtlFreeHeap(RtlGetProcessHeap(), 0, RelSD); + } + + if (EveryoneSid != NULL) + RtlFreeSid(EveryoneSid); + + if (AnonymousSid != NULL) + RtlFreeSid(AnonymousSid); + + if (AdministratorsSid != NULL) + RtlFreeSid(AdministratorsSid); + + if (Dacl != NULL) + RtlFreeHeap(RtlGetProcessHeap(), 0, Dacl); + + if (Sacl != NULL) + RtlFreeHeap(RtlGetProcessHeap(), 0, Sacl); + + if (AbsSD != NULL) + RtlFreeHeap(RtlGetProcessHeap(), 0, AbsSD); + + return Status; +} + +/* EOF */ Propchange: trunk/reactos/dll/win32/samsrv/security.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/dll/win32/samsrv/setup.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samsrv/setup.c?r…
============================================================================== --- trunk/reactos/dll/win32/samsrv/setup.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/samsrv/setup.c [iso-8859-1] Sun Jun 23 14:26:18 2013 @@ -722,6 +722,8 @@ { HANDLE hServerKey = NULL; HANDLE hDomainsKey = NULL; + PSECURITY_DESCRIPTOR Sd = NULL; + ULONG SdSize = 0; NTSTATUS Status; Status = SampRegCreateKey(hSamKey, @@ -738,11 +740,28 @@ if (!NT_SUCCESS(Status)) goto done; + /* Create the server SD */ + Status = SampCreateServerSD(&Sd, + &SdSize); + if (!NT_SUCCESS(Status)) + goto done; + + /* Set SecDesc attribute*/ + Status = SampRegSetValue(hServerKey, + L"SecDesc", + REG_BINARY, + Sd, + SdSize); + if (!NT_SUCCESS(Status)) + goto done; + SampRegCloseKey(hDomainsKey); *lpServerKey = hServerKey; done: + if (Sd != NULL) + RtlFreeHeap(RtlGetProcessHeap(), 0, Sd); return Status; }
11 years, 6 months
1
0
0
0
[aandrejevic] 59316: [KERNEL32] Use the already implemented BaseIsDosApplication instead of BasepCheckDosApp.
by aandrejevic@svn.reactos.org
Author: aandrejevic Date: Sun Jun 23 13:17:06 2013 New Revision: 59316 URL:
http://svn.reactos.org/svn/reactos?rev=59316&view=rev
Log: [KERNEL32] Use the already implemented BaseIsDosApplication instead of BasepCheckDosApp. Modified: branches/ntvdm/dll/win32/kernel32/client/proc.c Modified: branches/ntvdm/dll/win32/kernel32/client/proc.c URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/dll/win32/kernel32/client…
============================================================================== --- branches/ntvdm/dll/win32/kernel32/client/proc.c [iso-8859-1] (original) +++ branches/ntvdm/dll/win32/kernel32/client/proc.c [iso-8859-1] Sun Jun 23 13:17:06 2013 @@ -181,22 +181,6 @@ { /* Add this to the certification list */ return BasepSaveAppCertRegistryValue(Context, ValueName, ValueData); -} - - -BOOLEAN -NTAPI -BasepCheckDosApp(IN PUNICODE_STRING ApplicationName) -{ - PWCHAR Extension; - - /* Get the extension from the file name */ - Extension = &ApplicationName->Buffer[ApplicationName->Length / - sizeof(WCHAR) - 4]; - - /* Check if the extension is .COM */ - if (_wcsnicmp(Extension, L".com", 4) == 0) return TRUE; - else return FALSE; } NTSTATUS @@ -2877,7 +2861,7 @@ case STATUS_INVALID_IMAGE_NOT_MZ: /* If it's a DOS app, use VDM */ - if ((BasepCheckDosApp(&ApplicationName))) + if (BaseIsDosApplication(&ApplicationName, Status)) { DPRINT1("Launching VDM...\n"); RtlFreeHeap(RtlGetProcessHeap(), 0, NameBuffer);
11 years, 6 months
1
0
0
0
[akhaldi] 59315: [MSHTML] * Fix a typo.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sun Jun 23 12:56:00 2013 New Revision: 59315 URL:
http://svn.reactos.org/svn/reactos?rev=59315&view=rev
Log: [MSHTML] * Fix a typo. Modified: trunk/reactos/dll/win32/mshtml/msvc.S Modified: trunk/reactos/dll/win32/mshtml/msvc.S URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/msvc.S?re…
============================================================================== --- trunk/reactos/dll/win32/mshtml/msvc.S [iso-8859-1] (original) +++ trunk/reactos/dll/win32/mshtml/msvc.S [iso-8859-1] Sun Jun 23 12:56:00 2013 @@ -103,7 +103,7 @@ DEFINE_WRAPPER_FUNC 90, 360, 720 DEFINE_WRAPPER_FUNC 91, 364, 728 DEFINE_WRAPPER_FUNC 92, 368, 736 -DEFINE_WRAPPER_FUNC 93, 372, 744) +DEFINE_WRAPPER_FUNC 93, 372, 744 DEFINE_WRAPPER_FUNC 94, 376, 752 DEFINE_WRAPPER_FUNC 95, 380, 760 DEFINE_WRAPPER_FUNC 96, 384, 768
11 years, 6 months
1
0
0
0
← Newer
1
...
6
7
8
9
10
11
12
...
28
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
Results per page:
10
25
50
100
200