Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Go Back   Foros Club Delphi > Otros temas > Trucos
Register FAQ Members List Calendar Guía de estilo Search Today's Posts Mark Forums Read

Los mejores trucos

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08/06/2006
seoane's Avatar
[seoane] seoane is offline
Miembro Premium
 
Join Date: Feb 2004
Location: A Coruña, España
Posts: 3,717
Poder: 26
seoane Va por buen camino
Impedir el uso de memorias USB

A veces, por motivos de seguridad, necesitamos impedir el uso de memorias USB en un equipo. Esta funcion permite habilitar y deshabilitar el uso de las mismas:

Código Delphi [-]
procedure EnableUSB(Value: Boolean);
begin
  with TRegistry.Create do
  try
    RootKey:= HKEY_LOCAL_MACHINE;
    if OpenKey('\SYSTEM\CurrentControlSet\Services\USBSTOR',TRUE) then
    begin
      if Value then WriteInteger('Start',3)
        else WriteInteger('Start',4);
      CloseKey;
    end;
  finally
    Free;
  end;
end;

Ejemplo de uso:
Código Delphi [-]
  // Esto las deshabilita
  EnableUSB(FALSE);
  // Esto las vuelve a habilitar
  EnableUSB(TRUE);
  // Solo afecta a las memorias que se conecten despues
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT +2. The time now is 21:37.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi