Windows ignores the names and descriptions in the registry when populating the Security tab in Internet Options. Do the same in Wine.
From: Alex Henrie alexhenrie24@gmail.com
Windows ignores the names and descriptions in the registry when populating the Security tab in Internet Options. Do the same in Wine.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=27245 --- dlls/inetcpl.cpl/inetcpl.h | 10 ++++++++ dlls/inetcpl.cpl/inetcpl.rc | 12 +++++++++ dlls/inetcpl.cpl/security.c | 49 ++++++++++++++++++++++++++++++++++--- dlls/urlmon/urlmon.inf | 2 ++ 4 files changed, 69 insertions(+), 4 deletions(-)
diff --git a/dlls/inetcpl.cpl/inetcpl.h b/dlls/inetcpl.cpl/inetcpl.h index ff7d7d535d0..906074c4c92 100644 --- a/dlls/inetcpl.cpl/inetcpl.h +++ b/dlls/inetcpl.cpl/inetcpl.h @@ -54,6 +54,16 @@ INT_PTR CALLBACK security_dlgproc(HWND, UINT, WPARAM, LPARAM); #define IDS_SEC_LEVEL3_INFO 0x230 #define IDS_SEC_LEVEL4_INFO 0x240 #define IDS_SEC_LEVEL5_INFO 0x250 +#define IDS_SEC_ZONE0_NAME 0x300 +#define IDS_SEC_ZONE1_NAME 0x301 +#define IDS_SEC_ZONE2_NAME 0x302 +#define IDS_SEC_ZONE3_NAME 0x303 +#define IDS_SEC_ZONE4_NAME 0x304 +#define IDS_SEC_ZONE0_DESC 0x400 +#define IDS_SEC_ZONE1_DESC 0x401 +#define IDS_SEC_ZONE2_DESC 0x402 +#define IDS_SEC_ZONE3_DESC 0x403 +#define IDS_SEC_ZONE4_DESC 0x404
/* dialogs */ #define IDC_STATIC -1 diff --git a/dlls/inetcpl.cpl/inetcpl.rc b/dlls/inetcpl.cpl/inetcpl.rc index 7ae2a53efdf..6f0ee480b34 100644 --- a/dlls/inetcpl.cpl/inetcpl.rc +++ b/dlls/inetcpl.cpl/inetcpl.rc @@ -36,6 +36,18 @@ BEGIN IDS_SEC_LEVEL3 "Medium" IDS_SEC_LEVEL4 "Increased" IDS_SEC_LEVEL5 "High" + + /* The English zone names and descriptions should be identical to the ones in dlls/urlmon/urlmon.inf */ + IDS_SEC_ZONE0_NAME "My Computer" + IDS_SEC_ZONE0_DESC "Your computer" + IDS_SEC_ZONE1_NAME "Local intranet" + IDS_SEC_ZONE1_DESC "This zone contains all Web sites that are on your organization's intranet." + IDS_SEC_ZONE2_NAME "Trusted sites" + IDS_SEC_ZONE2_DESC "This zone contains Web sites that you trust not to damage your computer or data." + IDS_SEC_ZONE3_NAME "Internet" + IDS_SEC_ZONE3_DESC "This zone contains all Web sites you haven't placed in other zones" + IDS_SEC_ZONE4_NAME "Restricted sites" + IDS_SEC_ZONE4_DESC "This zone contains Web sites that could potentially damage your computer or data." END
/* "General" propsheet */ diff --git a/dlls/inetcpl.cpl/security.c b/dlls/inetcpl.cpl/security.c index 05c6502043c..8cd749b751c 100644 --- a/dlls/inetcpl.cpl/security.c +++ b/dlls/inetcpl.cpl/security.c @@ -121,20 +121,61 @@ static void update_security_level(secdlg_data *sd, DWORD lv_index, DWORD tb_inde } }
+/********************************************************************* + * get_zone_name [internal] + * + * For the standard zones (0-4), ignores the name that was loaded from the + * registry and returns a name in the user's own language. + * + */ +static WCHAR * get_zone_name(const secdlg_data *sd, DWORD lv_index) +{ + static WCHAR name[64]; + DWORD zone = sd->zones[lv_index]; + + if (zone < 5) + { + LoadStringW(hcpl, IDS_SEC_ZONE0_NAME + zone, name, ARRAY_SIZE(name)); + return name; + } + + return sd->zone_attr[lv_index].szDisplayName; +} + +/********************************************************************* + * get_zone_description [internal] + * + * For the standard zones (0-4), ignores the description that was loaded from + * the registry and returns a description in the user's own language. + * + */ +static WCHAR * get_zone_description(const secdlg_data *sd, DWORD lv_index) +{ + static WCHAR description[512]; + DWORD zone = sd->zones[lv_index]; + + if (zone < 5) + { + LoadStringW(hcpl, IDS_SEC_ZONE0_DESC + zone, description, ARRAY_SIZE(description)); + return description; + } + + return sd->zone_attr[lv_index].szDescription; +} + /********************************************************************* * update_zone_info [internal] * */ static void update_zone_info(secdlg_data *sd, DWORD lv_index) { - ZONEATTRIBUTES *za = &sd->zone_attr[lv_index]; WCHAR name[MAX_PATH]; DWORD len;
- SetWindowTextW(GetDlgItem(sd->hsec, IDC_SEC_ZONE_INFO), za->szDescription); + SetWindowTextW(GetDlgItem(sd->hsec, IDC_SEC_ZONE_INFO), get_zone_description(sd, lv_index));
len = LoadStringW(hcpl, IDS_SEC_SETTINGS, name, ARRAY_SIZE(name)); - lstrcpynW(&name[len], za->szDisplayName, ARRAY_SIZE(name) - len - 1); + lstrcpynW(name + len, get_zone_name(sd, lv_index), ARRAY_SIZE(name) - len - 1);
TRACE("new title: %s\n", debugstr_w(name)); SetWindowTextW(GetDlgItem(sd->hsec, IDC_SEC_GROUP), name); @@ -182,7 +223,7 @@ static void add_zone_to_listview(secdlg_data *sd, DWORD *pindex, DWORD zone) lvitem.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM; lvitem.iItem = lv_index; lvitem.iSubItem = 0; - lvitem.pszText = za->szDisplayName; + lvitem.pszText = get_zone_name(sd, lv_index); lvitem.lParam = (LPARAM) zone;
/* format is "filename.ext#iconid" */ diff --git a/dlls/urlmon/urlmon.inf b/dlls/urlmon/urlmon.inf index 77bb8f21165..c0f1ad74748 100644 --- a/dlls/urlmon/urlmon.inf +++ b/dlls/urlmon/urlmon.inf @@ -440,6 +440,8 @@ ZONES_TRUSTED="Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones ZONES_INTERNET="Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3" ZONES_UNTRUSTED="Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\4"
+;; The English zone names and descriptions should be identical to the ones in dlls/inetcpl.cpl/inetcpl.rc + NAME_LOCAL="My Computer" DESC_LOCAL="Your computer" ZICON_LOCAL="explorer.exe#0100"
Alfred Agrell (@Alcaro) commented about dlls/inetcpl.cpl/inetcpl.rc:
IDS_SEC_LEVEL3 "Medium" IDS_SEC_LEVEL4 "Increased" IDS_SEC_LEVEL5 "High"
- /* The English zone names and descriptions should be identical to the ones in dlls/urlmon/urlmon.inf */
- IDS_SEC_ZONE0_NAME "My Computer"
- IDS_SEC_ZONE0_DESC "Your computer"
- IDS_SEC_ZONE1_NAME "Local intranet"
- IDS_SEC_ZONE1_DESC "This zone contains all Web sites that are on your organization's intranet."
- IDS_SEC_ZONE2_NAME "Trusted sites"
- IDS_SEC_ZONE2_DESC "This zone contains Web sites that you trust not to damage your computer or data."
- IDS_SEC_ZONE3_NAME "Internet"
- IDS_SEC_ZONE3_DESC "This zone contains all Web sites you haven't placed in other zones"
This one doesn't have a trailing period. Is that intentional?
On Sun Dec 29 22:27:53 2024 +0000, Alfred Agrell wrote:
This one doesn't have a trailing period. Is that intentional?
I copied and pasted from urlmon.inf, whose description for Zone 3 also doesn't have a period. I just checked and Windows doesn't have a period in Zone 3's description either. Maybe we should add one to be consistent with the other zones' descriptions, but that's tangential to the purpose of this merge request.
Jacek Caban (@jacek) commented about dlls/inetcpl.cpl/security.c:
}
}
+/*********************************************************************
- get_zone_name [internal]
- For the standard zones (0-4), ignores the name that was loaded from the
- registry and returns a name in the user's own language.
- */
+static WCHAR * get_zone_name(const secdlg_data *sd, DWORD lv_index)
I think it might be easier to override the stored strings directly in `add_zone_to_listview`, right after the `IInternetZoneManager_GetZoneAttributes` call. Also, did you check whether `GetZoneAttributes()` returns translated strings on Windows?
On Mon Jan 27 22:26:52 2025 +0000, Jacek Caban wrote:
I think it might be easier to override the stored strings directly in `add_zone_to_listview`, right after the `IInternetZoneManager_GetZoneAttributes` call. Also, did you check whether `GetZoneAttributes()` returns translated strings on Windows?
Shoot, you're right: GetZoneAttributes always returns the correct localized strings, regardless of what's in the registry. So the translations need to be in urlmon, not in inetcpl. Thanks for pointing that out!
This merge request was closed by Alex Henrie.