Solved

Packaging a 'system' service for NT/2K

Posted on 2002-03-19
8
140 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
Independent Software Vendors: 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Excel VBA, find a string in a column, update a cell 7 115
Copy a row 12 74
Visual Studio search word table and return Cell index 8 83
Advice in Xamarin 21 118
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

734 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