function TForm1.GetComms:TStrings;
var
reg: TRegistry;
st: Tstrings;
rt: TStrings;
i: Integer;
begin
reg := TRegistry.Create;
try
reg.RootKey := HKEY_LOCAL_MACHINE;
reg.OpenKey('hardware/devicemap/serialcomm', False);
st := TstringList.Create;
rt := TStringList.Create;
try
reg.GetValueNames(st);
for i := 0 to st.Count - 1 do
rt.Add(reg.Readstring(st.strings));
Result := rt;
finally
st.Free;
//rt.Free;
end;
reg.CloseKey;
finally
reg.Free;
end;
end;