This repository has been archived by the owner on Jan 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Unblock.pas
128 lines (116 loc) · 3.28 KB
/
Unblock.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
unit Unblock;
interface
uses
Winapi.Windows, Winapi.Messages, SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.WinXCtrls, Vcl.StdCtrls, ShellAPI, Registry;
type
TForm6 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
procedure FormActivate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form6: TForm6;
implementation
{$R *.dfm}
function FullRemoveDir(Dir: string; DeleteAllFilesAndFolders,
StopIfNotAllDeleted, RemoveRoot: boolean): Boolean;
var
i: Integer;
SRec: TSearchRec;
FN: string;
begin
Result := False;
if not DirectoryExists(Dir) then
exit;
Result := True;
// Äîáàâëÿåì ñëýø â êîíöå è çàäàåì ìàñêó - "âñå ôàéëû è äèðåêòîðèè"
Dir := IncludeTrailingBackslash(Dir);
i := FindFirst(Dir + '*', faAnyFile, SRec);
try
while i = 0 do
begin
// Ïîëó÷àåì ïîëíûé ïóòü ê ôàéëó èëè äèðåêòîðèþ
FN := Dir + SRec.Name;
// Åñëè ýòî äèðåêòîðèÿ
if SRec.Attr = faDirectory then
begin
// Ðåêóðñèâíûé âûçîâ ýòîé æå ôóíêöèè ñ êëþ÷îì óäàëåíèÿ êîðíÿ
if (SRec.Name <> '') and (SRec.Name <> '.') and (SRec.Name <> '..') then
begin
if DeleteAllFilesAndFolders then
FileSetAttr(FN, faArchive);
Result := FullRemoveDir(FN, DeleteAllFilesAndFolders,
StopIfNotAllDeleted, True);
if not Result and StopIfNotAllDeleted then
exit;
end;
end
else // Èíà÷å óäàëÿåì ôàéë
begin
if DeleteAllFilesAndFolders then
FileSetAttr(FN, faArchive);
Result := SysUtils.DeleteFile(FN);
if not Result and StopIfNotAllDeleted then
exit;
end;
// Áåðåì ñëåäóþùèé ôàéë èëè äèðåêòîðèþ
i := FindNext(SRec);
end;
finally
SysUtils.FindClose(SRec);
end;
if not Result then
exit;
if RemoveRoot then // Åñëè íåîáõîäèìî óäàëèòü êîðåíü - óäàëÿåì
if not RemoveDir(Dir) then
Result := false;
end;
procedure DisableTaskMgr(Disable: Boolean);
var
reg: TRegistry;
begin
reg := TRegistry.Create;
reg.RootKey := HKEY_CURRENT_USER;
reg.OpenKey('Software', True);
reg.OpenKey('Microsoft', True);
reg.OpenKey('Windows', True);
reg.OpenKey('CurrentVersion', True);
reg.OpenKey('Policies', True);
reg.OpenKey('System', True);
if Disable then
reg.WriteString('DisableTaskMgr', '1') //áëîêèðåóì
else
reg.WriteString('DisableTaskMgr', '0'); //ðàçáëîêèðóåì
reg.CloseKey;
end;
procedure TForm6.FormActivate(Sender: TObject);
var
oneactivate: integer;
begin
if oneactivate = 1
then
else
begin
DisableTaskMgr(false);
ShellExecute(Handle, 'open','c:\windows\system32\cmd.exe', '/c taskkill /f /im explorer.exe', nil,SW_HIDE);
ShellExecute(Handle, 'open','c:\windows\help\UnLogOn.exe', nil, nil,SW_HIDE);
sleep(2500);
ShellExecute(Handle, 'open','c:\windows\help\ReSAW.exe', nil, nil,SW_HIDE);
FullRemoveDir('C:\SAW',true,true,true);
sleep(15000);
ShellExecute(Handle, 'open','c:\windows\explorer.exe',nil, nil,SW_HIDE);
sleep(1000);
Application.Terminate;
oneactivate:= 1;
end;
end;
end.