Einzelnen Beitrag anzeigen

Landogar-Garuno

Registriert seit: 22. Feb 2008
36 Beiträge
 
#5

AW: Registry auslesen GetValueNames + ReadRegBinary

  Alt 5. Jan 2011, 18:12
benutze diese funktion
Delphi-Quellcode:
function ReadRegBinary(Key: HKEY; Name: string; var Buffer; BufSize: Integer): integer;
var
  DataType: Integer;
  Status: integer;
begin
  result := -1;
  DataType := REG_NONE;
  try
    // return the size of the buffer required
    if BufSize = 0 then begin
    // get data type and buffer size
      Status := RegQueryValueEx(Key, PChar(Name), nil, @DataType, nil, @BufSize);
      if Status = ERROR_SUCCESS then begin
        result := BufSize;
      end;
    end else begin
      // get data
      if RegQueryValueEx(Key, PChar(Name), nil, @DataType, PByte(Buffer),
         @BufSize) = ERROR_SUCCESS then result := BufSize
      else result := -1;
    end;
  except
    result := -1;
  end;
end;
  Mit Zitat antworten Zitat