Solved

Packaging a 'system' service for NT/2K

Posted on 2002-03-19
8
136 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
  • 4
  • 4
8 Comments
 
LVL 7

Expert Comment

by:Z_Beeblebrox
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 7

Expert Comment

by:Z_Beeblebrox
Comment Utility
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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 1

Author Comment

by:superchook
Comment Utility
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
Comment Utility
Honestly I don't know what guarantees there are about resource availability on startup.

Zaphod.
0
 
LVL 1

Author Comment

by:superchook
Comment Utility
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
Comment Utility
Thanks,

Zaphod.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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 need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

744 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now