[ros-diffs] [ion] 26764: - Properly remove trailing \r\n depending on system configuration. Previous code assumed our wmc tool used target-newlines instead of host-newlines, causing Linux builds to display incorrect boot messages. New code scans the string.

ion at svn.reactos.org ion at svn.reactos.org
Sun May 13 22:26:08 CEST 2007


Author: ion
Date: Mon May 14 00:26:08 2007
New Revision: 26764

URL: http://svn.reactos.org/svn/reactos?rev=26764&view=rev
Log:
- Properly remove trailing \r\n depending on system configuration. Previous code assumed our wmc tool used target-newlines instead of host-newlines, causing Linux builds to display incorrect boot messages. New code scans the string.

Modified:
    trunk/reactos/ntoskrnl/ex/init.c

Modified: trunk/reactos/ntoskrnl/ex/init.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/init.c?rev=26764&r1=26763&r2=26764&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ex/init.c (original)
+++ trunk/reactos/ntoskrnl/ex/init.c Mon May 14 00:26:08 2007
@@ -1040,7 +1040,17 @@
         {
             /* Setup the string */
             RtlInitAnsiString(&CsdString, MsgEntry->Text);
-            CsdString.Length -= 2;
+
+            /* Remove trailing newline */
+            while ((CsdString.Length > 0) &&
+                   ((CsdString.Buffer[CsdString.Length] == '\r') ||
+                    (CsdString.Buffer[CsdString.Length] == '\n')))
+            {
+                /* Skip the trailing character */
+                CsdString.Length--;
+            }
+
+            /* Fill the buffer with version information */
             Status = RtlStringCbPrintfA(Buffer,
                                         sizeof(Buffer),
                                         "%Z %u%c",
@@ -1455,7 +1465,13 @@
     RtlInitAnsiString(&TempString, MpString);
 
     /* Make sure to remove the \r\n if we actually have a string */
-    if (TempString.Length >= 2) TempString.Length -= sizeof(2);
+    while ((TempString.Length > 0) &&
+           ((TempString.Buffer[TempString.Length] == '\r') ||
+            (TempString.Buffer[TempString.Length] == '\n')))
+    {
+        /* Skip the trailing character */
+        TempString.Length--;
+    }
 
     /* Get the information string from our resource file */
     MsgStatus = RtlFindMessage(NtosEntry->DllBase,




More information about the Ros-diffs mailing list