Access token from account name or SID

Hi, I have a service that eventually needs to place some files in application data directories associated to a Windows account. To obtain the path to such directory, I need to call SHGetFolderPath, passing the user's account access token as third argument.

My problem is that I know the user's account name and even the account's SID, but I haven't found a way to obtain the related access token only with this input. The only way I know to obtain a handle to the user's access token is by opening a process in the user's session ( OpenProcess and then OpenProcessToken), but due to some restriction I can't obtain the token that way.

So, my question is: is there a way to obtain a handle to an user's access token only by account name or account SID?

Thanks in advance.
Topic archived. No new replies allowed.