-
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
-
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
-
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.
-
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
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks