-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathAntiFreeze.pas
89 lines (73 loc) · 1.61 KB
/
AntiFreeze.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
77
78
79
80
81
82
83
84
85
86
87
88
89
unit AntiFreeze;
interface
uses sysutils,windows,typestuff;
procedure AFstart;
procedure AFquit;
procedure AFtick;
procedure AFUPstart(elbaszando:pointer);//mint antifreeze unpause
procedure AFUPquit;
implementation
var
AFgtcvolt:cardinal;
AFquitb:boolean;
AFupquitb:boolean;
function antifreezethread(nulla:pointer):integer;
begin
result:=0;
AFgtcvolt:=gettickcount;
repeat
sleep(500);
until AFquitb or ((AFgtcvolt+5000)<gettickcount);
if not AFquitb then
begin
messagebox(0,PChar('Sorry, but the software has frozen. Now closing'),'Freeze',MB_SETFOREGROUND);
writeln(logfile,'Software freezed');
writeln(logfile,'Last state: ',laststate);
writeln(logfile,'Freeze at:',formatdatetime('yyyy.mm.dd/hh:nn:ss',date+time));
closefile(logfile);
exitprocess(0);
end;
end;
procedure AFstart;
var
tID:cardinal;
begin
afquitb:=false;
beginthread(nil,0,antifreezethread,nil,0,tID);
end;
procedure AFtick;
begin
AFgtcvolt:=gettickcount;
end;
procedure AFquit;
begin
AFquitb:=true;
end;
var
bassz_el:pdword;
function antifreezeunpausethread(ures:pointer):integer;
var
gtc,gtcu:cardinal;
begin
result:=0;
gtc:=gettickcount;
repeat
sleep(100);
gtcu:=gettickcount;
if (gtc<gtcu-1000) then bassz_el^:=$D3AD1EE8;
gtc:=gtcu;
until AFUPquitb;
end;
procedure AFUPstart(elbaszando:pointer);//mint antifreeze unpause
var
tID:cardinal;
begin
bassz_el:=elbaszando;
beginthread(nil,0,antifreezeunpausethread,nil,0,tID);
setthreadpriority(tid,THREAD_PRIORITY_HIGHEST );
end;
procedure AFUPquit;
begin
AFUPquitb:=true;
end;
end.