https://git.reactos.org/?p=reactos.git;a=commitdiff;h=083d6be31eb82cc6f3c95…
commit 083d6be31eb82cc6f3c953c96da59453615b7d88
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Tue Apr 16 21:41:58 2019 +0900
Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
CommitDate: Tue Apr 16 21:41:58 2019 +0900
[KERNEL32] Implement InvalidateNLSCache
---
dll/win32/kernel32/winnls/string/japanese.c | 14 +++++++++++---
dll/win32/kernel32/winnls/string/japanese.h | 1 +
dll/win32/kernel32/winnls/string/lang.c | 8 ++++++++
3 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/dll/win32/kernel32/winnls/string/japanese.c
b/dll/win32/kernel32/winnls/string/japanese.c
index ddee64ffbd..2cd42e84c4 100644
--- a/dll/win32/kernel32/winnls/string/japanese.c
+++ b/dll/win32/kernel32/winnls/string/japanese.c
@@ -14,6 +14,7 @@
/* #define DONT_USE_REGISTRY */
+static BOOL s_bIsGannenCached = FALSE;
static DWORD s_JapaneseEraCount = 0;
static JAPANESE_ERA s_JapaneseEraTable[JAPANESE_ERA_MAX]
#ifdef DONT_USE_REGISTRY
@@ -34,6 +35,12 @@ BOOL NLS_RegEnumValue(HANDLE hKey, UINT ulIndex,
LPWSTR szValueName, ULONG valueNameSize,
LPWSTR szValueData, ULONG valueDataSize);
+void JapaneseEra_ClearCache(void)
+{
+ s_bIsGannenCached = FALSE;
+ s_JapaneseEraCount = 0;
+}
+
static INT JapaneseEra_Compare(const void *e1, const void *e2)
{
PCJAPANESE_ERA pEra1 = (PCJAPANESE_ERA)e1;
@@ -61,9 +68,9 @@ BOOL JapaneseEra_IsFirstYearGannen(void)
HANDLE KeyHandle;
DWORD dwIndex;
WCHAR szName[32], szValue[32];
- static BOOL s_bIsCached = FALSE, s_bFirstIsGannen = TRUE;
+ static BOOL s_bFirstIsGannen = TRUE;
- if (s_bIsCached)
+ if (s_bIsGannenCached)
return s_bFirstIsGannen;
KeyHandle = NLS_RegOpenKey(NULL, L"\\Registry\\Machine\\System\\"
@@ -71,6 +78,7 @@ BOOL JapaneseEra_IsFirstYearGannen(void)
if (!KeyHandle)
return TRUE;
+ s_bFirstIsGannen = TRUE;
for (dwIndex = 0; dwIndex < 16; ++dwIndex)
{
if (!NLS_RegEnumValue(KeyHandle, dwIndex, szName, sizeof(szName),
@@ -88,7 +96,7 @@ BOOL JapaneseEra_IsFirstYearGannen(void)
NtClose(KeyHandle);
- s_bIsCached = TRUE;
+ s_bIsGannenCached = TRUE;
return s_bFirstIsGannen;
#endif
diff --git a/dll/win32/kernel32/winnls/string/japanese.h
b/dll/win32/kernel32/winnls/string/japanese.h
index a4829bea69..fda4f1d1b9 100644
--- a/dll/win32/kernel32/winnls/string/japanese.h
+++ b/dll/win32/kernel32/winnls/string/japanese.h
@@ -20,3 +20,4 @@ typedef const JAPANESE_ERA *PCJAPANESE_ERA;
BOOL JapaneseEra_IsFirstYearGannen(void);
PCJAPANESE_ERA JapaneseEra_Find(const SYSTEMTIME *pst OPTIONAL);
+void JapaneseEra_ClearCache(void);
diff --git a/dll/win32/kernel32/winnls/string/lang.c
b/dll/win32/kernel32/winnls/string/lang.c
index 7d13980511..000b3e11bd 100644
--- a/dll/win32/kernel32/winnls/string/lang.c
+++ b/dll/win32/kernel32/winnls/string/lang.c
@@ -28,6 +28,9 @@
DEBUG_CHANNEL(nls);
#include "lcformat_private.h"
+#ifdef __REACTOS__
+ #include "japanese.h"
+#endif
#define REG_SZ 1
extern int wine_fold_string(int flags, const WCHAR *src, int srclen, WCHAR *dst, int
dstlen);
@@ -3326,8 +3329,13 @@ BOOL WINAPI EnumSystemGeoID(GEOCLASS geoclass, GEOID parent,
GEO_ENUMPROC enumpr
*/
BOOL WINAPI InvalidateNLSCache(void)
{
+#ifdef __REACTOS__
+ JapaneseEra_ClearCache();
+ return TRUE;
+#else
FIXME("() stub\n");
return FALSE;
+#endif
}
/******************************************************************************