Thread View: borland.public.cppbuilder.nativeapi
3 messages
3 total messages
Started by Simon Macneall
Fri, 14 Mar 2003 05:19
Run Service under a given user
Author: Simon Macneall
Date: Fri, 14 Mar 2003 05:19
Date: Fri, 14 Mar 2003 05:19
10 lines
1120 bytes
1120 bytes
Hi, Our service application needs to be run under a given user account (needs access to mapped drives). We can set this manually, but would really like it to be an automagic process. Does anyone know how to set the log on as property of a service through the API (or even a definative, "It can't be done" would help). Thanks Simon
Re: Run Service under a given user
Author: Remy Lebeau (TeamB)
Date: Fri, 14 Mar 2003 06:25
Date: Fri, 14 Mar 2003 06:25
35 lines
2587 bytes
2587 bytes
What you ask for would require you to alter the service's configuration. You can't just start the service programmably with a given user account directly. You need to either 1) use the SCM to manually change the account, 2) specify the account programmably via CreateService() if installing the service programmably, or else 3) use the ChangeServiceConfig() function to alter an existing service. Also note that if you are using Borland's TService class, it has a ServiceStartName property that you can set at design-time, which gets applied when the TService is installed (which calls CreateService() internally) Also note that Win2K and XP both have pre-defined accounts specifically designed (albeit more limited than the LocalSystem account) to allow services access to the network, rather than needing to use an actual user account. They are named "NT_AUTHORITY\LocalService" and "NT_AUTHORITY\NetworkService". Also note that as an alternative, the service can manually log in to a user account via LogonUser() and then impersonate the user via ImpersonateLoggedOnUser() in order to gain access to the network without having to alter the service's configuration. Gambit "Simon Macneall" <macneall-at-iinet.net.au> wrote in message news:Xns933E87F54F0B0macnealliinetnetau@207.105.83.65... > Our service application needs to be run under a given > user account (needs access to mapped drives). We can set > this manually, but would really like it to be an automagic > process. Does anyone know how to set the log on as > property of a service through the API (or even a > definative, "It can't be done" would help).
Re: Run Service under a given user
Author: Simon Macneall
Date: Mon, 17 Mar 2003 00:24
Date: Mon, 17 Mar 2003 00:24
16 lines
1466 bytes
1466 bytes
"Remy Lebeau \(TeamB\)" <gambit47@yahoo.com> wrote in news:3e7173b0$1@newsgroups.borland.com: > What you ask for would require you to alter the service's > configuration. You can't just start the service programmably with a > given user account directly. You need to either 1) use the SCM to > manually change the account, 2) specify the account programmably via > CreateService() if installing the service programmably, or else 3) use > the ChangeServiceConfig() function to alter an existing service. > Thanks Gambit, One of those solutions should suit us Simon
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads