Author: pschweitzer
Date: Sat Sep 25 21:20:54 2010
New Revision: 48895
URL:
http://svn.reactos.org/svn/reactos?rev=48895&view=rev
Log:
[RTL]
Fixed a really stupid (and old) bug in RtlComputeCrc32():
First parameter is initial CRC32 checksum. And it's complete and not partial, thus it
needs to be an ULONG and not an USHORT.
This fixes CRC32 checksum computation with initial checksum (tested again Windows 2003
& Seven).
Modified:
trunk/reactos/include/ndk/rtlfuncs.h
trunk/reactos/lib/rtl/crc32.c
Modified: trunk/reactos/include/ndk/rtlfuncs.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/rtlfuncs.h?rev…
==============================================================================
--- trunk/reactos/include/ndk/rtlfuncs.h [iso-8859-1] (original)
+++ trunk/reactos/include/ndk/rtlfuncs.h [iso-8859-1] Sat Sep 25 21:20:54 2010
@@ -3318,7 +3318,7 @@
ULONG
NTAPI
RtlComputeCrc32(
- IN USHORT PartialCrc,
+ IN ULONG InitialCrc,
IN PUCHAR Buffer,
IN ULONG Length
);
Modified: trunk/reactos/lib/rtl/crc32.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/crc32.c?rev=48895&…
==============================================================================
--- trunk/reactos/lib/rtl/crc32.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/crc32.c [iso-8859-1] Sat Sep 25 21:20:54 2010
@@ -85,15 +85,14 @@
* @implemented
*/
ULONG NTAPI
-RtlComputeCrc32 (IN USHORT Initial,
- IN PUCHAR Data,
- IN ULONG Length)
+RtlComputeCrc32(IN ULONG Initial,
+ IN PUCHAR Data,
+ IN ULONG Length)
{
- ULONG CrcValue;
+ ULONG CrcValue = ~Initial;
- DPRINT("(%lu,%p,%lu)\n", Initial, Data, Length);
+ DPRINT("(%d,%p,%d)\n", Initial, Data, Length);
- CrcValue = ~Initial;
while (Length > 0)
{
CrcValue = CrcTable[(CrcValue ^ *Data) & 0xff] ^ (CrcValue >> 8);