Mirror

Extract swf from Flash Projector (EXE) (Views: 13)


Problem/Question/Abstract:

How to extract swf from Flash Projector

Answer:

procedure ExeToSWF(ExeFile, aSWF: string);
var
  p: pointer;
  f: file;
  sz,
    swfsize: integer;
const
  SWF_FLAG: integer = $FA123456;
begin
  if not fileexists(ExeFile) then
  begin
    messagebox(Application.Handle, pchar('File not found'), pchar('Error'),
      MB_ICONERROR);
    exit;
  end;
  assignfile(f, ExeFile);
  reset(f, 1);
  seek(f, filesize(f) - (2 * sizeof(integer)));
  blockread(f, sz, sizeof(integer));
  if sz <> swf_flag then
  begin
    messagebox(Application.Handle, pchar('Not a valid Projector Exe'), pchar('Error'),
      MB_ICONERROR);
    closefile(f);
    exit;
  end;
  blockread(f, swfsize, sizeof(integer));
  seek(f, filesize(f) - (2 * sizeof(integer)) - swfsize);
  getmem(p, swfsize);
  blockread(f, p^, swfsize);
  closefile(f);
  assignfile(f, aSWF);
  rewrite(f, 1);
  blockwrite(f, p^, swfsize);
  closefile(f);
  freemem(p, swfsize);
  messagebox(Application.Handle, pchar('SWF Extracted'), pchar('Succes'),
    MB_ICONINFORMATION);
end;

Example:

procedure TForm1.Button1Click(Sender: TObject);
begin
  ExeToSWF('C:Desktopflash.exe', 'C:Desktopf.swf');
end;

end.

<< Back to main page