I need to retrieve the paths of certain special folders for the currently logged in user. For example, the current user's desktop.
This is simple using SHGetFolderLocation or ShGetSpecialFolderPath with CSIDL_DesktopDirectory, except if the user has standard rights and the application has been started using "Run as administrator", in which case the path returned is relevant to the administrator account used.
For example: Standard user "X" needs to run an application as admin by right-clicking the exe, selecting "run as administrator", then entering the account details for user "Y" who has admin rights.
CSIDL_DesktopDirectory returns "c:\users\Y\desktop" but I want to get "c:\users\X\desktop"
Thanks for any advice.