Solved

NT4 service's permission to access registry.

Posted on 2000-05-07
3
189 Views
Last Modified: 2010-04-04
Hello there,

I have written NT service... After it is installed (NT4 WS, admin login) it causes errors every time it tries to read (same with write) some data from/to system registry. Other than that it works as expected but registry is the pain. Furthermore it writes the data to the root of the HKLM dispite the key I am trying to operate at... Seems I missing something obvious am I?? Like permissions etc. Any info will be appreciated. Thanks in advance!

Art.
0
Comment
Question by:_art_
3 Comments
 
LVL 14

Expert Comment

by:DragonSlayer
ID: 2785977
some code from your programme will help others understand it better, Art.
0
 
LVL 2

Expert Comment

by:mullet_attack
ID: 2786788
if you write the registry code in a normal exe, not a service, does it do as expected? maybe the problem is simply in the code, not in the fact it's a service.
0
 

Accepted Solution

by:
jolla earned 50 total points
ID: 2787516
As mullet writes: Have you checked that the registry access works in a "normal" program?
I have a service that does this in the ServiceStart event:
RegKey is a global:
  RegKey = '\SOFTWARE\TT\Standin\';

var
  RegConnect: TRegistry;
begin
  RegConnect := TRegistry.Create;
  RegConnect.RootKey := HKEY_LOCAL_MACHINE;
      if RegConnect.OpenKey(RegKey, FALSE) then begin
        Datapath := RegConnect.ReadString('Datapath');
        timer1.Interval := RegConnect.ReadInteger('Intervall')*1000;
        os1.logondatabase := RegConnect.ReadString('Database');
        os1.logonusername := RegConnect.ReadString('Username');
        os1.logonpassword := RegConnect.ReadString('Password');
        RegConnect.CloseKey;
[etc]

The keys need to exist I have noticed. So in the AfterInstall event I have a similar thing that creates the keys if they do not exist.
The service management box on the NT under Startup I have marked that it should log on as System Account.


0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now