Author: tkreuzer Date: Thu Aug 30 10:12:55 2012 New Revision: 57205
URL: http://svn.reactos.org/svn/reactos?rev=57205&view=rev Log: [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.
Added: trunk/reactos/lib/sdk/crt/string/is_wctype.c (with props) trunk/reactos/lib/sdk/crt/string/iswctype.c (with props) Modified: trunk/reactos/boot/freeldr/freeldr/freeldr.c trunk/reactos/lib/sdk/crt/crt.cmake trunk/reactos/lib/sdk/crt/libcntpr.cmake trunk/reactos/lib/sdk/crt/string/ctype.c
Modified: trunk/reactos/boot/freeldr/freeldr/freeldr.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/freeld... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/freeldr.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/freeldr.c [iso-8859-1] Thu Aug 30 10:12:55 2012 @@ -57,6 +57,8 @@ }
// 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 @@ *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); +} +
Modified: trunk/reactos/lib/sdk/crt/crt.cmake URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/crt.cmake?rev=5... ============================================================================== --- trunk/reactos/lib/sdk/crt/crt.cmake [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/crt.cmake [iso-8859-1] Thu Aug 30 10:12:55 2012 @@ -252,6 +252,8 @@ 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
Modified: trunk/reactos/lib/sdk/crt/libcntpr.cmake URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/libcntpr.cmake?... ============================================================================== --- trunk/reactos/lib/sdk/crt/libcntpr.cmake [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/libcntpr.cmake [iso-8859-1] Thu Aug 30 10:12:55 2012 @@ -27,6 +27,8 @@ 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 @@ endif()
add_library(libcntpr ${LIBCNTPR_SOURCE}) -add_target_compile_definitions(libcntpr +add_target_compile_definitions(libcntpr NO_RTL_INLINES _NTSYSTEM_ _NTDLLBUILD_
Modified: trunk/reactos/lib/sdk/crt/string/ctype.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/string/ctype.c?... ============================================================================== --- trunk/reactos/lib/sdk/crt/string/ctype.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/string/ctype.c [iso-8859-1] Thu Aug 30 10:12:55 2012 @@ -587,24 +587,6 @@ /* * @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 - */ int isalpha(int c) { return(_isctype(c, _ALPHA));
Added: trunk/reactos/lib/sdk/crt/string/is_wctype.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/string/is_wctyp... ============================================================================== --- trunk/reactos/lib/sdk/crt/string/is_wctype.c (added) +++ trunk/reactos/lib/sdk/crt/string/is_wctype.c [iso-8859-1] Thu Aug 30 10:12:55 2012 @@ -1,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); +}
Propchange: trunk/reactos/lib/sdk/crt/string/is_wctype.c ------------------------------------------------------------------------------ svn:eol-style = native
Added: trunk/reactos/lib/sdk/crt/string/iswctype.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/string/iswctype... ============================================================================== --- trunk/reactos/lib/sdk/crt/string/iswctype.c (added) +++ trunk/reactos/lib/sdk/crt/string/iswctype.c [iso-8859-1] Thu Aug 30 10:12:55 2012 @@ -1,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); +} +
Propchange: trunk/reactos/lib/sdk/crt/string/iswctype.c ------------------------------------------------------------------------------ svn:eol-style = native