comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@bix.com (Tom Moran)
Subject: Re: Importing calls to access Windows registry
Date: 1999/05/07
Date: 1999-05-07T00:00:00+00:00	[thread overview]
Message-ID: <37331c0b.1253787@news.pacbell.net> (raw)
In-Reply-To: 7gulm9$20b$1@nnrp1.deja.com

The immediate answer to your link errors, as pointed out by
Sune Falck, is to add advapi32.lib to your link.

As a comment, I'd also suggest you can save yourself a lot of
typing and probably a lot of grief by using the package
Interfaces.C, instead of defining your own "windows_integer_type"
etc and using your own code to append nulls to Ada Strings and
using System.Address.

In Claw we (internally) use RegOpenKeyEx like
     function Reg_Open_Key_Ex(Key     :        Claw.Win32.HKey;
                              lpszSubKey:      Claw.Win32.Lpcstr;
                              dwReserved:      Claw.DWord := 0;
                              samDesired:      Key_Access_Options;
                              phkResult:       PHKey)
     return Reg_Error_Code_Type;
     pragma Import(Stdcall, Reg_Open_Key_Ex, "RegOpenKeyExA");
inside
    procedure Open (Key    : in out Key_Type;
                    Parent : in Key_Type;
                    Name   : in String;
                    Access_Capability : in Access_Capabilities :=
ALLOW_ALL_ACCESS;
                    Creation_Option : Creation_Options := Open_Only);
which uses it with
     C_Name : Interfaces.C.Char_Array
         := Interfaces.C.To_C(Name, Append_Nul=>True);
     Handle : aliased Claw.Win32.HKey;
...
     Result := Reg_Open_Key_Ex(Parent.Handle,
                                 C_Name(0)'Unchecked_Access,
                                 0,     -- reserved
                                 Access_Code(Access_Capability),
                                 Handle'Unchecked_Access);





  reply	other threads:[~1999-05-07  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-05-07  0:00 Importing calls to access Windows registry czgrr
1999-05-07  0:00 ` Tom Moran [this message]
1999-05-07  0:00   ` dennison
1999-05-07  0:00 ` Sune Falck
1999-05-11  0:00 ` czgrr
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox