Commit c267e3ae authored by Juergen Schmied's avatar Juergen Schmied Committed by Alexandre Julliard

GetLocaleInfo32A can handle len=0 now, sets LastError and touches

buffer only when necessary. Updated deu.nls and some LCTYPES in winnls.h.
parent 76e07b9f
......@@ -24,6 +24,7 @@
#define LOCALE_IDEFAULTCOUNTRY 0x0000000A
#define LOCALE_IDEFAULTCODEPAGE 0x0000000B
#define LOCALE_IDEFAULTANSICODEPAGE 0x00001004
#define LOCALE_IDEFAULTMACCODEPAGE 0x00001011
#define LOCALE_SLIST 0x0000000C
#define LOCALE_IMEASURE 0x0000000D
#define LOCALE_SDECIMAL 0x0000000E
......@@ -110,6 +111,8 @@
#define LOCALE_INEGSYMPRECEDES 0x00000056
#define LOCALE_INEGSEPBYSPACE 0x00000057
#define LOCALE_FONTSIGNATURE 0x00000058
#define LOCALE_SISO639LANGNAME 0x00000059
#define LOCALE_SISO3166CTRYNAME 0x0000005A
#define NORM_IGNORECASE 1
......
......@@ -4,9 +4,9 @@
*/
LOCVAL(LOCALE_ILANGUAGE,"0407")
LOCVAL(LOCALE_SLANGUAGE,"Deutsch")
LOCVAL(LOCALE_SLANGUAGE,"Deutsch (Deutschland)")
LOCVAL(LOCALE_SENGLANGUAGE,"German")
LOCVAL(LOCALE_SABBREVLANGNAME,"deu")
LOCVAL(LOCALE_SABBREVLANGNAME,"DEU")
LOCVAL(LOCALE_SNATIVELANGNAME,"Deutsch")
LOCVAL(LOCALE_ICOUNTRY,"49")
LOCVAL(LOCALE_SCOUNTRY,"Deutschland")
......@@ -15,16 +15,17 @@ LOCVAL(LOCALE_SABBREVCTRYNAME,"DEU")
LOCVAL(LOCALE_SNATIVECTRYNAME,"Deutschland")
LOCVAL(LOCALE_IDEFAULTLANGUAGE,"0407")
LOCVAL(LOCALE_IDEFAULTCOUNTRY,"49")
LOCVAL(LOCALE_IDEFAULTCODEPAGE,"851")
LOCVAL(LOCALE_IDEFAULTCODEPAGE,"850")
LOCVAL(LOCALE_IDEFAULTANSICODEPAGE,"1252")
LOCVAL(LOCALE_SLIST,";")
LOCVAL(LOCALE_IMEASURE,"0")
LOCVAL(LOCALE_SDECIMAL,",")
LOCVAL(LOCALE_STHOUSAND,".")
/* LOCVAL(LOCALE_SGROUPING) */
LOCVAL(LOCALE_SGROUPING,"3;0")
LOCVAL(LOCALE_IDIGITS,"2")
LOCVAL(LOCALE_IDEFAULTMACCODEPAGE,"10000")
LOCVAL(LOCALE_ILZERO,"1")
/* LOCVAL(LOCALE_INEGNUMBER) */
LOCVAL(LOCALE_INEGNUMBER,"1")
LOCVAL(LOCALE_SNATIVEDIGITS, "0123456789")
LOCVAL(LOCALE_SCURRENCY,"DM")
LOCVAL(LOCALE_SINTLSYMBOL, "DEM")
......@@ -32,35 +33,35 @@ LOCVAL(LOCALE_SMONDECIMALSEP, ",")
LOCVAL(LOCALE_SMONTHOUSANDSEP, ".")
LOCVAL(LOCALE_SMONGROUPING, "3;0")
LOCVAL(LOCALE_ICURRDIGITS,"2")
/* LOCVAL(LOCALE_IINTLCURRDIGITS) */
LOCVAL(LOCALE_IINTLCURRDIGITS,"2")
LOCVAL(LOCALE_ICURRENCY,"3")
LOCVAL(LOCALE_INEGCURR,"8")
LOCVAL(LOCALE_SDATE,".")
LOCVAL(LOCALE_STIME,":")
LOCVAL(LOCALE_SSHORTDATE,"dd.MM.yyyy")
LOCVAL(LOCALE_SLONGDATE,"ddd, d. MMMM yyyy")
/* LOCVAL(LOCALE_STIMEFORMAT) */
LOCVAL(LOCALE_SSHORTDATE,"dd.MM.yy")
LOCVAL(LOCALE_SLONGDATE,"dddd, d. MMMM yyyy")
LOCVAL(LOCALE_STIMEFORMAT,"HH:mm:ss")
LOCVAL(LOCALE_IDATE,"1")
/* LOCVAL(LOCALE_ILDATE) */
LOCVAL(LOCALE_ILDATE,"1")
LOCVAL(LOCALE_ITIME,"1")
/* LOCVAL(LOCALE_ITIMEMARKPOSN) */
/* LOCVAL(LOCALE_ICENTURY) */
LOCVAL(LOCALE_ITIMEMARKPOSN,"0")
LOCVAL(LOCALE_ICENTURY,"0")
LOCVAL(LOCALE_ITLZERO,"1")
/* LOCVAL(LOCALE_IDAYLZERO) */
/* LOCVAL(LOCALE_IMONLZERO) */
LOCVAL(LOCALE_IDAYLZERO,"1")
LOCVAL(LOCALE_IMONLZERO,"1")
LOCVAL(LOCALE_S1159,"")
LOCVAL(LOCALE_S2359,"")
LOCVAL(LOCALE_ICALENDARTYPE, "1")
/* LOCVAL(LOCALE_IOPTIONALCALENDAR) */
/* LOCVAL(LOCALE_IFIRSTDAYOFWEEK) */
/* LOCVAL(LOCALE_IFIRSTWEEKOFYEAR) */
LOCVAL(LOCALE_IOPTIONALCALENDAR,"0")
LOCVAL(LOCALE_IFIRSTDAYOFWEEK,"0")
LOCVAL(LOCALE_IFIRSTWEEKOFYEAR,"2")
LOCVAL(LOCALE_SDAYNAME1,"Montag")
LOCVAL(LOCALE_SDAYNAME2,"Dienstag")
LOCVAL(LOCALE_SDAYNAME3,"Mittwoch")
LOCVAL(LOCALE_SDAYNAME4,"Donnerstag")
LOCVAL(LOCALE_SDAYNAME5,"Freitag")
LOCVAL(LOCALE_SDAYNAME6,"Sonnabend")
LOCVAL(LOCALE_SDAYNAME6,"Samstag")
LOCVAL(LOCALE_SDAYNAME7,"Sonntag")
LOCVAL(LOCALE_SABBREVDAYNAME1,"Mo")
......@@ -87,7 +88,7 @@ LOCVAL(LOCALE_SMONTHNAME13,"")
LOCVAL(LOCALE_SABBREVMONTHNAME1,"Jan")
LOCVAL(LOCALE_SABBREVMONTHNAME2,"Feb")
LOCVAL(LOCALE_SABBREVMONTHNAME3,"Mr")
LOCVAL(LOCALE_SABBREVMONTHNAME3,"Mrz")
LOCVAL(LOCALE_SABBREVMONTHNAME4,"Apr")
LOCVAL(LOCALE_SABBREVMONTHNAME5,"Mai")
LOCVAL(LOCALE_SABBREVMONTHNAME6,"Jun")
......@@ -101,11 +102,12 @@ LOCVAL(LOCALE_SABBREVMONTHNAME13,"")
LOCVAL(LOCALE_SPOSITIVESIGN, "")
LOCVAL(LOCALE_SNEGATIVESIGN, "-")
/* LOCVAL(LOCALE_IPOSSIGNPOSN) */
/* LOCVAL(LOCALE_INEGSIGNPOSN) */
/* LOCVAL(LOCALE_IPOSSYMPRECEDES) */
/* LOCVAL(LOCALE_IPOSSEPBYSPACE) */
/* LOCVAL(LOCALE_INEGSYMPRECEDES) */
/* LOCVAL(LOCALE_INEGSEPBYSPACE) */
/* Gregorianischer Kalender */
LOCVAL(LOCALE_IPOSSIGNPOSN,"1")
LOCVAL(LOCALE_INEGSIGNPOSN,"1")
LOCVAL(LOCALE_IPOSSYMPRECEDES,"0")
LOCVAL(LOCALE_IPOSSEPBYSPACE,"1")
LOCVAL(LOCALE_INEGSYMPRECEDES,"0")
LOCVAL(LOCALE_INEGSEPBYSPACE,"1")
LOCVAL(LOCALE_FONTSIGNATURE,"/")
LOCVAL(LOCALE_SISO639LANGNAME,"de")
LOCVAL(LOCALE_SISO3166CTRYNAME,"DE")
......@@ -42,6 +42,7 @@ static struct tagLOCALE_NAME2ID {
LOCALE_ENTRY(IDEFAULTCOUNTRY),
LOCALE_ENTRY(IDEFAULTCODEPAGE),
LOCALE_ENTRY(IDEFAULTANSICODEPAGE),
LOCALE_ENTRY(IDEFAULTMACCODEPAGE),
LOCALE_ENTRY(SLIST),
LOCALE_ENTRY(IMEASURE),
LOCALE_ENTRY(SDECIMAL),
......@@ -127,7 +128,9 @@ static struct tagLOCALE_NAME2ID {
LOCALE_ENTRY(IPOSSEPBYSPACE),
LOCALE_ENTRY(INEGSYMPRECEDES),
LOCALE_ENTRY(INEGSEPBYSPACE),
/* LOCALE_ENTRY(FONTSIGNATURE),*/
LOCALE_ENTRY(FONTSIGNATURE),
LOCALE_ENTRY(SISO639LANGNAME),
LOCALE_ENTRY(SISO3166CTRYNAME),
{NULL,0},
};
......@@ -419,6 +422,11 @@ INT32 WINAPI GetLocaleInfo32A(LCID lcid,LCTYPE LCType,LPSTR buf,INT32 len)
TRACE(ole,"(lcid=0x%lx,lctype=0x%lx,%p,%x)\n",
lcid,LCType,buf,len);
if (len && (! buf) )
{ SetLastError(ERROR_INSUFFICIENT_BUFFER);
return 0;
}
if (lcid == LOCALE_SYSTEM_DEFAULT || (LCType & LOCALE_NOUSEROVERRIDE) )
{ lcid = GetSystemDefaultLCID();
}
......@@ -517,39 +525,53 @@ LANG_END
/*Insert other languages here*/
default:
found=0;
break;
} /* switch */
found=0;
break;
} /* switch */
/* language not found, try without a sublanguage*/
if (i==1) lang=MAKELANGID( PRIMARYLANGID(lang), SUBLANG_DEFAULT);
/* mask the LC Value */
if (i==2) LCType &= 0xfff;
/* language not found, try without a sublanguage*/
lang=MAKELANGID( PRIMARYLANGID(lang), SUBLANG_DEFAULT);
i++;
} while (!found && i<2);
i++;
} while (!found && i<3);
if(!found) {
ERR(ole,"'%s' not supported for your language.\n",
retString);
retString = "<WINE-NLS-unknown>";
if(!found)
{ ERR(ole,"'%s' not supported for your language.\n", retString);
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
if (buf)
/* if len=0 return only the length, don't touch the buffer*/
if (len)
lstrcpyn32A(buf,retString,len);
return strlen(retString)+1;
}
/******************************************************************************
* GetLocaleInfo32W [KERNEL32.343]
*
* Is the last parameter really WORD for Win16?
*/
INT32 WINAPI GetLocaleInfo32W(LCID lcid,LCTYPE LCType,LPWSTR wbuf,INT32 len)
{
LPSTR abuf = (LPSTR)HeapAlloc(GetProcessHeap(),0,len);
{ WORD wlen;
LPSTR abuf;
if (len && (! wbuf) )
{ SetLastError(ERROR_INSUFFICIENT_BUFFER);
return 0;
}
abuf = (LPSTR)HeapAlloc(GetProcessHeap(),0,len);
wlen = 2 * GetLocaleInfo32A(lcid, LCType, abuf, len);
if (wlen && len) /* if len=0 return only the length*/
lstrcpynAtoW(wbuf,abuf,len/2);
INT32 n = GetLocaleInfo32A(lcid, LCType, abuf, len);
if (wbuf)
lstrcpynAtoW(wbuf,abuf,len);
HeapFree(GetProcessHeap(),0,abuf);
return n;
return wlen;
}
/******************************************************************************
......
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