kernel32: Move some locale functions to kernelbase.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2019-09-17 18:14:49 +02:00
parent e3e1bede1b
commit 7c0032b62a
6 changed files with 303 additions and 363 deletions

View File

@ -242,7 +242,7 @@
@ stdcall CompareStringA(long long str long str long) @ stdcall CompareStringA(long long str long str long)
@ stdcall CompareStringW(long long wstr long wstr long) @ stdcall CompareStringW(long long wstr long wstr long)
@ stdcall CompareStringEx(wstr long wstr long wstr long ptr ptr long) @ stdcall CompareStringEx(wstr long wstr long wstr long ptr ptr long)
@ stdcall CompareStringOrdinal(wstr long wstr long long) @ stdcall -import CompareStringOrdinal(wstr long wstr long long)
@ stdcall -import ConnectNamedPipe(long ptr) @ stdcall -import ConnectNamedPipe(long ptr)
@ stub ConsoleMenuControl @ stub ConsoleMenuControl
@ stub ConsoleSubst @ stub ConsoleSubst
@ -508,7 +508,7 @@
@ stdcall FindResourceExA(long str str long) @ stdcall FindResourceExA(long str str long)
@ stdcall -import FindResourceExW(long wstr wstr long) @ stdcall -import FindResourceExW(long wstr wstr long)
@ stdcall -import FindResourceW(long wstr wstr) @ stdcall -import FindResourceW(long wstr wstr)
@ stdcall FindStringOrdinal(long wstr long wstr long long) @ stdcall -import FindStringOrdinal(long wstr long wstr long long)
@ stdcall FindVolumeClose(ptr) @ stdcall FindVolumeClose(ptr)
@ stdcall FindVolumeMountPointClose(ptr) @ stdcall FindVolumeMountPointClose(ptr)
@ stdcall -import FlsAlloc(ptr) @ stdcall -import FlsAlloc(ptr)
@ -818,10 +818,10 @@
@ stdcall GetStringTypeExW(long long wstr long ptr) @ stdcall GetStringTypeExW(long long wstr long ptr)
@ stdcall GetStringTypeW(long wstr long ptr) @ stdcall GetStringTypeW(long wstr long ptr)
@ stdcall GetSystemFileCacheSize(ptr ptr ptr) @ stdcall GetSystemFileCacheSize(ptr ptr ptr)
@ stdcall GetSystemDefaultLCID() @ stdcall -import GetSystemDefaultLCID()
@ stdcall GetSystemDefaultLangID() @ stdcall -import GetSystemDefaultLangID()
@ stdcall GetSystemDefaultLocaleName(ptr long) @ stdcall -import GetSystemDefaultLocaleName(ptr long)
@ stdcall GetSystemDefaultUILanguage() @ stdcall -import GetSystemDefaultUILanguage()
@ stdcall GetSystemDEPPolicy() @ stdcall GetSystemDEPPolicy()
@ stdcall GetSystemDirectoryA(ptr long) @ stdcall GetSystemDirectoryA(ptr long)
@ stdcall GetSystemDirectoryW(ptr long) @ stdcall GetSystemDirectoryW(ptr long)
@ -852,7 +852,7 @@
@ stdcall -import GetThreadIOPendingFlag(long ptr) @ stdcall -import GetThreadIOPendingFlag(long ptr)
@ stdcall -import GetThreadId(ptr) @ stdcall -import GetThreadId(ptr)
# @ stub GetThreadIdealProcessorEx # @ stub GetThreadIdealProcessorEx
@ stdcall GetThreadLocale() @ stdcall -import GetThreadLocale()
@ stdcall GetThreadPreferredUILanguages(long ptr ptr ptr) @ stdcall GetThreadPreferredUILanguages(long ptr ptr ptr)
@ stdcall -import GetThreadPriority(long) @ stdcall -import GetThreadPriority(long)
@ stdcall -import GetThreadPriorityBoost(long ptr) @ stdcall -import GetThreadPriorityBoost(long ptr)
@ -869,10 +869,10 @@
# @ stub GetUILanguageInfo # @ stub GetUILanguageInfo
@ stdcall -arch=x86_64 GetUmsCompletionListEvent(ptr ptr) @ stdcall -arch=x86_64 GetUmsCompletionListEvent(ptr ptr)
# @ stub -arch=x86_64 GetUmsSystemThreadInformation # @ stub -arch=x86_64 GetUmsSystemThreadInformation
@ stdcall GetUserDefaultLCID() @ stdcall -import GetUserDefaultLCID()
@ stdcall GetUserDefaultLangID() @ stdcall -import GetUserDefaultLangID()
@ stdcall GetUserDefaultLocaleName(ptr long) @ stdcall -import GetUserDefaultLocaleName(ptr long)
@ stdcall GetUserDefaultUILanguage() @ stdcall -import GetUserDefaultUILanguage()
@ stdcall GetUserGeoID(long) @ stdcall GetUserGeoID(long)
@ stub GetVDMCurrentDirectories @ stub GetVDMCurrentDirectories
@ stdcall -import GetVersion() @ stdcall -import GetVersion()
@ -1024,7 +1024,7 @@
@ stdcall K32QueryWorkingSetEx(long ptr long) @ stdcall K32QueryWorkingSetEx(long ptr long)
@ stdcall -i386 -private -norelay K32Thk1632Epilog() krnl386.exe16.K32Thk1632Epilog @ stdcall -i386 -private -norelay K32Thk1632Epilog() krnl386.exe16.K32Thk1632Epilog
@ stdcall -i386 -private -norelay K32Thk1632Prolog() krnl386.exe16.K32Thk1632Prolog @ stdcall -i386 -private -norelay K32Thk1632Prolog() krnl386.exe16.K32Thk1632Prolog
@ stdcall LCIDToLocaleName(long ptr long long) @ stdcall -import LCIDToLocaleName(long ptr long long)
@ stdcall LCMapStringA(long long str long ptr long) @ stdcall LCMapStringA(long long str long ptr long)
@ stdcall LCMapStringEx(wstr long wstr long ptr long ptr ptr long) @ stdcall LCMapStringEx(wstr long wstr long ptr long ptr ptr long)
@ stdcall LCMapStringW(long long wstr long ptr long) @ stdcall LCMapStringW(long long wstr long ptr long)
@ -1282,7 +1282,7 @@
@ stdcall -import ResetEvent(long) @ stdcall -import ResetEvent(long)
@ stdcall -import ResetWriteWatch(ptr long) @ stdcall -import ResetWriteWatch(ptr long)
@ stdcall ResolveDelayLoadedAPI(ptr ptr ptr ptr ptr long) ntdll.LdrResolveDelayLoadedAPI @ stdcall ResolveDelayLoadedAPI(ptr ptr ptr ptr ptr long) ntdll.LdrResolveDelayLoadedAPI
@ stdcall ResolveLocaleName(wstr ptr long) @ stdcall -import ResolveLocaleName(wstr ptr long)
@ stdcall RestoreLastError(long) ntdll.RtlRestoreLastWin32Error @ stdcall RestoreLastError(long) ntdll.RtlRestoreLastWin32Error
@ stdcall -import ResumeThread(long) @ stdcall -import ResumeThread(long)
@ cdecl -arch=arm,arm64,x86_64 RtlAddFunctionTable(ptr long long) ntdll.RtlAddFunctionTable @ cdecl -arch=arm,arm64,x86_64 RtlAddFunctionTable(ptr long long) ntdll.RtlAddFunctionTable
@ -1452,13 +1452,13 @@
@ stdcall -import SetThreadGroupAffinity(long ptr ptr) @ stdcall -import SetThreadGroupAffinity(long ptr ptr)
@ stdcall -import SetThreadIdealProcessor(long long) @ stdcall -import SetThreadIdealProcessor(long long)
@ stdcall -import SetThreadIdealProcessorEx(long ptr ptr) @ stdcall -import SetThreadIdealProcessorEx(long ptr ptr)
@ stdcall SetThreadLocale(long) @ stdcall -import SetThreadLocale(long)
@ stdcall SetThreadPreferredUILanguages(long ptr ptr) @ stdcall SetThreadPreferredUILanguages(long ptr ptr)
@ stdcall -import SetThreadPriority(long long) @ stdcall -import SetThreadPriority(long long)
@ stdcall -import SetThreadPriorityBoost(long long) @ stdcall -import SetThreadPriorityBoost(long long)
@ stdcall -import SetThreadStackGuarantee(ptr) @ stdcall -import SetThreadStackGuarantee(ptr)
# @ stub SetThreadToken # @ stub SetThreadToken
@ stdcall SetThreadUILanguage(long) @ stdcall -import SetThreadUILanguage(long)
# @ stub SetThreadpoolStackInformation # @ stub SetThreadpoolStackInformation
@ stdcall SetThreadpoolThreadMaximum(ptr long) ntdll.TpSetPoolMaxThreads @ stdcall SetThreadpoolThreadMaximum(ptr long) ntdll.TpSetPoolMaxThreads
@ stdcall SetThreadpoolThreadMinimum(ptr long) ntdll.TpSetPoolMinThreads @ stdcall SetThreadpoolThreadMinimum(ptr long) ntdll.TpSetPoolMinThreads
@ -1550,8 +1550,8 @@
@ stub VDMOperationStarted @ stub VDMOperationStarted
@ stub ValidateLCType @ stub ValidateLCType
@ stub ValidateLocale @ stub ValidateLocale
@ stdcall VerLanguageNameA(long str long) @ stdcall -import VerLanguageNameA(long str long)
@ stdcall VerLanguageNameW(long wstr long) @ stdcall -import VerLanguageNameW(long wstr long)
@ stdcall -ret64 VerSetConditionMask(long long long long) ntdll.VerSetConditionMask @ stdcall -ret64 VerSetConditionMask(long long long long) ntdll.VerSetConditionMask
@ stdcall VerifyConsoleIoHandle(long) @ stdcall VerifyConsoleIoHandle(long)
# @ stub VerifyScripts # @ stub VerifyScripts

View File

@ -1159,86 +1159,6 @@ static UINT setup_unix_locales(void)
} }
/***********************************************************************
* GetUserDefaultLangID (KERNEL32.@)
*
* Get the default language Id for the current user.
*
* PARAMS
* None.
*
* RETURNS
* The current LANGID of the default language for the current user.
*/
LANGID WINAPI GetUserDefaultLangID(void)
{
return LANGIDFROMLCID(GetUserDefaultLCID());
}
/***********************************************************************
* GetSystemDefaultLangID (KERNEL32.@)
*
* Get the default language Id for the system.
*
* PARAMS
* None.
*
* RETURNS
* The current LANGID of the default language for the system.
*/
LANGID WINAPI GetSystemDefaultLangID(void)
{
return LANGIDFROMLCID(GetSystemDefaultLCID());
}
/***********************************************************************
* GetUserDefaultLCID (KERNEL32.@)
*
* Get the default locale Id for the current user.
*
* PARAMS
* None.
*
* RETURNS
* The current LCID of the default locale for the current user.
*/
LCID WINAPI GetUserDefaultLCID(void)
{
LCID lcid;
NtQueryDefaultLocale( TRUE, &lcid );
return lcid;
}
/***********************************************************************
* GetSystemDefaultLCID (KERNEL32.@)
*
* Get the default locale Id for the system.
*
* PARAMS
* None.
*
* RETURNS
* The current LCID of the default locale for the system.
*/
LCID WINAPI GetSystemDefaultLCID(void)
{
LCID lcid;
NtQueryDefaultLocale( FALSE, &lcid );
return lcid;
}
/***********************************************************************
* GetSystemDefaultLocaleName (KERNEL32.@)
*/
INT WINAPI GetSystemDefaultLocaleName(LPWSTR localename, INT len)
{
LCID lcid = GetSystemDefaultLCID();
return LCIDToLocaleName(lcid, localename, len, 0);
}
static BOOL get_dummy_preferred_ui_language( DWORD flags, ULONG *count, WCHAR *buffer, ULONG *size ) static BOOL get_dummy_preferred_ui_language( DWORD flags, ULONG *count, WCHAR *buffer, ULONG *size )
{ {
LCTYPE type; LCTYPE type;
@ -1371,45 +1291,6 @@ BOOL WINAPI GetUserPreferredUILanguages( DWORD flags, ULONG *count, WCHAR *buffe
return get_dummy_preferred_ui_language( flags, count, buffer, size ); return get_dummy_preferred_ui_language( flags, count, buffer, size );
} }
/***********************************************************************
* GetUserDefaultUILanguage (KERNEL32.@)
*
* Get the default user interface language Id for the current user.
*
* PARAMS
* None.
*
* RETURNS
* The current LANGID of the default UI language for the current user.
*/
LANGID WINAPI GetUserDefaultUILanguage(void)
{
LANGID lang;
NtQueryDefaultUILanguage( &lang );
return lang;
}
/***********************************************************************
* GetSystemDefaultUILanguage (KERNEL32.@)
*
* Get the default user interface language Id for the system.
*
* PARAMS
* None.
*
* RETURNS
* The current LANGID of the default UI language for the system. This is
* typically the same language used during the installation process.
*/
LANGID WINAPI GetSystemDefaultUILanguage(void)
{
LANGID lang;
NtQueryInstallUILanguage( &lang );
return lang;
}
/*********************************************************************** /***********************************************************************
* LocaleNameToLCID (KERNEL32.@) * LocaleNameToLCID (KERNEL32.@)
*/ */
@ -1444,18 +1325,6 @@ LCID WINAPI LocaleNameToLCID( LPCWSTR name, DWORD flags )
} }
/***********************************************************************
* LCIDToLocaleName (KERNEL32.@)
*/
INT WINAPI LCIDToLocaleName( LCID lcid, LPWSTR name, INT count, DWORD flags )
{
static int once;
if (flags && !once++) FIXME( "unsupported flags %x\n", flags );
return GetLocaleInfoW( lcid, LOCALE_SNAME | LOCALE_NOUSEROVERRIDE, name, count );
}
/****************************************************************************** /******************************************************************************
* get_locale_registry_value * get_locale_registry_value
* *
@ -2779,80 +2648,6 @@ INT WINAPI WideCharToMultiByte( UINT page, DWORD flags, LPCWSTR src, INT srclen,
} }
/***********************************************************************
* GetThreadLocale (KERNEL32.@)
*
* Get the current threads locale.
*
* PARAMS
* None.
*
* RETURNS
* The LCID currently associated with the calling thread.
*/
LCID WINAPI GetThreadLocale(void)
{
LCID ret = NtCurrentTeb()->CurrentLocale;
if (!ret) NtCurrentTeb()->CurrentLocale = ret = GetUserDefaultLCID();
return ret;
}
/**********************************************************************
* SetThreadLocale (KERNEL32.@)
*
* Set the current threads locale.
*
* PARAMS
* lcid [I] LCID of the locale to set
*
* RETURNS
* Success: TRUE. The threads locale is set to lcid.
* Failure: FALSE. Use GetLastError() to determine the cause.
*/
BOOL WINAPI SetThreadLocale( LCID lcid )
{
TRACE("(0x%04X)\n", lcid);
lcid = ConvertDefaultLocale(lcid);
if (lcid != GetThreadLocale())
{
if (!IsValidLocale(lcid, LCID_SUPPORTED))
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
NtCurrentTeb()->CurrentLocale = lcid;
}
return TRUE;
}
/**********************************************************************
* SetThreadUILanguage (KERNEL32.@)
*
* Set the current threads UI language.
*
* PARAMS
* langid [I] LANGID of the language to set, or 0 to use
* the available language which is best supported
* for console applications
*
* RETURNS
* Success: The return value is the same as the input value.
* Failure: The return value differs from the input value.
* Use GetLastError() to determine the cause.
*/
LANGID WINAPI SetThreadUILanguage( LANGID langid )
{
TRACE("(0x%04x) stub - returning success\n", langid);
if (!langid)
return GetThreadUILanguage();
else
return langid;
}
/****************************************************************************** /******************************************************************************
* ConvertDefaultLocale (KERNEL32.@) * ConvertDefaultLocale (KERNEL32.@)
* *
@ -3047,38 +2842,6 @@ BOOL WINAPI EnumSystemLocalesEx( LOCALE_ENUMPROCEX proc, DWORD flags, LPARAM lpa
} }
/***********************************************************************
* VerLanguageNameA (KERNEL32.@)
*
* Get the name of a language.
*
* PARAMS
* wLang [I] LANGID of the language
* szLang [O] Destination for the language name
*
* RETURNS
* Success: The size of the language name. If szLang is non-NULL, it is filled
* with the name.
* Failure: 0. Use GetLastError() to determine the cause.
*
*/
DWORD WINAPI VerLanguageNameA( DWORD wLang, LPSTR szLang, DWORD nSize )
{
return GetLocaleInfoA( MAKELCID(wLang, SORT_DEFAULT), LOCALE_SENGLANGUAGE, szLang, nSize );
}
/***********************************************************************
* VerLanguageNameW (KERNEL32.@)
*
* See VerLanguageNameA.
*/
DWORD WINAPI VerLanguageNameW( DWORD wLang, LPWSTR szLang, DWORD nSize )
{
return GetLocaleInfoW( MAKELCID(wLang, SORT_DEFAULT), LOCALE_SENGLANGUAGE, szLang, nSize );
}
/****************************************************************************** /******************************************************************************
* GetStringTypeW (KERNEL32.@) * GetStringTypeW (KERNEL32.@)
* *
@ -4046,27 +3809,6 @@ INT WINAPI CompareStringA(LCID lcid, DWORD flags,
return ret; return ret;
} }
/******************************************************************************
* CompareStringOrdinal (KERNEL32.@)
*/
INT WINAPI CompareStringOrdinal(const WCHAR *str1, INT len1, const WCHAR *str2, INT len2, BOOL ignore_case)
{
int ret;
if (!str1 || !str2)
{
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
if (len1 < 0) len1 = strlenW(str1);
if (len2 < 0) len2 = strlenW(str2);
ret = RtlCompareUnicodeStrings( str1, len1, str2, len2, ignore_case );
if (ret < 0) return CSTR_LESS_THAN;
if (ret > 0) return CSTR_GREATER_THAN;
return CSTR_EQUAL;
}
/****************************************************************************** /******************************************************************************
* LOCALE_Init * LOCALE_Init
*/ */
@ -5260,16 +5002,6 @@ BOOL WINAPI EnumSystemGeoID(GEOCLASS geoclass, GEOID parent, GEO_ENUMPROC enumpr
return TRUE; return TRUE;
} }
INT WINAPI GetUserDefaultLocaleName(LPWSTR localename, int buffersize)
{
LCID userlcid;
TRACE("%p, %d\n", localename, buffersize);
userlcid = GetUserDefaultLCID();
return LCIDToLocaleName(userlcid, localename, buffersize, 0);
}
/****************************************************************************** /******************************************************************************
* NormalizeString (KERNEL32.@) * NormalizeString (KERNEL32.@)
*/ */
@ -5891,18 +5623,6 @@ BOOL WINAPI GetFileMUIInfo(DWORD flags, PCWSTR path, FILEMUIINFO *info, DWORD *s
return FALSE; return FALSE;
} }
/******************************************************************************
* ResolveLocaleName (KERNEL32.@)
*/
INT WINAPI ResolveLocaleName(LPCWSTR name, LPWSTR localename, INT len)
{
FIXME("stub: %s, %p, %d\n", wine_dbgstr_w(name), localename, len);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
}
/****************************************************************************** /******************************************************************************
* FindNLSStringEx (KERNEL32.@) * FindNLSStringEx (KERNEL32.@)
*/ */
@ -5953,52 +5673,3 @@ INT WINAPI FindNLSStringEx(const WCHAR *localename, DWORD flags, const WCHAR *sr
return -1; return -1;
} }
/******************************************************************************
* FindStringOrdinal (KERNEL32.@)
*/
INT WINAPI FindStringOrdinal(DWORD flag, const WCHAR *src, INT src_size, const WCHAR *val, INT val_size,
BOOL ignore_case)
{
INT offset, inc, count;
TRACE("%#x %s %d %s %d %d\n", flag, wine_dbgstr_w(src), src_size, wine_dbgstr_w(val), val_size, ignore_case);
if (!src || !val)
{
SetLastError(ERROR_INVALID_PARAMETER);
return -1;
}
if (flag != FIND_FROMSTART && flag != FIND_FROMEND && flag != FIND_STARTSWITH && flag != FIND_ENDSWITH)
{
SetLastError(ERROR_INVALID_FLAGS);
return -1;
}
if (src_size == -1) src_size = strlenW(src);
if (val_size == -1) val_size = strlenW(val);
src_size -= val_size;
if (src_size < 0)
{
SetLastError(NO_ERROR);
return -1;
}
count = flag & (FIND_FROMSTART | FIND_FROMEND) ? src_size + 1 : 1;
offset = flag & (FIND_FROMSTART | FIND_STARTSWITH) ? 0 : src_size;
inc = flag & (FIND_FROMSTART | FIND_STARTSWITH) ? 1 : -1;
while (count--)
{
if (CompareStringOrdinal(src + offset, val_size, val, val_size, ignore_case) == CSTR_EQUAL)
{
SetLastError(NO_ERROR);
return offset;
}
offset += inc;
}
SetLastError(NO_ERROR);
return -1;
}

View File

@ -8,6 +8,7 @@ C_SRCS = \
debug.c \ debug.c \
file.c \ file.c \
loader.c \ loader.c \
locale.c \
main.c \ main.c \
memory.c \ memory.c \
path.c \ path.c \

View File

@ -155,7 +155,7 @@
# @ stub CompareObjectHandles # @ stub CompareObjectHandles
@ stdcall CompareStringA(long long str long str long) kernel32.CompareStringA @ stdcall CompareStringA(long long str long str long) kernel32.CompareStringA
@ stdcall CompareStringEx(wstr long wstr long wstr long ptr ptr long) kernel32.CompareStringEx @ stdcall CompareStringEx(wstr long wstr long wstr long ptr ptr long) kernel32.CompareStringEx
@ stdcall CompareStringOrdinal(wstr long wstr long long) kernel32.CompareStringOrdinal @ stdcall CompareStringOrdinal(wstr long wstr long long)
@ stdcall CompareStringW(long long wstr long wstr long) kernel32.CompareStringW @ stdcall CompareStringW(long long wstr long wstr long) kernel32.CompareStringW
@ stdcall ConnectNamedPipe(long ptr) @ stdcall ConnectNamedPipe(long ptr)
@ stdcall ContinueDebugEvent(long long long) @ stdcall ContinueDebugEvent(long long long)
@ -373,7 +373,7 @@
# @ stub FindPackagesByPackageFamily # @ stub FindPackagesByPackageFamily
@ stdcall FindResourceExW(long wstr wstr long) @ stdcall FindResourceExW(long wstr wstr long)
@ stdcall FindResourceW(long wstr wstr) @ stdcall FindResourceW(long wstr wstr)
@ stdcall FindStringOrdinal(long wstr long wstr long long) kernel32.FindStringOrdinal @ stdcall FindStringOrdinal(long wstr long wstr long long)
@ stdcall FindVolumeClose(ptr) kernel32.FindVolumeClose @ stdcall FindVolumeClose(ptr) kernel32.FindVolumeClose
@ stdcall FlsAlloc(ptr) @ stdcall FlsAlloc(ptr)
@ stdcall FlsFree(long) @ stdcall FlsFree(long)
@ -681,10 +681,10 @@
# @ stub GetSystemAppDataFolder # @ stub GetSystemAppDataFolder
# @ stub GetSystemAppDataKey # @ stub GetSystemAppDataKey
# @ stub GetSystemCpuSetInformation # @ stub GetSystemCpuSetInformation
@ stdcall GetSystemDefaultLCID() kernel32.GetSystemDefaultLCID @ stdcall GetSystemDefaultLCID()
@ stdcall GetSystemDefaultLangID() kernel32.GetSystemDefaultLangID @ stdcall GetSystemDefaultLangID()
@ stdcall GetSystemDefaultLocaleName(ptr long) kernel32.GetSystemDefaultLocaleName @ stdcall GetSystemDefaultLocaleName(ptr long)
@ stdcall GetSystemDefaultUILanguage() kernel32.GetSystemDefaultUILanguage @ stdcall GetSystemDefaultUILanguage()
@ stdcall GetSystemDirectoryA(ptr long) @ stdcall GetSystemDirectoryA(ptr long)
@ stdcall GetSystemDirectoryW(ptr long) @ stdcall GetSystemDirectoryW(ptr long)
@ stdcall GetSystemFileCacheSize(ptr ptr ptr) kernel32.GetSystemFileCacheSize @ stdcall GetSystemFileCacheSize(ptr ptr ptr) kernel32.GetSystemFileCacheSize
@ -719,7 +719,7 @@
@ stdcall GetThreadId(ptr) @ stdcall GetThreadId(ptr)
# @ stub GetThreadIdealProcessorEx # @ stub GetThreadIdealProcessorEx
# @ stub GetThreadInformation # @ stub GetThreadInformation
@ stdcall GetThreadLocale() kernel32.GetThreadLocale @ stdcall GetThreadLocale()
@ stdcall GetThreadPreferredUILanguages(long ptr ptr ptr) kernel32.GetThreadPreferredUILanguages @ stdcall GetThreadPreferredUILanguages(long ptr ptr ptr) kernel32.GetThreadPreferredUILanguages
@ stdcall GetThreadPriority(long) @ stdcall GetThreadPriority(long)
@ stdcall GetThreadPriorityBoost(long ptr) @ stdcall GetThreadPriorityBoost(long ptr)
@ -740,10 +740,10 @@
@ stub GetUILanguageInfo @ stub GetUILanguageInfo
# @ stub GetUnicodeStringToEightBitSizeRoutine # @ stub GetUnicodeStringToEightBitSizeRoutine
# @ stub GetUnicodeStringToEightBitStringRoutine # @ stub GetUnicodeStringToEightBitStringRoutine
@ stdcall GetUserDefaultLCID() kernel32.GetUserDefaultLCID @ stdcall GetUserDefaultLCID()
@ stdcall GetUserDefaultLangID() kernel32.GetUserDefaultLangID @ stdcall GetUserDefaultLangID()
@ stdcall GetUserDefaultLocaleName(ptr long) kernel32.GetUserDefaultLocaleName @ stdcall GetUserDefaultLocaleName(ptr long)
@ stdcall GetUserDefaultUILanguage() kernel32.GetUserDefaultUILanguage @ stdcall GetUserDefaultUILanguage()
@ stdcall GetUserGeoID(long) kernel32.GetUserGeoID @ stdcall GetUserGeoID(long) kernel32.GetUserGeoID
@ stub GetUserInfo @ stub GetUserInfo
@ stub GetUserInfoWord @ stub GetUserInfoWord
@ -914,7 +914,7 @@
@ stdcall K32QueryWorkingSet(long ptr long) kernel32.K32QueryWorkingSet @ stdcall K32QueryWorkingSet(long ptr long) kernel32.K32QueryWorkingSet
@ stdcall K32QueryWorkingSetEx(long ptr long) kernel32.K32QueryWorkingSetEx @ stdcall K32QueryWorkingSetEx(long ptr long) kernel32.K32QueryWorkingSetEx
@ stub KernelBaseGetGlobalData @ stub KernelBaseGetGlobalData
@ stdcall LCIDToLocaleName(long ptr long long) kernel32.LCIDToLocaleName @ stdcall LCIDToLocaleName(long ptr long long)
@ stdcall LCMapStringA(long long str long ptr long) kernel32.LCMapStringA @ stdcall LCMapStringA(long long str long ptr long) kernel32.LCMapStringA
@ stdcall LCMapStringEx(wstr long wstr long ptr long ptr ptr long) kernel32.LCMapStringEx @ stdcall LCMapStringEx(wstr long wstr long ptr long ptr ptr long) kernel32.LCMapStringEx
@ stdcall LCMapStringW(long long wstr long ptr long) kernel32.LCMapStringW @ stdcall LCMapStringW(long long wstr long ptr long) kernel32.LCMapStringW
@ -1346,7 +1346,7 @@
@ stdcall ResetWriteWatch(ptr long) @ stdcall ResetWriteWatch(ptr long)
@ stdcall ResolveDelayLoadedAPI(ptr ptr ptr ptr ptr long) kernel32.ResolveDelayLoadedAPI @ stdcall ResolveDelayLoadedAPI(ptr ptr ptr ptr ptr long) kernel32.ResolveDelayLoadedAPI
# @ stub ResolveDelayLoadsFromDll # @ stub ResolveDelayLoadsFromDll
@ stdcall ResolveLocaleName(wstr ptr long) kernel32.ResolveLocaleName @ stdcall ResolveLocaleName(wstr ptr long)
@ stdcall RestoreLastError(long) ntdll.RtlRestoreLastWin32Error @ stdcall RestoreLastError(long) ntdll.RtlRestoreLastWin32Error
@ stdcall ResumeThread(long) @ stdcall ResumeThread(long)
@ stdcall RevertToSelf() @ stdcall RevertToSelf()
@ -1485,14 +1485,14 @@
@ stdcall SetThreadIdealProcessor(long long) @ stdcall SetThreadIdealProcessor(long long)
@ stdcall SetThreadIdealProcessorEx(long ptr ptr) @ stdcall SetThreadIdealProcessorEx(long ptr ptr)
# @ stub SetThreadInformation # @ stub SetThreadInformation
@ stdcall SetThreadLocale(long) kernel32.SetThreadLocale @ stdcall SetThreadLocale(long)
@ stdcall SetThreadPreferredUILanguages(long ptr ptr) kernel32.SetThreadPreferredUILanguages @ stdcall SetThreadPreferredUILanguages(long ptr ptr) kernel32.SetThreadPreferredUILanguages
@ stdcall SetThreadPriority(long long) @ stdcall SetThreadPriority(long long)
@ stdcall SetThreadPriorityBoost(long long) @ stdcall SetThreadPriorityBoost(long long)
# @ stub SetThreadSelectedCpuSets # @ stub SetThreadSelectedCpuSets
@ stdcall SetThreadStackGuarantee(ptr) @ stdcall SetThreadStackGuarantee(ptr)
@ stdcall SetThreadToken(ptr ptr) @ stdcall SetThreadToken(ptr ptr)
@ stdcall SetThreadUILanguage(long) kernel32.SetThreadUILanguage @ stdcall SetThreadUILanguage(long)
@ stub SetThreadpoolStackInformation @ stub SetThreadpoolStackInformation
@ stdcall SetThreadpoolThreadMaximum(ptr long) ntdll.TpSetPoolMaxThreads @ stdcall SetThreadpoolThreadMaximum(ptr long) ntdll.TpSetPoolMaxThreads
@ stdcall SetThreadpoolThreadMinimum(ptr long) ntdll.TpSetPoolMinThreads @ stdcall SetThreadpoolThreadMinimum(ptr long) ntdll.TpSetPoolMinThreads
@ -1657,8 +1657,8 @@
@ stdcall UrlUnescapeW(wstr ptr ptr long) @ stdcall UrlUnescapeW(wstr ptr ptr long)
@ stdcall VerFindFileA(long str str str ptr ptr ptr ptr) @ stdcall VerFindFileA(long str str str ptr ptr ptr ptr)
@ stdcall VerFindFileW(long wstr wstr wstr ptr ptr ptr ptr) @ stdcall VerFindFileW(long wstr wstr wstr ptr ptr ptr ptr)
@ stdcall VerLanguageNameA(long str long) kernel32.VerLanguageNameA @ stdcall VerLanguageNameA(long str long)
@ stdcall VerLanguageNameW(long wstr long) kernel32.VerLanguageNameW @ stdcall VerLanguageNameW(long wstr long)
@ stdcall VerQueryValueA(ptr str ptr ptr) @ stdcall VerQueryValueA(ptr str ptr ptr)
@ stdcall VerQueryValueW(ptr wstr ptr ptr) @ stdcall VerQueryValueW(ptr wstr ptr ptr)
@ stdcall -ret64 VerSetConditionMask(long long long long) ntdll.VerSetConditionMask @ stdcall -ret64 VerSetConditionMask(long long long long) ntdll.VerSetConditionMask

225
dlls/kernelbase/locale.c Normal file
View File

@ -0,0 +1,225 @@
/*
* Locale support
*
* Copyright 1995 Martin von Loewis
* Copyright 1998 David Lee Lambert
* Copyright 2000 Julio César Gázquez
* Copyright 2002 Alexandre Julliard for CodeWeavers
* Copyright 2003 Jon Griffiths
* Copyright 2005 Dmitry Timoshkov
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "winternl.h"
#include "kernelbase.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(nls);
/******************************************************************************
* CompareStringOrdinal (kernelbase.@)
*/
INT WINAPI DECLSPEC_HOTPATCH CompareStringOrdinal( const WCHAR *str1, INT len1,
const WCHAR *str2, INT len2, BOOL ignore_case )
{
int ret;
if (!str1 || !str2)
{
SetLastError( ERROR_INVALID_PARAMETER );
return 0;
}
if (len1 < 0) len1 = lstrlenW( str1 );
if (len2 < 0) len2 = lstrlenW( str2 );
ret = RtlCompareUnicodeStrings( str1, len1, str2, len2, ignore_case );
if (ret < 0) return CSTR_LESS_THAN;
if (ret > 0) return CSTR_GREATER_THAN;
return CSTR_EQUAL;
}
/******************************************************************************
* FindStringOrdinal (kernelbase.@)
*/
INT WINAPI DECLSPEC_HOTPATCH FindStringOrdinal( DWORD flag, const WCHAR *src, INT src_size,
const WCHAR *val, INT val_size, BOOL ignore_case )
{
INT offset, inc, count;
TRACE( "%#x %s %d %s %d %d\n", flag, wine_dbgstr_w(src), src_size,
wine_dbgstr_w(val), val_size, ignore_case );
if (!src || !val)
{
SetLastError( ERROR_INVALID_PARAMETER );
return -1;
}
if (flag != FIND_FROMSTART && flag != FIND_FROMEND && flag != FIND_STARTSWITH && flag != FIND_ENDSWITH)
{
SetLastError( ERROR_INVALID_FLAGS );
return -1;
}
if (src_size == -1) src_size = lstrlenW( src );
if (val_size == -1) val_size = lstrlenW( val );
SetLastError( ERROR_SUCCESS );
src_size -= val_size;
if (src_size < 0) return -1;
count = flag & (FIND_FROMSTART | FIND_FROMEND) ? src_size + 1 : 1;
offset = flag & (FIND_FROMSTART | FIND_STARTSWITH) ? 0 : src_size;
inc = flag & (FIND_FROMSTART | FIND_STARTSWITH) ? 1 : -1;
while (count--)
{
if (CompareStringOrdinal( src + offset, val_size, val, val_size, ignore_case ) == CSTR_EQUAL)
return offset;
offset += inc;
}
return -1;
}
/***********************************************************************
* LCIDToLocaleName (kernelbase.@)
*/
INT WINAPI DECLSPEC_HOTPATCH LCIDToLocaleName( LCID lcid, LPWSTR name, INT count, DWORD flags )
{
static int once;
if (flags && !once++) FIXME( "unsupported flags %x\n", flags );
return GetLocaleInfoW( lcid, LOCALE_SNAME | LOCALE_NOUSEROVERRIDE, name, count );
}
/***********************************************************************
* GetSystemDefaultLCID (kernelbase.@)
*/
LCID WINAPI DECLSPEC_HOTPATCH GetSystemDefaultLCID(void)
{
LCID lcid;
NtQueryDefaultLocale( FALSE, &lcid );
return lcid;
}
/***********************************************************************
* GetSystemDefaultLangID (kernelbase.@)
*/
LANGID WINAPI DECLSPEC_HOTPATCH GetSystemDefaultLangID(void)
{
return LANGIDFROMLCID( GetSystemDefaultLCID() );
}
/***********************************************************************
* GetSystemDefaultLocaleName (kernelbase.@)
*/
INT WINAPI DECLSPEC_HOTPATCH GetSystemDefaultLocaleName( LPWSTR name, INT len )
{
return LCIDToLocaleName( GetSystemDefaultLCID(), name, len, 0 );
}
/***********************************************************************
* GetSystemDefaultUILanguage (kernelbase.@)
*/
LANGID WINAPI DECLSPEC_HOTPATCH GetSystemDefaultUILanguage(void)
{
LANGID lang;
NtQueryInstallUILanguage( &lang );
return lang;
}
/***********************************************************************
* GetUserDefaultLCID (kernelbase.@)
*/
LCID WINAPI DECLSPEC_HOTPATCH GetUserDefaultLCID(void)
{
LCID lcid;
NtQueryDefaultLocale( TRUE, &lcid );
return lcid;
}
/***********************************************************************
* GetUserDefaultLangID (kernelbase.@)
*/
LANGID WINAPI DECLSPEC_HOTPATCH GetUserDefaultLangID(void)
{
return LANGIDFROMLCID( GetUserDefaultLCID() );
}
/***********************************************************************
* GetUserDefaultLocaleName (kernelbase.@)
*/
INT WINAPI DECLSPEC_HOTPATCH GetUserDefaultLocaleName( LPWSTR name, INT len )
{
return LCIDToLocaleName( GetUserDefaultLCID(), name, len, 0 );
}
/***********************************************************************
* GetUserDefaultUILanguage (kernelbase.@)
*/
LANGID WINAPI DECLSPEC_HOTPATCH GetUserDefaultUILanguage(void)
{
LANGID lang;
NtQueryDefaultUILanguage( &lang );
return lang;
}
/******************************************************************************
* ResolveLocaleName (kernelbase.@)
*/
INT WINAPI DECLSPEC_HOTPATCH ResolveLocaleName( LPCWSTR name, LPWSTR buffer, INT len )
{
FIXME( "stub: %s, %p, %d\n", wine_dbgstr_w(name), buffer, len );
SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
return 0;
}
/***********************************************************************
* VerLanguageNameA (kernelbase.@)
*/
DWORD WINAPI DECLSPEC_HOTPATCH VerLanguageNameA( DWORD lang, LPSTR buffer, DWORD size )
{
return GetLocaleInfoA( MAKELCID( lang, SORT_DEFAULT ), LOCALE_SENGLANGUAGE, buffer, size );
}
/***********************************************************************
* VerLanguageNameW (kernelbase.@)
*/
DWORD WINAPI DECLSPEC_HOTPATCH VerLanguageNameW( DWORD lang, LPWSTR buffer, DWORD size )
{
return GetLocaleInfoW( MAKELCID( lang, SORT_DEFAULT ), LOCALE_SENGLANGUAGE, buffer, size );
}

View File

@ -26,6 +26,7 @@
#define NONAMELESSUNION #define NONAMELESSUNION
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "winnls.h"
#include "winternl.h" #include "winternl.h"
#include "kernelbase.h" #include "kernelbase.h"
@ -249,6 +250,17 @@ DWORD WINAPI DECLSPEC_HOTPATCH GetThreadId( HANDLE thread )
} }
/***********************************************************************
* GetThreadLocale (kernelbase.@)
*/
LCID WINAPI DECLSPEC_HOTPATCH GetThreadLocale(void)
{
LCID ret = NtCurrentTeb()->CurrentLocale;
if (!ret) NtCurrentTeb()->CurrentLocale = ret = GetUserDefaultLCID();
return ret;
}
/********************************************************************** /**********************************************************************
* GetThreadPriority (kernelbase.@) * GetThreadPriority (kernelbase.@)
*/ */
@ -446,6 +458,25 @@ BOOL WINAPI DECLSPEC_HOTPATCH SetThreadIdealProcessorEx( HANDLE thread, PROCESSO
} }
/**********************************************************************
* SetThreadLocale (kernelbase.@)
*/
BOOL WINAPI DECLSPEC_HOTPATCH SetThreadLocale( LCID lcid )
{
lcid = ConvertDefaultLocale( lcid );
if (lcid != GetThreadLocale())
{
if (!IsValidLocale( lcid, LCID_SUPPORTED ))
{
SetLastError( ERROR_INVALID_PARAMETER );
return FALSE;
}
NtCurrentTeb()->CurrentLocale = lcid;
}
return TRUE;
}
/********************************************************************** /**********************************************************************
* SetThreadPriority (kernelbase.@) * SetThreadPriority (kernelbase.@)
*/ */
@ -487,6 +518,18 @@ BOOL WINAPI DECLSPEC_HOTPATCH SetThreadStackGuarantee( ULONG *size )
} }
/**********************************************************************
* SetThreadUILanguage (kernelbase.@)
*/
LANGID WINAPI DECLSPEC_HOTPATCH SetThreadUILanguage( LANGID langid )
{
TRACE( "(0x%04x) stub - returning success\n", langid );
if (!langid) langid = GetThreadUILanguage();
return langid;
}
/********************************************************************** /**********************************************************************
* SuspendThread (kernelbase.@) * SuspendThread (kernelbase.@)
*/ */