Skip to content

Instantly share code, notes, and snippets.

@djcsdy
Created November 17, 2012 10:10
Show Gist options
  • Save djcsdy/4094661 to your computer and use it in GitHub Desktop.
Save djcsdy/4094661 to your computer and use it in GitHub Desktop.
Useful Windows Known Folders
// If targeting Windows 2000 and later.
LPTSTR pszPath = (LPTSTR) malloc(MAX_PATH);
// If targeting Windows Vista and later, we don't have to allocate our own string.
PWSTR* ppszPath;
// Local Application Data (e.g. C:\Users\djc\AppData\Local
// If targeting Windows 2000 and later
SHGetFolderPath(NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, pszPath);
// If targeting Windows Vista and later
SHGetKnownFolderPath(FOLDERID_LocalAppData, 0, NULL, ppszPath)
// Saved Games (e.g. C:\Users\djc\Saved Games).
// If targeting Windows Vista and later
SHGetKnownFolderPath(FOLDERID_SavedGames, 0, NULL, ppszPath)
// References:
// http://msdn.microsoft.com/en-us/library/bb762181(v=vs.85).aspx
// http://msdn.microsoft.com/en-us/library/bb762188(v=vs.85).aspx
// http://msdn.microsoft.com/en-us/library/bb762494(v=vs.85).aspx
// http://msdn.microsoft.com/en-us/library/dd378457(v=vs.85).aspx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment