Habilitar e desabilitar USB  

Posted by: Paulo Bezerra in



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
//quatro bloqueia
reg.WriteInteger('Start', 4);
//caminho do arquivo que o windows usa para montar a unidade usb
reg.WriteString('ImagePath', '_system32\DRIVERS\USBSTOR.SYS');
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
//tres desbloqueia
reg.WriteInteger('Start', 3);
//caminho do arquivo que o windows usa para montar a unidade usb
reg.WriteString('ImagePath', 'system32\DRIVERS\USBSTOR.SYS');
end;

end;

end;

This entry was posted on 11:10 and is filed under . You can leave a response and follow any responses to this entry through the Assinar: Postar comentários (Atom) .

0 comentários

Postar um comentário