test: hivesum.c File Reference

Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

# hivesum.c File Reference

`#include "cmp.h"`

Go to the source code of this file.

## Functions

ULONG | HvpHeaderCheckSum (PHBASE_BLOCK BaseBlock)

## Function Documentation

ULONG HvpHeaderCheckSum | ( | PHBASE_BLOCK | BaseBlock | ) |

Definition at line 31 of file hivesum.c.

Referenced by DoDump(), HvInitializeHive(), HvpDoWriteHive(), HvpGetHiveHeader(), HvpGetLogHeader(), and HvpWriteLog().

    00036                    :
    00037
    00038     Compute the checksum for a hive disk header.
    00039
    00040 Arguments:
    00041
    00042     BaseBlock - supplies pointer to the header to checksum
    00043
    00044 Return Value:
    00045
    00046     the check sum.
    00047
    00048 --*/
    00049 {
    00050     ULONG   sum;
    00051     ULONG   i;
    00052
    00053     sum = 0;
    00054     for (i = 0; i < 127; i++) {
    00055         sum ^= ((PULONG)BaseBlock)[i];
    00056     }
    00057     if (sum == (ULONG)-1) {
    00058         sum = (ULONG)-2;
    00059     }
    00060     if (sum == 0) {
    00061         sum = 1;
    00062     }
    00063     return sum;
    00064 }
    }