VDF running as a Windows NT Service
by Frank G. Vandervelpen
Summary
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 |
Date Created: |
20/09/1999 |
Date Updated: |
20/09/1999 |
Author: |
Frank G. Vandervelpen
|
Company: |
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 @ info@vdf-guidance.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
Purpose
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.
Responsibility
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.
Requirements
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
not.
REGEDIT4
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WANExchange]
"Type"=dword:00000110
"Start"=dword:00000002
"ErrorControl"=dword:00000001
"DisplayName"="WANExchange"
"ObjectName"="LocalSystem"
"ImagePath"=hex(2):63,3a,5c,6e,74,52,65,73,6b,69,74,5c,73,72,76,61,6e,79,2e,65,\
78,65,00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WANExchange\Parameters]
"AppParameters"="WANexchange.vdf"
"AppDirectory"="H:\\accoflex\\mits\\wan\\programs\\"
"Application"="H:\\accoflex\\Mits\\Wan\\Programs\\Dfrun.exe"
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WANExchange\Security]
"Security"=hex:01,00,14,80,c0,00,00,00,cc,00,00,00,14,00,00,00,34,00,00,00,02,\
00,20,00,01,00,00,00,02,80,18,00,ff,01,0f,00,01,01,00,00,00,00,00,01,00,00,\
00,00,20,02,00,00,02,00,8c,00,05,00,00,00,00,00,18,00,8d,01,02,00,01,01,00,\
00,00,00,00,01,00,00,00,00,f8,00,14,00,00,00,1c,00,fd,01,02,00,01,02,00,00,\
00,00,00,05,20,00,00,00,23,02,00,00,06,00,00,00,00,00,1c,00,ff,01,0f,00,01,\
02,00,00,00,00,00,05,20,00,00,00,20,02,00,00,06,00,00,00,00,00,1c,00,ff,01,\
0f,00,01,02,00,00,00,00,00,05,20,00,00,00,25,02,00,00,06,00,00,00,00,00,18,\
00,fd,01,02,00,01,01,00,00,00,00,00,05,12,00,00,00,25,02,00,00,01,01,00,00,\
00,00,00,05,12,00,00,00,01,01,00,00,00,00,00,05,12,00,00,00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WANExchange\Enum]
"0"="Root\\LEGACY_WANEXCHANGE\\0000"
"Count"=dword:00000001
"NextInstance"=dword:00000001
|