views:

99

answers:

2

I am trying to use SHGetFolderPath() to determine the path of the user profiles folder. The documentation states that CSIDL_PROFILES defines this folder:

CSIDL_PROFILES (0x003e) Version 6.0. The file system directory containing user profile folders. A typical path is C:\Documents and Settings.

I am using Visual Studio 2005 SP1, and I cannot locate the definition of the constant CSIDL_PROFILES in the Platform SDK include files? Do I need a new version of the Platform SDK?

So I did some more experimenting by using the ID 0x3e in place of the symbol. However, it looks like 0x3e is not a valid argument to the shell functions that accept CSIDL_* arguments (an invalid argument error is returned).

So I guess CSIDL_PROFILES is not a valid argument and the at least some of the MSDN pages on the subject are incorrect when they mention this symbol. I have to say in all my years of working with the Win32/MSDN documentation I can't remember a similar situation.

A: 

It's not listed in the MSDN documentation for CSIDLs, so a newer version of the PSDK is unlikely to help you.

You can obviously do it yourself:

#define CSIDL_PROFILES 0x003E

... but in view of the fact that it appears totally undocumented by MS, it's not something I'd recommend.

Roddy
It's strange that it appears in one version of the MSDN page (the one that ships with VS2005). It's as if they have removed it. I did try to use the ID directly but that does not appear to works since the shell functions return an invalid argument code when I use 0x3e.
jmatthias
A: 

I'd say this was removed when someone noticed that it's worthless. Waht can you do with it anyway? You still have to determine for each user whether his profile actually exists under this directory. But since you're normally checking this per user, the only point when you need the default is when you're creating a new user profile. And that's Windows-internal code anyway.

MSalters
In my case, it would have been useful. I actually did need to know the location of this folder because I needed to iterate through all user profile folders and copy a file to each 'SendTo' folder. Bear in mind that this code was run during an installation running with Admin rights. In the end I had to read the current user profile folder and determine the parent folder.
jmatthias
No, that's indeed a good example why it's wrong. The proper solution is to iterate over all users and then retrieve for each user their profile folder. Your solution fails if the computer has a mix of roaming and non-roaming profiles.
MSalters