Форум: "Основная";
Текущий архив: 2003.12.30;
Скачать: [xml.tar.bz2];
ВнизПоиск по реестру Windows Найти похожие ветки
← →
Zhirnov Maxim (2003-12-12 20:50) [0]Здравствуйте.
Есть ли у кого-нибудь алгоритм поиска по реестру Windows, то пришлите мне, пожалуйста, на почту: Zhirnov5@mail.ru. Заранее благодарен.
С уважением, Жирнов Максим
← →
Zhirnov Maxim (2003-12-13 12:20) [1]пожалуйста, помогите мне...
← →
Zhirnov Maxim (2003-12-13 12:50) [2]Нижеследующий алгоритм не ищет в HKEY_LOCAL_MACHINE подскажите, пожалуйста, в чём тут дело? Через некоторое время после запуска он просто вываливается с сообщением об ошибке доступа к памяти. У меня Microsoft Windows XP, может ли она закрыть доступ к какому-либо разделу HKEY_LOCAL_MACHINE?
procedure FindStringRegistry(RootKey: HKEY; PathString: string; FindString: string; var OutList: TStringList);
var Reg: TRegistry;
SubKeys: TStringList;
ValueNames: TStringList;
i: integer;
begin
Reg := TRegistry.Create;
Reg.RootKey := RootKey;
Reg.OpenKey(PathString, false);
ValueNames := TStringList.Create;
Reg.GetValueNames(ValueNames);
for i := 0 to ValueNames.Count-1 do
if (Reg.GetDataType(ValueNames[i])=rdString) and (Reg.ReadString(ValueNames[i])=FindString) then
OutList.Add({HKey + "\" + }PathString + "\" + ValueNames[i]);
SubKeys := TStringList.Create;
Reg.GetKeyNames(SubKeys);
for i := 0 to SubKeys.Count-1 do
FindStringRegistry(RootKey, PathString + "\" + SubKeys[i], FindString, OutList);
end;
← →
Zhirnov Maxim (2003-12-13 14:39) [3]Всем ответившим, большое спасибо!!! :о)
Вот работающая версия вышеизложенного алгоритма:
procedure FindStringRegistry(RootKey: HKEY; PathString: string; FindString: string; var OutList: TStringList);
var Reg: TRegistry;
SubKeys: TStringList;
ValueNames: TStringList;
i: integer;
begin
Reg := TRegistry.Create;
Reg.RootKey := RootKey;
Reg.OpenKey(PathString, false);
ValueNames := TStringList.Create;
Reg.GetValueNames(ValueNames);
for i := 0 to ValueNames.Count-1 do
if (Reg.GetDataType(ValueNames[i])=rdString) and (Reg.ReadString(ValueNames[i])=FindString) then
OutList.Add({HKey + "\" + }PathString + "\" + ValueNames[i]);
SubKeys := TStringList.Create;
Reg.GetKeyNames(SubKeys);
for i := 0 to SubKeys.Count-1 do
if SubKeys[ i ] <> "" then
FindStringRegistry(RootKey, PathString + "\" + SubKeys[i], FindString, OutList);
end;
← →
Zhirnov Maxim (2003-12-15 17:37) [4]Вышеизложенный алгоритм, потребляет слишком много памяти... Если у кого-нибудь есть алгоритм поиска по реестру Windows, то пришлите мне, пожалуйста, на почту, очень прошу.
← →
Zhirnov Maxim (2003-12-16 21:13) [5]UP
← →
Zhirnov Maxim (2003-12-17 14:15) [6]Немного оптимизированный вариант вышеизложенного алгоритма. Если кто-то может его ещё оптимизировать, то подскажите мне, пожалуйста, в чём его ещё можно оптимизировать.
procedure FindStringRegistry(RootKey: HKEY; PathString: string; FindString: string; var OutList: TStringList);
var
Reg : TRegistry;
SubKeys : TStringList;
ValueNames : TStringList;
i : integer;
begin
Reg := TRegistry.Create;
Reg.RootKey := RootKey;
Reg.OpenKey( PathString, false );
ValueNames := TStringList.Create;
Reg.GetValueNames( ValueNames );
for i := 0 to ValueNames.Count - 1 do
if (Reg.GetDataType( ValueNames[ i ] ) = rdString ) and ( Reg.ReadString( ValueNames[ i ] ) = FindString) then
OutList.Add( PathString + "\" + ValueNames[ i ]);
SubKeys := TStringList.Create;
ValueNames.Free;
Reg.GetKeyNames( SubKeys );
Reg.Free;
for i := 0 to SubKeys.Count - 1 do
if SubKeys[ i ] <> "" then
FindStringRegistry(RootKey, PathString + "\" + SubKeys[ i ], FindString, OutList);
SubKeys.Free;
end;
Страницы: 1 вся ветка
Форум: "Основная";
Текущий архив: 2003.12.30;
Скачать: [xml.tar.bz2];
Память: 0.46 MB
Время: 0.007 c