Solved

Packaging a 'system' service for NT/2K

Posted on 2002-03-19
8
141 Views
Last Modified: 2011-09-20
I have developed an app - which runs fine as a service, but I would like to make it a 'system' service that runs immediately after boot (no user login required).

I have tried the obvious, (start=automatic), but this only provides a start event after a user logs in...

I will start this off at 100 pts for a straight answer to get my app running as a system bootup service, but will add (100 each) for the two following enhancements.

option 1)  After boot/start service...   display a systray icon - indicating the service status for any logged-in users

option 2)  Allow a maintenance applet to be run by an adequately authenticated user to display forms / modify states / pause/stop the service.

0
Comment
Question by:superchook
[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
  • 4
  • 4
8 Comments
 
LVL 7

Expert Comment

by:Z_Beeblebrox
ID: 6881296
What do you mean it only provides a start event? What is a start event? AFAIK no matter which user you run the service as, if you set it to automatic, it will start with Windows, regardless of whether someone logs in. You should note that it is possible to log into windows before all services have had time to start, maybe this is the behaviour you are experiencing?

Zaphod.
0
 
LVL 1

Author Comment

by:superchook
ID: 6881317
Sorry - my mention of a 'start event' was referring to the NTService_Start 'pseudo event' exposed by the NTService.ocx control.

From what I can understand, this is fired when the app is launched by the NT service manager.

Your comment about late start vs login is appreciated... I did consider it, but will check again when I'm in front of the machine later today.  I honestly didn't wait very long... and I know that some system tasks take quite a while to complete after bootup.
0
 
LVL 1

Author Comment

by:superchook
ID: 6881629
Z_Beeblebrox ...

No - the service just isn't starting...
In fact - my earlier observations were on an earlier development version... coded in a completely diferent way.

The current EXE will install and uninstall as a service...  will manually start & run properly as a service (or as a desktop application) - but will NOT auto start under any conditions as a service.

If the setting is Manual or Automatic, it appears in the list of services as 'blank' status (i.e. not 'Started'), and waits for me to START it manually.

Once started, it hides away in the background and does exactly what it should.


0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 7

Expert Comment

by:Z_Beeblebrox
ID: 6881661
Hi,

Is anything getting logged to the event log? If not, the only thing I can think of is that for some reason your service is crashing after it registers itself as started with the Service Control Manager. If this happened, then the scenario you describe would occur. Some reasons that it might crash are that it tries to access a network resource before it is available, it tries to access another service before that service has started...

Hope that helps.

Zaphod.
0
 
LVL 1

Author Comment

by:superchook
ID: 6881677
Aha ! that's possible...
I'll look into that and perhaps put a delay in to the initialisation.  Answer tomorrow

The app actually initialises and starts TWO Media Encoder instances - one to a TCP/IP port, and another to a local file.  So it has a fairly large hit on resources during startup.

Perhaps the networking isn't up yet - when it tries to start.. I had assumed that user added services would only be started after the OS was stable.. ??
0
 
LVL 7

Accepted Solution

by:
Z_Beeblebrox earned 100 total points
ID: 6881687
Honestly I don't know what guarantees there are about resource availability on startup.

Zaphod.
0
 
LVL 1

Author Comment

by:superchook
ID: 7036282
Sorry for the delay in responding...

As it turns out, one of the OEM drivers I am using has it's config stored in the CURRENT_USER keys of the registry.  Of course - before login, there is no current user - so the driver fails, and passes it's problen back up the chain i.e. the service fails.

As the answer was not a definitive solution, but you did help me look in the right places...

0
 
LVL 7

Expert Comment

by:Z_Beeblebrox
ID: 7036294
Thanks,

Zaphod.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

691 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