[KERNEL32][WINNLS] GetGeoInfoW: Allow to get localized text

Previous implementation ignored the last LangId parameter,
and always used GetUserDefaultLCID() instead.
This commit is contained in:
Stanislav Motylkov 2021-10-24 20:04:57 +03:00
parent 1b35626d54
commit 4278f46620
No known key found for this signature in database
GPG Key ID: AFE513258CBA9E92
2 changed files with 29 additions and 6 deletions

View File

@ -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;

View File

@ -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;
}