Ver Mensaje Individual
  #1  
Antiguo 16-07-2006
Avatar de Lepe
[Lepe] Lepe is offline
Miembro Premium
 
Registrado: may 2003
Posts: 7.424
Reputación: 28
Lepe Va por buen camino
Activar / Desactivar cache de escritura en Windows XP

Por algún lado he encontrado este "truco", no soy autor del mismo.

Puede ser útil en determinadas ocasiones, como por ejemplo al usar Paradox en red, donde hay que desactivar la caché en los ordenadores "clientes"

Código Delphi [-]
uses registry;

procedure TForm1.btCacheSegundoPlanoClick(Sender: TObject);
var r:TRegistry;
begin
//HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\FileSystem\
//   DriveWriteBehind = 00 (DWORD)
Memo1.Lines.Add('');
Memo1.Lines.Add('CACHE DE ESCRITURA EN SEGUNDO PLANO');
Memo1.Lines.Add('-----------------------------------');
Memo1.Lines.Add('Desactive la cache en los ordenadores clientes.');
Memo1.Lines.Add('');
  r := TRegistry.Create;
  r.RootKey := HKEY_LOCAL_MACHINE;
  if r.openkey('\System\CurrentControlSet\Control\FileSystem\',False) then
  begin
    if r.ValueExists('DriveWriteBehind') then
    begin
      Memo1.Lines.Add('valor: '+ IntToStr(r.Readinteger('DriveWriteBehind')));
      Memo1.Lines.Add(' Cero es interpretado como "cache desactivada"');
    end
    else
      Memo1.Lines.Add('La cache se encuentra activada');
  end
  else
  begin
    Memo1.Lines.Add('No existe ruta de registro para la cache');
    Memo1.Lines.Add('RUTA: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\FileSystem\');
  end;


end;

procedure TForm1.btDesactivarCacheClick(Sender: TObject);
var r:TRegistry;
begin
//HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\FileSystem\
//   DriveWriteBehind = 00 (DWORD)
Memo1.Lines.Add('');
Memo1.Lines.Add('CACHE DE ESCRITURA EN SEGUNDO PLANO');
Memo1.Lines.Add('-----------------------------------');
  r := TRegistry.Create;
  try
  r.RootKey := HKEY_LOCAL_MACHINE;
  if r.openkey('\System\CurrentControlSet\Control\FileSystem\',True) then
  begin
      r.WriteInteger('DriveWriteBehind',00);
      Memo1.Lines.Add('Cache deshabilitada, valor cero');
  end;
  finally
    r.CloseKey;
  end;
end;

Saludos
Responder Con Cita