Link to home
Start Free TrialLog in
Avatar of Madhura122398
Madhura122398

asked on

How to stop a running NT service?

Hi,
 We have an NT service running with a Java program as the process. We have prepared the NT service in C - program.
The question is when we press the "stop" for that NT Service, the services dialog is still showing that service as running.. If we try to start that service again immediately, it is giving an error.
 How to STOP a running service from the program?
Please reply as soon as possible,.

Thanks
Madhura
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Madhura122398
Madhura122398

ASKER

Thnk you very much
This is working absolutely fine.
We have one more problem.
In some NT systems the Start of the service is giving DrWatson error. The exception is AccessViolation.
When starting and stopping the service we are logging into some log file which would be created in the winnt\system32 directory.
Does it cause any problem? What can be the reason?
Please reply asap.
Thanks in advance.
>>Does it cause any problem? What can
>>be the reason?

Logging should be no problem, unless you don't use the log file for several facilities - if so, you'll have to synchronize access to the file.

The reason for an access violation can be a variety of things, most likely is accessing memory through an uninitialized pointer...
jkr, do you recommend any books for this type stuff?
No, sorry, I can't - I prefer the 'learning by doing method', so all I could recommend is MSDN and the SDK docs...