VDF running as a Windows NT Service
by Frank G. Vandervelpen
This document explains step by step how to set up a Windows NT machine so that it is able to run a VDF application as an NT service. This means that the application will automatically run in the background when the computer is booted. The VDF application will even run without a logon.
|No Files Available
||Frank G. Vandervelpen
||Velpe Development bvba
Author: Frank G. Vandervelpen (Original published as a web White paper)
Ownership: Mutual project of Vandervelpen Systems and Antwise solutions
DataFlex-version: 4.0/5.0/6.0 (VDF)
e-Mail us @ email@example.com
VDF GUIdance is a mutual project of
Frank Vandervelpen - Vandervelpen Systems and
Wil van Antwerpen - Antwise Solutions
This code is part of «VDF GUIdance»
Visit us @ https://www.vdf-guidance.com
This document describes how to make a software program (VDF) run as a service on Microsoft Windows NT4.0.r.
There are a lot of reasons why this could be useful. Suppose we want a program to run continuously, even when someone is not logged in. This can be for the sake of security since it runs by itself under a system account. A second argument for this is because of system backups. It is sometimes difficult to make backups when software is running, locking databases and blocking the backup utility. A background service can be stopped and restarted automatically from any kind of NT timer.
This document can be used as a feedback document, but you have to double-check everything. We are not responsible for direct or indirect faults or loss to hardware, software or data on your information system.
We have done our project on a Windows NT 4.0 r Int'l Edition Server with Support Pack 3. In addition we have installed the Microsoft Windows NT 4.0 r Resource kit.
* Allow applications to survive logon/logoff sequences, hence saving the overhead of restarting them for each user that logs on.
- Allow server applications to come-up and operate even when no user is logged on.
- Increases security of your server, as it can handle requests from the logon screen. If the server should reboot, the service will start totally unattended.
- Allows applications to run and perform tasks in a specified account that is different from the current user who is logged into the system. The task runs with the permissions assigned by the specified account, not to the current user.
As far as I could understand you can not run a user-data entry and network aware software in one service. You have to make a choice between those.
- «Start-Run» SRVINSTW (Carriage Return)
- Option Install a Service
- Option Local Machine
- Give the Service a Name: i.e. vsService
- Please enter the full path for the executable: d:\projectname\programs\dfrun.exe
- Now you select the option: Service its own Process
- The next step lets you define the rights that are necessary to run the software: in your
case, the VDF program
i.e. System Account and we check the option: Allow service to interact with desktop. You
can also supply a specific account and his password
You and/or the local system
administrator are the best-qualified person to take this decision.
- The next step will determine the «startup» option for the service. The most
interesting is the «Automatic» option.
- The service will now finish the installation of the service.
- This task has made a certain registry key that you can eventually modify. Start the
«Registry» editing software. Browse towards the following key:
HKEY_LOCAL_MACHINE+SYSTEM+CURRENTCONTROLSET+SERVICES and look for the service name that
you have defined (i.e. vsService)
- Now, you have to make some manual changes to the keys. You always have to define
pathnames and stuff like that as a pointer towards local drives. We can not use any UNC
coding in this stage.
- Under the above registry key, you have to change the entry of the key ImagePath towards
something like "C:\ntResKit\srvany.exe"
- If you want the service to automatically load the key, Start should be 0x00000002
- Make a new sub-key under the above key. Call this one Parameters
- Under this, make a key (String Value) called Application and place directory and
executable name in it. (i.e. C:\vdf\dfrun.exe"
- Under this, make a key (String Value) called AppParameters and place the optional
parameters in it. (i.e. MyProject BTW this could be the key of your VDF project, or the
location of your VDF-program)
- Under this, make a key (String Value) called AppDirectory and place the working
directory in this one. Very important to find things back.
- The software is now defined as a service!
- Please check whether your Service Account User (Control Panel Services
YourService) is used by the account that has the proper rights (i.e.
MyDomain\Administrator) This is often a crucial element whether your service will run or