function GetRegSubTree( MainKey : LongInt; var aList : TStringList; aKey :
string ) : Boolean;
var
hRoot : HKEY;
lItem : LongInt;
hError : LongInt;
szKey,pData : PChar;
aString : String;
begin
GetRegSubTree:=false;
if aList=Nil then exit;
{create pointers for the API}
szKey := StrAlloc( Length( aKey ) + 1 );
StrPCopy( szKey, aKey );
lItem := 0;
pData := StrAlloc( 1024 );
hError := RegOpenKey( MainKey, szKey, hRoot );
if hError = ERROR_SUCCESS then
begin
while (hError = ERROR_SUCCESS) do
begin
hError := RegEnumKey( hRoot, lItem, pData, 1024 );
if (hError = ERROR_SUCCESS) then
begin
GetRegSubTree:=true;
aList.Add( StrPas( pData ));
Inc(lItem);
end;
end;
RegCloseKey( hRoot );
end;
StrDispose( szKey );
StrDispose( pData );
end;