I'm being frustrated by this problem.
Connecting to remote registry using RegistryConnect, I'm able to open one key and read a value, but not another key. The code for both is the same, same root, only the key name changes.
The really odd thing is, if I fire up RegEdit and connect remotely to the users' PC, I able to easily browse to either key and see their contents and values. I'm not changing the root, nor is the authentication different. I've tried using the same instance of TRegistry to read both, and then tried one for the first, then free it, then another one for the 2nd, and then free it. Either way, same result: I could read the first key, but not the second, even though I could RegEdit to either one. I've triple-checked the spelling of the key, and it's identical to the one I copy from RegEdit.
Anyone have any ideas as to what I can try next?
(The code will display the logon name, but will fail when trying to get 'Enabled'.)
procedure TForm1.Button1Click(Sender: TObject);
var RegFile : TRegistry;
connected, r1, r2 : boolean;
lun : string;
enabled : integer;
// partial code:
RegFile := TRegistry.Create;
RegFile.RootKey := HKEY_USERS;
connected := RegFile.RegistryConnect('\\hou-l0-kpeterso');
if connected then
r1 := RegFile.OpenKeyReadOnly('S-1-5-21-1715567821-484763869-839522115-98312\Software\Microsoft\Windows\CurrentVersion\Explorer');
lun := RegFile.ReadString('Logon User Name');
if not r1 then ShowMessage('first OpenKeyReadOnly failed')
else ShowMessage('Logon User Name: '+lun);
r2 := RegFile.OpenKeyReadOnly('S-1-5-21-1715567821-484763869-839522115-98312\Software\America Online\AOL Instant Messenger (TM)\CurrentVersion\Proxy');
if not r2 then ShowMessage('first OpenKeyReadOnly failed')
enabled := RegFile.ReadInteger('Enabled');
ShowMessage('Enabled = '+IntToStr(enabled));
else ShowMessage('not connected');