Ver Mensaje Individual
  #4  
Antiguo 04-11-2008
Avatar de cHackAll
[cHackAll] cHackAll is offline
Baneado?
 
Registrado: oct 2006
Posts: 2.159
Reputación: 22
cHackAll Va por buen camino
Dispositivos montados:

Código Delphi [-]
procedure TForm1.Button1Click(Sender: TObject);
var
 Str: string;
 Index, Pos: Integer;
begin
 ListBox1.Items.LoadFromFile('/etc/mtab');
 Index := 0;
 while Index < ListBox1.Count do
  begin
   Str := ListBox1.Items[Index];
   if Copy(Str, 1, 5) <> '/dev/' then
    ListBox1.Items.Delete(Index)
   else
    begin
     Pos := System.Pos(' ', Str);
     repeat Inc(Pos);
     until Str[Pos] = ' ';
     ListBox1.Items[Index] := Copy(Str, 1, Pos);
     Inc(Index);
    end;
  end;
end;

Dispositivos según sistema de archivos:

Código Delphi [-]
procedure TForm1.Button2Click(Sender: TObject);
var
 Str: string;
 Index, Pos: Integer;
begin
 ListBox1.Items.LoadFromFile('/etc/fstab');
 Index := 0;
 while Index < ListBox1.Count do
  begin
   Str := ListBox1.Items[Index];
   if (Str <> '') and (Str[1] = '#') then
    if (Index < (ListBox1.Count - 1)) and (Copy(ListBox1.Items[Index + 1], 1, 5) = 'UUID=') then
     begin
      Str := Copy(Str, 3, 255) + Copy(ListBox1.Items[Index + 1], 42, 255);
      ListBox1.Items.Delete(Index + 1);
     end
    else
     Str := '';
   if (Str = '') or (Str[1] <> '/') then
    ListBox1.Items.Delete(Index)
   else
    begin
     repeat Pos := System.Pos('  ', Str);
      if Pos <> 0 then
       Delete(Str, Pos, 1);
     until Pos = 0;
     Pos := System.Pos(' ', Str); // just the physical device and the mount point.
     repeat Inc(Pos);
     until Str[Pos] = ' ';
     ListBox1.Items[Index] := Copy(Str, 1, Pos);
     Inc(Index);
    end;
  end;
end;

Saludos
__________________
RTFM > STFW > Foro > Truco > Post > cHackAll > KeBugCheckEx

Última edición por cHackAll fecha: 04-11-2008 a las 02:50:30.
Responder Con Cita