Win2k Services problem


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Win2k Services problem

  1. #1
    Brian Geddes Guest

    Win2k Services problem


    I'm writing a service in Win2k, and I'm having problems getting it to run.
    Here's the deal: if I run the service by executing it in Visual C++, it
    behaves normally (I inserted beeps and message boxes at various points in
    the code to confirm that it's running), and I can stop it in the Task Manager.
    However, if I start the service from dialog app (this is the final goal)
    using the Service Control Manager functions, it doesn't work. The service
    shows up as running in the Task Manager but doesn't actually do anything
    (no beeps or messages), and I can't stop the service in the Task Manager.
    The same problems occur when the service starts up automatically on boot.

    I'm pretty puzzled...any help would be greatly appreciated.

    Thanks!
    Brian Geddes

  2. #2
    Brian Geddes Guest

    Re: Win2k Services problem


    I just figured out part of the answer to my own question, but thought that
    I'd go ahead and post it just in case it might be of benefit to others.
    It turns out that when started outside of Visual Studio, the service was
    hanging up on the dialogs, because it wasn't allowed by the SCM to interact
    with the desktop. To fix this, when creating the service I set the SERVICE_INTERACTIVE_PROCESS
    flag, and the service now operates normally when started by another app.

    However, I still can't manually stop the service through the Task Manager...if
    anyone knows the answer to this part, I'd love to hear it.

    "Brian Geddes" <bgeddes@hotmail.com> wrote:
    >
    >I'm writing a service in Win2k, and I'm having problems getting it to run.
    > Here's the deal: if I run the service by executing it in Visual C++, it
    >behaves normally (I inserted beeps and message boxes at various points in
    >the code to confirm that it's running), and I can stop it in the Task Manager.
    > However, if I start the service from dialog app (this is the final goal)
    >using the Service Control Manager functions, it doesn't work. The service
    >shows up as running in the Task Manager but doesn't actually do anything
    >(no beeps or messages), and I can't stop the service in the Task Manager.
    > The same problems occur when the service starts up automatically on boot.
    >
    >I'm pretty puzzled...any help would be greatly appreciated.
    >
    >Thanks!
    >Brian Geddes



  3. #3
    Bob Rafuse Guest

    Re: Win2k Services problem

    > I just figured out part of the answer to my own question, but thought that
    > I'd go ahead and post it just in case it might be of benefit to others.
    > It turns out that when started outside of Visual Studio, the service was
    > hanging up on the dialogs, because it wasn't allowed by the SCM to

    interact
    > with the desktop. To fix this, when creating the service I set the

    SERVICE_INTERACTIVE_PROCESS
    > flag, and the service now operates normally when started by another app.
    >
    > However, I still can't manually stop the service through the Task

    Manager...if
    > anyone knows the answer to this part, I'd love to hear it.


    I see this all the time with the services I've written. The Task Manager
    "Access Denied" is most likely because the service is running under the
    LocalSystem account and you do not have sufficient priviledges to stop it
    via Task Manager.

    Bob.






  4. #4
    Bob Rafuse Guest

    Re: Win2k Services problem

    > I see this all the time with the services I've written. The Task Manager
    > "Access Denied" is most likely because the service is running under the
    > LocalSystem account and you do not have sufficient priviledges to stop it
    > via Task Manager.


    Oops. Premature send.

    Try the HandleEx utility from www.sysinternals.com. Its seems to let me
    kill processes running under LocalSystem where Task Manager does not, not to
    mention being a handy tool in its own right.

    Bob.





Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center