Moved a couple of locale functions from ole2nls.c into locale.c.
This commit is contained in:
parent
7463af6b2f
commit
408d0fd626
|
@ -789,6 +789,99 @@ BOOL WINAPI SetThreadLocale( LCID lcid ) /* [in] Locale identifier */
|
|||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* ConvertDefaultLocale (KERNEL32.@)
|
||||
*/
|
||||
LCID WINAPI ConvertDefaultLocale( LCID lcid )
|
||||
{
|
||||
switch (lcid)
|
||||
{
|
||||
case LOCALE_SYSTEM_DEFAULT:
|
||||
return GetSystemDefaultLCID();
|
||||
case LOCALE_USER_DEFAULT:
|
||||
return GetUserDefaultLCID();
|
||||
case LOCALE_NEUTRAL:
|
||||
return MAKELCID (LANG_NEUTRAL, SUBLANG_NEUTRAL);
|
||||
}
|
||||
return MAKELANGID( PRIMARYLANGID(lcid), SUBLANG_NEUTRAL);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* IsValidLocale (KERNEL32.@)
|
||||
*/
|
||||
BOOL WINAPI IsValidLocale( LCID lcid, DWORD flags )
|
||||
{
|
||||
/* check if language is registered in the kernel32 resources */
|
||||
return FindResourceExW( GetModuleHandleA("KERNEL32"), RT_STRINGW,
|
||||
(LPCWSTR)LOCALE_ILANGUAGE, LANGIDFROMLCID(lcid)) != 0;
|
||||
}
|
||||
|
||||
|
||||
static BOOL CALLBACK enum_lang_proc_a( HMODULE hModule, LPCSTR type,
|
||||
LPCSTR name, WORD LangID, LONG lParam )
|
||||
{
|
||||
LOCALE_ENUMPROCA lpfnLocaleEnum = (LOCALE_ENUMPROCA)lParam;
|
||||
char buf[20];
|
||||
|
||||
sprintf(buf, "%08x", (UINT)LangID);
|
||||
return lpfnLocaleEnum( buf );
|
||||
}
|
||||
|
||||
static BOOL CALLBACK enum_lang_proc_w( HMODULE hModule, LPCWSTR type,
|
||||
LPCWSTR name, WORD LangID, LONG lParam )
|
||||
{
|
||||
static const WCHAR formatW[] = {'%','0','8','x',0};
|
||||
LOCALE_ENUMPROCW lpfnLocaleEnum = (LOCALE_ENUMPROCW)lParam;
|
||||
WCHAR buf[20];
|
||||
sprintfW( buf, formatW, (UINT)LangID );
|
||||
return lpfnLocaleEnum( buf );
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* EnumSystemLocalesA (KERNEL32.@)
|
||||
*/
|
||||
BOOL WINAPI EnumSystemLocalesA(LOCALE_ENUMPROCA lpfnLocaleEnum,
|
||||
DWORD flags)
|
||||
{
|
||||
TRACE("(%p,%08lx)\n", lpfnLocaleEnum,flags);
|
||||
EnumResourceLanguagesA( GetModuleHandleA("KERNEL32"), RT_STRINGA,
|
||||
(LPCSTR)LOCALE_ILANGUAGE, enum_lang_proc_a,
|
||||
(LONG)lpfnLocaleEnum);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* EnumSystemLocalesW (KERNEL32.@)
|
||||
*/
|
||||
BOOL WINAPI EnumSystemLocalesW( LOCALE_ENUMPROCW lpfnLocaleEnum, DWORD flags )
|
||||
{
|
||||
TRACE("(%p,%08lx)\n", lpfnLocaleEnum,flags);
|
||||
EnumResourceLanguagesW( GetModuleHandleA("KERNEL32"), RT_STRINGW,
|
||||
(LPCWSTR)LOCALE_ILANGUAGE, enum_lang_proc_w,
|
||||
(LONG)lpfnLocaleEnum);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* VerLanguageNameA (KERNEL32.@)
|
||||
*/
|
||||
DWORD WINAPI VerLanguageNameA( UINT wLang, LPSTR szLang, UINT nSize )
|
||||
{
|
||||
return GetLocaleInfoA( MAKELCID(wLang, SORT_DEFAULT), LOCALE_SENGLANGUAGE, szLang, nSize );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* VerLanguageNameW (KERNEL32.@)
|
||||
*/
|
||||
DWORD WINAPI VerLanguageNameW( UINT wLang, LPWSTR szLang, UINT nSize )
|
||||
{
|
||||
return GetLocaleInfoW( MAKELCID(wLang, SORT_DEFAULT), LOCALE_SENGLANGUAGE, szLang, nSize );
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* GetStringTypeW (KERNEL32.@)
|
||||
|
|
101
ole/ole2nls.c
101
ole/ole2nls.c
|
@ -44,107 +44,6 @@
|
|||
WINE_DEFAULT_DEBUG_CHANNEL(nls);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* ConvertDefaultLocale (KERNEL32.@)
|
||||
*/
|
||||
LCID WINAPI ConvertDefaultLocale (LCID lcid)
|
||||
{ switch (lcid)
|
||||
{ case LOCALE_SYSTEM_DEFAULT:
|
||||
return GetSystemDefaultLCID();
|
||||
case LOCALE_USER_DEFAULT:
|
||||
return GetUserDefaultLCID();
|
||||
case LOCALE_NEUTRAL:
|
||||
return MAKELCID (LANG_NEUTRAL, SUBLANG_NEUTRAL);
|
||||
}
|
||||
return MAKELANGID( PRIMARYLANGID(lcid), SUBLANG_NEUTRAL);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* IsValidLocale [KERNEL32.@]
|
||||
*/
|
||||
BOOL WINAPI IsValidLocale(LCID lcid,DWORD flags)
|
||||
{
|
||||
/* check if language is registered in the kernel32 resources */
|
||||
if(!FindResourceExW(GetModuleHandleA("KERNEL32"), RT_STRINGW, (LPCWSTR)LOCALE_ILANGUAGE, LOWORD(lcid)))
|
||||
return FALSE;
|
||||
else
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL CALLBACK EnumResourceLanguagesProcW(HMODULE hModule, LPCWSTR type,
|
||||
LPCWSTR name, WORD LangID, LONG lParam)
|
||||
{
|
||||
CHAR bufA[20];
|
||||
WCHAR bufW[20];
|
||||
LOCALE_ENUMPROCW lpfnLocaleEnum = (LOCALE_ENUMPROCW)lParam;
|
||||
sprintf(bufA, "%08x", (UINT)LangID);
|
||||
MultiByteToWideChar(CP_ACP, 0, bufA, -1, bufW, sizeof(bufW)/sizeof(bufW[0]));
|
||||
return lpfnLocaleEnum(bufW);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* EnumSystemLocalesW [KERNEL32.@]
|
||||
*/
|
||||
BOOL WINAPI EnumSystemLocalesW( LOCALE_ENUMPROCW lpfnLocaleEnum,
|
||||
DWORD flags )
|
||||
{
|
||||
TRACE("(%p,%08lx)\n", lpfnLocaleEnum,flags);
|
||||
|
||||
EnumResourceLanguagesW(GetModuleHandleA("KERNEL32"), RT_STRINGW,
|
||||
(LPCWSTR)LOCALE_ILANGUAGE, EnumResourceLanguagesProcW,
|
||||
(LONG)lpfnLocaleEnum);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL CALLBACK EnumResourceLanguagesProcA(HMODULE hModule, LPCSTR type,
|
||||
LPCSTR name, WORD LangID, LONG lParam)
|
||||
{
|
||||
CHAR bufA[20];
|
||||
LOCALE_ENUMPROCA lpfnLocaleEnum = (LOCALE_ENUMPROCA)lParam;
|
||||
sprintf(bufA, "%08x", (UINT)LangID);
|
||||
return lpfnLocaleEnum(bufA);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* EnumSystemLocalesA [KERNEL32.@]
|
||||
*/
|
||||
BOOL WINAPI EnumSystemLocalesA(LOCALE_ENUMPROCA lpfnLocaleEnum,
|
||||
DWORD flags)
|
||||
{
|
||||
TRACE("(%p,%08lx)\n", lpfnLocaleEnum,flags);
|
||||
|
||||
EnumResourceLanguagesA(GetModuleHandleA("KERNEL32"), RT_STRINGA,
|
||||
(LPCSTR)LOCALE_ILANGUAGE, EnumResourceLanguagesProcA,
|
||||
(LONG)lpfnLocaleEnum);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* VerLanguageNameA [KERNEL32.@]
|
||||
*/
|
||||
DWORD WINAPI VerLanguageNameA( UINT wLang, LPSTR szLang, UINT nSize )
|
||||
{
|
||||
if(!szLang)
|
||||
return 0;
|
||||
|
||||
return GetLocaleInfoA(MAKELCID(wLang, SORT_DEFAULT), LOCALE_SENGLANGUAGE, szLang, nSize);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* VerLanguageNameW [KERNEL32.@]
|
||||
*/
|
||||
DWORD WINAPI VerLanguageNameW( UINT wLang, LPWSTR szLang, UINT nSize )
|
||||
{
|
||||
if(!szLang)
|
||||
return 0;
|
||||
|
||||
return GetLocaleInfoW(MAKELCID(wLang, SORT_DEFAULT), LOCALE_SENGLANGUAGE, szLang, nSize);
|
||||
}
|
||||
|
||||
|
||||
static const unsigned char LCM_Unicode_LUT[] = {
|
||||
6 , 3, /* - 1 */
|
||||
6 , 4, /* - 2 */
|
||||
|
|
Loading…
Reference in New Issue