From 7fb4809347faa8285c5c67bfc950d4fffeee86d4 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Sun, 26 Mar 2017 10:06:00 +0300 Subject: [PATCH] oleaut32: Implement GetAltMonthNames(). Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/oleaut32/oleaut.c | 109 ++++++++++++++++++++++++++++++++ dlls/oleaut32/oleaut32.spec | 2 +- dlls/oleaut32/tests/varformat.c | 37 +++++++++++ 3 files changed, 147 insertions(+), 1 deletion(-) diff --git a/dlls/oleaut32/oleaut.c b/dlls/oleaut32/oleaut.c index f9734e6d783..d03893a938c 100644 --- a/dlls/oleaut32/oleaut.c +++ b/dlls/oleaut32/oleaut.c @@ -935,3 +935,112 @@ HCURSOR WINAPI OleIconToCursor( HINSTANCE hinstExe, HICON hIcon) /* FIXME: make an extended conversation from HICON to HCURSOR */ return CopyCursor(hIcon); } + +/*********************************************************************** + * GetAltMonthNames (OLEAUT32.@) + */ +HRESULT WINAPI GetAltMonthNames(LCID lcid, LPOLESTR **str) +{ + static const WCHAR ar_month1W[] = {0x645,0x62d,0x631,0x645,0}; + static const WCHAR ar_month2W[] = {0x635,0x641,0x631,0}; + static const WCHAR ar_month3W[] = {0x631,0x628,0x64a,0x639,' ',0x627,0x644,0x627,0x648,0x644,0}; + static const WCHAR ar_month4W[] = {0x631,0x628,0x64a,0x639,' ',0x627,0x644,0x62b,0x627,0x646,0x64a,0}; + static const WCHAR ar_month5W[] = {0x62c,0x645,0x627,0x62f,0x649,' ',0x627,0x644,0x627,0x648,0x644,0x649,0}; + static const WCHAR ar_month6W[] = {0x62c,0x645,0x627,0x62f,0x649,' ',0x627,0x644,0x62b,0x627,0x646,0x64a,0x629,0}; + static const WCHAR ar_month7W[] = {0x631,0x62c,0x628,0}; + static const WCHAR ar_month8W[] = {0x634,0x639,0x628,0x627,0x646,0}; + static const WCHAR ar_month9W[] = {0x631,0x645,0x636,0x627,0x646,0}; + static const WCHAR ar_month10W[] = {0x634,0x648,0x627,0x643,0}; + static const WCHAR ar_month11W[] = {0x630,0x648,' ',0x627,0x644,0x642,0x639,0x62f,0x629,0}; + static const WCHAR ar_month12W[] = {0x630,0x648,' ',0x627,0x644,0x62d,0x62c,0x629,0}; + + static const WCHAR *arabic_hijri[] = + { + ar_month1W, + ar_month2W, + ar_month3W, + ar_month4W, + ar_month5W, + ar_month6W, + ar_month7W, + ar_month8W, + ar_month9W, + ar_month10W, + ar_month11W, + ar_month12W, + NULL + }; + + static const WCHAR pl_month1W[] = {'s','t','y','c','z','n','i','a',0}; + static const WCHAR pl_month2W[] = {'l','u','t','e','g','o',0}; + static const WCHAR pl_month3W[] = {'m','a','r','c','a',0}; + static const WCHAR pl_month4W[] = {'k','w','i','e','t','n','i','a',0}; + static const WCHAR pl_month5W[] = {'m','a','j','a',0}; + static const WCHAR pl_month6W[] = {'c','z','e','r','w','c','a',0}; + static const WCHAR pl_month7W[] = {'l','i','p','c','a',0}; + static const WCHAR pl_month8W[] = {'s','i','e','r','p','n','i','a',0}; + static const WCHAR pl_month9W[] = {'w','r','z','e',0x15b,'n','i','a',0}; + static const WCHAR pl_month10W[] = {'p','a',0x17a,'d','z','i','e','r','n','i','k','a',0}; + static const WCHAR pl_month11W[] = {'l','i','s','t','o','p','a','d','a',0}; + static const WCHAR pl_month12W[] = {'g','r','u','d','n','i','a',0}; + + static const WCHAR *polish_genitive_names[] = + { + pl_month1W, + pl_month2W, + pl_month3W, + pl_month4W, + pl_month5W, + pl_month6W, + pl_month7W, + pl_month8W, + pl_month9W, + pl_month10W, + pl_month11W, + pl_month12W, + NULL + }; + + static const WCHAR ru_month1W[] = {0x44f,0x43d,0x432,0x430,0x440,0x44f,0}; + static const WCHAR ru_month2W[] = {0x444,0x435,0x432,0x440,0x430,0x43b,0x44f,0}; + static const WCHAR ru_month3W[] = {0x43c,0x430,0x440,0x442,0x430,0}; + static const WCHAR ru_month4W[] = {0x430,0x43f,0x440,0x435,0x43b,0x44f,0}; + static const WCHAR ru_month5W[] = {0x43c,0x430,0x44f,0}; + static const WCHAR ru_month6W[] = {0x438,0x44e,0x43d,0x44f,0}; + static const WCHAR ru_month7W[] = {0x438,0x44e,0x43b,0x44f,0}; + static const WCHAR ru_month8W[] = {0x430,0x432,0x433,0x443,0x441,0x442,0x430,0}; + static const WCHAR ru_month9W[] = {0x441,0x435,0x43d,0x442,0x44f,0x431,0x440,0x44f,0}; + static const WCHAR ru_month10W[] = {0x43e,0x43a,0x442,0x44f,0x431,0x440,0x44f,0}; + static const WCHAR ru_month11W[] = {0x43d,0x43e,0x44f,0x431,0x440,0x44f,0}; + static const WCHAR ru_month12W[] = {0x434,0x435,0x43a,0x430,0x431,0x440,0x44f,0}; + + static const WCHAR *russian_genitive_names[] = + { + ru_month1W, + ru_month2W, + ru_month3W, + ru_month4W, + ru_month5W, + ru_month6W, + ru_month7W, + ru_month8W, + ru_month9W, + ru_month10W, + ru_month11W, + ru_month12W, + NULL + }; + + TRACE("%#x, %p\n", lcid, str); + + if (PRIMARYLANGID(LANGIDFROMLCID(lcid)) == LANG_ARABIC) + *str = (LPOLESTR *)arabic_hijri; + else if (PRIMARYLANGID(LANGIDFROMLCID(lcid)) == LANG_POLISH) + *str = (LPOLESTR *)polish_genitive_names; + else if (PRIMARYLANGID(LANGIDFROMLCID(lcid)) == LANG_RUSSIAN) + *str = (LPOLESTR *)russian_genitive_names; + else + *str = NULL; + + return S_OK; +} diff --git a/dlls/oleaut32/oleaut32.spec b/dlls/oleaut32/oleaut32.spec index dccdb5f99f3..cc18a04befe 100644 --- a/dlls/oleaut32/oleaut32.spec +++ b/dlls/oleaut32/oleaut32.spec @@ -319,7 +319,7 @@ 329 stdcall VarCyMulI8(int64 int64 ptr) 330 stdcall VarDateFromUdate(ptr long ptr) 331 stdcall VarUdateFromDate(double long ptr) -332 stub GetAltMonthNames +332 stdcall GetAltMonthNames(long ptr) 333 stdcall VarI8FromUI1(long long) 334 stdcall VarI8FromI2(long long) 335 stdcall VarI8FromR4(float long) diff --git a/dlls/oleaut32/tests/varformat.c b/dlls/oleaut32/tests/varformat.c index 9547c89444f..69476aa5d31 100644 --- a/dlls/oleaut32/tests/varformat.c +++ b/dlls/oleaut32/tests/varformat.c @@ -640,6 +640,42 @@ static void test_VarFormatFromTokens(void) SysFreeString(bstr); } +static void test_GetAltMonthNames(void) +{ + LPOLESTR *str, *str2; + HRESULT hr; + + str = (void *)0xdeadbeef; + hr = GetAltMonthNames(0, &str); + ok(hr == S_OK, "Unexpected return value %08x\n", hr); + ok(str == NULL, "Got %p\n", str); + + str = (void *)0xdeadbeef; + hr = GetAltMonthNames(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT), &str); + ok(hr == S_OK, "Unexpected return value %08x\n", hr); + ok(str == NULL, "Got %p\n", str); + + str = NULL; + hr = GetAltMonthNames(MAKELCID(MAKELANGID(LANG_ARABIC, SUBLANG_ARABIC_EGYPT), SORT_DEFAULT), &str); + ok(hr == S_OK, "Unexpected return value %08x\n", hr); + ok(str != NULL, "Got %p\n", str); + + str2 = NULL; + hr = GetAltMonthNames(MAKELCID(MAKELANGID(LANG_ARABIC, SUBLANG_ARABIC_EGYPT), SORT_DEFAULT), &str2); + ok(hr == S_OK, "Unexpected return value %08x\n", hr); + ok(str2 == str, "Got %p\n", str2); + + str = NULL; + hr = GetAltMonthNames(MAKELCID(MAKELANGID(LANG_RUSSIAN, SUBLANG_DEFAULT), SORT_DEFAULT), &str); + ok(hr == S_OK, "Unexpected return value %08x\n", hr); + ok(str != NULL, "Got %p\n", str); + + str = NULL; + hr = GetAltMonthNames(MAKELCID(MAKELANGID(LANG_POLISH, SUBLANG_DEFAULT), SORT_DEFAULT), &str); + ok(hr == S_OK, "Unexpected return value %08x\n", hr); + ok(str != NULL, "Got %p\n", str); +} + START_TEST(varformat) { hOleaut32 = GetModuleHandleA("oleaut32.dll"); @@ -650,4 +686,5 @@ START_TEST(varformat) test_VarFormat(); test_VarWeekdayName(); test_VarFormatFromTokens(); + test_GetAltMonthNames(); }