Subversion Repositories decoder

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 daniel-mar 1
unit Config;
2
 
3
interface
4
 
5
uses
6
  Windows, Messages, SysUtils, Forms, shellapi, registry, inifiles, DCConst,
7
  ExtCtrls, StdCtrls, ComCtrls, Controls, Classes;
8
 
9
type
10
  TConfigForm = class(TForm)
11
    btn_close: TButton;
12
    lbl_info1: TLabel;
13
    lbl_info2: TLabel;
14
    grp_system: TGroupBox;
15
    img_information: TImage;
16
    tmr_timer: TTimer;
17
    sys_checkbox1: TCheckBox;
18
    sys_checkbox2: TCheckBox;
19
    sys_checkbox3: TCheckBox;
20
    sys_checkbox4: TCheckBox;
21
    grp_keylogger: TGroupBox;
22
    lbl_key_info: TLabel;
23
    edt_garbarge: TEdit;
24
    upd_garbarge: TUpDown;
25
    lbl_bytes: TLabel;
26
    procedure btn_close_click(Sender: TObject);
27
    procedure form_create(Sender: TObject);
28
    procedure timer_timer(Sender: TObject);
29
    procedure sys_checkbox1_click(Sender: TObject);
30
    procedure sys_checkbox2_click(Sender: TObject);
31
    procedure sys_checkbox3_click(Sender: TObject);
32
    procedure sys_checkbox4_click(Sender: TObject);
33
    procedure form_show(Sender: TObject);
34
    procedure form_hide(Sender: TObject);
35
    procedure upd_garbargeClick(Sender: TObject; Button: TUDBtnType);
36
  private
37
    LangArray: array of TLanguageEntry;
38
    function GetLangEntry(name: string): string;
39
  end;
40
 
41
var
42
  ConfigForm: TConfigForm;
43
 
44
implementation
45
 
46
uses Main;
47
 
48
{$R *.dfm}
49
 
50
function TConfigForm.GetLangEntry(name: string): string;
51
var
52
  i: integer;
53
begin
54
  for i := 0 to high(LangArray) do
55
  begin
56
    if LangArray[i].name = name then
57
    begin
58
      result := LangArray[i].text;
59
      break;
60
    end;
61
  end;
62
end;
63
 
64
procedure TConfigForm.timer_timer(Sender: TObject);
65
var
66
  Reg: TRegistry;
67
begin
68
  sys_checkbox1.OnClick := nil;
69
  sys_checkbox2.OnClick := nil;
70
  sys_checkbox3.OnClick := nil;
71
  sys_checkbox4.OnClick := nil;
72
  Reg := TRegistry.Create;
73
  try
74
    Reg.RootKey := HKEY_CLASSES_ROOT;
75
    sys_checkbox1.checked := Reg.KeyExists('.dc4') and Reg.KeyExists('DeCoder4-File');
76
    sys_checkbox2.checked := Reg.KeyExists('*\shellex\ContextMenuHandlers\(De)Coder') and Reg.KeyExists('*\shellex\ContextMenuHandlers\(De)Coder');
77
    sys_checkbox3.checked := Reg.KeyExists('*\shellex\ContextMenuHandlers\(De)Coder-Erase') and Reg.KeyExists('*\shellex\ContextMenuHandlers\(De)Coder-Erase');
78
    sys_checkbox4.checked := Reg.KeyExists('CLSID\{54069E5A-C471-4B68-835C-FC845E64040B}');
79
    Reg.RootKey := HKEY_CURRENT_USER;
80
    if Reg.OpenKey('SOFTWARE\ViaThinkSoft\(De)Coder\', true) then
81
    begin
82
      if not reg.ValueExists('GarbargeCount') then
83
        reg.WriteInteger('GarbargeCount', StdGarbarge);
84
      upd_garbarge.Position := reg.ReadInteger('GarbargeCount');
85
      edt_garbarge.Text := inttostr(upd_garbarge.Position);
86
      reg.CloseKey;
87
    end;
88
  finally
89
    Reg.free;
90
  end;
91
  sys_checkbox1.OnClick := sys_checkbox1_click;
92
  sys_checkbox2.OnClick := sys_checkbox2_click;
93
  sys_checkbox3.OnClick := sys_checkbox3_click;
94
  sys_checkbox4.OnClick := sys_checkbox4_click;
95
end;
96
 
97
procedure TConfigForm.upd_garbargeClick(Sender: TObject; Button: TUDBtnType);
98
var
99
  reg: tregistry;
100
begin
101
  edt_garbarge.Text := inttostr(upd_garbarge.Position);
102
  reg := tregistry.Create;
103
  try
104
    reg.RootKey := HKEY_CURRENT_USER;
105
    if reg.OpenKey('SOFTWARE\ViaThinkSoft\(De)Coder\', true) then
106
    begin
107
      reg.WriteInteger('GarbargeCount', upd_garbarge.Position);
108
      reg.CloseKey;
109
    end;
110
  finally
111
    reg.free;
112
  end;
113
end;
114
 
115
procedure TConfigForm.btn_close_click(Sender: TObject);
116
begin
117
  close;
118
end;
119
 
120
procedure TConfigForm.sys_checkbox1_click(Sender: TObject);
121
begin
122
  if fileexists(extractfilepath(application.ExeName)+activator) then
123
  begin
124
    if sys_checkbox1.Checked then
125
      shellexecute(application.Handle, 'open', pchar(extractfilepath(application.ExeName)+activator), pchar('/typereg .dc4 "'+application.exename+'" 1 DeCoder4-File "'+Format(GetLangEntry('dc4file'), [DC4Ver])+'"'), pchar(extractfilepath(application.exename)), sw_normal)
126
    else
127
      shellexecute(application.Handle, 'open', pchar(extractfilepath(application.ExeName)+activator), pchar('/typeunreg .dc4'), pchar(extractfilepath(application.exename)), sw_normal);
128
  end;
129
end;
130
 
131
procedure TConfigForm.sys_checkbox2_click(Sender: TObject);
132
begin
133
  if fileexists(extractfilepath(application.ExeName)+activator) then
134
  begin
135
    if sys_checkbox2.Checked then
136
      shellexecute(application.Handle, 'open', pchar(extractfilepath(application.ExeName)+activator), pchar('/dllreg "'+extractfilepath(application.exename)+'ShlExt.dll"'), pchar(extractfilepath(application.ExeName)), sw_normal)
137
    else
138
      shellexecute(application.Handle, 'open', pchar(extractfilepath(application.ExeName)+activator), pchar('/dllunreg "'+extractfilepath(application.exename)+'ShlExt.dll"'), pchar(extractfilepath(application.ExeName)), sw_normal);
139
  end;
140
end;
141
 
142
procedure TConfigForm.sys_checkbox3_click(Sender: TObject);
143
begin
144
  if fileexists(extractfilepath(application.ExeName)+activator) then
145
  begin
146
    if sys_checkbox3.Checked then
147
      shellexecute(application.Handle, 'open', pchar(extractfilepath(application.ExeName)+activator), pchar('/dllreg "'+extractfilepath(application.exename)+'ShlErase.dll"'), pchar(extractfilepath(application.ExeName)), sw_normal)
148
    else
149
      shellexecute(application.Handle, 'open', pchar(extractfilepath(application.ExeName)+activator), pchar('/dllunreg "'+extractfilepath(application.exename)+'ShlErase.dll"'), pchar(extractfilepath(application.ExeName)), sw_normal);
150
  end;
151
end;
152
 
153
procedure TConfigForm.sys_checkbox4_click(Sender: TObject);
154
begin
155
  if fileexists(extractfilepath(application.ExeName)+activator) then
156
  begin
157
    if sys_checkbox4.Checked then
158
      shellexecute(application.Handle, 'open', pchar(extractfilepath(application.ExeName)+activator), pchar('/dllreg "'+extractfilepath(application.exename)+'SecureMoveExt.dll"'), pchar(extractfilepath(application.ExeName)), sw_normal)
159
    else
160
      shellexecute(application.Handle, 'open', pchar(extractfilepath(application.ExeName)+activator), pchar('/dllunreg "'+extractfilepath(application.exename)+'SecureMoveExt.dll"'), pchar(extractfilepath(application.ExeName)), sw_normal);
161
  end;
162
end;
163
 
164
procedure TConfigForm.form_hide(Sender: TObject);
165
begin
166
  tmr_timer.Enabled := false;
167
end;
168
 
169
procedure TConfigForm.form_show(Sender: TObject);
170
begin
171
  tmr_timer.Enabled := true;
172
  timer_timer(self);
173
end;
174
 
175
procedure TConfigForm.form_create(Sender: TObject);
176
var
177
  ini: TIniFile;
178
  str: TStringList;
179
  i, temp: integer;
180
begin
181
  // Sprachdatei auslesen
182
 
183
  ini := TIniFile.Create(ExtractFilePath(Application.ExeName)+'Language.ini');
184
  str := TStringList.Create();
185
  try
186
    ini.ReadSection(Name, str);
187
    for i := 0 to str.count-1 do
188
    begin
189
      setlength(LangArray, length(LangArray)+1);
190
      LangArray[length(LangArray)-1].name := str.strings[i];
191
      LangArray[length(LangArray)-1].text := ini.ReadString(name, str.strings[i], '?');
192
      LangArray[length(LangArray)-1].text := StringReplace(LangArray[length(LangArray)-1].text, '###', #13#10, [rfReplaceAll]);
193
    end;
194
  finally
195
    ini.free;
196
    str.Free;
197
  end;
198
 
199
  // Formular vorbereiten
200
 
201
  lbl_info1.Caption := GetLangEntry('confinfo1');
202
  lbl_info2.Caption := GetLangEntry('restartinfo');
203
  lbl_key_info.Caption := Format(GetLangEntry('keyinfo'), [StdGarbarge]);
204
  grp_system.Caption := GetLangEntry('operatingsystem');
205
  grp_keylogger.Caption := GetLangEntry('keycapt');
206
  btn_close.Caption := GetLangEntry('close');
207
  lbl_bytes.Caption := GetLangEntry('bytes');
208
 
209
  sys_checkbox1.Caption := GetLangEntry('confinfo2');
210
  sys_checkbox2.Caption := GetLangEntry('confinfo3');
211
  sys_checkbox3.Caption := GetLangEntry('confinfo4');
212
  sys_checkbox4.Caption := GetLangEntry('confinfo5');
213
 
214
  caption := GetLangEntry('caption');
215
  icon.LoadFromResourceID(hInstance, 103);
216
  img_information.Picture.Bitmap.LoadFromResourceName(hInstance, 'Information');
217
 
218
  // Bei verschiedenen Sprachen gibt es verschiedene Label-Größen!
219
  // Leider gibt es bei TCheckBox keine Zeilenumbrüche oder AutoSize
220
 
221
  // Vertikale Anpassung
222
 
223
  sys_checkbox1.Top := lbl_info1.Top + lbl_info1.Height + 16;
224
  sys_checkbox2.top := sys_checkbox1.top + sys_checkbox1.Height;
225
  sys_checkbox3.top := sys_checkbox2.top + sys_checkbox2.Height;
226
  sys_checkbox4.top := sys_checkbox3.top + sys_checkbox3.Height;
227
  img_information.top := sys_checkbox4.top + sys_checkbox4.height + 16;
228
  lbl_info2.top := img_information.top;
229
  grp_system.Height := lbl_info2.Top + lbl_info2.Height + 16;
230
  upd_garbarge.Top := lbl_key_info.Top + lbl_key_info.Height + 8;
231
  grp_keylogger.Height := upd_garbarge.Top + upd_garbarge.Height + 16;
232
  edt_garbarge.Top := upd_garbarge.Top;
233
  upd_garbarge.Height := edt_garbarge.Height;
234
  grp_keylogger.top := grp_system.Top + grp_system.Height + 8;
235
  btn_close.top := grp_keylogger.Top + grp_keylogger.Height + 8;
236
  clientheight := btn_close.Top + btn_close.Height + 8;
237
  lbl_bytes.top := upd_garbarge.top + upd_garbarge.Height div 2 - lbl_bytes.Height div 2;
238
 
239
  // Horizontale Anpassung
240
 
241
  temp := max_3(lbl_info1.width, lbl_info2.Width+img_information.width+(lbl_info2.left-img_information.left-img_information.width), lbl_key_info.Width);
242
  sys_checkbox1.Width := temp;
243
  sys_checkbox2.Width := temp;
244
  sys_checkbox3.Width := temp;
245
  sys_checkbox4.Width := temp;
246
  grp_system.Width := temp + 32;
247
  grp_keylogger.Width :=  grp_system.Width;
248
  upd_garbarge.Left := edt_garbarge.Left + edt_garbarge.Width + 1;
249
  clientwidth := grp_system.Left + grp_system.Width + 8;
250
  btn_close.Left := clientwidth div 2 - btn_close.width div 2;
251
 
252
  // Werte
253
 
254
  edt_garbarge.Text := inttostr(upd_garbarge.Position);
255
  timer_timer(self);
256
end;
257
 
258
end.