jamesa
28-02-2005, 09:17 AM
Hello,
Maybe this is not so related with games, but it can be used as debugging tools.
Anyone can show me some code to output registry tree and its value ?
I got this code somewhere:
function readTree(rootKey: HKEY; startKey: string): TStringList;
var reg: TRegistry;
childKeys, valueList: TStringList;
i: integer;
begin
childKeys:=TStringList.Create;
valueList:=TStringList.Create;
result:=TStringList.Create;
reg:=TRegistry.Create;
reg.RootKey:=rootKey;
reg.OpenKey(startKey, false);
reg.GetKeyNames(childKeys);
reg.GetValueNames(valueList);
result.AddStrings(valueList);
for i:=0 to childKeys.count-1 do begin
result.AddStrings(readTree(rootKey, startKey + '\' + childKeys[i]));
end;
end;
Usage:
procedure TForm1.Button1Click(Sender: TObject);
begin
memo1.Text := readTree(HKEY_CURRENT_USER, '\Software\MySoftware\').Text;
end;
But it did not print the path and value.
Please if anyone can help me, I am stuck with this for 2 days now :(
Thanks.
Maybe this is not so related with games, but it can be used as debugging tools.
Anyone can show me some code to output registry tree and its value ?
I got this code somewhere:
function readTree(rootKey: HKEY; startKey: string): TStringList;
var reg: TRegistry;
childKeys, valueList: TStringList;
i: integer;
begin
childKeys:=TStringList.Create;
valueList:=TStringList.Create;
result:=TStringList.Create;
reg:=TRegistry.Create;
reg.RootKey:=rootKey;
reg.OpenKey(startKey, false);
reg.GetKeyNames(childKeys);
reg.GetValueNames(valueList);
result.AddStrings(valueList);
for i:=0 to childKeys.count-1 do begin
result.AddStrings(readTree(rootKey, startKey + '\' + childKeys[i]));
end;
end;
Usage:
procedure TForm1.Button1Click(Sender: TObject);
begin
memo1.Text := readTree(HKEY_CURRENT_USER, '\Software\MySoftware\').Text;
end;
But it did not print the path and value.
Please if anyone can help me, I am stuck with this for 2 days now :(
Thanks.