PROGRAM T0P;
{$APPTYPE CONSOLE}
uses
  BeRoPE in 'BeRoPE.pas',
  BeRoStream in 'BeRoStream.pas';

VAR FileStream:TBeRoFileStream;
    PE:TBeRoPE;
BEGIN
 PE:=TBeRoPE.Create;
 FileStream:=TBeRoFileStream.Create('SmallSynth.exe');
 PE.ReadImage(FileStream);
 FileStream.Destroy;
 PE.DeleteDataDirectoryEntry(IMAGE_DIRECTORY_ENTRY_BASERELOC,TRUE,TRUE);
 PE.NTHeaders.FileHeader.Characteristics:=PE.NTHeaders.FileHeader.Characteristics OR IMAGE_FILE_RELOCS_STRIPPED;
 PE.DeleteDataDirectoryEntry(IMAGE_DIRECTORY_ENTRY_DEBUG,TRUE,TRUE);
 PE.NTHeaders.FileHeader.Characteristics:=PE.NTHeaders.FileHeader.Characteristics OR IMAGE_FILE_DEBUG_STRIPPED;
 PE.DeleteDataDirectoryEntry(IMAGE_DIRECTORY_ENTRY_RESOURCE,TRUE,TRUE);
 FileStream:=TBeRoFileStream.CreateNew('SmallSynth.exe');
 PE.WriteImage(FileStream);
 FileStream.Destroy;
 PE.Destroy;
END.
