Solved

NT4 service's permission to access registry.

Posted on 2000-05-07
3
190 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
find a node in VST 2 63
Delphi 2 48
Adoquery sql  left join does not work 25 80
How to build JSON File in Delphi 6 3 11
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

911 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

20 Experts available now in Live!

Get 1:1 Help Now