Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

NT4 service's permission to access registry.

Posted on 2000-05-07
3
Medium Priority
?
197 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_
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

722 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