Fix the fix to RtlFindMessage
Modified: trunk/reactos/lib/kernel32/misc/errormsg.c
Modified: trunk/reactos/lib/rtl/message.c

Modified: trunk/reactos/lib/kernel32/misc/errormsg.c
--- trunk/reactos/lib/kernel32/misc/errormsg.c	2005-11-28 22:25:11 UTC (rev 19730)
+++ trunk/reactos/lib/kernel32/misc/errormsg.c	2005-11-28 23:21:24 UTC (rev 19731)
@@ -383,7 +383,7 @@
     LPWSTR from,f;
     DWORD width = dwFlags & FORMAT_MESSAGE_MAX_WIDTH_MASK;
     BOOL eos = FALSE;
-    CHAR ch;
+    WCHAR ch;
 
     TRACE("(0x%lx,%p,%ld,0x%lx,%p,%ld,%p)\n",
           dwFlags,lpSource,dwMessageId,dwLanguageId,lpBuffer,nSize,args);

Modified: trunk/reactos/lib/rtl/message.c
--- trunk/reactos/lib/rtl/message.c	2005-11-28 22:25:11 UTC (rev 19730)
+++ trunk/reactos/lib/rtl/message.c	2005-11-28 23:21:24 UTC (rev 19731)
@@ -85,17 +85,20 @@
 	  }
      }
 
+   if (MessageTable->NumberOfBlocks <= i)
+     {
+	return STATUS_MESSAGE_NOT_FOUND;
+     }
+
    MessageEntry = (PRTL_MESSAGE_RESOURCE_ENTRY)((PUCHAR)MessageTable + MessageTable->Blocks[i].OffsetToEntries);
 
    DPRINT("EntryOffset 0x%08lx\n", EntryOffset);
    DPRINT("IdOffset 0x%08lx\n", IdOffset);
 
    DPRINT("MessageEntry: %p\n", MessageEntry);
-   
-   for (i = 0; i < MessageTable->NumberOfBlocks; i++)
+   for (i = 0; i < IdOffset; i++)
      {
-         if (MessageId >= MessageTable->Blocks[i].LowId && MessageId <= MessageTable->Blocks[i].HighId)
-	        MessageEntry = (PRTL_MESSAGE_RESOURCE_ENTRY)((char *)MessageEntry + MessageEntry->Length);
+	MessageEntry = (PRTL_MESSAGE_RESOURCE_ENTRY)((PUCHAR)MessageEntry + (ULONG)MessageEntry->Length);
      }
 
    if (MessageEntry->Flags == 0)