procedure bloquearUSB;
var
reg : TRegistry;
begin
reg := TRegistry.create;
with reg do begin
RootKey := HKEY_LOCAL_MACHINE;
if OpenKey('\SYSTEM\CurrentControlSet\Services\UsbStor',false) then begin
reg.WriteInteger('Start',4);//quatro bloqueia
reg.WriteString('ImagePath','_system32\DRIVERS\USBSTOR.SYS');//caminho do arquivo que o windows usa para montar a unidade usb
end;
CloseKey;
end;
end;
Procedure desbloquearUSB;
var
reg : Tregistry;
begin
reg := TRegistry.Create;
with reg do begin
RootKey := HKEY_LOCAL_MACHINE;
if OpenKey('\SYSTEM\CurrentControlSet\Services\UsbStor',false) then begin
reg.WriteInteger('Start',3);//tres desbloqueia
reg.WriteString('ImagePath','system32\DRIVERS\USBSTOR.SYS');//caminho do arquivo que o windows usa para montar a unidade usb
end;
end;
end;
//qualquer dúvida: joaopaulo_jpo@hotmail.com