shell32: Calculate known folder paths from parent and relative path.

Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Andrew Eikum 2021-05-27 13:38:03 -05:00 committed by Alexandre Julliard
parent 4111801ab3
commit 98d43c5dcf
1 changed files with 89 additions and 160 deletions

View File

@ -832,21 +832,8 @@ static const WCHAR AppUpdatesFolderW[] = {'A','p','p','U','p','d','a','t','e','s
static const WCHAR Administrative_ToolsW[] = {'A','d','m','i','n','i','s','t','r','a','t','i','v','e',' ','T','o','o','l','s','\0'};
static const WCHAR AppDataW[] = {'A','p','p','D','a','t','a','\0'};
static const WCHAR AppData_RoamingW[] = {'A','p','p','D','a','t','a','\\','R','o','a','m','i','n','g','\0'};
static const WCHAR AppData_Roaming_Microsoft_Windows_Network_ShortcutsW[] = {'A','p','p','D','a','t','a','\\','R','o','a','m','i','n','g','\\','M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','N','e','t','w','o','r','k',' ','S','h','o','r','t','c','u','t','s',0};
static const WCHAR AppData_Roaming_Microsoft_Windows_Printer_ShortcutsW[] = {'A','p','p','D','a','t','a','\\','R','o','a','m','i','n','g','\\','M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','P','r','i','n','t','e','r',' ','S','h','o','r','t','c','u','t','s',0};
static const WCHAR AppData_Roaming_Microsoft_Windows_RecentW[] = {'A','p','p','D','a','t','a','\\','R','o','a','m','i','n','g','\\','M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','R','e','c','e','n','t',0};
static const WCHAR AppData_Roaming_Microsoft_Windows_SendToW[] = {'A','p','p','D','a','t','a','\\','R','o','a','m','i','n','g','\\','M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','S','e','n','d','T','o',0};
static const WCHAR AppData_Roaming_Microsoft_Windows_Start_MenuW[] = {'A','p','p','D','a','t','a','\\','R','o','a','m','i','n','g','\\','M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','S','t','a','r','t',' ','M','e','n','u',0};
static const WCHAR AppData_Roaming_Microsoft_Windows_Start_Menu_ProgramsW[] = {'A','p','p','D','a','t','a','\\','R','o','a','m','i','n','g','\\','M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','S','t','a','r','t',' ','M','e','n','u','\\','P','r','o','g','r','a','m','s',0};
static const WCHAR AppData_Roaming_Microsoft_Windows_Start_Menu_Programs_StartupW[] = {'A','p','p','D','a','t','a','\\','R','o','a','m','i','n','g','\\','M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','S','t','a','r','t',' ','M','e','n','u','\\','P','r','o','g','r','a','m','s','\\','S','t','a','r','t','u','p',0};
static const WCHAR AppData_Roaming_Microsoft_Windows_Start_Menu_Programs_Administrative_ToolsW[] = {'A','p','p','D','a','t','a','\\','R','o','a','m','i','n','g','\\','M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','S','t','a','r','t',' ','M','e','n','u','\\','P','r','o','g','r','a','m','s','\\','A','d','m','i','n','i','s','t','r','a','t','i','v','e',' ','T','o','o','l','s',0};
static const WCHAR AppData_Roaming_Microsoft_Windows_TemplatesW[] = {'A','p','p','D','a','t','a','\\','R','o','a','m','i','n','g','\\','M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','T','e','m','p','l','a','t','e','s',0};
static const WCHAR AppData_LocalLowW[] = {'A','p','p','D','a','t','a','\\','L','o','c','a','l','L','o','w','\0'};
static const WCHAR AppData_LocalW[] = {'A','p','p','D','a','t','a','\\','L','o','c','a','l','\0'};
static const WCHAR AppData_Local_Microsoft_Windows_Burn_BurnW[] = {'A','p','p','D','a','t','a','\\','L','o','c','a','l','\\','M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','B','u','r','n','\\','B','u','r','n',0};
static const WCHAR AppData_Local_Microsoft_Windows_HistoryW[] = {'A','p','p','D','a','t','a','\\','L','o','c','a','l','\\','M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','H','i','s','t','o','r','y',0};
static const WCHAR AppData_Local_Microsoft_Windows_INetCacheW[] = {'A','p','p','D','a','t','a','\\','L','o','c','a','l','\\','M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','I','N','e','t','C','a','c','h','e',0};
static const WCHAR AppData_Local_Microsoft_Windows_INetCookiesW[] = {'A','p','p','D','a','t','a','\\','L','o','c','a','l','\\','M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','I','N','e','t','C','o','o','k','i','e','s',0};
static const WCHAR CacheW[] = {'C','a','c','h','e','\0'};
static const WCHAR CD_BurningW[] = {'C','D',' ','B','u','r','n','i','n','g','\0'};
static const WCHAR ChangeRemoveProgramsFolderW[] = {'C','h','a','n','g','e','R','e','m','o','v','e','P','r','o','g','r','a','m','s','F','o','l','d','e','r',0};
@ -912,18 +899,12 @@ static const WCHAR Microsoft_Windows_RingtonesW[] = {'M','i','c','r','o','s','o'
static const WCHAR Microsoft_Windows_SendToW[] = {'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','S','e','n','d','T','o',0};
static const WCHAR Microsoft_Windows_Sidebar_GadgetsW[] = {'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s',' ','S','i','d','e','b','a','r','\\','G','a','d','g','e','t','s',0};
static const WCHAR Microsoft_Windows_Start_MenuW[] = {'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','S','t','a','r','t',' ','M','e','n','u',0};
static const WCHAR Microsoft_Windows_Start_Menu_ProgramsW[] = {'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','S','t','a','r','t',' ','M','e','n','u','\\','P','r','o','g','r','a','m','s','\0'};
static const WCHAR Microsoft_Windows_Start_Menu_Admin_ToolsW[] = {'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','S','t','a','r','t',' ','M','e','n','u','\\','P','r','o','g','r','a','m','s','\\','A','d','m','i','n','i','s','t','r','a','t','i','v','e',' ','T','o','o','l','s','\0'};
static const WCHAR Microsoft_Windows_Start_Menu_StartupW[] = {'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','S','t','a','r','t',' ','M','e','n','u','\\','P','r','o','g','r','a','m','s','\\','S','t','a','r','t','U','p','\0'};
static const WCHAR Microsoft_Windows_TemplatesW[] = {'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','T','e','m','p','l','a','t','e','s',0};
static const WCHAR Microsoft_Windows_ThemesW[] = {'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','T','h','e','m','e','s',0};
static const WCHAR MoviesW[] = {'M','o','v','i','e','s','\0'};
static const WCHAR MusicW[] = {'M','u','s','i','c','\0'};
static const WCHAR MusicLibraryW[] = {'M','u','s','i','c','L','i','b','r','a','r','y',0};
static const WCHAR Music_librarymsW[] = {'M','u','s','i','c','.','l','i','b','r','a','r','y','-','m','s',0};
static const WCHAR Music_PlaylistsW[] = {'M','u','s','i','c','\\','P','l','a','y','l','i','s','t','s','\0'};
static const WCHAR Music_Sample_MusicW[] = {'M','u','s','i','c','\\','S','a','m','p','l','e',' ','M','u','s','i','c','\0'};
static const WCHAR Music_Sample_PlaylistsW[] = {'M','u','s','i','c','\\','S','a','m','p','l','e',' ','P','l','a','y','l','i','s','t','s','\0'};
static const WCHAR My_MusicW[] = {'M','y',' ','M','u','s','i','c','\0'};
static const WCHAR My_PicturesW[] = {'M','y',' ','P','i','c','t','u','r','e','s','\0'};
static const WCHAR My_VideosW[] = {'M','y',' ','V','i','d','e','o','s','\0'};
@ -938,8 +919,6 @@ static const WCHAR PhotoAlbumsW[] = {'P','h','o','t','o','A','l','b','u','m','s'
static const WCHAR PicturesW[] = {'P','i','c','t','u','r','e','s','\0'};
static const WCHAR PicturesLibraryW[] = {'P','i','c','t','u','r','e','s','L','i','b','r','a','r','y',0};
static const WCHAR Pictures_librarymsW[] = {'P','i','c','t','u','r','e','s','.','l','i','b','r','a','r','y','-','m','s',0};
static const WCHAR Pictures_Sample_PicturesW[] = {'P','i','c','t','u','r','e','s','\\','S','a','m','p','l','e',' ','P','i','c','t','u','r','e','s','\0'};
static const WCHAR Pictures_Slide_ShowsW[] = {'P','i','c','t','u','r','e','s','\\','S','l','i','d','e',' ','S','h','o','w','s','\0'};
static const WCHAR PlaylistsW[] = {'P','l','a','y','l','i','s','t','s',0};
static const WCHAR PrintersFolderW[] = {'P','r','i','n','t','e','r','s','F','o','l','d','e','r',0};
static const WCHAR PrintHoodW[] = {'P','r','i','n','t','H','o','o','d','\0'};
@ -1003,7 +982,6 @@ static const WCHAR UsersPublicW[] = {'u','s','e','r','s','\\','P','u','b','l','i
static const WCHAR VideosW[] = {'V','i','d','e','o','s','\0'};
static const WCHAR VideosLibraryW[] = {'V','i','d','e','o','s','L','i','b','r','a','r','y',0};
static const WCHAR Videos_librarymsW[] = {'V','i','d','e','o','s','.','l','i','b','r','a','r','y','-','m','s',0};
static const WCHAR Videos_Sample_VideosW[] = {'V','i','d','e','o','s','\\','S','a','m','p','l','e',' ','V','i','d','e','o','s','\0'};
static const WCHAR WindowsW[] = {'W','i','n','d','o','w','s',0};
static const WCHAR Windows_Sidebar_GadgetsW[] = {'W','i','n','d','o','w','s',' ','S','i','d','e','b','a','r','\\','G','a','d','g','e','t','s',0};
static const WCHAR DefaultW[] = {'.','D','e','f','a','u','l','t','\0'};
@ -1229,7 +1207,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_Desktop,
CSIDL_Type_User,
DesktopW,
MAKEINTRESOURCEW(IDS_DESKTOPDIRECTORY),
NULL,
KF_CATEGORY_PERUSER, /* category */
DesktopW, /* name */
@ -1269,7 +1247,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_Programs,
CSIDL_Type_User,
ProgramsW,
AppData_Roaming_Microsoft_Windows_Start_Menu_ProgramsW,
NULL,
KF_CATEGORY_PERUSER, /* category */
ProgramsW, /* name */
@ -1329,7 +1307,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_Documents,
CSIDL_Type_User,
PersonalW,
MAKEINTRESOURCEW(IDS_PERSONAL),
NULL,
KF_CATEGORY_PERUSER, /* category */
PersonalW, /* name */
@ -1349,7 +1327,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_Favorites,
CSIDL_Type_User,
FavoritesW,
FavoritesW,
NULL,
KF_CATEGORY_PERUSER, /* category */
FavoritesW, /* name */
@ -1369,7 +1347,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_Startup,
CSIDL_Type_User,
StartUpW,
AppData_Roaming_Microsoft_Windows_Start_Menu_Programs_StartupW,
NULL,
KF_CATEGORY_PERUSER, /* category */
StartupW, /* name */
@ -1389,7 +1367,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_Recent,
CSIDL_Type_User,
RecentW,
AppData_Roaming_Microsoft_Windows_RecentW,
NULL,
KF_CATEGORY_PERUSER, /* category */
RecentW, /* name */
@ -1409,7 +1387,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_SendTo,
CSIDL_Type_User,
SendToW,
AppData_Roaming_Microsoft_Windows_SendToW,
NULL,
KF_CATEGORY_PERUSER, /* category */
SendToW, /* name */
@ -1449,7 +1427,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_StartMenu,
CSIDL_Type_User,
Start_MenuW,
AppData_Roaming_Microsoft_Windows_Start_MenuW,
NULL,
KF_CATEGORY_PERUSER, /* category */
Start_MenuW, /* name */
@ -1475,7 +1453,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_Music,
CSIDL_Type_User,
My_MusicW,
MAKEINTRESOURCEW(IDS_MYMUSIC),
NULL,
KF_CATEGORY_PERUSER, /* category */
My_MusicW, /* name */
@ -1495,7 +1473,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_Videos,
CSIDL_Type_User,
My_VideosW,
MAKEINTRESOURCEW(IDS_MYVIDEOS),
NULL,
KF_CATEGORY_PERUSER, /* category */
My_VideoW, /* name */
@ -1521,7 +1499,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_Desktop,
CSIDL_Type_User,
DesktopW,
MAKEINTRESOURCEW(IDS_DESKTOPDIRECTORY),
NULL,
KF_CATEGORY_PERUSER, /* category */
DesktopW, /* name */
@ -1581,7 +1559,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_NetHood,
CSIDL_Type_User,
NetHoodW,
AppData_Roaming_Microsoft_Windows_Network_ShortcutsW,
NULL,
KF_CATEGORY_PERUSER, /* category */
NetHoodW, /* name */
@ -1621,7 +1599,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_Templates,
CSIDL_Type_User,
TemplatesW,
AppData_Roaming_Microsoft_Windows_TemplatesW,
NULL,
KF_CATEGORY_PERUSER, /* category */
TemplatesW, /* name */
@ -1641,7 +1619,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_CommonStartMenu,
CSIDL_Type_ProgramData,
Common_Start_MenuW,
Microsoft_Windows_Start_MenuW,
NULL,
KF_CATEGORY_COMMON, /* category */
Common_Start_MenuW, /* name */
@ -1661,7 +1639,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_CommonPrograms,
CSIDL_Type_ProgramData,
Common_ProgramsW,
Microsoft_Windows_Start_Menu_ProgramsW,
NULL,
KF_CATEGORY_COMMON, /* category */
Common_ProgramsW, /* name */
@ -1681,7 +1659,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_CommonStartup,
CSIDL_Type_ProgramData,
Common_StartUpW,
Microsoft_Windows_Start_Menu_StartupW,
NULL,
KF_CATEGORY_COMMON, /* category */
Common_StartupW, /* name */
@ -1701,7 +1679,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_PublicDesktop,
CSIDL_Type_AllUsers,
Common_DesktopW,
MAKEINTRESOURCEW(IDS_DESKTOPDIRECTORY),
NULL,
KF_CATEGORY_COMMON, /* category */
Common_DesktopW, /* name */
@ -1721,7 +1699,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_RoamingAppData,
CSIDL_Type_User,
AppDataW,
AppData_RoamingW,
NULL,
KF_CATEGORY_PERUSER, /* category */
AppDataW, /* name */
@ -1741,7 +1719,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_PrintHood,
CSIDL_Type_User,
PrintHoodW,
AppData_Roaming_Microsoft_Windows_Printer_ShortcutsW,
NULL,
KF_CATEGORY_PERUSER, /* category */
PrintHoodW, /* name */
@ -1761,7 +1739,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_LocalAppData,
CSIDL_Type_User,
Local_AppDataW,
AppData_LocalW,
NULL,
KF_CATEGORY_PERUSER, /* category */
Local_AppDataW, /* name */
@ -1793,7 +1771,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_Favorites,
CSIDL_Type_AllUsers,
Common_FavoritesW,
FavoritesW,
NULL,
KF_CATEGORY_PERUSER, /* category */
FavoritesW, /* name */
@ -1813,7 +1791,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_InternetCache,
CSIDL_Type_User,
CacheW,
AppData_Local_Microsoft_Windows_INetCacheW,
NULL,
KF_CATEGORY_PERUSER, /* category */
CacheW, /* name */
@ -1833,7 +1811,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_Cookies,
CSIDL_Type_User,
CookiesW,
AppData_Local_Microsoft_Windows_INetCookiesW,
NULL,
KF_CATEGORY_PERUSER, /* category */
CookiesW, /* name */
@ -1853,7 +1831,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_History,
CSIDL_Type_User,
HistoryW,
AppData_Local_Microsoft_Windows_HistoryW,
NULL,
KF_CATEGORY_PERUSER, /* category */
HistoryW, /* name */
@ -1953,7 +1931,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_Pictures,
CSIDL_Type_User,
My_PicturesW,
MAKEINTRESOURCEW(IDS_MYPICTURES),
NULL,
KF_CATEGORY_PERUSER, /* category */
My_PicturesW, /* name */
@ -2073,7 +2051,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_CommonTemplates,
CSIDL_Type_ProgramData,
Common_TemplatesW,
Microsoft_Windows_TemplatesW,
NULL,
KF_CATEGORY_COMMON, /* category */
Common_TemplatesW, /* name */
@ -2093,7 +2071,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_PublicDocuments,
CSIDL_Type_AllUsers,
Common_DocumentsW,
DocumentsW,
NULL,
KF_CATEGORY_COMMON, /* category */
Common_DocumentsW, /* name */
@ -2113,7 +2091,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_CommonAdminTools,
CSIDL_Type_ProgramData,
Common_Administrative_ToolsW,
Microsoft_Windows_Start_Menu_Admin_ToolsW,
NULL,
KF_CATEGORY_COMMON, /* category */
Common_Administrative_ToolsW, /* name */
@ -2133,7 +2111,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_AdminTools,
CSIDL_Type_User,
Administrative_ToolsW,
AppData_Roaming_Microsoft_Windows_Start_Menu_Programs_Administrative_ToolsW,
NULL,
KF_CATEGORY_PERUSER, /* category */
Administrative_ToolsW, /* name */
@ -2191,7 +2169,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_PublicMusic,
CSIDL_Type_AllUsers,
CommonMusicW,
MusicW,
NULL,
KF_CATEGORY_COMMON, /* category */
CommonMusicW, /* name */
@ -2211,7 +2189,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_PublicPictures,
CSIDL_Type_AllUsers,
CommonPicturesW,
PicturesW,
NULL,
KF_CATEGORY_COMMON, /* category */
CommonPicturesW, /* name */
@ -2231,7 +2209,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_PublicVideos,
CSIDL_Type_AllUsers,
CommonVideoW,
VideosW,
NULL,
KF_CATEGORY_COMMON, /* category */
CommonVideoW, /* name */
@ -2291,7 +2269,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_CommonOEMLinks,
CSIDL_Type_ProgramData,
NULL,
OEM_LinksW,
NULL,
KF_CATEGORY_COMMON, /* category */
OEM_LinksW, /* name */
@ -2311,7 +2289,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_CDBurning,
CSIDL_Type_User,
CD_BurningW,
AppData_Local_Microsoft_Windows_Burn_BurnW,
NULL,
KF_CATEGORY_PERUSER, /* category */
CD_BurningW, /* name */
@ -2429,7 +2407,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_Contacts,
CSIDL_Type_User,
NULL,
ContactsW,
NULL,
KF_CATEGORY_PERUSER, /* category */
ContactsW, /* name */
@ -2495,7 +2473,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_Downloads,
CSIDL_Type_User,
NULL,
DownloadsW,
NULL,
KF_CATEGORY_PERUSER, /* category */
DownloadsW, /* name */
@ -2615,7 +2593,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_Links,
CSIDL_Type_User,
NULL,
LinksW,
NULL,
KF_CATEGORY_PERUSER, /* category */
LinksW, /* name */
@ -2635,7 +2613,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_LocalAppDataLow,
CSIDL_Type_User,
NULL,
AppData_LocalLowW,
NULL,
KF_CATEGORY_PERUSER, /* category */
LocalAppDataLowW, /* name */
@ -2695,7 +2673,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_PhotoAlbums,
CSIDL_Type_User,
NULL,
Pictures_Slide_ShowsW,
NULL,
KF_CATEGORY_PERUSER, /* category */
PhotoAlbumsW, /* name */
@ -2735,7 +2713,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_Playlists,
CSIDL_Type_User,
NULL,
Music_PlaylistsW,
NULL,
KF_CATEGORY_PERUSER, /* category */
PlaylistsW, /* name */
@ -2827,7 +2805,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_PublicDownloads,
CSIDL_Type_AllUsers,
NULL,
DownloadsW,
NULL,
KF_CATEGORY_COMMON, /* category */
CommonDownloadsW, /* name */
@ -2847,7 +2825,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_PublicGameTasks,
CSIDL_Type_ProgramData,
NULL,
Microsoft_Windows_GameExplorerW,
NULL,
KF_CATEGORY_COMMON, /* category */
PublicGameTasksW, /* name */
@ -2867,7 +2845,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_PublicLibraries,
CSIDL_Type_AllUsers,
NULL,
Microsoft_Windows_LibrariesW,
NULL,
KF_CATEGORY_COMMON, /* category */
PublicLibrariesW, /* name */
@ -2887,7 +2865,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_PublicRingtones,
CSIDL_Type_ProgramData,
NULL,
Microsoft_Windows_RingtonesW,
NULL,
KF_CATEGORY_COMMON, /* category */
CommonRingtonesW, /* name */
@ -2967,7 +2945,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_SampleMusic,
CSIDL_Type_AllUsers,
NULL,
Music_Sample_MusicW,
NULL,
KF_CATEGORY_COMMON, /* category */
SampleMusicW, /* name */
@ -2987,7 +2965,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_SamplePictures,
CSIDL_Type_AllUsers,
NULL,
Pictures_Sample_PicturesW,
NULL,
KF_CATEGORY_COMMON, /* category */
SamplePicturesW, /* name */
@ -3007,7 +2985,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_SamplePlaylists,
CSIDL_Type_AllUsers,
NULL,
Music_Sample_PlaylistsW,
NULL,
KF_CATEGORY_COMMON, /* category */
SamplePlaylistsW, /* name */
@ -3027,7 +3005,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_SampleVideos,
CSIDL_Type_AllUsers,
NULL,
Videos_Sample_VideosW,
NULL,
KF_CATEGORY_COMMON, /* category */
SampleVideosW, /* name */
@ -3047,7 +3025,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_SavedGames,
CSIDL_Type_User,
NULL,
Saved_GamesW,
NULL,
KF_CATEGORY_PERUSER, /* category */
SavedGamesW, /* name */
@ -3067,7 +3045,7 @@ static const CSIDL_DATA CSIDL_Data[] =
&FOLDERID_SavedSearches,
CSIDL_Type_User,
NULL,
SearchesW,
NULL,
KF_CATEGORY_PERUSER, /* category */
SearchesW, /* name */
@ -3385,6 +3363,14 @@ static const CSIDL_DATA CSIDL_Data[] =
}
};
static int csidl_from_id( const KNOWNFOLDERID *id )
{
int i;
for (i = 0; i < ARRAY_SIZE(CSIDL_Data); i++)
if (IsEqualGUID( CSIDL_Data[i].id, id )) return i;
return -1;
}
static HRESULT _SHExpandEnvironmentStrings(LPCWSTR szSrc, LPWSTR szDest);
/* Gets the value named value from the registry key
@ -3467,11 +3453,22 @@ static HRESULT _SHGetUserShellFolderPath(HKEY rootKey, LPCWSTR userPrefix,
return hr;
}
static void append_relative_path(BYTE folder, WCHAR *pszPath)
{
if (CSIDL_Data[folder].pszRelativePath)
{
PathAddBackslashW(pszPath);
strcatW(pszPath, CSIDL_Data[folder].pszRelativePath);
}
else if (CSIDL_Data[folder].szDefaultPath)
{
PathAddBackslashW(pszPath);
strcatW(pszPath, CSIDL_Data[folder].szDefaultPath);
}
}
/* Gets a 'semi-expanded' default value of the CSIDL with index folder into
* pszPath, based on the entries in CSIDL_Data. By semi-expanded, I mean:
* - The entry's szDefaultPath may be either a string value or an integer
* resource identifier. In the latter case, the string value of the resource
* is written.
* - Depending on the entry's type, the path may begin with an (unexpanded)
* environment variable name. The caller is responsible for expanding
* environment strings if so desired.
@ -3484,8 +3481,6 @@ static HRESULT _SHGetUserShellFolderPath(HKEY rootKey, LPCWSTR userPrefix,
static HRESULT _SHGetDefaultValue(BYTE folder, LPWSTR pszPath)
{
HRESULT hr;
WCHAR resourcePath[MAX_PATH];
LPCWSTR pDefaultPath = NULL;
TRACE("0x%02x,%p\n", folder, pszPath);
@ -3514,29 +3509,9 @@ static HRESULT _SHGetDefaultValue(BYTE folder, LPWSTR pszPath)
}
}
if (CSIDL_Data[folder].szDefaultPath &&
IS_INTRESOURCE(CSIDL_Data[folder].szDefaultPath))
{
if (LoadStringW(shell32_hInstance,
LOWORD(CSIDL_Data[folder].szDefaultPath), resourcePath, MAX_PATH))
{
hr = S_OK;
pDefaultPath = resourcePath;
}
else
{
FIXME("(%d,%s), LoadString failed, missing translation?\n", folder,
debugstr_w(pszPath));
hr = E_FAIL;
}
}
else
{
hr = S_OK;
pDefaultPath = CSIDL_Data[folder].szDefaultPath;
}
if (SUCCEEDED(hr))
if (IsEqualGUID(CSIDL_Data[folder].fidParent, &GUID_NULL))
{
/* hit the root, sub in env var */
switch (CSIDL_Data[folder].type)
{
case CSIDL_Type_User:
@ -3554,12 +3529,15 @@ static HRESULT _SHGetDefaultValue(BYTE folder, LPWSTR pszPath)
default:
; /* no corresponding env. var, do nothing */
}
if (pDefaultPath)
{
PathAddBackslashW(pszPath);
strcatW(pszPath, pDefaultPath);
}
hr = S_OK;
}else{
/* prepend with parent */
hr = _SHGetDefaultValue(csidl_from_id(CSIDL_Data[folder].fidParent), pszPath);
}
if (SUCCEEDED(hr))
append_relative_path(folder, pszPath);
TRACE("returning 0x%08x\n", hr);
return hr;
}
@ -4519,35 +4497,17 @@ HRESULT WINAPI SHGetFolderPathAndSubDirW(
break;
case CSIDL_Type_WindowsPath:
GetWindowsDirectoryW(szTemp, MAX_PATH);
if (CSIDL_Data[folder].szDefaultPath &&
!IS_INTRESOURCE(CSIDL_Data[folder].szDefaultPath) &&
*CSIDL_Data[folder].szDefaultPath)
{
PathAddBackslashW(szTemp);
strcatW(szTemp, CSIDL_Data[folder].szDefaultPath);
}
append_relative_path(folder, szTemp);
hr = S_OK;
break;
case CSIDL_Type_SystemPath:
GetSystemDirectoryW(szTemp, MAX_PATH);
if (CSIDL_Data[folder].szDefaultPath &&
!IS_INTRESOURCE(CSIDL_Data[folder].szDefaultPath) &&
*CSIDL_Data[folder].szDefaultPath)
{
PathAddBackslashW(szTemp);
strcatW(szTemp, CSIDL_Data[folder].szDefaultPath);
}
append_relative_path(folder, szTemp);
hr = S_OK;
break;
case CSIDL_Type_SystemX86Path:
if (!GetSystemWow64DirectoryW(szTemp, MAX_PATH)) GetSystemDirectoryW(szTemp, MAX_PATH);
if (CSIDL_Data[folder].szDefaultPath &&
!IS_INTRESOURCE(CSIDL_Data[folder].szDefaultPath) &&
*CSIDL_Data[folder].szDefaultPath)
{
PathAddBackslashW(szTemp);
strcatW(szTemp, CSIDL_Data[folder].szDefaultPath);
}
append_relative_path(folder, szTemp);
hr = S_OK;
break;
case CSIDL_Type_CurrVer:
@ -4707,12 +4667,7 @@ static HRESULT _SHRegisterFolders(HKEY hRootKey, HANDLE hToken,
else if (CSIDL_Data[folders[i]].type == CSIDL_Type_WindowsPath)
{
GetWindowsDirectoryW(path, MAX_PATH);
if (CSIDL_Data[folders[i]].szDefaultPath &&
!IS_INTRESOURCE(CSIDL_Data[folders[i]].szDefaultPath))
{
PathAddBackslashW(path);
strcatW(path, CSIDL_Data[folders[i]].szDefaultPath);
}
append_relative_path(folders[i], path);
}
else
hr = E_FAIL;
@ -5118,14 +5073,6 @@ HRESULT WINAPI SHGetSpecialFolderLocation(
return hr;
}
static int csidl_from_id( const KNOWNFOLDERID *id )
{
int i;
for (i = 0; i < ARRAY_SIZE(CSIDL_Data); i++)
if (IsEqualGUID( CSIDL_Data[i].id, id )) return i;
return -1;
}
/*************************************************************************
* SHGetKnownFolderPath [SHELL32.@]
*/
@ -5165,35 +5112,17 @@ HRESULT WINAPI SHGetKnownFolderPath(REFKNOWNFOLDERID rfid, DWORD flags, HANDLE t
break;
case CSIDL_Type_WindowsPath:
GetWindowsDirectoryW(tempW, MAX_PATH);
if (CSIDL_Data[folder].szDefaultPath &&
!IS_INTRESOURCE(CSIDL_Data[folder].szDefaultPath) &&
*CSIDL_Data[folder].szDefaultPath)
{
PathAddBackslashW(tempW);
strcatW(tempW, CSIDL_Data[folder].szDefaultPath);
}
append_relative_path(folder, tempW);
hr = S_OK;
break;
case CSIDL_Type_SystemPath:
GetSystemDirectoryW(tempW, MAX_PATH);
if (CSIDL_Data[folder].szDefaultPath &&
!IS_INTRESOURCE(CSIDL_Data[folder].szDefaultPath) &&
*CSIDL_Data[folder].szDefaultPath)
{
PathAddBackslashW(tempW);
strcatW(tempW, CSIDL_Data[folder].szDefaultPath);
}
append_relative_path(folder, tempW);
hr = S_OK;
break;
case CSIDL_Type_SystemX86Path:
if (!GetSystemWow64DirectoryW(tempW, MAX_PATH)) GetSystemDirectoryW(tempW, MAX_PATH);
if (CSIDL_Data[folder].szDefaultPath &&
!IS_INTRESOURCE(CSIDL_Data[folder].szDefaultPath) &&
*CSIDL_Data[folder].szDefaultPath)
{
PathAddBackslashW(tempW);
strcatW(tempW, CSIDL_Data[folder].szDefaultPath);
}
append_relative_path(folder, tempW);
hr = S_OK;
break;
case CSIDL_Type_CurrVer: