https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4278f46620dcd914daaf4…
commit 4278f46620dcd914daaf44b10f788c1fd50874b6
Author: Stanislav Motylkov <x86corez(a)gmail.com>
AuthorDate: Sun Oct 24 20:04:57 2021 +0300
Commit: Stanislav Motylkov <x86corez(a)gmail.com>
CommitDate: Sun Oct 24 23:42:06 2021 +0300
[KERNEL32][WINNLS] GetGeoInfoW: Allow to get localized text
Previous implementation ignored the last LangId parameter,
and always used GetUserDefaultLCID() instead.
---
dll/win32/kernel32/winnls/string/lang.c | 20 ++++++++++++++++++++
dll/win32/kernel32/winnls/string/nls.c | 15 +++++++++------
2 files changed, 29 insertions(+), 6 deletions(-)
diff --git a/dll/win32/kernel32/winnls/string/lang.c
b/dll/win32/kernel32/winnls/string/lang.c
index 000b3e11bd0..06be3da8cb7 100644
--- a/dll/win32/kernel32/winnls/string/lang.c
+++ b/dll/win32/kernel32/winnls/string/lang.c
@@ -36,7 +36,11 @@ DEBUG_CHANNEL(nls);
extern int wine_fold_string(int flags, const WCHAR *src, int srclen, WCHAR *dst, int
dstlen);
extern int wine_get_sortkey(int flags, const WCHAR *src, int srclen, char *dst, int
dstlen);
extern int wine_compare_string(int flags, const WCHAR *str1, int len1, const WCHAR *str2,
int len2);
+#ifdef __REACTOS__
+extern UINT GetLocalisedText(IN UINT uID, IN LPWSTR lpszDest, IN UINT cchDest, IN LANGID
lang);
+#else
extern UINT GetLocalisedText(IN UINT uID, IN LPWSTR lpszDest, IN UINT cchDest);
+#endif
#define NLSRC_OFFSET 5000 /* FIXME */
extern HMODULE kernel32_handle;
@@ -3503,16 +3507,28 @@ BOOL WINAPI EnumUILanguagesW(UILANGUAGE_ENUMPROCW pUILangEnumProc,
DWORD dwFlags
}
static int
+#ifdef __REACTOS__
+NLS_GetGeoFriendlyName(GEOID Location, LPWSTR szFriendlyName, int cchData, LANGID lang)
+#else
NLS_GetGeoFriendlyName(GEOID Location, LPWSTR szFriendlyName, int cchData)
+#endif
{
/* FIXME: move *.nls resources out of kernel32 into locale.nls */
Location += NLSRC_OFFSET;
Location &= 0xFFFF;
if (cchData == 0)
+#ifdef __REACTOS__
+ return GetLocalisedText(Location, NULL, 0, lang);
+#else
return GetLocalisedText(Location, NULL, 0);
+#endif
+#ifdef __REACTOS__
+ if (GetLocalisedText(Location, szFriendlyName, (UINT)cchData, lang))
+#else
if (GetLocalisedText(Location, szFriendlyName, (UINT)cchData))
+#endif
return strlenW(szFriendlyName) + 1;
return 0;
@@ -3564,7 +3580,11 @@ INT WINAPI GetGeoInfoW(GEOID geoid, GEOTYPE geotype, LPWSTR data,
int data_len,
switch (geotype) {
case GEO_FRIENDLYNAME:
{
+#ifdef __REACTOS__
+ return NLS_GetGeoFriendlyName(geoid, data, data_len, lang);
+#else
return NLS_GetGeoFriendlyName(geoid, data, data_len);
+#endif
}
case GEO_NATION:
val = geoid;
diff --git a/dll/win32/kernel32/winnls/string/nls.c
b/dll/win32/kernel32/winnls/string/nls.c
index 712545f6da4..7264fa73cae 100644
--- a/dll/win32/kernel32/winnls/string/nls.c
+++ b/dll/win32/kernel32/winnls/string/nls.c
@@ -1828,7 +1828,8 @@ UINT
GetLocalisedText(
IN UINT uID,
IN LPWSTR lpszDest,
- IN UINT cchDest)
+ IN UINT cchDest,
+ IN LANGID lang)
{
HRSRC hrsrc;
HGLOBAL hmem;
@@ -1841,8 +1842,7 @@ GetLocalisedText(
if (uID == 37)
uID = uID * 100;
- lcid = GetUserDefaultLCID();
- lcid = ConvertDefaultLocale(lcid);
+ lcid = ConvertDefaultLocale(lang);
langId = LANGIDFROMLCID(lcid);
@@ -1981,7 +1981,8 @@ GetCPInfoExW(UINT CodePage,
lpCPInfoEx->UnicodeDefaultChar = 0x3f;
return GetLocalisedText(lpCPInfoEx->CodePage,
lpCPInfoEx->CodePageName,
- ARRAYSIZE(lpCPInfoEx->CodePageName)) != 0;
+ ARRAYSIZE(lpCPInfoEx->CodePageName),
+ GetThreadLocale()) != 0;
}
break;
@@ -1991,7 +1992,8 @@ GetCPInfoExW(UINT CodePage,
lpCPInfoEx->UnicodeDefaultChar = 0x3f;
return GetLocalisedText(lpCPInfoEx->CodePage,
lpCPInfoEx->CodePageName,
- ARRAYSIZE(lpCPInfoEx->CodePageName)) != 0;
+ ARRAYSIZE(lpCPInfoEx->CodePageName),
+ GetThreadLocale()) != 0;
}
default:
@@ -2010,7 +2012,8 @@ GetCPInfoExW(UINT CodePage,
lpCPInfoEx->UnicodeDefaultChar =
CodePageEntry->CodePageTable.UniDefaultChar;
return GetLocalisedText(lpCPInfoEx->CodePage,
lpCPInfoEx->CodePageName,
- ARRAYSIZE(lpCPInfoEx->CodePageName)) != 0;
+ ARRAYSIZE(lpCPInfoEx->CodePageName),
+ GetThreadLocale()) != 0;
}
break;
}