Added support for getting and setting the UI language.
This commit is contained in:
parent
a370fa83cb
commit
81b22375d0
|
@ -503,9 +503,9 @@ static int charset_cmp( const void *name, const void *entry )
|
|||
}
|
||||
|
||||
/***********************************************************************
|
||||
* init_default_lcid
|
||||
* get_env_lcid
|
||||
*/
|
||||
static LCID init_default_lcid( UINT *unix_cp, const char *env_str )
|
||||
static LCID get_env_lcid( UINT *unix_cp, const char *env_str )
|
||||
{
|
||||
char *buf, *lang,*country,*charset,*dialect,*next;
|
||||
LCID ret = 0;
|
||||
|
@ -527,7 +527,7 @@ static LCID init_default_lcid( UINT *unix_cp, const char *env_str )
|
|||
country=strchr(lang,'_'); if (country) *country++='\0';
|
||||
|
||||
ret = get_language_id(lang, country, charset, dialect);
|
||||
if (ret && charset)
|
||||
if (ret && charset && unix_cp)
|
||||
{
|
||||
const struct charset_entry *entry;
|
||||
char charset_name[16];
|
||||
|
@ -593,7 +593,7 @@ LANGID WINAPI GetUserDefaultLangID(void)
|
|||
*/
|
||||
LANGID WINAPI GetSystemDefaultLangID(void)
|
||||
{
|
||||
return GetUserDefaultLangID();
|
||||
return LANGIDFROMLCID(GetSystemDefaultLCID());
|
||||
}
|
||||
|
||||
|
||||
|
@ -648,7 +648,9 @@ LCID WINAPI GetSystemDefaultLCID(void)
|
|||
*/
|
||||
LANGID WINAPI GetUserDefaultUILanguage(void)
|
||||
{
|
||||
return GetUserDefaultLangID();
|
||||
LANGID lang;
|
||||
NtQueryDefaultUILanguage( &lang );
|
||||
return lang;
|
||||
}
|
||||
|
||||
|
||||
|
@ -666,7 +668,9 @@ LANGID WINAPI GetUserDefaultUILanguage(void)
|
|||
*/
|
||||
LANGID WINAPI GetSystemDefaultUILanguage(void)
|
||||
{
|
||||
return GetSystemDefaultLangID();
|
||||
LANGID lang;
|
||||
NtQueryInstallUILanguage( &lang );
|
||||
return lang;
|
||||
}
|
||||
|
||||
|
||||
|
@ -2483,11 +2487,15 @@ void LOCALE_Init(void)
|
|||
const union cptable *unix_cp );
|
||||
|
||||
UINT ansi_cp = 1252, oem_cp = 437, mac_cp = 10000, unix_cp = ~0U;
|
||||
LCID lcid = init_default_lcid( &unix_cp, NULL );
|
||||
LCID lcid;
|
||||
|
||||
lcid = get_env_lcid( NULL, NULL );
|
||||
NtSetDefaultLocale( TRUE, lcid );
|
||||
|
||||
lcid = init_default_lcid( &unix_cp, "LC_CTYPE" );
|
||||
lcid = get_env_lcid( NULL, "LC_MESSAGES" );
|
||||
NtSetDefaultUILanguage( LANGIDFROMLCID(lcid) );
|
||||
|
||||
lcid = get_env_lcid( &unix_cp, "LC_CTYPE" );
|
||||
NtSetDefaultLocale( FALSE, lcid );
|
||||
|
||||
ansi_cp = get_lcid_codepage(lcid);
|
||||
|
|
|
@ -161,6 +161,7 @@
|
|||
@ stdcall NtPulseEvent(long ptr)
|
||||
@ stdcall NtQueryAttributesFile(ptr ptr)
|
||||
@ stdcall NtQueryDefaultLocale(long ptr)
|
||||
@ stdcall NtQueryDefaultUILanguage(ptr)
|
||||
@ stdcall NtQueryDirectoryFile(long long ptr ptr ptr ptr long long long ptr long)
|
||||
@ stdcall NtQueryDirectoryObject(long ptr long long long ptr ptr)
|
||||
@ stub NtQueryEaFile
|
||||
|
@ -171,6 +172,7 @@
|
|||
@ stdcall NtQueryInformationProcess(long long ptr long ptr)
|
||||
@ stdcall NtQueryInformationThread(long long ptr long ptr)
|
||||
@ stdcall NtQueryInformationToken(long long ptr long ptr)
|
||||
@ stdcall NtQueryInstallUILanguage(ptr)
|
||||
@ stub NtQueryIntervalProfile
|
||||
@ stub NtQueryIoCompletion
|
||||
@ stdcall NtQueryKey (long long ptr long ptr)
|
||||
|
@ -217,6 +219,7 @@
|
|||
@ stdcall NtSetContextThread(long ptr)
|
||||
@ stub NtSetDefaultHardErrorPort
|
||||
@ stdcall NtSetDefaultLocale(long long)
|
||||
@ stdcall NtSetDefaultUILanguage(long)
|
||||
@ stub NtSetEaFile
|
||||
@ stdcall NtSetEvent(long long)
|
||||
@ stub NtSetHighEventPair
|
||||
|
@ -740,6 +743,7 @@
|
|||
@ stdcall ZwPulseEvent(long ptr) NtPulseEvent
|
||||
@ stdcall ZwQueryAttributesFile(ptr ptr) NtQueryAttributesFile
|
||||
@ stdcall ZwQueryDefaultLocale(long ptr) NtQueryDefaultLocale
|
||||
@ stdcall ZwQueryDefaultUILanguage(ptr) NtQueryDefaultUILanguage
|
||||
@ stdcall ZwQueryDirectoryFile(long long ptr ptr ptr ptr long long long ptr long)NtQueryDirectoryFile
|
||||
@ stdcall ZwQueryDirectoryObject(long ptr long long long ptr ptr) NtQueryDirectoryObject
|
||||
@ stub ZwQueryEaFile
|
||||
|
@ -749,6 +753,7 @@
|
|||
@ stdcall ZwQueryInformationProcess(long long ptr long ptr) NtQueryInformationProcess
|
||||
@ stdcall ZwQueryInformationThread(long long ptr long ptr) NtQueryInformationThread
|
||||
@ stdcall ZwQueryInformationToken(long long ptr long ptr) NtQueryInformationToken
|
||||
@ stdcall ZwQueryInstallUILanguage(ptr) NtQueryInstallUILanguage
|
||||
@ stub ZwQueryIntervalProfile
|
||||
@ stub ZwQueryIoCompletion
|
||||
@ stdcall ZwQueryKey(long long ptr long ptr) NtQueryKey
|
||||
|
@ -792,6 +797,7 @@
|
|||
@ stdcall ZwSetContextThread(long ptr) NtSetContextThread
|
||||
@ stub ZwSetDefaultHardErrorPort
|
||||
@ stdcall ZwSetDefaultLocale(long long) NtSetDefaultLocale
|
||||
@ stdcall ZwSetDefaultUILanguage(long) NtSetDefaultUILanguage
|
||||
@ stub ZwSetEaFile
|
||||
@ stdcall ZwSetEvent(long long) NtSetEvent
|
||||
@ stub ZwSetHighEventPair
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
WINE_DEFAULT_DEBUG_CHANNEL(resource);
|
||||
|
||||
static LCID user_lcid, system_lcid;
|
||||
static LANGID user_ui_language, system_ui_language;
|
||||
|
||||
static WINE_EXCEPTION_FILTER(page_fault)
|
||||
{
|
||||
|
@ -444,6 +445,40 @@ NTSTATUS WINAPI NtQueryDefaultLocale( BOOLEAN user, LCID *lcid )
|
|||
NTSTATUS WINAPI NtSetDefaultLocale( BOOLEAN user, LCID lcid )
|
||||
{
|
||||
if (user) user_lcid = lcid;
|
||||
else system_lcid = lcid;
|
||||
else
|
||||
{
|
||||
system_lcid = lcid;
|
||||
system_ui_language = LANGIDFROMLCID(lcid); /* there is no separate call to set it */
|
||||
}
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* NtQueryDefaultUILanguage (NTDLL.@)
|
||||
*/
|
||||
NTSTATUS WINAPI NtQueryDefaultUILanguage( LANGID *lang )
|
||||
{
|
||||
*lang = user_ui_language;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* NtSetDefaultUILanguage (NTDLL.@)
|
||||
*/
|
||||
NTSTATUS WINAPI NtSetDefaultUILanguage( LANGID lang )
|
||||
{
|
||||
user_ui_language = lang;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* NtQueryInstallUILanguage (NTDLL.@)
|
||||
*/
|
||||
NTSTATUS WINAPI NtQueryInstallUILanguage( LANGID *lang )
|
||||
{
|
||||
*lang = system_ui_language;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -1267,12 +1267,14 @@ NTSTATUS WINAPI NtPulseEvent(HANDLE,PULONG);
|
|||
NTSTATUS WINAPI NtQueueApcThread(HANDLE,PNTAPCFUNC,ULONG_PTR,ULONG_PTR,ULONG_PTR);
|
||||
NTSTATUS WINAPI NtQueryAttributesFile(const OBJECT_ATTRIBUTES*,FILE_BASIC_INFORMATION*);
|
||||
NTSTATUS WINAPI NtQueryDefaultLocale(BOOLEAN,LCID*);
|
||||
NTSTATUS WINAPI NtQueryDefaultUILanguage(LANGID*);
|
||||
NTSTATUS WINAPI NtQueryDirectoryFile(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,PVOID,ULONG,FILE_INFORMATION_CLASS,BOOLEAN,PUNICODE_STRING,BOOLEAN);
|
||||
NTSTATUS WINAPI NtQueryFullAttributesFile(const OBJECT_ATTRIBUTES*,FILE_NETWORK_OPEN_INFORMATION*);
|
||||
NTSTATUS WINAPI NtQueryInformationFile(HANDLE,PIO_STATUS_BLOCK,PVOID,LONG,FILE_INFORMATION_CLASS);
|
||||
NTSTATUS WINAPI NtQueryInformationProcess(HANDLE,PROCESSINFOCLASS,PVOID,ULONG,PULONG);
|
||||
NTSTATUS WINAPI NtQueryInformationThread(HANDLE,THREADINFOCLASS,PVOID,ULONG,PULONG);
|
||||
NTSTATUS WINAPI NtQueryInformationToken(HANDLE,DWORD,LPVOID,DWORD,LPDWORD);
|
||||
NTSTATUS WINAPI NtQueryInstallUILanguage(LANGID*);
|
||||
NTSTATUS WINAPI NtQueryKey(HKEY,KEY_INFORMATION_CLASS,void *,DWORD,DWORD *);
|
||||
NTSTATUS WINAPI NtQueryMultipleValueKey(HKEY,PVALENTW,ULONG,PVOID,ULONG,PULONG);
|
||||
NTSTATUS WINAPI NtQueryObject(HANDLE, OBJECT_INFORMATION_CLASS, PVOID, ULONG, PULONG);
|
||||
|
@ -1293,6 +1295,7 @@ NTSTATUS WINAPI NtResumeThread(HANDLE,PULONG);
|
|||
NTSTATUS WINAPI NtSaveKey(HKEY,HANDLE);
|
||||
NTSTATUS WINAPI NtSetContextThread(HANDLE,const CONTEXT*);
|
||||
NTSTATUS WINAPI NtSetDefaultLocale(BOOLEAN,LCID);
|
||||
NTSTATUS WINAPI NtSetDefaultUILanguage(LANGID);
|
||||
NTSTATUS WINAPI NtSetEvent(HANDLE,PULONG);
|
||||
NTSTATUS WINAPI NtSetInformationFile(HANDLE,PIO_STATUS_BLOCK,PVOID,ULONG,FILE_INFORMATION_CLASS);
|
||||
NTSTATUS WINAPI NtSetInformationKey(HKEY,const int,PVOID,ULONG);
|
||||
|
|
Loading…
Reference in New Issue