Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Trucos (https://www.clubdelphi.com/foros/forumdisplay.php?f=52)
-   -   Activar / Desactivar cache de escritura en Windows XP (https://www.clubdelphi.com/foros/showthread.php?t=80750)

Lepe 16-07-2006 11:02:28

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


La franja horaria es GMT +2. Ahora son las 20:30:10.

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