Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   Registro de windows remoto (https://www.clubdelphi.com/foros/showthread.php?t=35946)

sammyrano 27-09-2006 00:23:03

Registro de windows remoto
 
Hola a todos.

Tengo una duda para lograr leer el registro de una máquina de manera remota. Hata el momento he checado la librería TRegistry, pero no he encontrado una manera de conseguir leer un equipo remoto. Principalmente lo que deseo realizar es obtener las claves de windows y uso la siguiente tarea:

Código:


Código Delphi [-]
function View_Win_Key: string;
begin
  Reg := TRegistry.Create;
  try
    Reg.RootKey := HKEY_LOCAL_MACHINE;
    if Reg.OpenKeyReadOnly('\SOFTWARE\Microsoft\Windows NT\CurrentVersion') then
    begin
      if Reg.GetDataType('DigitalProductId') = rdBinary then
      begin
        PN        := (Reg.ReadString('ProductName'));
        PID        := (Reg.ReadString('ProductID'));
        binarySize := Reg.GetDataSize('DigitalProductId');
        SetLength(HexBuf, binarySize);
        if binarySize > 0 then
        begin
          Reg.ReadBinaryData('DigitalProductId', HexBuf[0], binarySize);
        end;
      end;
    end;
  finally
    FreeAndNil(Reg);
  end;
  Result := '';
  Result := DecodeProductKey(HexBuf);
end;


seoane 27-09-2006 02:03:08

Prueba con algo como esto:

Código Delphi [-]
function View_Win_Key(UNCName: string): string;
var
  Size: Integer;
  HexSrc: array of Byte;
begin
  Result:= '';
  with TRegistry.Create do
  try
    RootKey:= HKEY_LOCAL_MACHINE;
    // Esta es la instruccion que supongo que buscabas
    if RegistryConnect(UNCName) then
    begin
      if OpenKeyReadOnly('\SOFTWARE\Microsoft\Windows NT\CurrentVersion') then
      begin
        Size:= GetDataSize('DigitalProductId');
        SetLength(HexSrc,Size);
        ReadBinaryData('DigitalProductId',HexSrc[0],Size);
        Result:= DecodeProductKey(HexSrc);
        CloseKey;
      end;
    end;
  finally
    Free;
  end;
end;


// Por ejemplo
ShowMessage(View_Win_Key('\\192.168.0.10'));


La franja horaria es GMT +2. Ahora son las 13:14: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