Commit 210e1abb authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

Added support for Unix code page in NTDLL.

parent 30acf519
...@@ -2389,7 +2389,8 @@ int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2) ...@@ -2389,7 +2389,8 @@ int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
*/ */
void LOCALE_Init(void) 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; UINT ansi_cp = 1252, oem_cp = 437, mac_cp = 10000, unix_cp = ~0U;
LCID lcid = init_default_lcid( &unix_cp ); LCID lcid = init_default_lcid( &unix_cp );
...@@ -2418,7 +2419,7 @@ void LOCALE_Init(void) ...@@ -2418,7 +2419,7 @@ void LOCALE_Init(void)
unix_cptable = wine_cp_get_table( 28591 ); 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", TRACE( "ansi=%03d oem=%03d mac=%03d unix=%03d\n",
ansi_cptable->info.codepage, oem_cptable->info.codepage, ansi_cptable->info.codepage, oem_cptable->info.codepage,
......
...@@ -1076,7 +1076,7 @@ ...@@ -1076,7 +1076,7 @@
@ cdecl wine_server_send_fd(long) @ cdecl wine_server_send_fd(long)
# Codepages # Codepages
@ cdecl __wine_init_codepages(ptr ptr) @ cdecl __wine_init_codepages(ptr ptr ptr)
# signal handling # signal handling
@ cdecl __wine_set_signal_handler(long ptr) @ cdecl __wine_set_signal_handler(long ptr)
......
...@@ -102,4 +102,9 @@ typedef BOOL (*HANDLERPROC)(LPVOID, LPCVOID); ...@@ -102,4 +102,9 @@ typedef BOOL (*HANDLERPROC)(LPVOID, LPCVOID);
extern BOOL VIRTUAL_SetFaultHandler(LPCVOID addr, HANDLERPROC proc, LPVOID arg); extern BOOL VIRTUAL_SetFaultHandler(LPCVOID addr, HANDLERPROC proc, LPVOID arg);
extern DWORD VIRTUAL_HandleFault(LPCVOID addr); 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 #endif
...@@ -44,19 +44,37 @@ BYTE NlsMbOemCodePageTag = 0; ...@@ -44,19 +44,37 @@ BYTE NlsMbOemCodePageTag = 0;
static const union cptable *ansi_table; static const union cptable *ansi_table;
static const union cptable *oem_table; static const union cptable *oem_table;
static const union cptable* unix_table; /* NULL if UTF8 */
/************************************************************************** /**************************************************************************
* __wine_init_codepages (NTDLL.@) * __wine_init_codepages (NTDLL.@)
* *
* Set the code page once kernel32 is loaded. Should be done differently. * 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; ansi_table = ansi;
oem_table = oem; oem_table = oem;
unix_table = ucp;
NlsAnsiCodePage = ansi->info.codepage; 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.@) * RtlInitAnsiString (NTDLL.@)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment