Where to place user data file to be roamed along with Windows user's desktop settings?

119 views Asked by At

I need to place some data from my process running under a logged in interactive user account into a persistent storage. The information in question is concerning user's desktop, screensaver, theme, and other desktop-related settings (in relation to my app.) I know that I can place this data as a binary key in the HKEY_CURRENT_USER registry key, but this data file can be somewhat large and I read somewhere that it's better not to put too much data into the System Registry.

So now I think I'll just save it in a binary file instead. The question is how do I find the appropriate location to save this file into? My main stipulation is that this file should "travel" (or roam) along with the logged in user's profile.

1

There are 1 answers

3
Jonathan Potter On BEST ANSWER

Usually the best place is a sub-folder (named after your company or application so they use can identify where it came from) located under the %APPDATA% folder. You can get its location like this:

if(SUCCEEDED(SHGetKnownFolderPath ( FOLDERID_RoamingAppData, KF_FLAG_CREATE,
                                    NULL, &wszPath )))
{
    printf("\nSHGetKnownFolderPath FOLDERID_RoamingAppData = %S\n", wszPath);
}

There's more information on Pat Altimore's blog.