Article View: borland.public.cppbuilder.nativeapi
Article #16108Re: Troubles with services
From: Remy Lebeau (TeamB)
Date: Fri, 30 May 2003 16:29
Date: Fri, 30 May 2003 16:29
38 lines
2921 bytes
2921 bytes
"Stefano Bonifazi" <stefboombastic@libero.it> wrote in message news:3ed711ab$1@newsgroups.borland.com... > Well that works fine with HKEY_LOCAL_MACHINE key, > but I'd need to access to the HKEY_CURRENT_USER By default, service's run in the LocalSystem account, which allows them to run outside of the context of any user login session. However, HKEY_CURRENT_USER is only accessible once a user actually logs in. The only way to gain access to HKCU from a service is to either: 1) manually log in a specific user account via LogonUser() function 2) detemine if the user is already currently logged in, grab its security tokens, and adjust the tokens of your own calling thread to impersonate the user. Note that with the introduction of XP's "Fast User Switching" feature, this may become even more complicated since multiple users can be logged in at the same time now. and my service reports a different tree, I don't know > whose user is that, but none of the user I've installed on my machine!!:( When no user is logged in yet, any access to HKCU is going to go to HKEY_USERS\.DEFAULT since the current user's key has not been loaded yet. > ... And another matter is that I can't access to some user files with some > access restrictions even if I've installed the service as administrator, and > than run it under the same user/administrator!!;( The LocalSystem account has full access to the entire machine. If, on the other hand, you configured the service to run under a specific user account, then the service is restricted to whatever the user account is restricted to. Gambit
Technical Details
Message-ID:
<3ed7865e$3@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!border3.nntp.aus1.giganews.com!small1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<3ed1e176@newsgroups.borland.com> <3ed28fd7$1@newsgroups.borland.com> <3ed3a8c4@newsgroups.borland.com> <3ed3b644$4@newsgroups.borland.com> <3ed46301@newsgroups.borland.com> <3ed4eda2$1@newsgroups.borland.com> <3ed5d3fa@newsgroups.borland.com> <3ed65152$1@newsgroups.borland.com> <3ed711ab$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,2bef8d34fe764e59 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-05-30 10:08:54 PST From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3ed1e176@newsgroups.borland.com> <3ed28fd7$1@newsgroups.borland.com> <3ed3a8c4@newsgroups.borland.com> <3ed3b644$4@newsgroups.borland.com> <3ed46301@newsgroups.borland.com> <3ed4eda2$1@newsgroups.borland.com> <3ed5d3fa@newsgroups.borland.com> <3ed65152$1@newsgroups.borland.com> <3ed711ab$1@newsgroups.borland.com> Subject: Re: Troubles with services Date: Fri, 30 May 2003 09:29:58 -0700 Lines: 40 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 207.175.226.26 Message-ID: <3ed7865e$3@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1054312030 207.175.226.26 (30 May 2003 09:27:10 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!border3.nntp.aus1.giganews.com!small1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail