CPB Mailing List
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Problem With RegistryConnect()
Hello,
I wrote a program that would connect to a remote PC's registry and
return some keys but the RegistryConnect() fails every time. I am
running this as domain administrator under Windows NT 4.0 so
permissions shouldn't be an issue. I have listed some of the code
below. Any help would be appreciated.
Thanks,
Nick
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void __fastcall TForm1::Button1Click(TObject *Sender)
{
TStringList* pkgstrings = new TStringList();
TRegistry* reg = new TRegistry;
int count = 0;
Memo1->Clear();
if (Edit1->Text != NULL)
{
reg->RootKey = HKEY_LOCAL_MACHINE;
if (!reg->RegistryConnect(Edit1->Text))
{
ShowMessage("ERROR: Unable to connect to remote registry.");
} else {
if (!reg->OpenKey("SOFTWARE\\ESD\\package_list", false))
{
ShowMessage("ERROR: Unable to open registry key.");
} else {
reg->GetKeyNames(pkgstrings);
reg->CloseKey();
}
count = pkgstrings->Count;
if (count > 0)
{
for (int index = 0; index < count; index++)
{
Memo1->Lines->Add(pkgstrings->Strings[index]);
}
}
ShowMessage("Get Package List Completed.");
}
}
delete reg;
delete pkgstrings;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
W Komornicki's Home Page |
Main Index |
Thread Index