Indeed, looks like some unintentional copy-paste error:
Originally Posted by Jan Ondrus
This one is okay, applying the reverse E8E9, modifying DestBuffer and writing.
call WriteFile,TargetHandle,DestBuffer,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.
call WriteFile,SourceHandle,SourceBuffer,ecx,offset Dummy,NULL
The best solution seems to be moving the E8E9 filtering inside SMAC_Compress, so it operates on the 256 MB chunks read there.