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
May 2017
----- 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
17 participants
288 discussions
Start a n
N
ew thread
[hbelusca] 74464: [CONSRV]: Improvements for console font support (part 2): - Use the font functions from the concfg library (see r74462) to create a new console font & retrieve its metrics, inspir...
by hbelusca@svn.reactos.org
Author: hbelusca Date: Wed May 3 20:13:23 2017 New Revision: 74464 URL:
http://svn.reactos.org/svn/reactos?rev=74464&view=rev
Log: [CONSRV]: Improvements for console font support (part 2): - Use the font functions from the concfg library (see r74462) to create a new console font & retrieve its metrics, inspired by the suggestions from Katayama Hirofumi MZ in CORE-12451 and CORE-13122; - Use string-safe functions to copy the font names into the fixed-size buffers; - Use explicit UNICODE calls to GetObject and CreateFontIndirect. Related to CORE-13182. Modified: trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/conwnd.c Modified: trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/conwnd.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/consrv…
============================================================================== --- trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/conwnd.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/conwnd.c [iso-8859-1] Wed May 3 20:13:23 2017 @@ -18,6 +18,7 @@ #define NDEBUG #include <debug.h> +#include "font.h" #include "guiterm.h" #include "conwnd.h" #include "resource.h" @@ -503,13 +504,13 @@ BOOLEAN bUnderline, BOOLEAN bStrikeOut) { - LOGFONT lf; + LOGFONTW lf; /* Initialize the LOGFONT structure */ RtlZeroMemory(&lf, sizeof(lf)); /* Retrieve the details of the current font */ - if (GetObject(OrgFont, sizeof(lf), &lf) == 0) + if (GetObjectW(OrgFont, sizeof(lf), &lf) == 0) return NULL; /* Change the font attributes */ @@ -521,7 +522,7 @@ lf.lfStrikeOut = bStrikeOut; /* Build a new font */ - return CreateFontIndirect(&lf); + return CreateFontIndirectW(&lf); } BOOL @@ -532,65 +533,32 @@ ULONG FontWeight) { HDC hDC; - HFONT OldFont, NewFont; - TEXTMETRICW Metrics; - SIZE CharSize; + HFONT hFont; + + /* + * Initialize a new NORMAL font and get its character cell size. + */ + /* NOTE: FontSize is always in cell height/width units (pixels) */ + hFont = CreateConsoleFontEx((LONG)(ULONG)FontSize.Y, + (LONG)(ULONG)FontSize.X, + FaceName, + FontFamily, + FontWeight, + GuiData->Console->OutputCodePage); + if (hFont == NULL) + { + DPRINT1("InitFonts: CreateConsoleFontEx failed\n"); + return FALSE; + } hDC = GetDC(GuiData->hWindow); - - /* - * Initialize a new NORMAL font and get its metrics. - */ - - FontSize.Y = FontSize.Y > 0 ? -MulDiv(FontSize.Y, GetDeviceCaps(hDC, LOGPIXELSY), 72) - : FontSize.Y; - - NewFont = CreateFontW(FontSize.Y, - FontSize.X, - 0, - TA_BASELINE, - FontWeight, - FALSE, - FALSE, - FALSE, - OEM_CHARSET, - OUT_DEFAULT_PRECIS, - CLIP_DEFAULT_PRECIS, - DEFAULT_QUALITY, - FIXED_PITCH | FontFamily, - FaceName); - if (NewFont == NULL) - { - DPRINT1("InitFonts: CreateFontW failed\n"); + if (!GetFontCellSize(hDC, hFont, &GuiData->CharHeight, &GuiData->CharWidth)) + { + DPRINT1("InitFonts: GetFontCellSize failed\n"); ReleaseDC(GuiData->hWindow, hDC); + DeleteObject(hFont); return FALSE; } - - OldFont = SelectObject(hDC, NewFont); - if (OldFont == NULL) - { - DPRINT1("InitFonts: SelectObject failed\n"); - ReleaseDC(GuiData->hWindow, hDC); - DeleteObject(NewFont); - return FALSE; - } - - if (!GetTextMetricsW(hDC, &Metrics)) - { - DPRINT1("InitFonts: GetTextMetrics failed\n"); - SelectObject(hDC, OldFont); - ReleaseDC(GuiData->hWindow, hDC); - DeleteObject(NewFont); - return FALSE; - } - GuiData->CharWidth = Metrics.tmMaxCharWidth; - GuiData->CharHeight = Metrics.tmHeight + Metrics.tmExternalLeading; - - /* Measure real char width more precisely if possible */ - if (GetTextExtentPoint32W(hDC, L"R", 1, &CharSize)) - GuiData->CharWidth = CharSize.cx; - - SelectObject(hDC, OldFont); ReleaseDC(GuiData->hWindow, hDC); /* @@ -598,7 +566,7 @@ */ // Delete all the old fonts first. DeleteFonts(GuiData); - GuiData->Font[FONT_NORMAL] = NewFont; + GuiData->Font[FONT_NORMAL] = hFont; /* * Now build the other fonts (bold, underlined, mixed). @@ -624,8 +592,8 @@ */ if (FaceName != GuiData->GuiInfo.FaceName) { - wcsncpy(GuiData->GuiInfo.FaceName, FaceName, LF_FACESIZE); - GuiData->GuiInfo.FaceName[LF_FACESIZE - 1] = UNICODE_NULL; + StringCchCopyNW(GuiData->GuiInfo.FaceName, ARRAYSIZE(GuiData->GuiInfo.FaceName), + FaceName, LF_FACESIZE); } GuiData->GuiInfo.FontFamily = FontFamily; GuiData->GuiInfo.FontSize = FontSize; @@ -1012,7 +980,7 @@ WindowTitle = ConsoleAllocHeap(0, Length); wcsncpy(WindowTitle, SelTypeStr, SelTypeStrLength); - WindowTitle[SelTypeStrLength] = L'\0'; + WindowTitle[SelTypeStrLength] = UNICODE_NULL; wcscat(WindowTitle, L" - "); wcscat(WindowTitle, Console->Title.Buffer);
7 years, 7 months
1
0
0
0
[hbelusca] 74463: [CONSRV]: Use string-safe functions to copy the font names into the fixed-size buffers.
by hbelusca@svn.reactos.org
Author: hbelusca Date: Wed May 3 19:57:28 2017 New Revision: 74463 URL:
http://svn.reactos.org/svn/reactos?rev=74463&view=rev
Log: [CONSRV]: Use string-safe functions to copy the font names into the fixed-size buffers. Modified: trunk/reactos/win32ss/user/winsrv/consrv/consrv.h trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/guisettings.c trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/guiterm.c Modified: trunk/reactos/win32ss/user/winsrv/consrv/consrv.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/consrv…
============================================================================== --- trunk/reactos/win32ss/user/winsrv/consrv/consrv.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/winsrv/consrv/consrv.h [iso-8859-1] Wed May 3 19:57:28 2017 @@ -11,6 +11,8 @@ /* Main header */ #include "../winsrv.h" + +#include <strsafe.h> /* PSDK/NDK Headers */ #define WIN32_NO_STATUS Modified: trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/guisettings.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/consrv…
============================================================================== --- trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/guisettings.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/guisettings.c [iso-8859-1] Wed May 3 19:57:28 2017 @@ -161,8 +161,8 @@ pSharedInfo->CodePage = Console->OutputCodePage; /* GUI Information */ - wcsncpy(pSharedInfo->FaceName, GuiData->GuiInfo.FaceName, LF_FACESIZE); - pSharedInfo->FaceName[LF_FACESIZE - 1] = UNICODE_NULL; + StringCchCopyNW(pSharedInfo->FaceName, ARRAYSIZE(pSharedInfo->FaceName), + GuiData->GuiInfo.FaceName, ARRAYSIZE(GuiData->GuiInfo.FaceName)); pSharedInfo->FontFamily = GuiData->GuiInfo.FontFamily; pSharedInfo->FontSize = GuiData->GuiInfo.FontSize; pSharedInfo->FontWeight = GuiData->GuiInfo.FontWeight; Modified: trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/guiterm.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/consrv…
============================================================================== --- trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/guiterm.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/guiterm.c [iso-8859-1] Wed May 3 19:57:28 2017 @@ -1272,8 +1272,8 @@ #endif // Font data - wcsncpy(GuiInitInfo->TermInfo.FaceName, ConsoleInfo->FaceName, LF_FACESIZE); - GuiInitInfo->TermInfo.FaceName[LF_FACESIZE - 1] = UNICODE_NULL; + StringCchCopyNW(GuiInitInfo->TermInfo.FaceName, ARRAYSIZE(GuiInitInfo->TermInfo.FaceName), + ConsoleInfo->FaceName, ARRAYSIZE(ConsoleInfo->FaceName)); GuiInitInfo->TermInfo.FontFamily = ConsoleInfo->FontFamily; GuiInitInfo->TermInfo.FontSize = ConsoleInfo->FontSize; GuiInitInfo->TermInfo.FontWeight = ConsoleInfo->FontWeight;
7 years, 7 months
1
0
0
0
[hbelusca] 74462: [CONCFG]: Diverse improvements/additions for the console configuration library. CORE-13182 - Use string-safe functions to copy the font names into the fixed-size buffers; - Modify...
by hbelusca@svn.reactos.org
Author: hbelusca Date: Wed May 3 19:47:18 2017 New Revision: 74462 URL:
http://svn.reactos.org/svn/reactos?rev=74462&view=rev
Log: [CONCFG]: Diverse improvements/additions for the console configuration library. CORE-13182 - Use string-safe functions to copy the font names into the fixed-size buffers; - Modify some default settings; - Add a set of console font manipulation functions, to be used later by both the console applet console.cpl and by CONSRV. Some of these functions come from r74365 with minor improvements (see CORE-12451 too), others are based from a patch by Katayama Hirofumi MZ from CORE-13122, and the rest are needed for an upcoming commit for console.cpl. - Add PCH support in concfg. - Minor code formatting: Use our regular formatting for function prototypes. Added: trunk/reactos/win32ss/user/winsrv/concfg/concfg.h (with props) trunk/reactos/win32ss/user/winsrv/concfg/font.c (with props) trunk/reactos/win32ss/user/winsrv/concfg/font.h (with props) trunk/reactos/win32ss/user/winsrv/concfg/precomp.h (with props) Modified: trunk/reactos/win32ss/user/winsrv/concfg/CMakeLists.txt trunk/reactos/win32ss/user/winsrv/concfg/settings.c trunk/reactos/win32ss/user/winsrv/concfg/settings.h Modified: trunk/reactos/win32ss/user/winsrv/concfg/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/concfg…
============================================================================== --- trunk/reactos/win32ss/user/winsrv/concfg/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/winsrv/concfg/CMakeLists.txt [iso-8859-1] Wed May 3 19:47:18 2017 @@ -1,3 +1,9 @@ -add_library(concfg settings.c) +list(APPEND SOURCE + font.c + settings.c + precomp.h) + +add_library(concfg ${SOURCE}) +add_pch(concfg precomp.h SOURCE) add_dependencies(concfg xdk) Added: trunk/reactos/win32ss/user/winsrv/concfg/concfg.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/concfg…
============================================================================== --- trunk/reactos/win32ss/user/winsrv/concfg/concfg.h (added) +++ trunk/reactos/win32ss/user/winsrv/concfg/concfg.h [iso-8859-1] Wed May 3 19:47:18 2017 @@ -0,0 +1,30 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Console Server DLL + * FILE: win32ss/user/winsrv/concfg/concfg.h + * PURPOSE: Console settings management - Public header + * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca(a)sfr.fr) + */ + +#pragma once + +/* Needed PSDK headers when using this library */ +#if 0 + +#define WIN32_NO_STATUS +#define _INC_WINDOWS +#define COM_NO_WINDOWS_H + +#include <wingdi.h> // For LF_FACESIZE and TranslateCharsetInfo() +#include <wincon.h> +#include <winnls.h> // For code page support +#include <winreg.h> + +#endif + +/* NOTE: Please keep the header inclusion order! */ + +#include "settings.h" +#include "font.h" + +/* EOF */ Propchange: trunk/reactos/win32ss/user/winsrv/concfg/concfg.h ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/reactos/win32ss/user/winsrv/concfg/font.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/concfg…
============================================================================== --- trunk/reactos/win32ss/user/winsrv/concfg/font.c (added) +++ trunk/reactos/win32ss/user/winsrv/concfg/font.c [iso-8859-1] Wed May 3 19:47:18 2017 @@ -0,0 +1,333 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Console Server DLL + * FILE: win32ss/user/winsrv/concfg/font.c + * PURPOSE: Console Fonts Management + * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca(a)sfr.fr) + * Katayama Hirofumi MZ (katayama.hirofumi.mz(a)gmail.com) + */ + +/* INCLUDES *******************************************************************/ + +#include "precomp.h" +#include <winuser.h> + +#include "settings.h" +#include "font.h" +// #include "concfg.h" + +#define NDEBUG +#include <debug.h> + + +/* FUNCTIONS ******************************************************************/ + +/* Retrieves the character set associated with a given code page */ +BYTE +CodePageToCharSet( + IN UINT CodePage) +{ + CHARSETINFO CharInfo; + if (TranslateCharsetInfo((LPDWORD)CodePage, &CharInfo, TCI_SRCCODEPAGE)) + return CharInfo.ciCharset; + else + return DEFAULT_CHARSET; +} + +HFONT +CreateConsoleFontEx( + IN LONG Height, + IN LONG Width OPTIONAL, + IN OUT LPWSTR FaceName, // Points to a WCHAR array of LF_FACESIZE elements + IN ULONG FontFamily, + IN ULONG FontWeight, + IN UINT CodePage) +{ + LOGFONTW lf; + + RtlZeroMemory(&lf, sizeof(lf)); + + lf.lfHeight = Height; + lf.lfWidth = Width; + + lf.lfEscapement = 0; + lf.lfOrientation = 0; // TA_BASELINE; // TA_RTLREADING; when the console supports RTL? + // lf.lfItalic = lf.lfUnderline = lf.lfStrikeOut = FALSE; + lf.lfWeight = FontWeight; + lf.lfCharSet = CodePageToCharSet(CodePage); + lf.lfOutPrecision = OUT_DEFAULT_PRECIS; + lf.lfClipPrecision = CLIP_DEFAULT_PRECIS; + lf.lfQuality = DEFAULT_QUALITY; + lf.lfPitchAndFamily = (BYTE)(FIXED_PITCH | FontFamily); + + if (!IsValidConsoleFont(FaceName, CodePage)) + StringCchCopyW(FaceName, LF_FACESIZE, L"Terminal"); + + StringCchCopyNW(lf.lfFaceName, ARRAYSIZE(lf.lfFaceName), + FaceName, LF_FACESIZE); + + return CreateFontIndirectW(&lf); +} + +HFONT +CreateConsoleFont2( + IN LONG Height, + IN LONG Width OPTIONAL, + IN OUT PCONSOLE_STATE_INFO ConsoleInfo) +{ + return CreateConsoleFontEx(Height, + Width, + ConsoleInfo->FaceName, + ConsoleInfo->FontFamily, + ConsoleInfo->FontWeight, + ConsoleInfo->CodePage); +} + +HFONT +CreateConsoleFont( + IN OUT PCONSOLE_STATE_INFO ConsoleInfo) +{ + /* + * Format: + * Width = FontSize.X = LOWORD(FontSize); + * Height = FontSize.Y = HIWORD(FontSize); + */ + /* NOTE: FontSize is always in cell height/width units (pixels) */ + return CreateConsoleFontEx((LONG)(ULONG)ConsoleInfo->FontSize.Y, + (LONG)(ULONG)ConsoleInfo->FontSize.X, + ConsoleInfo->FaceName, + ConsoleInfo->FontFamily, + ConsoleInfo->FontWeight, + ConsoleInfo->CodePage); +} + +BOOL +GetFontCellSize( + IN HDC hDC OPTIONAL, + IN HFONT hFont, + OUT PUINT Height, + OUT PUINT Width) +{ + BOOL Success = FALSE; + HDC hOrgDC = hDC; + HFONT hOldFont; + // LONG LogSize, PointSize; + LONG CharWidth, CharHeight; + TEXTMETRICW tm; + // SIZE CharSize; + + if (!hDC) + hDC = GetDC(NULL); + + hOldFont = SelectObject(hDC, hFont); + if (hOldFont == NULL) + { + DPRINT1("GetFontCellSize: SelectObject failed\n"); + goto Quit; + } + +/* + * See also: Display_SetTypeFace in applications/fontview/display.c + */ + + /* + * Note that the method with GetObjectW just returns + * the original parameters with which the font was created. + */ + if (!GetTextMetricsW(hDC, &tm)) + { + DPRINT1("GetFontCellSize: GetTextMetrics failed\n"); + goto Cleanup; + } + + CharHeight = tm.tmHeight + tm.tmExternalLeading; + +#if 0 + /* Measure real char width more precisely if possible */ + if (GetTextExtentPoint32W(hDC, L"R", 1, &CharSize)) + CharWidth = CharSize.cx; +#else + CharWidth = tm.tmAveCharWidth; // tm.tmMaxCharWidth; +#endif + +#if 0 + /*** Logical to Point size ***/ + LogSize = tm.tmHeight - tm.tmInternalLeading; + PointSize = MulDiv(LogSize, 72, GetDeviceCaps(hDC, LOGPIXELSY)); + /*****************************/ +#endif + + *Height = (UINT)CharHeight; + *Width = (UINT)CharWidth; + Success = TRUE; + +Cleanup: + SelectObject(hDC, hOldFont); +Quit: + if (!hOrgDC) + ReleaseDC(NULL, hDC); + + return Success; +} + +BOOL +IsValidConsoleFont2( + IN PLOGFONTW lplf, + IN PNEWTEXTMETRICW lpntm, + IN DWORD FontType, + IN UINT CodePage) +{ + LPCWSTR FaceName = lplf->lfFaceName; + + /* Record the font's attributes (Fixedwidth and Truetype) */ + // BOOL fFixed = ((lplf->lfPitchAndFamily & 0x03) == FIXED_PITCH); + // BOOL fTrueType = (lplf->lfOutPrecision == OUT_STROKE_PRECIS); + + /* + * According to:
http://support.microsoft.com/kb/247815
+ * the criteria for console-eligible fonts are: + * - The font must be a fixed-pitch font. + * - The font cannot be an italic font. + * - The font cannot have a negative A or C space. + * - If it is a TrueType font, it must be FF_MODERN. + * - If it is not a TrueType font, it must be OEM_CHARSET. + * + * Non documented: vertical fonts are forbidden (their name start with a '@'). + * + * Additional criteria for Asian installations: + * - If it is not a TrueType font, the face name must be "Terminal". + * - If it is an Asian TrueType font, it must also be an Asian character set. + * + * To install additional TrueType fonts to be available for the console, + * add entries of type REG_SZ named "0", "00" etc... in: + * HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont + * The names of the fonts listed there should match those in: + * HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Fonts + */ + + /* + * In ReactOS we relax some of the criteria: + * - We allow fixed-pitch FF_MODERN (Monospace) TrueType fonts + * that can be italic or have negative A or C space. + * - If it is not a TrueType font, it can be from another character set + * than OEM_CHARSET. + * - We do not look into the magic registry key mentioned above. + */ + + /* Reject variable width fonts */ + if (((lplf->lfPitchAndFamily & 0x03) != FIXED_PITCH) +#if 0 /* Reject italic and TrueType fonts with negative A or C space */ + || (lplf->lfItalic) + || !(lpntm->ntmFlags & NTM_NONNEGATIVE_AC) +#endif + ) + { + DPRINT1("Font '%S' rejected because it%s (lfPitchAndFamily = %d).\n", + FaceName, !(lplf->lfPitchAndFamily & FIXED_PITCH) ? "'s not FIXED_PITCH" + : (!(lpntm->ntmFlags & NTM_NONNEGATIVE_AC) ? " has negative A or C space" + : " is broken"), + lplf->lfPitchAndFamily); + return FALSE; + } + + /* Reject TrueType fonts that are not FF_MODERN */ + if ((FontType == TRUETYPE_FONTTYPE) && ((lplf->lfPitchAndFamily & 0xF0) != FF_MODERN)) + { + DPRINT1("TrueType font '%S' rejected because it's not FF_MODERN (lfPitchAndFamily = %d)\n", + FaceName, lplf->lfPitchAndFamily); + return FALSE; + } + + /* Is the current code page Chinese, Japanese or Korean? */ + if (IsCJKCodePage(CodePage)) + { + /* It's Asian */ + if (FontType == TRUETYPE_FONTTYPE) + { + if (lplf->lfCharSet != CodePageToCharSet(CodePage)) + { + DPRINT1("TrueType font '%S' rejected because it's not user Asian charset (lfCharSet = %d)\n", + FaceName, lplf->lfCharSet); + return FALSE; + } + } + else + { + /* Reject non-TrueType fonts that are not Terminal */ + if (wcscmp(FaceName, L"Terminal") != 0) + { + DPRINT1("Non-TrueType font '%S' rejected because it's not Terminal\n", FaceName); + return FALSE; + } + } + } + else + { + /* Not CJK */ + if ((FontType != TRUETYPE_FONTTYPE) && + (lplf->lfCharSet != ANSI_CHARSET) && + (lplf->lfCharSet != DEFAULT_CHARSET) && + (lplf->lfCharSet != OEM_CHARSET)) + { + DPRINT1("Non-TrueType font '%S' rejected because it's not ANSI_CHARSET or DEFAULT_CHARSET or OEM_CHARSET (lfCharSet = %d)\n", + FaceName, lplf->lfCharSet); + return FALSE; + } + } + + /* Reject fonts that are vertical (tategaki) */ + if (FaceName[0] == L'@') + { + DPRINT1("Font '%S' rejected because it's vertical\n", FaceName); + return FALSE; + } + + /* All good */ + return TRUE; +} + +typedef struct _IS_VALID_CONSOLE_FONT_PARAM +{ + BOOL IsValidFont; + UINT CodePage; +} IS_VALID_CONSOLE_FONT_PARAM, *PIS_VALID_CONSOLE_FONT_PARAM; + +static BOOL CALLBACK +IsValidConsoleFontProc( + IN PLOGFONTW lplf, + IN PNEWTEXTMETRICW lpntm, + IN DWORD FontType, + IN LPARAM lParam) +{ + PIS_VALID_CONSOLE_FONT_PARAM Param = (PIS_VALID_CONSOLE_FONT_PARAM)lParam; + Param->IsValidFont = IsValidConsoleFont2(lplf, lpntm, FontType, Param->CodePage); + + /* Stop the enumeration now */ + return FALSE; +} + +BOOL +IsValidConsoleFont( + IN LPCWSTR FaceName, + IN UINT CodePage) +{ + IS_VALID_CONSOLE_FONT_PARAM Param; + HDC hDC; + LOGFONTW lf; + + Param.IsValidFont = FALSE; + Param.CodePage = CodePage; + + RtlZeroMemory(&lf, sizeof(lf)); + lf.lfCharSet = DEFAULT_CHARSET; // CodePageToCharSet(CodePage); + // lf.lfPitchAndFamily = FIXED_PITCH | FF_DONTCARE; + StringCchCopyW(lf.lfFaceName, ARRAYSIZE(lf.lfFaceName), FaceName); + + hDC = GetDC(NULL); + EnumFontFamiliesExW(hDC, &lf, (FONTENUMPROCW)IsValidConsoleFontProc, (LPARAM)&Param, 0); + ReleaseDC(NULL, hDC); + + return Param.IsValidFont; +} + +/* EOF */ Propchange: trunk/reactos/win32ss/user/winsrv/concfg/font.c ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/reactos/win32ss/user/winsrv/concfg/font.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/concfg…
============================================================================== --- trunk/reactos/win32ss/user/winsrv/concfg/font.h (added) +++ trunk/reactos/win32ss/user/winsrv/concfg/font.h [iso-8859-1] Wed May 3 19:47:18 2017 @@ -0,0 +1,68 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Console Server DLL + * FILE: win32ss/user/winsrv/concfg/font.h + * PURPOSE: Console Fonts Management + * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca(a)sfr.fr) + * Katayama Hirofumi MZ (katayama.hirofumi.mz(a)gmail.com) + */ + +#pragma once + +/* DEFINES ********************************************************************/ + +#define CP_SHIFTJIS 932 // Japanese Shift-JIS +#define CP_HANGUL 949 // Korean Hangul +#define CP_GB2312 936 // Chinese Simplified (GB2312) +#define CP_BIG5 950 // Chinese Traditional (Big5) + +/* IsFarEastCP(CodePage) */ +#define IsCJKCodePage(CodePage) \ + ((CodePage) == CP_SHIFTJIS || (CodePage) == CP_HANGUL || \ + (CodePage) == CP_BIG5 || (CodePage) == CP_GB2312) + +/* FUNCTIONS ******************************************************************/ + +BYTE +CodePageToCharSet( + IN UINT CodePage); + +HFONT +CreateConsoleFontEx( + IN LONG Height, + IN LONG Width OPTIONAL, + IN OUT LPWSTR FaceName, // Points to a WCHAR array of LF_FACESIZE elements + IN ULONG FontFamily, + IN ULONG FontWeight, + IN UINT CodePage); + +HFONT +CreateConsoleFont2( + IN LONG Height, + IN LONG Width OPTIONAL, + IN OUT PCONSOLE_STATE_INFO ConsoleInfo); + +HFONT +CreateConsoleFont( + IN OUT PCONSOLE_STATE_INFO ConsoleInfo); + +BOOL +GetFontCellSize( + IN HDC hDC OPTIONAL, + IN HFONT hFont, + OUT PUINT Height, + OUT PUINT Width); + +BOOL +IsValidConsoleFont2( + IN PLOGFONTW lplf, + IN PNEWTEXTMETRICW lpntm, + IN DWORD FontType, + IN UINT CodePage); + +BOOL +IsValidConsoleFont( + IN LPCWSTR FaceName, + IN UINT CodePage); + +/* EOF */ Propchange: trunk/reactos/win32ss/user/winsrv/concfg/font.h ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/reactos/win32ss/user/winsrv/concfg/precomp.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/concfg…
============================================================================== --- trunk/reactos/win32ss/user/winsrv/concfg/precomp.h (added) +++ trunk/reactos/win32ss/user/winsrv/concfg/precomp.h [iso-8859-1] Wed May 3 19:47:18 2017 @@ -0,0 +1,37 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Console Server DLL + * FILE: win32ss/user/winsrv/concfg/precomp.h + * PURPOSE: Console settings management - Precompiled header + * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca(a)sfr.fr) + */ + +// #pragma once + +/* PSDK/NDK Headers */ + +#define WIN32_NO_STATUS +#define _INC_WINDOWS +#define COM_NO_WINDOWS_H + +#include <windef.h> +#include <winbase.h> +#include <wingdi.h> // For LF_FACESIZE and TranslateCharsetInfo() +#include <wincon.h> +#include <winnls.h> // For code page support +#include <winreg.h> +// #include <imm.h> + +// /* Undocumented user definitions */ +// #include <undocuser.h> + +#define NTOS_MODE_USER +// #include <ndk/cmfuncs.h> +// #include <ndk/exfuncs.h> +#include <ndk/obfuncs.h> +#include <ndk/rtlfuncs.h> + +#include <stdio.h> // for swprintf +#include <strsafe.h> + +/* EOF */ Propchange: trunk/reactos/win32ss/user/winsrv/concfg/precomp.h ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/win32ss/user/winsrv/concfg/settings.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/concfg…
============================================================================== --- trunk/reactos/win32ss/user/winsrv/concfg/settings.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/winsrv/concfg/settings.c [iso-8859-1] Wed May 3 19:47:18 2017 @@ -9,35 +9,12 @@ /* INCLUDES *******************************************************************/ -/* PSDK/NDK Headers */ - -#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H - -#include <windef.h> -#include <winbase.h> -#include <wingdi.h> // For LF_FACESIZE -#include <wincon.h> -#include <winnls.h> -#include <winreg.h> -// #include <winuser.h> -// #include <imm.h> +#include "precomp.h" // /* Undocumented user definitions */ // #include <undocuser.h> -#define NTOS_MODE_USER -// #include <ndk/cmfuncs.h> -// #include <ndk/exfuncs.h> -#include <ndk/obfuncs.h> -// #include <ndk/psfuncs.h> -#include <ndk/rtlfuncs.h> - #include "settings.h" - -#include <stdio.h> // for swprintf -#include <strsafe.h> #define NDEBUG #include <debug.h> @@ -45,6 +22,7 @@ /* GLOBALS ********************************************************************/ /* Default cursor size -- see conio_winsrv.h */ +// #define SMALL_SIZE 25 #define CSR_DEFAULT_CURSOR_SIZE 25 /* Default attributes -- see conio.h */ @@ -76,20 +54,15 @@ RGB(255, 255, 0), // GREEN | RED | INTENSITY RGB(255, 255, 255) // BLUE | GREEN | RED | INTENSITY }; -// /* Default attributes */ -// #define DEFAULT_SCREEN_ATTRIB (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED) -// #define DEFAULT_POPUP_ATTRIB (FOREGROUND_BLUE | FOREGROUND_RED | / - // BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_INTENSITY) -// /* Cursor size */ -// #define CSR_DEFAULT_CURSOR_SIZE 25 /* FUNCTIONS ******************************************************************/ static VOID -TranslateConsoleName(OUT LPWSTR DestString, - IN LPCWSTR ConsoleName, - IN UINT MaxStrLen) +TranslateConsoleName( + OUT LPWSTR DestString, + IN LPCWSTR ConsoleName, + IN UINT MaxStrLen) { #define PATH_SEPARATOR L'\\' @@ -117,10 +90,11 @@ } BOOLEAN -ConCfgOpenUserSettings(LPCWSTR ConsoleTitle, - PHKEY hSubKey, - REGSAM samDesired, - BOOLEAN Create) +ConCfgOpenUserSettings( + IN LPCWSTR ConsoleTitle, + OUT PHKEY phSubKey, + IN REGSAM samDesired, + IN BOOLEAN Create) { BOOLEAN Success = TRUE; NTSTATUS Status; @@ -171,7 +145,7 @@ REG_OPTION_NON_VOLATILE, samDesired, NULL, - hSubKey, + phSubKey, NULL) == ERROR_SUCCESS); } else @@ -181,7 +155,7 @@ szBuffer, 0, samDesired, - hSubKey) == ERROR_SUCCESS); + phSubKey) == ERROR_SUCCESS); } /* Close the parent key and return success or not */ @@ -190,8 +164,9 @@ } BOOLEAN -ConCfgReadUserSettings(IN OUT PCONSOLE_STATE_INFO ConsoleInfo, - IN BOOLEAN DefaultSettings) +ConCfgReadUserSettings( + IN OUT PCONSOLE_STATE_INFO ConsoleInfo, + IN BOOLEAN DefaultSettings) { BOOLEAN Success = FALSE; HKEY hKey; @@ -263,8 +238,8 @@ } else if (!wcscmp(szValueName, L"FaceName")) { - wcsncpy(ConsoleInfo->FaceName, szValue, LF_FACESIZE); - ConsoleInfo->FaceName[LF_FACESIZE - 1] = UNICODE_NULL; + StringCchCopyNW(ConsoleInfo->FaceName, ARRAYSIZE(ConsoleInfo->FaceName), + szValue, ARRAYSIZE(szValue)); Success = TRUE; } else if (!wcscmp(szValueName, L"FontFamily")) @@ -354,8 +329,9 @@ } BOOLEAN -ConCfgWriteUserSettings(IN PCONSOLE_STATE_INFO ConsoleInfo, - IN BOOLEAN DefaultSettings) +ConCfgWriteUserSettings( + IN PCONSOLE_STATE_INFO ConsoleInfo, + IN BOOLEAN DefaultSettings) { HKEY hKey; DWORD Storage = 0; @@ -445,7 +421,8 @@ } VOID -ConCfgInitDefaultSettings(IN OUT PCONSOLE_STATE_INFO ConsoleInfo) +ConCfgInitDefaultSettings( + IN OUT PCONSOLE_STATE_INFO ConsoleInfo) { if (ConsoleInfo == NULL) return; @@ -455,15 +432,15 @@ // wcsncpy(ConsoleInfo->FaceName, L"DejaVu Sans Mono", LF_FACESIZE); // ConsoleInfo->FontSize = MAKELONG(8, 12); // 0x000C0008; // font is 8x12 - // ConsoleInfo->FontSize = MAKELONG(16, 16); // font is 16x16 - - wcsncpy(ConsoleInfo->FaceName, L"VGA", LF_FACESIZE); // HACK: !! + + StringCchCopyW(ConsoleInfo->FaceName, ARRAYSIZE(ConsoleInfo->FaceName), L"VGA"); // HACK: !! // ConsoleInfo->FaceName[0] = UNICODE_NULL; + // ConsoleInfo->FontSize.X = 8; + // ConsoleInfo->FontSize.Y = 12; + ConsoleInfo->FontSize.X = 0; // HACK: !! + ConsoleInfo->FontSize.Y = 16; // HACK: !! ConsoleInfo->FontFamily = FF_DONTCARE; - ConsoleInfo->FontSize.X = 0; - ConsoleInfo->FontSize.Y = 0; - ConsoleInfo->FontWeight = FW_NORMAL; // HACK: !! - // ConsoleInfo->FontWeight = FW_DONTCARE; + ConsoleInfo->FontWeight = FW_NORMAL; // FW_DONTCARE; /* Initialize the default properties */ @@ -488,7 +465,7 @@ ConsoleInfo->WindowPosition.x = 0; ConsoleInfo->WindowPosition.y = 0; - ConsoleInfo->CursorSize = CSR_DEFAULT_CURSOR_SIZE; // #define SMALL_SIZE 25 + ConsoleInfo->CursorSize = CSR_DEFAULT_CURSOR_SIZE; ConsoleInfo->ScreenAttributes = DEFAULT_SCREEN_ATTRIB; ConsoleInfo->PopupAttributes = DEFAULT_POPUP_ATTRIB; @@ -499,7 +476,8 @@ } VOID -ConCfgGetDefaultSettings(IN OUT PCONSOLE_STATE_INFO ConsoleInfo) +ConCfgGetDefaultSettings( + IN OUT PCONSOLE_STATE_INFO ConsoleInfo) { if (ConsoleInfo == NULL) return; Modified: trunk/reactos/win32ss/user/winsrv/concfg/settings.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/concfg…
============================================================================== --- trunk/reactos/win32ss/user/winsrv/concfg/settings.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/winsrv/concfg/settings.h [iso-8859-1] Wed May 3 19:47:18 2017 @@ -76,18 +76,28 @@ /* FUNCTIONS ******************************************************************/ BOOLEAN -ConCfgOpenUserSettings(LPCWSTR ConsoleTitle, - PHKEY hSubKey, - REGSAM samDesired, - BOOLEAN Create); +ConCfgOpenUserSettings( + IN LPCWSTR ConsoleTitle, + OUT PHKEY phSubKey, + IN REGSAM samDesired, + IN BOOLEAN Create); + BOOLEAN -ConCfgReadUserSettings(IN OUT PCONSOLE_STATE_INFO ConsoleInfo, - IN BOOLEAN DefaultSettings); +ConCfgReadUserSettings( + IN OUT PCONSOLE_STATE_INFO ConsoleInfo, + IN BOOLEAN DefaultSettings); + BOOLEAN -ConCfgWriteUserSettings(IN PCONSOLE_STATE_INFO ConsoleInfo, - IN BOOLEAN DefaultSettings); +ConCfgWriteUserSettings( + IN PCONSOLE_STATE_INFO ConsoleInfo, + IN BOOLEAN DefaultSettings); -VOID ConCfgInitDefaultSettings(IN OUT PCONSOLE_STATE_INFO ConsoleInfo); -VOID ConCfgGetDefaultSettings(IN OUT PCONSOLE_STATE_INFO ConsoleInfo); +VOID +ConCfgInitDefaultSettings( + IN OUT PCONSOLE_STATE_INFO ConsoleInfo); + +VOID +ConCfgGetDefaultSettings( + IN OUT PCONSOLE_STATE_INFO ConsoleInfo); /* EOF */
7 years, 7 months
1
0
0
0
[cfinck] 74461: [ISOHYBRID] Patch all our ISOs (bootcd, bootcdregtest, livecd, hybridcd) with isohybrid in order to make them bootable from HDDs or any kind of USB drives. The added MBR at the begi...
by cfinck@svn.reactos.org
Author: cfinck Date: Wed May 3 15:32:33 2017 New Revision: 74461 URL:
http://svn.reactos.org/svn/reactos?rev=74461&view=rev
Log: [ISOHYBRID] Patch all our ISOs (bootcd, bootcdregtest, livecd, hybridcd) with isohybrid in order to make them bootable from HDDs or any kind of USB drives. The added MBR at the beginning of each ISO doesn't cause any harm for normal CD booting anymore after my patch in r74460. There is also no need for the dedicated isohybrid targets anymore. Our ISOMBR master boot record now successfully loads our ISOBOOT boot sector. ISOBOOT loads FreeLdr and indicates that we're booting from HDD, so that FreeLdr can successfully load the kernel. We then bugcheck in the kernel with either 0x0000007B (INACCESSIBLE_BOOT_DEVICE) using bootcd or 0x0000006B (PROCESS1_INITIALIZATION_FAILED) using livecd. Testcase is: qemu-system-i386 -m 512 -hda bootcd_or_livecd.iso Needs more investigation, but these are separate bugs and I consider CORE-12648 fixed. Modified: trunk/reactos/boot/CMakeLists.txt Modified: trunk/reactos/boot/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/CMakeLists.txt?rev=74…
============================================================================== --- trunk/reactos/boot/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/boot/CMakeLists.txt [iso-8859-1] Wed May 3 15:32:33 2017 @@ -68,11 +68,8 @@ -eltorito-boot loader/isoboot.bin -no-emul-boot -boot-load-size 4 -eltorito-alt-boot -eltorito-platform efi -eltorito-boot loader/efisys.bin -no-emul-boot -hide boot.catalog -sort ${CMAKE_CURRENT_BINARY_DIR}/bootfiles.sort -no-cache-inodes -graft-points -path-list ${CMAKE_CURRENT_BINARY_DIR}/bootcd.lst - DEPENDS native-mkisofs - VERBATIM) -add_custom_target(isohybrid_bootcd COMMAND native-isohybrid -b ${_isombr_file} ${REACTOS_BINARY_DIR}/bootcd.iso - DEPENDS native-isohybrid isombr bootcd + DEPENDS isombr native-isohybrid native-mkisofs VERBATIM) ## BootCDRegTest @@ -86,11 +83,8 @@ -eltorito-boot loader/isobtrt.bin -no-emul-boot -boot-load-size 4 -eltorito-alt-boot -eltorito-platform efi -eltorito-boot loader/efisys.bin -no-emul-boot -hide boot.catalog -sort ${CMAKE_CURRENT_BINARY_DIR}/bootfiles.sort -no-cache-inodes -graft-points -path-list ${CMAKE_CURRENT_BINARY_DIR}/bootcdregtest.lst - DEPENDS native-mkisofs - VERBATIM) -add_custom_target(isohybrid_bootcdregtest COMMAND native-isohybrid -b ${_isombr_file} ${REACTOS_BINARY_DIR}/bootcdregtest.iso - DEPENDS native-isohybrid isombr bootcdregtest + DEPENDS isombr native-isohybrid native-mkisofs VERBATIM) ## LiveCD @@ -132,11 +126,8 @@ -eltorito-boot loader/isoboot.bin -no-emul-boot -boot-load-size 4 -eltorito-alt-boot -eltorito-platform efi -eltorito-boot loader/efisys.bin -no-emul-boot -hide boot.catalog -sort ${CMAKE_CURRENT_BINARY_DIR}/bootfiles.sort -no-cache-inodes -graft-points -path-list ${CMAKE_CURRENT_BINARY_DIR}/livecd.lst - DEPENDS native-mkisofs - VERBATIM) -add_custom_target(isohybrid_livecd COMMAND native-isohybrid -b ${_isombr_file} ${REACTOS_BINARY_DIR}/livecd.iso - DEPENDS native-isohybrid isombr livecd + DEPENDS isombr native-isohybrid native-mkisofs VERBATIM) ## HybridCD @@ -178,11 +169,8 @@ -eltorito-boot loader/isoboot.bin -no-emul-boot -boot-load-size 4 -eltorito-alt-boot -eltorito-platform efi -eltorito-boot loader/efisys.bin -no-emul-boot -hide boot.catalog -sort ${CMAKE_CURRENT_BINARY_DIR}/bootfiles.sort -duplicates-once -no-cache-inodes -graft-points -path-list ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.lst - DEPENDS native-mkisofs bootcd livecd - VERBATIM) -add_custom_target(isohybrid_hybridcd COMMAND native-isohybrid -b ${_isombr_file} ${REACTOS_BINARY_DIR}/hybridcd.iso - DEPENDS native-isohybrid isombr hybridcd + DEPENDS bootcd livecd VERBATIM) add_cd_file(TARGET efisys FILE ${CMAKE_CURRENT_BINARY_DIR}/efisys.bin DESTINATION loader NO_CAB NOT_IN_HYBRIDCD FOR bootcd regtest livecd hybridcd)
7 years, 7 months
1
0
0
0
[cfinck] 74460: [FREELDR] Set BootPartition (DH) to 0xFF in isoboot.S when booting from CD. Then check for that 0xFF value in FreeLdr to unambiguously detect CD booting instead of using BIOS functi...
by cfinck@svn.reactos.org
Author: cfinck Date: Wed May 3 14:53:57 2017 New Revision: 74460 URL:
http://svn.reactos.org/svn/reactos?rev=74460&view=rev
Log: [FREELDR] Set BootPartition (DH) to 0xFF in isoboot.S when booting from CD. Then check for that 0xFF value in FreeLdr to unambiguously detect CD booting instead of using BIOS functions (which don't work reliably on broken BIOSes) or checking for an MBR (which doesn't work on hybrid ISOs). CORE-12692 Modified: trunk/reactos/boot/freeldr/bootsect/isoboot.S trunk/reactos/boot/freeldr/freeldr/arch/i386/pcdisk.c trunk/reactos/boot/freeldr/freeldr/disk/disk.c Modified: trunk/reactos/boot/freeldr/bootsect/isoboot.S URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/bootsect/isob…
============================================================================== --- trunk/reactos/boot/freeldr/bootsect/isoboot.S [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/bootsect/isoboot.S [iso-8859-1] Wed May 3 14:53:57 2017 @@ -310,10 +310,15 @@ mov cx, HEX(FFFF) call getfssec - // Fetch our stored drive number to DL and set the boot partition to 0 in DH. - mov dl, byte ptr ds:[DriveNumber] - mov dh, 0 - + // Pass two parameters to SETUPLDR: + // DL = BIOS Drive Number + // DH = Boot Partition (0 for HDD booting in hybrid mode, FFh for CD booting) + movzx dx, byte ptr ds:[DriveNumber] + cmp word ptr ds:[GetlinsecPtr], offset getlinsec_ebios + je .jump_to_setupldr + mov dh, HEX(FF) + +.jump_to_setupldr: // Transfer execution to the bootloader. ljmp16 0, FREELDR_BASE Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/pcdisk.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/i386/pcdisk.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/i386/pcdisk.c [iso-8859-1] Wed May 3 14:53:57 2017 @@ -575,69 +575,6 @@ } } - -static BOOLEAN -FallbackDiskIsCdRomDrive(UCHAR DriveNumber) -{ - MASTER_BOOT_RECORD MasterBootRecord; - - TRACE("FallbackDiskIsCdRomDrive(0x%x)\n", DriveNumber); - - /* CD-ROM drive numbers are always > 0x80 */ - if (DriveNumber <= 0x80) - return FALSE; - - /* - * We suppose that a CD-ROM does not have a MBR - * (not always true: example of the Hybrid USB-ISOs). - */ - return !DiskReadBootRecord(DriveNumber, 0, &MasterBootRecord); -} - -BOOLEAN DiskIsCdRomDrive(UCHAR DriveNumber) -{ - REGS RegsIn, RegsOut; - PI386_CDROM_SPEC_PACKET Packet = (PI386_CDROM_SPEC_PACKET)(BIOSCALLBUFFER); - - TRACE("DiskIsCdRomDrive(0x%x)\n", DriveNumber); - - /* CD-ROM drive numbers are always > 0x80 */ - if (DriveNumber <= 0x80) - return FALSE; - - /* Setup disk address packet */ - RtlZeroMemory(Packet, sizeof(*Packet)); - Packet->PacketSize = sizeof(*Packet); - - /* - * BIOS Int 13h, function 4B01h - Bootable CD-ROM - Get Disk Emulation Status - * AX = 4B01h - * DL = drive number - * DS:SI -> empty specification packet - * Return: - * CF clear if successful - * CF set on error - * AX = return codes - * DS:SI specification packet filled - */ - RegsIn.w.ax = 0x4B01; - RegsIn.b.dl = DriveNumber; - RegsIn.x.ds = BIOSCALLBUFSEGMENT; // DS:SI -> specification packet - RegsIn.w.si = BIOSCALLBUFOFFSET; - - Int386(0x13, &RegsIn, &RegsOut); - - // return (INT386_SUCCESS(RegsOut) && (Packet->DriveNumber == DriveNumber)); - /* - * If the simple test failed, try to use the fallback code, - * but we can be on *very* thin ice. - */ - if (!INT386_SUCCESS(RegsOut) || (Packet->DriveNumber != DriveNumber)) - return FallbackDiskIsCdRomDrive(DriveNumber); - else - return TRUE; -} - BOOLEAN PcDiskGetBootPath(OUT PCHAR BootPath, IN ULONG Size) { Modified: trunk/reactos/boot/freeldr/freeldr/disk/disk.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/disk/…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/disk/disk.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/disk/disk.c [iso-8859-1] Wed May 3 14:53:57 2017 @@ -100,10 +100,6 @@ return TRUE; } - -extern BOOLEAN -DiskIsCdRomDrive(UCHAR DriveNumber); - BOOLEAN DiskGetBootPath(OUT PCHAR BootPath, IN ULONG Size) { if (*FrldrBootPath) @@ -121,9 +117,9 @@ /* This is a floppy */ sprintf(FrldrBootPath, "multi(0)disk(0)fdisk(%u)", FrldrBootDrive); } - else if (DiskIsCdRomDrive(FrldrBootDrive)) + else if (FrldrBootPartition == 0xFF) { - /* This is a CD-ROM drive */ + /* Boot Partition 0xFF is the magic value that indicates booting from CD-ROM (see isoboot.S) */ sprintf(FrldrBootPath, "multi(0)disk(0)cdrom(%u)", FrldrBootDrive - 0x80); } else
7 years, 7 months
1
0
0
0
[tfaber] 74459: [0.4.5] - Update version to RC2.
by tfaber@svn.reactos.org
Author: tfaber Date: Wed May 3 11:23:37 2017 New Revision: 74459 URL:
http://svn.reactos.org/svn/reactos?rev=74459&view=rev
Log: [0.4.5] - Update version to RC2. Modified: branches/ros-branch-0_4_5/reactos/sdk/include/reactos/version.cmake Modified: branches/ros-branch-0_4_5/reactos/sdk/include/reactos/version.cmake URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_4_5/reactos/sdk/in…
============================================================================== --- branches/ros-branch-0_4_5/reactos/sdk/include/reactos/version.cmake [iso-8859-1] (original) +++ branches/ros-branch-0_4_5/reactos/sdk/include/reactos/version.cmake [iso-8859-1] Wed May 3 11:23:37 2017 @@ -25,7 +25,7 @@ set(KERNEL_VERSION_BUILD_TYPE "") # KERNEL_VERSION_RELEASE_TYPE is "RC1", "RC2" or "" (for the final one) -set(KERNEL_VERSION_RELEASE_TYPE "RC1") +set(KERNEL_VERSION_RELEASE_TYPE "RC2") set(KERNEL_VERSION "${KERNEL_VERSION_MAJOR}.${KERNEL_VERSION_MINOR}") if(KERNEL_VERSION_PATCH_LEVEL)
7 years, 7 months
1
0
0
0
[tfaber] 74458: [0.4.5] - Revert r73436 to avoid trouble with VirtualBox Guest Additions. CORE-13172 CORE-12700 CORE-12765
by tfaber@svn.reactos.org
Author: tfaber Date: Wed May 3 11:18:11 2017 New Revision: 74458 URL:
http://svn.reactos.org/svn/reactos?rev=74458&view=rev
Log: [0.4.5] - Revert r73436 to avoid trouble with VirtualBox Guest Additions. CORE-13172 CORE-12700 CORE-12765 Modified: branches/ros-branch-0_4_5/reactos/dll/win32/shell32/iconcache.cpp branches/ros-branch-0_4_5/reactos/dll/win32/shell32/shell32.cpp branches/ros-branch-0_4_5/reactos/dll/win32/shell32/wine/shellord.c Modified: branches/ros-branch-0_4_5/reactos/dll/win32/shell32/iconcache.cpp URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_4_5/reactos/dll/wi…
============================================================================== --- branches/ros-branch-0_4_5/reactos/dll/win32/shell32/iconcache.cpp [iso-8859-1] (original) +++ branches/ros-branch-0_4_5/reactos/dll/win32/shell32/iconcache.cpp [iso-8859-1] Wed May 3 11:18:11 2017 @@ -453,9 +453,6 @@ sice.dwSourceIndex = dwSourceIndex; sice.dwFlags = dwFlags; - if (!sic_hdpa) - SIC_Initialize(); - EnterCriticalSection(&SHELL32_SicCS); if (NULL != DPA_GetPtr (sic_hdpa, 0)) @@ -690,9 +687,6 @@ RegCloseKey(hKeyShellIcons); } - if (!sic_hdpa) - SIC_Initialize(); - return SIC_LoadIcon(iconPath, iconIdx, 0); } @@ -704,17 +698,13 @@ * */ BOOL WINAPI Shell_GetImageLists(HIMAGELIST * lpBigList, HIMAGELIST * lpSmallList) -{ - TRACE("(%p,%p)\n",lpBigList,lpSmallList); - - if (!sic_hdpa) - SIC_Initialize(); - +{ TRACE("(%p,%p)\n",lpBigList,lpSmallList); if (lpBigList) - *lpBigList = ShellBigIconList; - + { *lpBigList = ShellBigIconList; + } if (lpSmallList) - *lpSmallList = ShellSmallIconList; + { *lpSmallList = ShellSmallIconList; + } return TRUE; } @@ -744,9 +734,6 @@ int iShortcutDefaultIndex = INVALID_INDEX; TRACE("sf=%p pidl=%p %s\n", sh, pidl, bBigIcon?"Big":"Small"); - - if (!sic_hdpa) - SIC_Initialize(); if (SUCCEEDED (sh->GetUIObjectOf(0, 1, &pidl, IID_NULL_PPV_ARG(IExtractIconW, &ei)))) { Modified: branches/ros-branch-0_4_5/reactos/dll/win32/shell32/shell32.cpp URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_4_5/reactos/dll/wi…
============================================================================== --- branches/ros-branch-0_4_5/reactos/dll/win32/shell32/shell32.cpp [iso-8859-1] (original) +++ branches/ros-branch-0_4_5/reactos/dll/win32/shell32/shell32.cpp [iso-8859-1] Wed May 3 11:18:11 2017 @@ -346,6 +346,7 @@ InitCommonControlsEx(&InitCtrls); /* Bad idea, initialization in DllMain! */ + SIC_Initialize(); InitChangeNotifications(); } else if (dwReason == DLL_PROCESS_DETACH) Modified: branches/ros-branch-0_4_5/reactos/dll/win32/shell32/wine/shellord.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_4_5/reactos/dll/wi…
============================================================================== --- branches/ros-branch-0_4_5/reactos/dll/win32/shell32/wine/shellord.c [iso-8859-1] (original) +++ branches/ros-branch-0_4_5/reactos/dll/win32/shell32/wine/shellord.c [iso-8859-1] Wed May 3 11:18:11 2017 @@ -1292,8 +1292,8 @@ * */ BOOL WINAPI FileIconInit(BOOL bFullInit) -{ - return SIC_Initialize(); +{ FIXME("(%s)\n", bFullInit ? "true" : "false"); + return FALSE; } /*************************************************************************
7 years, 7 months
1
0
0
0
[gadamopoulos] 74457: [UXTHEME] -Use GdiDrawStream in UXTHEME_DrawImageGlyph and UXTHEME_DrawImageBackground.
by gadamopoulos@svn.reactos.org
Author: gadamopoulos Date: Wed May 3 11:13:23 2017 New Revision: 74457 URL:
http://svn.reactos.org/svn/reactos?rev=74457&view=rev
Log: [UXTHEME] -Use GdiDrawStream in UXTHEME_DrawImageGlyph and UXTHEME_DrawImageBackground. Modified: trunk/reactos/dll/win32/uxtheme/draw.c trunk/reactos/dll/win32/uxtheme/uxthemep.h Modified: trunk/reactos/dll/win32/uxtheme/draw.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/uxtheme/draw.c?r…
============================================================================== --- trunk/reactos/dll/win32/uxtheme/draw.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/uxtheme/draw.c [iso-8859-1] Wed May 3 11:13:23 2017 @@ -269,163 +269,6 @@ return S_OK; } -/*********************************************************************** - * UXTHEME_StretchBlt - * - * Pseudo TransparentBlt/StretchBlt - */ -static inline BOOL UXTHEME_StretchBlt(HDC hdcDst, int nXOriginDst, int nYOriginDst, int nWidthDst, int nHeightDst, - HDC hdcSrc, int nXOriginSrc, int nYOriginSrc, int nWidthSrc, int nHeightSrc, - INT transparent, COLORREF transcolor) -{ - static const BLENDFUNCTION blendFunc = - { - AC_SRC_OVER, /* BlendOp */ - 0, /* BlendFlag */ - 255, /* SourceConstantAlpha */ - AC_SRC_ALPHA /* AlphaFormat */ - }; - - BOOL ret = TRUE; - int old_stretch_mode; - POINT old_brush_org; - - old_stretch_mode = SetStretchBltMode(hdcDst, HALFTONE); - SetBrushOrgEx(hdcDst, nXOriginDst, nYOriginDst, &old_brush_org); - - if (transparent == ALPHABLEND_BINARY) { - /* Ensure we don't pass any negative values to TransparentBlt */ - ret = TransparentBlt(hdcDst, nXOriginDst, nYOriginDst, abs(nWidthDst), abs(nHeightDst), - hdcSrc, nXOriginSrc, nYOriginSrc, abs(nWidthSrc), abs(nHeightSrc), - transcolor); - } else if ((transparent == ALPHABLEND_NONE) || - !AlphaBlend(hdcDst, nXOriginDst, nYOriginDst, nWidthDst, nHeightDst, - hdcSrc, nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc, - blendFunc)) - { - ret = StretchBlt(hdcDst, nXOriginDst, nYOriginDst, nWidthDst, nHeightDst, - hdcSrc, nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc, - SRCCOPY); - } - - SetBrushOrgEx(hdcDst, old_brush_org.x, old_brush_org.y, NULL); - SetStretchBltMode(hdcDst, old_stretch_mode); - - return ret; -} - -/*********************************************************************** - * UXTHEME_Blt - * - * Simplify sending same width/height for both source and dest - */ -static inline BOOL UXTHEME_Blt(HDC hdcDest, int nXOriginDest, int nYOriginDest, int nWidthDest, int nHeightDest, - HDC hdcSrc, int nXOriginSrc, int nYOriginSrc, - INT transparent, COLORREF transcolor) -{ - return UXTHEME_StretchBlt(hdcDest, nXOriginDest, nYOriginDest, nWidthDest, nHeightDest, - hdcSrc, nXOriginSrc, nYOriginSrc, nWidthDest, nHeightDest, - transparent, transcolor); -} - -/*********************************************************************** - * UXTHEME_SizedBlt - * - * Stretches or tiles, depending on sizingtype. - */ -static inline BOOL UXTHEME_SizedBlt (HDC hdcDst, int nXOriginDst, int nYOriginDst, - int nWidthDst, int nHeightDst, - HDC hdcSrc, int nXOriginSrc, int nYOriginSrc, - int nWidthSrc, int nHeightSrc, - int sizingtype, - INT transparent, COLORREF transcolor) -{ - if (sizingtype == ST_TILE) - { - HDC hdcTemp; - BOOL result = FALSE; - - if (!nWidthSrc || !nHeightSrc) return TRUE; - - /* For destination width/height less than or equal to source - width/height, do not bother with memory bitmap optimization */ - if (nWidthSrc >= nWidthDst && nHeightSrc >= nHeightDst) - { - int bltWidth = min (nWidthDst, nWidthSrc); - int bltHeight = min (nHeightDst, nHeightSrc); - - return UXTHEME_Blt (hdcDst, nXOriginDst, nYOriginDst, bltWidth, bltHeight, - hdcSrc, nXOriginSrc, nYOriginSrc, - transparent, transcolor); - } - - /* Create a DC with a bitmap consisting of a tiling of the source - bitmap, with standard GDI functions. This is faster than an - iteration with UXTHEME_Blt(). */ - hdcTemp = CreateCompatibleDC(hdcSrc); - if (hdcTemp != 0) - { - HBITMAP bitmapTemp; - HBITMAP bitmapOrig; - int nWidthTemp, nHeightTemp; - int xOfs, xRemaining; - int yOfs, yRemaining; - int growSize; - - /* Calculate temp dimensions of integer multiples of source dimensions */ - nWidthTemp = ((nWidthDst + nWidthSrc - 1) / nWidthSrc) * nWidthSrc; - nHeightTemp = ((nHeightDst + nHeightSrc - 1) / nHeightSrc) * nHeightSrc; - bitmapTemp = CreateCompatibleBitmap(hdcSrc, nWidthTemp, nHeightTemp); - bitmapOrig = SelectObject(hdcTemp, bitmapTemp); - - /* Initial copy of bitmap */ - BitBlt(hdcTemp, 0, 0, nWidthSrc, nHeightSrc, hdcSrc, nXOriginSrc, nYOriginSrc, SRCCOPY); - - /* Extend bitmap in the X direction. Growth of width is exponential */ - xOfs = nWidthSrc; - xRemaining = nWidthTemp - nWidthSrc; - growSize = nWidthSrc; - while (xRemaining > 0) - { - growSize = min(growSize, xRemaining); - BitBlt(hdcTemp, xOfs, 0, growSize, nHeightSrc, hdcTemp, 0, 0, SRCCOPY); - xOfs += growSize; - xRemaining -= growSize; - growSize *= 2; - } - - /* Extend bitmap in the Y direction. Growth of height is exponential */ - yOfs = nHeightSrc; - yRemaining = nHeightTemp - nHeightSrc; - growSize = nHeightSrc; - while (yRemaining > 0) - { - growSize = min(growSize, yRemaining); - BitBlt(hdcTemp, 0, yOfs, nWidthTemp, growSize, hdcTemp, 0, 0, SRCCOPY); - yOfs += growSize; - yRemaining -= growSize; - growSize *= 2; - } - - /* Use temporary hdc for source */ - result = UXTHEME_Blt (hdcDst, nXOriginDst, nYOriginDst, nWidthDst, nHeightDst, - hdcTemp, 0, 0, - transparent, transcolor); - - SelectObject(hdcTemp, bitmapOrig); - DeleteObject(bitmapTemp); - } - DeleteDC(hdcTemp); - return result; - } - else - { - return UXTHEME_StretchBlt (hdcDst, nXOriginDst, nYOriginDst, nWidthDst, nHeightDst, - hdcSrc, nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc, - transparent, transcolor); - } -} - /* Get transparency parameters passed to UXTHEME_StretchBlt() - the parameters * depend on whether the image has full alpha or whether it is * color-transparent or just opaque. */ @@ -468,8 +311,6 @@ { HRESULT hr; HBITMAP bmpSrc = NULL; - HDC hdcSrc = NULL; - HGDIOBJ oldSrc = NULL; RECT rcSrc; INT transparent = 0; COLORREF transparentcolor; @@ -477,18 +318,13 @@ int halign = HA_CENTER; POINT dstSize; POINT srcSize; - POINT topleft; BOOL hasAlpha; + RECT rcDst; + GDI_DRAW_STREAM DrawStream; hr = UXTHEME_LoadImage(hTheme, hdc, iPartId, iStateId, pRect, TRUE, &bmpSrc, &rcSrc, &hasAlpha); if(FAILED(hr)) return hr; - hdcSrc = CreateCompatibleDC(hdc); - if(!hdcSrc) { - hr = HRESULT_FROM_WIN32(GetLastError()); - return hr; - } - oldSrc = SelectObject(hdcSrc, bmpSrc); dstSize.x = pRect->right-pRect->left; dstSize.y = pRect->bottom-pRect->top; @@ -500,22 +336,37 @@ GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_VALIGN, &valign); GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_HALIGN, &halign); - topleft.x = pRect->left; - topleft.y = pRect->top; - if(halign == HA_CENTER) topleft.x += (dstSize.x/2)-(srcSize.x/2); - else if(halign == HA_RIGHT) topleft.x += dstSize.x-srcSize.x; - if(valign == VA_CENTER) topleft.y += (dstSize.y/2)-(srcSize.y/2); - else if(valign == VA_BOTTOM) topleft.y += dstSize.y-srcSize.y; - - if(!UXTHEME_Blt(hdc, topleft.x, topleft.y, srcSize.x, srcSize.y, - hdcSrc, rcSrc.left, rcSrc.top, - transparent, transparentcolor)) { - hr = HRESULT_FROM_WIN32(GetLastError()); - } - - SelectObject(hdcSrc, oldSrc); - DeleteDC(hdcSrc); - return hr; + rcDst = *pRect; + if(halign == HA_CENTER) rcDst.left += (dstSize.x/2)-(srcSize.x/2); + else if(halign == HA_RIGHT) rcDst.left += dstSize.x-srcSize.x; + if(valign == VA_CENTER) rcDst.top += (dstSize.y/2)-(srcSize.y/2); + else if(valign == VA_BOTTOM) rcDst.top += dstSize.y-srcSize.y; + + rcDst.right = rcDst.left + srcSize.x; + rcDst.bottom = rcDst.top + srcSize.y; + + DrawStream.signature = 0x44727753; + DrawStream.reserved = 0; + DrawStream.unknown1 = 1; + DrawStream.unknown2 = 9; + DrawStream.hDC = hdc; + DrawStream.hImage = bmpSrc; + DrawStream.crTransparent = transparentcolor; + DrawStream.rcSrc = rcSrc; + DrawStream.rcDest = rcDst; + DrawStream.leftSizingMargin = 0; + DrawStream.rightSizingMargin = 0; + DrawStream.topSizingMargin = 0; + DrawStream.bottomSizingMargin = 0; + DrawStream.drawOption = DS_TRUESIZE; + + if (transparent == ALPHABLEND_FULL) + DrawStream.drawOption |= DS_TRANSPARENTALPHA; + else if (transparent == ALPHABLEND_BINARY) + DrawStream.drawOption |= DS_TRANSPARENTCLR; + + GdiDrawStream(hdc, sizeof(DrawStream), &DrawStream); + return HRESULT_FROM_WIN32(GetLastError()); } /*********************************************************************** @@ -655,40 +506,33 @@ const DTBGOPTS *pOptions) { HRESULT hr = S_OK; - HBITMAP bmpSrc, bmpSrcResized = NULL; - HGDIOBJ oldSrc; - HDC hdcSrc, hdcOrigSrc = NULL; + HBITMAP bmpSrc; RECT rcSrc; RECT rcDst; POINT dstSize; - POINT srcSize; POINT drawSize; int sizingtype = ST_STRETCH; INT transparent; COLORREF transparentcolor = 0; BOOL hasAlpha; - - hr = UXTHEME_LoadImage(hTheme, hdc, iPartId, iStateId, pRect, FALSE, - &bmpSrc, &rcSrc, &hasAlpha); - if(FAILED(hr)) return hr; - hdcSrc = CreateCompatibleDC(hdc); - if(!hdcSrc) { - hr = HRESULT_FROM_WIN32(GetLastError()); + MARGINS sm; + GDI_DRAW_STREAM DrawStream; + + hr = UXTHEME_LoadImage(hTheme, hdc, iPartId, iStateId, pRect, FALSE, &bmpSrc, &rcSrc, &hasAlpha); + if(FAILED(hr)) return hr; - } - oldSrc = SelectObject(hdcSrc, bmpSrc); + get_transparency (hTheme, iPartId, iStateId, hasAlpha, &transparent, &transparentcolor, FALSE); rcDst = *pRect; - - get_transparency (hTheme, iPartId, iStateId, hasAlpha, &transparent, - &transparentcolor, FALSE); - dstSize.x = rcDst.right-rcDst.left; dstSize.y = rcDst.bottom-rcDst.top; - srcSize.x = rcSrc.right-rcSrc.left; - srcSize.y = rcSrc.bottom-rcSrc.top; - + + GetThemeMargins(hTheme, hdc, iPartId, iStateId, TMT_SIZINGMARGINS, NULL, &sm); GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_SIZINGTYPE, &sizingtype); + + /*FIXME: Is this ever used? */ + /*GetThemeBool(hTheme, iPartId, iStateId, TMT_BORDERONLY, &borderonly);*/ + if(sizingtype == ST_TRUESIZE) { int valign = VA_CENTER, halign = HA_CENTER; @@ -706,161 +550,36 @@ rcDst.top = rcDst.bottom - drawSize.y; rcDst.right = rcDst.left + drawSize.x; rcDst.bottom = rcDst.top + drawSize.y; - if(!UXTHEME_StretchBlt(hdc, rcDst.left, rcDst.top, drawSize.x, drawSize.y, - hdcSrc, rcSrc.left, rcSrc.top, srcSize.x, srcSize.y, - transparent, transparentcolor)) - hr = HRESULT_FROM_WIN32(GetLastError()); - } - else { - HDC hdcDst = NULL; - MARGINS sm; - POINT org; - - dstSize.x = abs(dstSize.x); - dstSize.y = abs(dstSize.y); - - GetThemeMargins(hTheme, hdc, iPartId, iStateId, TMT_SIZINGMARGINS, NULL, &sm); - - /* Resize source image if destination smaller than margins */ -#ifndef __REACTOS__ - /* Revert Wine Commit 2b650fa as it breaks themed Explorer Toolbar Separators - FIXME: Revisit this when the bug is fixed. CORE-9636 and Wine Bug #38538 */ - if (sm.cyTopHeight + sm.cyBottomHeight > dstSize.y || sm.cxLeftWidth + sm.cxRightWidth > dstSize.x) { - if (sm.cyTopHeight + sm.cyBottomHeight > dstSize.y) { - sm.cyTopHeight = MulDiv(sm.cyTopHeight, dstSize.y, srcSize.y); - sm.cyBottomHeight = dstSize.y - sm.cyTopHeight; - srcSize.y = dstSize.y; - } - - if (sm.cxLeftWidth + sm.cxRightWidth > dstSize.x) { - sm.cxLeftWidth = MulDiv(sm.cxLeftWidth, dstSize.x, srcSize.x); - sm.cxRightWidth = dstSize.x - sm.cxLeftWidth; - srcSize.x = dstSize.x; - } - - hdcOrigSrc = hdcSrc; - hdcSrc = CreateCompatibleDC(NULL); - bmpSrcResized = CreateBitmap(srcSize.x, srcSize.y, 1, 32, NULL); - SelectObject(hdcSrc, bmpSrcResized); - - UXTHEME_StretchBlt(hdcSrc, 0, 0, srcSize.x, srcSize.y, hdcOrigSrc, rcSrc.left, rcSrc.top, - rcSrc.right - rcSrc.left, rcSrc.bottom - rcSrc.top, transparent, transparentcolor); - - rcSrc.left = 0; - rcSrc.top = 0; - rcSrc.right = srcSize.x; - rcSrc.bottom = srcSize.y; - } -#endif /* __REACTOS__ */ - - hdcDst = hdc; - OffsetViewportOrgEx(hdcDst, rcDst.left, rcDst.top, &org); - - /* Upper left corner */ - if(!UXTHEME_Blt(hdcDst, 0, 0, sm.cxLeftWidth, sm.cyTopHeight, - hdcSrc, rcSrc.left, rcSrc.top, - transparent, transparentcolor)) { - hr = HRESULT_FROM_WIN32(GetLastError()); - goto draw_error; - } - /* Upper right corner */ - if(!UXTHEME_Blt (hdcDst, dstSize.x-sm.cxRightWidth, 0, - sm.cxRightWidth, sm.cyTopHeight, - hdcSrc, rcSrc.right-sm.cxRightWidth, rcSrc.top, - transparent, transparentcolor)) { - hr = HRESULT_FROM_WIN32(GetLastError()); - goto draw_error; - } - /* Lower left corner */ - if(!UXTHEME_Blt (hdcDst, 0, dstSize.y-sm.cyBottomHeight, - sm.cxLeftWidth, sm.cyBottomHeight, - hdcSrc, rcSrc.left, rcSrc.bottom-sm.cyBottomHeight, - transparent, transparentcolor)) { - hr = HRESULT_FROM_WIN32(GetLastError()); - goto draw_error; - } - /* Lower right corner */ - if(!UXTHEME_Blt (hdcDst, dstSize.x-sm.cxRightWidth, dstSize.y-sm.cyBottomHeight, - sm.cxRightWidth, sm.cyBottomHeight, - hdcSrc, rcSrc.right-sm.cxRightWidth, rcSrc.bottom-sm.cyBottomHeight, - transparent, transparentcolor)) { - hr = HRESULT_FROM_WIN32(GetLastError()); - goto draw_error; - } - - if ((sizingtype == ST_STRETCH) || (sizingtype == ST_TILE)) { - int destCenterWidth = dstSize.x - (sm.cxLeftWidth + sm.cxRightWidth); - int srcCenterWidth = srcSize.x - (sm.cxLeftWidth + sm.cxRightWidth); - int destCenterHeight = dstSize.y - (sm.cyTopHeight + sm.cyBottomHeight); - int srcCenterHeight = srcSize.y - (sm.cyTopHeight + sm.cyBottomHeight); - - if(destCenterWidth > 0) { - /* Center top */ - if(!UXTHEME_SizedBlt (hdcDst, sm.cxLeftWidth, 0, - destCenterWidth, sm.cyTopHeight, - hdcSrc, rcSrc.left+sm.cxLeftWidth, rcSrc.top, - srcCenterWidth, sm.cyTopHeight, - sizingtype, transparent, transparentcolor)) { - hr = HRESULT_FROM_WIN32(GetLastError()); - goto draw_error; - } - /* Center bottom */ - if(!UXTHEME_SizedBlt (hdcDst, sm.cxLeftWidth, dstSize.y-sm.cyBottomHeight, - destCenterWidth, sm.cyBottomHeight, - hdcSrc, rcSrc.left+sm.cxLeftWidth, rcSrc.bottom-sm.cyBottomHeight, - srcCenterWidth, sm.cyBottomHeight, - sizingtype, transparent, transparentcolor)) { - hr = HRESULT_FROM_WIN32(GetLastError()); - goto draw_error; - } - } - if(destCenterHeight > 0) { - /* Left center */ - if(!UXTHEME_SizedBlt (hdcDst, 0, sm.cyTopHeight, - sm.cxLeftWidth, destCenterHeight, - hdcSrc, rcSrc.left, rcSrc.top+sm.cyTopHeight, - sm.cxLeftWidth, srcCenterHeight, - sizingtype, - transparent, transparentcolor)) { - hr = HRESULT_FROM_WIN32(GetLastError()); - goto draw_error; - } - /* Right center */ - if(!UXTHEME_SizedBlt (hdcDst, dstSize.x-sm.cxRightWidth, sm.cyTopHeight, - sm.cxRightWidth, destCenterHeight, - hdcSrc, rcSrc.right-sm.cxRightWidth, rcSrc.top+sm.cyTopHeight, - sm.cxRightWidth, srcCenterHeight, - sizingtype, transparent, transparentcolor)) { - hr = HRESULT_FROM_WIN32(GetLastError()); - goto draw_error; - } - } - if(destCenterHeight > 0 && destCenterWidth > 0) { - BOOL borderonly = FALSE; - GetThemeBool(hTheme, iPartId, iStateId, TMT_BORDERONLY, &borderonly); - if(!borderonly) { - /* Center */ - if(!UXTHEME_SizedBlt (hdcDst, sm.cxLeftWidth, sm.cyTopHeight, - destCenterWidth, destCenterHeight, - hdcSrc, rcSrc.left+sm.cxLeftWidth, rcSrc.top+sm.cyTopHeight, - srcCenterWidth, srcCenterHeight, - sizingtype, transparent, transparentcolor)) { - hr = HRESULT_FROM_WIN32(GetLastError()); - goto draw_error; - } - } - } - } - -draw_error: - SetViewportOrgEx (hdcDst, org.x, org.y, NULL); - } - SelectObject(hdcSrc, oldSrc); - DeleteDC(hdcSrc); - if (bmpSrcResized) DeleteObject(bmpSrcResized); - if (hdcOrigSrc) DeleteDC(hdcOrigSrc); - *pRect = rcDst; - return hr; + *pRect = rcDst; + } + + DrawStream.signature = 0x44727753; + DrawStream.reserved = 0; + DrawStream.unknown1 = 1; + DrawStream.unknown2 = 9; + DrawStream.hDC = hdc; + DrawStream.hImage = bmpSrc; + DrawStream.crTransparent = transparentcolor; + DrawStream.rcSrc = rcSrc; + DrawStream.rcDest = rcDst; + DrawStream.leftSizingMargin = sm.cxLeftWidth; + DrawStream.rightSizingMargin = sm.cxRightWidth; + DrawStream.topSizingMargin = sm.cyTopHeight; + DrawStream.bottomSizingMargin = sm.cyBottomHeight; + DrawStream.drawOption = 0; + + if (transparent == ALPHABLEND_FULL) + DrawStream.drawOption |= DS_TRANSPARENTALPHA; + else if (transparent == ALPHABLEND_BINARY) + DrawStream.drawOption |= DS_TRANSPARENTCLR; + + if (sizingtype == ST_TILE) + DrawStream.drawOption |= DS_TILE; + else if (sizingtype == ST_TRUESIZE) + DrawStream.drawOption |= DS_TRUESIZE; + + GdiDrawStream(hdc, sizeof(DrawStream), &DrawStream); + return HRESULT_FROM_WIN32(GetLastError()); } /*********************************************************************** @@ -1050,7 +769,9 @@ /* This should never happen, and hence I don't know what to return */ hr = E_FAIL; } +#if 0 if(SUCCEEDED(hr)) +#endif { RECT rcGlyph = *pRect; MARGINS margin; Modified: trunk/reactos/dll/win32/uxtheme/uxthemep.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/uxtheme/uxthemep…
============================================================================== --- trunk/reactos/dll/win32/uxtheme/uxthemep.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/uxtheme/uxthemep.h [iso-8859-1] Wed May 3 11:13:23 2017 @@ -14,6 +14,7 @@ #include <winnls.h> #include <windowsx.h> #include <undocuser.h> +#include <undocgdi.h> #include <uxtheme.h> #include <uxundoc.h> #include <vfwmsgs.h>
7 years, 7 months
1
0
0
0
[tfaber] 74456: [0.4.5] - Merge Giannis's imagelist leak fix from r74440/r74443.
by tfaber@svn.reactos.org
Author: tfaber Date: Wed May 3 11:12:04 2017 New Revision: 74456 URL:
http://svn.reactos.org/svn/reactos?rev=74456&view=rev
Log: [0.4.5] - Merge Giannis's imagelist leak fix from r74440/r74443. Modified: branches/ros-branch-0_4_5/ (props changed) branches/ros-branch-0_4_5/reactos/ (props changed) branches/ros-branch-0_4_5/reactos/dll/win32/comctl32/imagelist.c Propchange: branches/ros-branch-0_4_5/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Wed May 3 11:12:04 2017 @@ -1,2 +1,2 @@ /branches/colins-printing-for-freedom:67543-68405,68407-68414,68417-70595 -/trunk:74437-74438,74441 +/trunk:74437-74438,74440-74441,74443 Propchange: branches/ros-branch-0_4_5/reactos/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Wed May 3 11:12:04 2017 @@ -23,4 +23,4 @@ /branches/usb-bringup:51335,51337,51341-51343,51348,51350,51353,51355,51365-51369,51372,51384-54388,54396-54398,54736-54737,54752-54754,54756-54760,54762,54764-54765,54767-54768,54772,54774-54777,54781,54787,54790-54792,54797-54798,54806,54808,54834-54838,54843,54850,54852,54856,54858-54859 /branches/usb-bringup-trunk:55019-55543,55548-55554,55556-55567 /branches/wlan-bringup:54809-54998 -/trunk/reactos:74437-74438,74441 +/trunk/reactos:74437-74438,74440-74441,74443 Modified: branches/ros-branch-0_4_5/reactos/dll/win32/comctl32/imagelist.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_4_5/reactos/dll/wi…
============================================================================== --- branches/ros-branch-0_4_5/reactos/dll/win32/comctl32/imagelist.c [iso-8859-1] (original) +++ branches/ros-branch-0_4_5/reactos/dll/win32/comctl32/imagelist.c [iso-8859-1] Wed May 3 11:12:04 2017 @@ -1444,6 +1444,9 @@ HBRUSH hOldBrush; POINT pt; BOOL has_alpha; +#ifdef __REACTOS__ + HDC hdcSaturated = NULL; +#endif if (!pimldp || !(himl = pimldp->himl)) return FALSE; if (!is_valid(himl)) return FALSE; @@ -1500,9 +1503,10 @@ */ if (fState & ILS_SATURATE) { - hImageListDC = saturate_image(himl, pimldp->hdcDst, pimldp->x, pimldp->y, + hdcSaturated = saturate_image(himl, pimldp->hdcDst, pimldp->x, pimldp->y, pt.x, pt.y, cx, cy, pimldp->rgbFg); + hImageListDC = hdcSaturated; /* shitty way of getting subroutines to blit at the right place (top left corner), as our modified imagelist only contains a single image for performance reasons */ pt.x = 0; @@ -1672,6 +1676,10 @@ SetTextColor(hImageDC, oldImageFg); SelectObject(hImageDC, hOldImageBmp); cleanup: +#ifdef __REACTOS__ + if (hdcSaturated) + DeleteDC(hdcSaturated); +#endif DeleteObject(hBlendMaskBmp); DeleteObject(hImageBmp); DeleteDC(hImageDC);
7 years, 7 months
1
0
0
0
[tfaber] 74455: [0.4.5] - Merge Giannis's rebar leak fix from r74438.
by tfaber@svn.reactos.org
Author: tfaber Date: Wed May 3 11:10:26 2017 New Revision: 74455 URL:
http://svn.reactos.org/svn/reactos?rev=74455&view=rev
Log: [0.4.5] - Merge Giannis's rebar leak fix from r74438. Modified: branches/ros-branch-0_4_5/ (props changed) branches/ros-branch-0_4_5/reactos/ (props changed) branches/ros-branch-0_4_5/reactos/dll/win32/comctl32/rebar.c Propchange: branches/ros-branch-0_4_5/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Wed May 3 11:10:26 2017 @@ -1,2 +1,2 @@ /branches/colins-printing-for-freedom:67543-68405,68407-68414,68417-70595 -/trunk:74437,74441 +/trunk:74437-74438,74441 Propchange: branches/ros-branch-0_4_5/reactos/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Wed May 3 11:10:26 2017 @@ -23,4 +23,4 @@ /branches/usb-bringup:51335,51337,51341-51343,51348,51350,51353,51355,51365-51369,51372,51384-54388,54396-54398,54736-54737,54752-54754,54756-54760,54762,54764-54765,54767-54768,54772,54774-54777,54781,54787,54790-54792,54797-54798,54806,54808,54834-54838,54843,54850,54852,54856,54858-54859 /branches/usb-bringup-trunk:55019-55543,55548-55554,55556-55567 /branches/wlan-bringup:54809-54998 -/trunk/reactos:74437,74441 +/trunk/reactos:74437-74438,74441 Modified: branches/ros-branch-0_4_5/reactos/dll/win32/comctl32/rebar.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_4_5/reactos/dll/wi…
============================================================================== --- branches/ros-branch-0_4_5/reactos/dll/win32/comctl32/rebar.c [iso-8859-1] (original) +++ branches/ros-branch-0_4_5/reactos/dll/win32/comctl32/rebar.c [iso-8859-1] Wed May 3 11:10:26 2017 @@ -1974,8 +1974,8 @@ HBRUSH hbrush = CreateSolidBrush(new); FillRgn(hdc, hrgn, hbrush); DeleteObject(hbrush); - DeleteObject(hrgn); - } + } + DeleteObject(hrgn); #endif return TRUE; }
7 years, 7 months
1
0
0
0
← Newer
1
...
24
25
26
27
28
29
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Results per page:
10
25
50
100
200