From 8adebaaab73d67386ba05f0677523ead4e185f6b Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Fri, 18 Mar 2022 13:46:30 +0100 Subject: [PATCH] mlang: Use a registry script to register codepages. Signed-off-by: Alexandre Julliard --- dlls/mlang/Makefile.in | 8 +- dlls/mlang/mlang.c | 63 --------- dlls/mlang/mlang.rc | 20 +++ dlls/mlang/mlang.rgs | 372 +++++++++++++++++++++++++++++++++++++++++++++++++ loader/wine.inf.in | 1 - 5 files changed, 396 insertions(+), 68 deletions(-) create mode 100644 dlls/mlang/mlang.rc create mode 100644 dlls/mlang/mlang.rgs diff --git a/dlls/mlang/Makefile.in b/dlls/mlang/Makefile.in index abee2a2d8b5..6fe383da010 100644 --- a/dlls/mlang/Makefile.in +++ b/dlls/mlang/Makefile.in @@ -3,7 +3,7 @@ IMPORTLIB = mlang IMPORTS = uuid ole32 gdi32 advapi32 DELAYIMPORTS = oleaut32 -C_SRCS = \ - mlang.c - -IDL_SRCS = mlang_classes.idl +SOURCES = \ + mlang.c \ + mlang.rc \ + mlang_classes.idl diff --git a/dlls/mlang/mlang.c b/dlls/mlang/mlang.c index e0d0be2ad8e..35ae7aabec9 100644 --- a/dlls/mlang/mlang.c +++ b/dlls/mlang/mlang.c @@ -3922,69 +3922,6 @@ HRESULT WINAPI DllCanUnloadNow(void) return dll_count == 0 ? S_OK : S_FALSE; } -static BOOL register_codepages(void) -{ - const struct mlang_data *family; - const MIME_CP_INFO *info; - HKEY db_key, key; - WCHAR buf[32]; - LSTATUS status; - - status = RegCreateKeyW(HKEY_CLASSES_ROOT, L"MIME\\Database\\Codepage", &db_key); - if (status != ERROR_SUCCESS) - return FALSE; - - for (family = mlang_data; family < mlang_data + ARRAY_SIZE(mlang_data); family++) - { - for (info = family->mime_cp_info; info < family->mime_cp_info + family->number_of_cp; info++) - { - swprintf(buf, ARRAY_SIZE(buf), L"%u", info->cp); - status = RegCreateKeyW(db_key, buf, &key); - if (status != ERROR_SUCCESS) - continue; - - RegSetValueExA(key, "BodyCharset", 0, REG_SZ, (BYTE*)info->body_charset, - strlen(info->body_charset) + 1); - - if (info->cp == family->family_codepage) - { - RegSetValueExA(key, "FixedWidthFont", 0, REG_SZ, (BYTE*)family->fixed_font, - strlen(family->fixed_font) + 1); - RegSetValueExA(key, "ProportionalFont", 0, REG_SZ, (BYTE*)family->proportional_font, - strlen(family->proportional_font) + 1); - } - else - { - RegSetValueExW(key, L"Family", 0, REG_DWORD, (BYTE*)&family->family_codepage, - sizeof(family->family_codepage)); - } - - RegCloseKey(key); - } - } - - RegCloseKey(db_key); - return TRUE; -} - -/*********************************************************************** - * DllRegisterServer (MLANG.@) - */ -HRESULT WINAPI DllRegisterServer(void) -{ - if(!register_codepages()) - return E_FAIL; - return __wine_register_resources(); -} - -/*********************************************************************** - * DllUnregisterServer (MLANG.@) - */ -HRESULT WINAPI DllUnregisterServer(void) -{ - return __wine_unregister_resources(); -} - HRESULT WINAPI GetGlobalFontLinkObject(void **unknown) { if (!unknown) return E_INVALIDARG; diff --git a/dlls/mlang/mlang.rc b/dlls/mlang/mlang.rc new file mode 100644 index 00000000000..61e7cd3f8dd --- /dev/null +++ b/dlls/mlang/mlang.rc @@ -0,0 +1,20 @@ +/* + * Copyright 2022 Alexandre Julliard + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +/* @makedep: mlang.rgs */ +2 WINE_REGISTRY mlang.rgs diff --git a/dlls/mlang/mlang.rgs b/dlls/mlang/mlang.rgs new file mode 100644 index 00000000000..585d7946b64 --- /dev/null +++ b/dlls/mlang/mlang.rgs @@ -0,0 +1,372 @@ +HKCR +{ + NoRemove MIME + { + NoRemove Database + { + Codepage + { + 37 + { + val 'BodyCharset' = s 'ibm037' + val 'Family' = d 1252 + } + 424 + { + val 'BodyCharset' = s 'ibm424' + val 'Family' = d 1255 + } + 437 + { + val 'BodyCharset' = s 'ibm437' + val 'Family' = d 1252 + } + 500 + { + val 'BodyCharset' = s 'ibm500' + val 'Family' = d 1252 + } + 708 + { + val 'BodyCharset' = s 'ASMO-708' + val 'Family' = d 1256 + } + 720 + { + val 'BodyCharset' = s 'DOS-720' + val 'Family' = d 1256 + } + 737 + { + val 'BodyCharset' = s 'ibm737' + val 'Family' = d 1253 + } + 775 + { + val 'BodyCharset' = s 'ibm775' + val 'Family' = d 1257 + } + 850 + { + val 'BodyCharset' = s 'ibm850' + val 'Family' = d 1252 + } + 852 + { + val 'BodyCharset' = s 'ibm852' + val 'Family' = d 1250 + } + 855 + { + val 'BodyCharset' = s 'ibm855' + val 'Family' = d 1251 + } + 856 + { + val 'BodyCharset' = s 'cp856' + val 'Family' = d 1255 + } + 857 + { + val 'BodyCharset' = s 'ibm857' + val 'Family' = d 1254 + } + 860 + { + val 'BodyCharset' = s 'ibm860' + val 'Family' = d 1252 + } + 861 + { + val 'BodyCharset' = s 'ibm861' + val 'Family' = d 1252 + } + 862 + { + val 'BodyCharset' = s 'dos-862' + val 'Family' = d 1255 + } + 863 + { + val 'BodyCharset' = s 'ibm863' + val 'Family' = d 1252 + } + 864 + { + val 'BodyCharset' = s 'ibm864' + val 'Family' = d 1256 + } + 865 + { + val 'BodyCharset' = s 'ibm865' + val 'Family' = d 1252 + } + 866 + { + val 'BodyCharset' = s 'cp866' + val 'Family' = d 1251 + } + 869 + { + val 'BodyCharset' = s 'ibm869' + val 'Family' = d 1253 + } + 874 + { + val 'BodyCharset' = s 'ibm-thai' + val 'FixedWidthFont' = s 'Tahoma' + val 'ProportionalFont' = s 'Tahoma' + } + 875 + { + val 'BodyCharset' = s 'cp875' + val 'Family' = d 1253 + } + 932 + { + val 'BodyCharset' = s 'iso-2022-jp' + val 'FixedWidthFont' = s 'MS Gothic' + val 'ProportionalFont' = s 'MS PGothic' + } + 936 + { + val 'BodyCharset' = s 'gbk' + val 'FixedWidthFont' = s 'Simsun' + val 'ProportionalFont' = s 'Simsun' + } + 949 + { + val 'BodyCharset' = s 'euc-kr' + val 'FixedWidthFont' = s 'GulimChe' + val 'ProportionalFont' = s 'Gulim' + } + 950 + { + val 'BodyCharset' = s 'big5' + val 'FixedWidthFont' = s 'MingLiu' + val 'ProportionalFont' = s 'New MingLiu' + } + 1006 + { + val 'BodyCharset' = s 'ibm1006' + val 'Family' = d 1256 + } + 1026 + { + val 'BodyCharset' = s 'ibm1026' + val 'Family' = d 1254 + } + 1200 + { + val 'BodyCharset' = s 'unicode' + val 'FixedWidthFont' = s 'Courier New' + val 'ProportionalFont' = s 'Arial' + } + 1250 + { + val 'BodyCharset' = s 'iso-8859-2' + val 'FixedWidthFont' = s 'Courier New' + val 'ProportionalFont' = s 'Arial' + } + 1251 + { + val 'BodyCharset' = s 'koi8-r' + val 'FixedWidthFont' = s 'Courier New' + val 'ProportionalFont' = s 'Arial' + } + 1252 + { + val 'BodyCharset' = s 'iso-8859-1' + val 'FixedWidthFont' = s 'Courier New' + val 'ProportionalFont' = s 'Arial' + } + 1253 + { + val 'BodyCharset' = s 'iso-8859-7' + val 'FixedWidthFont' = s 'Courier New' + val 'ProportionalFont' = s 'Arial' + } + 1254 + { + val 'BodyCharset' = s 'iso-8859-9' + val 'FixedWidthFont' = s 'Courier New' + val 'ProportionalFont' = s 'Arial' + } + 1255 + { + val 'BodyCharset' = s 'windows-1255' + val 'FixedWidthFont' = s 'Miriam Fixed' + val 'ProportionalFont' = s 'David' + } + 1256 + { + val 'BodyCharset' = s 'iso-8859-6' + val 'FixedWidthFont' = s 'Simplified Arabic Fixed' + val 'ProportionalFont' = s 'Simplified Arabic' + } + 1257 + { + val 'BodyCharset' = s 'iso-8859-4' + val 'FixedWidthFont' = s 'Courier New' + val 'ProportionalFont' = s 'Arial' + } + 1258 + { + val 'BodyCharset' = s 'windows-1258' + val 'FixedWidthFont' = s 'Courier New' + val 'ProportionalFont' = s 'Arial' + } + 20000 + { + val 'BodyCharset' = s 'x-Chinese-CNS' + val 'Family' = d 950 + } + 20127 + { + val 'BodyCharset' = s 'us-ascii' + val 'Family' = d 1252 + } + 20866 + { + val 'BodyCharset' = s 'koi8-r' + val 'Family' = d 1251 + } + 20932 + { + val 'BodyCharset' = s 'EUC-JP' + val 'Family' = d 932 + } + 20936 + { + val 'BodyCharset' = s 'x-cp20936' + val 'Family' = d 936 + } + 21866 + { + val 'BodyCharset' = s 'koi8-ru' + val 'Family' = d 1251 + } + 28591 + { + val 'BodyCharset' = s 'iso-8859-1' + val 'Family' = d 1252 + } + 28592 + { + val 'BodyCharset' = s 'iso-8859-2' + val 'Family' = d 1250 + } + 28593 + { + val 'BodyCharset' = s 'iso-8859-3' + val 'Family' = d 1254 + } + 28594 + { + val 'BodyCharset' = s 'iso-8859-4' + val 'Family' = d 1257 + } + 28595 + { + val 'BodyCharset' = s 'iso-8859-5' + val 'Family' = d 1251 + } + 28596 + { + val 'BodyCharset' = s 'iso-8859-6' + val 'Family' = d 1256 + } + 28597 + { + val 'BodyCharset' = s 'iso-8859-7' + val 'Family' = d 1253 + } + 28598 + { + val 'BodyCharset' = s 'iso-8859-8' + val 'Family' = d 1255 + } + 28599 + { + val 'BodyCharset' = s 'iso-8859-9' + val 'Family' = d 1254 + } + 28603 + { + val 'BodyCharset' = s 'iso-8859-13' + val 'Family' = d 1257 + } + 28605 + { + val 'BodyCharset' = s 'iso-8859-15' + val 'Family' = d 1252 + } + 50220 + { + val 'BodyCharset' = s 'iso-2022-jp' + val 'Family' = d 932 + } + 50221 + { + val 'BodyCharset' = s 'iso-2022-jp' + val 'Family' = d 932 + } + 50222 + { + val 'BodyCharset' = s 'iso-2022-jp' + val 'Family' = d 932 + } + 50932 + { + val 'BodyCharset' = s '_autodetect' + val 'Family' = d 932 + } + 50936 + { + val 'BodyCharset' = s '_autodetect_chs' + val 'Family' = d 936 + } + 50949 + { + val 'BodyCharset' = s '_autodetect_kr' + val 'Family' = d 949 + } + 50950 + { + val 'BodyCharset' = s '_autodetect_cht' + val 'Family' = d 950 + } + 51932 + { + val 'BodyCharset' = s 'euc-jp' + val 'Family' = d 932 + } + 51949 + { + val 'BodyCharset' = s 'euc-kr' + val 'Family' = d 951 + } + 52936 + { + val 'BodyCharset' = s 'hz-gb-2312' + val 'Family' = d 936 + } + 54936 + { + val 'BodyCharset' = s 'GB18030' + val 'Family' = d 936 + } + 65000 + { + val 'BodyCharset' = s 'utf-7' + val 'Family' = d 1200 + } + 65001 + { + val 'BodyCharset' = s 'utf-8' + val 'Family' = d 1200 + } + } + } + } +} diff --git a/loader/wine.inf.in b/loader/wine.inf.in index 3e6194a3929..055c88e10c4 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -2581,7 +2581,6 @@ HKLM,%CurrentVersion%\Telephony\Country List\998,"SameAreaRule",,"G" 11,,cryptdlg.dll,1 11,,cryptnet.dll,1 11,,devenum.dll,1 -11,,mlang.dll,1 11,,mp3dmod.dll,1 11,,mscoree.dll,1 11,,mshtml.dll,1 -- 2.11.4.GIT