Alexandre Julliard : ntdll Implement RtlInitNlsTables() and RtlResetRtlTranslations().

Alexandre Julliard julliard at winehq.org
Tue Nov 26 16:21:24 CST 2019


Module: wine
Branch: master
Commit: c0ff49061f0bfb200d18854309ad177c1f718b65
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=c0ff49061f0bfb200d18854309ad177c1f718b65

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Nov 26 17:49:31 2019 +0100

ntdll Implement RtlInitNlsTables() and RtlResetRtlTranslations().

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/locale.c   | 29 +++++++++++++++++++++++++++++
 dlls/ntdll/ntdll.spec |  4 ++--
 dlls/ntdll/rtlstr.c   |  5 -----
 include/winternl.h    |  2 ++
 4 files changed, 33 insertions(+), 7 deletions(-)

diff --git a/dlls/ntdll/locale.c b/dlls/ntdll/locale.c
index 6da6f5ead3..c271cab732 100644
--- a/dlls/ntdll/locale.c
+++ b/dlls/ntdll/locale.c
@@ -71,9 +71,14 @@ enum nls_section_type
     NLS_SECTION_NORMALIZE = 12
 };
 
+UINT NlsAnsiCodePage = 0;
+BYTE NlsMbCodePageTag = 0;
+BYTE NlsMbOemCodePageTag = 0;
+
 LCID user_lcid = 0, system_lcid = 0;
 
 static LANGID user_ui_language, system_ui_language;
+static NLSTABLEINFO nls_info;
 static HMODULE kernel32_handle;
 static const union cptable *unix_table; /* NULL if UTF8 */
 
@@ -652,6 +657,30 @@ void WINAPI RtlInitCodePageTable( USHORT *ptr, CPTABLEINFO *info )
 }
 
 
+/**************************************************************************
+ *      RtlInitNlsTables   (NTDLL.@)
+ */
+void WINAPI RtlInitNlsTables( USHORT *ansi, USHORT *oem, USHORT *casetable, NLSTABLEINFO *info )
+{
+    RtlInitCodePageTable( ansi, &info->AnsiTableInfo );
+    RtlInitCodePageTable( oem, &info->OemTableInfo );
+    info->UpperCaseTable = casetable + 2;
+    info->LowerCaseTable = casetable + casetable[1] + 2;
+}
+
+
+/**************************************************************************
+ *      RtlResetRtlTranslations   (NTDLL.@)
+ */
+void WINAPI RtlResetRtlTranslations( const NLSTABLEINFO *info )
+{
+    NlsAnsiCodePage     = info->AnsiTableInfo.CodePage;
+    NlsMbCodePageTag    = info->AnsiTableInfo.DBCSCodePage;
+    NlsMbOemCodePageTag = info->OemTableInfo.DBCSCodePage;
+    nls_info = *info;
+}
+
+
 /******************************************************************
  *      RtlLocaleNameToLcid   (NTDLL.@)
  */
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index d713e80a16..899b044c74 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -731,7 +731,7 @@
 @ stdcall RtlInitAnsiStringEx(ptr str)
 @ stdcall RtlInitCodePageTable(ptr ptr)
 # @ stub RtlInitMemoryStream
-@ stub RtlInitNlsTables
+@ stdcall RtlInitNlsTables(ptr ptr ptr ptr)
 # @ stub RtlInitOutOfProcessMemoryStream
 @ stdcall RtlInitString(ptr str)
 @ stdcall RtlInitUnicodeString(ptr wstr)
@@ -901,7 +901,7 @@
 @ stub RtlRemoteCall
 @ stdcall RtlRemoveVectoredContinueHandler(ptr)
 @ stdcall RtlRemoveVectoredExceptionHandler(ptr)
-@ stub RtlResetRtlTranslations
+@ stdcall RtlResetRtlTranslations(ptr)
 @ stdcall -arch=x86_64 RtlRestoreContext(ptr ptr)
 @ stdcall RtlRestoreLastWin32Error(long) RtlSetLastWin32Error
 @ stub RtlRevertMemoryStream
diff --git a/dlls/ntdll/rtlstr.c b/dlls/ntdll/rtlstr.c
index ee861ddea4..0eeb14ed65 100644
--- a/dlls/ntdll/rtlstr.c
+++ b/dlls/ntdll/rtlstr.c
@@ -40,10 +40,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(ntdll);
 
 #define GUID_STRING_LENGTH    38
 
-UINT NlsAnsiCodePage = 0;
-BYTE NlsMbCodePageTag = 0;
-BYTE NlsMbOemCodePageTag = 0;
-
 extern const union cptable cptable_20127;  /* 7-bit ASCII */
 
 static const union cptable *ansi_table = &cptable_20127;
@@ -59,7 +55,6 @@ void CDECL __wine_init_codepages( const union cptable *ansi, const union cptable
 {
     ansi_table = ansi;
     oem_table = oem;
-    NlsAnsiCodePage = ansi->info.codepage;
 }
 
 /**************************************************************************
diff --git a/include/winternl.h b/include/winternl.h
index a2fb7e94e3..1477932d10 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -2782,6 +2782,7 @@ NTSYSAPI void      WINAPI RtlInitString(PSTRING,PCSZ);
 NTSYSAPI void      WINAPI RtlInitAnsiString(PANSI_STRING,PCSZ);
 NTSYSAPI NTSTATUS  WINAPI RtlInitAnsiStringEx(PANSI_STRING,PCSZ);
 NTSYSAPI void      WINAPI RtlInitCodePageTable(USHORT*,CPTABLEINFO*);
+NTSYSAPI void      WINAPI RtlInitNlsTables(USHORT*,USHORT*,USHORT*,NLSTABLEINFO*);
 NTSYSAPI void      WINAPI RtlInitUnicodeString(PUNICODE_STRING,PCWSTR);
 NTSYSAPI NTSTATUS  WINAPI RtlInitUnicodeStringEx(PUNICODE_STRING,PCWSTR);
 NTSYSAPI void      WINAPI RtlInitializeBitMap(PRTL_BITMAP,PULONG,ULONG);
@@ -2861,6 +2862,7 @@ NTSYSAPI void      WINAPI RtlReleaseResource(LPRTL_RWLOCK);
 NTSYSAPI void      WINAPI RtlReleaseSRWLockExclusive(RTL_SRWLOCK*);
 NTSYSAPI void      WINAPI RtlReleaseSRWLockShared(RTL_SRWLOCK*);
 NTSYSAPI ULONG     WINAPI RtlRemoveVectoredExceptionHandler(PVOID);
+NTSYSAPI void      WINAPI RtlResetRtlTranslations(const NLSTABLEINFO*);
 NTSYSAPI void      WINAPI RtlRestoreLastWin32Error(DWORD);
 NTSYSAPI void      WINAPI RtlSecondsSince1970ToTime(DWORD,LARGE_INTEGER *);
 NTSYSAPI void      WINAPI RtlSecondsSince1980ToTime(DWORD,LARGE_INTEGER *);




More information about the wine-cvs mailing list