ReactOS 0.4.16-dev-334-g4d9f67c
japanese.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  JAPANESE_ERA
 

Macros

#define JAPANESE_MAX_TWODIGITYEAR   99
 

Typedefs

typedef struct JAPANESE_ERA JAPANESE_ERA
 
typedef struct JAPANESE_ERAPJAPANESE_ERA
 
typedef const JAPANESE_ERAPCJAPANESE_ERA
 

Functions

BOOL JapaneseEra_IsFirstYearGannen (void)
 
PCJAPANESE_ERA JapaneseEra_Find (const SYSTEMTIME *pst OPTIONAL)
 
void JapaneseEra_ClearCache (void)
 

Macro Definition Documentation

◆ JAPANESE_MAX_TWODIGITYEAR

#define JAPANESE_MAX_TWODIGITYEAR   99

Definition at line 7 of file japanese.h.

Typedef Documentation

◆ JAPANESE_ERA

◆ PCJAPANESE_ERA

Definition at line 19 of file japanese.h.

◆ PJAPANESE_ERA

Function Documentation

◆ JapaneseEra_ClearCache()

void JapaneseEra_ClearCache ( void  )

Definition at line 38 of file japanese.c.

39{
42}
#define FALSE
Definition: types.h:117
static BOOL s_bIsGannenCached
Definition: japanese.c:17
static DWORD s_JapaneseEraCount
Definition: japanese.c:18

Referenced by InvalidateNLSCache().

◆ JapaneseEra_Find()

PCJAPANESE_ERA JapaneseEra_Find ( const SYSTEMTIME *pst  OPTIONAL)

Definition at line 236 of file japanese.c.

237{
238 DWORD dwIndex, dwCount = 0;
239 PCJAPANESE_ERA pTable, pEntry, pPrevEntry = NULL;
240 SYSTEMTIME st1, st2;
241 FILETIME ft1, ft2;
242 LONG nCompare;
243
244 /* pst --> ft1 */
245 if (pst == NULL)
246 {
247 GetLocalTime(&st1);
248 pst = &st1;
249 }
250 SystemTimeToFileTime(pst, &ft1);
251
252 /* load era table */
253 pTable = JapaneseEra_Load(&dwCount);
254 if (pTable == NULL || dwCount == 0 || dwCount > JAPANESE_ERA_MAX)
255 {
256 return NULL;
257 }
258
259 /* for all eras */
260 for (dwIndex = 0; dwIndex < dwCount; dwIndex++)
261 {
262 pEntry = &pTable[dwIndex];
263
264 /* pEntry --> st2 --> ft2 */
266 SystemTimeToFileTime(&st2, &ft2);
267
268 /* ft1 <=> ft2 */
269 nCompare = CompareFileTime(&ft1, &ft2);
270 if (nCompare == 0)
271 return pEntry;
272 if (nCompare < 0)
273 return pPrevEntry;
274 pPrevEntry = pEntry;
275 }
276
277 return pPrevEntry;
278}
#define NULL
Definition: types.h:112
BOOL WINAPI SystemTimeToFileTime(IN CONST SYSTEMTIME *lpSystemTime, OUT LPFILETIME lpFileTime)
Definition: time.c:158
LONG WINAPI CompareFileTime(IN CONST FILETIME *lpFileTime1, IN CONST FILETIME *lpFileTime2)
Definition: time.c:106
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:286
unsigned long DWORD
Definition: ntddk_ex.h:95
PLIST_ENTRY pEntry
Definition: fxioqueue.cpp:4484
static PCJAPANESE_ERA JapaneseEra_Load(DWORD *pdwCount)
Definition: japanese.c:110
#define JAPANESE_ERA_MAX
Definition: japanese.c:13
static BOOL JapaneseEra_ToSystemTime(PCJAPANESE_ERA pEra, LPSYSTEMTIME pst)
Definition: japanese.c:224
long LONG
Definition: pedump.c:60
static const EHCI_PERIOD pTable[]
Definition: usbehci.c:29

Referenced by GetCalendarInfoW(), and NLS_GetDateTimeFormatW().

◆ JapaneseEra_IsFirstYearGannen()

BOOL JapaneseEra_IsFirstYearGannen ( void  )

Definition at line 63 of file japanese.c.

64{
65#ifdef DONT_USE_REGISTRY
66 return TRUE;
67#else
69 DWORD dwIndex;
70 WCHAR szName[32], szValue[32];
71 static BOOL s_bFirstIsGannen = TRUE;
72
74 return s_bFirstIsGannen;
75
76 KeyHandle = NLS_RegOpenKey(NULL, L"\\Registry\\Machine\\System\\"
77 L"CurrentControlSet\\Control\\Nls\\Calendars\\Japanese");
78 if (!KeyHandle)
79 return TRUE;
80
81 s_bFirstIsGannen = TRUE;
82 for (dwIndex = 0; dwIndex < 16; ++dwIndex)
83 {
84 if (!NLS_RegEnumValue(KeyHandle, dwIndex, szName, sizeof(szName),
85 szValue, sizeof(szValue)))
86 {
87 break;
88 }
89
90 if (lstrcmpiW(szName, L"InitialEraYear") == 0)
91 {
92 s_bFirstIsGannen = (szValue[0] == 0x5143);
93 break;
94 }
95 }
96
98
100
101 return s_bFirstIsGannen;
102#endif
103}
#define TRUE
Definition: types.h:120
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4262
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL NLS_RegEnumValue(HANDLE hKey, UINT ulIndex, LPWSTR szValueName, ULONG valueNameSize, LPWSTR szValueData, ULONG valueDataSize)
HANDLE NLS_RegOpenKey(HANDLE hRootKey, LPCWSTR szKeyName)
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4715
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3402
#define L(x)
Definition: ntvdm.h:50
static const WCHAR szName[]
Definition: powrprof.c:45
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by NLS_GetDateTimeFormatW().