Services for Windows NT/2000 and Windows
95/98 |
|
Using the SvCom framework applications
that run as NT Services can be deployed under all 32 bit versions of Windows
i.e. 2000/NT/9x yes even Windows 95!
A Win 9x service emulator that is
included with SvCom provides this unique ability. This means that any
service you create using SvCom, on being executed will decide which platform it
is running on, if it is Win 9x it will simply run as a normal application,
otherwise it will run as a service
This service emulator for Win95/98 is
based on a dynamic library that is included in SvCom that emulates accurately
most NT Service features. Moreover SvCom includes an API that is similar to the
native NT services API. This API is designed to allow service management
without carrying about the operating system. Under NT this API passes all it's
calls to the native NT services API while under Win9x it processes all calls to
emulate behavior of the NT services API.
|
Development of services under Windows
NT/2000 and Windows 95/98 |
|
The SvCom components are designed to be
used both in Windows NT/2000 and Windows 95/98/ME. So you can use any of
mentioned systems to design your application.
The only limitation to using Win9x is
debugging and testing your service, as there is no NT services API on these
systems. But this is unlikely to cause you much of a problem, as SvCom will
recognize the operating system and allow you to run and test your NT Service as
if it were a normal application. Then when you later deploy it on an NT
machine it will run as a NT service without any code changes.
|
Advanced service debugging |
|
Debugging of SvCom-based services is far
easier than debugging services created without SvCom.
The standard advice for service debugging
using the Delphi VCL is to start your service from the Delphi IDE and then
quickly start the service using Control Panel. This is a nice trick but it is
not convenient and it does not often work (A service with DCOM server inside is
a good example).
SvCom includes a powerful built-in service
debugging tool. The idea of this tool is simple: if an SvCom-based application
is started with the "/debug" switch it starts as an ordinary executable. Now
the service will run in the debug mode exactly as it would as a service but
this time you can trace it as an ordinary application. Of course this can be
done on both WinNT and Win9x machines.
|
DCOM server in a service |
|
The SvCom includes it`s own ActiveX
framework. It is partially based on native Delphi ActiveX framework but has
some serious differences. All SvCom class factories know about SvCom
services, this makes it possible to implement a DCOM server that will live in a
service. SvCom takes care of all necessary registry keys and COM
initialization. SvCom-based DCOM servers automatically support pausing and
stopping, it is even possible to have several services in one application with
several DCOM servers in each service. What's more SvCom wizards
make DCOM server in service creation as easy as possible.
|
Interactive services |
|
The Delphi VCL was not designed to
create interactive services. The reason being that it uses some system
information that changes when interactive user logs off and logs on again. This
will cause any forms that are created after a logoff/logon appear damaged.
SvCom includes component that protects
service forms from being damaged even if logoff/logon occurs several times.
|
Configurable services |
|
SvCom's internal design allows several
instances of one service module to be created and then used as independent
services. Of course the names and some other attributes of each instance should
be changed to avoid problems with operating system.
Note, that with Delphi's service
implementation it is not possible to use several instances of one
TService descendant.
|
Service and windows messages |
|
Standard services have no window handles at
all, so the only way to send a message to this kind of service is to send it to
the service thread. SvCom-base services do not have this limitation and are
able to receive and process messages. Therefore it is possible to write a
message handler for a service which will be called when the service receives
the corresponding message.
|
Specialized timer component |
|
SvCom includes specialized timer
component that will work in a service. This automatically detects a service
being started or stopped causing an OnTimer event to occur in the service
thread. Just drop it onto an SvCom service module and it is ready for
use. If this component is dropped onto the form or an other module then it
functions exactly the same as Delphi's timer.
|
SID, ACL, SD... |
|
The Windows NT security model includes a
lot of objects and rules concerning the use of these objects. Most of these
objects are variable-length records and their manipulation is additionally
complicated by memory allocations and deallocation.
This means that even simple tasks can
require quite complicated code to accommodate the NT security model. Most of
these objects are variable-length records and their manipulation is
additionally complicated by memory allocations and deallocation. SvCom includes
a set of components to deal with NT security objects such as SID, ACL,
SECURITY_DESCRIPTOR and so on. In addition components are provided to control
user privileges and access NT secret data storage. These components take care
of the correct memory allocation for security objects and conversion of their
representation. This greatly simplifies the manipulation of NT security
objects.
|
Security editor dialog |
|
SvCom's non-visual security components
provide an easy way to deal with NT security objects. Visual
security-related SvCom components provide all levels of functionality
that are necessary to design a user`s interface.
For example, SvCom includes the security
descriptor editor dialog. This is a configurable component that can be used to
adjust security of any NT securable object. It's security-editing capabilities
are much powerful then NT 4.0 and comparable with NT 2000.
|
Is there an interactive user? |
|
SvCom includes non-visual component that
detects when the interactive user logs on or off. There are no standard
API to solve this task. Microsoft recommendation is to analyze the list of
running processes to answer this question. This is the method is employed by
SvCom and it works both in WinNT and Win9x.
|
List of processes |
|
Windows NT/2000 and Windows 95/98 supply
different API to obtain the list of running processes. SvCom includes simple
function that works both in WinNT and Win9x and returns the list of processes
in the string list.
|
Utils and tools |
|
SvCom includes several applications that
are useful for service development. They include
- Service Indicator - application that sits in tray and
shows the state of one selected service and allows control of it;
- Service Controller - command line service control
tool for Windows NT/2000 and Windows 95/98
|