Fix 3 bugs in locale handling
Dmitry Timoshkov
dmitry at baikal.ru
Tue Jun 15 00:11:18 CDT 2004
"Alexandre Julliard" <julliard at winehq.org> wrote:
> > lcid is always pointing to current user locale returned by GetUserDefaultLCID()
> > and therefore cached (old) values get returned.
> >
> > I modified code to get data directly from kernel resources in that case.
>
> It seems to me that this is what we are doing already since we pass
> LOCALE_NOUSEROVERRIDE in that case, I don't see how your patch would
> make any difference (and win.ini definitely gets refreshed with the
> current code). Could you please give more details on the problem you
> are seeing?
You are right, it seems that it was a side effect caused by incorrect
parsing of the date format string.
Here is a patch which works for me as well.
Changelog:
Dmitry Timoshkov <dmitry at codeweavers.com>
- Fix erroneous use of LOCALE_SDATE in the place of LOCALE_SSHORTDATE.
- Fix incorrect assumptions about format strings when parsing date
formats and setting LOCALE_IDATE and LOCALE_ILDATE values.
--
Dmitry.
-------------- next part --------------
--- cvs/hq/wine/dlls/kernel/locale.c 2004-04-20 18:51:26.000000000 +0900
+++ wine/dlls/kernel/locale.c 2004-06-15 13:37:13.000000000 +0900
@@ -250,7 +250,6 @@ void LOCALE_InitRegistry(void)
LOCALE_STIME, LOCALE_ITIME,
LOCALE_ITLZERO,
LOCALE_SSHORTDATE,
- LOCALE_IDATE,
LOCALE_SLONGDATE,
LOCALE_SDATE,
LOCALE_SCURRENCY, LOCALE_ICURRENCY,
@@ -829,6 +828,8 @@ INT WINAPI GetLocaleInfoA( LCID lcid, LC
WCHAR *bufferW;
INT lenW, ret;
+ TRACE( "(lcid=0x%lx,lctype=0x%lx,%p,%d)\n", lcid, lctype, buffer, len );
+
if (len < 0 || (len && !buffer))
{
SetLastError( ERROR_INVALID_PARAMETER );
@@ -899,6 +900,8 @@ INT WINAPI GetLocaleInfoW( LCID lcid, LC
lcflags = lctype & LOCALE_LOCALEINFOFLAGSMASK;
lctype &= 0xffff;
+ TRACE( "(lcid=0x%lx,lctype=0x%lx,%p,%d)\n", lcid, lctype, buffer, len );
+
/* first check for overrides in the registry */
if (!(lcflags & LOCALE_NOUSEROVERRIDE) && lcid == GetUserDefaultLCID())
@@ -1089,7 +1092,7 @@ BOOL WINAPI SetLocaleInfoW( LCID lcid, L
lcid, GetUserDefaultLCID());
}
- TRACE("setting %lx to %s\n", lctype, debugstr_w(data) );
+ TRACE("setting %lx (%s) to %s\n", lctype, debugstr_w(value), debugstr_w(data) );
/* FIXME: should check that data to set is sane */
@@ -1100,15 +1103,15 @@ BOOL WINAPI SetLocaleInfoW( LCID lcid, L
RtlInitUnicodeString( &valueW, value );
status = NtSetValueKey( hkey, &valueW, 0, REG_SZ, data, (strlenW(data)+1)*sizeof(WCHAR) );
- if (lctype == LOCALE_SDATE || lctype == LOCALE_SLONGDATE)
+ if (lctype == LOCALE_SSHORTDATE || lctype == LOCALE_SLONGDATE)
{
/* Set I-value from S value */
WCHAR *lpD, *lpM, *lpY;
WCHAR szBuff[2];
- lpD = strchrW(data, 'd');
- lpM = strchrW(data, 'M');
- lpY = strchrW(data, 'y');
+ lpD = strrchrW(data, 'd');
+ lpM = strrchrW(data, 'M');
+ lpY = strrchrW(data, 'y');
if (lpD <= lpM)
{
@@ -1124,7 +1127,7 @@ BOOL WINAPI SetLocaleInfoW( LCID lcid, L
szBuff[1] = '\0';
- if (lctype == LOCALE_SDATE)
+ if (lctype == LOCALE_SSHORTDATE)
lctype = LOCALE_IDATE;
else
lctype = LOCALE_ILDATE;
More information about the wine-patches
mailing list