v2: Remove some unnecessary initialization code (leftovers) from test, as this minimal test now only tests for returnvalues of ResolveLocaleName
Fixes https://bugs.winehq.org/show_bug.cgi?id=52407
The current stub assumes a failing call to ResolveLocaleName returns 0, but tests show it returns 1 (and empty string). It actually never seems to returns 0. Added test is minimal to keep patch small, a few other traces of what the function returns can be seen on testbot here https://testbot.winehq.org/JobDetails.pl?Key=105651&f206=exe32.report#k2... and https://testbot.winehq.org/JobDetails.pl?Key=105651&f206=exe32.report&am...
Signed-off-by: Louis Lenders xerox.xerox2000x@gmail.com --- dlls/kernel32/tests/locale.c | 19 +++++++++++++++++++ dlls/kernelbase/locale.c | 6 ++++-- 2 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/dlls/kernel32/tests/locale.c b/dlls/kernel32/tests/locale.c index 2d327b7130c..daa70f13580 100644 --- a/dlls/kernel32/tests/locale.c +++ b/dlls/kernel32/tests/locale.c @@ -99,6 +99,7 @@ static NTSTATUS (WINAPI *pRtlCustomCPToUnicodeN)(CPTABLEINFO*,WCHAR*,DWORD,DWORD static NTSTATUS (WINAPI *pRtlGetSystemPreferredUILanguages)(DWORD,ULONG,ULONG*,WCHAR*,ULONG*); static NTSTATUS (WINAPI *pRtlGetThreadPreferredUILanguages)(DWORD,ULONG*,WCHAR*,ULONG*); static NTSTATUS (WINAPI *pRtlGetUserPreferredUILanguages)(DWORD,ULONG,ULONG*,WCHAR*,ULONG*); +static INT (WINAPI *pResolveLocaleName)(LPCWSTR,LPWSTR,INT);
static void InitFunctionPointers(void) { @@ -139,6 +140,7 @@ static void InitFunctionPointers(void) X(GetNLSVersion); X(GetNLSVersionEx); X(IsValidNLSVersion); + X(ResolveLocaleName);
mod = GetModuleHandleA("ntdll"); X(RtlUpcaseUnicodeChar); @@ -7142,6 +7144,22 @@ static void test_EnumCalendarInfoExW(void) } }
+static void test_ResolveLocaleName(void) +{ + WCHAR name[LOCALE_NAME_MAX_LENGTH]; + INT i; + + /* querying for 'eo' returns empty string '' on <=win8 and 'eo-001' on win10 */ + i = pResolveLocaleName( L"eo", name, LOCALE_NAME_MAX_LENGTH ); + ok( i, "ResolveLocaleName returned unexpected %d\n", i ); + + i = pResolveLocaleName( L"wi-NEHQ", name, LOCALE_NAME_MAX_LENGTH ); + ok( i == 1, "ResolveLocaleName returned unexpected %d\n", i ); + + i = pResolveLocaleName( L"wi-NEHQ", NULL, 0 ); + ok( i == 1, "ResolveLocaleName returned unexpected %d\n", i ); +} + START_TEST(locale) { InitFunctionPointers(); @@ -7198,4 +7216,5 @@ START_TEST(locale) test_EnumCalendarInfoW(); test_EnumCalendarInfoExA(); test_EnumCalendarInfoExW(); + test_ResolveLocaleName(); } diff --git a/dlls/kernelbase/locale.c b/dlls/kernelbase/locale.c index 667d1a4dc65..79e60913182 100644 --- a/dlls/kernelbase/locale.c +++ b/dlls/kernelbase/locale.c @@ -5621,8 +5621,10 @@ INT WINAPI DECLSPEC_HOTPATCH ResolveLocaleName( LPCWSTR name, LPWSTR buffer, INT { FIXME( "stub: %s, %p, %d\n", wine_dbgstr_w(name), buffer, len );
- SetLastError( ERROR_CALL_NOT_IMPLEMENTED ); - return 0; + if (buffer) + buffer[0] = 0; + + return 1; }