[FREELDR/CRT]

Freeldr size is currently limited to 448 KB. On MSVC it was already at 442 KB, before wine's wctype table was used. The new wctype table is itself 37 KB. This lead to freeldr overflowing into memory regions that were used for the filesystem buffer, causing bootfailures. Fix this by giving freeldr it's own using _isctype(), since freeldr casts WCHAR to CHAR anyway.

svn path=/trunk/; revision=57205
This commit is contained in:
Timo Kreuzer 2012-08-30 10:12:55 +00:00
parent c4d952dc0f
commit dcbf403aee
6 changed files with 39 additions and 19 deletions

View file

@ -57,6 +57,8 @@ VOID BootMain(LPSTR CmdLine)
}
// We need to emulate these, because the original ones don't work in freeldr
// These functions are here, because they need to be in the main compilation unit
// and cannot be in a library.
int __cdecl wctomb(char *mbchar, wchar_t wchar)
{
*mbchar = (char)wchar;
@ -68,3 +70,10 @@ int __cdecl mbtowc (wchar_t *wchar, const char *mbchar, size_t count)
*wchar = (wchar_t)*mbchar;
return 1;
}
// The wctype table is 144 KB, too much for poor freeldr
int iswctype(wint_t wc, wctype_t wctypeFlags)
{
return _isctype((char)wc, wctypeFlags);
}

View file

@ -252,6 +252,8 @@ list(APPEND CRT_SOURCE
string/atoi64.c
string/atol.c
string/ctype.c
string/iswctype.c
string/is_wctype.c
string/itoa.c
string/itow.c
string/scanf.c

View file

@ -27,6 +27,8 @@ list(APPEND LIBCNTPR_SOURCE
search/lfind.c
stdlib/qsort.c
string/ctype.c
string/iswctype.c
string/is_wctype.c
string/scanf.c
string/strcspn.c
string/stricmp.c
@ -182,7 +184,7 @@ else()
endif()
add_library(libcntpr ${LIBCNTPR_SOURCE})
add_target_compile_definitions(libcntpr
add_target_compile_definitions(libcntpr
NO_RTL_INLINES
_NTSYSTEM_
_NTDLLBUILD_

View file

@ -584,24 +584,6 @@ int _isctype (int c, int ctypeFlags)
return (_pctype[(unsigned char)(c & 0xFF)] & ctypeFlags);
}
/*
* @implemented
*/
int iswctype(wint_t wc, wctype_t wctypeFlags)
{
return (wine_wctype_table[wine_wctype_table[wc >> 8] + (wc & 0xff)] & wctypeFlags);
}
/*
* obsolete
*
* @implemented
*/
int is_wctype(wint_t wc, wctype_t wctypeFlags)
{
return (wine_wctype_table[wine_wctype_table[wc >> 8] + (wc & 0xff)] & wctypeFlags);
}
/*
* @implemented
*/

View file

@ -0,0 +1,13 @@
#include <string.h>
extern const unsigned short wine_wctype_table[];
/*
* obsolete
*
* @implemented
*/
int is_wctype(wint_t wc, wctype_t wctypeFlags)
{
return iswctype(wc, wctypeFlags);
}

View file

@ -0,0 +1,12 @@
#include <string.h>
extern const unsigned short wine_wctype_table[];
/*
* @implemented
*/
int iswctype(wint_t wc, wctype_t wctypeFlags)
{
return (wine_wctype_table[wine_wctype_table[wc >> 8] + (wc & 0xff)] & wctypeFlags);
}