Module: wine Branch: master Commit: d5385c71779cf5b164582d68e26ca8e9834e8863 URL: https://gitlab.winehq.org/wine/wine/-/commit/d5385c71779cf5b164582d68e26ca8e...
Author: Santino Mazza smazza@codeweavers.com Date: Mon Nov 21 11:06:09 2022 -0300
kernelbase: Implement GetGeoInfoEx.
---
dlls/kernel32/tests/locale.c | 12 ++++++------ dlls/kernelbase/locale.c | 19 ++++++++++++++++--- 2 files changed, 22 insertions(+), 9 deletions(-)
diff --git a/dlls/kernel32/tests/locale.c b/dlls/kernel32/tests/locale.c index 8dd9e12c91b..723c24873c6 100644 --- a/dlls/kernel32/tests/locale.c +++ b/dlls/kernel32/tests/locale.c @@ -5977,26 +5977,26 @@ static void test_GetGeoInfo(void)
/* Test with ISO 3166-1 */ ret = pGetGeoInfoEx(L"AR", GEO_ISO3, buffW, ARRAYSIZE(buffW)); - todo_wine ok(ret != 0, "GetGeoInfoEx failed %ld.\n", GetLastError()); - todo_wine ok(!wcscmp(buffW, L"ARG"), "expected string to be ARG, got %ls\n", buffW); + ok(ret != 0, "GetGeoInfoEx failed %ld.\n", GetLastError()); + ok(!wcscmp(buffW, L"ARG"), "expected string to be ARG, got %ls\n", buffW);
/* Test with UN M.49 */ SetLastError(0xdeadbeef); ret = pGetGeoInfoEx(L"032", GEO_ISO3, buffW, ARRAYSIZE(buffW)); ok(ret == 0, "expected GetGeoInfoEx to fail.\n"); - todo_wine ok(GetLastError() == ERROR_INVALID_PARAMETER, + ok(GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got %ld.\n", GetLastError());
/* Test GEO_ID */ ret = pGetGeoInfoEx(L"AR", GEO_ID, buffW, ARRAYSIZE(buffW)); - todo_wine ok(ret != 0, "GetGeoInfoEx failed %ld.\n", GetLastError()); - todo_wine ok(!wcscmp(buffW, L"11"), "expected string to be 11, got %ls\n", buffW); + ok(ret != 0, "GetGeoInfoEx failed %ld.\n", GetLastError()); + ok(!wcscmp(buffW, L"11"), "expected string to be 11, got %ls\n", buffW);
/* Test with invalid geo type */ SetLastError(0xdeadbeef); ret = pGetGeoInfoEx(L"AR", GEO_LCID, buffW, ARRAYSIZE(buffW)); ok(ret == 0, "expected GetGeoInfoEx to fail.\n"); - todo_wine ok(GetLastError() == ERROR_INVALID_FLAGS, + ok(GetLastError() == ERROR_INVALID_FLAGS, "expected ERROR_INVALID_PARAMETER got %ld.\n", GetLastError()); }
diff --git a/dlls/kernelbase/locale.c b/dlls/kernelbase/locale.c index b745726f7c1..5cc4152e491 100644 --- a/dlls/kernelbase/locale.c +++ b/dlls/kernelbase/locale.c @@ -5746,10 +5746,23 @@ INT WINAPI DECLSPEC_HOTPATCH GetGeoInfoW( GEOID id, GEOTYPE type, WCHAR *data, i
INT WINAPI DECLSPEC_HOTPATCH GetGeoInfoEx( WCHAR *location, GEOTYPE type, WCHAR *data, int data_count ) { - FIXME( "stub: %s %lx %p %d\n", wine_dbgstr_w(location), type, data, data_count ); + const struct geo_id *ptr = find_geo_name_entry( location );
- SetLastError( ERROR_CALL_NOT_IMPLEMENTED ); - return 0; + TRACE( "%s %lx %p %d\n", wine_dbgstr_w(location), type, data, data_count ); + + if (!ptr) + { + SetLastError( ERROR_INVALID_PARAMETER ); + return 0; + } + + if (type == GEO_LCID || type == GEO_NATION || type == GEO_RFC1766) + { + SetLastError( ERROR_INVALID_FLAGS ); + return 0; + } + + return get_geo_info( ptr, type, data, data_count, 0 ); }