mirror of
https://github.com/reactos/reactos.git
synced 2025-07-14 00:54:14 +00:00
[KERNEL32] Era first year is GANNEN
This commit is contained in:
parent
df2a8c40be
commit
7e3826786e
3 changed files with 48 additions and 1 deletions
|
@ -53,6 +53,44 @@ static INT JapaneseEra_Compare(const void *e1, const void *e2)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL JapaneseEra_IsFirstYearGannen(void)
|
||||||
|
{
|
||||||
|
#ifdef DONT_USE_REGISTRY
|
||||||
|
return TRUE;
|
||||||
|
#else
|
||||||
|
HANDLE KeyHandle;
|
||||||
|
DWORD dwIndex;
|
||||||
|
WCHAR szName[32], szValue[32];
|
||||||
|
static BOOL s_bIsCached = FALSE, s_bFirstIsGannen = TRUE;
|
||||||
|
|
||||||
|
if (s_bIsCached)
|
||||||
|
return s_bFirstIsGannen;
|
||||||
|
|
||||||
|
KeyHandle = NLS_RegOpenKey(NULL, L"\\Registry\\Machine\\System\\"
|
||||||
|
L"CurrentControlSet\\Control\\Nls\\Calendars\\Japanese");
|
||||||
|
if (!KeyHandle)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
for (dwIndex = 0; dwIndex < 16; ++dwIndex)
|
||||||
|
{
|
||||||
|
if (!NLS_RegEnumValue(KeyHandle, dwIndex, szName, sizeof(szName),
|
||||||
|
szValue, sizeof(szValue)))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lstrcmpiW(szName, L"InitialEraYear") == 0)
|
||||||
|
{
|
||||||
|
s_bFirstIsGannen = (szValue[0] == 0x5143);
|
||||||
|
s_bIsCached = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return s_bFirstIsGannen;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SEE ALSO:
|
* SEE ALSO:
|
||||||
* https://en.wikipedia.org/wiki/Japanese_era_name
|
* https://en.wikipedia.org/wiki/Japanese_era_name
|
||||||
|
@ -61,7 +99,7 @@ static INT JapaneseEra_Compare(const void *e1, const void *e2)
|
||||||
static PCJAPANESE_ERA JapaneseEra_Load(DWORD *pdwCount)
|
static PCJAPANESE_ERA JapaneseEra_Load(DWORD *pdwCount)
|
||||||
{
|
{
|
||||||
#ifndef DONT_USE_REGISTRY
|
#ifndef DONT_USE_REGISTRY
|
||||||
HANDLE KeyHandle = NULL;
|
HANDLE KeyHandle;
|
||||||
DWORD dwIndex;
|
DWORD dwIndex;
|
||||||
WCHAR szName[128], szValue[128];
|
WCHAR szName[128], szValue[128];
|
||||||
JAPANESE_ERA *pEntry;
|
JAPANESE_ERA *pEntry;
|
||||||
|
|
|
@ -18,4 +18,5 @@ typedef struct JAPANESE_ERA
|
||||||
} JAPANESE_ERA, *PJAPANESE_ERA;
|
} JAPANESE_ERA, *PJAPANESE_ERA;
|
||||||
typedef const JAPANESE_ERA *PCJAPANESE_ERA;
|
typedef const JAPANESE_ERA *PCJAPANESE_ERA;
|
||||||
|
|
||||||
|
BOOL JapaneseEra_IsFirstYearGannen(void);
|
||||||
PCJAPANESE_ERA JapaneseEra_Find(const SYSTEMTIME *pst OPTIONAL);
|
PCJAPANESE_ERA JapaneseEra_Find(const SYSTEMTIME *pst OPTIONAL);
|
||||||
|
|
|
@ -625,7 +625,15 @@ static INT NLS_GetDateTimeFormatW(LCID lcid, DWORD dwFlags,
|
||||||
{
|
{
|
||||||
count = 2;
|
count = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
dwVal = lpTime->wYear - pEra->wYear + 1;
|
dwVal = lpTime->wYear - pEra->wYear + 1;
|
||||||
|
|
||||||
|
if (dwVal == 1 && JapaneseEra_IsFirstYearGannen())
|
||||||
|
{
|
||||||
|
// Gan of 'Gannen'
|
||||||
|
buff[0] = 0x5143;
|
||||||
|
buff[1] = 0;
|
||||||
|
}
|
||||||
szAdd = buff;
|
szAdd = buff;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue