Commit ab6970d9 authored by Alexandre Julliard's avatar Alexandre Julliard

kernel32: Move Get/SetCalendarInfo to kernelbase.

parent 42ed9797
......@@ -556,8 +556,8 @@
# @ stub GetCalendarDaysInMonth
# @ stub GetCalendarDifferenceInDays
@ stdcall GetCalendarInfoA(long long long ptr long ptr)
@ stdcall GetCalendarInfoW(long long long ptr long ptr)
@ stdcall GetCalendarInfoEx(wstr long ptr long ptr long ptr)
@ stdcall -import GetCalendarInfoW(long long long ptr long ptr)
@ stdcall -import GetCalendarInfoEx(wstr long ptr long ptr long ptr)
# @ stub GetCalendarMonthsInYear
# @ stub GetCalendarSupportedDateRange
# @ stub GetCalendarWeekNumber
......@@ -1328,7 +1328,7 @@
@ stdcall -import SearchPathW(wstr wstr wstr long ptr ptr)
@ stdcall SetCPGlobal(long)
@ stdcall SetCalendarInfoA(long long long str)
@ stdcall SetCalendarInfoW(long long long wstr)
@ stdcall -import SetCalendarInfoW(long long long wstr)
# @ stub SetClientTimeZoneInformation
# @ stub SetComPlusPackageInstallStatus
@ stdcall -import SetCommBreak(long)
......
......@@ -54,8 +54,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(time);
#define CALINFO_MAX_YEAR 2029
static inline void longlong_to_filetime( LONGLONG t, FILETIME *ft )
{
ft->dwLowDateTime = (DWORD)t;
......@@ -832,219 +830,6 @@ int WINAPI GetCalendarInfoA(LCID lcid, CALID Calendar, CALTYPE CalType,
}
/*********************************************************************
* GetCalendarInfoW (KERNEL32.@)
*
*/
int WINAPI GetCalendarInfoW(LCID Locale, CALID Calendar, CALTYPE CalType,
LPWSTR lpCalData, int cchData, LPDWORD lpValue)
{
static const LCTYPE caltype_lctype_map[] = {
0, /* not used */
0, /* CAL_ICALINTVALUE */
0, /* CAL_SCALNAME */
0, /* CAL_IYEAROFFSETRANGE */
0, /* CAL_SERASTRING */
LOCALE_SSHORTDATE,
LOCALE_SLONGDATE,
LOCALE_SDAYNAME1,
LOCALE_SDAYNAME2,
LOCALE_SDAYNAME3,
LOCALE_SDAYNAME4,
LOCALE_SDAYNAME5,
LOCALE_SDAYNAME6,
LOCALE_SDAYNAME7,
LOCALE_SABBREVDAYNAME1,
LOCALE_SABBREVDAYNAME2,
LOCALE_SABBREVDAYNAME3,
LOCALE_SABBREVDAYNAME4,
LOCALE_SABBREVDAYNAME5,
LOCALE_SABBREVDAYNAME6,
LOCALE_SABBREVDAYNAME7,
LOCALE_SMONTHNAME1,
LOCALE_SMONTHNAME2,
LOCALE_SMONTHNAME3,
LOCALE_SMONTHNAME4,
LOCALE_SMONTHNAME5,
LOCALE_SMONTHNAME6,
LOCALE_SMONTHNAME7,
LOCALE_SMONTHNAME8,
LOCALE_SMONTHNAME9,
LOCALE_SMONTHNAME10,
LOCALE_SMONTHNAME11,
LOCALE_SMONTHNAME12,
LOCALE_SMONTHNAME13,
LOCALE_SABBREVMONTHNAME1,
LOCALE_SABBREVMONTHNAME2,
LOCALE_SABBREVMONTHNAME3,
LOCALE_SABBREVMONTHNAME4,
LOCALE_SABBREVMONTHNAME5,
LOCALE_SABBREVMONTHNAME6,
LOCALE_SABBREVMONTHNAME7,
LOCALE_SABBREVMONTHNAME8,
LOCALE_SABBREVMONTHNAME9,
LOCALE_SABBREVMONTHNAME10,
LOCALE_SABBREVMONTHNAME11,
LOCALE_SABBREVMONTHNAME12,
LOCALE_SABBREVMONTHNAME13,
LOCALE_SYEARMONTH,
0, /* CAL_ITWODIGITYEARMAX */
LOCALE_SSHORTESTDAYNAME1,
LOCALE_SSHORTESTDAYNAME2,
LOCALE_SSHORTESTDAYNAME3,
LOCALE_SSHORTESTDAYNAME4,
LOCALE_SSHORTESTDAYNAME5,
LOCALE_SSHORTESTDAYNAME6,
LOCALE_SSHORTESTDAYNAME7,
LOCALE_SMONTHDAY,
0, /* CAL_SABBREVERASTRING */
};
DWORD localeflags = 0;
CALTYPE calinfo;
if (CalType & CAL_NOUSEROVERRIDE)
FIXME("flag CAL_NOUSEROVERRIDE used, not fully implemented\n");
if (CalType & CAL_USE_CP_ACP)
FIXME("flag CAL_USE_CP_ACP used, not fully implemented\n");
if (CalType & CAL_RETURN_NUMBER) {
if (!lpValue)
{
SetLastError( ERROR_INVALID_PARAMETER );
return 0;
}
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 */
calinfo = CalType & 0xffff;
if (CalType & CAL_RETURN_GENITIVE_NAMES)
localeflags |= LOCALE_RETURN_GENITIVE_NAMES;
switch (calinfo) {
case CAL_ICALINTVALUE:
if (CalType & CAL_RETURN_NUMBER)
return GetLocaleInfoW(Locale, LOCALE_RETURN_NUMBER | LOCALE_ICALENDARTYPE,
(LPWSTR)lpValue, 2);
return GetLocaleInfoW(Locale, LOCALE_ICALENDARTYPE, lpCalData, cchData);
case CAL_SCALNAME:
FIXME("Unimplemented caltype %d\n", calinfo);
if (lpCalData) *lpCalData = 0;
return 1;
case CAL_IYEAROFFSETRANGE:
FIXME("Unimplemented caltype %d\n", calinfo);
return 0;
case CAL_SERASTRING:
FIXME("Unimplemented caltype %d\n", calinfo);
return 0;
case CAL_SSHORTDATE:
case CAL_SLONGDATE:
case CAL_SDAYNAME1:
case CAL_SDAYNAME2:
case CAL_SDAYNAME3:
case CAL_SDAYNAME4:
case CAL_SDAYNAME5:
case CAL_SDAYNAME6:
case CAL_SDAYNAME7:
case CAL_SABBREVDAYNAME1:
case CAL_SABBREVDAYNAME2:
case CAL_SABBREVDAYNAME3:
case CAL_SABBREVDAYNAME4:
case CAL_SABBREVDAYNAME5:
case CAL_SABBREVDAYNAME6:
case CAL_SABBREVDAYNAME7:
case CAL_SMONTHNAME1:
case CAL_SMONTHNAME2:
case CAL_SMONTHNAME3:
case CAL_SMONTHNAME4:
case CAL_SMONTHNAME5:
case CAL_SMONTHNAME6:
case CAL_SMONTHNAME7:
case CAL_SMONTHNAME8:
case CAL_SMONTHNAME9:
case CAL_SMONTHNAME10:
case CAL_SMONTHNAME11:
case CAL_SMONTHNAME12:
case CAL_SMONTHNAME13:
case CAL_SABBREVMONTHNAME1:
case CAL_SABBREVMONTHNAME2:
case CAL_SABBREVMONTHNAME3:
case CAL_SABBREVMONTHNAME4:
case CAL_SABBREVMONTHNAME5:
case CAL_SABBREVMONTHNAME6:
case CAL_SABBREVMONTHNAME7:
case CAL_SABBREVMONTHNAME8:
case CAL_SABBREVMONTHNAME9:
case CAL_SABBREVMONTHNAME10:
case CAL_SABBREVMONTHNAME11:
case CAL_SABBREVMONTHNAME12:
case CAL_SABBREVMONTHNAME13:
case CAL_SMONTHDAY:
case CAL_SYEARMONTH:
case CAL_SSHORTESTDAYNAME1:
case CAL_SSHORTESTDAYNAME2:
case CAL_SSHORTESTDAYNAME3:
case CAL_SSHORTESTDAYNAME4:
case CAL_SSHORTESTDAYNAME5:
case CAL_SSHORTESTDAYNAME6:
case CAL_SSHORTESTDAYNAME7:
return GetLocaleInfoW(Locale, caltype_lctype_map[calinfo] | localeflags, lpCalData, cchData);
case CAL_ITWODIGITYEARMAX:
if (CalType & CAL_RETURN_NUMBER)
{
*lpValue = CALINFO_MAX_YEAR;
return sizeof(DWORD) / sizeof(WCHAR);
}
else
{
static const WCHAR fmtW[] = {'%','u',0};
WCHAR buffer[10];
int ret = snprintfW( buffer, 10, fmtW, CALINFO_MAX_YEAR ) + 1;
if (!lpCalData) return ret;
if (ret <= cchData)
{
strcpyW( lpCalData, buffer );
return ret;
}
SetLastError( ERROR_INSUFFICIENT_BUFFER );
return 0;
}
break;
case CAL_SABBREVERASTRING:
FIXME("Unimplemented caltype %d\n", calinfo);
return 0;
default:
FIXME("Unknown caltype %d\n", calinfo);
SetLastError(ERROR_INVALID_FLAGS);
return 0;
}
return 0;
}
/*********************************************************************
* GetCalendarInfoEx (KERNEL32.@)
*/
int WINAPI GetCalendarInfoEx(LPCWSTR locale, CALID calendar, LPCWSTR lpReserved, CALTYPE caltype,
LPWSTR data, int len, DWORD *value)
{
static int once;
LCID lcid = LocaleNameToLCID(locale, 0);
if (!once++)
FIXME("(%s, %d, %p, 0x%08x, %p, %d, %p): semi-stub\n", debugstr_w(locale), calendar, lpReserved, caltype,
data, len, value);
return GetCalendarInfoW(lcid, calendar, caltype, data, len, value);
}
/*********************************************************************
* SetCalendarInfoA (KERNEL32.@)
*
*/
......@@ -1056,18 +841,6 @@ int WINAPI SetCalendarInfoA(LCID Locale, CALID Calendar, CALTYPE CalType, LPCSTR
}
/*********************************************************************
* SetCalendarInfoW (KERNEL32.@)
*
*
*/
int WINAPI SetCalendarInfoW(LCID Locale, CALID Calendar, CALTYPE CalType, LPCWSTR lpCalData)
{
FIXME("(%08x,%08x,%08x,%s): stub\n",
Locale, Calendar, CalType, debugstr_w(lpCalData));
return 0;
}
/*********************************************************************
* GetDaylightFlag (KERNEL32.@)
*
* Specifies if daylight savings time is in operation.
......
......@@ -425,8 +425,8 @@
@ stdcall GetCPInfoExW(long long ptr) kernel32.GetCPInfoExW
# @ stub GetCachedSigningLevel
@ stub GetCalendar
@ stdcall GetCalendarInfoEx(wstr long ptr long ptr long ptr) kernel32.GetCalendarInfoEx
@ stdcall GetCalendarInfoW(long long long ptr long ptr) kernel32.GetCalendarInfoW
@ stdcall GetCalendarInfoEx(wstr long ptr long ptr long ptr)
@ stdcall GetCalendarInfoW(long long long ptr long ptr)
@ stdcall GetCommConfig(long ptr ptr)
@ stdcall GetCommMask(long ptr)
@ stdcall GetCommModemStatus(long ptr)
......@@ -1389,7 +1389,7 @@
@ stdcall SearchPathW(wstr wstr wstr long ptr ptr)
@ stdcall SetAclInformation(ptr ptr long long)
# @ stub SetCachedSigningLevel
@ stdcall SetCalendarInfoW(long long long wstr) kernel32.SetCalendarInfoW
@ stdcall SetCalendarInfoW(long long long wstr)
# @ stub SetClientDynamicTimeZoneInformation
# @ stub SetClientTimeZoneInformation
@ stdcall SetCommBreak(long)
......
......@@ -39,6 +39,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(nls);
#define CALINFO_MAX_YEAR 2029
static const WCHAR codepages_key[] =
{ 'S','y','s','t','e','m','\\','C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t',
......@@ -703,6 +704,199 @@ INT WINAPI DECLSPEC_HOTPATCH LCIDToLocaleName( LCID lcid, LPWSTR name, INT count
/***********************************************************************
* GetCalendarInfoW (kernelbase.@)
*/
INT WINAPI DECLSPEC_HOTPATCH GetCalendarInfoW( LCID lcid, CALID calendar, CALTYPE type,
WCHAR *data, INT count, DWORD *value )
{
static const LCTYPE lctype_map[] =
{
0, /* not used */
0, /* CAL_ICALINTVALUE */
0, /* CAL_SCALNAME */
0, /* CAL_IYEAROFFSETRANGE */
0, /* CAL_SERASTRING */
LOCALE_SSHORTDATE,
LOCALE_SLONGDATE,
LOCALE_SDAYNAME1,
LOCALE_SDAYNAME2,
LOCALE_SDAYNAME3,
LOCALE_SDAYNAME4,
LOCALE_SDAYNAME5,
LOCALE_SDAYNAME6,
LOCALE_SDAYNAME7,
LOCALE_SABBREVDAYNAME1,
LOCALE_SABBREVDAYNAME2,
LOCALE_SABBREVDAYNAME3,
LOCALE_SABBREVDAYNAME4,
LOCALE_SABBREVDAYNAME5,
LOCALE_SABBREVDAYNAME6,
LOCALE_SABBREVDAYNAME7,
LOCALE_SMONTHNAME1,
LOCALE_SMONTHNAME2,
LOCALE_SMONTHNAME3,
LOCALE_SMONTHNAME4,
LOCALE_SMONTHNAME5,
LOCALE_SMONTHNAME6,
LOCALE_SMONTHNAME7,
LOCALE_SMONTHNAME8,
LOCALE_SMONTHNAME9,
LOCALE_SMONTHNAME10,
LOCALE_SMONTHNAME11,
LOCALE_SMONTHNAME12,
LOCALE_SMONTHNAME13,
LOCALE_SABBREVMONTHNAME1,
LOCALE_SABBREVMONTHNAME2,
LOCALE_SABBREVMONTHNAME3,
LOCALE_SABBREVMONTHNAME4,
LOCALE_SABBREVMONTHNAME5,
LOCALE_SABBREVMONTHNAME6,
LOCALE_SABBREVMONTHNAME7,
LOCALE_SABBREVMONTHNAME8,
LOCALE_SABBREVMONTHNAME9,
LOCALE_SABBREVMONTHNAME10,
LOCALE_SABBREVMONTHNAME11,
LOCALE_SABBREVMONTHNAME12,
LOCALE_SABBREVMONTHNAME13,
LOCALE_SYEARMONTH,
0, /* CAL_ITWODIGITYEARMAX */
LOCALE_SSHORTESTDAYNAME1,
LOCALE_SSHORTESTDAYNAME2,
LOCALE_SSHORTESTDAYNAME3,
LOCALE_SSHORTESTDAYNAME4,
LOCALE_SSHORTESTDAYNAME5,
LOCALE_SSHORTESTDAYNAME6,
LOCALE_SSHORTESTDAYNAME7,
LOCALE_SMONTHDAY,
0, /* CAL_SABBREVERASTRING */
};
DWORD flags = 0;
CALTYPE calinfo = type & 0xffff;
if (type & CAL_NOUSEROVERRIDE) FIXME("flag CAL_NOUSEROVERRIDE used, not fully implemented\n");
if (type & CAL_USE_CP_ACP) FIXME("flag CAL_USE_CP_ACP used, not fully implemented\n");
if ((type & CAL_RETURN_NUMBER) && !value)
{
SetLastError( ERROR_INVALID_PARAMETER );
return 0;
}
if (type & CAL_RETURN_GENITIVE_NAMES) flags |= LOCALE_RETURN_GENITIVE_NAMES;
switch (calinfo)
{
case CAL_ICALINTVALUE:
if (type & CAL_RETURN_NUMBER)
return GetLocaleInfoW( lcid, LOCALE_RETURN_NUMBER | LOCALE_ICALENDARTYPE,
(WCHAR *)value, sizeof(*value) / sizeof(WCHAR) );
return GetLocaleInfoW( lcid, LOCALE_ICALENDARTYPE, data, count );
case CAL_SCALNAME:
FIXME( "Unimplemented caltype %d\n", calinfo );
if (data) *data = 0;
return 1;
case CAL_IYEAROFFSETRANGE:
case CAL_SERASTRING:
case CAL_SABBREVERASTRING:
FIXME( "Unimplemented caltype %d\n", calinfo );
return 0;
case CAL_SSHORTDATE:
case CAL_SLONGDATE:
case CAL_SDAYNAME1:
case CAL_SDAYNAME2:
case CAL_SDAYNAME3:
case CAL_SDAYNAME4:
case CAL_SDAYNAME5:
case CAL_SDAYNAME6:
case CAL_SDAYNAME7:
case CAL_SABBREVDAYNAME1:
case CAL_SABBREVDAYNAME2:
case CAL_SABBREVDAYNAME3:
case CAL_SABBREVDAYNAME4:
case CAL_SABBREVDAYNAME5:
case CAL_SABBREVDAYNAME6:
case CAL_SABBREVDAYNAME7:
case CAL_SMONTHNAME1:
case CAL_SMONTHNAME2:
case CAL_SMONTHNAME3:
case CAL_SMONTHNAME4:
case CAL_SMONTHNAME5:
case CAL_SMONTHNAME6:
case CAL_SMONTHNAME7:
case CAL_SMONTHNAME8:
case CAL_SMONTHNAME9:
case CAL_SMONTHNAME10:
case CAL_SMONTHNAME11:
case CAL_SMONTHNAME12:
case CAL_SMONTHNAME13:
case CAL_SABBREVMONTHNAME1:
case CAL_SABBREVMONTHNAME2:
case CAL_SABBREVMONTHNAME3:
case CAL_SABBREVMONTHNAME4:
case CAL_SABBREVMONTHNAME5:
case CAL_SABBREVMONTHNAME6:
case CAL_SABBREVMONTHNAME7:
case CAL_SABBREVMONTHNAME8:
case CAL_SABBREVMONTHNAME9:
case CAL_SABBREVMONTHNAME10:
case CAL_SABBREVMONTHNAME11:
case CAL_SABBREVMONTHNAME12:
case CAL_SABBREVMONTHNAME13:
case CAL_SMONTHDAY:
case CAL_SYEARMONTH:
case CAL_SSHORTESTDAYNAME1:
case CAL_SSHORTESTDAYNAME2:
case CAL_SSHORTESTDAYNAME3:
case CAL_SSHORTESTDAYNAME4:
case CAL_SSHORTESTDAYNAME5:
case CAL_SSHORTESTDAYNAME6:
case CAL_SSHORTESTDAYNAME7:
return GetLocaleInfoW( lcid, lctype_map[calinfo] | flags, data, count );
case CAL_ITWODIGITYEARMAX:
if (type & CAL_RETURN_NUMBER)
{
*value = CALINFO_MAX_YEAR;
return sizeof(DWORD) / sizeof(WCHAR);
}
else
{
WCHAR buffer[10];
int ret = swprintf( buffer, ARRAY_SIZE(buffer), L"%u", CALINFO_MAX_YEAR ) + 1;
if (!data) return ret;
if (ret <= count)
{
lstrcpyW( data, buffer );
return ret;
}
SetLastError( ERROR_INSUFFICIENT_BUFFER );
return 0;
}
break;
default:
FIXME( "Unknown caltype %d\n", calinfo );
SetLastError( ERROR_INVALID_FLAGS );
return 0;
}
return 0;
}
/***********************************************************************
* GetCalendarInfoEx (kernelbase.@)
*/
INT WINAPI DECLSPEC_HOTPATCH GetCalendarInfoEx( const WCHAR *locale, CALID calendar, const WCHAR *reserved,
CALTYPE type, WCHAR *data, INT count, DWORD *value )
{
LCID lcid = LocaleNameToLCID( locale, 0 );
return GetCalendarInfoW( lcid, calendar, type, data, count, value );
}
/***********************************************************************
* GetSystemDefaultLCID (kernelbase.@)
*/
LCID WINAPI DECLSPEC_HOTPATCH GetSystemDefaultLCID(void)
......@@ -795,6 +989,16 @@ INT WINAPI DECLSPEC_HOTPATCH ResolveLocaleName( LPCWSTR name, LPWSTR buffer, INT
/***********************************************************************
* SetCalendarInfoW (kernelbase.@)
*/
INT WINAPI /* DECLSPEC_HOTPATCH */ SetCalendarInfoW( LCID lcid, CALID calendar, CALTYPE type, const WCHAR *data )
{
FIXME( "(%08x,%08x,%08x,%s): stub\n", lcid, calendar, type, debugstr_w(data) );
return 0;
}
/***********************************************************************
* VerLanguageNameA (kernelbase.@)
*/
DWORD WINAPI DECLSPEC_HOTPATCH VerLanguageNameA( DWORD lang, LPSTR buffer, DWORD size )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment