Author: Joko Rivai
How to extract swf from Flash Projector
Answer:
1 procedure ExeToSWF(ExeFile, aSWF: string);
2 var
3 p: pointer;
4 f: file;
5 sz,
6 swfsize: integer;
7 const
8 SWF_FLAG: integer = $FA123456;
9 begin
10 if not fileexists(ExeFile) then
11 begin
12 messagebox(Application.Handle, pchar('File not found'), pchar('Error'),
13 MB_ICONERROR);
14 exit;
15 end;
16 assignfile(f, ExeFile);
17 reset(f, 1);
18 seek(f, filesize(f) - (2 * sizeof(integer)));
19 blockread(f, sz, sizeof(integer));
20 if sz <> swf_flag then
21 begin
22 messagebox(Application.Handle, pchar('Not a valid Projector Exe'),
23 pchar('Error'),
24 MB_ICONERROR);
25 closefile(f);
26 exit;
27 end;
28 blockread(f, swfsize, sizeof(integer));
29 seek(f, filesize(f) - (2 * sizeof(integer)) - swfsize);
30 getmem(p, swfsize);
31 blockread(f, p^, swfsize);
32 closefile(f);
33 assignfile(f, aSWF);
34 rewrite(f, 1);
35 blockwrite(f, p^, swfsize);
36 closefile(f);
37 freemem(p, swfsize);
38 messagebox(Application.Handle, pchar('SWF Extracted'), pchar('Succes'),
39 MB_ICONINFORMATION);
40 end;
41
42 Example:
43
44 procedure TForm1.Button1Click(Sender: TObject);
45 begin
46 ExeToSWF('C:Desktopflash.exe', 'C:Desktopf.swf');
47 end;
48
49 end.
|