Title: How do i identify a file ?
Question: It is obvious for everyone that can't identify a file from a filename.
Nor it's size or it's date.
Here an interesting routine for calculating the checksum of a file
Answer:
function GetCheckSum (FileName : string) : DWORD;
var
F : File of DWORD;
Fsize : DWORD;
Buffer : Array [0..500] of DWORD;
P : Pointer;
begin
FileMode := 0;
AssignFile ( F , FileName);
Reset ( F );
Seek ( F , FileSize ( F ) div 2);
Fsize := FileSize( F )-1-FilePos( F );
if Fsize 500 then Fsize := 500;
BlockRead ( F, Buffer, Fsize);
Close ( F );
P:=@Buffer;
asm
xor eax, eax
xor ecx, ecx
mov edi , p
@again:
add eax, [edi + 4*ecx]
inc ecx
cmp ecx, fsize
jl @again
mov @result, eax
end;
end;