// ChkSum()
// Returns an unsigned byte checksum computed on an unsigned byte
// array. The array must be 11 bytes long and is assumed to contain
// a name stored in the format of a MS-DOS directory entry.
//
|
Passed: pFcbName
|
Pointer to an unsigned byte array assumed to be
|
//
|
|
11 bytes long.
|
//
|
Returns: Sum
|
An 8-bit unsigned checksum of the array pointed
|
//
|
|
to by pFcbName.
|
//------------------------------------------------------------------------
|
|
|
unsigned char ChkSum (unsigned char *pFcbName)
{
short FcbNameLen; unsigned char Sum;
Sum = 0;
for (FcbNameLen=11; FcbNameLen!=0; FcbNameLen--) {
// NOTE: The operation is an unsigned char rotate right Sum = ((Sum & 1) ? 0x80 : 0) + (Sum >> 1) + *pFcbName++;
}
return (Sum);
}
下面是一组长文件名目录项。
00799640
|
43
|
70 00 71
|
00 72
|
00
|
73
|
00
|
74 00
|
0F
|
00
|
52
|
2E
|
00
|
...Cp.q.r.s.t
|
R..
|
00799650
|
74
|
00 78 00
|
74 00
|
00
|
00
|
FF FF 00
|
00
|
FF FF FF FF
|
t.x.t...
|
..
|
00799660
|
02
|
63 00 64
|
00 65
|
00
|
66
|
00
|
67 00
|
0F
|
00 52
|
68
|
00
|
.c.d.e.f.g...
|
Rh.
|
00799670
|
69
|
00 67 00
|
6B 00
|
6C
|
00
|
6D
|
00 00
|
00
|
6E 00
|
6F
|
00
|
i.g.k.l.m...
|
n.o.
|
00799680
|
01
|
73 00 75
|
00 62
|
00
|
64
|
00
|
69 00
|
0F
|
00 52
|
72
|
00
|
.s.u.b.d.i...
|
Rr.
|
00799690
|
66
|
00 69 00
|
6C 00
|
65
|
00
|
5F
|
00 00
|
00
|
61 00
|
62
|
00
|
f.i.l.e._...
|
a.b.
|
007996A0
|
53
|
55 42 44
|
49 52
|
7E
|
31
|
54
|
58 54
|
20
|
00 22
|
2E
|
4F
|
SUBDIR~1TXT .".O
|
007996B0
|
6C
|
3B 71 3B
|
00 00
|
E9
|
84
|
6D
|
3B 14
|
00
|
00 0E
|
00
|
00
|
l;q;..閯 m;......
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|