1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
#define HeaderSize 4
BYTE PACK_HEADER[HeaderSize] = {'P', 'A', 'C', 'K'};
BYTE LZO1_HEADER[HeaderSize] = {'L', 'Z', 'O', '1'};
BOOL CheckHeader(FILE *hFile, int *check){
int i;
BYTE Pakheader[HeaderSize];
BYTE Lzoheader[HeaderSize];
if(check == 1){ //PACK header checking
printf("Checking 'PACK' Header\n\n");
fread(Pakheader, sizeof(HeaderSize), 4, hFile);
printf("Buffer Readout %s Hex = %x\n", Pakheader, Pakheader);
for(i = 0; i < HeaderSize; i++)
if(Pakheader[i] != PACK_HEADER[i])
return FALSE; //ident corrupt
printf("|P = TRUE\n");
printf("|A = TRUE\n");
printf("|C = TRUE\n");
printf("|K = TRUE\n");
printf("Verified!\n");
}
if(check == 2){ //LZO1 Header checking
printf("Checking 'LZO1' Header\n");
fread(Lzoheader, sizeof(HeaderSize), 1, hFile);
for(i = 0; i < HeaderSize; i++)
if(Lzoheader[i] != LZO1_HEADER[i])
return FALSE; //ident corrupt
printf("|L = TRUE\n");
printf("|Z = TRUE\n");
printf("|O = TRUE\n");
printf("|1 = TRUE\n");
printf("-Verified!\n");
}
return TRUE;
}
|