Am 23.08.2013 09:50, schrieb Michael Van Canneyt:


On Fri, 23 Aug 2013, Flávio Etrusco wrote:

On Thu, Aug 22, 2013 at 9:55 PM, waldo kitty <wkitt...@windstream.net> wrote:
On 8/22/2013 16:46, Liyuan Garcia Caballero wrote:

Hi guys,

I need access to remote registry of Microsoft Window and get a data,
it's posible with Pascal?


of course it is possible... the question is how are you expecting to be able
to perform this task...

Somebody can share one code?


no but possibly an idea or two... write a remote "server" that accesses the registry for whatever you want... then talk to it via a local "client"...

in reality, it should be no different than using ssh or rdp into the remote host and starting the remote machine's regedit or similar... capturing that
information and feeding it back across the link...

NOTE: i use the term "server" above because you are wanting to connect to a remote system and pull data from it... in the most general terms, that makes it a server... the connecting package on the local side is then considered a
client...



I guess he means this:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms724840%28v=vs.85%29.aspx

Currently this is not supported by FPC.

What needs to be done is implement

function TRegistry.RegistryConnect(const UNCName: string): Boolean;
begin
  Result := False;
end;

in packages/fcl-registry/src.

The function indicated by Flavio must be used for this.

So I'd guess that would be something like:

function TRegistry.RegistryConnect(const UNCName: string): Boolean;

Var
  Res : HKey;

begin
  Result := RegConnectRegistryA(PAnsiChar(UNCName),FRootKey,@HKey);
  if Result then
    FCurentKey:=Res;
end;

Not entirely. According to the Delphi documentation RootKey needs to be set instead of CurrentKey and also the key must be closed in the end. I've already done the implementation and I'm currently testing it. As a workaround for older FPC versions simply set RootKey to the value returned by RegConnectRegistry. Note: The login stuff mentioned on the MSDN page needs to be done nevertheless.

Regards,
Sven

--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to