Commit 9def213d authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Move the locale system calls to the Unix library.

parent 0e45f7b4
...@@ -102,7 +102,6 @@ struct norm_table ...@@ -102,7 +102,6 @@ struct norm_table
LCID user_lcid = 0, system_lcid = 0; LCID user_lcid = 0, system_lcid = 0;
static LANGID user_ui_language, system_ui_language;
static NLSTABLEINFO nls_info; static NLSTABLEINFO nls_info;
static HMODULE kernel32_handle; static HMODULE kernel32_handle;
static CPTABLEINFO unix_table; static CPTABLEINFO unix_table;
...@@ -721,7 +720,6 @@ void init_locale( HMODULE module ) ...@@ -721,7 +720,6 @@ void init_locale( HMODULE module )
{ {
WCHAR system_locale[LOCALE_NAME_MAX_LENGTH]; WCHAR system_locale[LOCALE_NAME_MAX_LENGTH];
WCHAR user_locale[LOCALE_NAME_MAX_LENGTH]; WCHAR user_locale[LOCALE_NAME_MAX_LENGTH];
LCID system_lcid, user_lcid;
kernel32_handle = module; kernel32_handle = module;
...@@ -814,61 +812,6 @@ UINT CDECL __wine_get_unix_codepage(void) ...@@ -814,61 +812,6 @@ UINT CDECL __wine_get_unix_codepage(void)
} }
/**********************************************************************
* NtQueryDefaultLocale (NTDLL.@)
*/
NTSTATUS WINAPI NtQueryDefaultLocale( BOOLEAN user, LCID *lcid )
{
*lcid = user ? user_lcid : system_lcid;
return STATUS_SUCCESS;
}
/**********************************************************************
* NtSetDefaultLocale (NTDLL.@)
*/
NTSTATUS WINAPI NtSetDefaultLocale( BOOLEAN user, LCID lcid )
{
if (user) user_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;
}
static NTSTATUS get_dummy_preferred_ui_language( DWORD flags, LANGID lang, ULONG *count, static NTSTATUS get_dummy_preferred_ui_language( DWORD flags, LANGID lang, ULONG *count,
WCHAR *buffer, ULONG *size ) WCHAR *buffer, ULONG *size )
{ {
...@@ -905,8 +848,12 @@ static NTSTATUS get_dummy_preferred_ui_language( DWORD flags, LANGID lang, ULONG ...@@ -905,8 +848,12 @@ static NTSTATUS get_dummy_preferred_ui_language( DWORD flags, LANGID lang, ULONG
*/ */
NTSTATUS WINAPI RtlGetProcessPreferredUILanguages( DWORD flags, ULONG *count, WCHAR *buffer, ULONG *size ) NTSTATUS WINAPI RtlGetProcessPreferredUILanguages( DWORD flags, ULONG *count, WCHAR *buffer, ULONG *size )
{ {
LANGID ui_language;
FIXME( "%08x, %p, %p %p\n", flags, count, buffer, size ); FIXME( "%08x, %p, %p %p\n", flags, count, buffer, size );
return get_dummy_preferred_ui_language( flags, user_ui_language, count, buffer, size );
NtQueryDefaultUILanguage( &ui_language );
return get_dummy_preferred_ui_language( flags, ui_language, count, buffer, size );
} }
...@@ -916,11 +863,14 @@ NTSTATUS WINAPI RtlGetProcessPreferredUILanguages( DWORD flags, ULONG *count, WC ...@@ -916,11 +863,14 @@ NTSTATUS WINAPI RtlGetProcessPreferredUILanguages( DWORD flags, ULONG *count, WC
NTSTATUS WINAPI RtlGetSystemPreferredUILanguages( DWORD flags, ULONG unknown, ULONG *count, NTSTATUS WINAPI RtlGetSystemPreferredUILanguages( DWORD flags, ULONG unknown, ULONG *count,
WCHAR *buffer, ULONG *size ) WCHAR *buffer, ULONG *size )
{ {
LANGID ui_language;
if (flags & ~(MUI_LANGUAGE_NAME | MUI_LANGUAGE_ID | MUI_MACHINE_LANGUAGE_SETTINGS)) return STATUS_INVALID_PARAMETER; if (flags & ~(MUI_LANGUAGE_NAME | MUI_LANGUAGE_ID | MUI_MACHINE_LANGUAGE_SETTINGS)) return STATUS_INVALID_PARAMETER;
if ((flags & MUI_LANGUAGE_NAME) && (flags & MUI_LANGUAGE_ID)) return STATUS_INVALID_PARAMETER; if ((flags & MUI_LANGUAGE_NAME) && (flags & MUI_LANGUAGE_ID)) return STATUS_INVALID_PARAMETER;
if (*size && !buffer) return STATUS_INVALID_PARAMETER; if (*size && !buffer) return STATUS_INVALID_PARAMETER;
return get_dummy_preferred_ui_language( flags, system_ui_language, count, buffer, size ); NtQueryInstallUILanguage( &ui_language );
return get_dummy_preferred_ui_language( flags, ui_language, count, buffer, size );
} }
...@@ -929,8 +879,12 @@ NTSTATUS WINAPI RtlGetSystemPreferredUILanguages( DWORD flags, ULONG unknown, UL ...@@ -929,8 +879,12 @@ NTSTATUS WINAPI RtlGetSystemPreferredUILanguages( DWORD flags, ULONG unknown, UL
*/ */
NTSTATUS WINAPI RtlGetThreadPreferredUILanguages( DWORD flags, ULONG *count, WCHAR *buffer, ULONG *size ) NTSTATUS WINAPI RtlGetThreadPreferredUILanguages( DWORD flags, ULONG *count, WCHAR *buffer, ULONG *size )
{ {
LANGID ui_language;
FIXME( "%08x, %p, %p %p\n", flags, count, buffer, size ); FIXME( "%08x, %p, %p %p\n", flags, count, buffer, size );
return get_dummy_preferred_ui_language( flags, user_ui_language, count, buffer, size );
NtQueryDefaultUILanguage( &ui_language );
return get_dummy_preferred_ui_language( flags, ui_language, count, buffer, size );
} }
...@@ -940,11 +894,14 @@ NTSTATUS WINAPI RtlGetThreadPreferredUILanguages( DWORD flags, ULONG *count, WCH ...@@ -940,11 +894,14 @@ NTSTATUS WINAPI RtlGetThreadPreferredUILanguages( DWORD flags, ULONG *count, WCH
NTSTATUS WINAPI RtlGetUserPreferredUILanguages( DWORD flags, ULONG unknown, ULONG *count, NTSTATUS WINAPI RtlGetUserPreferredUILanguages( DWORD flags, ULONG unknown, ULONG *count,
WCHAR *buffer, ULONG *size ) WCHAR *buffer, ULONG *size )
{ {
LANGID ui_language;
if (flags & ~(MUI_LANGUAGE_NAME | MUI_LANGUAGE_ID)) return STATUS_INVALID_PARAMETER; if (flags & ~(MUI_LANGUAGE_NAME | MUI_LANGUAGE_ID)) return STATUS_INVALID_PARAMETER;
if ((flags & MUI_LANGUAGE_NAME) && (flags & MUI_LANGUAGE_ID)) return STATUS_INVALID_PARAMETER; if ((flags & MUI_LANGUAGE_NAME) && (flags & MUI_LANGUAGE_ID)) return STATUS_INVALID_PARAMETER;
if (*size && !buffer) return STATUS_INVALID_PARAMETER; if (*size && !buffer) return STATUS_INVALID_PARAMETER;
return get_dummy_preferred_ui_language( flags, user_ui_language, count, buffer, size ); NtQueryDefaultUILanguage( &ui_language );
return get_dummy_preferred_ui_language( flags, ui_language, count, buffer, size );
} }
......
...@@ -284,8 +284,8 @@ ...@@ -284,8 +284,8 @@
# @ stub NtQueryBootEntryOrder # @ stub NtQueryBootEntryOrder
# @ stub NtQueryBootOptions # @ stub NtQueryBootOptions
# @ stub NtQueryDebugFilterState # @ stub NtQueryDebugFilterState
@ stdcall NtQueryDefaultLocale(long ptr) @ stdcall -syscall NtQueryDefaultLocale(long ptr)
@ stdcall NtQueryDefaultUILanguage(ptr) @ stdcall -syscall NtQueryDefaultUILanguage(ptr)
@ stdcall -syscall NtQueryDirectoryFile(long long ptr ptr ptr ptr long long long ptr long) @ stdcall -syscall NtQueryDirectoryFile(long long ptr ptr ptr ptr long long long ptr long)
@ stdcall -syscall NtQueryDirectoryObject(long ptr long long long ptr ptr) @ stdcall -syscall NtQueryDirectoryObject(long ptr long long long ptr ptr)
@ stdcall -syscall NtQueryEaFile(long ptr ptr long long ptr long ptr long) @ stdcall -syscall NtQueryEaFile(long ptr ptr long long ptr long ptr long)
...@@ -298,7 +298,7 @@ ...@@ -298,7 +298,7 @@
@ stdcall -syscall NtQueryInformationProcess(long long ptr long ptr) @ stdcall -syscall NtQueryInformationProcess(long long ptr long ptr)
@ stdcall -syscall NtQueryInformationThread(long long ptr long ptr) @ stdcall -syscall NtQueryInformationThread(long long ptr long ptr)
@ stdcall -syscall NtQueryInformationToken(long long ptr long ptr) @ stdcall -syscall NtQueryInformationToken(long long ptr long ptr)
@ stdcall NtQueryInstallUILanguage(ptr) @ stdcall -syscall NtQueryInstallUILanguage(ptr)
@ stub NtQueryIntervalProfile @ stub NtQueryIntervalProfile
@ stdcall -syscall NtQueryIoCompletion(long long ptr long ptr) @ stdcall -syscall NtQueryIoCompletion(long long ptr long ptr)
@ stdcall -syscall NtQueryKey(long long ptr long ptr) @ stdcall -syscall NtQueryKey(long long ptr long ptr)
...@@ -364,8 +364,8 @@ ...@@ -364,8 +364,8 @@
@ stdcall -syscall NtSetContextThread(long ptr) @ stdcall -syscall NtSetContextThread(long ptr)
@ stub NtSetDebugFilterState @ stub NtSetDebugFilterState
@ stub NtSetDefaultHardErrorPort @ stub NtSetDefaultHardErrorPort
@ stdcall NtSetDefaultLocale(long long) @ stdcall -syscall NtSetDefaultLocale(long long)
@ stdcall NtSetDefaultUILanguage(long) @ stdcall -syscall NtSetDefaultUILanguage(long)
@ stdcall -syscall NtSetEaFile(long ptr ptr long) @ stdcall -syscall NtSetEaFile(long ptr ptr long)
@ stdcall -syscall NtSetEvent(long ptr) @ stdcall -syscall NtSetEvent(long ptr)
# @ stub NtSetEventBoostPriority # @ stub NtSetEventBoostPriority
...@@ -1272,8 +1272,8 @@ ...@@ -1272,8 +1272,8 @@
# @ stub ZwQueryBootEntryOrder # @ stub ZwQueryBootEntryOrder
# @ stub ZwQueryBootOptions # @ stub ZwQueryBootOptions
# @ stub ZwQueryDebugFilterState # @ stub ZwQueryDebugFilterState
@ stdcall -private ZwQueryDefaultLocale(long ptr) NtQueryDefaultLocale @ stdcall -private -syscall ZwQueryDefaultLocale(long ptr) NtQueryDefaultLocale
@ stdcall -private ZwQueryDefaultUILanguage(ptr) NtQueryDefaultUILanguage @ stdcall -private -syscall ZwQueryDefaultUILanguage(ptr) NtQueryDefaultUILanguage
@ stdcall -private -syscall ZwQueryDirectoryFile(long long ptr ptr ptr ptr long long long ptr long) NtQueryDirectoryFile @ stdcall -private -syscall ZwQueryDirectoryFile(long long ptr ptr ptr ptr long long long ptr long) NtQueryDirectoryFile
@ stdcall -private -syscall ZwQueryDirectoryObject(long ptr long long long ptr ptr) NtQueryDirectoryObject @ stdcall -private -syscall ZwQueryDirectoryObject(long ptr long long long ptr ptr) NtQueryDirectoryObject
@ stdcall -private -syscall ZwQueryEaFile(long ptr ptr long long ptr long ptr long) NtQueryEaFile @ stdcall -private -syscall ZwQueryEaFile(long ptr ptr long long ptr long ptr long) NtQueryEaFile
...@@ -1286,7 +1286,7 @@ ...@@ -1286,7 +1286,7 @@
@ stdcall -private -syscall ZwQueryInformationProcess(long long ptr long ptr) NtQueryInformationProcess @ stdcall -private -syscall ZwQueryInformationProcess(long long ptr long ptr) NtQueryInformationProcess
@ stdcall -private -syscall ZwQueryInformationThread(long long ptr long ptr) NtQueryInformationThread @ stdcall -private -syscall ZwQueryInformationThread(long long ptr long ptr) NtQueryInformationThread
@ stdcall -private -syscall ZwQueryInformationToken(long long ptr long ptr) NtQueryInformationToken @ stdcall -private -syscall ZwQueryInformationToken(long long ptr long ptr) NtQueryInformationToken
@ stdcall -private ZwQueryInstallUILanguage(ptr) NtQueryInstallUILanguage @ stdcall -private -syscall ZwQueryInstallUILanguage(ptr) NtQueryInstallUILanguage
@ stub ZwQueryIntervalProfile @ stub ZwQueryIntervalProfile
@ stdcall -private -syscall ZwQueryIoCompletion(long long ptr long ptr) NtQueryIoCompletion @ stdcall -private -syscall ZwQueryIoCompletion(long long ptr long ptr) NtQueryIoCompletion
@ stdcall -private -syscall ZwQueryKey(long long ptr long ptr) NtQueryKey @ stdcall -private -syscall ZwQueryKey(long long ptr long ptr) NtQueryKey
...@@ -1352,8 +1352,8 @@ ...@@ -1352,8 +1352,8 @@
@ stdcall -private -syscall ZwSetContextThread(long ptr) NtSetContextThread @ stdcall -private -syscall ZwSetContextThread(long ptr) NtSetContextThread
@ stub ZwSetDebugFilterState @ stub ZwSetDebugFilterState
@ stub ZwSetDefaultHardErrorPort @ stub ZwSetDefaultHardErrorPort
@ stdcall -private ZwSetDefaultLocale(long long) NtSetDefaultLocale @ stdcall -private -syscall ZwSetDefaultLocale(long long) NtSetDefaultLocale
@ stdcall -private ZwSetDefaultUILanguage(long) NtSetDefaultUILanguage @ stdcall -private -syscall ZwSetDefaultUILanguage(long) NtSetDefaultUILanguage
@ stdcall -private -syscall ZwSetEaFile(long ptr ptr long) NtSetEaFile @ stdcall -private -syscall ZwSetEaFile(long ptr ptr long) NtSetEaFile
@ stdcall -private -syscall ZwSetEvent(long ptr) NtSetEvent @ stdcall -private -syscall ZwSetEvent(long ptr) NtSetEvent
# @ stub ZwSetEventBoostPriority # @ stub ZwSetEventBoostPriority
......
...@@ -73,6 +73,9 @@ char **main_argv = NULL; ...@@ -73,6 +73,9 @@ char **main_argv = NULL;
char **main_envp = NULL; char **main_envp = NULL;
static WCHAR **main_wargv; static WCHAR **main_wargv;
static LCID user_lcid, system_lcid;
static LANGID user_ui_language, system_ui_language;
static char system_locale[LOCALE_NAME_MAX_LENGTH]; static char system_locale[LOCALE_NAME_MAX_LENGTH];
static char user_locale[LOCALE_NAME_MAX_LENGTH]; static char user_locale[LOCALE_NAME_MAX_LENGTH];
...@@ -1251,3 +1254,58 @@ void CDECL get_locales( WCHAR *sys, WCHAR *user ) ...@@ -1251,3 +1254,58 @@ void CDECL get_locales( WCHAR *sys, WCHAR *user )
ntdll_umbstowcs( system_locale, strlen(system_locale) + 1, sys, LOCALE_NAME_MAX_LENGTH ); ntdll_umbstowcs( system_locale, strlen(system_locale) + 1, sys, LOCALE_NAME_MAX_LENGTH );
ntdll_umbstowcs( user_locale, strlen(user_locale) + 1, user, LOCALE_NAME_MAX_LENGTH ); ntdll_umbstowcs( user_locale, strlen(user_locale) + 1, user, LOCALE_NAME_MAX_LENGTH );
} }
/**********************************************************************
* NtQueryDefaultLocale (NTDLL.@)
*/
NTSTATUS WINAPI NtQueryDefaultLocale( BOOLEAN user, LCID *lcid )
{
*lcid = user ? user_lcid : system_lcid;
return STATUS_SUCCESS;
}
/**********************************************************************
* NtSetDefaultLocale (NTDLL.@)
*/
NTSTATUS WINAPI NtSetDefaultLocale( BOOLEAN user, LCID lcid )
{
if (user) user_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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment