Author: cfinck
Date: Wed Mar 16 15:09:31 2011
New Revision: 51066
URL: http://svn.reactos.org/svn/reactos?rev=51066&view=rev
Log:
Hackfix for Far 1.65.
Although the file manager didn't become fully usable with this patch, it works better than without and the patch doesn't seem to have negative side effects.
See issue #5503 for more details.
Modified:
branches/ros-branch-0_3_13/reactos/include/reactos/subsys/csrss/csrss.h
Modified: branches/ros-branch-0_3_13/reactos/include/reactos/subsys/csrss/csrss.h
URL: http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_13/reactos/inclu…
==============================================================================
--- branches/ros-branch-0_3_13/reactos/include/reactos/subsys/csrss/csrss.h [iso-8859-1] (original)
+++ branches/ros-branch-0_3_13/reactos/include/reactos/subsys/csrss/csrss.h [iso-8859-1] Wed Mar 16 15:09:31 2011
@@ -22,7 +22,7 @@
#define MAKE_CSR_API(Number, Server) \
((Server) << 16) + Number
-#define CSR_CSRSS_SECTION_SIZE (65536)
+#define CSR_CSRSS_SECTION_SIZE (131072) //(65536)
typedef VOID (CALLBACK *PCONTROLDISPATCHER)(DWORD);
Author: fireball
Date: Wed Mar 16 11:58:12 2011
New Revision: 51061
URL: http://svn.reactos.org/svn/reactos?rev=51061&view=rev
Log:
[RTL]
- Hack away LdrVerifyMappedImageMatchesChecksum() invocations with zero ImageSize until MM is fixed.
- Implement a helper ChkSum() routine to be used later by LdrVerifyMappedImageMatchesChecksum().
Modified:
trunk/reactos/lib/rtl/image.c
Modified: trunk/reactos/lib/rtl/image.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/image.c?rev=51061&…
==============================================================================
--- trunk/reactos/lib/rtl/image.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/image.c [iso-8859-1] Wed Mar 16 11:58:12 2011
@@ -20,6 +20,25 @@
/* FUNCTIONS *****************************************************************/
+USHORT
+FORCEINLINE
+ChkSum(ULONG Sum, PUSHORT Src, ULONG Len)
+{
+ ULONG i;
+
+ for (i=0; i<Len; i++)
+ {
+ /* Sum up the current word */
+ Sum += Src[i];
+
+ /* Sum up everything above the low word as a carry */
+ Sum = (Sum & 0xFFFF) + (Sum >> 16);
+ }
+
+ /* Apply carry one more time and clamp to the USHORT */
+ return (Sum + (Sum >> 16)) & 0xFFFF;
+}
+
BOOLEAN
NTAPI
LdrVerifyMappedImageMatchesChecksum(
@@ -34,8 +53,11 @@
ULONG HeaderSum;
ULONG i;
+ // HACK: Ignore calls with ImageSize=0. Should be fixed by new MM.
+ if (ImageSize == 0) return TRUE;
+
/* Get NT header to check if it's an image at all */
- Header = RtlImageNtHeader (BaseAddress);
+ Header = RtlImageNtHeader(BaseAddress);
if (!Header) return FALSE;
/* Get checksum to match */
@@ -93,7 +115,7 @@
CalcSum += ImageSize;
if (CalcSum != HeaderSum)
- DPRINT1("Image %p checksum mismatches! 0x%x != 0x%x\n", BaseAddress, CalcSum, HeaderSum);
+ DPRINT1("Image %p checksum mismatches! 0x%x != 0x%x, ImageSize %x, FileLen %x\n", BaseAddress, CalcSum, HeaderSum, ImageSize, FileLength);
return (BOOLEAN)(CalcSum == HeaderSum);
}
Author: cfinck
Date: Tue Mar 15 23:45:38 2011
New Revision: 51058
URL: http://svn.reactos.org/svn/reactos?rev=51058&view=rev
Log:
[CRT]
- Revert 38185 which synced fputwc to the Wine version for the sake of fixing Winetests.
This removed the implicit ANSI conversion, which was honestly checking the wrong flags. The new version correctly checks for WX_TEXT and only does the conversion in this case. This way we also don't fail any additional Winetests.
- Simplify streamout_char in the new printf implementation and use _fputtc instead of _flsbuf.
This way, we correctly do an implicit ANSI conversion when required.
- Fix fgetwc declaration.
Thanks to Timo for many hints and assistance. Most of this code is actually his idea :-)
Thanks to Olaf for providing a build server to speed up my code tests.
See issue #6007 for more details.
Modified:
trunk/reactos/lib/sdk/crt/printf/streamout.c
trunk/reactos/lib/sdk/crt/stdio/file.c
Modified: trunk/reactos/lib/sdk/crt/printf/streamout.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/printf/streamo…
==============================================================================
--- trunk/reactos/lib/sdk/crt/printf/streamout.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/printf/streamout.c [iso-8859-1] Tue Mar 15 23:45:38 2011
@@ -16,13 +16,6 @@
#ifdef _UNICODE
# define streamout wstreamout
# define format_float format_floatw
-# define _flsbuf _flswbuf
-int __cdecl _flswbuf(int ch, FILE *stream);
-#endif
-
-#ifdef _LIBCNT_
-# undef _flsbuf
-# define _flsbuf(chr, stream) _TEOF
#endif
#define MB_CUR_MAX 10
@@ -234,25 +227,19 @@
int
streamout_char(FILE *stream, int chr)
{
+#if defined(_USER32_WSPRINTF) || defined(_LIBCNT_)
/* Check if the buffer is full */
if (stream->_cnt < sizeof(TCHAR))
- {
-#ifdef _USER32_WSPRINTF
- return _TEOF;
-#else
- /* Strings are done now */
- if (stream->_flag & _IOSTRG) return _TEOF;
-
- /* Flush buffer for files */
- return _flsbuf(chr, stream) != _TEOF;
-#endif
- }
+ return 0;
*(TCHAR*)stream->_ptr = chr;
stream->_ptr += sizeof(TCHAR);
stream->_cnt -= sizeof(TCHAR);
return 1;
+#else
+ return _fputtc((TCHAR)chr, stream) != _TEOF;
+#endif
}
static
Modified: trunk/reactos/lib/sdk/crt/stdio/file.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/stdio/file.c?r…
==============================================================================
--- trunk/reactos/lib/sdk/crt/stdio/file.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/stdio/file.c [iso-8859-1] Tue Mar 15 23:45:38 2011
@@ -2175,12 +2175,33 @@
/*********************************************************************
* fputwc (MSVCRT.@)
*/
-wint_t CDECL fputwc(wint_t wc, FILE* file)
-{
- wchar_t mwc=wc;
- if (fwrite( &mwc, sizeof(mwc), 1, file) != 1)
- return WEOF;
- return wc;
+wint_t CDECL fputwc(wchar_t c, FILE* stream)
+{
+ /* If this is a real file stream (and not some temporary one for
+ sprintf-like functions), check whether it is opened in text mode.
+ In this case, we have to perform an implicit conversion to ANSI. */
+ if (!(stream->_flag & _IOSTRG) && fdesc[stream->_file].wxflag & WX_TEXT)
+ {
+ /* Convert to multibyte in text mode */
+ char mbc[MB_LEN_MAX];
+ int mb_return;
+
+ mb_return = wctomb(mbc, c);
+
+ if(mb_return == -1)
+ return WEOF;
+
+ /* Output all characters */
+ if (fwrite(mbc, mb_return, 1, stream) != 1)
+ return WEOF;
+ }
+ else
+ {
+ if (fwrite(&c, sizeof(c), 1, stream) != 1)
+ return WEOF;
+ }
+
+ return c;
}
/*********************************************************************