🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.delphi.nativeapi.win32
3 messages
3 total messages Started by Adrien Reboisson Thu, 10 Jul 2008 19:01
SHGetFolderPath() from a service application
#172
Author: Adrien Reboisson
Date: Thu, 10 Jul 2008 19:01
20 lines
1550 bytes
Hi,

I'm trying to get paths (CSIDL_MYDOCUMENTS, CSIDL_DESKTOP and 
CSIDL_PROFILE) for all the interactive users from a service application 
running in the LocalSystem account.

SHGetFolderPath() takes a hToken parameter, which "can be used to 
represent a particular user". Is there another solution than calling 
LogonUser() to generate this token ? To call LogonUser(), knowing the 
user password is compulsory, and I want to avoid to store any password 
in my application.

I know how to enumerate the users, but I don't see exactly how I could 
fetch the paths I need without knowing each user's password.

Any hint appreciated !

Regards,

A.R.
Re: SHGetFolderPath() from a service application
#173
Author: Remy Lebeau (TeamB)
Date: Thu, 10 Jul 2008 20:42
24 lines
1945 bytes
"Adrien Reboisson" <adrien-reboissonATastaseDOTcom@lala.com> wrote in 
message news:48765cb5@newsgroups.borland.com...

> I'm trying to get paths (CSIDL_MYDOCUMENTS, CSIDL_DESKTOP
> and CSIDL_PROFILE) for all the interactive users from a service
> application running in the LocalSystem account.

Because the service runs in a separate user acccount, it has to load the 
Registry hive for another user before it can query values from its 
HKEY_CURRENT_USER key.  Use LoadUserProfile(), ImpersonateLoggedOnUser(), 
and RegOpenCurrentUser() for that.

> SHGetFolderPath() takes a hToken parameter, which "can be used
> to represent a particular user". Is there another solution than calling 
> LogonUser() to generate this token ?

If a particular user is already logged in, you can enumerate the running 
processes for that user and extract a token from one of them that you can 
then duplicate and impersonate as needed.  But for users that are not logged 
in, you have to use LogonUser().


Gambit 
Re: SHGetFolderPath() from a service application
#175
Author: Adrien Reboisson
Date: Fri, 11 Jul 2008 10:20
8 lines
1084 bytes
Hi,

> But for users that are not logged 
> in, you have to use LogonUser().

Okay, thanks.

A.R.
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