Proteksi Flashdisk Dari Serangan Virus


Kadang ketika saya dari warnet untuk mengupload file atau sejenisnya, setibanya di rumah flashdisk terdapat tamu tak diundang, ga salah lagi pasti virus. Padahal antivirus di warnet sudah pake salah satu antivirus lokal yang suka mengeluarkan updatean, kok ga terdeteksi ya. Akhirnya capek lagi untuk mengcopy file-file program yang saya wajibkan di flashdisk) akhirnya saya menemukan program untuk memprotek flashdisk.


1. Buka notepad
2. Copy scrip di bawah lalu paste di notepad.



type
TForm1 = class(TForm)
Label1: TLabel;
Button1: TButton;
Label2: TLabel;
Label3: TLabel;
Button2: TButton;
procedure FormCreate(Sender: TObject);
procedure showCurrentStatus;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
const
regKey = ‘\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies’;
regValue = ‘WriteProtect’;
var
Form1: TForm1;
currentVal: integer;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
try
with TRegistry.Create do
begin
try
RootKey := HKEY_LOCAL_MACHINE;
if OpenKey(regKey, true) then
begin
if currentVal = 0 then
WriteInteger(regValue, 1)
else
WriteInteger(regValue, 0);
end;
finally
free;
end;
end;
except
on E:Exception do
begin
showmessage(’Error updating registry’);
end;
end;
showCurrentStatus;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
showCurrentStatus;
end;
procedure TForm1.showCurrentStatus;
begin
try
with TRegistry.Create do
begin
try
RootKey := HKEY_LOCAL_MACHINE;
if OpenKey(regKey, false) then
begin
currentVal := ReadInteger(regValue);
if currentVal = 0 then
label1.caption := ‘Current status: Your USB disk is now WRITEABLE’
else
label1.caption := ‘Current status: Your USB disk is now READ ONLY’;
end
else
begin
label1.caption := ‘There is no current setting for your USB disk.’;
currentVal := 0;
end;

0 komentar:

Posting Komentar

Diberdayakan oleh Blogger.

Copyright © / CYP's note

Template by : Urang-kurai / powered by :blogger