ntdll / kernel32: #40

Eric Pouech pouech-eric at wanadoo.fr
Sun Jan 18 08:09:44 CST 2004


Added support for Unix code page in NTDLL.
A+
-------------- next part --------------
diff -u -N -r -x '*~' -x '.#*' -x CVS dlls/kernel39/locale.c dlls/kernel/locale.c
--- dlls/kernel39/locale.c	2004-01-01 09:53:31.000000000 +0100
+++ dlls/kernel/locale.c	2004-01-17 11:24:03.000000000 +0100
@@ -2389,7 +2389,8 @@
  */
 void LOCALE_Init(void)
 {
-    extern void __wine_init_codepages( const union cptable *ansi_cp, const union cptable *oem_cp );
+    extern void __wine_init_codepages( const union cptable *ansi_cp, const union cptable *oem_cp,
+                                       const union cptable *unix_cp );
 
     UINT ansi_cp = 1252, oem_cp = 437, mac_cp = 10000, unix_cp = ~0U;
     LCID lcid = init_default_lcid( &unix_cp );
@@ -2418,7 +2419,7 @@
             unix_cptable  = wine_cp_get_table( 28591 );
     }
 
-    __wine_init_codepages( ansi_cptable, oem_cptable );
+    __wine_init_codepages( ansi_cptable, oem_cptable, unix_cptable );
 
     TRACE( "ansi=%03d oem=%03d mac=%03d unix=%03d\n",
            ansi_cptable->info.codepage, oem_cptable->info.codepage,
diff -u -N -r -x '*~' -x '.#*' -x CVS dlls/ntdll39/ntdll_misc.h dlls/ntdll/ntdll_misc.h
--- dlls/ntdll39/ntdll_misc.h	2004-01-14 22:29:57.000000000 +0100
+++ dlls/ntdll/ntdll_misc.h	2004-01-17 11:24:55.000000000 +0100
@@ -102,4 +102,9 @@
 extern BOOL VIRTUAL_SetFaultHandler(LPCVOID addr, HANDLERPROC proc, LPVOID arg);
 extern DWORD VIRTUAL_HandleFault(LPCVOID addr);
 
+/* code pages */
+extern int ntdll_umbstowcs(DWORD flags, const char* src, int srclen, WCHAR* dst, int dstlen);
+extern int ntdll_wcstoumbs(DWORD flags, const WCHAR* src, int srclen, char* dst, int dstlen,
+                           const char* defchar, int *used );
+
 #endif
diff -u -N -r -x '*~' -x '.#*' -x CVS dlls/ntdll39/ntdll.spec dlls/ntdll/ntdll.spec
--- dlls/ntdll39/ntdll.spec	2004-01-01 09:53:18.000000000 +0100
+++ dlls/ntdll/ntdll.spec	2004-01-17 11:23:18.000000000 +0100
@@ -1076,7 +1076,7 @@
 @ cdecl wine_server_send_fd(long)
 
 # Codepages
-@ cdecl __wine_init_codepages(ptr ptr)
+@ cdecl __wine_init_codepages(ptr ptr ptr)
 
 # signal handling
 @ cdecl __wine_set_signal_handler(long ptr)
diff -u -N -r -x '*~' -x '.#*' -x CVS dlls/ntdll39/rtlstr.c dlls/ntdll/rtlstr.c
--- dlls/ntdll39/rtlstr.c	2004-01-01 09:53:17.000000000 +0100
+++ dlls/ntdll/rtlstr.c	2004-01-17 11:24:16.000000000 +0100
@@ -44,19 +44,37 @@
 
 static const union cptable *ansi_table;
 static const union cptable *oem_table;
+static const union cptable* unix_table; /* NULL if UTF8 */
+
 
 /**************************************************************************
  *	__wine_init_codepages   (NTDLL.@)
  *
  * Set the code page once kernel32 is loaded. Should be done differently.
  */
-void __wine_init_codepages( const union cptable *ansi, const union cptable *oem )
+void __wine_init_codepages( const union cptable *ansi, const union cptable *oem,
+                            const union cptable *ucp)
 {
     ansi_table = ansi;
     oem_table = oem;
+    unix_table = ucp;
     NlsAnsiCodePage = ansi->info.codepage;
 }
 
+int ntdll_umbstowcs(DWORD flags, const char* src, int srclen, WCHAR* dst, int dstlen)
+{ 
+    return (unix_table) ?
+        wine_cp_mbstowcs( unix_table, flags, src, srclen, dst, dstlen ) :
+        wine_utf8_mbstowcs( flags, src, srclen, dst, dstlen );
+}
+
+int ntdll_wcstoumbs(DWORD flags, const WCHAR* src, int srclen, char* dst, int dstlen,
+                    const char* defchar, int *used )
+{ 
+    return (unix_table) ?
+        wine_cp_wcstombs( unix_table, flags, src, srclen, dst, dstlen, defchar, used ) :
+        wine_utf8_wcstombs( src, srclen, dst, dstlen );
+}
 
 /**************************************************************************
  *      RtlInitAnsiString   (NTDLL.@)


More information about the wine-patches mailing list