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
March 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
14 participants
251 discussions
Start a n
N
ew thread
[mjansen] 74187: [APPLICATIONS/SYSUTILS] Add a font substitutes editor. Patch by Katayama Hirofumi MZ. CORE-12749 #resolve #comment Thanks!
by mjansen@svn.reactos.org
Author: mjansen Date: Sat Mar 18 13:01:18 2017 New Revision: 74187 URL:
http://svn.reactos.org/svn/reactos?rev=74187&view=rev
Log: [APPLICATIONS/SYSUTILS] Add a font substitutes editor. Patch by Katayama Hirofumi MZ. CORE-12749 #resolve #comment Thanks! Added: trunk/rosapps/applications/sysutils/fontsub/ trunk/rosapps/applications/sysutils/fontsub/CMakeLists.txt (with props) trunk/rosapps/applications/sysutils/fontsub/License.txt (with props) trunk/rosapps/applications/sysutils/fontsub/down.bmp (with props) trunk/rosapps/applications/sysutils/fontsub/fontsub.cpp (with props) trunk/rosapps/applications/sysutils/fontsub/fontsub.ico (with props) trunk/rosapps/applications/sysutils/fontsub/fontsub.svg trunk/rosapps/applications/sysutils/fontsub/fontsub_res.rc (with props) trunk/rosapps/applications/sysutils/fontsub/lang/ trunk/rosapps/applications/sysutils/fontsub/lang/en-US.rc (with props) trunk/rosapps/applications/sysutils/fontsub/lang/ja-JP.rc (with props) trunk/rosapps/applications/sysutils/fontsub/nil.bmp (with props) trunk/rosapps/applications/sysutils/fontsub/resource.h (with props) trunk/rosapps/applications/sysutils/fontsub/up.bmp (with props) Modified: trunk/rosapps/applications/sysutils/CMakeLists.txt Modified: trunk/rosapps/applications/sysutils/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/sysutils/CMak…
============================================================================== --- trunk/rosapps/applications/sysutils/CMakeLists.txt [iso-8859-1] (original) +++ trunk/rosapps/applications/sysutils/CMakeLists.txt [iso-8859-1] Sat Mar 18 13:01:18 2017 @@ -1,5 +1,6 @@ add_subdirectory(chklib) add_subdirectory(ctm) +add_subdirectory(fontsub) add_subdirectory(gettype) add_subdirectory(kill) add_subdirectory(logevent) Added: trunk/rosapps/applications/sysutils/fontsub/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/sysutils/font…
============================================================================== --- trunk/rosapps/applications/sysutils/fontsub/CMakeLists.txt (added) +++ trunk/rosapps/applications/sysutils/fontsub/CMakeLists.txt [iso-8859-1] Sat Mar 18 13:01:18 2017 @@ -0,0 +1,16 @@ +# FontSub by Katayama Hirofumi MZ +# +# To the extent possible under law, the person who associated CC0 with +# FontSub has waived all copyright and related or neighboring rights +# to FontSub. +# +# You should have received a copy of the CC0 legalcode along with this +# work. If not, see <
http://creativecommons.org/publicdomain/zero/1.0/
>. + +set_cpp(WITH_RUNTIME WITH_STL WITH_EXCEPTIONS) + +add_executable(fontsubedit fontsub.cpp fontsub_res.rc) +set_module_type(fontsubedit win32gui UNICODE) +add_importlibs(fontsubedit advapi32 comctl32 comdlg32 shell32 gdi32 user32 msvcrt kernel32) +set_target_properties(fontsubedit PROPERTIES OUTPUT_NAME "fontsub") +add_cd_file(TARGET fontsubedit DESTINATION reactos/system32 FOR all) Propchange: trunk/rosapps/applications/sysutils/fontsub/CMakeLists.txt ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/rosapps/applications/sysutils/fontsub/License.txt URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/sysutils/font…
============================================================================== --- trunk/rosapps/applications/sysutils/fontsub/License.txt (added) +++ trunk/rosapps/applications/sysutils/fontsub/License.txt [iso-8859-1] Sat Mar 18 13:01:18 2017 @@ -0,0 +1,122 @@ +Creative Commons Legal Code + +CC0 1.0 Universal + + CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE + LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN + ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS + INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES + REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS + PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM + THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED + HEREUNDER. + +Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer +exclusive Copyright and Related Rights (defined below) upon the creator +and subsequent owner(s) (each and all, an "owner") of an original work of +authorship and/or a database (each, a "Work"). + +Certain owners wish to permanently relinquish those rights to a Work for +the purpose of contributing to a commons of creative, cultural and +scientific works ("Commons") that the public can reliably and without fear +of later claims of infringement build upon, modify, incorporate in other +works, reuse and redistribute as freely as possible in any form whatsoever +and for any purposes, including without limitation commercial purposes. +These owners may contribute to the Commons to promote the ideal of a free +culture and the further production of creative, cultural and scientific +works, or to gain reputation or greater distribution for their Work in +part through the use and efforts of others. + +For these and/or other purposes and motivations, and without any +expectation of additional consideration or compensation, the person +associating CC0 with a Work (the "Affirmer"), to the extent that he or she +is an owner of Copyright and Related Rights in the Work, voluntarily +elects to apply CC0 to the Work and publicly distribute the Work under its +terms, with knowledge of his or her Copyright and Related Rights in the +Work and the meaning and intended legal effect of CC0 on those rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be +protected by copyright and related or neighboring rights ("Copyright and +Related Rights"). Copyright and Related Rights include, but are not +limited to, the following: + + i. the right to reproduce, adapt, distribute, perform, display, + communicate, and translate a Work; + ii. moral rights retained by the original author(s) and/or performer(s); +iii. publicity and privacy rights pertaining to a person's image or + likeness depicted in a Work; + iv. rights protecting against unfair competition in regards to a Work, + subject to the limitations in paragraph 4(a), below; + v. rights protecting the extraction, dissemination, use and reuse of data + in a Work; + vi. database rights (such as those arising under Directive 96/9/EC of the + European Parliament and of the Council of 11 March 1996 on the legal + protection of databases, and under any national implementation + thereof, including any amended or successor version of such + directive); and +vii. other similar, equivalent or corresponding rights throughout the + world based on applicable law or treaty, and any national + implementations thereof. + +2. Waiver. To the greatest extent permitted by, but not in contravention +of, applicable law, Affirmer hereby overtly, fully, permanently, +irrevocably and unconditionally waives, abandons, and surrenders all of +Affirmer's Copyright and Related Rights and associated claims and causes +of action, whether now known or unknown (including existing as well as +future claims and causes of action), in the Work (i) in all territories +worldwide, (ii) for the maximum duration provided by applicable law or +treaty (including future time extensions), (iii) in any current or future +medium and for any number of copies, and (iv) for any purpose whatsoever, +including without limitation commercial, advertising or promotional +purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each +member of the public at large and to the detriment of Affirmer's heirs and +successors, fully intending that such Waiver shall not be subject to +revocation, rescission, cancellation, termination, or any other legal or +equitable action to disrupt the quiet enjoyment of the Work by the public +as contemplated by Affirmer's express Statement of Purpose. + +3. Public License Fallback. Should any part of the Waiver for any reason +be judged legally invalid or ineffective under applicable law, then the +Waiver shall be preserved to the maximum extent permitted taking into +account Affirmer's express Statement of Purpose. In addition, to the +extent the Waiver is so judged Affirmer hereby grants to each affected +person a royalty-free, non transferable, non sublicensable, non exclusive, +irrevocable and unconditional license to exercise Affirmer's Copyright and +Related Rights in the Work (i) in all territories worldwide, (ii) for the +maximum duration provided by applicable law or treaty (including future +time extensions), (iii) in any current or future medium and for any number +of copies, and (iv) for any purpose whatsoever, including without +limitation commercial, advertising or promotional purposes (the +"License"). The License shall be deemed effective as of the date CC0 was +applied by Affirmer to the Work. Should any part of the License for any +reason be judged legally invalid or ineffective under applicable law, such +partial invalidity or ineffectiveness shall not invalidate the remainder +of the License, and in such case Affirmer hereby affirms that he or she +will not (i) exercise any of his or her remaining Copyright and Related +Rights in the Work or (ii) assert any associated claims and causes of +action with respect to the Work, in either case contrary to Affirmer's +express Statement of Purpose. + +4. Limitations and Disclaimers. + + a. No trademark or patent rights held by Affirmer are waived, abandoned, + surrendered, licensed or otherwise affected by this document. + b. Affirmer offers the Work as-is and makes no representations or + warranties of any kind concerning the Work, express, implied, + statutory or otherwise, including without limitation warranties of + title, merchantability, fitness for a particular purpose, non + infringement, or the absence of latent or other defects, accuracy, or + the present or absence of errors, whether or not discoverable, all to + the greatest extent permissible under applicable law. + c. Affirmer disclaims responsibility for clearing rights of other persons + that may apply to the Work or any use thereof, including without + limitation any person's Copyright and Related Rights in the Work. + Further, Affirmer disclaims responsibility for obtaining any necessary + consents, permissions or other rights required for any use of the + Work. + d. Affirmer understands and acknowledges that Creative Commons is not a + party to this document and has no duty or obligation with respect to + this CC0 or use of the Work. + Propchange: trunk/rosapps/applications/sysutils/fontsub/License.txt ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/rosapps/applications/sysutils/fontsub/down.bmp URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/sysutils/font…
============================================================================== Binary file - no diff available. Propchange: trunk/rosapps/applications/sysutils/fontsub/down.bmp ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: trunk/rosapps/applications/sysutils/fontsub/fontsub.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/sysutils/font…
============================================================================== --- trunk/rosapps/applications/sysutils/fontsub/fontsub.cpp (added) +++ trunk/rosapps/applications/sysutils/fontsub/fontsub.cpp [iso-8859-1] Sat Mar 18 13:01:18 2017 @@ -0,0 +1,1603 @@ +// FontSub by Katayama Hirofumi MZ +// +// To the extent possible under law, the person who associated CC0 with +// FontSub has waived all copyright and related or neighboring rights +// to FontSub. +// +// You should have received a copy of the CC0 legalcode along with this +// work. If not, see <
http://creativecommons.org/publicdomain/zero/1.0/
>. + + +#include <windows.h> +#include <windowsx.h> +#include <commctrl.h> +#include <tchar.h> +#include <vector> // for std::vector +#include <set> // for std::set +#include <string> // for std::basic_string +#include <algorithm> // for std::sort +#include <cstdio> +#include <cstring> +#include <cassert> +#include "resource.h" + + +#define NAME_COLUMN_WIDTH 250 +#define SUB_COLUMN_WIDTH 250 +#define MAX_STRING 120 + +#ifndef _countof + #define _countof(array) (sizeof(array) / sizeof(array[0])) +#endif + +typedef std::wstring STRING; + +struct ITEM +{ + STRING m_Name, m_Substitute; + BYTE m_CharSet1, m_CharSet2; + ITEM(const STRING& Name, const STRING& Substitute, + BYTE CharSet1, BYTE CharSet2) + : m_Name(Name), m_Substitute(Substitute), + m_CharSet1(CharSet1), m_CharSet2(CharSet2) { } +}; + +/* global variables */ +HINSTANCE g_hInstance = NULL; +HWND g_hMainWnd = NULL; +HICON g_hIcon = NULL; +HWND g_hListView = NULL; +BOOL g_bModified = FALSE; +BOOL g_bNeedsReboot = FALSE; +INT g_iItem = 0; + +LPCWSTR g_pszClassName = L"ReactOS Font Substitutes Editor"; +LPCWSTR g_pszFileHeader = L"Windows Registry Editor Version 5.00"; + +WCHAR g_szTitle[MAX_STRING]; +WCHAR g_szNameHead[MAX_STRING]; +WCHAR g_szSubstituteHead[MAX_STRING]; + +INT g_iSortColumn = 0; +BOOL g_bSortAscendant = TRUE; + +LPCWSTR g_pszKey = + L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\FontSubstitutes"; + +typedef std::set<STRING> FONTNAMESET; +typedef std::vector<ITEM> ITEMVECTOR; + +FONTNAMESET g_Names; +ITEMVECTOR g_Items; +STRING g_strFontName; +STRING g_strSubstitute; +BYTE g_CharSet1 = DEFAULT_CHARSET; +BYTE g_CharSet2 = DEFAULT_CHARSET; + +typedef struct CHARSET_ENTRY +{ + BYTE CharSet; + LPCWSTR DisplayName; +} CHARSET_ENTRY; + +CHARSET_ENTRY g_CharSetList[] = +{ + { DEFAULT_CHARSET, L"DEFAULT_CHARSET (1)" }, + { ANSI_CHARSET, L"ANSI_CHARSET (0)" }, + { SYMBOL_CHARSET, L"SYMBOL_CHARSET (2)" }, + { SHIFTJIS_CHARSET, L"SHIFTJIS_CHARSET (128)" }, + { HANGUL_CHARSET, L"HANGUL_CHARSET (129)" }, + { GB2312_CHARSET, L"GB2312_CHARSET (134)" }, + { CHINESEBIG5_CHARSET, L"CHINESEBIG5_CHARSET (136)" }, + { OEM_CHARSET, L"OEM_CHARSET (255)" }, + { JOHAB_CHARSET, L"JOHAB_CHARSET (130)" }, + { HEBREW_CHARSET, L"HEBREW_CHARSET (177)" }, + { ARABIC_CHARSET, L"ARABIC_CHARSET (178)" }, + { GREEK_CHARSET, L"GREEK_CHARSET (161)" }, + { TURKISH_CHARSET, L"TURKISH_CHARSET (162)" }, + { VIETNAMESE_CHARSET, L"VIETNAMESE_CHARSET (163)" }, + { THAI_CHARSET, L"THAI_CHARSET (222)" }, + { EASTEUROPE_CHARSET, L"EASTEUROPE_CHARSET (238)" }, + { RUSSIAN_CHARSET, L"RUSSIAN_CHARSET (204)" }, + { MAC_CHARSET, L"MAC_CHARSET (77)" }, + { BALTIC_CHARSET, L"BALTIC_CHARSET (186)" } +}; +const WCHAR g_LongestName[] = L"CHINESEBIG5_CHARSET (136)"; + +static void trim(STRING& str) +{ + static const WCHAR Spaces[] = L" \t\r\n"; + size_t i = str.find_first_not_of(Spaces); + size_t j = str.find_last_not_of(Spaces); + if (i == STRING::npos || j == STRING::npos) + { + str.clear(); + } + else + { + str = str.substr(i, j - i + 1); + } +} + +static int CALLBACK +EnumFontFamExProc(const ENUMLOGFONTW *pelf, + const NEWTEXTMETRICW *pntm, + int FontType, + LPARAM lParam) +{ + switch (pelf->elfFullName[0]) + { + case UNICODE_NULL: case L'@': + break; + default: + g_Names.insert((const WCHAR *)pelf->elfFullName); + } + switch (pelf->elfLogFont.lfFaceName[0]) + { + case UNICODE_NULL: case L'@': + break; + default: + g_Names.insert(pelf->elfLogFont.lfFaceName); + } + return 1; +} + +BOOL DoLoadNames(void) +{ + g_Names.clear(); + + LOGFONTW lf; + ZeroMemory(&lf, sizeof(lf)); + lf.lfCharSet = DEFAULT_CHARSET; + + HDC hDC = CreateCompatibleDC(NULL); + EnumFontFamiliesExW(hDC, &lf, (FONTENUMPROCW)EnumFontFamExProc, 0, 0); + DeleteDC(hDC); + + return !g_Names.empty(); +} + +inline bool ItemCompareByNameAscend(const ITEM& Item1, const ITEM& Item2) +{ + return Item1.m_Name < Item2.m_Name; +} + +inline bool ItemCompareByNameDescend(const ITEM& Item1, const ITEM& Item2) +{ + return Item1.m_Name > Item2.m_Name; +} + +inline bool ItemCompareBySubAscend(const ITEM& Item1, const ITEM& Item2) +{ + return Item1.m_Substitute < Item2.m_Substitute; +} + +inline bool ItemCompareBySubDescend(const ITEM& Item1, const ITEM& Item2) +{ + return Item1.m_Substitute > Item2.m_Substitute; +} + +void DoSort(INT iColumn, BOOL bAscendant = TRUE) +{ + LV_COLUMN Column; + ZeroMemory(&Column, sizeof(Column)); + Column.mask = LVCF_IMAGE | LVCF_SUBITEM; + Column.iImage = 2; + Column.iSubItem = 0; + ListView_SetColumn(g_hListView, 0, &Column); + Column.iSubItem = 1; + ListView_SetColumn(g_hListView, 1, &Column); + + switch (iColumn) + { + case 0: + Column.iSubItem = 0; + if (bAscendant) + { + std::sort(g_Items.begin(), g_Items.end(), + ItemCompareByNameAscend); + Column.iImage = 0; + ListView_SetColumn(g_hListView, 0, &Column); + } + else + { + std::sort(g_Items.begin(), g_Items.end(), + ItemCompareByNameDescend); + Column.iImage = 1; + ListView_SetColumn(g_hListView, 0, &Column); + } + break; + case 1: + Column.iSubItem = 1; + if (bAscendant) + { + std::sort(g_Items.begin(), g_Items.end(), + ItemCompareBySubAscend); + Column.iImage = 0; + ListView_SetColumn(g_hListView, 1, &Column); + } + else + { + std::sort(g_Items.begin(), g_Items.end(), + ItemCompareBySubDescend); + Column.iImage = 1; + ListView_SetColumn(g_hListView, 1, &Column); + } + break; + } + g_iSortColumn = iColumn; + g_bSortAscendant = bAscendant; + InvalidateRect(g_hListView, NULL, TRUE); +} + +void LV_AddItems(HWND hwnd) +{ + ListView_DeleteAllItems(hwnd); + + LV_ITEM Item; + ZeroMemory(&Item, sizeof(Item)); + Item.mask = LVIF_PARAM; + + const INT Count = INT(g_Items.size()); + for (INT i = 0; i < Count; ++i) + { + Item.iItem = i; + Item.iSubItem = 0; + Item.lParam = i; + ListView_InsertItem(hwnd, &Item); + + Item.iItem = i; + Item.iSubItem = 1; + Item.lParam = i; + ListView_InsertItem(hwnd, &Item); + } +} + +BOOL DoLoadItems(void) +{ + ITEMVECTOR Items; + + HKEY hKey = NULL; + RegOpenKeyExW(HKEY_LOCAL_MACHINE, g_pszKey, 0, KEY_READ, &hKey); + if (hKey == NULL) + return FALSE; + + WCHAR szName[MAX_STRING], szValue[MAX_STRING]; + DWORD cbName, cbValue; + for (DWORD dwIndex = 0; ; ++dwIndex) + { + cbName = sizeof(szName); + cbValue = sizeof(szValue); + LONG Error = RegEnumValueW(hKey, dwIndex, szName, &cbName, + NULL, NULL, (LPBYTE)szValue, &cbValue); + if (Error != ERROR_SUCCESS) + break; + + BYTE CharSet1 = DEFAULT_CHARSET, CharSet2 = DEFAULT_CHARSET; + LPWSTR pch; + + pch = wcsrchr(szName, L','); + if (pch) + { + *pch = 0; + CharSet1 = (BYTE)_wtoi(pch + 1); + } + + pch = wcsrchr(szValue, L','); + if (pch) + { + *pch = 0; + CharSet2 = (BYTE)_wtoi(pch + 1); + } + + ITEM Item(szName, szValue, CharSet1, CharSet2); + trim(Item.m_Name); + trim(Item.m_Substitute); + Items.push_back(Item); + } + + RegCloseKey(hKey); + + g_Items = Items; + LV_AddItems(g_hListView); + DoSort(0, TRUE); + g_bModified = FALSE; + g_bNeedsReboot = FALSE; + + return !g_Items.empty(); +} + +BOOL DoLoad(void) +{ + return DoLoadNames() && DoLoadItems(); +} + +void LV_InvalidateRow(HWND hwnd, INT iRow = -1) +{ + if (iRow == -1) + iRow = ListView_GetNextItem(hwnd, -1, LVNI_SELECTED); + if (iRow == -1) + return; + + RECT Rect; + LPRECT GccIsWhining = &Rect; + ListView_GetItemRect(hwnd, iRow, GccIsWhining, LVIR_BOUNDS); + InvalidateRect(hwnd, &Rect, FALSE); +} + +BOOL LV_Init(HWND hwnd) +{ + ListView_SetExtendedListViewStyle(hwnd, + LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES); + + HIMAGELIST hImageList; + hImageList = ImageList_Create(12, 12, ILC_COLOR8 | ILC_MASK, 2, 2); + + HBITMAP hbm; + hbm = (HBITMAP)LoadImage(g_hInstance, MAKEINTRESOURCE(2), IMAGE_BITMAP, + 12, 12, LR_CREATEDIBSECTION | LR_LOADMAP3DCOLORS); + assert(hbm); + ImageList_AddMasked(hImageList, hbm, RGB(192, 192, 192)); + DeleteObject(hbm); + + hbm = (HBITMAP)LoadImage(g_hInstance, MAKEINTRESOURCE(3), IMAGE_BITMAP, + 12, 12, LR_CREATEDIBSECTION | LR_LOADMAP3DCOLORS); + assert(hbm); + ImageList_AddMasked(hImageList, hbm, RGB(192, 192, 192)); + DeleteObject(hbm); + + hbm = (HBITMAP)LoadImage(g_hInstance, MAKEINTRESOURCE(4), IMAGE_BITMAP, + 12, 12, LR_CREATEDIBSECTION | LR_LOADMAP3DCOLORS); + assert(hbm); + ImageList_AddMasked(hImageList, hbm, RGB(192, 192, 192)); + DeleteObject(hbm); + + ListView_SetImageList(hwnd, hImageList, LVSIL_SMALL); + + LV_COLUMNW Column; + ZeroMemory(&Column, sizeof(Column)); + Column.mask = LVCF_FMT | LVCF_TEXT | LVCF_SUBITEM | LVCF_WIDTH | LVCF_IMAGE; + Column.fmt = LVCFMT_LEFT; + + Column.cx = NAME_COLUMN_WIDTH; + Column.pszText = g_szNameHead; + Column.iSubItem = 0; + Column.iImage = 0; + ListView_InsertColumn(hwnd, 0, &Column); + + Column.cx = SUB_COLUMN_WIDTH; + Column.pszText = g_szSubstituteHead; + Column.iSubItem = 1; + Column.iImage = 2; + ListView_InsertColumn(hwnd, 1, &Column); + + UINT State = LVIS_SELECTED | LVIS_FOCUSED; + ListView_SetItemState(hwnd, 0, State, State); + + return TRUE; +} + +BOOL EditDlg_OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam) +{ + COMBOBOXEXITEMW Item; + ZeroMemory(&Item, sizeof(Item)); + Item.mask = CBEIF_TEXT; + + FONTNAMESET::iterator it, end = g_Names.end(); + for (it = g_Names.begin(); it != end; ++it) + { + Item.pszText = const_cast<LPWSTR>(it->c_str()); + Item.iItem = ComboBox_GetCount(GetDlgItem(hwnd, cmb2)); + SendDlgItemMessageW(hwnd, cmb2, CBEM_INSERTITEM, 0, (LPARAM)&Item); + } + SetDlgItemTextW(hwnd, edt1, g_strFontName.c_str()); + SetDlgItemTextW(hwnd, cmb2, g_strSubstitute.c_str()); + + const INT Count = _countof(g_CharSetList); + for (INT i = 0; i < Count; ++i) + { + Item.pszText = const_cast<LPWSTR>(g_CharSetList[i].DisplayName); + Item.iItem = ComboBox_GetCount(GetDlgItem(hwnd, cmb3)); + SendDlgItemMessageW(hwnd, cmb3, CBEM_INSERTITEM, 0, (LPARAM)&Item); + Item.iItem = ComboBox_GetCount(GetDlgItem(hwnd, cmb4)); + SendDlgItemMessageW(hwnd, cmb4, CBEM_INSERTITEM, 0, (LPARAM)&Item); + } + + SendDlgItemMessageW(hwnd, cmb3, CB_SETCURSEL, 0, 0); + SendDlgItemMessageW(hwnd, cmb4, CB_SETCURSEL, 0, 0); + for (INT i = 0; i < Count; ++i) + { + if (g_CharSet1 == g_CharSetList[i].CharSet) + { + SendDlgItemMessageW(hwnd, cmb3, CB_SETCURSEL, i, 0); + } + if (g_CharSet2 == g_CharSetList[i].CharSet) + { + SendDlgItemMessageW(hwnd, cmb4, CB_SETCURSEL, i, 0); + } + } + + SIZE siz; + HDC hDC = CreateCompatibleDC(NULL); + SelectObject(hDC, GetStockObject(DEFAULT_GUI_FONT)); + GetTextExtentPoint32W(hDC, g_LongestName, lstrlenW(g_LongestName), &siz); + DeleteDC(hDC); + + SendDlgItemMessageW(hwnd, cmb3, CB_SETHORIZONTALEXTENT, siz.cx + 16, 0); + SendDlgItemMessageW(hwnd, cmb4, CB_SETHORIZONTALEXTENT, siz.cx + 16, 0); + + EnableWindow(GetDlgItem(hwnd, cmb3), FALSE); + + return TRUE; +} + +void LV_OnDelete(HWND hwnd, INT iRow = -1) +{ + if (iRow == -1) + iRow = ListView_GetNextItem(hwnd, -1, LVNI_SELECTED); + if (iRow == -1) + return; + + UINT State = LVIS_SELECTED | LVIS_FOCUSED; + ListView_SetItemState(g_hListView, iRow, State, State); + + WCHAR sz[MAX_STRING]; + LoadStringW(g_hInstance, IDS_QUERYDELETE, sz, _countof(sz)); + if (IDYES != MessageBoxW(g_hMainWnd, sz, g_szTitle, + MB_ICONINFORMATION | MB_YESNO)) + { + return; + } + + ListView_DeleteItem(hwnd, iRow); + g_Items.erase(g_Items.begin() + iRow); + g_bModified = TRUE; + + ListView_SetItemState(g_hListView, iRow, State, State); + + InvalidateRect(hwnd, NULL, TRUE); +} + +void EditDlg_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify) +{ + WCHAR szValue[MAX_STRING]; + STRING str; + INT i; + + switch (id) + { + case IDOK: + GetDlgItemTextW(hwnd, cmb2, szValue, _countof(szValue)); + str = szValue; + trim(str); + if (str.empty()) + { + WCHAR sz[MAX_STRING]; + SendDlgItemMessageW(hwnd, cmb2, CB_SETEDITSEL, 0, MAKELPARAM(0, -1)); + SetFocus(GetDlgItem(hwnd, cmb2)); + LoadStringW(g_hInstance, IDS_ENTERNAME2, sz, _countof(sz)); + MessageBoxW(hwnd, sz, NULL, MB_ICONERROR); + return; + } + + g_Items[g_iItem].m_CharSet2 = DEFAULT_CHARSET; + i = SendDlgItemMessageW(hwnd, cmb4, CB_GETCURSEL, 0, 0); + if (i != CB_ERR) + { + g_Items[g_iItem].m_CharSet2 = g_CharSetList[i].CharSet; + } + g_Items[g_iItem].m_Substitute = str; + + g_bModified = TRUE; + EndDialog(hwnd, IDOK); + break; + case IDCANCEL: + EndDialog(hwnd, IDCANCEL); + break; + case psh1: + LV_OnDelete(g_hListView, g_iItem); + EndDialog(hwnd, psh1); + break; + } +} + +INT_PTR CALLBACK +EditDlg_DlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + switch (uMsg) + { + HANDLE_MSG(hwnd, WM_INITDIALOG, EditDlg_OnInitDialog); + HANDLE_MSG(hwnd, WM_COMMAND, EditDlg_OnCommand); + } + return 0; +} + +void LV_OnDblClk(HWND hwnd) +{ + g_iItem = ListView_GetNextItem(hwnd, -1, LVNI_SELECTED); + if (g_iItem == -1) + return; + + g_strFontName = g_Items[g_iItem].m_Name; + g_strSubstitute = g_Items[g_iItem].m_Substitute; + g_CharSet1 = g_Items[g_iItem].m_CharSet1; + g_CharSet2 = g_Items[g_iItem].m_CharSet2; + + DialogBox(g_hInstance, MAKEINTRESOURCE(IDD_EDIT), g_hMainWnd, + EditDlg_DlgProc); + InvalidateRect(g_hListView, NULL, TRUE); +} + +BOOL MainWnd_OnCreate(HWND hwnd, LPCREATESTRUCT lpCreateStruct) +{ + DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_VSCROLL | + LVS_SINGLESEL | LVS_REPORT | LVS_OWNERDRAWFIXED; + DWORD dwExStyle = WS_EX_CLIENTEDGE; + g_hListView = CreateWindowEx(dwExStyle, WC_LISTVIEW, NULL, dwStyle, + 0, 0, 0, 0, + hwnd, (HMENU)1, g_hInstance, NULL); + if (g_hListView == NULL) + return FALSE; + + if (!LV_Init(g_hListView)) + return FALSE; + + if (!DoLoad()) + return FALSE; + + UINT State = LVIS_SELECTED | LVIS_FOCUSED; + ListView_SetItemState(g_hListView, 0, State, State); + SetFocus(g_hListView); + return TRUE; +} + +BOOL AddDlg_OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam) +{ + COMBOBOXEXITEMW Item; + ZeroMemory(&Item, sizeof(Item)); + Item.iItem = -1; + Item.mask = CBEIF_TEXT; + + FONTNAMESET::iterator it, end = g_Names.end(); + for (it = g_Names.begin(); it != end; ++it) + { + Item.pszText = const_cast<LPWSTR>(it->c_str()); + Item.iItem = ComboBox_GetCount(GetDlgItem(hwnd, cmb1)); + SendDlgItemMessageW(hwnd, cmb1, CBEM_INSERTITEM, 0, (LPARAM)&Item); + Item.iItem = ComboBox_GetCount(GetDlgItem(hwnd, cmb2)); + SendDlgItemMessageW(hwnd, cmb2, CBEM_INSERTITEM, 0, (LPARAM)&Item); + } + WCHAR szEnterName[MAX_STRING]; + LoadStringW(g_hInstance, IDS_ENTERNAME, szEnterName, _countof(szEnterName)); + SetDlgItemTextW(hwnd, cmb1, szEnterName); + SendDlgItemMessageW(hwnd, cmb1, CB_SETEDITSEL, 0, MAKELPARAM(0, -1)); + + const INT Count = _countof(g_CharSetList); + for (INT i = 0; i < Count; ++i) + { + Item.pszText = const_cast<LPWSTR>(g_CharSetList[i].DisplayName); + Item.iItem = ComboBox_GetCount(GetDlgItem(hwnd, cmb3)); + SendDlgItemMessageW(hwnd, cmb3, CBEM_INSERTITEM, 0, (LPARAM)&Item); + Item.iItem = ComboBox_GetCount(GetDlgItem(hwnd, cmb4)); + SendDlgItemMessageW(hwnd, cmb4, CBEM_INSERTITEM, 0, (LPARAM)&Item); + } + + SendDlgItemMessageW(hwnd, cmb3, CB_SETCURSEL, 0, 0); + SendDlgItemMessageW(hwnd, cmb4, CB_SETCURSEL, 0, 0); + for (INT i = 0; i < Count; ++i) + { + if (g_CharSet1 == g_CharSetList[i].CharSet) + { + SendDlgItemMessageW(hwnd, cmb3, CB_SETCURSEL, i, 0); + } + if (g_CharSet2 == g_CharSetList[i].CharSet) + { + SendDlgItemMessageW(hwnd, cmb4, CB_SETCURSEL, i, 0); + } + } + + SIZE siz; + HDC hDC = CreateCompatibleDC(NULL); + SelectObject(hDC, GetStockObject(DEFAULT_GUI_FONT)); + GetTextExtentPoint32W(hDC, g_LongestName, lstrlenW(g_LongestName), &siz); + DeleteDC(hDC); + + SendDlgItemMessageW(hwnd, cmb3, CB_SETHORIZONTALEXTENT, siz.cx + 16, 0); + SendDlgItemMessageW(hwnd, cmb4, CB_SETHORIZONTALEXTENT, siz.cx + 16, 0); + + return TRUE; +} + +void AddDlg_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify) +{ + WCHAR szKey[MAX_STRING], szValue[MAX_STRING], sz[MAX_STRING]; + INT i, iCharSet1, iCharSet2; + BYTE CharSet1, CharSet2; + STRING key, value; + switch (id) + { + case IDOK: + GetDlgItemTextW(hwnd, cmb1, szKey, _countof(szKey)); + key = szKey; + trim(key); + LoadStringW(g_hInstance, IDS_ENTERNAME, sz, _countof(sz)); + if (key.empty() || key == sz) + { + SendDlgItemMessageW(hwnd, cmb1, CB_SETEDITSEL, 0, MAKELPARAM(0, -1)); + SetFocus(GetDlgItem(hwnd, cmb1)); + LoadStringW(g_hInstance, IDS_ENTERNAME2, sz, _countof(sz)); + MessageBoxW(hwnd, sz, NULL, MB_ICONERROR); + return; + } + + GetDlgItemTextW(hwnd, cmb2, szValue, _countof(szValue)); + value = szValue; + trim(value); + if (value.empty()) + { + SendDlgItemMessageW(hwnd, cmb2, CB_SETEDITSEL, 0, MAKELPARAM(0, -1)); + SetFocus(GetDlgItem(hwnd, cmb2)); + LoadStringW(g_hInstance, IDS_ENTERNAME2, sz, _countof(sz)); + MessageBoxW(hwnd, sz, NULL, MB_ICONERROR); + return; + } + + iCharSet1 = SendDlgItemMessageW(hwnd, cmb3, CB_GETCURSEL, 0, 0); + if (iCharSet1 == CB_ERR) + iCharSet1 = 0; + iCharSet2 = SendDlgItemMessageW(hwnd, cmb4, CB_GETCURSEL, 0, 0); + if (iCharSet2 == CB_ERR) + iCharSet2 = 0; + + CharSet1 = g_CharSetList[iCharSet1].CharSet; + CharSet2 = g_CharSetList[iCharSet2].CharSet; + + for (i = 0; i < (INT)g_Items.size(); ++i) + { + if (g_Items[i].m_Name == key && + g_Items[i].m_CharSet1 == CharSet1) + { + WCHAR sz[MAX_STRING]; + SendDlgItemMessageW(hwnd, cmb1, CB_SETEDITSEL, 0, MAKELPARAM(0, -1)); + SetFocus(GetDlgItem(hwnd, cmb1)); + LoadStringW(g_hInstance, IDS_ALREADYEXISTS, sz, _countof(sz)); + MessageBoxW(hwnd, sz, NULL, MB_ICONERROR); + return; + } + } + { + ITEM Item(key, value, CharSet1, CharSet2); + g_Items.push_back(Item); + g_bModified = TRUE; + + i = (INT)g_Items.size(); + LV_ITEM LvItem; + ZeroMemory(&LvItem, sizeof(LvItem)); + LvItem.mask = LVIF_PARAM; + LvItem.iItem = i; + LvItem.lParam = i; + + LvItem.iSubItem = 0; + ListView_InsertItem(g_hListView, &LvItem); + + LvItem.iSubItem = 1; + ListView_InsertItem(g_hListView, &LvItem); + } + g_bModified = TRUE; + EndDialog(hwnd, IDOK); + break; + case IDCANCEL: + EndDialog(hwnd, IDCANCEL); + break; + } +} + +INT_PTR CALLBACK +AddDlg_DlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + switch (uMsg) + { + HANDLE_MSG(hwnd, WM_INITDIALOG, AddDlg_OnInitDialog); + HANDLE_MSG(hwnd, WM_COMMAND, AddDlg_OnCommand); + } + return 0; +} + +void MainWnd_OnNew(HWND hwnd) +{ + g_iItem = ListView_GetNextItem(hwnd, -1, LVNI_SELECTED); + if (g_iItem == -1) + return; + + g_strFontName = g_Items[g_iItem].m_Name; + g_strSubstitute = g_Items[g_iItem].m_Substitute; + g_CharSet1 = g_Items[g_iItem].m_CharSet1; + g_CharSet2 = g_Items[g_iItem].m_CharSet2; + + if (IDOK == DialogBox(g_hInstance, MAKEINTRESOURCE(IDD_ADD), g_hMainWnd, + AddDlg_DlgProc)) + { + INT i = ListView_GetItemCount(g_hListView) - 1; + UINT State = LVIS_SELECTED | LVIS_FOCUSED; + ListView_SetItemState(g_hListView, i, State, State); + ListView_EnsureVisible(g_hListView, i, FALSE); + } +} + +BOOL MainWnd_OnUpdateRegistry(HWND hwnd) +{ + // open the key + HKEY hKey = NULL; + RegOpenKeyExW(HKEY_LOCAL_MACHINE, g_pszKey, 0, KEY_ALL_ACCESS, &hKey); + if (hKey == NULL) + return FALSE; + + // clear all values + WCHAR szName[MAX_STRING], szValue[MAX_STRING]; + DWORD cbName, cbValue; + for (;;) + { + cbName = sizeof(szName); + cbValue = sizeof(szValue); + LONG Error = RegEnumValueW(hKey, 0, szName, &cbName, + NULL, NULL, (LPBYTE)szValue, &cbValue); + if (Error != ERROR_SUCCESS) + break; + + RegDeleteValueW(hKey, szName); + } + + // set values + size_t Count = g_Items.size(); + for (size_t i = 0; i < Count; ++i) + { + DWORD cbData = (g_Items[i].m_Substitute.size() + 1) * sizeof(WCHAR); + RegSetValueExW(hKey, g_Items[i].m_Name.c_str(), 0, + REG_SZ, (LPBYTE)g_Items[i].m_Substitute.c_str(), cbData); + } + + // close now + RegCloseKey(hKey); + + g_bModified = FALSE; + g_bNeedsReboot = TRUE; + return TRUE; +} + +LPWSTR SkipSpace(LPCWSTR pch) +{ + while (*pch && wcschr(L" \t\r\n", *pch) != NULL) + { + ++pch; + } + return const_cast<LPWSTR>(pch); +} + +LPWSTR SkipQuoted(LPWSTR pch) +{ + ++pch; // L'"' + while (*pch) + { + if (*pch == L'"') + { + ++pch; + break; + } + if (*pch == L'\\') + { + ++pch; + } + ++pch; + } + return pch; +} + +void UnescapeHex(const STRING& str, size_t& i, STRING& Ret, BOOL Unicode) +{ + STRING Num; + + // hexadecimal + if (iswxdigit(str[i])) + { + Num += str[i]; + ++i; + if (iswxdigit(str[i])) + { + Num += str[i]; + ++i; + if (Unicode) + { + if (iswxdigit(str[i])) + { + Num += str[i]; + ++i; + if (iswxdigit(str[i])) + { + Num += str[i]; + ++i; + } + } + } + } + } + if (!Num.empty()) + { + Ret += (WCHAR)wcstoul(&Num[0], NULL, 16); + } +} + +void UnescapeOther(const STRING& str, size_t& i, STRING& Ret) +{ + STRING Num; + + // check octal + if (L'0' <= str[i] && str[i] < L'8') + { + Num += str[i]; + ++i; + if (L'0' <= str[i] && str[i] < L'8') + { + Num += str[i]; + ++i; + if (L'0' <= str[i] && str[i] < L'8') + { + Num += str[i]; + ++i; + } + } + } + if (Num.empty()) + { + Ret += str[i]; + ++i; + } + else + { + // octal + Ret += (WCHAR)wcstoul(&Num[0], NULL, 8); + } +} + +// process escape sequence +void UnescapeChar(const STRING& str, size_t& i, STRING& Ret) +{ + if (str[i] != L'\\') + { + Ret += str[i]; + ++i; + return; + } + + ++i; + switch (str[i]) + { + case L'a': Ret += L'\a'; ++i; break; + case L'b': Ret += L'\b'; ++i; break; + case L'f': Ret += L'\f'; ++i; break; + case L'n': Ret += L'\n'; ++i; break; + case L'r': Ret += L'\r'; ++i; break; + case L't': Ret += L'\t'; ++i; break; + case L'v': Ret += L'\v'; ++i; break; + case L'x': + // hexidemical + ++i; + UnescapeHex(str, i, Ret, FALSE); + break; + case L'u': + // Unicode hexidemical + ++i; + UnescapeHex(str, i, Ret, TRUE); + break; + default: + // other case + UnescapeOther(str, i, Ret); + break; + } +} + +STRING Unquote(const STRING& str) +{ + if (str[0] != L'"') + return str; + + STRING Ret; + size_t i = 1; + while (i < str.size()) + { + if (str[i] == L'"' || str[i] == UNICODE_NULL) + break; + + UnescapeChar(str, i, Ret); + } + return Ret; +} + +BOOL DoParseFile(LPVOID pvContents, DWORD dwSize) +{ + ITEMVECTOR Items; + + LPWSTR pch, pchSep, pchStart = (LPWSTR)pvContents; + + pchStart[dwSize / sizeof(WCHAR)] = UNICODE_NULL; + + // check header + const DWORD cbHeader = lstrlenW(g_pszFileHeader) * sizeof(WCHAR); + if (memcmp(pchStart, g_pszFileHeader, cbHeader) != 0) + return FALSE; + + pchStart += cbHeader / sizeof(WCHAR); + + // find the key + WCHAR szKey[MAX_STRING]; + wsprintfW(szKey, L"[HKEY_LOCAL_MACHINE\\%s]", g_pszKey); + pch = wcsstr(pchStart, szKey); + if (pch == NULL) + return FALSE; + + pchStart = pch + lstrlenW(szKey); + + for (;;) + { + pchStart = SkipSpace(pchStart); + if (*pchStart == UNICODE_NULL || *pchStart == L'[') + break; + + pch = wcschr(pchStart, L'\n'); + if (pch) + *pch = UNICODE_NULL; + + pchSep = SkipQuoted(pchStart); + if (*pchSep == L'=') + { + *pchSep = UNICODE_NULL; + + STRING key = pchStart; + trim(key); + key = Unquote(key); + + STRING value = pchSep + 1; + trim(value); + value = Unquote(value); + + BYTE CharSet1 = DEFAULT_CHARSET, CharSet2 = DEFAULT_CHARSET; + + size_t pos; + pos = key.find(L','); + if (pos != STRING::npos) + { + CharSet1 = (BYTE)_wtoi(&key[pos + 1]); + key.resize(pos); + trim(key); + } + pos = value.find(L','); + if (pos != STRING::npos) + { + CharSet2 = (BYTE)_wtoi(&value[pos + 1]); + value.resize(pos); + trim(value); + } + + ITEM Item(key, value, CharSet1, CharSet2); + Items.push_back(Item); + } + + if (pch == NULL) + break; + + pchStart = pch + 1; + } + + g_Items = Items; + g_bModified = TRUE; + + LV_AddItems(g_hListView); + return TRUE; +} + +BOOL DoImport(HWND hwnd, LPCWSTR pszFile) +{ + HANDLE hFile = CreateFileW(pszFile, GENERIC_READ, + FILE_SHARE_READ | FILE_SHARE_DELETE, NULL, + OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL); + if (hFile == INVALID_HANDLE_VALUE) + return FALSE; + + BOOL bSuccess = FALSE; + DWORD dwSize = GetFileSize(hFile, NULL); + if (dwSize != 0xFFFFFFFF) + { + std::vector<BYTE> Contents(dwSize + 2); + DWORD cbRead; + if (ReadFile(hFile, &Contents[0], dwSize, &cbRead, NULL) && + cbRead == dwSize) + { + /* check BOM */ + if (memcmp(&Contents[0], "\xFF\xFE", 2) == 0) + { + bSuccess = DoParseFile(&Contents[2], dwSize - 2); + } + else + { + bSuccess = DoParseFile(&Contents[0], dwSize); + } + } + } + CloseHandle(hFile); + + return bSuccess; +} + +STRING Escape(const STRING& str) +{ + STRING Ret; + for (size_t i = 0; i < str.size(); ++i) + { + switch (str[i]) + { + case L'"': case L'\\': + Ret += L'\\'; + Ret += str[i]; + break; + default: + Ret += str[i]; + } + } + return Ret; +} + +BOOL DoExport(HWND hwnd, LPCWSTR pszFile) +{ + HANDLE hFile = CreateFileW(pszFile, GENERIC_WRITE, FILE_SHARE_READ, + NULL, CREATE_ALWAYS, + FILE_ATTRIBUTE_NORMAL | FILE_FLAG_WRITE_THROUGH, NULL); + if (hFile == INVALID_HANDLE_VALUE) + return FALSE; + + BOOL bSuccess; + DWORD dwSize, cbWritten; + WCHAR szCharSet1[MAX_STRING], szCharSet2[MAX_STRING]; + WCHAR szLine[MAX_STRING * 2 + 4]; + + /* write header */ + dwSize = lstrlenW(g_pszFileHeader) * sizeof(WCHAR); + bSuccess = + WriteFile(hFile, "\xFF\xFE", 2, &cbWritten, NULL) && + WriteFile(hFile, g_pszFileHeader, dwSize, &cbWritten, NULL); + if (bSuccess) + { + wsprintfW(szLine, L"\r\n\r\n[HKEY_LOCAL_MACHINE\\%s]\r\n", g_pszKey); + dwSize = lstrlenW(szLine) * sizeof(WCHAR); + bSuccess = WriteFile(hFile, szLine, dwSize, &cbWritten, NULL); + } + if (bSuccess) + { + size_t i, Count = g_Items.size(); + for (i = 0; i < Count; ++i) + { + if (g_Items[i].m_CharSet1 != DEFAULT_CHARSET) + wsprintfW(szCharSet1, L",%u", g_Items[i].m_CharSet1); + else + szCharSet1[0] = UNICODE_NULL; + + if (g_Items[i].m_CharSet2 != DEFAULT_CHARSET) + wsprintfW(szCharSet2, L",%u", g_Items[i].m_CharSet2); + else + szCharSet2[0] = UNICODE_NULL; + + STRING Name = Escape(g_Items[i].m_Name); + STRING Substitute = Escape(g_Items[i].m_Substitute); + wsprintfW(szLine, L"\"%s%s\"=\"%s%s\"\r\n", + Name.c_str(), szCharSet1, + Substitute.c_str(), szCharSet2); + + dwSize = lstrlenW(szLine) * sizeof(WCHAR); + if (!WriteFile(hFile, szLine, dwSize, &cbWritten, NULL)) + { + bSuccess = FALSE; + break; + } + } + WriteFile(hFile, L"\r\n", 2 * sizeof(WCHAR), &cbWritten, NULL); + } + CloseHandle(hFile); + + if (!bSuccess) + { + DeleteFileW(pszFile); + } + + return bSuccess; +} + +void MakeFilter(LPWSTR pszFilter) +{ + while (*pszFilter) + { + if (*pszFilter == L'|') + *pszFilter = 0; + + ++pszFilter; + } +} + +void MainWnd_OnImport(HWND hwnd) +{ + OPENFILENAMEW ofn = {0}; + WCHAR szFile[MAX_PATH] = L""; + WCHAR szImportTitle[MAX_STRING]; + WCHAR szCannotImport[MAX_STRING]; + WCHAR szImportFilter[MAX_STRING]; + LoadStringW(g_hInstance, IDS_IMPORT, szImportTitle, _countof(szImportTitle)); + LoadStringW(g_hInstance, IDS_CANTIMPORT, szCannotImport, _countof(szCannotImport)); + LoadStringW(g_hInstance, IDS_INPFILTER, szImportFilter, _countof(szImportFilter)); + MakeFilter(szImportFilter); + + ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; + ofn.hwndOwner = hwnd; + ofn.lpstrFilter = szImportFilter; + ofn.lpstrFile = szFile; + ofn.nMaxFile = _countof(szFile); + ofn.lpstrTitle = szImportTitle; + ofn.Flags = OFN_DONTADDTORECENT | OFN_ENABLESIZING | + OFN_EXPLORER | OFN_FILEMUSTEXIST | + OFN_HIDEREADONLY | OFN_LONGNAMES | + OFN_PATHMUSTEXIST; + ofn.lpstrDefExt = L"reg"; + if (GetOpenFileNameW(&ofn)) + { + if (!DoImport(hwnd, szFile)) + { + MessageBoxW(hwnd, szCannotImport, g_szTitle, MB_ICONERROR); + } + } +} + +void MainWnd_OnExport(HWND hwnd) +{ + OPENFILENAMEW ofn = {0}; + WCHAR szFile[MAX_PATH] = L""; + WCHAR szExportTitle[MAX_STRING]; + WCHAR szCannotExport[MAX_STRING]; + WCHAR szExportFilter[MAX_STRING]; + LoadStringW(g_hInstance, IDS_EXPORT, szExportTitle, _countof(szExportTitle)); + LoadStringW(g_hInstance, IDS_CANTEXPORT, szCannotExport, _countof(szCannotExport)); + LoadStringW(g_hInstance, IDS_OUTFILTER, szExportFilter, _countof(szExportFilter)); + MakeFilter(szExportFilter); + + ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; + ofn.hwndOwner = hwnd; + ofn.lpstrFilter = szExportFilter; + ofn.lpstrFile = szFile; + ofn.nMaxFile = _countof(szFile); + ofn.lpstrTitle = szExportTitle; + ofn.Flags = OFN_DONTADDTORECENT | OFN_ENABLESIZING | + OFN_EXPLORER | OFN_HIDEREADONLY | OFN_LONGNAMES | + OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT; + ofn.lpstrDefExt = L"reg"; + if (GetSaveFileNameW(&ofn)) + { + if (!DoExport(hwnd, szFile)) + { + MessageBoxW(hwnd, szCannotExport, g_szTitle, MB_ICONERROR); + } + } +} + +void MainWnd_OnReload(HWND hwnd) +{ + DoLoad(); +} + +void MainWnd_OnEdit(HWND hwnd) +{ + LV_OnDblClk(g_hListView); +} + +void MainWnd_OnDelete(HWND hwnd) +{ + LV_OnDelete(g_hListView); +} + +void MainWnd_OnOpenRegKey(HWND hwnd) +{ + static const WCHAR s_szRegeditKey[] = + L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Applets\\Regedit"; + WCHAR sz[MAX_STRING]; + + // open regedit key + HKEY hKey = NULL; + LSTATUS Result = RegCreateKeyExW(HKEY_CURRENT_USER, s_szRegeditKey, 0, + NULL, 0, KEY_WRITE, NULL, &hKey, NULL); + if (Result != ERROR_SUCCESS) + { + LoadStringW(g_hInstance, IDS_CANTOPENKEY, sz, _countof(sz)); + MessageBoxW(hwnd, sz, NULL, MB_ICONERROR); + return; + } + + // set LastKey value + wsprintfW(sz, L"HKEY_LOCAL_MACHINE\\%s", g_pszKey); + DWORD dwSize = sizeof(sz); + Result = RegSetValueExW(hKey, L"LastKey", 0, REG_SZ, + (LPBYTE)sz, dwSize); + + // close now + RegCloseKey(hKey); + + if (Result != ERROR_SUCCESS) + { + LoadStringW(g_hInstance, IDS_CANTOPENKEY, sz, _countof(sz)); + MessageBoxW(hwnd, sz, NULL, MB_ICONERROR); + return; + } + + // open by regedit + ShellExecuteW(hwnd, NULL, L"regedit.exe", NULL, NULL, SW_SHOWNORMAL); +} + +void MainWnd_OnAbout(HWND hwnd) +{ + WCHAR szAbout[MAX_PATH]; + LoadStringW(g_hInstance, IDS_ABOUT, szAbout, _countof(szAbout)); + + MSGBOXPARAMS Params; + ZeroMemory(&Params, sizeof(Params)); + Params.cbSize = sizeof(Params); + Params.hwndOwner = hwnd; + Params.hInstance = g_hInstance; + Params.lpszText = szAbout; + Params.lpszCaption = g_szTitle; + Params.dwStyle = MB_OK | MB_USERICON; + Params.lpszIcon = MAKEINTRESOURCEW(1); + Params.dwLanguageId = LANG_USER_DEFAULT; + MessageBoxIndirectW(&Params); +} + +void MainWnd_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify) +{ + switch (id) + { + case ID_NEW: + MainWnd_OnNew(hwnd); + break; + case ID_EDIT: + MainWnd_OnEdit(hwnd); + break; + case ID_EXIT: + PostMessage(hwnd, WM_CLOSE, 0, 0); + break; + case ID_RELOAD: + MainWnd_OnReload(hwnd); + break; + case ID_UPDATE_REGISTRY: + MainWnd_OnUpdateRegistry(hwnd); + break; + case ID_DELETE: + MainWnd_OnDelete(hwnd); + break; + case ID_IMPORT: + MainWnd_OnImport(hwnd); + break; + case ID_EXPORT: + MainWnd_OnExport(hwnd); + break; + case ID_OPEN_REGKEY: + MainWnd_OnOpenRegKey(hwnd); + break; + case ID_ABOUT: + MainWnd_OnAbout(hwnd); + break; + } +} + +void MainWnd_OnDestroy(HWND hwnd) +{ + PostQuitMessage(0); +} + +void MainWnd_OnSize(HWND hwnd, UINT state, int cx, int cy) +{ + MoveWindow(g_hListView, 0, 0, cx, cy, TRUE); +} + +void MainWnd_OnDrawItem(HWND hwnd, const DRAWITEMSTRUCT *lpDrawItem) +{ + if (lpDrawItem->CtlType != ODT_LISTVIEW) + return; + + HDC hDC = lpDrawItem->hDC; + SetBkMode(hDC, TRANSPARENT); + + INT iColumn = 0, x, cx; + RECT rcItem, rcSubItem, rcText; + STRING Str; + + x = -GetScrollPos(g_hListView, SB_HORZ); + + rcItem = lpDrawItem->rcItem; + if (lpDrawItem->itemState & ODS_SELECTED) + { + FillRect(hDC, &rcItem, (HBRUSH)(COLOR_HIGHLIGHT + 1)); + SetTextColor(hDC, GetSysColor(COLOR_HIGHLIGHTTEXT)); + } + else + { + FillRect(hDC, &rcItem, (HBRUSH)(COLOR_WINDOW + 1)); + SetTextColor(hDC, GetSysColor(COLOR_WINDOWTEXT)); + } + + cx = ListView_GetColumnWidth(g_hListView, iColumn); + rcSubItem = rcItem; + rcSubItem.left = x; + rcSubItem.right = x + cx; + + WCHAR sz[MAX_STRING]; + + rcText = rcSubItem; + InflateRect(&rcText, -1, -1); + Str = g_Items[lpDrawItem->itemID].m_Name; + BYTE CharSet1 = g_Items[lpDrawItem->itemID].m_CharSet1; + if (CharSet1 != DEFAULT_CHARSET) + wsprintfW(sz, L"%s,%u", Str.c_str(), CharSet1); + else + wsprintfW(sz, L"%s", Str.c_str()); + + DrawTextW(hDC, sz, lstrlenW(sz), &rcText, + DT_SINGLELINE | DT_LEFT | DT_VCENTER | DT_END_ELLIPSIS | + DT_NOPREFIX); + + x += cx; + ++iColumn; + + cx = ListView_GetColumnWidth(g_hListView, iColumn); + rcSubItem = rcItem; + rcSubItem.left = x; + rcSubItem.right = x + cx; + + rcText = rcSubItem; + InflateRect(&rcText, -1, -1); + Str = g_Items[lpDrawItem->itemID].m_Substitute; + BYTE CharSet2 = g_Items[lpDrawItem->itemID].m_CharSet2; + if (CharSet2 != DEFAULT_CHARSET) + wsprintfW(sz, L"%s,%u", Str.c_str(), CharSet2); + else + wsprintfW(sz, L"%s", Str.c_str()); + + DrawTextW(hDC, sz, lstrlenW(sz), &rcText, + DT_SINGLELINE | DT_LEFT | DT_VCENTER | DT_END_ELLIPSIS | + DT_NOPREFIX); +} + +void MainWnd_OnMeasureItem(HWND hwnd, MEASUREITEMSTRUCT *lpMeasureItem) +{ + if (lpMeasureItem->CtlType != ODT_LISTVIEW) + return; + + TEXTMETRIC tm; + HDC hDC = GetDC(hwnd); + GetTextMetrics(hDC, &tm); + ReleaseDC(hwnd, hDC); + + lpMeasureItem->itemHeight = tm.tmHeight * 4 / 3; +} + +LRESULT MainWnd_OnNotify(HWND hwnd, int idFrom, NMHDR *pnmhdr) +{ + NM_LISTVIEW *pNMLV = (NM_LISTVIEW *)pnmhdr; + LV_KEYDOWN *pLVKD = (LV_KEYDOWN *)pnmhdr; + + switch (pnmhdr->code) + { + case LVN_COLUMNCLICK: + if (pNMLV->iSubItem == g_iSortColumn) + DoSort(pNMLV->iSubItem, !g_bSortAscendant); + else + DoSort(pNMLV->iSubItem, TRUE); + break; + case NM_DBLCLK: + LV_OnDblClk(g_hListView); + break; + case LVN_KEYDOWN: + if (pLVKD->wVKey == VK_RETURN) // [Enter] key + { + LV_OnDblClk(g_hListView); + } + if (pLVKD->wVKey == VK_DELETE) // [Del] key + { + LV_OnDelete(g_hListView); + } + break; + } + return 0; +} + +LRESULT MainWnd_OnContextMenu(HWND hwnd, HWND hwndContext, UINT xPos, UINT yPos) +{ + POINT pt = {(INT)xPos, (INT)yPos}; + ScreenToClient(g_hListView, &pt); + SendMessageW(g_hListView, WM_LBUTTONDOWN, 0, MAKELPARAM(pt.x, pt.y)); + + HMENU hMenu = LoadMenu(g_hInstance, MAKEINTRESOURCE(2)); + if (hMenu == NULL) + return 0; + + HMENU hSubMenu = GetSubMenu(hMenu, 0); + if (hSubMenu == NULL) + return 0; + + SetForegroundWindow(hwnd); + TrackPopupMenu(hSubMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON, + xPos, yPos, 0, g_hMainWnd, NULL); + PostMessage(g_hMainWnd, WM_NULL, 0, 0); + return 0; +} + +void MainWnd_OnActivate(HWND hwnd, UINT state, HWND hwndActDeact, BOOL fMinimized) +{ + if (state != WA_INACTIVE) + { + SetFocus(g_hListView); + } +} + +BOOL EnableProcessPrivileges(LPCWSTR lpPrivilegeName, BOOL bEnable = TRUE) +{ + HANDLE hToken; + LUID luid; + TOKEN_PRIVILEGES tokenPrivileges; + BOOL Ret; + + Ret = ::OpenProcessToken(::GetCurrentProcess(), + TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, + &hToken); + if (!Ret) + return Ret; // failure + + Ret = ::LookupPrivilegeValueW(NULL, lpPrivilegeName, &luid); + if (Ret) + { + tokenPrivileges.PrivilegeCount = 1; + tokenPrivileges.Privileges[0].Luid = luid; + tokenPrivileges.Privileges[0].Attributes = bEnable ? SE_PRIVILEGE_ENABLED : 0; + + Ret = ::AdjustTokenPrivileges(hToken, FALSE, &tokenPrivileges, 0, 0, 0); + } + + ::CloseHandle(hToken); + return Ret; +} + +void MainWnd_OnClose(HWND hwnd) +{ + if (!g_bNeedsReboot && !g_bModified) + { + DestroyWindow(hwnd); + return; + } + + if (g_bModified) + { + WCHAR szUpdateNow[MAX_STRING]; + LoadStringW(g_hInstance, IDS_QUERYUPDATE, szUpdateNow, _countof(szUpdateNow)); + INT id = MessageBoxW(hwnd, szUpdateNow, g_szTitle, + MB_ICONINFORMATION | MB_YESNOCANCEL); + switch (id) + { + case IDYES: + MainWnd_OnUpdateRegistry(hwnd); + break; + case IDNO: + break; + case IDCANCEL: + return; + } + } + + if (g_bNeedsReboot) + { + WCHAR szRebootNow[MAX_STRING]; + LoadStringW(g_hInstance, IDS_REBOOTNOW, szRebootNow, _countof(szRebootNow)); + INT id = MessageBoxW(hwnd, szRebootNow, g_szTitle, + MB_ICONINFORMATION | MB_YESNOCANCEL); + switch (id) + { + case IDYES: + EnableProcessPrivileges(SE_SHUTDOWN_NAME, TRUE); + ::ExitWindowsEx(EWX_REBOOT | EWX_FORCE, 0); + break; + case IDNO: + break; + case IDCANCEL: + return; + } + } + + ::DestroyWindow(hwnd); +} + +LRESULT CALLBACK +WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + switch (uMsg) + { + HANDLE_MSG(hwnd, WM_CREATE, MainWnd_OnCreate); + HANDLE_MSG(hwnd, WM_COMMAND, MainWnd_OnCommand); + HANDLE_MSG(hwnd, WM_DESTROY, MainWnd_OnDestroy); + HANDLE_MSG(hwnd, WM_SIZE, MainWnd_OnSize); + HANDLE_MSG(hwnd, WM_DRAWITEM, MainWnd_OnDrawItem); + HANDLE_MSG(hwnd, WM_MEASUREITEM, MainWnd_OnMeasureItem); + HANDLE_MSG(hwnd, WM_NOTIFY, MainWnd_OnNotify); + HANDLE_MSG(hwnd, WM_CONTEXTMENU, MainWnd_OnContextMenu); + HANDLE_MSG(hwnd, WM_ACTIVATE, MainWnd_OnActivate); + HANDLE_MSG(hwnd, WM_CLOSE, MainWnd_OnClose); + default: + return DefWindowProc(hwnd, uMsg, wParam, lParam); + } +} + +INT WINAPI wWinMain( + HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPWSTR lpCmdLine, + INT nCmdShow) +{ + g_hInstance = hInstance; + InitCommonControls(); + + HACCEL hAccel = LoadAcceleratorsW(hInstance, MAKEINTRESOURCEW(1)); + + LoadStringW(hInstance, IDS_TITLE, g_szTitle, _countof(g_szTitle)); + LoadStringW(hInstance, IDS_FONTNAME, g_szNameHead, _countof(g_szNameHead)); + LoadStringW(hInstance, IDS_SUBSTITUTE, g_szSubstituteHead, _countof(g_szSubstituteHead)); + + WNDCLASSW wc = {0}; + wc.style = 0; + wc.lpfnWndProc = WindowProc; + wc.hInstance = hInstance; + g_hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(1)); + wc.hIcon = g_hIcon; + wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1); + wc.lpszMenuName = MAKEINTRESOURCEW(1); + wc.lpszClassName = g_pszClassName; + if (!RegisterClassW(&wc)) + { + MessageBoxA(NULL, "ERROR: RegisterClass failed.", NULL, MB_ICONERROR); + return 1; + } + + const DWORD dwStyle = WS_OVERLAPPEDWINDOW; + INT Width = NAME_COLUMN_WIDTH + SUB_COLUMN_WIDTH + + GetSystemMetrics(SM_CXVSCROLL) + + GetSystemMetrics(SM_CXSIZEFRAME); + INT Height = 320; + + RECT Rect = { 0, 0, Width, Height }; + AdjustWindowRect(&Rect, dwStyle, TRUE); + Width = Rect.right - Rect.left; + Height = Rect.bottom - Rect.top; + + g_hMainWnd = CreateWindowW(g_pszClassName, g_szTitle, dwStyle, + CW_USEDEFAULT, CW_USEDEFAULT, Width, Height, + NULL, NULL, hInstance, NULL); + if (g_hMainWnd == NULL) + { + MessageBoxA(NULL, "ERROR: CreateWindow failed.", NULL, MB_ICONERROR); + return 2; + } + + ShowWindow(g_hMainWnd, nCmdShow); + UpdateWindow(g_hMainWnd); + + MSG msg; + while (GetMessage(&msg, NULL, 0, 0)) + { + if (TranslateAccelerator(g_hMainWnd, hAccel, &msg)) + continue; + + TranslateMessage(&msg); + DispatchMessage(&msg); + } + + return (INT)msg.wParam; +} Propchange: trunk/rosapps/applications/sysutils/fontsub/fontsub.cpp ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/rosapps/applications/sysutils/fontsub/fontsub.ico URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/sysutils/font…
============================================================================== Binary file - no diff available. Propchange: trunk/rosapps/applications/sysutils/fontsub/fontsub.ico ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: trunk/rosapps/applications/sysutils/fontsub/fontsub.svg URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/sysutils/font…
============================================================================== --- trunk/rosapps/applications/sysutils/fontsub/fontsub.svg (added) +++ trunk/rosapps/applications/sysutils/fontsub/fontsub.svg [iso-8859-1] Sat Mar 18 13:01:18 2017 @@ -0,0 +1,368 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (
http://www.inkscape.org/
) --> + +<svg + xmlns:dc="
http://purl.org/dc/elements/1.1/
" + xmlns:cc="
http://creativecommons.org/ns#
" + xmlns:rdf="
http://www.w3.org/1999/02/22-rdf-syntax-ns#
" + xmlns:svg="
http://www.w3.org/2000/svg
" + xmlns="
http://www.w3.org/2000/svg
" + xmlns:sodipodi="
http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd
" + xmlns:inkscape="
http://www.inkscape.org/namespaces/inkscape
" + width="256" + height="256" + viewBox="0 0 256 256" + id="svg2" + version="1.1" + inkscape:version="0.91 r13725" + sodipodi:docname="fontsub.svg" + inkscape:export-filename="C:\Users\katahiromz\Desktop\fontsub2\fontsub.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90"> + <defs + id="defs4" /> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="0.35" + inkscape:cx="-96.950454" + inkscape:cy="-3.229257" + inkscape:document-units="px" + inkscape:current-layer="layer1" + showgrid="false" + inkscape:snap-bbox="true" + inkscape:bbox-paths="true" + inkscape:bbox-nodes="true" + inkscape:snap-bbox-edge-midpoints="true" + inkscape:snap-bbox-midpoints="true" + inkscape:snap-intersection-paths="true" + inkscape:object-paths="true" + inkscape:object-nodes="true" + inkscape:snap-smooth-nodes="true" + inkscape:snap-midpoints="true" + inkscape:snap-object-midpoints="true" + inkscape:snap-center="true" + inkscape:snap-text-baseline="true" + inkscape:snap-page="true" + inkscape:snap-global="true" + inkscape:window-width="1366" + inkscape:window-height="705" + inkscape:window-x="-8" + inkscape:window-y="-8" + inkscape:window-maximized="1" + units="px" /> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="
http://purl.org/dc/dcmitype/StillImage
" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="ã¬ã¤ã¤ã¼ 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(0,-796.36219)"> + <g + id="g4467" + transform="matrix(0.2822222,0,0,0.2822222,0,755.36218)"> + <rect + y="362.76154" + x="2.6432549e-006" + height="689.60077" + width="907.08661" + id="rect4240-2" + style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901" /> + <rect + y="145.27559" + x="7.7024585e-015" + height="254.62881" + width="907.08661" + id="rect4240" + style="opacity:1;fill:#b1b1b1;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901" /> + <rect + y="145.27559" + x="2.6432549e-006" + height="37.142868" + width="907.08661" + id="rect3336" + style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901" /> + <rect + y="1015.2194" + x="2.6432549e-006" + height="37.142868" + width="907.08661" + id="rect3336-9" + style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901" /> + <rect + transform="matrix(0,-1,1,0,0,0)" + y="0" + x="-1052.3622" + height="37.142868" + width="907.08661" + id="rect3336-9-4" + style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901" /> + <rect + transform="matrix(0,-1,1,0,0,0)" + y="869.94373" + x="-1052.3623" + height="37.142868" + width="907.08661" + id="rect3336-9-4-9" + style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901" /> + <rect + transform="matrix(0,-1,1,0,0,0)" + y="434.97186" + x="-1052.3623" + height="37.142868" + width="907.08661" + id="rect3336-9-4-8" + style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901" /> + <rect + y="580.2475" + x="2.6432549e-006" + height="37.142868" + width="907.08661" + id="rect3336-9-4-8-9" + style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901" /> + <rect + y="362.76154" + x="2.6432549e-006" + height="37.142868" + width="907.08661" + id="rect3336-9-4-8-9-9" + style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901" /> + <rect + y="797.73346" + x="2.6432549e-006" + height="37.142868" + width="907.08661" + id="rect3336-9-4-8-9-9-0" + style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901" /> + <g + id="g4346"> + <rect + style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901" + id="rect3336-9-4-98" + width="147.08661" + height="37.142868" + x="-564.2475" + y="87.599564" + transform="matrix(0,-1,1,0,0,0)" /> + <rect + style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901" + id="rect3336-9-4-98-1" + width="118.51518" + height="37.142868" + x="-206.11475" + y="-454.30377" + transform="scale(-1,-1)" /> + <rect + style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901" + id="rect3336-9-4-98-1-8" + width="94.285751" + height="37.142868" + x="-181.88531" + y="-516.64795" + transform="scale(-1,-1)" /> + </g> + <g + transform="translate(0,-2)" + id="g4351"> + <rect + style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901" + id="rect3336-9-4-98-4" + width="85.427803" + height="37.142868" + x="-502.58875" + y="506.45667" + transform="matrix(0,-1,1,0,0,0)" /> + <rect + style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901" + id="rect3336-9-4-98-1-6" + width="118.51518" + height="37.142868" + x="-624.97186" + y="-454.3038" + transform="scale(-1,-1)" /> + <rect + style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901" + id="rect3336-9-4-98-1-8-7" + width="117.19617" + height="37.142868" + x="-623.65283" + y="-510.8382" + transform="scale(-1,-1)" /> + <rect + style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901" + id="rect3336-9-4-98-4-1" + width="72.800896" + height="37.142868" + x="-552.87671" + y="586.50995" + transform="matrix(0,-1,1,0,0,0)" /> + <rect + style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901" + id="rect3336-9-4-98-1-6-6" + width="118.51518" + height="37.142868" + x="-623.65283" + y="-567.37256" + transform="scale(-1,-1)" /> + </g> + <g + id="g4346-9" + transform="translate(0,217.11474)"> + <rect + style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901" + id="rect3336-9-4-98-6" + width="147.08661" + height="37.142868" + x="-564.2475" + y="87.599564" + transform="matrix(0,-1,1,0,0,0)" /> + <rect + style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901" + id="rect3336-9-4-98-1-5" + width="118.51518" + height="37.142868" + x="-206.11475" + y="-454.30377" + transform="scale(-1,-1)" /> + <rect + style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901" + id="rect3336-9-4-98-1-8-8" + width="94.285751" + height="37.142868" + x="-181.88531" + y="-516.64795" + transform="scale(-1,-1)" /> + </g> + <g + id="g4346-9-6" + transform="translate(0,434.22944)"> + <rect + style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901" + id="rect3336-9-4-98-6-9" + width="147.08661" + height="37.142868" + x="-564.2475" + y="87.599564" + transform="matrix(0,-1,1,0,0,0)" /> + <rect + style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901" + id="rect3336-9-4-98-1-5-2" + width="118.51518" + height="37.142868" + x="-206.11475" + y="-454.30377" + transform="scale(-1,-1)" /> + <rect + style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901" + id="rect3336-9-4-98-1-8-8-5" + width="94.285751" + height="37.142868" + x="-181.88531" + y="-516.64795" + transform="scale(-1,-1)" /> + </g> + <g + transform="translate(0,215.61916)" + id="g4351-9"> + <rect + style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901" + id="rect3336-9-4-98-4-8" + width="85.427803" + height="37.142868" + x="-502.58875" + y="506.45667" + transform="matrix(0,-1,1,0,0,0)" /> + <rect + style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901" + id="rect3336-9-4-98-1-6-7" + width="118.51518" + height="37.142868" + x="-624.97186" + y="-454.3038" + transform="scale(-1,-1)" /> + <rect + style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901" + id="rect3336-9-4-98-1-8-7-3" + width="117.19617" + height="37.142868" + x="-623.65283" + y="-510.8382" + transform="scale(-1,-1)" /> + <rect + style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901" + id="rect3336-9-4-98-4-1-2" + width="72.800896" + height="37.142868" + x="-552.87671" + y="586.50995" + transform="matrix(0,-1,1,0,0,0)" /> + <rect + style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901" + id="rect3336-9-4-98-1-6-6-4" + width="118.51518" + height="37.142868" + x="-623.65283" + y="-567.37256" + transform="scale(-1,-1)" /> + </g> + <g + transform="translate(0,433.23832)" + id="g4351-1"> + <rect + style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901" + id="rect3336-9-4-98-4-15" + width="85.427803" + height="37.142868" + x="-502.58875" + y="506.45667" + transform="matrix(0,-1,1,0,0,0)" /> + <rect + style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901" + id="rect3336-9-4-98-1-6-64" + width="118.51518" + height="37.142868" + x="-624.97186" + y="-454.3038" + transform="scale(-1,-1)" /> + <rect + style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901" + id="rect3336-9-4-98-1-8-7-9" + width="117.19617" + height="37.142868" + x="-623.65283" + y="-510.8382" + transform="scale(-1,-1)" /> + <rect + style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901" + id="rect3336-9-4-98-4-1-5" + width="72.800896" + height="37.142868" + x="-552.87671" + y="586.50995" + transform="matrix(0,-1,1,0,0,0)" /> + <rect + style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:10.90200043;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.50243901" + id="rect3336-9-4-98-1-6-6-6" + width="118.51518" + height="37.142868" + x="-623.65283" + y="-567.37256" + transform="scale(-1,-1)" /> + </g> + </g> + </g> +</svg> Added: trunk/rosapps/applications/sysutils/fontsub/fontsub_res.rc URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/sysutils/font…
============================================================================== --- trunk/rosapps/applications/sysutils/fontsub/fontsub_res.rc (added) +++ trunk/rosapps/applications/sysutils/fontsub/fontsub_res.rc [iso-8859-1] Sat Mar 18 13:01:18 2017 @@ -0,0 +1,46 @@ +/* FontSub by Katayama Hirofumi MZ + * + * To the extent possible under law, the person who associated CC0 with + * FontSub has waived all copyright and related or neighboring rights + * to FontSub. + * + * You should have received a copy of the CC0 legalcode along with this + * work. If not, see <
http://creativecommons.org/publicdomain/zero/1.0/
>. + */ +#include <windef.h> +#include <winuser.h> +#include <dlgs.h> + +#include "resource.h" + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL + +#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Font Substitute Editor" +#define REACTOS_STR_INTERNAL_NAME "fontsub" +#define REACTOS_STR_ORIGINAL_FILENAME "fontsub.exe" +#include <reactos/version.rc> + +/* UTF-8 */ +#pragma code_page(65001) + +1 ICON "fontsub.ico" + +2 BITMAP "up.bmp" +3 BITMAP "down.bmp" +4 BITMAP "nil.bmp" + +#ifdef LANGUAGE_EN_US + #include "lang/en-US.rc" +#endif +#ifdef LANGUAGE_JA_JP + #include "lang/ja-JP.rc" +#endif + +1 ACCELERATORS +BEGIN + "O", ID_IMPORT, CONTROL, VIRTKEY + "S", ID_EXPORT, CONTROL, VIRTKEY + "N", ID_NEW, CONTROL, VIRTKEY + "L", ID_RELOAD, CONTROL, VIRTKEY + "U", ID_UPDATE_REGISTRY, CONTROL, VIRTKEY +END Propchange: trunk/rosapps/applications/sysutils/fontsub/fontsub_res.rc ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/rosapps/applications/sysutils/fontsub/lang/en-US.rc URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/sysutils/font…
============================================================================== --- trunk/rosapps/applications/sysutils/fontsub/lang/en-US.rc (added) +++ trunk/rosapps/applications/sysutils/fontsub/lang/en-US.rc [iso-8859-1] Sat Mar 18 13:01:18 2017 @@ -0,0 +1,106 @@ +/* FontSub by Katayama Hirofumi MZ + * + * To the extent possible under law, the person who associated CC0 with + * FontSub has waived all copyright and related or neighboring rights + * to FontSub. + * + * You should have received a copy of the CC0 legalcode along with this + * work. If not, see <
http://creativecommons.org/publicdomain/zero/1.0/
>. + */ + +/* UTF-8 */ +#pragma code_page(65001) + +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +1 MENU +BEGIN + POPUP "&File" + BEGIN + MENUITEM "&Import From...\tCtrl+O", ID_IMPORT + MENUITEM "&Export To...\tCtrl+S", ID_EXPORT + MENUITEM SEPARATOR + MENUITEM "Re&load from Registry\tCtrl+L", ID_RELOAD + MENUITEM "Update &Registry\tCtrl+U", ID_UPDATE_REGISTRY + MENUITEM SEPARATOR + MENUITEM "Open in Reg&edit", ID_OPEN_REGKEY + MENUITEM SEPARATOR + MENUITEM "E&xit\tAlt+F4", ID_EXIT + END + POPUP "&Edit" + BEGIN + MENUITEM "&New Item\tCtrl+N", ID_NEW + MENUITEM SEPARATOR + MENUITEM "&Edit Item\tEnter", ID_EDIT + MENUITEM SEPARATOR + MENUITEM "&Delete Item\tDel", ID_DELETE + END + POPUP "&Help" + BEGIN + MENUITEM "&About...", ID_ABOUT + END +END + +2 MENU +BEGIN + POPUP "Popup" + BEGIN + MENUITEM "&New Item\tCtrl+N", ID_NEW + MENUITEM SEPARATOR + MENUITEM "&Edit Item\tEnter", ID_EDIT + MENUITEM SEPARATOR + MENUITEM "&Delete Item\tDel", ID_DELETE + END +END + +STRINGTABLE +BEGIN + IDS_TITLE, "Font Substitutes Editor" + IDS_FONTNAME, "Font Name" + IDS_SUBSTITUTE, "Substitute" + IDS_ENTERNAME, "(Please enter a font name...)" + IDS_IMPORT, "Import" + IDS_EXPORT, "Export" + IDS_CANTIMPORT, "Could not import." + IDS_CANTEXPORT, "Could not export." + IDS_INPFILTER, "Registry Files (*.reg)|*.reg|All Files (*.*)|*.*|" + IDS_OUTFILTER, "Registry Files (*.reg)|*.reg|" + IDS_QUERYUPDATE, "Substitutes info has been modified. Update registry now?" + IDS_ALREADYEXISTS, "The same name already exists." + IDS_ENTERNAME2, "Enter the font name." + IDS_QUERYDELETE, "Do you really want to delete this item?" + IDS_CANTOPENKEY, "Could not open the registry key." + IDS_REBOOTNOW, "Registry was updated. Reboot Windows now?" + IDS_ABOUT, "FontSub (Font Substitute Editor) Version 0.5\r\nby Katayama Hirofumi MZ and The ReactOS Team\r\n\r\nThis software was released under CC0 1.0 license." +END + +IDD_ADD DIALOG 0, 0, 315, 65 +STYLE DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_CAPTION | WS_SYSMENU +CAPTION "Add Substitute Item" +FONT 10, "MS Shell Dlg" +BEGIN + CONTROL "Font &Name:", -1, "STATIC", SS_RIGHT | SS_CENTERIMAGE | WS_CHILD | WS_VISIBLE | WS_GROUP, 5, 5, 55, 15 + CONTROL "", cmb1, "ComboBoxEx32", CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 70, 6, 120, 120 + CONTROL "", cmb3, "ComboBoxEx32", CBS_DROPDOWNLIST | WS_HSCROLL | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 195, 6, 115, 120 + CONTROL "&Substitute:", -1, "STATIC", SS_RIGHT | SS_CENTERIMAGE | WS_CHILD | WS_VISIBLE | WS_GROUP, 5, 25, 55, 15 + CONTROL "", cmb2, "ComboBoxEx32", CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 70, 26, 120, 120 + CONTROL "", cmb4, "ComboBoxEx32", CBS_DROPDOWNLIST | WS_HSCROLL | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 195, 26, 115, 120 + CONTROL "OK", IDOK, "BUTTON", BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 175, 45, 60, 14 + CONTROL "Cancel", IDCANCEL, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 240, 45, 60, 14 +END + +IDD_EDIT DIALOG 0, 0, 315, 65 +STYLE DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_CAPTION | WS_SYSMENU +CAPTION "Edit Substitute Item" +FONT 10, "MS Shell Dlg" +BEGIN + CONTROL "Font &Name:", -1, "STATIC", SS_RIGHT | SS_CENTERIMAGE | WS_CHILD | WS_VISIBLE | WS_GROUP, 5, 5, 55, 15 + CONTROL "", edt1, "EDIT", ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_BORDER | WS_TABSTOP, 70, 6, 120, 14 + CONTROL "", cmb3, "ComboBoxEx32", CBS_DROPDOWNLIST | WS_HSCROLL | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 195, 6, 115, 120 + CONTROL "&Substitute:", -1, "STATIC", SS_RIGHT | SS_CENTERIMAGE | WS_CHILD | WS_VISIBLE | WS_GROUP, 5, 25, 55, 15 + CONTROL "", cmb2, "ComboBoxEx32", CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 70, 26, 120, 120 + CONTROL "", cmb4, "ComboBoxEx32", CBS_DROPDOWNLIST | WS_HSCROLL | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 195, 26, 115, 120 + CONTROL "OK", IDOK, "BUTTON", BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 175, 45, 60, 14 + CONTROL "Cancel", IDCANCEL, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 240, 45, 60, 14 + CONTROL "&Delete", psh1, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 5, 45, 60, 14 +END Propchange: trunk/rosapps/applications/sysutils/fontsub/lang/en-US.rc ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/rosapps/applications/sysutils/fontsub/lang/ja-JP.rc URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/sysutils/font…
============================================================================== --- trunk/rosapps/applications/sysutils/fontsub/lang/ja-JP.rc (added) +++ trunk/rosapps/applications/sysutils/fontsub/lang/ja-JP.rc [iso-8859-1] Sat Mar 18 13:01:18 2017 @@ -0,0 +1,106 @@ +/* FontSub by Katayama Hirofumi MZ + * + * To the extent possible under law, the person who associated CC0 with + * FontSub has waived all copyright and related or neighboring rights + * to FontSub. + * + * You should have received a copy of the CC0 legalcode along with this + * work. If not, see <
http://creativecommons.org/publicdomain/zero/1.0/
>. + */ + +/* UTF-8 */ +#pragma code_page(65001) + +LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT + +1 MENU +BEGIN + POPUP "ãã¡ã¤ã«(&F)" + BEGIN + MENUITEM "ã¤ã³ãã¼ã(&I)...\tCtrl+O", ID_IMPORT + MENUITEM "ã¨ã¯ã¹ãã¼ã(&E)...\tCtrl+S", ID_EXPORT + MENUITEM SEPARATOR + MENUITEM "ã¬ã¸ã¹ããªããåèªã¿è¾¼ã¿(&L)\tCtrl+L", ID_RELOAD + MENUITEM "ã¬ã¸ã¹ããªã®æ´æ°(&R)\tCtrl+U", ID_UPDATE_REGISTRY + MENUITEM SEPARATOR + MENUITEM "Regeditã§éã(&E)", ID_OPEN_REGKEY + MENUITEM SEPARATOR + MENUITEM "çµäº(&X)\tAlt+F4", ID_EXIT + END + POPUP "ç·¨é(&E)" + BEGIN + MENUITEM "æ°ããé ç®(&N)\tCtrl+N", ID_NEW + MENUITEM SEPARATOR + MENUITEM "é ç®ã®ç·¨é(&E)\tEnter", ID_EDIT + MENUITEM SEPARATOR + MENUITEM "é ç®ã®åé¤(&D)\tDel", ID_DELETE + END + POPUP "ãã«ã(&H)" + BEGIN + MENUITEM "ãã¼ã¸ã§ã³æ å ±(&A)...", ID_ABOUT + END +END + +2 MENU +BEGIN + POPUP "ãããã¢ãã" + BEGIN + MENUITEM "æ°ããé ç®(&N)\tCtrl+N", ID_NEW + MENUITEM SEPARATOR + MENUITEM "é ç®ã®ç·¨é(&E)\tEnter", ID_EDIT + MENUITEM SEPARATOR + MENUITEM "é ç®ã®åé¤(&D)\tDel", ID_DELETE + END +END + +STRINGTABLE +BEGIN + IDS_TITLE, "ãã©ã³ã代æ¿ã¨ãã£ã¿" + IDS_FONTNAME, "ãã©ã³ãå" + IDS_SUBSTITUTE, "代æ¿å" + IDS_ENTERNAME, "(ãã©ã³ãåãå ¥åãã¦ä¸ãã...)" + IDS_IMPORT, "ã¤ã³ãã¼ã" + IDS_EXPORT, "ã¨ã¯ã¹ãã¼ã" + IDS_CANTIMPORT, "ã¤ã³ãã¼ãã§ãã¾ããã" + IDS_CANTEXPORT, "ã¨ã¯ã¹ãã¼ãã§ãã¾ããã" + IDS_INPFILTER, "ã¬ã¸ã¹ã㪠ãã¡ã¤ã« (*.reg)|*.reg|ãã¹ã¦ã®ãã¡ã¤ã« (*.*)|*.*|" + IDS_OUTFILTER, "ã¬ã¸ã¹ã㪠ãã¡ã¤ã« (*.reg)|*.reg|" + IDS_QUERYUPDATE, "代æ¿æ å ±ã¯å¤æ´ããã¦ãã¾ããã¬ã¸ã¹ããªãæ´æ°ãã¾ããï¼" + IDS_ALREADYEXISTS, "ãã§ã«åãååãåå¨ãã¾ãã" + IDS_ENTERNAME2, "ãã©ã³ãåãå ¥åãã¦ä¸ããã" + IDS_QUERYDELETE, "æ¬å½ã«ãã®é ç®ãåé¤ãããã§ããï¼" + IDS_CANTOPENKEY, "ã¬ã¸ã¹ããªãã¼ãéãã¾ããã§ããã" + IDS_REBOOTNOW, "ã¬ã¸ã¹ããªãæ´æ°ããã¾ãããWindowsãåèµ·åãã¾ããï¼" + IDS_ABOUT, "FontSub (Font Substitute Editor) Version 0.5\r\nby Katayama Hirofumi MZ and The ReactOS Team\r\n\r\nThis software was released under CC0 1.0 license." +END + +IDD_ADD DIALOG 0, 0, 315, 65 +STYLE DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_CAPTION | WS_SYSMENU +CAPTION "代æ¿é ç®ã追å ãã" +FONT 10, "MS UI Gothic" +BEGIN + CONTROL "ãã©ã³ãå(&N):", -1, "STATIC", SS_RIGHT | SS_CENTERIMAGE | WS_CHILD | WS_VISIBLE | WS_GROUP, 5, 5, 55, 15 + CONTROL "", cmb1, "ComboBoxEx32", CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 70, 6, 120, 120 + CONTROL "", cmb3, "ComboBoxEx32", CBS_DROPDOWNLIST | WS_HSCROLL | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 195, 6, 115, 120 + CONTROL "代æ¿å(&S):", -1, "STATIC", SS_RIGHT | SS_CENTERIMAGE | WS_CHILD | WS_VISIBLE | WS_GROUP, 5, 25, 55, 15 + CONTROL "", cmb2, "ComboBoxEx32", CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 70, 26, 120, 120 + CONTROL "", cmb4, "ComboBoxEx32", CBS_DROPDOWNLIST | WS_HSCROLL | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 195, 26, 115, 120 + CONTROL "OK", IDOK, "BUTTON", BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 175, 45, 60, 14 + CONTROL "ãã£ã³ã»ã«", IDCANCEL, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 240, 45, 60, 14 +END + +IDD_EDIT DIALOG 0, 0, 315, 65 +STYLE DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_CAPTION | WS_SYSMENU +CAPTION "代æ¿é ç®ãç·¨éãã" +FONT 10, "MS UI Gothic" +BEGIN + CONTROL "ãã©ã³ãå(&N):", -1, "STATIC", SS_RIGHT | SS_CENTERIMAGE | WS_CHILD | WS_VISIBLE | WS_GROUP, 5, 5, 55, 15 + CONTROL "", edt1, "EDIT", ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_BORDER | WS_TABSTOP, 70, 6, 120, 14 + CONTROL "", cmb3, "ComboBoxEx32", CBS_DROPDOWNLIST | WS_HSCROLL | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 195, 6, 115, 120 + CONTROL "代æ¿å(&S):", -1, "STATIC", SS_RIGHT | SS_CENTERIMAGE | WS_CHILD | WS_VISIBLE | WS_GROUP, 5, 25, 55, 15 + CONTROL "", cmb2, "ComboBoxEx32", CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 70, 26, 120, 120 + CONTROL "", cmb4, "ComboBoxEx32", CBS_DROPDOWNLIST | WS_HSCROLL | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 195, 26, 115, 120 + CONTROL "OK", IDOK, "BUTTON", BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 175, 45, 60, 14 + CONTROL "ãã£ã³ã»ã«", IDCANCEL, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 240, 45, 60, 14 + CONTROL "åé¤(&D)", psh1, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 5, 45, 60, 14 +END Propchange: trunk/rosapps/applications/sysutils/fontsub/lang/ja-JP.rc ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/rosapps/applications/sysutils/fontsub/nil.bmp URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/sysutils/font…
============================================================================== Binary file - no diff available. Propchange: trunk/rosapps/applications/sysutils/fontsub/nil.bmp ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: trunk/rosapps/applications/sysutils/fontsub/resource.h URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/sysutils/font…
============================================================================== --- trunk/rosapps/applications/sysutils/fontsub/resource.h (added) +++ trunk/rosapps/applications/sysutils/fontsub/resource.h [iso-8859-1] Sat Mar 18 13:01:18 2017 @@ -0,0 +1,40 @@ +/* FontSub by Katayama Hirofumi MZ + * + * To the extent possible under law, the person who associated CC0 with + * FontSub has waived all copyright and related or neighboring rights + * to FontSub. + * + * You should have received a copy of the CC0 legalcode along with this + * work. If not, see <
http://creativecommons.org/publicdomain/zero/1.0/
>. + */ +#define ID_NEW 100 +#define ID_EDIT 101 +#define ID_EXIT 102 +#define ID_UPDATE_REGISTRY 103 +#define ID_DELETE 104 +#define ID_IMPORT 105 +#define ID_EXPORT 106 +#define ID_RELOAD 107 +#define ID_ABOUT 108 +#define ID_OPEN_REGKEY 109 + +#define IDD_ADD 1 +#define IDD_EDIT 2 + +#define IDS_TITLE 1 +#define IDS_FONTNAME 2 +#define IDS_SUBSTITUTE 3 +#define IDS_ENTERNAME 4 +#define IDS_IMPORT 5 +#define IDS_EXPORT 6 +#define IDS_CANTIMPORT 7 +#define IDS_CANTEXPORT 8 +#define IDS_INPFILTER 9 +#define IDS_OUTFILTER 10 +#define IDS_QUERYUPDATE 11 +#define IDS_ALREADYEXISTS 12 +#define IDS_ENTERNAME2 13 +#define IDS_QUERYDELETE 14 +#define IDS_CANTOPENKEY 15 +#define IDS_REBOOTNOW 16 +#define IDS_ABOUT 17 Propchange: trunk/rosapps/applications/sysutils/fontsub/resource.h ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/rosapps/applications/sysutils/fontsub/up.bmp URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/sysutils/font…
============================================================================== Binary file - no diff available. Propchange: trunk/rosapps/applications/sysutils/fontsub/up.bmp ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream
7 years, 9 months
1
0
0
0
[mjansen] 74186: [REGEDIT] Fix regedit not showing it's main window when loading view settings fail. CORE-12749
by mjansen@svn.reactos.org
Author: mjansen Date: Sat Mar 18 12:54:43 2017 New Revision: 74186 URL:
http://svn.reactos.org/svn/reactos?rev=74186&view=rev
Log: [REGEDIT] Fix regedit not showing it's main window when loading view settings fail. CORE-12749 Modified: trunk/reactos/base/applications/regedit/settings.c Modified: trunk/reactos/base/applications/regedit/settings.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/regedit/…
============================================================================== --- trunk/reactos/base/applications/regedit/settings.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/regedit/settings.c [iso-8859-1] Sat Mar 18 12:54:43 2017 @@ -67,6 +67,7 @@ { RegistryBinaryConfig tConfig; DWORD iBufferSize = sizeof(tConfig); + BOOL bVisible = FALSE; if (RegQueryValueExW(hKey, L"View", NULL, NULL, (LPBYTE)&tConfig, &iBufferSize) == ERROR_SUCCESS) { @@ -90,11 +91,13 @@ /* Apply program window settings */ tConfig.tPlacement.length = sizeof(WINDOWPLACEMENT); - if (SetWindowPlacement(hFrameWnd, &tConfig.tPlacement) == FALSE) - /* In case we fail, show normal */ - ShowWindow(hFrameWnd, SW_SHOWNORMAL); + bVisible = SetWindowPlacement(hFrameWnd, &tConfig.tPlacement); } } + + /* In case we fail to restore the window, or open the key, show normal */ + if (!bVisible) + ShowWindow(hFrameWnd, SW_SHOWNORMAL); /* Restore key position */ if (QueryStringValue(HKEY_CURRENT_USER, g_szGeneralRegKey, L"LastKey", szBuffer, COUNT_OF(szBuffer)) == ERROR_SUCCESS) @@ -102,7 +105,7 @@ SelectNode(g_pChildWnd->hTreeWnd, szBuffer); } - RegCloseKey(hKey); + RegCloseKey(hKey); } else {
7 years, 9 months
1
0
0
0
[mjansen] 74185: [SDK] Add WM_CONTEXTMENU handler to WindowsX.h CORE-12749
by mjansen@svn.reactos.org
Author: mjansen Date: Sat Mar 18 12:24:16 2017 New Revision: 74185 URL:
http://svn.reactos.org/svn/reactos?rev=74185&view=rev
Log: [SDK] Add WM_CONTEXTMENU handler to WindowsX.h CORE-12749 Modified: trunk/reactos/sdk/include/psdk/windowsx.h Modified: trunk/reactos/sdk/include/psdk/windowsx.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/psdk/windowsx.…
============================================================================== --- trunk/reactos/sdk/include/psdk/windowsx.h [iso-8859-1] (original) +++ trunk/reactos/sdk/include/psdk/windowsx.h [iso-8859-1] Sat Mar 18 12:24:16 2017 @@ -309,6 +309,7 @@ #define HANDLE_WM_COMMNOTIFY(hwnd,wParam,lParam,fn) ((fn)((hwnd),(int)(wParam),(UINT)LOWORD(lParam)),0) #define HANDLE_WM_COMPACTING(hwnd,wParam,lParam,fn) ((fn)((hwnd),(UINT)(wParam)),0) #define HANDLE_WM_COMPAREITEM(hwnd,wParam,lParam,fn) (LRESULT)(DWORD)(int)(fn)((hwnd),(const COMPAREITEMSTRUCT*)(lParam)) +#define HANDLE_WM_CONTEXTMENU(hwnd,wParam,lParam,fn) ((fn)((hwnd),(HWND)(wParam),(UINT)GET_X_LPARAM(lParam),(UINT)GET_Y_LPARAM(lParam))) #define HANDLE_WM_COPY(hwnd,wParam,lParam,fn) ((fn)(hwnd),0) #define HANDLE_WM_CREATE(hwnd,wParam,lParam,fn) ((fn)((hwnd),(LPCREATESTRUCT)(lParam)) ? 0 : (LRESULT)-1L) #define HANDLE_WM_CTLCOLORBTN(hwnd,wParam,lParam,fn) (LRESULT)(DWORD)(UINT)(HBRUSH)(fn)((hwnd),(HDC)(wParam),(HWND)(lParam),CTLCOLOR_BTN)
7 years, 9 months
1
0
0
0
[tfaber] 74184: [BOOTLIB] - Avoid an uninitialized variable in BlpDisplayReinitialize. Patch by Victor Martinez Calvo. CID 1363648. CORE-11692 #resolve
by tfaber@svn.reactos.org
Author: tfaber Date: Fri Mar 17 14:11:03 2017 New Revision: 74184 URL:
http://svn.reactos.org/svn/reactos?rev=74184&view=rev
Log: [BOOTLIB] - Avoid an uninitialized variable in BlpDisplayReinitialize. Patch by Victor Martinez Calvo. CID 1363648. CORE-11692 #resolve Modified: trunk/reactos/boot/environ/lib/io/display/display.c Modified: trunk/reactos/boot/environ/lib/io/display/display.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/io/displa…
============================================================================== --- trunk/reactos/boot/environ/lib/io/display/display.c [iso-8859-1] (original) +++ trunk/reactos/boot/environ/lib/io/display/display.c [iso-8859-1] Fri Mar 17 14:11:03 2017 @@ -547,7 +547,7 @@ VOID ) { - NTSTATUS Status; + NTSTATUS Status = STATUS_SUCCESS; PBL_TEXT_CONSOLE TextConsole; PBL_INPUT_CONSOLE InputConsole;
7 years, 9 months
1
0
0
0
[ekohl] 74183: [FONTVIEW] Implement fontview /p parameter support. Patch by amber. Patch was slightly modified by me in order to open the print dialog automatically. CORE-12944 #resolve #comment Th...
by ekohl@svn.reactos.org
Author: ekohl Date: Thu Mar 16 23:36:08 2017 New Revision: 74183 URL:
http://svn.reactos.org/svn/reactos?rev=74183&view=rev
Log: [FONTVIEW] Implement fontview /p parameter support. Patch by amber. Patch was slightly modified by me in order to open the print dialog automatically. CORE-12944 #resolve #comment Thanks a lot! Modified: trunk/reactos/base/applications/fontview/fontview.c Modified: trunk/reactos/base/applications/fontview/fontview.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/fontview…
============================================================================== --- trunk/reactos/base/applications/fontview/fontview.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/fontview/fontview.c [iso-8859-1] Thu Mar 16 23:36:08 2017 @@ -37,6 +37,7 @@ LOGFONTW g_LogFonts[64]; LPCWSTR g_fileName; WCHAR g_FontTitle[1024] = L""; +BOOL g_FontPrint = FALSE; static const WCHAR g_szFontViewClassName[] = L"FontViewWClass"; @@ -156,7 +157,24 @@ else { /* Try to add the font resource from command line */ - fileName = argv[1]; +// fileName = argv[1]; + if (argc == 2) + { + fileName = argv[1]; + } + else + { + /* Windows fontview supports the /p option, which displays print dialog */ + fileName = argv[2]; + if (wcscmp(argv[1], L"/p") == 0) + { + g_FontPrint = TRUE; + } + else + { + fileName = argv[1]; + } + } g_fileName = fileName; } @@ -361,6 +379,9 @@ SendMessage(hDisplay, FVM_SETTYPEFACE, 0, (LPARAM)&g_LogFonts[g_FontIndex]); ShowWindow(hDisplay, SW_SHOWNORMAL); + if (g_FontPrint) + PostMessage(hwnd, WM_COMMAND, IDC_PRINT, 0); + return 0; }
7 years, 9 months
1
0
0
0
[hbelusca] 74182: Tag the CLT-2017 release!
by hbelusca@svn.reactos.org
Author: hbelusca Date: Thu Mar 16 21:51:51 2017 New Revision: 74182 URL:
http://svn.reactos.org/svn/reactos?rev=74182&view=rev
Log: Tag the CLT-2017 release! Added: tags/ReactOS-0.4.4-CLT2017/ (props changed) - copied from r74181, branches/ReactOS-0.4.4-CLT2017/ Removed: branches/ReactOS-0.4.4-CLT2017/ Propchange: tags/ReactOS-0.4.4-CLT2017/ ------------------------------------------------------------------------------ --- svn:mergeinfo (added) +++ svn:mergeinfo Thu Mar 16 21:51:51 2017 @@ -0,0 +1 @@ +/branches/colins-printing-for-freedom:67543-68405,68407-68414,68417-70595
7 years, 9 months
1
0
0
0
[sgasiorek] 74181: [DXG] Implement DxDdCanCreateSurface and DxDdCanCreateD3DBuffer. Reorganisation of code - put functions in the same filenames as in ntddraw CORE-4490
by sgasiorek@svn.reactos.org
Author: sgasiorek Date: Thu Mar 16 14:37:27 2017 New Revision: 74181 URL:
http://svn.reactos.org/svn/reactos?rev=74181&view=rev
Log: [DXG] Implement DxDdCanCreateSurface and DxDdCanCreateD3DBuffer. Reorganisation of code - put functions in the same filenames as in ntddraw CORE-4490 Added: trunk/reactos/win32ss/reactx/dxg/d3d.c (with props) trunk/reactos/win32ss/reactx/dxg/dd.c (with props) trunk/reactos/win32ss/reactx/dxg/ddraw.c (with props) Modified: trunk/reactos/win32ss/reactx/dxg/CMakeLists.txt trunk/reactos/win32ss/reactx/dxg/ddhmg.c trunk/reactos/win32ss/reactx/dxg/dxg_driver.h trunk/reactos/win32ss/reactx/dxg/dxg_int.h trunk/reactos/win32ss/reactx/dxg/eng.c Modified: trunk/reactos/win32ss/reactx/dxg/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/reactx/dxg/CMakeLi…
============================================================================== --- trunk/reactos/win32ss/reactx/dxg/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/win32ss/reactx/dxg/CMakeLists.txt [iso-8859-1] Thu Mar 16 14:37:27 2017 @@ -4,6 +4,9 @@ list(APPEND SOURCE main.c ddhmg.c + d3d.c + dd.c + ddraw.c eng.c historic.c dxg_int.h) Added: trunk/reactos/win32ss/reactx/dxg/d3d.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/reactx/dxg/d3d.c?r…
============================================================================== --- trunk/reactos/win32ss/reactx/dxg/d3d.c (added) +++ trunk/reactos/win32ss/reactx/dxg/d3d.c [iso-8859-1] Thu Mar 16 14:37:27 2017 @@ -0,0 +1,39 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * PURPOSE: Native driver for dxg implementation + * FILE: win32ss/reactx/dxg/d3d.c + * PROGRAMER: Sebastian Gasiorek (sebastian.gasiorek(a)reactos.org) + */ + +#include <string.h> +#include <dxg_int.h> + +DWORD +NTAPI +DxDdCanCreateD3DBuffer( + HANDLE DdHandle, + PDD_CANCREATESURFACEDATA SurfaceData) +{ + PEDD_DIRECTDRAW_LOCAL peDdL; + PEDD_DIRECTDRAW_GLOBAL peDdGl; + DWORD RetVal = DDHAL_DRIVER_NOTHANDLED; + + peDdL = (PEDD_DIRECTDRAW_LOCAL)DdHmgLock(DdHandle, ObjType_DDLOCAL_TYPE, FALSE); + if (!peDdL) + return RetVal; + + peDdGl = peDdL->peDirectDrawGlobal2; + gpEngFuncs.DxEngLockHdev(peDdGl->hDev); + + // assign out DirectDrawGlobal to SurfaceData + SurfaceData->lpDD = (PDD_DIRECTDRAW_GLOBAL)peDdGl; + + if (peDdGl->d3dBufCallbacks.CanCreateD3DBuffer) + RetVal = peDdGl->d3dBufCallbacks.CanCreateD3DBuffer(SurfaceData); + + gpEngFuncs.DxEngUnlockHdev(peDdGl->hDev); + InterlockedDecrement((VOID*)&peDdL->pobj.cExclusiveLock); + + return RetVal; +} Propchange: trunk/reactos/win32ss/reactx/dxg/d3d.c ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/reactos/win32ss/reactx/dxg/dd.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/reactx/dxg/dd.c?re…
============================================================================== --- trunk/reactos/win32ss/reactx/dxg/dd.c (added) +++ trunk/reactos/win32ss/reactx/dxg/dd.c [iso-8859-1] Thu Mar 16 14:37:27 2017 @@ -0,0 +1,40 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * PURPOSE: Native driver for dxg implementation + * FILE: win32ss/reactx/dxg/dd.c + * PROGRAMER: Sebastian Gasiorek (sebastian.gasiorek(a)reactos.org) + */ + +#include <dxg_int.h> + +DWORD +NTAPI +DxDdCanCreateSurface( + HANDLE DdHandle, + PDD_CANCREATESURFACEDATA SurfaceData) +{ + PEDD_DIRECTDRAW_LOCAL peDdL; + PEDD_DIRECTDRAW_GLOBAL peDdGl; + DWORD RetVal = DDHAL_DRIVER_NOTHANDLED; + + peDdL = (PEDD_DIRECTDRAW_LOCAL)DdHmgLock(DdHandle, ObjType_DDLOCAL_TYPE, FALSE); + if (!peDdL) + return RetVal; + + peDdGl = peDdL->peDirectDrawGlobal2; + gpEngFuncs.DxEngLockHdev(peDdGl->hDev); + + // assign out DirectDrawGlobal to SurfaceData + SurfaceData->lpDD = (PDD_DIRECTDRAW_GLOBAL)peDdGl; + + if (peDdGl->ddCallbacks.dwFlags && DDHAL_CB32_CANCREATESURFACE) + { + RetVal = peDdGl->ddCallbacks.CanCreateSurface(SurfaceData); + } + + gpEngFuncs.DxEngUnlockHdev(peDdGl->hDev); + InterlockedDecrement((VOID*)&peDdL->pobj.cExclusiveLock); + + return RetVal; +} Propchange: trunk/reactos/win32ss/reactx/dxg/dd.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/win32ss/reactx/dxg/ddhmg.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/reactx/dxg/ddhmg.c…
============================================================================== --- trunk/reactos/win32ss/reactx/dxg/ddhmg.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/reactx/dxg/ddhmg.c [iso-8859-1] Thu Mar 16 14:37:27 2017 @@ -4,6 +4,7 @@ * PURPOSE: Native driver for dxg implementation * FILE: win32ss/reactx/dxg/ddhmg.c * PROGRAMER: Magnus olsen (magnus(a)greatlord.com) + * Sebastian Gasiorek (sebastian.gasiorek(a)reactos.org) * REVISION HISTORY: * 30/12-2007 Magnus Olsen */ Added: trunk/reactos/win32ss/reactx/dxg/ddraw.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/reactx/dxg/ddraw.c…
============================================================================== --- trunk/reactos/win32ss/reactx/dxg/ddraw.c (added) +++ trunk/reactos/win32ss/reactx/dxg/ddraw.c [iso-8859-1] Thu Mar 16 14:37:27 2017 @@ -0,0 +1,583 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * PURPOSE: Native driver for dxg implementation + * FILE: win32ss/reactx/dxg/eng.c + * PROGRAMER: Magnus olsen (magnus(a)greatlord.com) + * Sebastian Gasiorek (sebastian.gasiorek(a)reactos.org) + * REVISION HISTORY: + * 30/12-2007 Magnus Olsen + */ + +#include <dxg_int.h> + +/*++ +* @name intDdGetDriverInfo +* @implemented +* +* The function intDdGetDriverInfo is used internally in dxg.sys +* It retrieves driver information structures +* +* @param PEDD_DIRECTDRAW_GLOBAL peDdGl +* DirectDraw global structure +* +* @param GUID guid +* GUID of InfoData to read +* +* @param PVOID callbackStruct +* Callback structure pointer +* +* @param ULONG callbackSize +* Size of allocated callback structure +* +* @param ULONG *returnSize +* Desired structure size returned by driver +* +* @return +* Returns true on successful execution, false when error. +* +* @remarks. +* Only used internally in dxg.sys +*--*/ +BOOL intDdGetDriverInfo(PEDD_DIRECTDRAW_GLOBAL peDdGl, GUID guid, PVOID callbackStruct, ULONG callbackSize, ULONG *returnSize) +{ + DD_GETDRIVERINFODATA ddGetDriverInfoData; + + if (peDdGl->ddHalInfo.dwFlags & DDHALINFO_GETDRIVERINFOSET && peDdGl->ddHalInfo.GetDriverInfo) + { + memset(&ddGetDriverInfoData, 0, sizeof(DD_GETDRIVERINFODATA)); + ddGetDriverInfoData.dwSize = sizeof(DD_GETDRIVERINFODATA); + ddGetDriverInfoData.dhpdev = peDdGl->dhpdev; + memcpy(&ddGetDriverInfoData.guidInfo, &guid, sizeof(GUID)); + ddGetDriverInfoData.dwExpectedSize = callbackSize; + ddGetDriverInfoData.lpvData = callbackStruct; + ddGetDriverInfoData.ddRVal = DDERR_CURRENTLYNOTAVAIL; + if (peDdGl->ddHalInfo.GetDriverInfo(&ddGetDriverInfoData) && !ddGetDriverInfoData.ddRVal) + { + if (returnSize) + *returnSize = ddGetDriverInfoData.dwActualSize; + return TRUE; + } + + } + + /* cleanup on error */ + memset(callbackStruct, 0, callbackSize); + if (returnSize) + *returnSize = 0; + return FALSE; +} + +/*++ +* @name intDdGetAllDriverInfo +* @implemented +* +* The function intDdGetAllDriverInfo is used internally in dxg.sys +* It retrieves all possible driver information structures +* +* @param PEDD_DIRECTDRAW_GLOBAL peDdGl +* Pointer to destination DirectDrawGlobal structure +* +* @remarks. +* Only used internally in dxg.sys +* Missing some callbacks (VideoPort, DxApi, AGP) +*--*/ +VOID intDdGetAllDriverInfo(PEDD_DIRECTDRAW_GLOBAL peDdGl) +{ + if (peDdGl->ddHalInfo.GetDriverInfo && peDdGl->ddHalInfo.dwFlags & DDHALINFO_GETDRIVERINFOSET) + { + intDdGetDriverInfo(peDdGl, GUID_KernelCaps, &peDdGl->ddKernelCaps, sizeof(peDdGl->ddKernelCaps), 0); + intDdGetDriverInfo(peDdGl, GUID_KernelCallbacks, &peDdGl->ddKernelCallbacks, sizeof(peDdGl->ddKernelCallbacks), 0); + + if (intDdGetDriverInfo(peDdGl, GUID_D3DCallbacks3, &peDdGl->d3dNtHalCallbacks3, sizeof(peDdGl->d3dNtHalCallbacks3), 0)) + peDdGl->dwCallbackFlags |= EDDDGBL_D3DCALLBACKS3; + + if (intDdGetDriverInfo(peDdGl, GUID_ColorControlCallbacks, &peDdGl->ddColorControlCallbacks, sizeof(peDdGl->ddColorControlCallbacks), 0)) + peDdGl->dwCallbackFlags |= EDDDGBL_COLORCONTROLCALLBACKS; + + if (intDdGetDriverInfo(peDdGl, GUID_MiscellaneousCallbacks, &peDdGl->ddMiscellanousCallbacks, sizeof(peDdGl->ddMiscellanousCallbacks), 0)) + peDdGl->dwCallbackFlags |= EDDDGBL_MISCCALLBACKS; + + if (intDdGetDriverInfo(peDdGl, GUID_Miscellaneous2Callbacks, &peDdGl->ddMiscellanous2Callbacks, sizeof(peDdGl->ddMiscellanous2Callbacks), 0)) + peDdGl->dwCallbackFlags |= EDDDGBL_MISC2CALLBACKS; + + if (intDdGetDriverInfo(peDdGl, GUID_NTCallbacks, &peDdGl->ddNtCallbacks, sizeof(peDdGl->ddNtCallbacks), 0) ) + peDdGl->dwCallbackFlags |= EDDDGBL_NTCALLBACKS; + + if (intDdGetDriverInfo(peDdGl, GUID_DDMoreCaps, &peDdGl->ddMoreCaps, sizeof(peDdGl->ddMoreCaps), 0) ) + peDdGl->dwCallbackFlags |= EDDDGBL_DDMORECAPS; + + if (intDdGetDriverInfo(peDdGl, GUID_NTPrivateDriverCaps, &peDdGl->ddNtPrivateDriverCaps, sizeof(peDdGl->ddNtPrivateDriverCaps), 0) ) + peDdGl->dwCallbackFlags |= EDDDGBL_PRIVATEDRIVERCAPS; + + if (intDdGetDriverInfo(peDdGl, GUID_MotionCompCallbacks, &peDdGl->ddMotionCompCallbacks, sizeof(peDdGl->ddMotionCompCallbacks), 0) ) + peDdGl->dwCallbackFlags |= EDDDGBL_MOTIONCOMPCALLBACKS; + } +} + +/*++ +* @name intDdEnableDriver +* @implemented +* +* The function intDdEnableDriver is used internally in dxg.sys +* Fills in all EDD_DIRECTDRAW_GLOBAL structures and enables DirectDraw acceleration when possible +* +* @param PEDD_DIRECTDRAW_GLOBAL peDdGl +* Pointer to destination DirectDrawGlobal structure +* +* @remarks. +* Only used internally in dxg.sys +*--*/ +VOID intDdEnableDriver(PEDD_DIRECTDRAW_GLOBAL peDdGl) +{ + PDRIVER_FUNCTIONS DriverFunctions; + LPD3DNTHAL_GLOBALDRIVERDATA GlobalDriverData; + LPD3DNTHAL_CALLBACKS HalCallbacks; + PDD_D3DBUFCALLBACKS D3DBufCallbacks; + + + gpEngFuncs.DxEngLockHdev(peDdGl->hDev); + DriverFunctions = (PDRIVER_FUNCTIONS)gpEngFuncs.DxEngGetHdevData(peDdGl->hDev, DxEGShDevData_DrvFuncs); + + // check if driver has DirectDraw functions + if ((!DriverFunctions->GetDirectDrawInfo)||(!DriverFunctions->EnableDirectDraw)||(!DriverFunctions->DisableDirectDraw)) + peDdGl->dhpdev = 0; + + + // reset acceleration flag + peDdGl->fl = peDdGl->fl & 0xFFFFFFFE; + + // ask for structure sizes + if ((peDdGl->dhpdev)&&(DriverFunctions->GetDirectDrawInfo(peDdGl->dhpdev, &peDdGl->ddHalInfo, &peDdGl->dwNumHeaps, NULL, &peDdGl->dwNumFourCC, NULL))) + { + // allocate memory for DX data + if (peDdGl->dwNumHeaps) + peDdGl->pvmList = EngAllocMem(FL_ZERO_MEMORY, peDdGl->dwNumHeaps*sizeof(VIDEOMEMORY), TAG_GDDV); + if (peDdGl->dwNumFourCC) + peDdGl->pdwFourCC = EngAllocMem(FL_ZERO_MEMORY, peDdGl->dwNumFourCC * 4, TAG_GDDF); + + // get data from driver + if (!DriverFunctions->GetDirectDrawInfo(peDdGl->dhpdev, &peDdGl->ddHalInfo, &peDdGl->dwNumHeaps, peDdGl->pvmList, &peDdGl->dwNumFourCC, peDdGl->pdwFourCC)) + { + // failed - cleanup and exit + if (peDdGl->pvmList) + EngFreeMem(peDdGl->pvmList); + if (peDdGl->pdwFourCC) + EngFreeMem(peDdGl->pdwFourCC); + gpEngFuncs.DxEngUnlockHdev(peDdGl->hDev); + return; + } + + // check if we can enable DirectDraw acceleration + if ((peDdGl->ddHalInfo.vmiData.pvPrimary) && + (DriverFunctions->EnableDirectDraw(peDdGl->dhpdev, &peDdGl->ddCallbacks, &peDdGl->ddSurfaceCallbacks, &peDdGl->ddPaletteCallbacks))&& + !(gpEngFuncs.DxEngGetHdevData(peDdGl->hDev, DxEGShDevData_dd_flags) & CapOver_DisableD3DAccel)&& + (peDdGl->ddHalInfo.dwSize == sizeof(DD_HALINFO))) + { + GlobalDriverData = peDdGl->ddHalInfo.lpD3DGlobalDriverData; + HalCallbacks = peDdGl->ddHalInfo.lpD3DHALCallbacks; + D3DBufCallbacks = peDdGl->ddHalInfo.lpD3DHALCallbacks; + + if (GlobalDriverData && GlobalDriverData->dwSize == sizeof(D3DNTHAL_GLOBALDRIVERDATA)) + memcpy(&peDdGl->d3dNtGlobalDriverData, GlobalDriverData, sizeof(D3DNTHAL_GLOBALDRIVERDATA)); + + if (HalCallbacks && HalCallbacks->dwSize == sizeof(D3DNTHAL_CALLBACKS)) + memcpy(&peDdGl->d3dNtHalCallbacks, HalCallbacks, sizeof(D3DNTHAL_CALLBACKS)); + + if (D3DBufCallbacks && D3DBufCallbacks->dwSize == sizeof(DD_D3DBUFCALLBACKS)) + memcpy(&peDdGl->d3dBufCallbacks, D3DBufCallbacks, sizeof(DD_D3DBUFCALLBACKS)); + + intDdGetAllDriverInfo(peDdGl); + + // enable DirectDraw acceleration + peDdGl->fl |= 1; + } + else + { + // failed - cleanup and exit + if (peDdGl->pvmList) + EngFreeMem(peDdGl->pvmList); + if (peDdGl->pdwFourCC) + EngFreeMem(peDdGl->pdwFourCC); + } + } + + gpEngFuncs.DxEngUnlockHdev(peDdGl->hDev); +} + +PVOID +FASTCALL +intDdCreateDirectDrawLocal(HDEV hDev) +{ + PEDD_DIRECTDRAW_GLOBAL peDdGl = NULL; + PEDD_DIRECTDRAW_LOCAL peDdL = NULL; + PDD_ENTRY AllocRet; + + peDdGl = (PEDD_DIRECTDRAW_GLOBAL)gpEngFuncs.DxEngGetHdevData(hDev, DxEGShDevData_eddg); + + AllocRet = DdHmgAlloc(sizeof(EDD_DIRECTDRAW_LOCAL), ObjType_DDLOCAL_TYPE, TRUE); + if (!AllocRet) + return NULL; + + peDdL = (PEDD_DIRECTDRAW_LOCAL)AllocRet->pobj; + + /* initialize DIRECTDRAW_LOCAL */ + peDdL->peDirectDrawLocal_prev = peDdGl->peDirectDrawLocalList; + peDdL->UniqueProcess = PsGetCurrentThreadProcessId(); + peDdL->Process = PsGetCurrentProcess(); + + // link DirectDrawGlobal and DirectDrawLocal + peDdGl->peDirectDrawLocalList = peDdL; + peDdL->peDirectDrawGlobal = peDdGl; + peDdL->peDirectDrawGlobal2 = peDdGl; + + gpEngFuncs.DxEngReferenceHdev(hDev); + + InterlockedExchangeAdd((LONG*)&peDdL->pobj.cExclusiveLock, 0xFFFFFFFF); + + return peDdL->pobj.hHmgr; +} + +/*++ +* @name DxDdCreateDirectDrawObject +* @implemented +* +* Function creates new DirectDraw object +* +* @param HDC hDC +* Device context handle +* +* @return +* Newly created DirectDraw object handle. +* +* @remarks. +* Missing all AGP stuff +*--*/ +DWORD +NTAPI +DxDdCreateDirectDrawObject( + HDC hDC) +{ + PDC pDC = NULL; + HDEV hDev = NULL; + DWORD retVal = 0; + + pDC = gpEngFuncs.DxEngLockDC(hDC); + if (!pDC) + return 0; + + // get driver hDev from DC + hDev = (HDEV)gpEngFuncs.DxEngGetDCState(hDC, 3); + if (!hDev) { + gpEngFuncs.DxEngUnlockDC(pDC); + return 0; + } + + // is this primary display? + if (!gpEngFuncs.DxEngGetHdevData(hDev, DxEGShDevData_display)) + { + gpEngFuncs.DxEngUnlockDC(pDC); + return 0; + } + + gpEngFuncs.DxEngLockHdev(hDev); + + // create object only for 8BPP and more + if (gpEngFuncs.DxEngGetHdevData(hDev, DxEGShDevData_DitherFmt) >= BMF_8BPP) + retVal = (DWORD)intDdCreateDirectDrawLocal(hDev); + + gpEngFuncs.DxEngUnlockHdev(hDev); + gpEngFuncs.DxEngUnlockDC(pDC); + return retVal; +} + + +/*++ +* @name DxDdGetDriverInfo +* @implemented +* +* Function queries the driver for DirectDraw and Direct3D functionality +* +* @param HANDLE DdHandle +* Handle to DirectDraw object +* +* @param PDD_GETDRIVERINFODATA drvInfoData +* Pointer to in/out driver info data structure +*--*/ +DWORD +NTAPI +DxDdGetDriverInfo(HANDLE DdHandle, PDD_GETDRIVERINFODATA drvInfoData) +{ + PEDD_DIRECTDRAW_LOCAL peDdL; + PEDD_DIRECTDRAW_GLOBAL peDdGl; + PVOID pInfo = NULL; + DWORD dwInfoSize = 0; + BYTE callbackStruct[1024]; + DWORD RetVal = FALSE; + + peDdL = (PEDD_DIRECTDRAW_LOCAL)DdHmgLock(DdHandle, ObjType_DDLOCAL_TYPE, FALSE); + if (!peDdL) + return RetVal; + + peDdGl = peDdL->peDirectDrawGlobal2; + + // check VideoPort related callbacks + if (peDdGl->dwCallbackFlags & EDDDGBL_VIDEOPORTCALLBACKS) + { + if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_VideoPortCallbacks)) + { + dwInfoSize = sizeof(DD_VIDEOPORTCALLBACKS); + pInfo = (VOID*)&peDdGl->ddVideoPortCallback; + } + if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_VideoPortCaps)) + { + pInfo = (VOID*)peDdGl->unk_000c[0]; + dwInfoSize = 72 * peDdGl->ddHalInfo.ddCaps.dwMaxVideoPorts; + } + if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_D3DCallbacks3)) + { + dwInfoSize = sizeof(D3DNTHAL_CALLBACKS3); + pInfo = (VOID*)&peDdGl->d3dNtHalCallbacks3; + } + } + + // check ColorControl related callbacks + if (peDdGl->dwCallbackFlags & EDDDGBL_COLORCONTROLCALLBACKS) + { + if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_ColorControlCallbacks)) + { + dwInfoSize = sizeof(DD_COLORCONTROLCALLBACKS); + pInfo = (VOID*)&peDdGl->ddColorControlCallbacks; + } + if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_NTCallbacks)) + { + dwInfoSize = sizeof(DD_NTCALLBACKS); + pInfo = (VOID*)&peDdGl->ddNtCallbacks; + } + } + + // check Miscellaneous callbacks + if (peDdGl->dwCallbackFlags & EDDDGBL_MISCCALLBACKS) + { + if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_MiscellaneousCallbacks)) + { + dwInfoSize = sizeof(DD_MISCELLANEOUSCALLBACKS); + pInfo = (VOID*)&peDdGl->ddMiscellanousCallbacks; + } + if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_DDMoreCaps)) + { + dwInfoSize = sizeof(DD_MORECAPS); + pInfo = &peDdGl->ddMoreCaps; + } + } + + if (peDdGl->dwCallbackFlags & EDDDGBL_MISC2CALLBACKS && + InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_Miscellaneous2Callbacks)) + { + dwInfoSize = sizeof(DD_MISCELLANEOUS2CALLBACKS); + pInfo = (VOID*)&peDdGl->ddMiscellanous2Callbacks; + } + + if (peDdGl->dwCallbackFlags & EDDDGBL_MOTIONCOMPCALLBACKS && + InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_MotionCompCallbacks)) + { + dwInfoSize = sizeof(DD_MOTIONCOMPCALLBACKS); + pInfo = (VOID*)&peDdGl->ddMotionCompCallbacks; + } + + if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_KernelCaps) ) + { + dwInfoSize = sizeof(DD_KERNELCALLBACKS); + pInfo = &peDdGl->ddKernelCaps; + } + + if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_DDMoreSurfaceCaps)) + { + dwInfoSize = sizeof(DDMORESURFACECAPS); + pInfo = &peDdGl->ddMoreSurfaceCaps; + } + + if (dwInfoSize && pInfo) + { + gpEngFuncs.DxEngLockHdev(peDdGl->hDev); + intDdGetDriverInfo(peDdGl, drvInfoData->guidInfo, &callbackStruct, dwInfoSize, &dwInfoSize); + gpEngFuncs.DxEngUnlockHdev(peDdGl->hDev); + memcpy(drvInfoData->lpvData, callbackStruct, dwInfoSize); + } + + InterlockedDecrement((VOID*)&peDdL->pobj.cExclusiveLock); + + return TRUE; +} + +/*++ +* @name DxDdQueryDirectDrawObject +* @implemented +* +* Function queries the DirectDraw object for its functionality +* +* @return +* TRUE on success. +*--*/ +BOOL +NTAPI +DxDdQueryDirectDrawObject( + HANDLE DdHandle, + DD_HALINFO* pDdHalInfo, + DWORD* pCallBackFlags, + LPD3DNTHAL_CALLBACKS pd3dNtHalCallbacks, + LPD3DNTHAL_GLOBALDRIVERDATA pd3dNtGlobalDriverData, + PDD_D3DBUFCALLBACKS pd3dBufCallbacks, + LPDDSURFACEDESC pTextureFormats, + DWORD* p8, + VIDEOMEMORY* p9, + DWORD* pdwNumFourCC, + DWORD* pdwFourCC) +{ + PEDD_DIRECTDRAW_LOCAL peDdL; + PEDD_DIRECTDRAW_GLOBAL peDdGl; + BOOL RetVal = FALSE; + + if (!DdHandle) + return RetVal; + + if (!pDdHalInfo) + return RetVal; + + if (!gpEngFuncs.DxEngScreenAccessCheck()) + return RetVal; + + peDdL = (PEDD_DIRECTDRAW_LOCAL)DdHmgLock(DdHandle, ObjType_DDLOCAL_TYPE, FALSE); + if (peDdL) + { + peDdGl = peDdL->peDirectDrawGlobal2; + gpEngFuncs.DxEngLockHdev(peDdGl->hDev); + + memcpy(pDdHalInfo, &peDdGl->ddHalInfo, sizeof(DD_HALINFO)); + + if (pCallBackFlags) + { + *(DWORD*)pCallBackFlags = peDdGl->ddCallbacks.dwFlags; + *(DWORD*)((ULONG)pCallBackFlags + 4) = peDdGl->ddSurfaceCallbacks.dwFlags; + *(DWORD*)((ULONG)pCallBackFlags + 8) = peDdGl->ddPaletteCallbacks.dwFlags; + } + + if ( pd3dNtHalCallbacks ) + memcpy(pd3dNtHalCallbacks, &peDdGl->d3dNtHalCallbacks, sizeof(peDdGl->d3dNtHalCallbacks)); + + if ( pd3dNtGlobalDriverData ) + memcpy(pd3dNtGlobalDriverData, &peDdGl->d3dNtGlobalDriverData, sizeof(peDdGl->d3dNtGlobalDriverData)); + + if ( pd3dBufCallbacks ) + memcpy(pd3dBufCallbacks, &peDdGl->d3dBufCallbacks, sizeof(peDdGl->d3dBufCallbacks)); + + if (pTextureFormats) + memcpy(pTextureFormats, &peDdGl->d3dNtGlobalDriverData.lpTextureFormats, peDdGl->d3dNtGlobalDriverData.dwNumTextureFormats * sizeof(DDSURFACEDESC2)); + + if (pdwNumFourCC) + *pdwNumFourCC = peDdGl->dwNumFourCC; + + if (pdwFourCC) + memcpy(pdwFourCC, &peDdGl->pdwFourCC, 4 * peDdGl->dwNumFourCC); + + RetVal = TRUE; + + gpEngFuncs.DxEngUnlockHdev(peDdGl->hDev); + + InterlockedDecrement((VOID*)&peDdL->pobj.cExclusiveLock); + } + + return RetVal; +} + +/*++ +* @name DxDdEnableDirectDraw +* @implemented +* +* Function enables DirectDraw +* +* @param PEDD_DIRECTDRAW_GLOBAL peDdGl +* Pointer to destination DirectDrawGlobal structure +*--*/ +BOOL +NTAPI +DxDdEnableDirectDraw(HANDLE hDev, BOOL arg2/*What for?*/) +{ + PEDD_DIRECTDRAW_GLOBAL peDdGl = NULL; + + if (gpEngFuncs.DxEngGetHdevData(hDev, DxEGShDevData_display)) + { + peDdGl = (PEDD_DIRECTDRAW_GLOBAL)gpEngFuncs.DxEngGetHdevData(hDev, DxEGShDevData_eddg); + peDdGl->hDev = hDev; + peDdGl->bSuspended = FALSE; + peDdGl->dhpdev = (PVOID)gpEngFuncs.DxEngGetHdevData(hDev, DxEGShDevData_dhpdev); + intDdEnableDriver(peDdGl); + return TRUE; + } + + return FALSE; +} + +/*++ +* @name DxDdReenableDirectDrawObject +* @implemented +* +* Function re-enables DirectDraw object after mode switch +* +* @param HANDLE DdHandle +* DirectDraw object handle +* +* @param PVOID p2 +* ??? +* +* @return +* TRUE on success. +* +* @remarks +* Missing all AGP stuff and second parameter handling +*--*/ +DWORD +NTAPI +DxDdReenableDirectDrawObject( + HANDLE DdHandle, + PVOID p2) +{ + PEDD_DIRECTDRAW_LOCAL peDdL; + PEDD_DIRECTDRAW_GLOBAL peDdGl; + HDC hDC; + DWORD RetVal = FALSE; + + peDdL = (PEDD_DIRECTDRAW_LOCAL)DdHmgLock(DdHandle, ObjType_DDLOCAL_TYPE, FALSE); + + if (!peDdL) + return RetVal; + + peDdGl = peDdL->peDirectDrawGlobal2; + + hDC = gpEngFuncs.DxEngGetDesktopDC(0, FALSE, FALSE); + + gpEngFuncs.DxEngLockShareSem(); + gpEngFuncs.DxEngLockHdev(peDdGl->hDev); + + if (peDdGl->fl & 1 && + gpEngFuncs.DxEngGetDCState(hDC, 2) != 1 && + !(gpEngFuncs.DxEngGetHdevData(peDdGl->hDev, DxEGShDevData_OpenRefs)) && + !(gpEngFuncs.DxEngGetHdevData(peDdGl->hDev, DxEGShDevData_disable)) && + !(gpEngFuncs.DxEngGetHdevData(peDdGl->hDev, DxEGShDevData_dd_nCount)) && + gpEngFuncs.DxEngGetHdevData(peDdGl->hDev, DxEGShDevData_DitherFmt) >= BMF_8BPP) + { + // reset acceleration and suspend flags + peDdGl->fl &= 0xFFFFFFFD; + peDdGl->bSuspended = 0; + + RetVal = TRUE; + // FIXME AGP Stuff + } + + gpEngFuncs.DxEngUnlockHdev(peDdGl->hDev); + gpEngFuncs.DxEngUnlockShareSem(); + + InterlockedDecrement((VOID*)&peDdL->pobj.cExclusiveLock); + + return RetVal; +} Propchange: trunk/reactos/win32ss/reactx/dxg/ddraw.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/win32ss/reactx/dxg/dxg_driver.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/reactx/dxg/dxg_dri…
============================================================================== --- trunk/reactos/win32ss/reactx/dxg/dxg_driver.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/reactx/dxg/dxg_driver.h [iso-8859-1] Thu Mar 16 14:37:27 2017 @@ -114,26 +114,6 @@ PVOID p1, PVOID p2, PVOID p3) -{ - TRACE(); - return 0; -} - -DWORD -NTAPI -DxDdCanCreateSurface( - PVOID p1, - PVOID p2) -{ - TRACE(); - return 0; -} - -DWORD -NTAPI -DxDdCanCreateD3DBuffer( - PVOID p1, - PVOID p2) { TRACE(); return 0; Modified: trunk/reactos/win32ss/reactx/dxg/dxg_int.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/reactx/dxg/dxg_int…
============================================================================== --- trunk/reactos/win32ss/reactx/dxg/dxg_int.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/reactx/dxg/dxg_int.h [iso-8859-1] Thu Mar 16 14:37:27 2017 @@ -200,7 +200,8 @@ LPD3DNTHAL_GLOBALDRIVERDATA pd3dNtGlobalDriverData, PDD_D3DBUFCALLBACKS pd3dBufCallbacks, LPDDSURFACEDESC pTextureFormats, DWORD* p8, VIDEOMEMORY* p9, DWORD* pdwNumFourCC, DWORD* pdwFourCC); DWORD NTAPI DxDdReenableDirectDrawObject(HANDLE DdHandle, PVOID p2); - +DWORD NTAPI DxDdCanCreateSurface(HANDLE DdHandle, PDD_CANCREATESURFACEDATA SurfaceData); +DWORD NTAPI DxDdCanCreateD3DBuffer(HANDLE DdHandle, PDD_CANCREATESURFACEDATA SurfaceData); /* Internal functions */ Modified: trunk/reactos/win32ss/reactx/dxg/eng.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/reactx/dxg/eng.c?r…
============================================================================== --- trunk/reactos/win32ss/reactx/dxg/eng.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/reactx/dxg/eng.c [iso-8859-1] Thu Mar 16 14:37:27 2017 @@ -9,98 +9,6 @@ */ #include <dxg_int.h> - -/*++ -* @name intDdGetDriverInfo -* @implemented -* -* The function intDdGetDriverInfo is used internally in dxg.sys -* It retrieves driver information structures -* -* @param PEDD_DIRECTDRAW_GLOBAL peDdGl -* DirectDraw global structure -* -* @param GUID guid -* GUID of InfoData to read -* -* @param PVOID callbackStruct -* Callback structure pointer -* -* @param ULONG callbackSize -* Size of allocated callback structure -* -* @param ULONG *returnSize -* Desired structure size returned by driver -* -* @return -* Returns true on successful execution, false when error. -* -* @remarks. -* Only used internally in dxg.sys -*--*/ -BOOL intDdGetDriverInfo(PEDD_DIRECTDRAW_GLOBAL peDdGl, GUID guid, PVOID callbackStruct, ULONG callbackSize, ULONG *returnSize) -{ - DD_GETDRIVERINFODATA ddGetDriverInfoData; - - if (peDdGl->ddHalInfo.dwFlags & DDHALINFO_GETDRIVERINFOSET && peDdGl->ddHalInfo.GetDriverInfo) - { - memset(&ddGetDriverInfoData, 0, sizeof(DD_GETDRIVERINFODATA)); - ddGetDriverInfoData.dwSize = sizeof(DD_GETDRIVERINFODATA); - ddGetDriverInfoData.dhpdev = peDdGl->dhpdev; - memcpy(&ddGetDriverInfoData.guidInfo, &guid, sizeof(GUID)); - ddGetDriverInfoData.dwExpectedSize = callbackSize; - ddGetDriverInfoData.lpvData = callbackStruct; - ddGetDriverInfoData.ddRVal = DDERR_CURRENTLYNOTAVAIL; - if (peDdGl->ddHalInfo.GetDriverInfo(&ddGetDriverInfoData) && !ddGetDriverInfoData.ddRVal) - { - if (returnSize) - *returnSize = ddGetDriverInfoData.dwActualSize; - return TRUE; - } - - } - - /* cleanup on error */ - memset(callbackStruct, 0, callbackSize); - if (returnSize) - *returnSize = 0; - return FALSE; -} - - -PVOID -FASTCALL -intDdCreateDirectDrawLocal(HDEV hDev) -{ - PEDD_DIRECTDRAW_GLOBAL peDdGl = NULL; - PEDD_DIRECTDRAW_LOCAL peDdL = NULL; - PDD_ENTRY AllocRet; - - peDdGl = (PEDD_DIRECTDRAW_GLOBAL)gpEngFuncs.DxEngGetHdevData(hDev, DxEGShDevData_eddg); - - AllocRet = DdHmgAlloc(sizeof(EDD_DIRECTDRAW_LOCAL), ObjType_DDLOCAL_TYPE, TRUE); - if (!AllocRet) - return NULL; - - peDdL = (PEDD_DIRECTDRAW_LOCAL)AllocRet->pobj; - - /* initialize DIRECTDRAW_LOCAL */ - peDdL->peDirectDrawLocal_prev = peDdGl->peDirectDrawLocalList; - peDdL->UniqueProcess = PsGetCurrentThreadProcessId(); - peDdL->Process = PsGetCurrentProcess(); - - // link DirectDrawGlobal and DirectDrawLocal - peDdGl->peDirectDrawLocalList = peDdL; - peDdL->peDirectDrawGlobal = peDdGl; - peDdL->peDirectDrawGlobal2 = peDdGl; - - gpEngFuncs.DxEngReferenceHdev(hDev); - - InterlockedExchangeAdd((LONG*)&peDdL->pobj.cExclusiveLock, 0xFFFFFFFF); - - return peDdL->pobj.hHmgr; -} - PDD_SURFACE_LOCAL NTAPI @@ -134,486 +42,3 @@ return retVal; } - -/*++ -* @name intDdGetAllDriverInfo -* @implemented -* -* The function intDdGetAllDriverInfo is used internally in dxg.sys -* It retrieves all possible driver information structures -* -* @param PEDD_DIRECTDRAW_GLOBAL peDdGl -* Pointer to destination DirectDrawGlobal structure -* -* @remarks. -* Only used internally in dxg.sys -* Missing some callbacks (VideoPort, DxApi, AGP) -*--*/ -VOID intDdGetAllDriverInfo(PEDD_DIRECTDRAW_GLOBAL peDdGl) -{ - if (peDdGl->ddHalInfo.GetDriverInfo && peDdGl->ddHalInfo.dwFlags & DDHALINFO_GETDRIVERINFOSET) - { - intDdGetDriverInfo(peDdGl, GUID_KernelCaps, &peDdGl->ddKernelCaps, sizeof(peDdGl->ddKernelCaps), 0); - intDdGetDriverInfo(peDdGl, GUID_KernelCallbacks, &peDdGl->ddKernelCallbacks, sizeof(peDdGl->ddKernelCallbacks), 0); - - if (intDdGetDriverInfo(peDdGl, GUID_D3DCallbacks3, &peDdGl->d3dNtHalCallbacks3, sizeof(peDdGl->d3dNtHalCallbacks3), 0)) - peDdGl->dwCallbackFlags |= EDDDGBL_D3DCALLBACKS3; - - if (intDdGetDriverInfo(peDdGl, GUID_ColorControlCallbacks, &peDdGl->ddColorControlCallbacks, sizeof(peDdGl->ddColorControlCallbacks), 0)) - peDdGl->dwCallbackFlags |= EDDDGBL_COLORCONTROLCALLBACKS; - - if (intDdGetDriverInfo(peDdGl, GUID_MiscellaneousCallbacks, &peDdGl->ddMiscellanousCallbacks, sizeof(peDdGl->ddMiscellanousCallbacks), 0)) - peDdGl->dwCallbackFlags |= EDDDGBL_MISCCALLBACKS; - - if (intDdGetDriverInfo(peDdGl, GUID_Miscellaneous2Callbacks, &peDdGl->ddMiscellanous2Callbacks, sizeof(peDdGl->ddMiscellanous2Callbacks), 0)) - peDdGl->dwCallbackFlags |= EDDDGBL_MISC2CALLBACKS; - - if (intDdGetDriverInfo(peDdGl, GUID_NTCallbacks, &peDdGl->ddNtCallbacks, sizeof(peDdGl->ddNtCallbacks), 0) ) - peDdGl->dwCallbackFlags |= EDDDGBL_NTCALLBACKS; - - if (intDdGetDriverInfo(peDdGl, GUID_DDMoreCaps, &peDdGl->ddMoreCaps, sizeof(peDdGl->ddMoreCaps), 0) ) - peDdGl->dwCallbackFlags |= EDDDGBL_DDMORECAPS; - - if (intDdGetDriverInfo(peDdGl, GUID_NTPrivateDriverCaps, &peDdGl->ddNtPrivateDriverCaps, sizeof(peDdGl->ddNtPrivateDriverCaps), 0) ) - peDdGl->dwCallbackFlags |= EDDDGBL_PRIVATEDRIVERCAPS; - - if (intDdGetDriverInfo(peDdGl, GUID_MotionCompCallbacks, &peDdGl->ddMotionCompCallbacks, sizeof(peDdGl->ddMotionCompCallbacks), 0) ) - peDdGl->dwCallbackFlags |= EDDDGBL_MOTIONCOMPCALLBACKS; - } -} - - -/*++ -* @name intDdEnableDriver -* @implemented -* -* The function intDdEnableDriver is used internally in dxg.sys -* Fills in all EDD_DIRECTDRAW_GLOBAL structures and enables DirectDraw acceleration when possible -* -* @param PEDD_DIRECTDRAW_GLOBAL peDdGl -* Pointer to destination DirectDrawGlobal structure -* -* @remarks. -* Only used internally in dxg.sys -*--*/ -VOID intDdEnableDriver(PEDD_DIRECTDRAW_GLOBAL peDdGl) -{ - PDRIVER_FUNCTIONS DriverFunctions; - LPD3DNTHAL_GLOBALDRIVERDATA GlobalDriverData; - LPD3DNTHAL_CALLBACKS HalCallbacks; - PDD_D3DBUFCALLBACKS D3DBufCallbacks; - - - gpEngFuncs.DxEngLockHdev(peDdGl->hDev); - DriverFunctions = (PDRIVER_FUNCTIONS)gpEngFuncs.DxEngGetHdevData(peDdGl->hDev, DxEGShDevData_DrvFuncs); - - // check if driver has DirectDraw functions - if ((!DriverFunctions->GetDirectDrawInfo)||(!DriverFunctions->EnableDirectDraw)||(!DriverFunctions->DisableDirectDraw)) - peDdGl->dhpdev = 0; - - - // reset acceleration flag - peDdGl->fl = peDdGl->fl & 0xFFFFFFFE; - - // ask for structure sizes - if ((peDdGl->dhpdev)&&(DriverFunctions->GetDirectDrawInfo(peDdGl->dhpdev, &peDdGl->ddHalInfo, &peDdGl->dwNumHeaps, NULL, &peDdGl->dwNumFourCC, NULL))) - { - // allocate memory for DX data - if (peDdGl->dwNumHeaps) - peDdGl->pvmList = EngAllocMem(FL_ZERO_MEMORY, peDdGl->dwNumHeaps*sizeof(VIDEOMEMORY), TAG_GDDV); - if (peDdGl->dwNumFourCC) - peDdGl->pdwFourCC = EngAllocMem(FL_ZERO_MEMORY, peDdGl->dwNumFourCC * 4, TAG_GDDF); - - // get data from driver - if (!DriverFunctions->GetDirectDrawInfo(peDdGl->dhpdev, &peDdGl->ddHalInfo, &peDdGl->dwNumHeaps, peDdGl->pvmList, &peDdGl->dwNumFourCC, peDdGl->pdwFourCC)) - { - // failed - cleanup and exit - if (peDdGl->pvmList) - EngFreeMem(peDdGl->pvmList); - if (peDdGl->pdwFourCC) - EngFreeMem(peDdGl->pdwFourCC); - gpEngFuncs.DxEngUnlockHdev(peDdGl->hDev); - return; - } - - // check if we can enable DirectDraw acceleration - if ((peDdGl->ddHalInfo.vmiData.pvPrimary) && - (DriverFunctions->EnableDirectDraw(peDdGl->dhpdev, &peDdGl->ddCallbacks, &peDdGl->ddSurfaceCallbacks, &peDdGl->ddPaletteCallbacks))&& - !(gpEngFuncs.DxEngGetHdevData(peDdGl->hDev, DxEGShDevData_dd_flags) & CapOver_DisableD3DAccel)&& - (peDdGl->ddHalInfo.dwSize == sizeof(DD_HALINFO))) - { - GlobalDriverData = peDdGl->ddHalInfo.lpD3DGlobalDriverData; - HalCallbacks = peDdGl->ddHalInfo.lpD3DHALCallbacks; - D3DBufCallbacks = peDdGl->ddHalInfo.lpD3DHALCallbacks; - - if (GlobalDriverData && GlobalDriverData->dwSize == sizeof(D3DNTHAL_GLOBALDRIVERDATA)) - memcpy(&peDdGl->d3dNtGlobalDriverData, GlobalDriverData, sizeof(D3DNTHAL_GLOBALDRIVERDATA)); - - if (HalCallbacks && HalCallbacks->dwSize == sizeof(D3DNTHAL_CALLBACKS)) - memcpy(&peDdGl->d3dNtHalCallbacks, HalCallbacks, sizeof(D3DNTHAL_CALLBACKS)); - - if (D3DBufCallbacks && D3DBufCallbacks->dwSize == sizeof(DD_D3DBUFCALLBACKS)) - memcpy(&peDdGl->d3dBufCallbacks, D3DBufCallbacks, sizeof(DD_D3DBUFCALLBACKS)); - - intDdGetAllDriverInfo(peDdGl); - - // enable DirectDraw acceleration - peDdGl->fl |= 1; - } - else - { - // failed - cleanup and exit - if (peDdGl->pvmList) - EngFreeMem(peDdGl->pvmList); - if (peDdGl->pdwFourCC) - EngFreeMem(peDdGl->pdwFourCC); - } - } - - gpEngFuncs.DxEngUnlockHdev(peDdGl->hDev); -} - -/*++ -* @name DxDdEnableDirectDraw -* @implemented -* -* Function enables DirectDraw -* -* @param PEDD_DIRECTDRAW_GLOBAL peDdGl -* Pointer to destination DirectDrawGlobal structure -*--*/ -BOOL -NTAPI -DxDdEnableDirectDraw(HANDLE hDev, BOOL arg2/*What for?*/) -{ - PEDD_DIRECTDRAW_GLOBAL peDdGl = NULL; - - if (gpEngFuncs.DxEngGetHdevData(hDev, DxEGShDevData_display)) - { - peDdGl = (PEDD_DIRECTDRAW_GLOBAL)gpEngFuncs.DxEngGetHdevData(hDev, DxEGShDevData_eddg); - peDdGl->hDev = hDev; - peDdGl->bSuspended = FALSE; - peDdGl->dhpdev = (PVOID)gpEngFuncs.DxEngGetHdevData(hDev, DxEGShDevData_dhpdev); - intDdEnableDriver(peDdGl); - return TRUE; - } - - return FALSE; -} - -/*++ -* @name DxDdCreateDirectDrawObject -* @implemented -* -* Function creates new DirectDraw object -* -* @param HDC hDC -* Device context handle -* -* @return -* Newly created DirectDraw object handle. -* -* @remarks. -* Missing all AGP stuff -*--*/ -DWORD -NTAPI -DxDdCreateDirectDrawObject( - HDC hDC) -{ - PDC pDC = NULL; - HDEV hDev = NULL; - DWORD retVal = 0; - - pDC = gpEngFuncs.DxEngLockDC(hDC); - if (!pDC) - return 0; - - // get driver hDev from DC - hDev = (HDEV)gpEngFuncs.DxEngGetDCState(hDC, 3); - if (!hDev) { - gpEngFuncs.DxEngUnlockDC(pDC); - return 0; - } - - // is this primary display? - if (!gpEngFuncs.DxEngGetHdevData(hDev, DxEGShDevData_display)) - { - gpEngFuncs.DxEngUnlockDC(pDC); - return 0; - } - - gpEngFuncs.DxEngLockHdev(hDev); - - // create object only for 8BPP and more - if (gpEngFuncs.DxEngGetHdevData(hDev, DxEGShDevData_DitherFmt) >= BMF_8BPP) - retVal = (DWORD)intDdCreateDirectDrawLocal(hDev); - - gpEngFuncs.DxEngUnlockHdev(hDev); - gpEngFuncs.DxEngUnlockDC(pDC); - return retVal; -} - -/*++ -* @name DxDdGetDriverInfo -* @implemented -* -* Function queries the driver for DirectDraw and Direct3D functionality -* -* @param HANDLE DdHandle -* Handle to DirectDraw object -* -* @param PDD_GETDRIVERINFODATA drvInfoData -* Pointer to in/out driver info data structure -*--*/ -DWORD -NTAPI -DxDdGetDriverInfo(HANDLE DdHandle, PDD_GETDRIVERINFODATA drvInfoData) -{ - PEDD_DIRECTDRAW_LOCAL peDdL; - PEDD_DIRECTDRAW_GLOBAL peDdGl; - PVOID pInfo = NULL; - DWORD dwInfoSize = 0; - BYTE callbackStruct[1024]; - DWORD RetVal = FALSE; - - peDdL = (PEDD_DIRECTDRAW_LOCAL)DdHmgLock(DdHandle, ObjType_DDLOCAL_TYPE, FALSE); - if (!peDdL) - return RetVal; - - peDdGl = peDdL->peDirectDrawGlobal2; - - // check VideoPort related callbacks - if (peDdGl->dwCallbackFlags & EDDDGBL_VIDEOPORTCALLBACKS) - { - if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_VideoPortCallbacks)) - { - dwInfoSize = sizeof(DD_VIDEOPORTCALLBACKS); - pInfo = (VOID*)&peDdGl->ddVideoPortCallback; - } - if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_VideoPortCaps)) - { - pInfo = (VOID*)peDdGl->unk_000c[0]; - dwInfoSize = 72 * peDdGl->ddHalInfo.ddCaps.dwMaxVideoPorts; - } - if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_D3DCallbacks3)) - { - dwInfoSize = sizeof(D3DNTHAL_CALLBACKS3); - pInfo = (VOID*)&peDdGl->d3dNtHalCallbacks3; - } - } - - // check ColorControl related callbacks - if (peDdGl->dwCallbackFlags & EDDDGBL_COLORCONTROLCALLBACKS) - { - if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_ColorControlCallbacks)) - { - dwInfoSize = sizeof(DD_COLORCONTROLCALLBACKS); - pInfo = (VOID*)&peDdGl->ddColorControlCallbacks; - } - if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_NTCallbacks)) - { - dwInfoSize = sizeof(DD_NTCALLBACKS); - pInfo = (VOID*)&peDdGl->ddNtCallbacks; - } - } - - // check Miscellaneous callbacks - if (peDdGl->dwCallbackFlags & EDDDGBL_MISCCALLBACKS) - { - if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_MiscellaneousCallbacks)) - { - dwInfoSize = sizeof(DD_MISCELLANEOUSCALLBACKS); - pInfo = (VOID*)&peDdGl->ddMiscellanousCallbacks; - } - if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_DDMoreCaps)) - { - dwInfoSize = sizeof(DD_MORECAPS); - pInfo = &peDdGl->ddMoreCaps; - } - } - - if (peDdGl->dwCallbackFlags & EDDDGBL_MISC2CALLBACKS && - InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_Miscellaneous2Callbacks)) - { - dwInfoSize = sizeof(DD_MISCELLANEOUS2CALLBACKS); - pInfo = (VOID*)&peDdGl->ddMiscellanous2Callbacks; - } - - if (peDdGl->dwCallbackFlags & EDDDGBL_MOTIONCOMPCALLBACKS && - InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_MotionCompCallbacks)) - { - dwInfoSize = sizeof(DD_MOTIONCOMPCALLBACKS); - pInfo = (VOID*)&peDdGl->ddMotionCompCallbacks; - } - - if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_KernelCaps) ) - { - dwInfoSize = sizeof(DD_KERNELCALLBACKS); - pInfo = &peDdGl->ddKernelCaps; - } - - if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_DDMoreSurfaceCaps)) - { - dwInfoSize = sizeof(DDMORESURFACECAPS); - pInfo = &peDdGl->ddMoreSurfaceCaps; - } - - if (dwInfoSize && pInfo) - { - gpEngFuncs.DxEngLockHdev(peDdGl->hDev); - intDdGetDriverInfo(peDdGl, drvInfoData->guidInfo, &callbackStruct, dwInfoSize, &dwInfoSize); - gpEngFuncs.DxEngUnlockHdev(peDdGl->hDev); - memcpy(drvInfoData->lpvData, callbackStruct, dwInfoSize); - } - - InterlockedDecrement((VOID*)&peDdL->pobj.cExclusiveLock); - - return TRUE; -} - - -/*++ -* @name DxDdQueryDirectDrawObject -* @implemented -* -* Function queries the DirectDraw object for its functionality -* -* @return -* TRUE on success. -*--*/ -BOOL -NTAPI -DxDdQueryDirectDrawObject( - HANDLE DdHandle, - DD_HALINFO* pDdHalInfo, - DWORD* pCallBackFlags, - LPD3DNTHAL_CALLBACKS pd3dNtHalCallbacks, - LPD3DNTHAL_GLOBALDRIVERDATA pd3dNtGlobalDriverData, - PDD_D3DBUFCALLBACKS pd3dBufCallbacks, - LPDDSURFACEDESC pTextureFormats, - DWORD* p8, - VIDEOMEMORY* p9, - DWORD* pdwNumFourCC, - DWORD* pdwFourCC) -{ - PEDD_DIRECTDRAW_LOCAL peDdL; - PEDD_DIRECTDRAW_GLOBAL peDdGl; - BOOL RetVal = FALSE; - - if (!DdHandle) - return RetVal; - - if (!pDdHalInfo) - return RetVal; - - if (!gpEngFuncs.DxEngScreenAccessCheck()) - return RetVal; - - peDdL = (PEDD_DIRECTDRAW_LOCAL)DdHmgLock(DdHandle, ObjType_DDLOCAL_TYPE, FALSE); - if (peDdL) - { - peDdGl = peDdL->peDirectDrawGlobal2; - gpEngFuncs.DxEngLockHdev(peDdGl->hDev); - - memcpy(pDdHalInfo, &peDdGl->ddHalInfo, sizeof(DD_HALINFO)); - - if (pCallBackFlags) - { - *(DWORD*)pCallBackFlags = peDdGl->ddCallbacks.dwFlags; - *(DWORD*)((ULONG)pCallBackFlags + 4) = peDdGl->ddSurfaceCallbacks.dwFlags; - *(DWORD*)((ULONG)pCallBackFlags + 8) = peDdGl->ddPaletteCallbacks.dwFlags; - } - - if ( pd3dNtHalCallbacks ) - memcpy(pd3dNtHalCallbacks, &peDdGl->d3dNtHalCallbacks, sizeof(peDdGl->d3dNtHalCallbacks)); - - if ( pd3dNtGlobalDriverData ) - memcpy(pd3dNtGlobalDriverData, &peDdGl->d3dNtGlobalDriverData, sizeof(peDdGl->d3dNtGlobalDriverData)); - - if ( pd3dBufCallbacks ) - memcpy(pd3dBufCallbacks, &peDdGl->d3dBufCallbacks, sizeof(peDdGl->d3dBufCallbacks)); - - if (pTextureFormats) - memcpy(pTextureFormats, &peDdGl->d3dNtGlobalDriverData.lpTextureFormats, peDdGl->d3dNtGlobalDriverData.dwNumTextureFormats * sizeof(DDSURFACEDESC2)); - - if (pdwNumFourCC) - *pdwNumFourCC = peDdGl->dwNumFourCC; - - if (pdwFourCC) - memcpy(pdwFourCC, &peDdGl->pdwFourCC, 4 * peDdGl->dwNumFourCC); - - RetVal = TRUE; - - gpEngFuncs.DxEngUnlockHdev(peDdGl->hDev); - - InterlockedDecrement((VOID*)&peDdL->pobj.cExclusiveLock); - } - - return RetVal; -} - - -/*++ -* @name DxDdReenableDirectDrawObject -* @implemented -* -* Function re-enables DirectDraw object after mode switch -* -* @param HANDLE DdHandle -* DirectDraw object handle -* -* @param PVOID p2 -* ??? -* -* @return -* TRUE on success. -* -* @remarks -* Missing all AGP stuff and second parameter handling -*--*/ -DWORD -NTAPI -DxDdReenableDirectDrawObject( - HANDLE DdHandle, - PVOID p2) -{ - PEDD_DIRECTDRAW_LOCAL peDdL; - PEDD_DIRECTDRAW_GLOBAL peDdGl; - HDC hDC; - DWORD RetVal = FALSE; - - peDdL = (PEDD_DIRECTDRAW_LOCAL)DdHmgLock(DdHandle, ObjType_DDLOCAL_TYPE, FALSE); - - if (!peDdL) - return RetVal; - - peDdGl = peDdL->peDirectDrawGlobal2; - - hDC = gpEngFuncs.DxEngGetDesktopDC(0, FALSE, FALSE); - - gpEngFuncs.DxEngLockShareSem(); - gpEngFuncs.DxEngLockHdev(peDdGl->hDev); - - if (peDdGl->fl & 1 && - gpEngFuncs.DxEngGetDCState(hDC, 2) != 1 && - !(gpEngFuncs.DxEngGetHdevData(peDdGl->hDev, DxEGShDevData_OpenRefs)) && - !(gpEngFuncs.DxEngGetHdevData(peDdGl->hDev, DxEGShDevData_disable)) && - !(gpEngFuncs.DxEngGetHdevData(peDdGl->hDev, DxEGShDevData_dd_nCount)) && - gpEngFuncs.DxEngGetHdevData(peDdGl->hDev, DxEGShDevData_DitherFmt) >= BMF_8BPP) - { - // reset acceleration and suspend flags - peDdGl->fl &= 0xFFFFFFFD; - peDdGl->bSuspended = 0; - - RetVal = TRUE; - // FIXME AGP Stuff - } - - gpEngFuncs.DxEngUnlockHdev(peDdGl->hDev); - gpEngFuncs.DxEngUnlockShareSem(); - - InterlockedDecrement((VOID*)&peDdL->pobj.cExclusiveLock); - - return RetVal; -}
7 years, 9 months
1
0
0
0
[sgasiorek] 74180: [DXG] implement DxDdGetDriverInfo, DxDdQueryDirectDrawObject, DxDdReenableDirectDrawObject, fix DirectDrawLocal assignment in intDdCreateDirectDrawLocal CORE-4490
by sgasiorek@svn.reactos.org
Author: sgasiorek Date: Thu Mar 16 12:20:36 2017 New Revision: 74180 URL:
http://svn.reactos.org/svn/reactos?rev=74180&view=rev
Log: [DXG] implement DxDdGetDriverInfo, DxDdQueryDirectDrawObject, DxDdReenableDirectDrawObject, fix DirectDrawLocal assignment in intDdCreateDirectDrawLocal CORE-4490 Modified: trunk/reactos/win32ss/reactx/dxg/dxg_driver.h trunk/reactos/win32ss/reactx/dxg/dxg_int.h trunk/reactos/win32ss/reactx/dxg/eng.c Modified: trunk/reactos/win32ss/reactx/dxg/dxg_driver.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/reactx/dxg/dxg_dri…
============================================================================== --- trunk/reactos/win32ss/reactx/dxg/dxg_driver.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/reactx/dxg/dxg_driver.h [iso-8859-1] Thu Mar 16 12:20:36 2017 @@ -296,16 +296,6 @@ DWORD NTAPI -DxDdGetDriverInfo( - PVOID p1, - PVOID p2) -{ - TRACE(); - return 0; -} - -DWORD -NTAPI DxDdGetDxHandle( PVOID p1, PVOID p2, @@ -394,36 +384,7 @@ DWORD NTAPI -DxDdQueryDirectDrawObject( - PVOID p1, - PVOID p2, - PVOID p3, - PVOID p4, - PVOID p5, - PVOID p6, - PVOID p7, - PVOID p8, - PVOID p9, - PVOID p10, - PVOID p11) -{ - TRACE(); - return 0; -} - -DWORD -NTAPI DxDdQueryMoCompStatus( - PVOID p1, - PVOID p2) -{ - TRACE(); - return 0; -} - -DWORD -NTAPI -DxDdReenableDirectDrawObject( PVOID p1, PVOID p2) { Modified: trunk/reactos/win32ss/reactx/dxg/dxg_int.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/reactx/dxg/dxg_int…
============================================================================== --- trunk/reactos/win32ss/reactx/dxg/dxg_int.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/reactx/dxg/dxg_int.h [iso-8859-1] Thu Mar 16 12:20:36 2017 @@ -195,6 +195,13 @@ DWORD NTAPI DxDdIoctl(ULONG ulIoctl, PVOID pBuffer, ULONG ulBufferSize); PDD_SURFACE_LOCAL NTAPI DxDdLockDirectDrawSurface(HANDLE hDdSurface); BOOL NTAPI DxDdUnlockDirectDrawSurface(PDD_SURFACE_LOCAL pSurface); +DWORD NTAPI DxDdGetDriverInfo(HANDLE DdHandle, PDD_GETDRIVERINFODATA drvInfoData); +BOOL NTAPI DxDdQueryDirectDrawObject(HANDLE DdHandle, DD_HALINFO* pDdHalInfo, DWORD* pCallBackFlags, LPD3DNTHAL_CALLBACKS pd3dNtHalCallbacks, + LPD3DNTHAL_GLOBALDRIVERDATA pd3dNtGlobalDriverData, PDD_D3DBUFCALLBACKS pd3dBufCallbacks, LPDDSURFACEDESC pTextureFormats, + DWORD* p8, VIDEOMEMORY* p9, DWORD* pdwNumFourCC, DWORD* pdwFourCC); +DWORD NTAPI DxDdReenableDirectDrawObject(HANDLE DdHandle, PVOID p2); + + /* Internal functions */ BOOL FASTCALL VerifyObjectOwner(PDD_ENTRY pEntry); Modified: trunk/reactos/win32ss/reactx/dxg/eng.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/reactx/dxg/eng.c?r…
============================================================================== --- trunk/reactos/win32ss/reactx/dxg/eng.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/reactx/dxg/eng.c [iso-8859-1] Thu Mar 16 12:20:36 2017 @@ -82,7 +82,7 @@ if (!AllocRet) return NULL; - peDdL = (PEDD_DIRECTDRAW_LOCAL)AllocRet; + peDdL = (PEDD_DIRECTDRAW_LOCAL)AllocRet->pobj; /* initialize DIRECTDRAW_LOCAL */ peDdL->peDirectDrawLocal_prev = peDdGl->peDirectDrawLocalList; @@ -353,3 +353,267 @@ gpEngFuncs.DxEngUnlockDC(pDC); return retVal; } + +/*++ +* @name DxDdGetDriverInfo +* @implemented +* +* Function queries the driver for DirectDraw and Direct3D functionality +* +* @param HANDLE DdHandle +* Handle to DirectDraw object +* +* @param PDD_GETDRIVERINFODATA drvInfoData +* Pointer to in/out driver info data structure +*--*/ +DWORD +NTAPI +DxDdGetDriverInfo(HANDLE DdHandle, PDD_GETDRIVERINFODATA drvInfoData) +{ + PEDD_DIRECTDRAW_LOCAL peDdL; + PEDD_DIRECTDRAW_GLOBAL peDdGl; + PVOID pInfo = NULL; + DWORD dwInfoSize = 0; + BYTE callbackStruct[1024]; + DWORD RetVal = FALSE; + + peDdL = (PEDD_DIRECTDRAW_LOCAL)DdHmgLock(DdHandle, ObjType_DDLOCAL_TYPE, FALSE); + if (!peDdL) + return RetVal; + + peDdGl = peDdL->peDirectDrawGlobal2; + + // check VideoPort related callbacks + if (peDdGl->dwCallbackFlags & EDDDGBL_VIDEOPORTCALLBACKS) + { + if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_VideoPortCallbacks)) + { + dwInfoSize = sizeof(DD_VIDEOPORTCALLBACKS); + pInfo = (VOID*)&peDdGl->ddVideoPortCallback; + } + if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_VideoPortCaps)) + { + pInfo = (VOID*)peDdGl->unk_000c[0]; + dwInfoSize = 72 * peDdGl->ddHalInfo.ddCaps.dwMaxVideoPorts; + } + if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_D3DCallbacks3)) + { + dwInfoSize = sizeof(D3DNTHAL_CALLBACKS3); + pInfo = (VOID*)&peDdGl->d3dNtHalCallbacks3; + } + } + + // check ColorControl related callbacks + if (peDdGl->dwCallbackFlags & EDDDGBL_COLORCONTROLCALLBACKS) + { + if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_ColorControlCallbacks)) + { + dwInfoSize = sizeof(DD_COLORCONTROLCALLBACKS); + pInfo = (VOID*)&peDdGl->ddColorControlCallbacks; + } + if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_NTCallbacks)) + { + dwInfoSize = sizeof(DD_NTCALLBACKS); + pInfo = (VOID*)&peDdGl->ddNtCallbacks; + } + } + + // check Miscellaneous callbacks + if (peDdGl->dwCallbackFlags & EDDDGBL_MISCCALLBACKS) + { + if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_MiscellaneousCallbacks)) + { + dwInfoSize = sizeof(DD_MISCELLANEOUSCALLBACKS); + pInfo = (VOID*)&peDdGl->ddMiscellanousCallbacks; + } + if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_DDMoreCaps)) + { + dwInfoSize = sizeof(DD_MORECAPS); + pInfo = &peDdGl->ddMoreCaps; + } + } + + if (peDdGl->dwCallbackFlags & EDDDGBL_MISC2CALLBACKS && + InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_Miscellaneous2Callbacks)) + { + dwInfoSize = sizeof(DD_MISCELLANEOUS2CALLBACKS); + pInfo = (VOID*)&peDdGl->ddMiscellanous2Callbacks; + } + + if (peDdGl->dwCallbackFlags & EDDDGBL_MOTIONCOMPCALLBACKS && + InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_MotionCompCallbacks)) + { + dwInfoSize = sizeof(DD_MOTIONCOMPCALLBACKS); + pInfo = (VOID*)&peDdGl->ddMotionCompCallbacks; + } + + if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_KernelCaps) ) + { + dwInfoSize = sizeof(DD_KERNELCALLBACKS); + pInfo = &peDdGl->ddKernelCaps; + } + + if (InlineIsEqualGUID(&drvInfoData->guidInfo, &GUID_DDMoreSurfaceCaps)) + { + dwInfoSize = sizeof(DDMORESURFACECAPS); + pInfo = &peDdGl->ddMoreSurfaceCaps; + } + + if (dwInfoSize && pInfo) + { + gpEngFuncs.DxEngLockHdev(peDdGl->hDev); + intDdGetDriverInfo(peDdGl, drvInfoData->guidInfo, &callbackStruct, dwInfoSize, &dwInfoSize); + gpEngFuncs.DxEngUnlockHdev(peDdGl->hDev); + memcpy(drvInfoData->lpvData, callbackStruct, dwInfoSize); + } + + InterlockedDecrement((VOID*)&peDdL->pobj.cExclusiveLock); + + return TRUE; +} + + +/*++ +* @name DxDdQueryDirectDrawObject +* @implemented +* +* Function queries the DirectDraw object for its functionality +* +* @return +* TRUE on success. +*--*/ +BOOL +NTAPI +DxDdQueryDirectDrawObject( + HANDLE DdHandle, + DD_HALINFO* pDdHalInfo, + DWORD* pCallBackFlags, + LPD3DNTHAL_CALLBACKS pd3dNtHalCallbacks, + LPD3DNTHAL_GLOBALDRIVERDATA pd3dNtGlobalDriverData, + PDD_D3DBUFCALLBACKS pd3dBufCallbacks, + LPDDSURFACEDESC pTextureFormats, + DWORD* p8, + VIDEOMEMORY* p9, + DWORD* pdwNumFourCC, + DWORD* pdwFourCC) +{ + PEDD_DIRECTDRAW_LOCAL peDdL; + PEDD_DIRECTDRAW_GLOBAL peDdGl; + BOOL RetVal = FALSE; + + if (!DdHandle) + return RetVal; + + if (!pDdHalInfo) + return RetVal; + + if (!gpEngFuncs.DxEngScreenAccessCheck()) + return RetVal; + + peDdL = (PEDD_DIRECTDRAW_LOCAL)DdHmgLock(DdHandle, ObjType_DDLOCAL_TYPE, FALSE); + if (peDdL) + { + peDdGl = peDdL->peDirectDrawGlobal2; + gpEngFuncs.DxEngLockHdev(peDdGl->hDev); + + memcpy(pDdHalInfo, &peDdGl->ddHalInfo, sizeof(DD_HALINFO)); + + if (pCallBackFlags) + { + *(DWORD*)pCallBackFlags = peDdGl->ddCallbacks.dwFlags; + *(DWORD*)((ULONG)pCallBackFlags + 4) = peDdGl->ddSurfaceCallbacks.dwFlags; + *(DWORD*)((ULONG)pCallBackFlags + 8) = peDdGl->ddPaletteCallbacks.dwFlags; + } + + if ( pd3dNtHalCallbacks ) + memcpy(pd3dNtHalCallbacks, &peDdGl->d3dNtHalCallbacks, sizeof(peDdGl->d3dNtHalCallbacks)); + + if ( pd3dNtGlobalDriverData ) + memcpy(pd3dNtGlobalDriverData, &peDdGl->d3dNtGlobalDriverData, sizeof(peDdGl->d3dNtGlobalDriverData)); + + if ( pd3dBufCallbacks ) + memcpy(pd3dBufCallbacks, &peDdGl->d3dBufCallbacks, sizeof(peDdGl->d3dBufCallbacks)); + + if (pTextureFormats) + memcpy(pTextureFormats, &peDdGl->d3dNtGlobalDriverData.lpTextureFormats, peDdGl->d3dNtGlobalDriverData.dwNumTextureFormats * sizeof(DDSURFACEDESC2)); + + if (pdwNumFourCC) + *pdwNumFourCC = peDdGl->dwNumFourCC; + + if (pdwFourCC) + memcpy(pdwFourCC, &peDdGl->pdwFourCC, 4 * peDdGl->dwNumFourCC); + + RetVal = TRUE; + + gpEngFuncs.DxEngUnlockHdev(peDdGl->hDev); + + InterlockedDecrement((VOID*)&peDdL->pobj.cExclusiveLock); + } + + return RetVal; +} + + +/*++ +* @name DxDdReenableDirectDrawObject +* @implemented +* +* Function re-enables DirectDraw object after mode switch +* +* @param HANDLE DdHandle +* DirectDraw object handle +* +* @param PVOID p2 +* ??? +* +* @return +* TRUE on success. +* +* @remarks +* Missing all AGP stuff and second parameter handling +*--*/ +DWORD +NTAPI +DxDdReenableDirectDrawObject( + HANDLE DdHandle, + PVOID p2) +{ + PEDD_DIRECTDRAW_LOCAL peDdL; + PEDD_DIRECTDRAW_GLOBAL peDdGl; + HDC hDC; + DWORD RetVal = FALSE; + + peDdL = (PEDD_DIRECTDRAW_LOCAL)DdHmgLock(DdHandle, ObjType_DDLOCAL_TYPE, FALSE); + + if (!peDdL) + return RetVal; + + peDdGl = peDdL->peDirectDrawGlobal2; + + hDC = gpEngFuncs.DxEngGetDesktopDC(0, FALSE, FALSE); + + gpEngFuncs.DxEngLockShareSem(); + gpEngFuncs.DxEngLockHdev(peDdGl->hDev); + + if (peDdGl->fl & 1 && + gpEngFuncs.DxEngGetDCState(hDC, 2) != 1 && + !(gpEngFuncs.DxEngGetHdevData(peDdGl->hDev, DxEGShDevData_OpenRefs)) && + !(gpEngFuncs.DxEngGetHdevData(peDdGl->hDev, DxEGShDevData_disable)) && + !(gpEngFuncs.DxEngGetHdevData(peDdGl->hDev, DxEGShDevData_dd_nCount)) && + gpEngFuncs.DxEngGetHdevData(peDdGl->hDev, DxEGShDevData_DitherFmt) >= BMF_8BPP) + { + // reset acceleration and suspend flags + peDdGl->fl &= 0xFFFFFFFD; + peDdGl->bSuspended = 0; + + RetVal = TRUE; + // FIXME AGP Stuff + } + + gpEngFuncs.DxEngUnlockHdev(peDdGl->hDev); + gpEngFuncs.DxEngUnlockShareSem(); + + InterlockedDecrement((VOID*)&peDdL->pobj.cExclusiveLock); + + return RetVal; +}
7 years, 9 months
1
0
0
0
[sgasiorek] 74179: [DXG] DdHmgLock - use PLONG instead of PBYTE.
by sgasiorek@svn.reactos.org
Author: sgasiorek Date: Thu Mar 16 09:59:15 2017 New Revision: 74179 URL:
http://svn.reactos.org/svn/reactos?rev=74179&view=rev
Log: [DXG] DdHmgLock - use PLONG instead of PBYTE. Modified: trunk/reactos/win32ss/reactx/dxg/ddhmg.c Modified: trunk/reactos/win32ss/reactx/dxg/ddhmg.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/reactx/dxg/ddhmg.c…
============================================================================== --- trunk/reactos/win32ss/reactx/dxg/ddhmg.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/reactx/dxg/ddhmg.c [iso-8859-1] Thu Mar 16 09:59:15 2017 @@ -157,7 +157,7 @@ if ( Index < gcMaxDdHmgr ) { - pEntry = (PDD_ENTRY)((PBYTE)gpentDdHmgr + (sizeof(DD_ENTRY) * Index)); + pEntry = (PDD_ENTRY)((PLONG)gpentDdHmgr + (sizeof(DD_ENTRY) * Index)); if ( VerifyObjectOwner(pEntry) ) {
7 years, 9 months
1
0
0
0
[mjansen] 74178: [WIN32SS] Improve font substitutes by adding support for charset + loading the substitutes at boot. Patch by Katayama Hirofumi MZ. CORE-12902 #resolve #comment Thanks!
by mjansen@svn.reactos.org
Author: mjansen Date: Wed Mar 15 20:38:45 2017 New Revision: 74178 URL:
http://svn.reactos.org/svn/reactos?rev=74178&view=rev
Log: [WIN32SS] Improve font substitutes by adding support for charset + loading the substitutes at boot. Patch by Katayama Hirofumi MZ. CORE-12902 #resolve #comment Thanks! Modified: trunk/reactos/win32ss/gdi/ntgdi/freetype.c Modified: trunk/reactos/win32ss/gdi/ntgdi/freetype.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/freetype…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/freetype.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/freetype.c [iso-8859-1] Wed Mar 15 20:38:45 2017 @@ -43,7 +43,7 @@ extern const MATRIX gmxWorldToDeviceDefault; extern const MATRIX gmxWorldToPageDefault; -// HACK!! Fix XFORMOBJ then use 1:16 / 16:1 +/* HACK!! Fix XFORMOBJ then use 1:16 / 16:1 */ #define gmxWorldToDeviceDefault gmxWorldToPageDefault FT_Library library; @@ -201,6 +201,167 @@ { SYMBOL_CHARSET, CP_SYMBOL, {{0,0,0,0},{FS_SYMBOL,0}} } }; +/* + * FONTSUBST_... --- constants for font substitutes + */ +#define FONTSUBST_FROM 0 +#define FONTSUBST_TO 1 +#define FONTSUBST_FROM_AND_TO 2 + +/* + * FONTSUBST_ENTRY --- font substitute entry + */ +typedef struct FONTSUBST_ENTRY +{ + LIST_ENTRY ListEntry; + UNICODE_STRING FontNames[FONTSUBST_FROM_AND_TO]; + BYTE CharSets[FONTSUBST_FROM_AND_TO]; +} FONTSUBST_ENTRY, *PFONTSUBST_ENTRY; + +/* list head */ +static RTL_STATIC_LIST_HEAD(FontSubstListHead); + +/* + * IntLoadFontSubstList --- loads the list of font substitutes + */ +BOOL FASTCALL +IntLoadFontSubstList(PLIST_ENTRY pHead) +{ + NTSTATUS Status; + HANDLE KeyHandle; + OBJECT_ATTRIBUTES ObjectAttributes; + KEY_FULL_INFORMATION KeyFullInfo; + ULONG i, Length; + UNICODE_STRING FromW, ToW; + BYTE InfoBuffer[128]; + PKEY_VALUE_FULL_INFORMATION pInfo; + BYTE CharSets[FONTSUBST_FROM_AND_TO]; + LPWSTR pch; + PFONTSUBST_ENTRY pEntry; + + /* the FontSubstitutes registry key */ + static UNICODE_STRING FontSubstKey = + RTL_CONSTANT_STRING(L"\\Registry\\Machine\\Software\\" + L"Microsoft\\Windows NT\\CurrentVersion\\" + L"FontSubstitutes"); + + /* open registry key */ + InitializeObjectAttributes(&ObjectAttributes, &FontSubstKey, + OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, + NULL, NULL); + Status = ZwOpenKey(&KeyHandle, KEY_READ, &ObjectAttributes); + if (!NT_SUCCESS(Status)) + { + DPRINT("ZwOpenKey failed: 0x%08X\n", Status); + return FALSE; /* failure */ + } + + /* query count of values */ + Status = ZwQueryKey(KeyHandle, KeyFullInformation, + &KeyFullInfo, sizeof(KeyFullInfo), &Length); + if (!NT_SUCCESS(Status)) + { + DPRINT("ZwQueryKey failed: 0x%08X\n", Status); + ZwClose(KeyHandle); + return FALSE; /* failure */ + } + + /* for each value */ + for (i = 0; i < KeyFullInfo.Values; ++i) + { + /* get value name */ + Status = ZwEnumerateValueKey(KeyHandle, i, KeyValueFullInformation, + InfoBuffer, sizeof(InfoBuffer), &Length); + if (!NT_SUCCESS(Status)) + { + DPRINT("ZwEnumerateValueKey failed: 0x%08X\n", Status); + break; /* failure */ + } + + /* create FromW string */ + pInfo = (PKEY_VALUE_FULL_INFORMATION)InfoBuffer; + Length = pInfo->NameLength / sizeof(WCHAR); + pInfo->Name[Length] = UNICODE_NULL; /* truncate */ + Status = RtlCreateUnicodeString(&FromW, pInfo->Name); + if (!NT_SUCCESS(Status)) + { + DPRINT("RtlCreateUnicodeString failed: 0x%08X\n", Status); + break; /* failure */ + } + + /* query value */ + Status = ZwQueryValueKey(KeyHandle, &FromW, KeyValueFullInformation, + InfoBuffer, sizeof(InfoBuffer), &Length); + pInfo = (PKEY_VALUE_FULL_INFORMATION)InfoBuffer; + if (!NT_SUCCESS(Status) || !pInfo->DataLength) + { + DPRINT("ZwQueryValueKey failed: 0x%08X\n", Status); + RtlFreeUnicodeString(&FromW); + break; /* failure */ + } + + /* create ToW string */ + pch = (LPWSTR)((PUCHAR)pInfo + pInfo->DataOffset); + Length = pInfo->DataLength / sizeof(WCHAR); + pch[Length] = UNICODE_NULL; /* truncate */ + Status = RtlCreateUnicodeString(&ToW, pch); + if (!NT_SUCCESS(Status)) + { + DPRINT("RtlCreateUnicodeString failed: 0x%08X\n", Status); + RtlFreeUnicodeString(&FromW); + break; /* failure */ + } + + /* does charset exist? (from) */ + CharSets[FONTSUBST_FROM] = DEFAULT_CHARSET; + pch = wcsrchr(FromW.Buffer, L','); + if (pch) + { + /* truncate */ + *pch = UNICODE_NULL; + FromW.Length = (pch - FromW.Buffer) * sizeof(WCHAR); + /* parse charset number */ + CharSets[FONTSUBST_FROM] = (BYTE)_wtoi(pch + 1); + } + + /* does charset exist? (to) */ + CharSets[FONTSUBST_TO] = DEFAULT_CHARSET; + pch = wcsrchr(ToW.Buffer, L','); + if (pch) + { + /* truncate */ + *pch = UNICODE_NULL; + ToW.Length = (pch - ToW.Buffer) * sizeof(WCHAR); + /* parse charset number */ + CharSets[FONTSUBST_TO] = (BYTE)_wtoi(pch + 1); + } + + /* allocate an entry */ + pEntry = ExAllocatePoolWithTag(PagedPool, sizeof(FONTSUBST_ENTRY), TAG_FONT); + if (pEntry == NULL) + { + DPRINT("ExAllocatePoolWithTag failed\n"); + RtlFreeUnicodeString(&FromW); + RtlFreeUnicodeString(&ToW); + break; /* failure */ + } + + /* store to *pEntry */ + pEntry->FontNames[FONTSUBST_FROM] = FromW; + pEntry->FontNames[FONTSUBST_TO] = ToW; + pEntry->CharSets[FONTSUBST_FROM] = CharSets[FONTSUBST_FROM]; + pEntry->CharSets[FONTSUBST_TO] = CharSets[FONTSUBST_TO]; + + /* insert pEntry to *pHead */ + InsertTailList(pHead, &pEntry->ListEntry); + } + + /* close now */ + ZwClose(KeyHandle); + + return NT_SUCCESS(Status); +} + BOOL FASTCALL InitFontSupport(VOID) { @@ -232,6 +393,7 @@ } IntLoadSystemFonts(); + IntLoadFontSubstList(&FontSubstListHead); return TRUE; } @@ -263,6 +425,109 @@ /* Set the transformation matrix */ FT_Set_Transform(face, &ftmatrix, 0); +} + +static BOOL +SubstituteFontByList(PLIST_ENTRY pHead, + PUNICODE_STRING pOutputName, + PUNICODE_STRING pInputName, + BYTE RequestedCharSet, + BYTE CharSetMap[FONTSUBST_FROM_AND_TO]) +{ + NTSTATUS Status; + PLIST_ENTRY pListEntry; + PFONTSUBST_ENTRY pSubstEntry; + BYTE CharSets[FONTSUBST_FROM_AND_TO]; + + CharSetMap[FONTSUBST_FROM] = DEFAULT_CHARSET; + CharSetMap[FONTSUBST_TO] = RequestedCharSet; + + /* for each list entry */ + for (pListEntry = pHead->Flink; + pListEntry != pHead; + pListEntry = pListEntry->Flink) + { + pSubstEntry = + (PFONTSUBST_ENTRY)CONTAINING_RECORD(pListEntry, FONT_ENTRY, ListEntry); + + CharSets[FONTSUBST_FROM] = pSubstEntry->CharSets[FONTSUBST_FROM]; + + if (CharSets[FONTSUBST_FROM] != DEFAULT_CHARSET && + CharSets[FONTSUBST_FROM] != RequestedCharSet) + { + continue; /* not matched */ + } + + /* does charset number exist? (to) */ + if (pSubstEntry->CharSets[FONTSUBST_TO] != DEFAULT_CHARSET) + { + CharSets[FONTSUBST_TO] = pSubstEntry->CharSets[FONTSUBST_TO]; + } + else + { + CharSets[FONTSUBST_TO] = RequestedCharSet; + } + + /* does font name match? */ + if (!RtlEqualUnicodeString(&pSubstEntry->FontNames[FONTSUBST_FROM], + pInputName, TRUE)) + { + continue; /* not matched */ + } + + /* update *pOutputName */ + RtlFreeUnicodeString(pOutputName); + Status = RtlCreateUnicodeString(pOutputName, + pSubstEntry->FontNames[FONTSUBST_TO].Buffer); + if (!NT_SUCCESS(Status)) + { + DPRINT("RtlCreateUnicodeString failed: 0x%08X\n", Status); + continue; /* cannot create string */ + } + + if (CharSetMap[FONTSUBST_FROM] == DEFAULT_CHARSET) + { + /* update CharSetMap */ + CharSetMap[FONTSUBST_FROM] = CharSets[FONTSUBST_FROM]; + CharSetMap[FONTSUBST_TO] = CharSets[FONTSUBST_TO]; + } + return TRUE; /* success */ + } + + return FALSE; +} + +static BOOL +SubstituteFontRecurse(PUNICODE_STRING pInOutName, BYTE *pRequestedCharSet) +{ + UINT RecurseCount = 5; + UNICODE_STRING OutputNameW = { 0 }; + BYTE CharSetMap[FONTSUBST_FROM_AND_TO]; + BOOL Found; + + if (pInOutName->Buffer[0] == UNICODE_NULL) + return FALSE; + + while (RecurseCount-- > 0) + { + RtlInitUnicodeString(&OutputNameW, NULL); + Found = SubstituteFontByList(&FontSubstListHead, + &OutputNameW, pInOutName, + *pRequestedCharSet, CharSetMap); + if (!Found) + break; + + /* update *pInOutName and *pRequestedCharSet */ + RtlFreeUnicodeString(pInOutName); + *pInOutName = OutputNameW; + if (CharSetMap[FONTSUBST_FROM] == DEFAULT_CHARSET || + CharSetMap[FONTSUBST_FROM] == *pRequestedCharSet) + { + *pRequestedCharSet = CharSetMap[FONTSUBST_TO]; + } + } + + return TRUE; /* success */ } /* @@ -270,7 +535,6 @@ * * Search the system font directory and adds each font found. */ - VOID FASTCALL IntLoadSystemFonts(VOID) { @@ -3296,7 +3560,6 @@ return TRUE; } - DWORD FASTCALL ftGdiGetFontData( @@ -3337,73 +3600,13 @@ return Result; } -static __inline BOOLEAN -SubstituteFontNameByKey(PUNICODE_STRING FaceName, - LPCWSTR Key) -{ - RTL_QUERY_REGISTRY_TABLE QueryTable[2] = {{0}}; - NTSTATUS Status; - UNICODE_STRING Value; - - RtlInitUnicodeString(&Value, NULL); - - QueryTable[0].QueryRoutine = NULL; - QueryTable[0].Flags = RTL_QUERY_REGISTRY_DIRECT | RTL_QUERY_REGISTRY_NOEXPAND | - RTL_QUERY_REGISTRY_REQUIRED; - QueryTable[0].Name = FaceName->Buffer; - QueryTable[0].EntryContext = &Value; - QueryTable[0].DefaultType = REG_NONE; - QueryTable[0].DefaultData = NULL; - QueryTable[0].DefaultLength = 0; - - QueryTable[1].QueryRoutine = NULL; - QueryTable[1].Name = NULL; - - Status = RtlQueryRegistryValues(RTL_REGISTRY_WINDOWS_NT, - Key, - QueryTable, - NULL, - NULL); - if (NT_SUCCESS(Status)) - { - RtlFreeUnicodeString(FaceName); - *FaceName = Value; - - /* truncate */ - if ((LF_FACESIZE - 1) * sizeof(WCHAR) < FaceName->Length) - { - FaceName->Length = (LF_FACESIZE - 1) * sizeof(WCHAR); - FaceName->Buffer[LF_FACESIZE - 1] = UNICODE_NULL; - } - } - - return NT_SUCCESS(Status); -} - -static __inline BOOL -SubstituteFontName(PUNICODE_STRING FaceName) -{ - UINT Level; - const UINT MaxLevel = 10; - - if (FaceName->Buffer[0] == 0) - return FALSE; - - for (Level = 0; Level < MaxLevel; ++Level) - { - /* NOTE: SubstituteFontNameByKey changes FaceName. Be careful... */ - if (!SubstituteFontNameByKey(FaceName, L"FontSubstitutes")) - break; - } - return (Level > 0); -} - // NOTE: See Table 1. of
https://msdn.microsoft.com/en-us/library/ms969909.aspx
static UINT FASTCALL GetFontPenalty(LOGFONTW * LogFont, PUNICODE_STRING RequestedNameW, PUNICODE_STRING ActualNameW, PUNICODE_STRING FullFaceNameW, + BYTE RequestedCharSet, PFONTGDI FontGDI, OUTLINETEXTMETRICW * Otm, TEXTMETRICW * TM, @@ -3443,7 +3646,7 @@ } else /* Request is non-"System" font */ { - Byte = LogFont->lfCharSet; + Byte = RequestedCharSet; if (Byte == DEFAULT_CHARSET) { if (RtlEqualUnicodeString(RequestedNameW, &MarlettW, TRUE)) @@ -3470,12 +3673,12 @@ if (UserCharSet != TM->tmCharSet) { /* UNDOCUMENTED */ - Penalty += 10; - } - if (ANSI_CHARSET != TM->tmCharSet) - { - /* UNDOCUMENTED */ - Penalty += 10; + Penalty += 100; + if (ANSI_CHARSET != TM->tmCharSet) + { + /* UNDOCUMENTED */ + Penalty += 100; + } } } } @@ -3777,7 +3980,8 @@ static __inline VOID FindBestFontFromList(FONTOBJ **FontObj, ULONG *MatchPenalty, LOGFONTW *LogFont, PUNICODE_STRING pRequestedNameW, - PUNICODE_STRING pActualNameW, PLIST_ENTRY Head) + PUNICODE_STRING pActualNameW, BYTE RequestedCharSet, + PLIST_ENTRY Head) { ULONG Penalty; NTSTATUS Status; @@ -3846,8 +4050,8 @@ } Penalty = GetFontPenalty(LogFont, pRequestedNameW, &ActualNameW, - &FullFaceNameW, FontGDI, Otm, TM, - Face->style_name); + &FullFaceNameW, RequestedCharSet, + FontGDI, Otm, TM, Face->style_name); if (*MatchPenalty == 0xFFFFFFFF || Penalty < *MatchPenalty) { DPRINT("%ls Penalty: %lu\n", FullFaceNameW.Buffer, Penalty); @@ -3915,6 +4119,7 @@ ULONG MatchPenalty; LOGFONTW *pLogFont; FT_Face Face; + BYTE RequestedCharSet; if (!pTextObj) { @@ -3938,15 +4143,18 @@ RtlInitUnicodeString(&ActualNameW, NULL); pLogFont = &TextObj->logfont.elfEnumLogfontEx.elfLogFont; - if (! RtlCreateUnicodeString(&RequestedNameW, pLogFont->lfFaceName)) + if (!RtlCreateUnicodeString(&RequestedNameW, pLogFont->lfFaceName)) { if (!pTextObj) TEXTOBJ_UnlockText(TextObj); return STATUS_NO_MEMORY; } - DPRINT("Font '%ls' is substituted by: ", RequestedNameW.Buffer); - SubstituteFontName(&RequestedNameW); - DPRINT("'%ls'.\n", RequestedNameW.Buffer); + /* substitute */ + RequestedCharSet = pLogFont->lfCharSet; + DPRINT("Font '%ls,%u' is substituted by: ", + RequestedNameW.Buffer, RequestedCharSet); + SubstituteFontRecurse(&RequestedNameW, &RequestedCharSet); + DPRINT("'%ls,%u'.\n", RequestedNameW.Buffer, RequestedCharSet); MatchPenalty = 0xFFFFFFFF; TextObj->Font = NULL; @@ -3956,14 +4164,14 @@ /* Search private fonts */ IntLockProcessPrivateFonts(Win32Process); FindBestFontFromList(&TextObj->Font, &MatchPenalty, pLogFont, - &RequestedNameW, &ActualNameW, + &RequestedNameW, &ActualNameW, RequestedCharSet, &Win32Process->PrivateFontListHead); IntUnLockProcessPrivateFonts(Win32Process); /* Search system fonts */ IntLockGlobalFonts; FindBestFontFromList(&TextObj->Font, &MatchPenalty, pLogFont, - &RequestedNameW, &ActualNameW, + &RequestedNameW, &ActualNameW, RequestedCharSet, &FontListHead); IntUnLockGlobalFonts;
7 years, 9 months
1
0
0
0
← Newer
1
...
5
6
7
8
9
10
11
...
26
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
Results per page:
10
25
50
100
200