Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

NT4 service's permission to access registry.

Posted on 2000-05-07
3
Medium Priority
?
199 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 100 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

824 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