Using Win32 unmanaged C++, how can I get/lookup/create a User Token when I have the user SID?
I realize this is sort-of the reverse of most situations. I have a function that needs to resolve a specific user's %AppData% directory (and a few others) and as such, I am planning on using SHGetFolderPath, with a supplied user token. However, I don't have the token in the function, all that I have passed is the user's SID. I'd like to retrieve a user token for this method, so I can with reasonable accuracy resolve the folder path.
Disclaimer: Yes, I realize this is most likely an architectural problem. I have a very monolithic system that is in dire need of refactor, but I don't have enterprise authority (i'm an outside contractor, and this particular piece is probably the worst in the whole system).