Commit d9339f83 authored by Jon Griffiths's avatar Jon Griffiths Committed by Alexandre Julliard

Fail GetCalendarInfoA for Unicode-only locales.

parent 87ae5ba8
......@@ -56,6 +56,8 @@ extern VOID SYSLEVEL_CheckNotLevel( INT level );
extern DWORD INSTR_EmulateInstruction( EXCEPTION_RECORD *rec, CONTEXT86 *context );
extern void INSTR_CallBuiltinHandler( CONTEXT86 *context, BYTE intnum );
extern BOOL NLS_IsUnicodeOnlyLcid(LCID);
extern WORD SELECTOR_AllocBlock( const void *base, DWORD size, unsigned char flags );
extern WORD SELECTOR_ReallocBlock( WORD sel, const void *base, DWORD size );
extern void SELECTOR_FreeBlock( WORD sel );
......
......@@ -95,7 +95,7 @@ static CRITICAL_SECTION NLS_FormatsCS = { &NLS_FormatsCS_debug, -1, 0, 0, 0, 0 }
*
* Get a numeric locale format value.
*/
static WINAPI DWORD NLS_GetLocaleNumber(LCID lcid, DWORD dwFlags)
static DWORD NLS_GetLocaleNumber(LCID lcid, DWORD dwFlags)
{
WCHAR szBuff[80];
DWORD dwVal = 0;
......@@ -120,7 +120,7 @@ static WINAPI DWORD NLS_GetLocaleNumber(LCID lcid, DWORD dwFlags)
*
* Get a string locale format value.
*/
static WINAPI WCHAR* NLS_GetLocaleString(LCID lcid, DWORD dwFlags)
static WCHAR* NLS_GetLocaleString(LCID lcid, DWORD dwFlags)
{
WCHAR szBuff[80], *str;
DWORD dwLen;
......@@ -145,7 +145,7 @@ static WINAPI WCHAR* NLS_GetLocaleString(LCID lcid, DWORD dwFlags)
*
* Calculate (and cache) the number formats for a locale.
*/
static WINAPI const NLS_FORMAT_NODE *NLS_GetFormats(LCID lcid, DWORD dwFlags)
static const NLS_FORMAT_NODE *NLS_GetFormats(LCID lcid, DWORD dwFlags)
{
/* GetLocaleInfo() identifiers for cached formatting strings */
static const USHORT NLS_LocaleIndices[] = {
......@@ -295,7 +295,7 @@ static WINAPI const NLS_FORMAT_NODE *NLS_GetFormats(LCID lcid, DWORD dwFlags)
*
* Determine if a locale is Unicode only, and thus invalid in ASCII calls.
*/
BOOL WINAPI NLS_IsUnicodeOnlyLcid(LCID lcid)
BOOL NLS_IsUnicodeOnlyLcid(LCID lcid)
{
switch (PRIMARYLANGID(lcid))
{
......@@ -666,9 +666,9 @@ NLS_GetDateTimeFormatW_Overrun:
*
* ASCII wrapper for GetDateFormatA/GetTimeFormatA.
*/
static INT WINAPI NLS_GetDateTimeFormatA(LCID lcid, DWORD dwFlags,
const SYSTEMTIME* lpTime,
LPCSTR lpFormat, LPSTR lpStr, INT cchOut)
static INT NLS_GetDateTimeFormatA(LCID lcid, DWORD dwFlags,
const SYSTEMTIME* lpTime,
LPCSTR lpFormat, LPSTR lpStr, INT cchOut)
{
DWORD cp = CP_ACP;
WCHAR szFormat[128], szOut[128];
......
......@@ -39,6 +39,7 @@
#include "winternl.h"
#include "winerror.h"
#include "winnls.h"
#include "kernel_private.h"
#include "wine/unicode.h"
#include "wine/debug.h"
......@@ -530,20 +531,28 @@ BOOL WINAPI GetProcessTimes(
* GetCalendarInfoA (KERNEL32.@)
*
*/
int WINAPI GetCalendarInfoA(LCID Locale, CALID Calendar, CALTYPE CalType,
int WINAPI GetCalendarInfoA(LCID lcid, CALID Calendar, CALTYPE CalType,
LPSTR lpCalData, int cchData, LPDWORD lpValue)
{
int ret;
LPWSTR lpCalDataW = NULL;
FIXME("(%08lx,%08lx,%08lx,%p,%d,%p): quarter-stub\n",
Locale, Calendar, CalType, lpCalData, cchData, lpValue);
/* FIXME: Should verify if Locale is allowable in ANSI, as per MSDN */
lcid, Calendar, CalType, lpCalData, cchData, lpValue);
lcid = ConvertDefaultLocale(lcid);
if (NLS_IsUnicodeOnlyLcid(lcid))
{
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
if(cchData)
if(!(lpCalDataW = HeapAlloc(GetProcessHeap(), 0, cchData*sizeof(WCHAR)))) return 0;
if (cchData &&
!(lpCalDataW = HeapAlloc(GetProcessHeap(), 0, cchData*sizeof(WCHAR))))
return 0;
ret = GetCalendarInfoW(Locale, Calendar, CalType, lpCalDataW, cchData, lpValue);
ret = GetCalendarInfoW(lcid, Calendar, CalType, lpCalDataW, cchData, lpValue);
if(ret && lpCalDataW && lpCalData)
WideCharToMultiByte(CP_ACP, 0, lpCalDataW, cchData, lpCalData, cchData, NULL, NULL);
if(lpCalDataW)
......
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