|
信息军队-上等兵

|
1#
大 中
小 发表于 2008-3-6 14:59 只看该作者
岁月专版 auto病毒保护~︶︶ㄣ
岁月专版 auto病毒保护~︶︶ㄣ
公布下原代码。。呵呵。。当然有参考一些网络代码。。但是呢个是100%属于自己写的。。现在跟大家分享下。。
{*******************************************************}
{ U盘病毒免疫器 }
{ 版权所有 (C) 2007 by:☆六月的雨☆~︶︶ㄣ }
{ 请注明出处 }
{ Http://jaketlv.com.cn }
{*******************************************************}
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, jpeg,shellapi, WinSkinData,
Menus;
const
WM_TRAYNOTIFY=2000;
type
TForm1 = class(TForm)
SkinData1: TSkinData;
GroupBox1: TGroupBox;
RadioButton1: TRadioButton;
Button1: TButton;
PopupMenu1: TPopupMenu;
N1: TMenuItem;
N2: TMenuItem;
GroupBox2: TGroupBox;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure RadioButton1Click(Sender: TObject);
procedure wmTrayNotify(var Msg:TMessage);message WM_TRAYNOTIFY;
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure N1Click(Sender: TObject);
procedure N2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
Nid:TNotifyIconData;//定义ICON结构
implementation
{$R *.dfm}
var
DriveString:array[0..15] of string;
s:array[0..max_path] of char;
Win_dir:string;
//------------------------------------------------------------------------------------------
procedure TForm1.wmTrayNotify(var Msg:TMessage);
var
p:TPoint;
begin
if(Msg.lparam=WM_LBUTTONDBLCLK) then
begin
ShowWindow(Application.Handle,SW_SHOW);
Application.Restore;
end else
if(Msg.LParam=WM_RButtonUp) then
begin
GetCursorPos(P);//获得鼠标坐标
PopupMenu1.Popup(P.X, P.Y);//在鼠标光标处显示弹出菜单
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
n:integer;
cmdtext:string;
rel:integer;
begin
//在选择盘符创建免疫文件
if RadioButton1.Checked=true then
begin
//全盘免疫
for n:=0 to 15 do
begin
if DriveString[n]<>'' then
begin
if FileExists(DriveString[n]+'autorun.inf')then
begin
setfileattributes(PChar(DriveString[n]+'autorun.inf'),file_attribute_normal);
deletefile(DriveString[n]+'autorun.inf');
end;
CreateDir(DriveString[n]+'autorun.inf');
cmdtext:=Win_dir+'\system32\cmd.exe /c md '+DriveString[n]+'autorun.inf';
rel:=WinExec(PChar(cmdtext),sw_HIDE);
end;
end;
if rel>31 then
messagebox(handle,PChar('免疫成功'),PChar('提示'),MB_OK);
end;
begin
//选择免疫
end;
end;
//------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------
procedure TForm1.FormCreate(Sender: TObject);
var
k:Integer;
i:integer;
C:string;
DType:integer;
begin
//初始化盘符
for i:= 65 to 90 do
begin
C := chr(i)+':\';
DType := GetDriveType(PChar(C));
case DType of
DRIVE_REMOVABLE: DriveString[i-65]:=C;
DRIVE_FIXED: DriveString[i-65]:=C;
end;
end;
GetWindowsDirectory(s,Sizeof(s));
Win_dir:=strpas(@s[0]);
//showmessage(Win_dir);
Nid.cbSize:=sizeof(TNotifyIconData);
Nid.Wnd:=Form1.Handle;
Nid.uID:=1000;
Nid.uFlags:=NIF_MESSAGE or NIF_ICON or NIF_TIP;
Nid.uCallbackMessage:=WM_TRAYNOTIFY;
Nid.hIcon:=Application.Icon.Handle;
Nid.szTip:='U盘AUTO病毒免疫器'; //托盘图标文字提示
Shell_NotifyIcon(NIM_ADD,@Nid); //显示托盘图标
end;
//------------------------------------------------------------------------------------------
procedure TForm1.RadioButton1Click(Sender: TObject);
begin
//RadioButton2.Checked:=false;
end;
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
CanClose:=false;
application.Minimize();
Form1.Hide();
end;
procedure TForm1.N1Click(Sender: TObject);
var
j:integer;
cmdtext:string;
begin
//删除免疫文件
if (RadioButton1.Checked=true) then
begin
//全盘删除
for j:=0 to 15 do
begin
if DriveString[j]<>'' then
begin
cmdtext:=Win_dir+'\system32\cmd.exe /c rd '+DriveString[j]+'autorun.inf';
WinExec(PChar(cmdtext),sw_hide);
RemoveDirectory(PChar(DriveString[j]+'autorun.inf'));
end;
end;
messagebox(handle,PChar('程序已经退出保护'),PChar('提示'),MB_OK);
end;
ShellExecute(Handle,'Open',PChar('http://bbs.syue.com/'),
nil,nil,SW_SHOWNORMAL);
Nid.cbSize:=sizeof(TNotifyIconData);
Nid.Wnd:=Form1.Handle;
shell_notifyicona(NIM_DELETE, @Nid); //删除托盘图标
application.Terminate(); //结束程序
end;
procedure TForm1.N2Click(Sender: TObject);
begin
showmessage('============================'+#13#10+
'IT技术交流群︶︶ㄣ①QQ群:24820685'+#13#10+
'IT技术交流群︶︶ㄣ②QQ群:12232440'#13#10+#13#10+
'小城大爱~︶︶ㄣQQ群:15637808'+#13#10+
'技术联盟︶︶ㄣ QQ群:25152957(需要审核)'+#13#10+#13#10+
'→群网站:jaketlv.com.cn 群内进行统一管理~'+#13#10+
'请大家统一改名~开头统一是“┌IT→”多谢合作︶︶ㄣ'+#13#10+#13#10+
'制作时间:2007年2月14日'+#13#10+#13#10+'程序制作人 by:☆六月的雨☆~︶︶ㄣ QQ:365123467'+#13#10+
'==================================')
end;
end. 版本加入了API函数还有一关闭程序会自动连接岁月网站..呵呵..这样
一来可以增加网站人气而来又可以保护防autorun.inf引起的脚本病毒~︶︶ㄣ
[ 本帖最后由 六月的雨~︶︶ㄣ 于 2008-3-7 08:00 编辑 ]
附件: 您所在的用户组无法下载或查看附件
|