NT System Service

Hi,

I wonder if anyone can help me.

Ive written a small C++ program, and I need it to be run every time the
system starts, before login.
The program is a ‘heartbeat’ program, so this is necessary.

I have been told I need to run it as a service, but NT wont accept it as a
service, so I assume there is some code I need to put into the program to
allow this.

Any help would be appreciated,
Rob Tucker.


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

The documentation on writing services is very clear. Also, there is a book
from WROX Press by Marshall Brain (I think that’s his name) dealing with
Win32 system services. It has a very good chapter dealing with services as
well.

Greg

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of
robert.3.tucker@bt.com
Sent: Friday, August 24, 2001 7:17 AM
To: NT Developers Interest List
Subject: [ntdev] NT System Service

Hi,

I wonder if anyone can help me.

Ive written a small C++ program, and I need it to be run every time the
system starts, before login.
The program is a ‘heartbeat’ program, so this is necessary.

I have been told I need to run it as a service, but NT wont accept it as a
service, so I assume there is some code I need to put into the program to
allow this.

Any help would be appreciated,
Rob Tucker.


You are currently subscribed to ntdev as: xxxxx@pdq.net
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

The documentation where?

Thanks for your help.

Rob Tucker

-----Original Message-----
From: Gregory G. Dyess [mailto:xxxxx@pdq.net]
Sent: 24 August 2001 13:36
To: NT Developers Interest List
Subject: [ntdev] RE: NT System Service

The documentation on writing services is very clear. Also, there is a book
from WROX Press by Marshall Brain (I think that’s his name) dealing with
Win32 system services. It has a very good chapter dealing with services as
well.

Greg

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of
robert.3.tucker@bt.com
Sent: Friday, August 24, 2001 7:17 AM
To: NT Developers Interest List
Subject: [ntdev] NT System Service

Hi,

I wonder if anyone can help me.

Ive written a small C++ program, and I need it to be run every time the
system starts, before login.
The program is a ‘heartbeat’ program, so this is necessary.

I have been told I need to run it as a service, but NT wont accept it as a
service, so I assume there is some code I need to put into the program to
allow this.

Any help would be appreciated,
Rob Tucker.


You are currently subscribed to ntdev as: xxxxx@pdq.net
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: robert.3.tucker@bt.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

The Services’ documentation is also in MSDN Library.
http://msdn.microsoft.com/library/en-us/dllproc/hh/winbase/services_0p0z
.asp

Hope this helps
Paul

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of
robert.3.tucker@bt.com
Sent: Friday, August 24, 2001 3:44 PM
To: NT Developers Interest List
Subject: [ntdev] RE: NT System Service

The documentation where?

Thanks for your help.

Rob Tucker

-----Original Message-----
From: Gregory G. Dyess [mailto:xxxxx@pdq.net]
Sent: 24 August 2001 13:36
To: NT Developers Interest List
Subject: [ntdev] RE: NT System Service

The documentation on writing services is very clear. Also, there is a
book
from WROX Press by Marshall Brain (I think that’s his name) dealing with
Win32 system services. It has a very good chapter dealing with services
as
well.

Greg

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of
robert.3.tucker@bt.com
Sent: Friday, August 24, 2001 7:17 AM
To: NT Developers Interest List
Subject: [ntdev] NT System Service

Hi,

I wonder if anyone can help me.

Ive written a small C++ program, and I need it to be run every time the
system starts, before login.
The program is a ‘heartbeat’ program, so this is necessary.

I have been told I need to run it as a service, but NT wont accept it as
a
service, so I assume there is some code I need to put into the program
to
allow this.

Any help would be appreciated,
Rob Tucker.


You are currently subscribed to ntdev as: xxxxx@pdq.net
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: robert.3.tucker@bt.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@compelson.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Its ok, I found some resources online from that book you mentioned.
The service works great now.

Thanks a lot.

Rob Tucker

-----Original Message-----
From: robert.3.tucker@bt.com [mailto:robert.3.tucker@bt.com]
Sent: 24 August 2001 14:44
To: NT Developers Interest List
Subject: [ntdev] RE: NT System Service

The documentation where?

Thanks for your help.

Rob Tucker

-----Original Message-----
From: Gregory G. Dyess [mailto:xxxxx@pdq.net]
Sent: 24 August 2001 13:36
To: NT Developers Interest List
Subject: [ntdev] RE: NT System Service

The documentation on writing services is very clear. Also, there is a book
from WROX Press by Marshall Brain (I think that’s his name) dealing with
Win32 system services. It has a very good chapter dealing with services as
well.

Greg

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of
robert.3.tucker@bt.com
Sent: Friday, August 24, 2001 7:17 AM
To: NT Developers Interest List
Subject: [ntdev] NT System Service

Hi,

I wonder if anyone can help me.

Ive written a small C++ program, and I need it to be run every time the
system starts, before login.
The program is a ‘heartbeat’ program, so this is necessary.

I have been told I need to run it as a service, but NT wont accept it as a
service, so I assume there is some code I need to put into the program to
allow this.

Any help would be appreciated,
Rob Tucker.


You are currently subscribed to ntdev as: xxxxx@pdq.net
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: robert.3.tucker@bt.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: robert.3.tucker@bt.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

>>

A little effort on your part would have found it in the MSDN libraries.
Just search for “services” and start narrowing it down from there. There
are periodicals, service tutorials and partial books in addition to the API
descriptions and references. If you really want me to do your research for
you, here is the path to the services discussion in the reference manual:

Platform SDK\Base Services\DLLs, Processes and Threads\Services

Greg


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

See this link. Its an introduction for NT services with example

http://www.commsoft.com/services.html

Uma
CMOSChips Inc.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Gregory G. Dyess
Sent: Friday, August 24, 2001 11:23 AM
To: NT Developers Interest List
Subject: [ntdev] RE: NT System Service

<<>>

A little effort on your part would have found it in the MSDN libraries.
Just search for “services” and start narrowing it down from there. There
are periodicals, service tutorials and partial books in addition to the API
descriptions and references. If you really want me to do your research for
you, here is the path to the services discussion in the reference manual:

Platform SDK\Base Services\DLLs, Processes and Threads\Services

Greg


You are currently subscribed to ntdev as: xxxxx@cmoschips.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Robert,

My email account has been down for the past few day so I do not know
if you received an answer yet, if not here goes:

For an application to function as a service there are several things that
it needs to do:

  1. register itself with the SCM (service control manager)
  2. in main it must call StartServiceCtrlDispatcher() to
    connect the main thread of execution to the SCM
  3. implement ServiceMain() for each process in the service
  4. setup a handler to deal with stop/start/pause/continue requests

In addition, you may want to check the load time for your service and make
sure that it is loaded and running before a user logs in - this is not
a given. (I was working on a replacement for msgina.dll and wanted to
log events to the event log, however it turned out that sometimes the
logging worked and other times it did not. I eventually tracked this
down to the event service not fully running when a user was attempting
to log in).

For more informtion on developing services, check MSDN as well as

Miller, Kevin “Professional NT Services”, Wrox Publishers 1998
ISBN # 1-861001-30-4

(this is the only book on NT servies that I am aware of)

George Huber
Computer Scientist
SRI, International
phone: 732-427-8064
fax : 732-427-2065
xxxxx@mail1.monmouth.army.mil

-----Original Message-----
From: robert.3.tucker@bt.com [mailto:robert.3.tucker@bt.com]
Sent: Friday, August 24, 2001 8:17 AM
To: NT Developers Interest List
Subject: [ntdev] NT System Service

Hi,

I wonder if anyone can help me.

Ive written a small C++ program, and I need it to be run every time the
system starts, before login.
The program is a ‘heartbeat’ program, so this is necessary.

I have been told I need to run it as a service, but NT wont accept it as a
service, so I assume there is some code I need to put into the program to
allow this.

Any help would be appreciated,
Rob Tucker.


You are currently subscribed to ntdev as:
xxxxx@mail1.monmouth.army.mil
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

> For an application to function as a service there are several things that

it needs to do:

  1. register itself with the SCM (service control manager)
  2. in main it must call StartServiceCtrlDispatcher() to
    connect the main thread of execution to the SCM
  3. implement ServiceMain() for each process in the service
  4. setup a handler to deal with stop/start/pause/continue requests

ATL has a service skeleton. You can do the same as ATL does.

Max


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com