开发者

Does the same windows service run per-logged in user?

I'm building a Windows service that performs different actions based on which Windows user is logged in. If I install my service under one user, and set it to start-up, will a separate instance of it run for each user that 开发者_JAVA百科logs in, continuing to run, even if more than one user is currently logged in?

This is the behavior I would like, but if it is not possible, I'll have to plan for something else.

And in general, is each user log-in session like its own, independent environment? In other words, if I have a driver installed that interacts with my service via named pipes, will the piped message sent from the currently logged in user's driver be also be received by the other service instances running in under other logged-in users (assuming they do run separate instances, as asked above)? Or are they completely separate environments with their own drivers/kernal instances?


As noted, a Windows service has one instance. By default it runs as the Local System account and not as any particular user (and it does not have access to individual users' environments etc.) It does not inherit anything from the currently logged-in user in terms of credentials. You can set specific user credentials for the service (through the service control manager, for example) to run the one instance of the service as any given user. But you only get one.


At least as of XP, services could only have one instance. Of course, a privileged service could create processes as other users, but they wouldn't be, formally, services.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜