There's still a couple of things unimplemented, as I don't have access to a compiler able to produce working code on Windows for me to get the missing data. The literal strings should move somewhere else (*.nls files?). Also, I'm not sure how to translate that code to the W version of the function. Should the W call the A? Or reimplement the same algorithm, with different string constants and function calls (A vs W)? Changelog: - Better implementation of GetCalendarInfoA. Vincent
diff -urN wine/dlls/kernel/kernel32.spec-orig wine/dlls/kernel/kernel32.spec --- wine/dlls/kernel/kernel32.spec-orig Fri May 10 08:40:00 2002 +++ wine/dlls/kernel/kernel32.spec Sat May 11 15:07:50 2002 @@ -964,8 +964,8 @@ @ stdcall InitializeCriticalSectionAndSpinCount(ptr long) InitializeCriticalSectionAndSpinCount @ stdcall ProcessIdToSessionId(long ptr) ProcessIdToSessionId @ stdcall SetCriticalSectionSpinCount(ptr long) SetCriticalSectionSpinCount -@ stdcall GetCalendarInfoA(long long long ptr long ptr) GetCalendarInfoA -@ stdcall GetCalendarInfoW(long long long ptr long ptr) GetCalendarInfoW +@ stdcall GetCalendarInfoA(long long long str long ptr) GetCalendarInfoA +@ stdcall GetCalendarInfoW(long long long wstr long ptr) GetCalendarInfoW @ stdcall SetCalendarInfoA(long long long str) SetCalendarInfoA @ stdcall SetCalendarInfoW(long long long wstr) SetCalendarInfoW @ stdcall VerifyVersionInfoW(long long long long)VerifyVersionInfoW diff -urN wine/dlls/kernel/time.c-orig wine/dlls/kernel/time.c --- wine/dlls/kernel/time.c-orig Mon Mar 11 00:08:38 2002 +++ wine/dlls/kernel/time.c Sat May 11 17:43:18 2002 @@ -585,71 +585,145 @@ int WINAPI GetCalendarInfoA(LCID Locale, CALID Calendar, CALTYPE CalType, LPSTR lpCalData, int cchData, LPDWORD lpValue) { - FIXME("(%08lx,%08lx,%08lx,%p,%d,%p): stub\n", + FIXME("(%08lx,%08lx,%08lx,%p,%d,%p): quarter-stub\n", Locale, Calendar, CalType, lpCalData, cchData, lpValue); - /* dont have the #define values for those */ - FIXME("\t"); - /* if (CalType & CAL_NOUSEROVERRIDE) - MESSAGE("CAL_NOUSEROVERRIDE|"); - if (CalType & CAL_RETURN_NUMBER) - MESSAGE("CAL_RETURN_NUMBER|"); + FIXME("flag CAL_NOUSEROVERRIDE used, not fully implemented\n"); if (CalType & CAL_USE_CP_ACP) - MESSAGE("CAL_USE_CP_ACP|"); - */ + FIXME("flag CAL_USE_CP_ACP used, not fully implemented\n"); - /*switch (CalType & ~(CAL_NOUSEROVERRIDE|CAL_RETURN_NUMBER|CAL_USE_CP_ACP)) {*/ - switch (CalType & 0xffff) { -#define X(x) case x: MESSAGE(#x"\n");break; - X(CAL_ICALINTVALUE) - X(CAL_SCALNAME) - X(CAL_IYEAROFFSETRANGE) - X(CAL_SERASTRING) - X(CAL_SSHORTDATE) - X(CAL_SLONGDATE) - X(CAL_SDAYNAME1) - X(CAL_SDAYNAME2) - X(CAL_SDAYNAME3) - X(CAL_SDAYNAME4) - X(CAL_SDAYNAME5) - X(CAL_SDAYNAME6) - X(CAL_SDAYNAME7) - X(CAL_SABBREVDAYNAME1) - X(CAL_SABBREVDAYNAME2) - X(CAL_SABBREVDAYNAME3) - X(CAL_SABBREVDAYNAME4) - X(CAL_SABBREVDAYNAME5) - X(CAL_SABBREVDAYNAME6) - X(CAL_SABBREVDAYNAME7) - X(CAL_SMONTHNAME1) - X(CAL_SMONTHNAME2) - X(CAL_SMONTHNAME3) - X(CAL_SMONTHNAME4) - X(CAL_SMONTHNAME5) - X(CAL_SMONTHNAME6) - X(CAL_SMONTHNAME7) - X(CAL_SMONTHNAME8) - X(CAL_SMONTHNAME9) - X(CAL_SMONTHNAME10) - X(CAL_SMONTHNAME11) - X(CAL_SMONTHNAME12) - X(CAL_SMONTHNAME13) - X(CAL_SABBREVMONTHNAME1) - X(CAL_SABBREVMONTHNAME2) - X(CAL_SABBREVMONTHNAME3) - X(CAL_SABBREVMONTHNAME4) - X(CAL_SABBREVMONTHNAME5) - X(CAL_SABBREVMONTHNAME6) - X(CAL_SABBREVMONTHNAME7) - X(CAL_SABBREVMONTHNAME8) - X(CAL_SABBREVMONTHNAME9) - X(CAL_SABBREVMONTHNAME10) - X(CAL_SABBREVMONTHNAME11) - X(CAL_SABBREVMONTHNAME12) - X(CAL_SABBREVMONTHNAME13) - X(CAL_SYEARMONTH) + if (CalType & CAL_RETURN_NUMBER) { + if (lpCalData != NULL) + WARN("lpCalData not NULL (%p) when it should!\n", lpCalData); + if (cchData != 0) + WARN("cchData not 0 (%d) when it should!\n", cchData); + } else { + if (lpValue != NULL) + WARN("lpValue not NULL (%p) when it should!\n", lpValue); + } + + /* FIXME: No verification is made yet wrt Locale + * for the CALTYPES not requiring GetLocaleInfoA */ + switch (CalType & ~(CAL_NOUSEROVERRIDE|CAL_RETURN_NUMBER|CAL_USE_CP_ACP)) { + case CAL_ICALINTVALUE: + FIXME("Unimplemented caltype %ld\n", CalType & 0xffff); + return E_FAIL; + case CAL_SCALNAME: + FIXME("Known *not* good values for caltype %ld\n", CalType & 0xffff); + switch(Calendar) { +#define X(x,y) case x: do{INT l=strlen(y);if(cchData>l)if(lstrcpynA(lpCalData,y,cchData))return l;else return 0;else return l;} while(0); + X(CAL_GREGORIAN, "GREGORIAN") + X(CAL_GREGORIAN_US, "GREGORIAN US") + X(CAL_JAPAN, "JAPAN") + X(CAL_TAIWAN, "TAIWAN") + X(CAL_KOREA, "KOREA") + X(CAL_HIJRI, "HIJRI") + X(CAL_THAI, "THAI") + X(CAL_HEBREW, "HEBREW") + X(CAL_GREGORIAN_ME_FRENCH, "GREGORIAN MIDDLE EAST FRENCH") + X(CAL_GREGORIAN_ARABIC, "GREGORIAN ARABIC") + X(CAL_GREGORIAN_XLIT_ENGLISH, "GREGORIAN TRANSLIT ENGLISH") + X(CAL_GREGORIAN_XLIT_FRENCH, "GREGORIAN TRANSLIT FRENCH") #undef X + default: MESSAGE("Unknown calid %ld\n", Calendar); + return E_FAIL; + } + case CAL_IYEAROFFSETRANGE: + FIXME("Unimplemented caltype %ld\n", CalType & 0xffff); + return E_FAIL; + case CAL_SERASTRING: + FIXME("Unimplemented caltype %ld\n", CalType & 0xffff); + return E_FAIL; + case CAL_SSHORTDATE: + return GetLocaleInfoA(Locale, LOCALE_SSHORTDATE, lpCalData, cchData); + case CAL_SLONGDATE: + return GetLocaleInfoA(Locale, LOCALE_SLONGDATE, lpCalData, cchData); + case CAL_SDAYNAME1: + return GetLocaleInfoA(Locale, LOCALE_SDAYNAME1, lpCalData, cchData); + case CAL_SDAYNAME2: + return GetLocaleInfoA(Locale, LOCALE_SDAYNAME2, lpCalData, cchData); + case CAL_SDAYNAME3: + return GetLocaleInfoA(Locale, LOCALE_SDAYNAME3, lpCalData, cchData); + case CAL_SDAYNAME4: + return GetLocaleInfoA(Locale, LOCALE_SDAYNAME4, lpCalData, cchData); + case CAL_SDAYNAME5: + return GetLocaleInfoA(Locale, LOCALE_SDAYNAME5, lpCalData, cchData); + case CAL_SDAYNAME6: + return GetLocaleInfoA(Locale, LOCALE_SDAYNAME6, lpCalData, cchData); + case CAL_SDAYNAME7: + return GetLocaleInfoA(Locale, LOCALE_SDAYNAME7, lpCalData, cchData); + case CAL_SABBREVDAYNAME1: + return GetLocaleInfoA(Locale, LOCALE_SABBREVDAYNAME1, lpCalData, cchData); + case CAL_SABBREVDAYNAME2: + return GetLocaleInfoA(Locale, LOCALE_SABBREVDAYNAME2, lpCalData, cchData); + case CAL_SABBREVDAYNAME3: + return GetLocaleInfoA(Locale, LOCALE_SABBREVDAYNAME3, lpCalData, cchData); + case CAL_SABBREVDAYNAME4: + return GetLocaleInfoA(Locale, LOCALE_SABBREVDAYNAME4, lpCalData, cchData); + case CAL_SABBREVDAYNAME5: + return GetLocaleInfoA(Locale, LOCALE_SABBREVDAYNAME5, lpCalData, cchData); + case CAL_SABBREVDAYNAME6: + return GetLocaleInfoA(Locale, LOCALE_SABBREVDAYNAME6, lpCalData, cchData); + case CAL_SABBREVDAYNAME7: + return GetLocaleInfoA(Locale, LOCALE_SABBREVDAYNAME7, lpCalData, cchData); + case CAL_SMONTHNAME1: + return GetLocaleInfoA(Locale, LOCALE_SMONTHNAME1, lpCalData, cchData); + case CAL_SMONTHNAME2: + return GetLocaleInfoA(Locale, LOCALE_SMONTHNAME2, lpCalData, cchData); + case CAL_SMONTHNAME3: + return GetLocaleInfoA(Locale, LOCALE_SMONTHNAME3, lpCalData, cchData); + case CAL_SMONTHNAME4: + return GetLocaleInfoA(Locale, LOCALE_SMONTHNAME4, lpCalData, cchData); + case CAL_SMONTHNAME5: + return GetLocaleInfoA(Locale, LOCALE_SMONTHNAME5, lpCalData, cchData); + case CAL_SMONTHNAME6: + return GetLocaleInfoA(Locale, LOCALE_SMONTHNAME6, lpCalData, cchData); + case CAL_SMONTHNAME7: + return GetLocaleInfoA(Locale, LOCALE_SMONTHNAME7, lpCalData, cchData); + case CAL_SMONTHNAME8: + return GetLocaleInfoA(Locale, LOCALE_SMONTHNAME8, lpCalData, cchData); + case CAL_SMONTHNAME9: + return GetLocaleInfoA(Locale, LOCALE_SMONTHNAME9, lpCalData, cchData); + case CAL_SMONTHNAME10: + return GetLocaleInfoA(Locale, LOCALE_SMONTHNAME10, lpCalData, cchData); + case CAL_SMONTHNAME11: + return GetLocaleInfoA(Locale, LOCALE_SMONTHNAME11, lpCalData, cchData); + case CAL_SMONTHNAME12: + return GetLocaleInfoA(Locale, LOCALE_SMONTHNAME12, lpCalData, cchData); + case CAL_SMONTHNAME13: + return GetLocaleInfoA(Locale, LOCALE_SMONTHNAME13, lpCalData, cchData); + case CAL_SABBREVMONTHNAME1: + return GetLocaleInfoA(Locale, LOCALE_SABBREVMONTHNAME1, lpCalData, cchData); + case CAL_SABBREVMONTHNAME2: + return GetLocaleInfoA(Locale, LOCALE_SABBREVMONTHNAME2, lpCalData, cchData); + case CAL_SABBREVMONTHNAME3: + return GetLocaleInfoA(Locale, LOCALE_SABBREVMONTHNAME3, lpCalData, cchData); + case CAL_SABBREVMONTHNAME4: + return GetLocaleInfoA(Locale, LOCALE_SABBREVMONTHNAME4, lpCalData, cchData); + case CAL_SABBREVMONTHNAME5: + return GetLocaleInfoA(Locale, LOCALE_SABBREVMONTHNAME5, lpCalData, cchData); + case CAL_SABBREVMONTHNAME6: + return GetLocaleInfoA(Locale, LOCALE_SABBREVMONTHNAME6, lpCalData, cchData); + case CAL_SABBREVMONTHNAME7: + return GetLocaleInfoA(Locale, LOCALE_SABBREVMONTHNAME7, lpCalData, cchData); + case CAL_SABBREVMONTHNAME8: + return GetLocaleInfoA(Locale, LOCALE_SABBREVMONTHNAME8, lpCalData, cchData); + case CAL_SABBREVMONTHNAME9: + return GetLocaleInfoA(Locale, LOCALE_SABBREVMONTHNAME9, lpCalData, cchData); + case CAL_SABBREVMONTHNAME10: + return GetLocaleInfoA(Locale, LOCALE_SABBREVMONTHNAME10, lpCalData, cchData); + case CAL_SABBREVMONTHNAME11: + return GetLocaleInfoA(Locale, LOCALE_SABBREVMONTHNAME11, lpCalData, cchData); + case CAL_SABBREVMONTHNAME12: + return GetLocaleInfoA(Locale, LOCALE_SABBREVMONTHNAME12, lpCalData, cchData); + case CAL_SABBREVMONTHNAME13: + return GetLocaleInfoA(Locale, LOCALE_SABBREVMONTHNAME13, lpCalData, cchData); + case CAL_SYEARMONTH: + return GetLocaleInfoA(Locale, LOCALE_SYEARMONTH, lpCalData, cchData); + case CAL_ITWODIGITYEARMAX: + FIXME("Unimplemented caltype %ld\n", CalType & 0xffff); + return E_FAIL; default: MESSAGE("Unknown caltype %ld\n",CalType & 0xffff); return E_FAIL; } diff -urN wine/include/winnls.h-orig wine/include/winnls.h --- wine/include/winnls.h-orig Sat Mar 9 19:02:34 2002 +++ wine/include/winnls.h Sat May 11 15:26:59 2002 @@ -37,11 +37,12 @@ /* flags to GetLocaleInfo */ #define LOCALE_NOUSEROVERRIDE 0x80000000 #define LOCALE_USE_CP_ACP 0x40000000 +#define LOCALE_RETURN_NUMBER 0x20000000 #define LOCALE_LOCALEINFOFLAGSMASK 0xC0000000 /* When adding new defines, don't forget to add an entry to the - * locale2id map in misc/ole2nls.c + * locale_name2id map in ole/ole2nls.c */ #define LOCALE_ILANGUAGE 0x00000001 #define LOCALE_SLANGUAGE 0x00000002 @@ -265,6 +266,9 @@ #define MAX_DEFAULTCHAR 2 /* Defines for calendar handling */ +#define CAL_NOUSEROVERRIDE LOCALE_NOUSEROVERRIDE +#define CAL_USE_CP_ACP LOCALE_USE_CP_ACP +#define CAL_RETURN_NUMBER LOCALE_RETURN_NUMBER #define CAL_ICALINTVALUE 0x00000001 #define CAL_SCALNAME 0x00000002 #define CAL_IYEAROFFSETRANGE 0x00000003 @@ -312,6 +316,7 @@ #define CAL_SABBREVMONTHNAME12 0x0000002d #define CAL_SABBREVMONTHNAME13 0x0000002e #define CAL_SYEARMONTH 0x0000002f +#define CAL_ITWODIGITYEARMAX 0x00000030 #define CAL_GREGORIAN 1 #define CAL_GREGORIAN_US 2 #define CAL_JAPAN 3 @@ -490,6 +495,9 @@ BOOL WINAPI GetCPInfoExA(UINT,DWORD,LPCPINFOEXA); BOOL WINAPI GetCPInfoExW(UINT,DWORD,LPCPINFOEXW); #define GetCPInfoEx WINELIB_NAME_AW(GetCPInfoEx) +int WINAPI GetCalendarInfoA(LCID,DWORD,DWORD,LPSTR,INT,LPDWORD); +int WINAPI GetCalendarInfoW(LCID,DWORD,DWORD,LPWSTR,INT,LPDWORD); +#define GetCalendarInfo WINELIB_NAME_AW(GetCalendarInfo) INT WINAPI GetCurrencyFormatA(LCID,DWORD,LPCSTR,const CURRENCYFMTA*,LPSTR,int); INT WINAPI GetCurrencyFormatW(LCID,DWORD,LPCWSTR,const CURRENCYFMTW*,LPWSTR,int); #define GetCurrencyFormat WINELIB_NAME_AW(GetCurrencyFormat)