Added support for Unix code page in NTDLL.

This commit is contained in:
Eric Pouech 2004-01-18 22:11:52 +00:00 committed by Alexandre Julliard
parent 30acf519b6
commit 210e1abb35
4 changed files with 28 additions and 4 deletions

View File

@ -2389,7 +2389,8 @@ int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
*/
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 @@ void LOCALE_Init(void)
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,

View File

@ -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)

View File

@ -102,4 +102,9 @@ typedef BOOL (*HANDLERPROC)(LPVOID, LPCVOID);
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

View File

@ -44,19 +44,37 @@ BYTE NlsMbOemCodePageTag = 0;
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.@)