Однако, из выйти из ситуации можно воспользовавшись следующей функцией:
- Код: Выделить всё
procedure GetSubKeys(KeyName : String; SubKeysList : TStringList);
var
subKeyNameBuf : array [1 .. 300] of Char;
classNameBuf : array [1 .. 300] of Char;
subKeyLng : Cardinal;
classLng : Cardinal;
keyHndl : THandle;
index : Integer;
keyTime : TFileTime;
begin
SubKeysList.Clear();
if (RegOpenKeyEx(HKEY_CURRENT_USER,PWideChar(WideString(KeyName)),0,KEY_READ,keyHndl) = ERROR_SUCCESS) then
begin
index := 0;
FillChar(subKeyNameBuf,SizeOf(subKeyNameBuf),#0);
FillChar(classNameBuf,SizeOf(classNameBuf),#0);
subKeyLng := SizeOf(subKeyNameBuf);
classLng := SizeOf(classNameBuf);
while RegEnumKeyEx(keyHndl, // handle of key to enumerate
index, // index of subkey to enumerate
@subKeyNameBuf[1], // address of buffer for subkey name
subKeyLng, // address for size of subkey buffer
NIL, // reserved
@classNameBuf[1], // address of buffer for class string
@classLng, // address for size of class buffer
@keyTime // address for time key last written to
) = ERROR_SUCCESS do
begin
SubKeysList.Add(WideCharToString(@subKeyNameBuf[1]));
FillChar(subKeyNameBuf,SizeOf(subKeyNameBuf),#0);
FillChar(classNameBuf,SizeOf(classNameBuf),#0);
subKeyLng := SizeOf(subKeyNameBuf);
classLng := SizeOf(classNameBuf);
Inc(index);
end;
RegCloseKey(keyHndl);
end;
end;