Link to home
Start Free TrialLog in
Avatar of MikeMonroe
MikeMonroe

asked on

Registry

I have administrator account. I want to change the permissions for a registry key. I want all the users of a computer to be able to change a certain registry key through my program. How can I do that by Delphi programming? Please, help me.
Avatar of nafeelm
nafeelm

This is just to give you an idea how you could change information stored in the registry.


You will have to add the 'Registry' unit to the main uses clause.

procedure TMainForm.FormCreate(Sender: TObject);
var Reg: TRegistry;
begin
  Reg := TRegistry.Create;
  Reg.RootKey := HKEY_LOCAL_MACHINE;
  Reg.OpenKey('Software\Borland',False);

  //then you can use
  Reg.ReadString('variable name'); // to read info. from registry

  Reg.WriteString('variable', 'data value'); // to write info. into registry

  Reg.CloseKey;
  Reg.Free;
end;
The registry in NT has permissions just like files. They are set and modified using REGEDT32.EXE.

Browse to the keys or subkeys you want to modify, then select "Security", "Permissions" from the menus. Add permissions just like you would to files and folders, specifying "Replace permission on existing subkeys" if necessary.

To assign all possible permissions, select the root of "HKEY_LOCAL_MACHINE" and "HKEY_USERS". These are really the only 2 root keys. The others are derived.

Once the users have the proper registry permissions, then can use any method available to them to do what they need to do..be it directly using regedit or regedt32, or programmatically.

ASKER CERTIFIED SOLUTION
Avatar of tkalchev
tkalchev
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial