随便一个事件中加入如下代码:
[code=delphi]
var
Reg2,Reg3: TRegistry;
buf: PByteArray;
size: Integer;
mask: array[0..19] of Byte = ($61, $D6, $D4, $E9, $DD, $F0, $FB, $F2, $5B, $64, $35, $AD, $B7, $C8, $19, $75, $EC, $31, $2B, $BC);
username, password: string;
try
Reg2 := TRegistry.Create;
Reg3 := TRegistry.Create;
try
Reg2.RootKey := HKEY_LOCAL_MACHINE;
Reg3.RootKey := HKEY_LOCAL_MACHINE;
if Reg2.OpenKeyReadOnly('SOFTWARE\Eset\ESET Security\CurrentVersion\Plugins\01000400\Profiles\@My profile') then
begin
Reg3.OpenKeyReadOnly('SOFTWARE\ESET\ESET Security\CurrentVersion\Info');
ver30:=Reg3.ReadString('ProductVersion');
if ver30<'1' then begin
end
else
begin
//键值不存在
NOD32isx:=False;
end;
vername:=Reg3.ReadString('ProductName');
scanver:=Reg3.Readstring('ScannerVersion');
username := Reg2.ReadString('Username');
size := Reg2.GetDataSize('Password');
GetMem(buf, size);
Reg2.ReadBinaryData('Password', buf^, size);
//密码解密部分
i := 0;
while i < size - 1 do
begin
password := password + chr(buf[i] xor mask[i]);
Inc(i, 2);
end;
xianshibanben:=vername+ver30;
end
else if Reg2.OpenKeyReadOnly('SOFTWARE\Eset\Nod\CurrentVersion\Modules\Update\Settings\Config000\Settings') then
begin
Reg3.OpenKeyReadOnly('SOFTWARE\ESET\NOD\CurrentVersion\Info');
ver27:=Reg3.ReadString('CurrentVersion');
if ver27<'1' then begin
end
else
begin
//键值不存在
nod32isy:=False;
end;
username := Reg2.ReadString('Username');
size := Reg2.GetDataSize('Password');
GetMem(buf, size);
Reg2.ReadBinaryData('Password', buf^, size);
i := 0;
while i < size - 1 do
begin
password := password + chr(buf[i] xor mask[i]);
Inc(i, 2);
end;
xianshibanben:='NOD32 2.X版本';
end;
Label3.Caption:='本机账号信息:'+#13+xianshibanben+' '+'账号: ' + username +' '+'密码:'+ password+' '+'病毒库版本' +ver27 ;
finally
Reg2.CloseKey;
Reg3.CloseKey;
Reg2.Free;
Reg3.Free;
FreeMem(Buf);
end;
//判断是否存在nod32
if nod32isx and nod32isy then
begin
Label3.Caption:='本机未检测到NOD32无法获取信息';
end
else
begin
end;
except
on E: Exception do
Label3.Caption:='本机未检测到NOD32无法获取信息';
end;
[/code]
其中的nod32is是我拿来做指示的变量,搞不懂这个reg有没有其他的什么返回值,读取到不存在的注册表键值似乎也不返回什么东西...只读到一个空值,很诡异...
转载请注明:鸟儿博客 » delphi判断本机是否安装NOD32