
Originally Posted by
Jan Ondrus
EDIT: I just noticed what is wrong with your program. It modifies source file during compression.... Decompressed file is identical to original. Comparison fails because original was corrupted!
Indeed, looks like some unintentional copy-paste error:
Code:
call E8E9Defilter
call SetFilePointer,TargetHandle,0,0,0
pop ecx
call WriteFile,TargetHandle,DestBuffer,ecx,offset Dummy,NULL
This one is okay, applying the reverse E8E9, modifying DestBuffer and writing.
Code:
call E8E9Filter
call SetFilePointer,SourceHandle,0,0,0
pop ecx
call WriteFile,SourceHandle,SourceBuffer,ecx,offset Dummy,NULL
This is not okay, WriteFile is modifying the source file. Usually, I would just recommend to remove the WriteFile call, but it seems that SMAC_Compress wouldn't work without it at least for files >256 MB because the E8E9Filter modifications would get lost.
The best solution seems to be moving the E8E9 filtering inside SMAC_Compress, so it operates on the 256 MB chunks read there.