ReactOS 0.4.17-dev-1196-gb6224c3
shellpath.c File Reference
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#include "windef.h"
#include "winbase.h"
#include "winternl.h"
#include "winnls.h"
#include "winreg.h"
#include "wingdi.h"
#include "winuser.h"
#include "winioctl.h"
#include "ddk/mountmgr.h"
#include "shlobj.h"
#include "shtypes.h"
#include "shresdef.h"
#include "shell32_main.h"
#include "pidl.h"
#include "shlwapi.h"
#include "sddl.h"
#include "knownfolders.h"
#include "initguid.h"
#include "shobjidl.h"
#include "wine/debug.h"
Include dependency graph for shellpath.c:

Go to the source code of this file.

Classes

struct  IApplicationDestinationsImpl
 
struct  IApplicationDocumentListsImpl
 
struct  CSIDL_DATA
 
struct  knownfolder
 
struct  foldermanager
 

Macros

#define COBJMACROS
 
#define WINE_MOUNTMGR_EXTENSIONS
 
#define CSIDL_CONTACTS   0x0043
 
#define CSIDL_DOWNLOADS   0x0047
 
#define CSIDL_LINKS   0x004d
 
#define CSIDL_APPDATA_LOCALLOW   0x004e
 
#define CSIDL_SAVED_GAMES   0x0062
 
#define CSIDL_SEARCHES   0x0063
 

Typedefs

typedef enum _CSIDL_Type CSIDL_Type
 

Enumerations

enum  _CSIDL_Type {
  CSIDL_Type_User , CSIDL_Type_AllUsers , CSIDL_Type_CurrVer , CSIDL_Type_Disallowed ,
  CSIDL_Type_NonExistent , CSIDL_Type_WindowsPath , CSIDL_Type_SystemPath , CSIDL_Type_SystemX86Path ,
  CSIDL_Type_ProgramData
}
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (shell)
 
BOOL WINAPI PathAppendAW (LPVOID lpszPath1, LPCVOID lpszPath2)
 
LPVOID WINAPI PathCombineAW (LPVOID szDest, LPCVOID lpszDir, LPCVOID lpszFile)
 
LPVOID WINAPI PathAddBackslashAW (LPVOID lpszPath)
 
LPVOID WINAPI PathBuildRootAW (LPVOID lpszPath, int drive)
 
LPVOID WINAPI PathFindFileNameAW (LPCVOID lpszPath)
 
LPVOID WINAPI PathFindExtensionAW (LPCVOID lpszPath)
 
static LPSTR PathGetExtensionA (LPCSTR lpszPath)
 
static LPWSTR PathGetExtensionW (LPCWSTR lpszPath)
 
LPVOID WINAPI PathGetExtensionAW (LPCVOID lpszPath, DWORD void1, DWORD void2)
 
LPVOID WINAPI PathGetArgsAW (LPVOID lpszPath)
 
int WINAPI PathGetDriveNumberAW (LPVOID lpszPath)
 
BOOL WINAPI PathRemoveFileSpecAW (LPVOID lpszPath)
 
void WINAPI PathStripPathAW (LPVOID lpszPath)
 
BOOL WINAPI PathStripToRootAW (LPVOID lpszPath)
 
void WINAPI PathRemoveArgsAW (LPVOID lpszPath)
 
void WINAPI PathRemoveExtensionAW (LPVOID lpszPath)
 
static void PathGetShortPathA (LPSTR pszPath)
 
static void PathGetShortPathW (LPWSTR pszPath)
 
VOID WINAPI PathGetShortPathAW (LPVOID pszPath)
 
void WINAPI PathRemoveBlanksAW (LPVOID str)
 
VOID WINAPI PathQuoteSpacesAW (LPVOID lpszPath)
 
VOID WINAPI PathUnquoteSpacesAW (LPVOID str)
 
int WINAPI PathParseIconLocationAW (LPVOID lpszPath)
 
BOOL WINAPI PathIsUNCAW (LPCVOID lpszPath)
 
BOOL WINAPI PathIsRelativeAW (LPCVOID lpszPath)
 
BOOL WINAPI PathIsRootAW (LPCVOID lpszPath)
 
static BOOL PathIsExeA (LPCSTR lpszPath)
 
static BOOL PathIsExeW (LPCWSTR lpszPath)
 
BOOL WINAPI PathIsExeAW (LPCVOID path)
 
BOOL WINAPI PathIsDirectoryAW (LPCVOID lpszPath)
 
BOOL WINAPI PathFileExistsAW (LPCVOID lpszPath)
 
BOOL WINAPI PathMatchSpecAW (LPVOID name, LPVOID mask)
 
BOOL WINAPI PathIsSameRootAW (LPCVOID lpszPath1, LPCVOID lpszPath2)
 
BOOL WINAPI IsLFNDriveA (LPCSTR lpszPath)
 
BOOL WINAPI IsLFNDriveW (LPCWSTR lpszPath)
 
BOOL WINAPI IsLFNDriveAW (LPCVOID lpszPath)
 
static BOOL PathMakeUniqueNameA (LPSTR lpszBuffer, DWORD dwBuffSize, LPCSTR lpszShortName, LPCSTR lpszLongName, LPCSTR lpszPathName)
 
static BOOL PathMakeUniqueNameW (LPWSTR lpszBuffer, DWORD dwBuffSize, LPCWSTR lpszShortName, LPCWSTR lpszLongName, LPCWSTR lpszPathName)
 
BOOL WINAPI PathMakeUniqueNameAW (LPVOID lpszBuffer, DWORD dwBuffSize, LPCVOID lpszShortName, LPCVOID lpszLongName, LPCVOID lpszPathName)
 
BOOL WINAPI PathYetAnotherMakeUniqueName (LPWSTR buffer, LPCWSTR path, LPCWSTR shortname, LPCWSTR longname)
 
BOOL WINAPI PathFindOnPathAW (LPVOID sFile, LPCVOID *sOtherDirs)
 
int WINAPI PathCleanupSpec (LPCWSTR lpszPathW, LPWSTR lpszFileW)
 
static BOOL PathQualifyA (LPCSTR pszPath)
 
static BOOL PathQualifyW (LPCWSTR pszPath)
 
BOOL WINAPI PathQualifyAW (LPCVOID pszPath)
 
static BOOL PathResolveA (char *path, const char **dirs, DWORD flags)
 
BOOL WINAPI PathResolveW (WCHAR *path, const WCHAR **dirs, DWORD flags)
 
BOOL WINAPI PathResolveAW (void *path, const void **paths, DWORD flags)
 
static LONG PathProcessCommandA (LPCSTR lpszPath, LPSTR lpszBuff, DWORD dwBuffSize, DWORD dwFlags)
 
static LONG PathProcessCommandW (LPCWSTR lpszPath, LPWSTR lpszBuff, DWORD dwBuffSize, DWORD dwFlags)
 
LONG WINAPI PathProcessCommandAW (LPCVOID lpszPath, LPVOID lpszBuff, DWORD dwBuffSize, DWORD dwFlags)
 
VOID WINAPI PathSetDlgItemPathAW (HWND hDlg, int id, LPCVOID pszPath)
 
static IApplicationDestinationsImpl * impl_from_IApplicationDestinations (IApplicationDestinations *iface)
 
static HRESULT WINAPI ApplicationDestinations_QueryInterface (IApplicationDestinations *iface, REFIID riid, LPVOID *ppv)
 
static ULONG WINAPI ApplicationDestinations_AddRef (IApplicationDestinations *iface)
 
static ULONG WINAPI ApplicationDestinations_Release (IApplicationDestinations *iface)
 
static HRESULT WINAPI ApplicationDestinations_SetAppID (IApplicationDestinations *iface, const WCHAR *appid)
 
static HRESULT WINAPI ApplicationDestinations_RemoveDestination (IApplicationDestinations *iface, IUnknown *punk)
 
static HRESULT WINAPI ApplicationDestinations_RemoveAllDestinations (IApplicationDestinations *iface)
 
HRESULT WINAPI ApplicationDestinations_Constructor (IUnknown *outer, REFIID riid, LPVOID *ppv)
 
static IApplicationDocumentListsImpl * impl_from_IApplicationDocumentLists (IApplicationDocumentLists *iface)
 
static HRESULT WINAPI ApplicationDocumentLists_QueryInterface (IApplicationDocumentLists *iface, REFIID riid, LPVOID *ppv)
 
static ULONG WINAPI ApplicationDocumentLists_AddRef (IApplicationDocumentLists *iface)
 
static ULONG WINAPI ApplicationDocumentLists_Release (IApplicationDocumentLists *iface)
 
static HRESULT WINAPI ApplicationDocumentLists_SetAppID (IApplicationDocumentLists *iface, const WCHAR *appid)
 
static HRESULT WINAPI ApplicationDocumentLists_GetList (IApplicationDocumentLists *iface, APPDOCLISTTYPE list_type, UINT item_count, REFIID riid, void **obj)
 
HRESULT WINAPI ApplicationDocumentLists_Constructor (IUnknown *outer, REFIID riid, LPVOID *ppv)
 
static int csidl_from_id (const KNOWNFOLDERID *id)
 
static HRESULT _SHExpandEnvironmentStrings (LPCWSTR szSrc, LPWSTR szDest)
 
static HRESULT _SHGetUserShellFolderPath (HKEY rootKey, LPCWSTR userPrefix, LPCWSTR value, LPWSTR path)
 
static void append_relative_path (BYTE folder, WCHAR *pszPath)
 
static HRESULT _SHGetDefaultValue (BYTE folder, LPWSTR pszPath)
 
static HRESULT _SHGetCurrentVersionPath (DWORD dwFlags, BYTE folder, LPWSTR pszPath)
 
static LPWSTR _GetUserSidStringFromToken (HANDLE Token)
 
static HRESULT _SHGetUserProfilePath (HANDLE hToken, DWORD dwFlags, BYTE folder, LPWSTR pszPath)
 
static HRESULT _SHGetAllUsersProfilePath (DWORD dwFlags, BYTE folder, LPWSTR pszPath)
 
static HRESULT _SHOpenProfilesKey (PHKEY pKey)
 
static HRESULT _SHGetProfilesValue (HKEY profilesKey, LPCWSTR szValueName, LPWSTR szValue, LPCWSTR szDefault)
 
static BOOL WINAPI init_xdg_dirs (INIT_ONCE *once, void *param, void **context)
 
static char * get_xdg_path (const char *var)
 
static BOOL link_folder (HANDLE mgr, const UNICODE_STRING *path, const char *link)
 
static void create_link (const WCHAR *path, const char *xdg_name, const char *default_name)
 
static void _SHCreateSymbolicLink (int nFolder, const WCHAR *path)
 
HRESULT WINAPI SHGetFolderPathW (HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath)
 
HRESULT WINAPI SHGetFolderPathAndSubDirA (HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPCSTR pszSubPath, LPSTR pszPath)
 
HRESULT WINAPI SHGetFolderPathAndSubDirW (HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPCWSTR pszSubPath, LPWSTR pszPath)
 
HRESULT WINAPI SHGetFolderPathA (HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPSTR pszPath)
 
static HRESULT _SHRegisterFolders (HKEY hRootKey, HANDLE hToken, LPCWSTR szUserShellFolderPath, LPCWSTR szShellFolderPath, const UINT folders[], UINT foldersLen)
 
static HRESULT _SHRegisterUserShellFolders (BOOL bDefault)
 
static HRESULT _SHRegisterCommonShellFolders (void)
 
static HRESULT create_extra_folders (void)
 
static HRESULT set_folder_attributes (void)
 
BOOL WINAPI SHGetSpecialFolderPathA (HWND hwndOwner, LPSTR szPath, int nFolder, BOOL bCreate)
 
BOOL WINAPI SHGetSpecialFolderPathW (HWND hwndOwner, LPWSTR szPath, int nFolder, BOOL bCreate)
 
BOOL WINAPI SHGetSpecialFolderPathAW (HWND hwndOwner, LPVOID szPath, int nFolder, BOOL bCreate)
 
HRESULT WINAPI SHGetFolderLocation (HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwReserved, LPITEMIDLIST *ppidl)
 
HRESULT WINAPI SHGetSpecialFolderLocation (HWND hwndOwner, INT nFolder, LPITEMIDLIST *ppidl)
 
HRESULT WINAPI SHGetKnownFolderPath (REFKNOWNFOLDERID rfid, DWORD flags, HANDLE token, WCHAR **ret_path)
 
HRESULT WINAPI SHGetFolderPathEx (REFKNOWNFOLDERID rfid, DWORD flags, HANDLE token, LPWSTR path, DWORD len)
 
static HRESULT get_known_folder_registry_path (REFKNOWNFOLDERID rfid, LPWSTR lpStringGuid, LPWSTR *lpPath)
 
static HRESULT get_known_folder_wstr (const WCHAR *regpath, const WCHAR *value, WCHAR **out)
 
static HRESULT get_known_folder_dword (const WCHAR *registryPath, const WCHAR *value, DWORD *out)
 
static HRESULT get_known_folder_redirection_place (REFKNOWNFOLDERID rfid, HKEY *rootKey)
 
static HRESULT get_known_folder_path_by_id (REFKNOWNFOLDERID folderId, LPWSTR lpRegistryPath, DWORD dwFlags, LPWSTR *ppszPath)
 
static HRESULT redirect_known_folder (REFKNOWNFOLDERID rfid, HWND hwnd, KF_REDIRECT_FLAGS flags, LPCWSTR pszTargetPath, UINT cFolders, KNOWNFOLDERID const *pExclusion, LPWSTR *ppszError)
 
static struct knownfolder * impl_from_IKnownFolder (IKnownFolder *iface)
 
static ULONG WINAPI knownfolder_AddRef (IKnownFolder *iface)
 
static ULONG WINAPI knownfolder_Release (IKnownFolder *iface)
 
static HRESULT WINAPI knownfolder_QueryInterface (IKnownFolder *iface, REFIID riid, void **ppv)
 
static HRESULT knownfolder_set_id (struct knownfolder *knownfolder, const KNOWNFOLDERID *kfid)
 
static HRESULT WINAPI knownfolder_GetId (IKnownFolder *iface, KNOWNFOLDERID *pkfid)
 
static HRESULT WINAPI knownfolder_GetCategory (IKnownFolder *iface, KF_CATEGORY *pCategory)
 
static HRESULT WINAPI knownfolder_GetShellItem (IKnownFolder *iface, DWORD flags, REFIID riid, void **ppv)
 
static HRESULT get_known_folder_path (LPWSTR sFolderId, LPWSTR registryPath, LPWSTR *ppszPath)
 
static HRESULT WINAPI knownfolder_GetPath (IKnownFolder *iface, DWORD dwFlags, LPWSTR *ppszPath)
 
static HRESULT WINAPI knownfolder_SetPath (IKnownFolder *iface, DWORD dwFlags, LPCWSTR pszPath)
 
static HRESULT WINAPI knownfolder_GetIDList (IKnownFolder *iface, DWORD flags, PIDLIST_ABSOLUTE *ppidl)
 
static HRESULT WINAPI knownfolder_GetFolderType (IKnownFolder *iface, FOLDERTYPEID *pftid)
 
static HRESULT WINAPI knownfolder_GetRedirectionCapabilities (IKnownFolder *iface, KF_REDIRECTION_CAPABILITIES *pCapabilities)
 
static HRESULT WINAPI knownfolder_GetFolderDefinition (IKnownFolder *iface, KNOWNFOLDER_DEFINITION *pKFD)
 
static HRESULT knownfolder_create (struct knownfolder **knownfolder)
 
static struct foldermanager * impl_from_IKnownFolderManager (IKnownFolderManager *iface)
 
static ULONG WINAPI foldermanager_AddRef (IKnownFolderManager *iface)
 
static ULONG WINAPI foldermanager_Release (IKnownFolderManager *iface)
 
static HRESULT WINAPI foldermanager_QueryInterface (IKnownFolderManager *iface, REFIID riid, void **ppv)
 
static HRESULT WINAPI foldermanager_FolderIdFromCsidl (IKnownFolderManager *iface, int nCsidl, KNOWNFOLDERID *pfid)
 
static HRESULT WINAPI foldermanager_FolderIdToCsidl (IKnownFolderManager *iface, REFKNOWNFOLDERID rfid, int *pnCsidl)
 
static HRESULT WINAPI foldermanager_GetFolderIds (IKnownFolderManager *iface, KNOWNFOLDERID **ppKFId, UINT *pCount)
 
static BOOL is_knownfolder (struct foldermanager *fm, const KNOWNFOLDERID *id)
 
static HRESULT WINAPI foldermanager_GetFolder (IKnownFolderManager *iface, REFKNOWNFOLDERID rfid, IKnownFolder **ppkf)
 
static HRESULT WINAPI foldermanager_GetFolderByName (IKnownFolderManager *iface, LPCWSTR pszCanonicalName, IKnownFolder **ppkf)
 
static HRESULT register_folder (const KNOWNFOLDERID *rfid, const KNOWNFOLDER_DEFINITION *pKFD)
 
static HRESULT WINAPI foldermanager_RegisterFolder (IKnownFolderManager *iface, REFKNOWNFOLDERID rfid, KNOWNFOLDER_DEFINITION const *pKFD)
 
static HRESULT WINAPI foldermanager_UnregisterFolder (IKnownFolderManager *iface, REFKNOWNFOLDERID rfid)
 
static HRESULT WINAPI foldermanager_FindFolderFromPath (IKnownFolderManager *iface, LPCWSTR pszPath, FFFP_MODE mode, IKnownFolder **ppkf)
 
static HRESULT WINAPI foldermanager_FindFolderFromIDList (IKnownFolderManager *iface, PCIDLIST_ABSOLUTE pidl, IKnownFolder **ppkf)
 
static HRESULT WINAPI foldermanager_Redirect (IKnownFolderManager *iface, REFKNOWNFOLDERID rfid, HWND hwnd, KF_REDIRECT_FLAGS flags, LPCWSTR pszTargetPath, UINT cFolders, KNOWNFOLDERID const *pExclusion, LPWSTR *ppszError)
 
static HRESULT foldermanager_create (void **ppv)
 
HRESULT WINAPI KnownFolderManager_Constructor (IUnknown *punk, REFIID riid, void **ppv)
 
HRESULT WINAPI SHGetKnownFolderIDList (REFKNOWNFOLDERID rfid, DWORD flags, HANDLE token, PIDLIST_ABSOLUTE *pidl)
 
HRESULT WINAPI SHGetKnownFolderItem (REFKNOWNFOLDERID rfid, KNOWN_FOLDER_FLAG flags, HANDLE hToken, REFIID riid, void **ppv)
 
static void register_system_knownfolders (void)
 
HRESULT SHELL_RegisterShellFolders (void)
 

Variables

static const BOOL is_win64 = sizeof(void *) > sizeof(int)
 
static const IApplicationDestinationsVtbl ApplicationDestinationsVtbl
 
static const IApplicationDocumentListsVtbl ApplicationDocumentListsVtbl
 
static const CSIDL_DATA CSIDL_Data []
 
static char * xdg_config
 
static DWORD xdg_config_len
 
static const struct IKnownFolderVtbl knownfolder_vtbl
 
static const struct IKnownFolderManagerVtbl foldermanager_vtbl
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 59 of file shellpath.c.

◆ CSIDL_APPDATA_LOCALLOW

#define CSIDL_APPDATA_LOCALLOW   0x004e

Definition at line 1572 of file shellpath.c.

◆ CSIDL_CONTACTS

#define CSIDL_CONTACTS   0x0043

Definition at line 1569 of file shellpath.c.

◆ CSIDL_DOWNLOADS

#define CSIDL_DOWNLOADS   0x0047

Definition at line 1570 of file shellpath.c.

◆ CSIDL_LINKS

#define CSIDL_LINKS   0x004d

Definition at line 1571 of file shellpath.c.

◆ CSIDL_SAVED_GAMES

#define CSIDL_SAVED_GAMES   0x0062

Definition at line 1573 of file shellpath.c.

◆ CSIDL_SEARCHES

#define CSIDL_SEARCHES   0x0063

Definition at line 1574 of file shellpath.c.

◆ WINE_MOUNTMGR_EXTENSIONS

#define WINE_MOUNTMGR_EXTENSIONS

Definition at line 74 of file shellpath.c.

Typedef Documentation

◆ CSIDL_Type

Enumeration Type Documentation

◆ _CSIDL_Type

Enumerator
CSIDL_Type_User 
CSIDL_Type_AllUsers 
CSIDL_Type_CurrVer 
CSIDL_Type_Disallowed 
CSIDL_Type_NonExistent 
CSIDL_Type_WindowsPath 
CSIDL_Type_SystemPath 
CSIDL_Type_SystemX86Path 
CSIDL_Type_ProgramData 

Definition at line 1557 of file shellpath.c.

1557 {
1567} CSIDL_Type;
enum _CSIDL_Type CSIDL_Type
@ CSIDL_Type_CurrVer
Definition: shellpath.c:1560
@ CSIDL_Type_ProgramData
Definition: shellpath.c:1566
@ CSIDL_Type_AllUsers
Definition: shellpath.c:1559
@ CSIDL_Type_WindowsPath
Definition: shellpath.c:1563
@ CSIDL_Type_Disallowed
Definition: shellpath.c:1561
@ CSIDL_Type_SystemX86Path
Definition: shellpath.c:1565
@ CSIDL_Type_SystemPath
Definition: shellpath.c:1564
@ CSIDL_Type_User
Definition: shellpath.c:1558
@ CSIDL_Type_NonExistent
Definition: shellpath.c:1562

Function Documentation

◆ _GetUserSidStringFromToken()

static LPWSTR _GetUserSidStringFromToken ( HANDLE  Token)
static

Definition at line 3238 of file shellpath.c.

3239{
3240 char InfoBuffer[64];
3241 PTOKEN_USER UserInfo;
3242 DWORD InfoSize;
3243 LPWSTR SidStr;
3244
3245 UserInfo = (PTOKEN_USER) InfoBuffer;
3246 if (! GetTokenInformation(Token, TokenUser, InfoBuffer, sizeof(InfoBuffer),
3247 &InfoSize))
3248 {
3250 return NULL;
3251 UserInfo = malloc(InfoSize);
3252 if (UserInfo == NULL)
3253 return NULL;
3254 if (! GetTokenInformation(Token, TokenUser, UserInfo, InfoSize,
3255 &InfoSize))
3256 {
3257 free(UserInfo);
3258 return NULL;
3259 }
3260 }
3261
3262 if (! ConvertSidToStringSidW(UserInfo->User.Sid, &SidStr))
3263 SidStr = NULL;
3264
3265 if (UserInfo != (PTOKEN_USER) InfoBuffer)
3266 free(UserInfo);
3267
3268 return SidStr;
3269}
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define NULL
Definition: types.h:112
BOOL WINAPI GetTokenInformation(HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength)
Definition: security.c:411
BOOL WINAPI ConvertSidToStringSidW(PSID Sid, LPWSTR *StringSid)
Definition: security.c:3583
unsigned long DWORD
Definition: ntddk_ex.h:95
SID_AND_ATTRIBUTES User
Definition: setypes.h:1022
uint16_t * LPWSTR
Definition: typedefs.h:56
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
struct _TOKEN_USER * PTOKEN_USER
@ TokenUser
Definition: setypes.h:978

Referenced by _SHGetUserProfilePath().

◆ _SHCreateSymbolicLink()

static void _SHCreateSymbolicLink ( int  nFolder,
const WCHAR *  path 
)
static

Definition at line 3766 of file shellpath.c.

3767{
3769
3770 switch (folder) {
3771 case CSIDL_PERSONAL:
3772 create_link( path, "XDG_DOCUMENTS_DIR", "$HOME/Documents" );
3773 break;
3775 create_link( path, "XDG_DESKTOP_DIR", "$HOME/Desktop" );
3776 break;
3777 case CSIDL_MYPICTURES:
3778 create_link( path, "XDG_PICTURES_DIR", "$HOME/Pictures" );
3779 break;
3780 case CSIDL_MYVIDEO:
3781 create_link( path, "XDG_VIDEOS_DIR", "$HOME/Movies" );
3782 break;
3783 case CSIDL_MYMUSIC:
3784 create_link( path, "XDG_MUSIC_DIR", "$HOME/Music" );
3785 break;
3786 case CSIDL_DOWNLOADS:
3787 create_link( path, "XDG_DOWNLOAD_DIR", "$HOME/Downloads" );
3788 break;
3789 case CSIDL_TEMPLATES:
3790 create_link( path, "XDG_TEMPLATES_DIR", "$HOME/Templates" );
3791 break;
3792 }
3793}
#define CSIDL_DOWNLOADS
Definition: shellpath.c:1570
static void create_link(const WCHAR *path, const char *xdg_name, const char *default_name)
Definition: shellpath.c:3728
#define CSIDL_TEMPLATES
Definition: shlobj.h:2240
#define CSIDL_DESKTOPDIRECTORY
Definition: shlobj.h:2235
#define CSIDL_PERSONAL
Definition: shlobj.h:2225
#define CSIDL_MYPICTURES
Definition: shlobj.h:2258
#define CSIDL_FOLDER_MASK
Definition: shlobj.h:2278
#define CSIDL_MYMUSIC
Definition: shlobj.h:2233
#define CSIDL_MYVIDEO
Definition: shlobj.h:2234
_In_ int nFolder
Definition: shlobj.h:1564
Definition: fci.c:112

Referenced by SHGetFolderPathAndSubDirW().

◆ _SHExpandEnvironmentStrings()

static HRESULT _SHExpandEnvironmentStrings ( LPCWSTR  szSrc,
LPWSTR  szDest 
)
static

Definition at line 3469 of file shellpath.c.

3473{
3474 HRESULT hr;
3475 WCHAR szTemp[MAX_PATH], szProfilesPrefix[MAX_PATH] = { 0 };
3476 HKEY key = NULL;
3477
3478 TRACE("%s, %p\n", debugstr_w(szSrc), szDest);
3479
3480 if (!szSrc || !szDest) return E_INVALIDARG;
3481
3482 /* short-circuit if there's nothing to expand */
3483 if (szSrc[0] != '%')
3484 {
3485 lstrcpyW(szDest, szSrc);
3486 hr = S_OK;
3487 goto end;
3488 }
3489
3490 /* Get the profile prefix, we'll probably be needing it */
3492 if (SUCCEEDED(hr))
3493 {
3494 WCHAR def_val[MAX_PATH];
3495
3496 /* get the system drive */
3497 GetSystemDirectoryW(def_val, MAX_PATH);
3498 lstrcpyW( def_val + 3, L"users" );
3499
3500 hr = _SHGetProfilesValue(key, L"ProfilesDirectory", szProfilesPrefix, def_val );
3501 }
3502
3503 *szDest = 0;
3504 lstrcpyW(szTemp, szSrc);
3505 while (SUCCEEDED(hr) && szTemp[0] == '%')
3506 {
3507 if (!wcsnicmp(szTemp, L"%ALLUSERSPROFILE%", lstrlenW(L"%ALLUSERSPROFILE%")))
3508 {
3509#ifndef __REACTOS__
3510 WCHAR szAllUsers[MAX_PATH], def_val[MAX_PATH];
3511
3512 GetSystemDirectoryW(def_val, MAX_PATH);
3513 lstrcpyW( def_val + 3, L"users\\Public" );
3514
3515 hr = _SHGetProfilesValue(key, L"Public", szAllUsers, def_val);
3516 PathAppendW(szDest, szAllUsers);
3517#else
3518 DWORD cchSize = cchDest;
3519 if (!GetAllUsersProfileDirectoryW(szDest, &cchSize))
3520 goto fallback_expand;
3521#endif
3522 PathAppendW(szDest, szTemp + lstrlenW(L"%ALLUSERSPROFILE%"));
3523 }
3524 else if (!wcsnicmp(szTemp, L"%PUBLIC%", lstrlenW(L"%PUBLIC%")))
3525 {
3526 WCHAR szAllUsers[MAX_PATH], def_val[MAX_PATH];
3527
3528 GetSystemDirectoryW(def_val, MAX_PATH);
3529 lstrcpyW( def_val + 3, L"users\\Public" );
3530
3531 hr = _SHGetProfilesValue(key, L"Public", szAllUsers, def_val);
3532 PathAppendW(szDest, szAllUsers);
3533 PathAppendW(szDest, szTemp + lstrlenW(L"%PUBLIC%"));
3534 }
3535 else if (!wcsnicmp(szTemp, L"%ProgramData%", lstrlenW(L"%ProgramData%")))
3536 {
3537 WCHAR szProgramData[MAX_PATH], def_val[MAX_PATH];
3538 HKEY shellFolderKey;
3539 DWORD dwType, dwPathLen = sizeof(def_val);
3540 BOOL in_registry = FALSE;
3541
3542 if (!RegCreateKeyW(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &shellFolderKey))
3543 {
3544 if (!RegQueryValueExW(shellFolderKey, L"Common AppData", NULL, &dwType,
3545 (LPBYTE)def_val, &dwPathLen) && (dwType == REG_EXPAND_SZ || dwType == REG_SZ))
3546 in_registry = TRUE;
3547
3548 RegCloseKey(shellFolderKey);
3549 }
3550
3551 if (!in_registry)
3552 {
3553 GetSystemDirectoryW(def_val, MAX_PATH);
3554 lstrcpyW( def_val + 3, L"ProgramData" );
3555 }
3556
3557 hr = _SHGetProfilesValue(key, L"ProgramData", szProgramData, def_val);
3558 PathAppendW(szDest, szProgramData);
3559 PathAppendW(szDest, szTemp + lstrlenW(L"%ProgramData%"));
3560 }
3561 else if (!wcsnicmp(szTemp, L"%USERPROFILE%", lstrlenW(L"%USERPROFILE%")))
3562 {
3563#ifndef __REACTOS__
3565 DWORD userLen = MAX_PATH;
3566
3567 lstrcpyW(szDest, szProfilesPrefix);
3568 GetUserNameW(userName, &userLen);
3569 PathAppendW(szDest, userName);
3570#else
3571 DWORD cchSize = cchDest;
3572 if (!SHELL_GetUserProfileDirectoryW(hToken, szDest, &cchSize))
3573 goto fallback_expand;
3574#endif
3575 PathAppendW(szDest, szTemp + lstrlenW(L"%USERPROFILE%"));
3576 }
3577 else if (!wcsnicmp(szTemp, L"%SystemDrive%", lstrlenW(L"%SystemDrive%")))
3578 {
3579#ifndef __REACTOS__
3581#else
3582 if (!GetSystemDirectoryW(szDest, cchDest))
3583 goto fallback_expand;
3584#endif
3585 lstrcpyW(szDest + 3, szTemp + lstrlenW(L"%SystemDrive%") + 1);
3586 }
3587 else
3588#ifdef __REACTOS__
3589fallback_expand:
3590#endif
3591 {
3592#ifndef __REACTOS__
3593 DWORD ret = ExpandEnvironmentStringsW(szTemp, szDest, MAX_PATH);
3594#else
3595 DWORD ret = SHExpandEnvironmentStringsForUserW(hToken, szTemp, szDest, cchDest);
3596#endif
3597
3598#ifndef __REACTOS__
3599 if (ret > MAX_PATH)
3600#else
3601 if (ret > cchDest)
3602#endif
3604 else if (ret == 0)
3606 else if (!wcscmp( szTemp, szDest )) break; /* nothing expanded */
3607 }
3608 if (SUCCEEDED(hr)) lstrcpyW(szTemp, szDest);
3609 }
3610end:
3611#ifndef __REACTOS__
3612 if (key)
3614#endif
3615 TRACE("returning 0x%08lx (input was %s, output is %s)\n", hr,
3616 debugstr_w(szSrc), debugstr_w(szDest));
3617 return hr;
3618}
#define REG_SZ
Definition: layer.c:22
#define RegCloseKey(hKey)
Definition: registry.h:49
#define E_INVALIDARG
Definition: ddrawi.h:101
HRESULT hr
Definition: delayimp.cpp:582
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
LONG WINAPI RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1201
BOOL WINAPI GetUserNameW(LPWSTR lpszName, LPDWORD lpSize)
Definition: misc.c:291
#define wcsnicmp
Definition: compat.h:14
#define MAX_PATH
Definition: compat.h:34
#define lstrcpyW
Definition: compat.h:749
#define lstrlenW
Definition: compat.h:750
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:492
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2331
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:1977
static HRESULT _SHOpenProfilesKey(PHKEY pKey)
Definition: shellpath.c:3405
static HRESULT _SHGetProfilesValue(HKEY profilesKey, LPCWSTR szValueName, LPWSTR szValue, LPCWSTR szDefault)
Definition: shellpath.c:3420
BOOL WINAPI GetAllUsersProfileDirectoryW(_Out_opt_ LPWSTR lpProfileDir, _Inout_ LPDWORD lpcchSize)
Definition: profile.c:1315
return ret
Definition: mutex.c:147
#define L(x)
Definition: resources.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint GLuint end
Definition: gl.h:1545
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define debugstr_w
Definition: kernel32.h:32
#define REG_EXPAND_SZ
Definition: nt_native.h:1497
#define PathAppendW
Definition: pathcch.h:310
short WCHAR
Definition: pedump.c:58
_In_ INT cchDest
Definition: shlwapi.h:1161
#define TRACE(s)
Definition: solgame.cpp:4
Definition: copy.c:22
unsigned char * LPBYTE
Definition: typedefs.h:53
static HRESULT HRESULT_FROM_WIN32(unsigned int x)
Definition: winerror.h:210
#define E_NOT_SUFFICIENT_BUFFER
Definition: winerror.h:3437
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
static const WCHAR userName[]
Definition: wnet.c:2156

Referenced by _SHGetUserShellFolderPath(), and SHGetFolderPathAndSubDirW().

◆ _SHGetAllUsersProfilePath()

static HRESULT _SHGetAllUsersProfilePath ( DWORD  dwFlags,
BYTE  folder,
LPWSTR  pszPath 
)
static

Definition at line 3366 of file shellpath.c.

3368{
3369 HRESULT hr;
3370
3371 TRACE("0x%08lx,0x%02x,%p\n", dwFlags, folder, pszPath);
3372
3374 return E_INVALIDARG;
3376 return E_INVALIDARG;
3377 if (!pszPath)
3378 return E_INVALIDARG;
3379
3381#ifndef __REACTOS__
3382 hr = _SHGetDefaultValue(folder, pszPath);
3383#else
3384 hr = _SHGetDefaultValue(NULL, folder, pszPath);
3385#endif
3386 else
3387 {
3388#ifndef __REACTOS__
3390#else
3392#endif
3393 CSIDL_Data[folder].value, pszPath);
3394 if (FAILED(hr))
3395#ifndef __REACTOS__
3396 hr = _SHGetDefaultValue(folder, pszPath);
3397#else
3398 hr = _SHGetDefaultValue(NULL, folder, pszPath);
3399#endif
3400 }
3401 TRACE("returning 0x%08lx (output path is %s)\n", hr, debugstr_w(pszPath));
3402 return hr;
3403}
#define ARRAY_SIZE(A)
Definition: main.h:20
static HRESULT _SHGetDefaultValue(BYTE folder, LPWSTR pszPath)
Definition: shellpath.c:3085
static const CSIDL_DATA CSIDL_Data[]
Definition: shellpath.c:1826
static HRESULT _SHGetUserShellFolderPath(HKEY rootKey, LPCWSTR userPrefix, LPCWSTR value, LPWSTR path)
Definition: shellpath.c:2976
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define FAILED(hr)
Definition: intsafe.h:51
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition: netsh.h:141
@ SHGFP_TYPE_DEFAULT
Definition: shlobj.h:2197
Definition: pdh_main.c:64

Referenced by _SHRegisterFolders(), and SHGetFolderPathAndSubDirW().

◆ _SHGetCurrentVersionPath()

static HRESULT _SHGetCurrentVersionPath ( DWORD  dwFlags,
BYTE  folder,
LPWSTR  pszPath 
)
static

Definition at line 3169 of file shellpath.c.

3171{
3172 HRESULT hr;
3173
3174 TRACE("0x%08lx,0x%02x,%p\n", dwFlags, folder, pszPath);
3175
3177 return E_INVALIDARG;
3179 return E_INVALIDARG;
3180 if (!pszPath)
3181 return E_INVALIDARG;
3182
3184#ifndef __REACTOS__
3185 hr = _SHGetDefaultValue(folder, pszPath);
3186#else
3187 hr = _SHGetDefaultValue(NULL, folder, pszPath);
3188#endif
3189 else
3190 {
3191 HKEY hKey;
3192
3193 if (RegCreateKeyW(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion", &hKey))
3194 hr = E_FAIL;
3195 else
3196 {
3197 DWORD dwType, dwPathLen = MAX_PATH * sizeof(WCHAR);
3198
3200 &dwType, (LPBYTE)pszPath, &dwPathLen) ||
3201 (dwType != REG_SZ && dwType != REG_EXPAND_SZ))
3202 {
3203#ifndef __REACTOS__
3204 hr = _SHGetDefaultValue(folder, pszPath);
3205#else
3206 hr = _SHGetDefaultValue(NULL, folder, pszPath);
3207#endif
3208 dwType = REG_EXPAND_SZ;
3209 switch (folder)
3210 {
3213 /* these two should never be set on 32-bit setups */
3214 if (!is_win64)
3215 {
3216 BOOL is_wow64;
3218 if (!is_wow64) break;
3219 }
3220 /* fall through */
3221 default:
3223 (LPBYTE)pszPath, (lstrlenW(pszPath)+1)*sizeof(WCHAR));
3224 }
3225 }
3226 else
3227 {
3228 pszPath[dwPathLen / sizeof(WCHAR)] = '\0';
3229 hr = S_OK;
3230 }
3232 }
3233 }
3234 TRACE("returning 0x%08lx (output path is %s)\n", hr, debugstr_w(pszPath));
3235 return hr;
3236}
#define E_FAIL
Definition: ddrawi.h:102
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4882
#define GetCurrentProcess()
Definition: compat.h:759
#define IsWow64Process
Definition: compat.h:760
static const BOOL is_win64
Definition: shellpath.c:92
FxAutoRegKey hKey
BOOL is_wow64
Definition: main.c:38
#define CSIDL_PROGRAM_FILES_COMMONX86
Definition: shlobj.h:2263
#define CSIDL_PROGRAM_FILESX86
Definition: shlobj.h:2261

Referenced by SHGetFolderPathAndSubDirW().

◆ _SHGetDefaultValue()

static HRESULT _SHGetDefaultValue ( BYTE  folder,
LPWSTR  pszPath 
)
static

Definition at line 3085 of file shellpath.c.

3089{
3090 HRESULT hr;
3091
3092 TRACE("0x%02x,%p\n", folder, pszPath);
3093
3095 return E_INVALIDARG;
3096
3097 if (!pszPath)
3098 return E_INVALIDARG;
3099
3100#ifdef __REACTOS__
3101 if (hToken != NULL && hToken != (HANDLE)-1)
3102 {
3103 FIXME("unsupported for user other than current or default\n");
3104 }
3105#endif
3106
3107 if (!is_win64)
3108 {
3109 BOOL is_wow64;
3110
3111 switch (folder)
3112 {
3117 break;
3122 break;
3123 }
3124 }
3125
3126 if (!CSIDL_Data[folder].parent)
3127 {
3128 /* hit the root, sub in env var */
3129 switch (CSIDL_Data[folder].type)
3130 {
3131 case CSIDL_Type_User:
3132 lstrcpyW(pszPath, L"%USERPROFILE%");
3133 break;
3135 lstrcpyW(pszPath, L"%PUBLIC%");
3136 break;
3138 lstrcpyW(pszPath, L"%ProgramData%");
3139 break;
3140 case CSIDL_Type_CurrVer:
3141 lstrcpyW(pszPath, L"%SystemDrive%");
3142 break;
3143 default:
3144 ; /* no corresponding env. var, do nothing */
3145 }
3146 hr = S_OK;
3147 }else{
3148 /* prepend with parent */
3149#ifdef __REACTOS__
3151#else
3153#endif
3154 }
3155
3156 if (SUCCEEDED(hr))
3157 append_relative_path(folder, pszPath);
3158
3159 TRACE("returning 0x%08lx\n", hr);
3160 return hr;
3161}
#define FIXME(fmt,...)
Definition: precomp.h:53
static int csidl_from_id(const KNOWNFOLDERID *id)
Definition: shellpath.c:2913
static void append_relative_path(BYTE folder, WCHAR *pszPath)
Definition: shellpath.c:3059
r parent
Definition: btrfs.c:3010
#define CSIDL_PROGRAM_FILES
Definition: shlobj.h:2257
#define CSIDL_PROGRAM_FILES_COMMON
Definition: shlobj.h:2262

Referenced by _SHGetAllUsersProfilePath(), _SHGetCurrentVersionPath(), _SHGetDefaultValue(), and _SHGetUserProfilePath().

◆ _SHGetProfilesValue()

static HRESULT _SHGetProfilesValue ( HKEY  profilesKey,
LPCWSTR  szValueName,
LPWSTR  szValue,
LPCWSTR  szDefault 
)
static

Definition at line 3420 of file shellpath.c.

3422{
3423 HRESULT hr;
3424 DWORD type, dwPathLen = MAX_PATH * sizeof(WCHAR);
3425 LONG lRet;
3426
3427 TRACE("%p,%s,%p,%s\n", profilesKey, debugstr_w(szValueName), szValue,
3428 debugstr_w(szDefault));
3429 lRet = RegQueryValueExW(profilesKey, szValueName, NULL, &type,
3430 (LPBYTE)szValue, &dwPathLen);
3431 if (!lRet && (type == REG_SZ || type == REG_EXPAND_SZ) && dwPathLen
3432 && *szValue)
3433 {
3434 dwPathLen /= sizeof(WCHAR);
3435 szValue[dwPathLen] = '\0';
3436 hr = S_OK;
3437 }
3438 else
3439 {
3440 /* Missing or invalid value, set a default */
3441 lstrcpynW(szValue, szDefault, MAX_PATH);
3442 TRACE("Setting missing value %s to %s\n", debugstr_w(szValueName),
3443 debugstr_w(szValue));
3444 lRet = RegSetValueExW(profilesKey, szValueName, 0, REG_EXPAND_SZ,
3445 (LPBYTE)szValue,
3446 (lstrlenW(szValue) + 1) * sizeof(WCHAR));
3447 if (lRet)
3448 hr = HRESULT_FROM_WIN32(lRet);
3449 else
3450 hr = S_OK;
3451 }
3452 TRACE("returning 0x%08lx (output value is %s)\n", hr, debugstr_w(szValue));
3453 return hr;
3454}
#define lstrcpynW
Definition: compat.h:738
long LONG
Definition: pedump.c:60

Referenced by _SHExpandEnvironmentStrings().

◆ _SHGetUserProfilePath()

static HRESULT _SHGetUserProfilePath ( HANDLE  hToken,
DWORD  dwFlags,
BYTE  folder,
LPWSTR  pszPath 
)
static

Definition at line 3279 of file shellpath.c.

3281{
3282 const WCHAR *szValueName;
3283 WCHAR buffer[40];
3284 HRESULT hr;
3285
3286 TRACE("%p,0x%08lx,0x%02x,%p\n", hToken, dwFlags, folder, pszPath);
3287
3289 return E_INVALIDARG;
3291 return E_INVALIDARG;
3292 if (!pszPath)
3293 return E_INVALIDARG;
3294
3296 {
3297#ifndef __REACTOS__
3298 if (hToken != NULL && hToken != (HANDLE)-1)
3299 {
3300 FIXME("unsupported for user other than current or default\n");
3301 return E_FAIL;
3302 }
3303 hr = _SHGetDefaultValue(folder, pszPath);
3304#else
3305 hr = _SHGetDefaultValue(hToken, folder, pszPath);
3306#endif
3307 }
3308 else
3309 {
3310 static const WCHAR DefaultW[] = L".Default";
3311 LPCWSTR userPrefix = NULL;
3312 HKEY hRootKey;
3313
3314 if (hToken == (HANDLE)-1)
3315 {
3316 hRootKey = HKEY_USERS;
3317 userPrefix = DefaultW;
3318 }
3319 else if (hToken == NULL)
3320 hRootKey = HKEY_CURRENT_USER;
3321 else
3322 {
3323 hRootKey = HKEY_USERS;
3324 userPrefix = _GetUserSidStringFromToken(hToken);
3325 if (userPrefix == NULL)
3326 {
3327 hr = E_FAIL;
3328 goto error;
3329 }
3330 }
3331
3332 /* For CSIDL_Type_User we also use the GUID if no szValueName is provided */
3333 szValueName = CSIDL_Data[folder].value;
3334 if (!szValueName)
3335 {
3337 szValueName = &buffer[0];
3338 }
3339
3340#ifndef __REACTOS__
3341 hr = _SHGetUserShellFolderPath(hRootKey, userPrefix, szValueName, pszPath);
3342 if (FAILED(hr) && hRootKey != HKEY_LOCAL_MACHINE)
3343 hr = _SHGetUserShellFolderPath(HKEY_LOCAL_MACHINE, NULL, szValueName, pszPath);
3344 if (FAILED(hr))
3345 hr = _SHGetDefaultValue(folder, pszPath);
3346#else
3347 hr = _SHGetUserShellFolderPath(hRootKey, hToken, userPrefix, szValueName, pszPath);
3348 if (FAILED(hr) && hRootKey != HKEY_LOCAL_MACHINE)
3349 hr = _SHGetUserShellFolderPath(HKEY_LOCAL_MACHINE, hToken, NULL, szValueName, pszPath);
3350 if (FAILED(hr))
3351 hr = _SHGetDefaultValue(hToken, folder, pszPath);
3352#endif
3353 if (userPrefix != NULL && userPrefix != DefaultW)
3354 LocalFree((HLOCAL) userPrefix);
3355 }
3356error:
3357 TRACE("returning 0x%08lx (output path is %s)\n", hr, debugstr_w(pszPath));
3358 return hr;
3359}
INT WINAPI StringFromGUID2(REFGUID guid, LPOLESTR str, INT cmax)
Definition: combase.c:1525
static LPWSTR _GetUserSidStringFromToken(HANDLE Token)
Definition: shellpath.c:3238
GLuint buffer
Definition: glext.h:5915
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
#define error(str)
Definition: mkdosfs.c:1605
const WCHAR * value
Definition: shellpath.c:1811
const uint16_t * LPCWSTR
Definition: typedefs.h:57
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define HKEY_USERS
Definition: winreg.h:13

Referenced by _SHRegisterFolders(), and SHGetFolderPathAndSubDirW().

◆ _SHGetUserShellFolderPath()

static HRESULT _SHGetUserShellFolderPath ( HKEY  rootKey,
LPCWSTR  userPrefix,
LPCWSTR  value,
LPWSTR  path 
)
static

Definition at line 2976 of file shellpath.c.

2981{
2982 HRESULT hr;
2983 WCHAR shellFolderPath[MAX_PATH], userShellFolderPath[MAX_PATH];
2984 LPCWSTR pShellFolderPath, pUserShellFolderPath;
2985 HKEY userShellFolderKey, shellFolderKey;
2986 DWORD dwType, dwPathLen;
2987
2988 TRACE("%p,%s,%s,%p\n",rootKey, debugstr_w(userPrefix), debugstr_w(value),
2989 path);
2990
2991 if (userPrefix)
2992 {
2993 lstrcpyW(shellFolderPath, userPrefix);
2994 PathAddBackslashW(shellFolderPath);
2995 lstrcatW(shellFolderPath, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders");
2996 pShellFolderPath = shellFolderPath;
2997 lstrcpyW(userShellFolderPath, userPrefix);
2998 PathAddBackslashW(userShellFolderPath);
2999 lstrcatW(userShellFolderPath, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders");
3000 pUserShellFolderPath = userShellFolderPath;
3001 }
3002 else
3003 {
3004 pUserShellFolderPath = L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders";
3005 pShellFolderPath = L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders";
3006 }
3007
3008 if (RegCreateKeyW(rootKey, pShellFolderPath, &shellFolderKey))
3009 {
3010 TRACE("Failed to create %s\n", debugstr_w(pShellFolderPath));
3011 return E_FAIL;
3012 }
3013 if (RegCreateKeyW(rootKey, pUserShellFolderPath, &userShellFolderKey))
3014 {
3015 TRACE("Failed to create %s\n",
3016 debugstr_w(pUserShellFolderPath));
3017 RegCloseKey(shellFolderKey);
3018 return E_FAIL;
3019 }
3020
3021 dwPathLen = MAX_PATH * sizeof(WCHAR);
3022 if (!RegQueryValueExW(userShellFolderKey, value, NULL, &dwType,
3023 (LPBYTE)path, &dwPathLen) && (dwType == REG_EXPAND_SZ || dwType == REG_SZ))
3024 {
3025 LONG ret;
3026
3027 path[dwPathLen / sizeof(WCHAR)] = '\0';
3028 if (dwType == REG_EXPAND_SZ && path[0] == '%')
3029 {
3030 WCHAR szTemp[MAX_PATH];
3031
3032#ifndef __REACTOS__
3034#else
3035 hr = _SHExpandEnvironmentStrings(hToken, path, szTemp, _countof(szTemp));
3036 if (FAILED(hr))
3037 goto end;
3038#endif
3039 lstrcpynW(path, szTemp, MAX_PATH);
3040 }
3041 ret = RegSetValueExW(shellFolderKey, value, 0, REG_SZ, (LPBYTE)path,
3042 (lstrlenW(path) + 1) * sizeof(WCHAR));
3043 if (ret != ERROR_SUCCESS)
3045 else
3046 hr = S_OK;
3047 }
3048 else
3049 hr = E_FAIL;
3050#ifdef __REACTOS__
3051end:
3052#endif
3053 RegCloseKey(shellFolderKey);
3054 RegCloseKey(userShellFolderKey);
3055 TRACE("returning 0x%08lx\n", hr);
3056 return hr;
3057}
#define ERROR_SUCCESS
Definition: deptool.c:10
static HRESULT _SHExpandEnvironmentStrings(LPCWSTR szSrc, LPWSTR szDest)
Definition: shellpath.c:3469
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
#define PathAddBackslashW
Definition: pathcch.h:302
#define _countof(array)
Definition: sndvol32.h:70

Referenced by _SHGetAllUsersProfilePath(), and _SHGetUserProfilePath().

◆ _SHOpenProfilesKey()

static HRESULT _SHOpenProfilesKey ( PHKEY  pKey)
static

Definition at line 3405 of file shellpath.c.

3406{
3407 LONG lRet;
3408 DWORD disp;
3409
3410 lRet = RegCreateKeyExW(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList", 0, NULL, 0,
3411 KEY_ALL_ACCESS, NULL, pKey, &disp);
3412 return HRESULT_FROM_WIN32(lRet);
3413}
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1096
#define KEY_ALL_ACCESS
Definition: nt_native.h:1044
PCSYMCRYPT_HMAC_MD5_EXPANDED_KEY pKey

Referenced by _SHExpandEnvironmentStrings().

◆ _SHRegisterCommonShellFolders()

static HRESULT _SHRegisterCommonShellFolders ( void  )
static

Definition at line 4232 of file shellpath.c.

4233{
4234 static const UINT folders[] = {
4247 };
4248 HRESULT hr;
4249
4250 TRACE("\n");
4252 L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders",
4253 L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders",
4254 folders, ARRAY_SIZE(folders));
4255 TRACE("returning 0x%08lx\n", hr);
4256 return hr;
4257}
static HRESULT _SHRegisterFolders(HKEY hRootKey, HANDLE hToken, LPCWSTR szUserShellFolderPath, LPCWSTR szShellFolderPath, const UINT folders[], UINT foldersLen)
Definition: shellpath.c:4078
unsigned int UINT
Definition: sysinfo.c:13
#define CSIDL_COMMON_TEMPLATES
Definition: shlobj.h:2264
#define CSIDL_COMMON_DESKTOPDIRECTORY
Definition: shlobj.h:2244
#define CSIDL_COMMON_STARTMENU
Definition: shlobj.h:2241
#define CSIDL_COMMON_APPDATA
Definition: shlobj.h:2254
#define CSIDL_COMMON_PROGRAMS
Definition: shlobj.h:2242
#define CSIDL_COMMON_FAVORITES
Definition: shlobj.h:2250
#define CSIDL_COMMON_MUSIC
Definition: shlobj.h:2269
#define CSIDL_COMMON_VIDEO
Definition: shlobj.h:2271
#define CSIDL_COMMON_PICTURES
Definition: shlobj.h:2270
#define CSIDL_COMMON_STARTUP
Definition: shlobj.h:2243
#define CSIDL_COMMON_DOCUMENTS
Definition: shlobj.h:2265
#define CSIDL_COMMON_ADMINTOOLS
Definition: shlobj.h:2266

Referenced by SHELL_RegisterShellFolders().

◆ _SHRegisterFolders()

static HRESULT _SHRegisterFolders ( HKEY  hRootKey,
HANDLE  hToken,
LPCWSTR  szUserShellFolderPath,
LPCWSTR  szShellFolderPath,
const UINT  folders[],
UINT  foldersLen 
)
static

Definition at line 4078 of file shellpath.c.

4081{
4082 const WCHAR *szValueName;
4083 WCHAR buffer[40];
4084 UINT i;
4086 HRESULT hr = S_OK;
4087 HKEY hUserKey = NULL, hKey = NULL;
4088 DWORD dwType, dwPathLen;
4089 LONG ret;
4090
4091 TRACE("%p,%p,%s,%p,%u\n", hRootKey, hToken,
4092 debugstr_w(szUserShellFolderPath), folders, foldersLen);
4093
4094 ret = RegCreateKeyW(hRootKey, szUserShellFolderPath, &hUserKey);
4095 if (ret)
4097 else
4098 {
4099 ret = RegCreateKeyW(hRootKey, szShellFolderPath, &hKey);
4100 if (ret)
4102 }
4103 for (i = 0; SUCCEEDED(hr) && i < foldersLen; i++)
4104 {
4105 dwPathLen = MAX_PATH * sizeof(WCHAR);
4106
4107 /* For CSIDL_Type_User we also use the GUID if no szValueName is provided */
4108 szValueName = CSIDL_Data[folders[i]].value;
4109 if (!szValueName && CSIDL_Data[folders[i]].type == CSIDL_Type_User)
4110 {
4111 StringFromGUID2( CSIDL_Data[folders[i]].id, buffer, 39 );
4112 szValueName = &buffer[0];
4113 }
4114
4115 if (RegQueryValueExW(hUserKey, szValueName, NULL,
4116 &dwType, (LPBYTE)path, &dwPathLen) || (dwType != REG_SZ &&
4117 dwType != REG_EXPAND_SZ))
4118 {
4119 *path = '\0';
4120 if (CSIDL_Data[folders[i]].type == CSIDL_Type_User)
4121 _SHGetUserProfilePath(hToken, SHGFP_TYPE_DEFAULT, folders[i],
4122 path);
4123 else if (CSIDL_Data[folders[i]].type == CSIDL_Type_AllUsers ||
4126 else if (CSIDL_Data[folders[i]].type == CSIDL_Type_WindowsPath)
4127 {
4129 append_relative_path(folders[i], path);
4130 }
4131 else
4132 hr = E_FAIL;
4133 if (*path)
4134 {
4135 ret = RegSetValueExW(hUserKey, szValueName, 0, REG_EXPAND_SZ,
4136 (LPBYTE)path, (lstrlenW(path) + 1) * sizeof(WCHAR));
4137 if (ret)
4139 else
4140 {
4142 hToken, SHGFP_TYPE_DEFAULT, path);
4143 ret = RegSetValueExW(hKey, szValueName, 0, REG_SZ,
4144 (LPBYTE)path, (lstrlenW(path) + 1) * sizeof(WCHAR));
4145 if (ret)
4147 }
4148 }
4149 }
4150 else
4151 {
4152 /* create the default dir, which may be different from the path
4153 * stored in the registry. */
4155 hToken, SHGFP_TYPE_DEFAULT, path);
4156 }
4157 }
4158 if (hUserKey)
4159 RegCloseKey(hUserKey);
4160 if (hKey)
4162
4163 TRACE("returning 0x%08lx\n", hr);
4164 return hr;
4165}
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2370
HRESULT WINAPI SHGetFolderPathW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath)
Definition: shellpath.c:3816
static HRESULT _SHGetAllUsersProfilePath(DWORD dwFlags, BYTE folder, LPWSTR pszPath)
Definition: shellpath.c:3366
static HRESULT _SHGetUserProfilePath(HANDLE hToken, DWORD dwFlags, BYTE folder, LPWSTR pszPath)
Definition: shellpath.c:3279
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define CSIDL_FLAG_CREATE
Definition: shlobj.h:2282

Referenced by _SHRegisterCommonShellFolders(), and _SHRegisterUserShellFolders().

◆ _SHRegisterUserShellFolders()

static HRESULT _SHRegisterUserShellFolders ( BOOL  bDefault)
static

Definition at line 4167 of file shellpath.c.

4168{
4169 static const UINT folders[] = {
4197 };
4198 WCHAR userShellFolderPath[MAX_PATH], shellFolderPath[MAX_PATH];
4199 LPCWSTR pUserShellFolderPath, pShellFolderPath;
4200 HRESULT hr = S_OK;
4201 HKEY hRootKey;
4202 HANDLE hToken;
4203
4204 TRACE("%s\n", bDefault ? "TRUE" : "FALSE");
4205 if (bDefault)
4206 {
4207 hToken = (HANDLE)-1;
4208 hRootKey = HKEY_USERS;
4209 lstrcpyW(userShellFolderPath, L".Default");
4210 PathAddBackslashW(userShellFolderPath);
4211 lstrcatW(userShellFolderPath, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders");
4212 pUserShellFolderPath = userShellFolderPath;
4213 lstrcpyW(shellFolderPath, L".Default");
4214 PathAddBackslashW(shellFolderPath);
4215 lstrcatW(shellFolderPath, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders");
4216 pShellFolderPath = shellFolderPath;
4217 }
4218 else
4219 {
4220 hToken = NULL;
4221 hRootKey = HKEY_CURRENT_USER;
4222 pUserShellFolderPath = L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders";
4223 pShellFolderPath = L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders";
4224 }
4225
4226 hr = _SHRegisterFolders(hRootKey, hToken, pUserShellFolderPath,
4227 pShellFolderPath, folders, ARRAY_SIZE(folders));
4228 TRACE("returning 0x%08lx\n", hr);
4229 return hr;
4230}
#define CSIDL_LINKS
Definition: shellpath.c:1571
#define CSIDL_APPDATA_LOCALLOW
Definition: shellpath.c:1572
#define CSIDL_SEARCHES
Definition: shellpath.c:1574
#define CSIDL_SAVED_GAMES
Definition: shellpath.c:1573
#define CSIDL_CONTACTS
Definition: shellpath.c:1569
#define CSIDL_INTERNET_CACHE
Definition: shlobj.h:2251
#define CSIDL_SENDTO
Definition: shlobj.h:2229
#define CSIDL_RECENT
Definition: shlobj.h:2228
#define CSIDL_ADMINTOOLS
Definition: shlobj.h:2267
#define CSIDL_FONTS
Definition: shlobj.h:2239
#define CSIDL_FAVORITES
Definition: shlobj.h:2226
#define CSIDL_COOKIES
Definition: shlobj.h:2252
#define CSIDL_HISTORY
Definition: shlobj.h:2253
#define CSIDL_LOCAL_APPDATA
Definition: shlobj.h:2247
#define CSIDL_STARTMENU
Definition: shlobj.h:2231
#define CSIDL_PROGRAMS
Definition: shlobj.h:2222
#define CSIDL_APPDATA
Definition: shlobj.h:2245
#define CSIDL_PRINTHOOD
Definition: shlobj.h:2246
#define CSIDL_STARTUP
Definition: shlobj.h:2227
#define CSIDL_NETHOOD
Definition: shlobj.h:2238
PVOID HANDLE
Definition: typedefs.h:73

Referenced by SHELL_RegisterShellFolders().

◆ append_relative_path()

static void append_relative_path ( BYTE  folder,
WCHAR *  pszPath 
)
static

Definition at line 3059 of file shellpath.c.

3060{
3061 if (CSIDL_Data[folder].path)
3062 {
3063 PathAddBackslashW(pszPath);
3064 lstrcatW(pszPath, CSIDL_Data[folder].path);
3065 }
3066 else if (CSIDL_Data[folder].def_path)
3067 {
3068 PathAddBackslashW(pszPath);
3069 lstrcatW(pszPath, CSIDL_Data[folder].def_path);
3070 }
3071}

Referenced by _SHGetDefaultValue(), _SHRegisterFolders(), and SHGetFolderPathAndSubDirW().

◆ ApplicationDestinations_AddRef()

static ULONG WINAPI ApplicationDestinations_AddRef ( IApplicationDestinations *  iface)
static

Definition at line 1612 of file shellpath.c.

1613{
1616
1617 TRACE("(%p), new refcount=%li\n", This, ref);
1618
1619 return ref;
1620}
#define InterlockedIncrement
Definition: armddk.h:53
static IApplicationDestinationsImpl * impl_from_IApplicationDestinations(IApplicationDestinations *iface)
Definition: shellpath.c:1582
Definition: send.c:48
uint32_t ULONG
Definition: typedefs.h:59

◆ ApplicationDestinations_Constructor()

HRESULT WINAPI ApplicationDestinations_Constructor ( IUnknown *  outer,
REFIID  riid,
LPVOID *  ppv 
)

Definition at line 1672 of file shellpath.c.

1673{
1675 HRESULT hr;
1676
1677 TRACE("(%p, %s, %p)\n", outer, debugstr_guid(riid), ppv);
1678
1679 if (outer)
1680 return CLASS_E_NOAGGREGATION;
1681
1682 if (!(This = SHAlloc(sizeof(*This))))
1683 return E_OUTOFMEMORY;
1684
1685 This->IApplicationDestinations_iface.lpVtbl = &ApplicationDestinationsVtbl;
1686 This->ref = 0;
1687
1688 hr = IUnknown_QueryInterface(&This->IApplicationDestinations_iface, riid, ppv);
1689 if (FAILED(hr))
1690 SHFree(This);
1691
1692 return hr;
1693}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:370
LPVOID WINAPI SHAlloc(SIZE_T len)
Definition: shellole.c:348
static const IApplicationDestinationsVtbl ApplicationDestinationsVtbl
Definition: shellpath.c:1662
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define debugstr_guid
Definition: kernel32.h:35
static IUnknown * outer
Definition: compobj.c:82
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:3771

◆ ApplicationDestinations_QueryInterface()

static HRESULT WINAPI ApplicationDestinations_QueryInterface ( IApplicationDestinations *  iface,
REFIID  riid,
LPVOID *  ppv 
)
static

Definition at line 1587 of file shellpath.c.

1589{
1591
1592 TRACE("(%p, %s, %p)\n", This, debugstr_guid(riid), ppv);
1593
1594 if (ppv == NULL)
1595 return E_POINTER;
1596
1597 if (IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IApplicationDestinations, riid))
1598 {
1599 *ppv = &This->IApplicationDestinations_iface;
1600 IUnknown_AddRef((IUnknown*)*ppv);
1601
1602 TRACE("Returning IApplicationDestinations: %p\n", *ppv);
1603 return S_OK;
1604 }
1605
1606 *ppv = NULL;
1607 FIXME("(%p)->(%s, %p) interface not supported.\n", This, debugstr_guid(riid), ppv);
1608
1609 return E_NOINTERFACE;
1610}
const GUID IID_IUnknown
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define E_NOINTERFACE
Definition: winerror.h:3479
#define E_POINTER
Definition: winerror.h:3480

◆ ApplicationDestinations_Release()

static ULONG WINAPI ApplicationDestinations_Release ( IApplicationDestinations *  iface)
static

Definition at line 1622 of file shellpath.c.

1623{
1626
1627 TRACE("(%p), new refcount=%li\n", This, ref);
1628
1629 if (ref == 0)
1630 free(This);
1631
1632 return ref;
1633}
#define InterlockedDecrement
Definition: armddk.h:52

◆ ApplicationDestinations_RemoveAllDestinations()

static HRESULT WINAPI ApplicationDestinations_RemoveAllDestinations ( IApplicationDestinations *  iface)
static

Definition at line 1653 of file shellpath.c.

1654{
1656
1657 FIXME("(%p) stub!\n", This);
1658
1659 return E_NOTIMPL;
1660}
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ ApplicationDestinations_RemoveDestination()

static HRESULT WINAPI ApplicationDestinations_RemoveDestination ( IApplicationDestinations *  iface,
IUnknown *  punk 
)
static

Definition at line 1644 of file shellpath.c.

1645{
1647
1648 FIXME("(%p, %p) stub!\n", This, punk);
1649
1650 return E_NOTIMPL;
1651}
_In_opt_ IUnknown * punk
Definition: shlwapi.h:158

◆ ApplicationDestinations_SetAppID()

static HRESULT WINAPI ApplicationDestinations_SetAppID ( IApplicationDestinations *  iface,
const WCHAR *  appid 
)
static

Definition at line 1635 of file shellpath.c.

1636{
1638
1639 FIXME("(%p, %s) stub!\n", This, debugstr_w(appid));
1640
1641 return E_NOTIMPL;
1642}
char * appid
Definition: mkisofs.c:161

◆ ApplicationDocumentLists_AddRef()

static ULONG WINAPI ApplicationDocumentLists_AddRef ( IApplicationDocumentLists *  iface)
static

Definition at line 1731 of file shellpath.c.

1732{
1735
1736 TRACE("(%p), new refcount=%li\n", This, ref);
1737
1738 return ref;
1739}
static IApplicationDocumentListsImpl * impl_from_IApplicationDocumentLists(IApplicationDocumentLists *iface)
Definition: shellpath.c:1701

◆ ApplicationDocumentLists_Constructor()

HRESULT WINAPI ApplicationDocumentLists_Constructor ( IUnknown *  outer,
REFIID  riid,
LPVOID *  ppv 
)

Definition at line 1784 of file shellpath.c.

1785{
1787 HRESULT hr;
1788
1789 TRACE("(%p, %s, %p)\n", outer, debugstr_guid(riid), ppv);
1790
1791 if (outer)
1792 return CLASS_E_NOAGGREGATION;
1793
1794 if (!(This = SHAlloc(sizeof(*This))))
1795 return E_OUTOFMEMORY;
1796
1797 This->IApplicationDocumentLists_iface.lpVtbl = &ApplicationDocumentListsVtbl;
1798 This->ref = 0;
1799
1800 hr = IUnknown_QueryInterface(&This->IApplicationDocumentLists_iface, riid, ppv);
1801 if (FAILED(hr))
1802 SHFree(This);
1803
1804 return hr;
1805}
static const IApplicationDocumentListsVtbl ApplicationDocumentListsVtbl
Definition: shellpath.c:1775

◆ ApplicationDocumentLists_GetList()

static HRESULT WINAPI ApplicationDocumentLists_GetList ( IApplicationDocumentLists *  iface,
APPDOCLISTTYPE  list_type,
UINT  item_count,
REFIID  riid,
void **  obj 
)
static

Definition at line 1764 of file shellpath.c.

1767{
1769
1770 FIXME("(%p, %u, %u, %s, %p): stub\n", This, list_type, item_count, debugstr_guid(riid), obj);
1771
1772 return E_NOTIMPL;
1773}

◆ ApplicationDocumentLists_QueryInterface()

static HRESULT WINAPI ApplicationDocumentLists_QueryInterface ( IApplicationDocumentLists *  iface,
REFIID  riid,
LPVOID *  ppv 
)
static

Definition at line 1706 of file shellpath.c.

1708{
1710
1711 TRACE("(%p, %s, %p)\n", This, debugstr_guid(riid), ppv);
1712
1713 if (ppv == NULL)
1714 return E_POINTER;
1715
1716 if (IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IApplicationDocumentLists, riid))
1717 {
1718 *ppv = &This->IApplicationDocumentLists_iface;
1719 IUnknown_AddRef((IUnknown*)*ppv);
1720
1721 TRACE("Returning IApplicationDocumentLists: %p\n", *ppv);
1722 return S_OK;
1723 }
1724
1725 *ppv = NULL;
1726 FIXME("(%p)->(%s, %p) interface not supported.\n", This, debugstr_guid(riid), ppv);
1727
1728 return E_NOINTERFACE;
1729}

◆ ApplicationDocumentLists_Release()

static ULONG WINAPI ApplicationDocumentLists_Release ( IApplicationDocumentLists *  iface)
static

Definition at line 1741 of file shellpath.c.

1742{
1745
1746 TRACE("(%p), new refcount=%li\n", This, ref);
1747
1748 if (ref == 0)
1749 free(This);
1750
1751 return ref;
1752}

◆ ApplicationDocumentLists_SetAppID()

static HRESULT WINAPI ApplicationDocumentLists_SetAppID ( IApplicationDocumentLists *  iface,
const WCHAR *  appid 
)
static

Definition at line 1754 of file shellpath.c.

1756{
1758
1759 FIXME("(%p, %s) stub!\n", This, debugstr_w(appid));
1760
1761 return E_NOTIMPL;
1762}

◆ create_extra_folders()

static HRESULT create_extra_folders ( void  )
static

Definition at line 4265 of file shellpath.c.

4266{
4267 WCHAR path[MAX_PATH+5];
4268 HRESULT hr;
4269 HKEY hkey;
4270 DWORD type, size, ret;
4271
4272 ret = RegCreateKeyW( HKEY_CURRENT_USER, L"Environment", &hkey );
4273 if (ret) return HRESULT_FROM_WIN32( ret );
4274
4276 SHGFP_TYPE_DEFAULT, L"Temp", path );
4277 if (SUCCEEDED(hr))
4278 {
4279 size = sizeof(path);
4280 if (RegQueryValueExW( hkey, L"TEMP", NULL, &type, (LPBYTE)path, &size ))
4281 RegSetValueExW( hkey, L"TEMP", 0, REG_SZ, (LPBYTE)path, (lstrlenW(path) + 1) * sizeof(WCHAR) );
4282 size = sizeof(path);
4283 if (RegQueryValueExW( hkey, L"TMP", NULL, &type, (LPBYTE)path, &size ))
4284 RegSetValueExW( hkey, L"TMP", 0, REG_SZ, (LPBYTE)path, (lstrlenW(path) + 1) * sizeof(WCHAR) );
4285 }
4286 RegCloseKey( hkey );
4287
4288 if (SUCCEEDED(hr))
4289 {
4291 SHGFP_TYPE_DEFAULT, L"Microsoft", path );
4292 }
4293 if (SUCCEEDED(hr))
4294 {
4296 SHGFP_TYPE_DEFAULT, L"Microsoft\\Windows\\Themes", path);
4297 }
4298 if (SUCCEEDED(hr))
4299 {
4301 SHGFP_TYPE_DEFAULT, L"Microsoft\\Windows\\AccountPictures", path);
4302 }
4303 if (SUCCEEDED(hr))
4304 {
4306 SHGFP_TYPE_DEFAULT, L"Screenshots", path);
4307 }
4308 return hr;
4309}
HRESULT WINAPI SHGetFolderPathAndSubDirW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPCWSTR pszSubPath, LPWSTR pszPath)
Definition: shellpath.c:3881
GLsizeiptr size
Definition: glext.h:5919

Referenced by SHELL_RegisterShellFolders().

◆ create_link()

static void create_link ( const WCHAR *  path,
const char *  xdg_name,
const char *  default_name 
)
static

Definition at line 3728 of file shellpath.c.

3729{
3730 UNICODE_STRING nt_name;
3731 char *target = NULL;
3732 HANDLE mgr;
3733
3736 0, 0 )) == INVALID_HANDLE_VALUE)
3737 {
3738 FIXME( "failed to connect to mount manager\n" );
3739 return;
3740 }
3741
3742 nt_name.Buffer = NULL;
3743 if (!RtlDosPathNameToNtPathName_U( path, &nt_name, NULL, NULL )) goto done;
3744
3745 if ((target = get_xdg_path( xdg_name )))
3746 {
3747 if (link_folder( mgr, &nt_name, target )) goto done;
3748 }
3749 link_folder( mgr, &nt_name, default_name );
3750
3751done:
3752 RtlFreeUnicodeString( &nt_name );
3753 free( target );
3754 CloseHandle( mgr );
3755}
#define CloseHandle
Definition: compat.h:739
#define OPEN_EXISTING
Definition: compat.h:775
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define GENERIC_READ
Definition: compat.h:135
#define CreateFileW
Definition: compat.h:741
#define FILE_SHARE_READ
Definition: compat.h:136
static BOOL link_folder(HANDLE mgr, const UNICODE_STRING *path, const char *link)
Definition: shellpath.c:3703
static char * get_xdg_path(const char *var)
Definition: shellpath.c:3664
#define MOUNTMGR_DOS_DEVICE_NAME
Definition: mountmgr.h:37
NTSYSAPI BOOLEAN NTAPI RtlDosPathNameToNtPathName_U(_In_opt_z_ PCWSTR DosPathName, _Out_ PUNICODE_STRING NtPathName, _Out_opt_ PCWSTR *NtFileNamePart, _Out_opt_ PRTL_RELATIVE_NAME_U DirectoryInfo)
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define GENERIC_WRITE
Definition: nt_native.h:90
Definition: tools.h:99

Referenced by _SHCreateSymbolicLink().

◆ csidl_from_id()

static int csidl_from_id ( const KNOWNFOLDERID *  id)
static

Definition at line 2913 of file shellpath.c.

2914{
2915 int i;
2916 for (i = 0; i < ARRAY_SIZE(CSIDL_Data); i++)
2917 if (IsEqualGUID( CSIDL_Data[i].id, id )) return i;
2918 return -1;
2919}

Referenced by _SHGetDefaultValue(), foldermanager_FolderIdToCsidl(), and SHGetKnownFolderPath().

◆ foldermanager_AddRef()

static ULONG WINAPI foldermanager_AddRef ( IKnownFolderManager *  iface)
static

Definition at line 5291 of file shellpath.c.

5293{
5296}
static struct foldermanager * impl_from_IKnownFolderManager(IKnownFolderManager *iface)
Definition: shellpath.c:5286

◆ foldermanager_create()

static HRESULT foldermanager_create ( void **  ppv)
static

Definition at line 5612 of file shellpath.c.

5613{
5614 UINT i, j;
5615 struct foldermanager *fm;
5616
5617 fm = malloc( sizeof(*fm) );
5618 if (!fm) return E_OUTOFMEMORY;
5619
5621 fm->refs = 1;
5622 fm->num_ids = 0;
5623
5624 for (i = 0; i < ARRAY_SIZE(CSIDL_Data); i++)
5625 {
5626 if (!IsEqualGUID( CSIDL_Data[i].id, &GUID_NULL )) fm->num_ids++;
5627 }
5628 fm->ids = malloc( fm->num_ids * sizeof(KNOWNFOLDERID) );
5629 if (!fm->ids)
5630 {
5631 free( fm );
5632 return E_OUTOFMEMORY;
5633 }
5634 for (i = j = 0; i < ARRAY_SIZE(CSIDL_Data); i++)
5635 {
5636 if (!IsEqualGUID( CSIDL_Data[i].id, &GUID_NULL ))
5637 {
5638 fm->ids[j] = *CSIDL_Data[i].id;
5639 j++;
5640 }
5641 }
5642 TRACE("found %u known folders\n", fm->num_ids);
5644
5645 TRACE("returning iface %p\n", *ppv);
5646 return S_OK;
5647}
static const struct IKnownFolderManagerVtbl foldermanager_vtbl
Definition: shellpath.c:5595
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define GUID_NULL
Definition: ks.h:106
const KNOWNFOLDERID * id
Definition: shellpath.c:1809
KNOWNFOLDERID * ids
Definition: shellpath.c:5283
IKnownFolderManager IKnownFolderManager_iface
Definition: shellpath.c:5280

Referenced by KnownFolderManager_Constructor().

◆ foldermanager_FindFolderFromIDList()

static HRESULT WINAPI foldermanager_FindFolderFromIDList ( IKnownFolderManager *  iface,
PCIDLIST_ABSOLUTE  pidl,
IKnownFolder **  ppkf 
)
static

Definition at line 5573 of file shellpath.c.

5577{
5578 FIXME("%p, %p\n", pidl, ppkf);
5579 return E_NOTIMPL;
5580}

◆ foldermanager_FindFolderFromPath()

static HRESULT WINAPI foldermanager_FindFolderFromPath ( IKnownFolderManager *  iface,
LPCWSTR  pszPath,
FFFP_MODE  mode,
IKnownFolder **  ppkf 
)
static

Definition at line 5563 of file shellpath.c.

5568{
5569 FIXME("%s, 0x%08x, %p\n", debugstr_w(pszPath), mode, ppkf);
5570 return E_NOTIMPL;
5571}
GLenum mode
Definition: glext.h:6217

◆ foldermanager_FolderIdFromCsidl()

static HRESULT WINAPI foldermanager_FolderIdFromCsidl ( IKnownFolderManager *  iface,
int  nCsidl,
KNOWNFOLDERID *  pfid 
)
static

Definition at line 5341 of file shellpath.c.

5345{
5346 TRACE("%d, %p\n", nCsidl, pfid);
5347
5348 if (nCsidl >= ARRAY_SIZE(CSIDL_Data))
5349 return E_INVALIDARG;
5350 *pfid = *CSIDL_Data[nCsidl].id;
5351 return S_OK;
5352}

◆ foldermanager_FolderIdToCsidl()

static HRESULT WINAPI foldermanager_FolderIdToCsidl ( IKnownFolderManager *  iface,
REFKNOWNFOLDERID  rfid,
int *  pnCsidl 
)
static

Definition at line 5354 of file shellpath.c.

5358{
5359 int csidl;
5360
5361 TRACE("%s, %p\n", debugstr_guid(rfid), pnCsidl);
5362
5363 csidl = csidl_from_id( rfid );
5364 if (csidl == -1) return E_INVALIDARG;
5365 *pnCsidl = csidl;
5366 return S_OK;
5367}

◆ foldermanager_GetFolder()

static HRESULT WINAPI foldermanager_GetFolder ( IKnownFolderManager *  iface,
REFKNOWNFOLDERID  rfid,
IKnownFolder **  ppkf 
)
static

Definition at line 5411 of file shellpath.c.

5415{
5416 struct foldermanager *fm = impl_from_IKnownFolderManager( iface );
5417 struct knownfolder *kf;
5418 HRESULT hr;
5419
5420 TRACE("%s, %p\n", debugstr_guid(rfid), ppkf);
5421
5422 if (!is_knownfolder( fm, rfid ))
5423 {
5424 WARN("unknown folder\n");
5425 return E_INVALIDARG;
5426 }
5427 hr = knownfolder_create( &kf );
5428 if (SUCCEEDED( hr ))
5429 {
5430 hr = knownfolder_set_id( kf, rfid );
5431 *ppkf = &kf->IKnownFolder_iface;
5432 }
5433 else
5434 *ppkf = NULL;
5435
5436 return hr;
5437}
#define WARN(fmt,...)
Definition: precomp.h:61
static BOOL is_knownfolder(struct foldermanager *fm, const KNOWNFOLDERID *id)
Definition: shellpath.c:5384
static HRESULT knownfolder_set_id(struct knownfolder *knownfolder, const KNOWNFOLDERID *kfid)
Definition: shellpath.c:4938
static HRESULT knownfolder_create(struct knownfolder **knownfolder)
Definition: shellpath.c:5260
IKnownFolder IKnownFolder_iface
Definition: shellpath.c:4877

◆ foldermanager_GetFolderByName()

static HRESULT WINAPI foldermanager_GetFolderByName ( IKnownFolderManager *  iface,
LPCWSTR  pszCanonicalName,
IKnownFolder **  ppkf 
)
static

Definition at line 5439 of file shellpath.c.

5443{
5444 struct foldermanager *fm = impl_from_IKnownFolderManager( iface );
5445 struct knownfolder *kf;
5446 BOOL found = FALSE;
5447 HRESULT hr;
5448 UINT i;
5449
5450 TRACE( "%s, %p\n", debugstr_w(pszCanonicalName), ppkf );
5451
5452 for (i = 0; i < fm->num_ids; i++)
5453 {
5454 WCHAR *path, *name;
5456 if (FAILED( hr )) return hr;
5457
5458 hr = get_known_folder_wstr( path, L"Name", &name );
5459 free( path );
5460 if (FAILED( hr )) return hr;
5461
5462 found = !wcsicmp( pszCanonicalName, name );
5464 if (found) break;
5465 }
5466
5467 if (found)
5468 {
5469 hr = knownfolder_create( &kf );
5470 if (FAILED( hr )) return hr;
5471
5472 hr = knownfolder_set_id( kf, &fm->ids[i] );
5473 if (FAILED( hr ))
5474 {
5475 IKnownFolder_Release( &kf->IKnownFolder_iface );
5476 return hr;
5477 }
5478 *ppkf = &kf->IKnownFolder_iface;
5479 }
5480 else
5481 {
5483 *ppkf = NULL;
5484 }
5485
5486 return hr;
5487}
void WINAPI CoTaskMemFree(void *ptr)
Definition: malloc.c:389
#define wcsicmp
Definition: compat.h:15
static HRESULT get_known_folder_registry_path(REFKNOWNFOLDERID rfid, LPWSTR lpStringGuid, LPWSTR *lpPath)
Definition: shellpath.c:4681
static HRESULT get_known_folder_wstr(const WCHAR *regpath, const WCHAR *value, WCHAR **out)
Definition: shellpath.c:4711
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
Definition: name.c:39

◆ foldermanager_GetFolderIds()

static HRESULT WINAPI foldermanager_GetFolderIds ( IKnownFolderManager *  iface,
KNOWNFOLDERID **  ppKFId,
UINT *  pCount 
)
static

Definition at line 5369 of file shellpath.c.

5373{
5374 struct foldermanager *fm = impl_from_IKnownFolderManager( iface );
5375
5376 TRACE("%p, %p\n", ppKFId, pCount);
5377
5378 *ppKFId = CoTaskMemAlloc(fm->num_ids * sizeof(KNOWNFOLDERID));
5379 memcpy(*ppKFId, fm->ids, fm->num_ids * sizeof(KNOWNFOLDERID));
5380 *pCount = fm->num_ids;
5381 return S_OK;
5382}
void *WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: malloc.c:381
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878

◆ foldermanager_QueryInterface()

static HRESULT WINAPI foldermanager_QueryInterface ( IKnownFolderManager *  iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 5312 of file shellpath.c.

5316{
5318
5319 TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppv );
5320
5321 *ppv = NULL;
5322 if ( IsEqualGUID( riid, &IID_IKnownFolderManager ) ||
5324 {
5325 *ppv = iface;
5326 }
5327 else if ( IsEqualGUID( riid, &IID_IMarshal ) )
5328 {
5329 TRACE("IID_IMarshal returning NULL.\n");
5330 return E_NOINTERFACE;
5331 }
5332 else
5333 {
5334 FIXME("interface %s not implemented\n", debugstr_guid(riid));
5335 return E_NOINTERFACE;
5336 }
5337 IKnownFolderManager_AddRef( iface );
5338 return S_OK;
5339}

◆ foldermanager_Redirect()

static HRESULT WINAPI foldermanager_Redirect ( IKnownFolderManager *  iface,
REFKNOWNFOLDERID  rfid,
HWND  hwnd,
KF_REDIRECT_FLAGS  flags,
LPCWSTR  pszTargetPath,
UINT  cFolders,
KNOWNFOLDERID const *  pExclusion,
LPWSTR *  ppszError 
)
static

Definition at line 5582 of file shellpath.c.

5591{
5592 return redirect_known_folder(rfid, hwnd, flags, pszTargetPath, cFolders, pExclusion, ppszError);
5593}
static HRESULT redirect_known_folder(REFKNOWNFOLDERID rfid, HWND hwnd, KF_REDIRECT_FLAGS flags, LPCWSTR pszTargetPath, UINT cFolders, KNOWNFOLDERID const *pExclusion, LPWSTR *ppszError)
Definition: shellpath.c:4785
GLbitfield flags
Definition: glext.h:7161
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023

◆ foldermanager_RegisterFolder()

static HRESULT WINAPI foldermanager_RegisterFolder ( IKnownFolderManager *  iface,
REFKNOWNFOLDERID  rfid,
KNOWNFOLDER_DEFINITION const *  pKFD 
)
static

Definition at line 5537 of file shellpath.c.

5541{
5542 TRACE("(%p, %s, %p)\n", iface, debugstr_guid(rfid), pKFD);
5543 return register_folder(rfid, pKFD);
5544}
static HRESULT register_folder(const KNOWNFOLDERID *rfid, const KNOWNFOLDER_DEFINITION *pKFD)
Definition: shellpath.c:5489

◆ foldermanager_Release()

static ULONG WINAPI foldermanager_Release ( IKnownFolderManager *  iface)
static

Definition at line 5298 of file shellpath.c.

5300{
5303 if (!refs)
5304 {
5305 TRACE("destroying %p\n", foldermanager);
5308 }
5309 return refs;
5310}
LONG refs
Definition: port.c:62

◆ foldermanager_UnregisterFolder()

static HRESULT WINAPI foldermanager_UnregisterFolder ( IKnownFolderManager *  iface,
REFKNOWNFOLDERID  rfid 
)
static

Definition at line 5546 of file shellpath.c.

5549{
5550 HRESULT hr;
5552 TRACE("(%p, %s)\n", iface, debugstr_guid(rfid));
5553
5555
5556 if(SUCCEEDED(hr))
5558
5560 return hr;
5561}
LPCTSTR registryPath
Definition: butterflies.c:17
DWORD WINAPI SHDeleteKeyW(HKEY hkey, const WCHAR *subkey)
Definition: main.c:1886

◆ get_known_folder_dword()

static HRESULT get_known_folder_dword ( const WCHAR *  registryPath,
const WCHAR *  value,
DWORD *  out 
)
static

Definition at line 4734 of file shellpath.c.

4735{
4736 DWORD dwSize = sizeof(DWORD);
4737 DWORD dwType;
4739}
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:1931
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define DWORD
Definition: nt_native.h:44
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383
#define RRF_RT_DWORD
Definition: winreg.h:64

Referenced by get_known_folder_path(), get_known_folder_redirection_place(), knownfolder_GetCategory(), and knownfolder_GetFolderDefinition().

◆ get_known_folder_path()

static HRESULT get_known_folder_path ( LPWSTR  sFolderId,
LPWSTR  registryPath,
LPWSTR *  ppszPath 
)
static

Definition at line 5012 of file shellpath.c.

5016{
5017 HRESULT hr;
5018 DWORD dwSize, dwType;
5019 WCHAR path[MAX_PATH] = {0};
5020 WCHAR parentGuid[39];
5022 LPWSTR parentRegistryPath, parentPath;
5023 HKEY hRedirectionRootKey = NULL;
5024
5025 TRACE("(%s, %p)\n", debugstr_w(registryPath), ppszPath);
5026 *ppszPath = NULL;
5027
5028 /* check if folder has parent */
5029 dwSize = sizeof(parentGuid);
5030 hr = HRESULT_FROM_WIN32(RegGetValueW(HKEY_LOCAL_MACHINE, registryPath, L"ParentFolder", RRF_RT_REG_SZ, &dwType, parentGuid, &dwSize));
5032
5033 if(hr == S_OK)
5034 {
5035 /* get parent's known folder path (recursive) */
5036 hr = get_known_folder_registry_path(NULL, parentGuid, &parentRegistryPath);
5037 if(FAILED(hr)) return hr;
5038
5039 hr = get_known_folder_path(parentGuid, parentRegistryPath, &parentPath);
5040 if(FAILED(hr)) {
5041 free(parentRegistryPath);
5042 return hr;
5043 }
5044
5045 lstrcatW(path, parentPath);
5046 lstrcatW(path, L"\\");
5047
5048 free(parentRegistryPath);
5049 free(parentPath);
5050 }
5051
5052 /* check, if folder was redirected */
5053 if(SUCCEEDED(hr))
5055
5056 if(SUCCEEDED(hr))
5057 {
5058 if(category == KF_CATEGORY_COMMON)
5059 hRedirectionRootKey = HKEY_LOCAL_MACHINE;
5060 else if(category == KF_CATEGORY_PERUSER)
5061 hRedirectionRootKey = HKEY_CURRENT_USER;
5062
5063 if(hRedirectionRootKey)
5064 {
5065 hr = HRESULT_FROM_WIN32(RegGetValueW(hRedirectionRootKey, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders", sFolderId, RRF_RT_REG_SZ, NULL, NULL, &dwSize));
5066
5067 if(SUCCEEDED(hr))
5068 {
5069 *ppszPath = CoTaskMemAlloc(dwSize+(lstrlenW(path)+1)*sizeof(WCHAR));
5070 if(!*ppszPath) hr = E_OUTOFMEMORY;
5071 }
5072
5073 if(SUCCEEDED(hr))
5074 {
5075 lstrcpyW(*ppszPath, path);
5076 hr = HRESULT_FROM_WIN32(RegGetValueW(hRedirectionRootKey, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders", sFolderId, RRF_RT_REG_SZ, NULL, *ppszPath + lstrlenW(path), &dwSize));
5077 }
5078 }
5079
5080 if(!*ppszPath)
5081 {
5082 /* no redirection, use previous way - read the relative path from folder definition */
5084
5085 if(SUCCEEDED(hr))
5086 {
5087 *ppszPath = CoTaskMemAlloc(dwSize+(lstrlenW(path)+1)*sizeof(WCHAR));
5088 if(!*ppszPath) hr = E_OUTOFMEMORY;
5089 }
5090
5091 if(SUCCEEDED(hr))
5092 {
5093 lstrcpyW(*ppszPath, path);
5095 }
5096 }
5097 }
5098
5099 TRACE("returning path: %s\n", debugstr_w(*ppszPath));
5100 return hr;
5101}
static HRESULT get_known_folder_dword(const WCHAR *registryPath, const WCHAR *value, DWORD *out)
Definition: shellpath.c:4734
static HRESULT get_known_folder_path(LPWSTR sFolderId, LPWSTR registryPath, LPWSTR *ppszPath)
Definition: shellpath.c:5012
#define S_FALSE
Definition: winerror.h:3451
#define RRF_RT_REG_SZ
Definition: winreg.h:58

Referenced by get_known_folder_path(), and get_known_folder_path_by_id().

◆ get_known_folder_path_by_id()

static HRESULT get_known_folder_path_by_id ( REFKNOWNFOLDERID  folderId,
LPWSTR  lpRegistryPath,
DWORD  dwFlags,
LPWSTR *  ppszPath 
)
static

Definition at line 5103 of file shellpath.c.

5108{
5109 HRESULT hr = E_FAIL;
5110 WCHAR sGuid[39];
5112
5113 TRACE("(%s, %s, 0x%08lx, %p)\n", debugstr_guid(folderId), debugstr_w(lpRegistryPath), dwFlags, ppszPath);
5114
5115 /* if this is registry-registered known folder, get path from registry */
5116 if(lpRegistryPath)
5117 {
5118 StringFromGUID2(folderId, sGuid, ARRAY_SIZE(sGuid));
5119
5120 hr = get_known_folder_path(sGuid, lpRegistryPath, ppszPath);
5121 }
5122 /* in other case, use older way */
5123
5124 if(FAILED(hr))
5125 hr = SHGetKnownFolderPath( folderId, dwFlags, NULL, ppszPath );
5126
5127 if (FAILED(hr)) return hr;
5128
5129 /* check if known folder really exists */
5130 dwAttributes = GetFileAttributesW(*ppszPath);
5132 {
5133 TRACE("directory %s not found\n", debugstr_w(*ppszPath));
5134 CoTaskMemFree(*ppszPath);
5135 *ppszPath = NULL;
5137 }
5138
5139 return hr;
5140}
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:636
HRESULT WINAPI SHGetKnownFolderPath(REFKNOWNFOLDERID rfid, DWORD flags, HANDLE token, WCHAR **ret_path)
Definition: shellpath.c:4593
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
DWORD dwAttributes
Definition: vdmdbg.h:34
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23

Referenced by knownfolder_GetPath(), and redirect_known_folder().

◆ get_known_folder_redirection_place()

static HRESULT get_known_folder_redirection_place ( REFKNOWNFOLDERID  rfid,
HKEY *  rootKey 
)
static

Definition at line 4749 of file shellpath.c.

4752{
4753 HRESULT hr;
4754 LPWSTR lpRegistryPath = NULL;
4756
4757 /* first, get known folder's category */
4758 hr = get_known_folder_registry_path(rfid, NULL, &lpRegistryPath);
4759
4760 if(SUCCEEDED(hr))
4761 hr = get_known_folder_dword(lpRegistryPath, L"Category", &category);
4762
4763 if(SUCCEEDED(hr))
4764 {
4765 if(category == KF_CATEGORY_COMMON)
4766 {
4767 *rootKey = HKEY_LOCAL_MACHINE;
4768 hr = S_OK;
4769 }
4770 else if(category == KF_CATEGORY_PERUSER)
4771 {
4772 *rootKey = HKEY_CURRENT_USER;
4773 hr = S_OK;
4774 }
4775 else
4776 hr = E_FAIL;
4777 }
4778
4779 free(lpRegistryPath);
4780 return hr;
4781}

Referenced by redirect_known_folder().

◆ get_known_folder_registry_path()

static HRESULT get_known_folder_registry_path ( REFKNOWNFOLDERID  rfid,
LPWSTR  lpStringGuid,
LPWSTR *  lpPath 
)
static

Definition at line 4681 of file shellpath.c.

4685{
4686 HRESULT hr = S_OK;
4687 int length;
4688 WCHAR sGuid[50];
4689
4690 TRACE("(%s, %s, %p)\n", debugstr_guid(rfid), debugstr_w(lpStringGuid), lpPath);
4691
4692 if(rfid)
4693 StringFromGUID2(rfid, sGuid, ARRAY_SIZE(sGuid));
4694 else
4695 lstrcpyW(sGuid, lpStringGuid);
4696
4697 length = lstrlenW(L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FolderDescriptions")+51;
4698 *lpPath = malloc(length * sizeof(WCHAR));
4699 if(!(*lpPath))
4700 hr = E_OUTOFMEMORY;
4701
4702 if(SUCCEEDED(hr))
4703 {
4704 lstrcpyW(*lpPath, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FolderDescriptions\\");
4705 lstrcatW(*lpPath, sGuid);
4706 }
4707
4708 return hr;
4709}
GLuint GLsizei GLsizei * length
Definition: glext.h:6040

Referenced by foldermanager_GetFolderByName(), foldermanager_UnregisterFolder(), get_known_folder_path(), get_known_folder_redirection_place(), is_knownfolder(), knownfolder_set_id(), redirect_known_folder(), and register_folder().

◆ get_known_folder_wstr()

static HRESULT get_known_folder_wstr ( const WCHAR *  regpath,
const WCHAR *  value,
WCHAR **  out 
)
static

Definition at line 4711 of file shellpath.c.

4712{
4713 DWORD size = 0;
4714 HRESULT hr;
4715
4716 size = 0;
4718 if(FAILED(hr))
4719 return hr;
4720
4722 if(!*out)
4723 return E_OUTOFMEMORY;
4724
4726 if(FAILED(hr)){
4728 *out = NULL;
4729 }
4730
4731 return hr;
4732}

Referenced by foldermanager_GetFolderByName(), and knownfolder_GetFolderDefinition().

◆ get_xdg_path()

static char * get_xdg_path ( const char *  var)
static

Definition at line 3664 of file shellpath.c.

3665{
3666 static INIT_ONCE once;
3667 char *p, *ret = NULL;
3668 int i;
3669
3671 if (!xdg_config) return NULL;
3672
3673 for (p = xdg_config; p < xdg_config + xdg_config_len; p += strlen(p) + 1)
3674 {
3675 while (*p == ' ' || *p == '\t') p++;
3676 if (strncmp( p, var, strlen(var) )) continue;
3677 p += strlen(var);
3678 while (*p == ' ' || *p == '\t') p++;
3679 if (*p != '=') continue;
3680 p++;
3681 while (*p == ' ' || *p == '\t') p++;
3682 if (*p != '"') continue;
3683 p++;
3684 if (*p != '/' && strncmp( p, "$HOME/", 6 )) continue;
3685
3686 if (!(ret = malloc( strlen(p) + 1 ))) break;
3687 for (i = 0; *p && *p != '"'; i++, p++)
3688 {
3689 if (*p == '\\' && p[1]) p++;
3690 ret[i] = *p;
3691 }
3692 ret[i] = 0;
3693 if (*p != '"')
3694 {
3695 free( ret );
3696 ret = NULL;
3697 }
3698 break;
3699 }
3700 return ret;
3701}
BOOL WINAPI InitOnceExecuteOnce(_Inout_ PINIT_ONCE InitOnce, _In_ __callback PINIT_ONCE_FN InitFn, _Inout_opt_ PVOID Parameter, _Outptr_opt_result_maybenull_ LPVOID *Context)
Definition: InitOnce.c:12
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1597
_ACRTIMP int __cdecl strncmp(const char *, const char *, size_t)
Definition: string.c:3335
static BOOL WINAPI init_xdg_dirs(INIT_ONCE *once, void *param, void **context)
Definition: shellpath.c:3624
static DWORD xdg_config_len
Definition: shellpath.c:3622
static char * xdg_config
Definition: shellpath.c:3621
GLfloat GLfloat p
Definition: glext.h:8902
const char * var
Definition: shader.c:5879
RTL_RUN_ONCE INIT_ONCE
Definition: winbase.h:3654

Referenced by create_link().

◆ impl_from_IApplicationDestinations()

static IApplicationDestinationsImpl * impl_from_IApplicationDestinations ( IApplicationDestinations *  iface)
inlinestatic

◆ impl_from_IApplicationDocumentLists()

static IApplicationDocumentListsImpl * impl_from_IApplicationDocumentLists ( IApplicationDocumentLists *  iface)
inlinestatic

◆ impl_from_IKnownFolder()

static struct knownfolder * impl_from_IKnownFolder ( IKnownFolder *  iface)
inlinestatic

◆ impl_from_IKnownFolderManager()

static struct foldermanager * impl_from_IKnownFolderManager ( IKnownFolderManager *  iface)
inlinestatic

◆ init_xdg_dirs()

static BOOL WINAPI init_xdg_dirs ( INIT_ONCE *  once,
void *  param,
void **  context 
)
static

Definition at line 3624 of file shellpath.c.

3625{
3626 const WCHAR *var, *fmt = L"\\??\\unix%s/user-dirs.dirs";
3627 char *p;
3628 WCHAR *name, *ptr;
3629 HANDLE file;
3630 DWORD len;
3631
3632 if (!(var = _wgetenv( L"WINE_HOST_XDG_CONFIG_HOME" )) || var[0] != '/')
3633 {
3634 if (!(var = _wgetenv( L"WINEHOMEDIR" ))) return TRUE;
3635 fmt = L"%s/.config/user-dirs.dirs";
3636 }
3637 len = lstrlenW(var) + lstrlenW(fmt);
3638 name = malloc( len * sizeof(WCHAR) );
3639 swprintf( name, len, fmt, var );
3640 name[1] = '\\'; /* change \??\ to \\?\ */
3641 for (ptr = name; *ptr; ptr++) if (*ptr == '/') *ptr = '\\';
3642
3644 free( name );
3646 {
3647 len = GetFileSize( file, NULL );
3648 if (!(xdg_config = malloc( len + 1 ))) return TRUE;
3650 {
3651 free( xdg_config );
3652 xdg_config = NULL;
3653 }
3654 else
3655 {
3656 for (p = xdg_config; p < xdg_config + xdg_config_len; p++) if (*p == '\n') *p = 0;
3657 *p = 0; /* append null to simplify string parsing */
3658 }
3659 CloseHandle( file );
3660 }
3661 return TRUE;
3662}
#define ReadFile(a, b, c, d, e)
Definition: compat.h:742
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:331
wchar_t *CDECL _wgetenv(const wchar_t *name)
Definition: environ.c:254
GLenum GLsizei len
Definition: glext.h:6722
static PVOID ptr
Definition: dispmode.c:27
Definition: fci.c:123
Definition: dsound.c:943
#define swprintf
Definition: winemm.h:209

Referenced by get_xdg_path().

◆ is_knownfolder()

static BOOL is_knownfolder ( struct foldermanager *  fm,
const KNOWNFOLDERID *  id 
)
static

Definition at line 5384 of file shellpath.c.

5385{
5386 UINT i;
5387 HRESULT hr;
5389 HKEY hKey;
5390
5391 /* TODO: move all entries from "CSIDL_Data" static array to registry known folder descriptions */
5392 for (i = 0; i < fm->num_ids; i++)
5393 if (IsEqualGUID( &fm->ids[i], id )) return TRUE;
5394
5396 if(SUCCEEDED(hr))
5397 {
5400 }
5401
5402 if(SUCCEEDED(hr))
5403 {
5404 hr = S_OK;
5406 }
5407
5408 return hr == S_OK;
5409}
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
#define KEY_ENUMERATE_SUB_KEYS
Definition: nt_native.h:1022

Referenced by foldermanager_GetFolder().

◆ IsLFNDriveA()

BOOL WINAPI IsLFNDriveA ( LPCSTR  lpszPath)

Definition at line 874 of file shellpath.c.

875{
876 DWORD fnlen;
877
878 if (!GetVolumeInformationA(lpszPath, NULL, 0, NULL, &fnlen, NULL, NULL, 0))
879 return FALSE;
880 return fnlen > 12;
881}
BOOL WINAPI GetVolumeInformationA(IN LPCSTR lpRootPathName, IN LPSTR lpVolumeNameBuffer, IN DWORD nVolumeNameSize, OUT LPDWORD lpVolumeSerialNumber OPTIONAL, OUT LPDWORD lpMaximumComponentLength OPTIONAL, OUT LPDWORD lpFileSystemFlags OPTIONAL, OUT LPSTR lpFileSystemNameBuffer OPTIONAL, IN DWORD nFileSystemNameSize)
Definition: volume.c:32

Referenced by IsLFNDriveAW().

◆ IsLFNDriveAW()

BOOL WINAPI IsLFNDriveAW ( LPCVOID  lpszPath)

Definition at line 899 of file shellpath.c.

900{
901 if (SHELL_OsIsUnicode())
902 return IsLFNDriveW(lpszPath);
903 return IsLFNDriveA(lpszPath);
904}
BOOL WINAPI IsLFNDriveW(LPCWSTR lpszPath)
Definition: shellpath.c:886
BOOL WINAPI IsLFNDriveA(LPCSTR lpszPath)
Definition: shellpath.c:874
static __inline BOOL SHELL_OsIsUnicode(void)
Definition: shell32_main.h:197

◆ IsLFNDriveW()

BOOL WINAPI IsLFNDriveW ( LPCWSTR  lpszPath)

Definition at line 886 of file shellpath.c.

887{
888 DWORD fnlen;
889
890 if (!GetVolumeInformationW(lpszPath, NULL, 0, NULL, &fnlen, NULL, NULL, 0))
891 return FALSE;
892 return fnlen > 12;
893}
BOOL WINAPI GetVolumeInformationW(IN LPCWSTR lpRootPathName, IN LPWSTR lpVolumeNameBuffer, IN DWORD nVolumeNameSize, OUT LPDWORD lpVolumeSerialNumber OPTIONAL, OUT LPDWORD lpMaximumComponentLength OPTIONAL, OUT LPDWORD lpFileSystemFlags OPTIONAL, OUT LPWSTR lpFileSystemNameBuffer OPTIONAL, IN DWORD nFileSystemNameSize)
Definition: volume.c:226

Referenced by IsLFNDriveAW().

◆ knownfolder_AddRef()

static ULONG WINAPI knownfolder_AddRef ( IKnownFolder *  iface)
static

Definition at line 4888 of file shellpath.c.

4890{
4893}
static struct knownfolder * impl_from_IKnownFolder(IKnownFolder *iface)
Definition: shellpath.c:4883

◆ knownfolder_create()

static HRESULT knownfolder_create ( struct knownfolder **  knownfolder)
static

Definition at line 5260 of file shellpath.c.

5261{
5262 struct knownfolder *kf;
5263
5264 kf = malloc( sizeof(*kf) );
5265 if (!kf) return E_OUTOFMEMORY;
5266
5268 kf->refs = 1;
5269 memset( &kf->id, 0, sizeof(kf->id) );
5270 kf->registryPath = NULL;
5271
5272 *knownfolder = kf;
5273
5274 TRACE("returning iface %p\n", &kf->IKnownFolder_iface);
5275 return S_OK;
5276}
static const struct IKnownFolderVtbl knownfolder_vtbl
Definition: shellpath.c:5244
#define memset(x, y, z)
Definition: compat.h:39
LPWSTR registryPath
Definition: shellpath.c:4880
KNOWNFOLDERID id
Definition: shellpath.c:4879

Referenced by foldermanager_GetFolder(), and foldermanager_GetFolderByName().

◆ knownfolder_GetCategory()

static HRESULT WINAPI knownfolder_GetCategory ( IKnownFolder *  iface,
KF_CATEGORY *  pCategory 
)
static

Definition at line 4982 of file shellpath.c.

4985{
4987 HRESULT hr = S_OK;
4988
4989 TRACE("%p, %p\n", knownfolder, pCategory);
4990
4991 /* we cannot get a category for a folder which is not registered */
4993 hr = E_FAIL;
4994
4995 if(SUCCEEDED(hr))
4996 hr = get_known_folder_dword(knownfolder->registryPath, L"Category", (DWORD *)pCategory);
4997
4998 return hr;
4999}

◆ knownfolder_GetFolderDefinition()

static HRESULT WINAPI knownfolder_GetFolderDefinition ( IKnownFolder *  iface,
KNOWNFOLDER_DEFINITION *  pKFD 
)
static

Definition at line 5201 of file shellpath.c.

5204{
5206 HRESULT hr;
5207 DWORD dwSize;
5208 WCHAR parentGuid[39];
5209 TRACE("(%p, %p)\n", knownfolder, pKFD);
5210
5211 if(!pKFD) return E_INVALIDARG;
5212
5213 ZeroMemory(pKFD, sizeof(*pKFD));
5214
5215 /* required fields */
5217 if(FAILED(hr))
5218 return hr;
5219
5221 if(FAILED(hr))
5222 return hr;
5223
5224 /* optional fields */
5225 dwSize = sizeof(parentGuid);
5227 RRF_RT_REG_SZ, NULL, parentGuid, &dwSize));
5228 if(SUCCEEDED(hr))
5229 {
5230 hr = IIDFromString(parentGuid, &pKFD->fidParent);
5231 if(FAILED(hr))
5232 return hr;
5233 }
5234
5236
5238
5240
5241 return S_OK;
5242}
HRESULT WINAPI IIDFromString(LPCOLESTR str, IID *iid)
Definition: combase.c:1492
#define ZeroMemory
Definition: minwinbase.h:31

◆ knownfolder_GetFolderType()

static HRESULT WINAPI knownfolder_GetFolderType ( IKnownFolder *  iface,
FOLDERTYPEID *  pftid 
)
static

Definition at line 5183 of file shellpath.c.

5186{
5187 FIXME("%p\n", pftid);
5188 return E_NOTIMPL;
5189}

◆ knownfolder_GetId()

static HRESULT WINAPI knownfolder_GetId ( IKnownFolder *  iface,
KNOWNFOLDERID *  pkfid 
)
static

Definition at line 4970 of file shellpath.c.

4973{
4975
4976 TRACE("%p\n", pkfid);
4977
4978 *pkfid = knownfolder->id;
4979 return S_OK;
4980}

◆ knownfolder_GetIDList()

static HRESULT WINAPI knownfolder_GetIDList ( IKnownFolder *  iface,
DWORD  flags,
PIDLIST_ABSOLUTE *  ppidl 
)
static

Definition at line 5173 of file shellpath.c.

5177{
5179 TRACE("(%p, 0x%08lx, %p)\n", knownfolder, flags, ppidl);
5180 return SHGetKnownFolderIDList(&knownfolder->id, flags, NULL, ppidl);
5181}
HRESULT WINAPI SHGetKnownFolderIDList(REFKNOWNFOLDERID rfid, DWORD flags, HANDLE token, PIDLIST_ABSOLUTE *pidl)
Definition: shellpath.c:5661

◆ knownfolder_GetPath()

static HRESULT WINAPI knownfolder_GetPath ( IKnownFolder *  iface,
DWORD  dwFlags,
LPWSTR *  ppszPath 
)
static

Definition at line 5142 of file shellpath.c.

5146{
5148 TRACE("(%p, 0x%08lx, %p)\n", knownfolder, dwFlags, ppszPath);
5149
5151}
static HRESULT get_known_folder_path_by_id(REFKNOWNFOLDERID folderId, LPWSTR lpRegistryPath, DWORD dwFlags, LPWSTR *ppszPath)
Definition: shellpath.c:5103

◆ knownfolder_GetRedirectionCapabilities()

static HRESULT WINAPI knownfolder_GetRedirectionCapabilities ( IKnownFolder *  iface,
KF_REDIRECTION_CAPABILITIES *  pCapabilities 
)
static

Definition at line 5191 of file shellpath.c.

5194{
5195 FIXME("%p stub\n", pCapabilities);
5196 if(!pCapabilities) return E_INVALIDARG;
5197 *pCapabilities = KF_REDIRECTION_CAPABILITIES_DENY_ALL;
5198 return S_OK;
5199}
@ KF_REDIRECTION_CAPABILITIES_DENY_ALL
Definition: shobjidl.idl:4083

◆ knownfolder_GetShellItem()

static HRESULT WINAPI knownfolder_GetShellItem ( IKnownFolder *  iface,
DWORD  flags,
REFIID  riid,
void **  ppv 
)
static

Definition at line 5001 of file shellpath.c.

5006{
5008 TRACE("(%p, 0x%08lx, %s, %p)\n", knownfolder, flags, debugstr_guid(riid), ppv);
5010}
HRESULT WINAPI SHGetKnownFolderItem(REFKNOWNFOLDERID rfid, KNOWN_FOLDER_FLAG flags, HANDLE hToken, REFIID riid, void **ppv)
Definition: shellpath.c:5707

◆ knownfolder_QueryInterface()

static HRESULT WINAPI knownfolder_QueryInterface ( IKnownFolder *  iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 4909 of file shellpath.c.

4913{
4914 struct knownfolder *This = impl_from_IKnownFolder( iface );
4915
4916 TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppv );
4917
4918 *ppv = NULL;
4919 if ( IsEqualGUID( riid, &IID_IKnownFolder ) ||
4921 {
4922 *ppv = iface;
4923 }
4924 else if ( IsEqualGUID( riid, &IID_IMarshal ) )
4925 {
4926 TRACE("IID_IMarshal returning NULL.\n");
4927 return E_NOINTERFACE;
4928 }
4929 else
4930 {
4931 FIXME("interface %s not implemented\n", debugstr_guid(riid));
4932 return E_NOINTERFACE;
4933 }
4934 IKnownFolder_AddRef( iface );
4935 return S_OK;
4936}

◆ knownfolder_Release()

static ULONG WINAPI knownfolder_Release ( IKnownFolder *  iface)
static

Definition at line 4895 of file shellpath.c.

4897{
4900 if (!refs)
4901 {
4902 TRACE("destroying %p\n", knownfolder);
4904 free( knownfolder );
4905 }
4906 return refs;
4907}

◆ knownfolder_set_id()

static HRESULT knownfolder_set_id ( struct knownfolder *  knownfolder,
const KNOWNFOLDERID *  kfid 
)
static

Definition at line 4938 of file shellpath.c.

4941{
4942 HKEY hKey;
4943 HRESULT hr;
4944
4945 TRACE("%s\n", debugstr_guid(kfid));
4946
4947 knownfolder->id = *kfid;
4948
4949 /* check is it registry-registered folder */
4951 if(SUCCEEDED(hr))
4953
4954 if(SUCCEEDED(hr))
4955 {
4956 hr = S_OK;
4958 }
4959 else
4960 {
4961 /* This known folder is not registered. To mark it, we set registryPath to NULL */
4964 hr = S_OK;
4965 }
4966
4967 return hr;
4968}

Referenced by foldermanager_GetFolder(), and foldermanager_GetFolderByName().

◆ knownfolder_SetPath()

static HRESULT WINAPI knownfolder_SetPath ( IKnownFolder *  iface,
DWORD  dwFlags,
LPCWSTR  pszPath 
)
static

Definition at line 5153 of file shellpath.c.

5157{
5159 HRESULT hr = S_OK;
5160
5161 TRACE("(%p, 0x%08lx, %s)\n", knownfolder, dwFlags, debugstr_w(pszPath));
5162
5163 /* check if the known folder is registered */
5165 hr = E_FAIL;
5166
5167 if(SUCCEEDED(hr))
5168 hr = redirect_known_folder(&knownfolder->id, NULL, 0, pszPath, 0, NULL, NULL);
5169
5170 return hr;
5171}

◆ KnownFolderManager_Constructor()

HRESULT WINAPI KnownFolderManager_Constructor ( IUnknown *  punk,
REFIID  riid,
void **  ppv 
)

Definition at line 5649 of file shellpath.c.

5650{
5651 TRACE("%p, %s, %p\n", punk, debugstr_guid(riid), ppv);
5652
5653 if (!ppv)
5654 return E_POINTER;
5655 if (punk)
5656 return CLASS_E_NOAGGREGATION;
5657
5658 return foldermanager_create( ppv );
5659}
static HRESULT foldermanager_create(void **ppv)
Definition: shellpath.c:5612

◆ link_folder()

static BOOL link_folder ( HANDLE  mgr,
const UNICODE_STRING *  path,
const char *  link 
)
static

Definition at line 3703 of file shellpath.c.

3704{
3705 struct mountmgr_shell_folder *ioctl;
3706 DWORD len = sizeof(*ioctl) + path->Length + strlen(link) + 1;
3707 BOOL ret;
3708
3709 if (!(ioctl = malloc( len ))) return FALSE;
3710 ioctl->create_backup = FALSE;
3711 ioctl->folder_offset = sizeof(*ioctl);
3712 ioctl->folder_size = path->Length;
3713 memcpy( (char *)ioctl + ioctl->folder_offset, path->Buffer, ioctl->folder_size );
3714 ioctl->symlink_offset = ioctl->folder_offset + ioctl->folder_size;
3715 strcpy( (char *)ioctl + ioctl->symlink_offset, link );
3716
3717 ret = DeviceIoControl( mgr, IOCTL_MOUNTMGR_DEFINE_SHELL_FOLDER, ioctl, len, NULL, 0, NULL, NULL );
3718 free( ioctl );
3719 return ret;
3720}
const WCHAR * link
Definition: db.cpp:998
BOOL WINAPI DeviceIoControl(IN HANDLE hDevice, IN DWORD dwIoControlCode, IN LPVOID lpInBuffer OPTIONAL, IN DWORD nInBufferSize OPTIONAL, OUT LPVOID lpOutBuffer OPTIONAL, IN DWORD nOutBufferSize OPTIONAL, OUT LPDWORD lpBytesReturned OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: deviceio.c:136
strcpy
Definition: string.h:131
#define ioctl
Definition: wintirpc.h:60

Referenced by create_link(), and get_link_file().

◆ PathAddBackslashAW()

LPVOID WINAPI PathAddBackslashAW ( LPVOID  lpszPath)

Definition at line 446 of file shellpath.c.

447{
449 return PathAddBackslashW(lpszPath);
450 return PathAddBackslashA(lpszPath);
451}
#define PathAddBackslashA
Definition: pathcch.h:301

◆ PathAppendAW()

BOOL WINAPI PathAppendAW ( LPVOID  lpszPath1,
LPCVOID  lpszPath2 
)

Definition at line 421 of file shellpath.c.

424{
425 if (SHELL_OsIsUnicode())
426 return PathAppendW(lpszPath1, lpszPath2);
427 return PathAppendA(lpszPath1, lpszPath2);
428}
#define PathAppendA
Definition: pathcch.h:309

◆ PathBuildRootAW()

LPVOID WINAPI PathBuildRootAW ( LPVOID  lpszPath,
int  drive 
)

Definition at line 456 of file shellpath.c.

457{
459 return PathBuildRootW(lpszPath, drive);
460 return PathBuildRootA(lpszPath, drive);
461}
LPSTR WINAPI PathBuildRootA(LPSTR lpszPath, int drive)
Definition: path.c:86
LPWSTR WINAPI PathBuildRootW(LPWSTR lpszPath, int drive)
Definition: path.c:105

◆ PathCleanupSpec()

int WINAPI PathCleanupSpec ( LPCWSTR  lpszPathW,
LPWSTR  lpszFileW 
)

Definition at line 1155 of file shellpath.c.

1156{
1157 int i = 0;
1158 DWORD rc = 0;
1159 int length = 0;
1160
1161 if (SHELL_OsIsUnicode())
1162 {
1163 LPWSTR p = lpszFileW;
1164
1165 TRACE("Cleanup %s\n",debugstr_w(lpszFileW));
1166
1167 if (lpszPathW)
1168 length = lstrlenW(lpszPathW);
1169
1170 while (*p)
1171 {
1172 int gct = PathGetCharTypeW(*p);
1173 if (gct == GCT_INVALID || gct == GCT_WILD || gct == GCT_SEPARATOR)
1174 {
1175 lpszFileW[i]='-';
1176 rc |= PCS_REPLACEDCHAR;
1177 }
1178 else
1179 lpszFileW[i]=*p;
1180 i++;
1181 p++;
1182 if (length + i == MAX_PATH)
1183 {
1184 rc |= PCS_FATAL | PCS_PATHTOOLONG;
1185 break;
1186 }
1187 }
1188 lpszFileW[i]=0;
1189 }
1190 else
1191 {
1192 LPSTR lpszFileA = (LPSTR)lpszFileW;
1193 LPCSTR lpszPathA = (LPCSTR)lpszPathW;
1194 LPSTR p = lpszFileA;
1195
1196 TRACE("Cleanup %s\n",debugstr_a(lpszFileA));
1197
1198 if (lpszPathA)
1199 length = strlen(lpszPathA);
1200
1201 while (*p)
1202 {
1203 int gct = PathGetCharTypeA(*p);
1204 if (gct == GCT_INVALID || gct == GCT_WILD || gct == GCT_SEPARATOR)
1205 {
1206 lpszFileA[i]='-';
1207 rc |= PCS_REPLACEDCHAR;
1208 }
1209 else
1210 lpszFileA[i]=*p;
1211 i++;
1212 p++;
1213 if (length + i == MAX_PATH)
1214 {
1215 rc |= PCS_FATAL | PCS_PATHTOOLONG;
1216 break;
1217 }
1218 }
1219 lpszFileA[i]=0;
1220 }
1221 return rc;
1222}
UINT WINAPI PathGetCharTypeA(UCHAR ch)
Definition: path.c:1769
UINT WINAPI PathGetCharTypeW(WCHAR ch)
Definition: path.c:1738
#define debugstr_a
Definition: kernel32.h:31
#define GCT_SEPARATOR
Definition: shlwapi.h:275
#define GCT_INVALID
Definition: shlwapi.h:271
#define GCT_WILD
Definition: shlwapi.h:274
#define PCS_REPLACEDCHAR
Definition: shlobj.h:396
#define PCS_PATHTOOLONG
Definition: shlobj.h:399
#define PCS_FATAL
Definition: shlobj.h:395
const char * LPCSTR
Definition: typedefs.h:52
char * LPSTR
Definition: typedefs.h:51

Referenced by FinishDlgProc().

◆ PathCombineAW()

LPVOID WINAPI PathCombineAW ( LPVOID  szDest,
LPCVOID  lpszDir,
LPCVOID  lpszFile 
)

Definition at line 433 of file shellpath.c.

437{
438 if (SHELL_OsIsUnicode())
439 return PathCombineW( szDest, lpszDir, lpszFile );
440 return PathCombineA( szDest, lpszDir, lpszFile );
441}
#define PathCombineA
Definition: pathcch.h:317
#define PathCombineW
Definition: pathcch.h:318

◆ PathFileExistsAW()

BOOL WINAPI PathFileExistsAW ( LPCVOID  lpszPath)

Definition at line 781 of file shellpath.c.

782{
783 if (SHELL_OsIsUnicode())
784 return PathFileExistsW (lpszPath);
785 return PathFileExistsA (lpszPath);
786}
BOOL WINAPI PathFileExistsA(const char *path)
Definition: path.c:2566
BOOL WINAPI PathFileExistsW(const WCHAR *path)
Definition: path.c:2583

◆ PathFindExtensionAW()

LPVOID WINAPI PathFindExtensionAW ( LPCVOID  lpszPath)

Definition at line 480 of file shellpath.c.

481{
482 if (SHELL_OsIsUnicode())
483 return PathFindExtensionW(lpszPath);
484 return PathFindExtensionA(lpszPath);
485
486}
LPSTR WINAPI PathFindExtensionA(const char *path)
Definition: path.c:1229
LPWSTR WINAPI PathFindExtensionW(const WCHAR *path)
Definition: path.c:1250

◆ PathFindFileNameAW()

LPVOID WINAPI PathFindFileNameAW ( LPCVOID  lpszPath)

Definition at line 470 of file shellpath.c.

471{
473 return PathFindFileNameW(lpszPath);
474 return PathFindFileNameA(lpszPath);
475}
WCHAR *WINAPI PathFindFileNameW(const WCHAR *path)
Definition: path.c:1677
char *WINAPI PathFindFileNameA(const char *path)
Definition: path.c:1660

◆ PathFindOnPathAW()

BOOL WINAPI PathFindOnPathAW ( LPVOID  sFile,
LPCVOID *  sOtherDirs 
)

Definition at line 1143 of file shellpath.c.

1144{
1145 if (SHELL_OsIsUnicode())
1146 return PathFindOnPathW(sFile, (LPCWSTR *)sOtherDirs);
1147 return PathFindOnPathA(sFile, (LPCSTR *)sOtherDirs);
1148}
BOOL WINAPI PathFindOnPathW(LPWSTR lpszFile, LPCWSTR *lppszOtherDirs)
Definition: path.c:456
BOOL WINAPI PathFindOnPathA(LPSTR lpszFile, LPCSTR *lppszOtherDirs)
Definition: path.c:445

◆ PathGetArgsAW()

LPVOID WINAPI PathGetArgsAW ( LPVOID  lpszPath)

Definition at line 527 of file shellpath.c.

528{
529 if (SHELL_OsIsUnicode())
530 return PathGetArgsW(lpszPath);
531 return PathGetArgsA(lpszPath);
532}
char *WINAPI PathGetArgsA(const char *path)
Definition: path.c:1694
WCHAR *WINAPI PathGetArgsW(const WCHAR *path)
Definition: path.c:1716

◆ PathGetDriveNumberAW()

int WINAPI PathGetDriveNumberAW ( LPVOID  lpszPath)

Definition at line 537 of file shellpath.c.

538{
539 if (SHELL_OsIsUnicode())
540 return PathGetDriveNumberW(lpszPath);
541 return PathGetDriveNumberA(lpszPath);
542}
int WINAPI PathGetDriveNumberW(const WCHAR *path)
Definition: path.c:1786
int WINAPI PathGetDriveNumberA(const char *path)
Definition: path.c:1774

◆ PathGetExtensionA()

static LPSTR PathGetExtensionA ( LPCSTR  lpszPath)
static

Definition at line 495 of file shellpath.c.

496{
497 TRACE("(%s)\n",lpszPath);
498
499 lpszPath = PathFindExtensionA(lpszPath);
500 return (LPSTR)(*lpszPath?(lpszPath+1):lpszPath);
501}

Referenced by PathGetExtensionAW(), and PathIsExeA().

◆ PathGetExtensionAW()

LPVOID WINAPI PathGetExtensionAW ( LPCVOID  lpszPath,
DWORD  void1,
DWORD  void2 
)

Definition at line 517 of file shellpath.c.

518{
519 if (SHELL_OsIsUnicode())
520 return PathGetExtensionW(lpszPath);
521 return PathGetExtensionA(lpszPath);
522}
static LPWSTR PathGetExtensionW(LPCWSTR lpszPath)
Definition: shellpath.c:506
static LPSTR PathGetExtensionA(LPCSTR lpszPath)
Definition: shellpath.c:495

◆ PathGetExtensionW()

static LPWSTR PathGetExtensionW ( LPCWSTR  lpszPath)
static

Definition at line 506 of file shellpath.c.

507{
508 TRACE("(%s)\n",debugstr_w(lpszPath));
509
510 lpszPath = PathFindExtensionW(lpszPath);
511 return (LPWSTR)(*lpszPath?(lpszPath+1):lpszPath);
512}

Referenced by PathGetExtensionAW(), and PathIsExeW().

◆ PathGetShortPathA()

static void PathGetShortPathA ( LPSTR  pszPath)
static

Definition at line 605 of file shellpath.c.

606{
608
609 TRACE("%s\n", pszPath);
610
611 if (GetShortPathNameA(pszPath, path, MAX_PATH))
612 {
613 lstrcpyA(pszPath, path);
614 }
615}
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
DWORD WINAPI GetShortPathNameA(IN LPCSTR lpszLongPath, OUT LPSTR lpszShortPath, IN DWORD cchBuffer)
Definition: pathansi.c:20
char CHAR
Definition: pedump.c:57

Referenced by PathGetShortPathAW().

◆ PathGetShortPathAW()

VOID WINAPI PathGetShortPathAW ( LPVOID  pszPath)

Definition at line 635 of file shellpath.c.

636{
638 PathGetShortPathW(pszPath);
639 PathGetShortPathA(pszPath);
640}
static void PathGetShortPathA(LPSTR pszPath)
Definition: shellpath.c:605
static void PathGetShortPathW(LPWSTR pszPath)
Definition: shellpath.c:620

◆ PathGetShortPathW()

static void PathGetShortPathW ( LPWSTR  pszPath)
static

Definition at line 620 of file shellpath.c.

621{
623
624 TRACE("%s\n", debugstr_w(pszPath));
625
626 if (GetShortPathNameW(pszPath, path, MAX_PATH))
627 {
628 lstrcpyW(pszPath, path);
629 }
630}
DWORD WINAPI GetShortPathNameW(IN LPCWSTR lpszLongPath, OUT LPWSTR lpszShortPath, IN DWORD cchBuffer)
Definition: path.c:1851

Referenced by PathGetShortPathAW().

◆ PathIsDirectoryAW()

BOOL WINAPI PathIsDirectoryAW ( LPCVOID  lpszPath)

Definition at line 771 of file shellpath.c.

772{
773 if (SHELL_OsIsUnicode())
774 return PathIsDirectoryW (lpszPath);
775 return PathIsDirectoryA (lpszPath);
776}
BOOL WINAPI PathIsDirectoryA(LPCSTR lpszPath)
Definition: path.c:625
BOOL WINAPI PathIsDirectoryW(LPCWSTR lpszPath)
Definition: path.c:669

◆ PathIsExeA()

static BOOL PathIsExeA ( LPCSTR  lpszPath)
static

Definition at line 721 of file shellpath.c.

722{
723 LPCSTR lpszExtension = PathGetExtensionA(lpszPath);
724 int i;
725 static const char * const lpszExtensions[] =
726 {"exe", "com", "pif", "cmd", "bat", "scf", "scr", NULL };
727
728 TRACE("path=%s\n",lpszPath);
729
730 for(i=0; lpszExtensions[i]; i++)
731 if (!lstrcmpiA(lpszExtension,lpszExtensions[i])) return TRUE;
732
733 return FALSE;
734}
int WINAPI lstrcmpiA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4133

Referenced by PathIsExeAW().

◆ PathIsExeAW()

BOOL WINAPI PathIsExeAW ( LPCVOID  path)

Definition at line 761 of file shellpath.c.

762{
763 if (SHELL_OsIsUnicode())
764 return PathIsExeW (path);
765 return PathIsExeA(path);
766}
static BOOL PathIsExeA(LPCSTR lpszPath)
Definition: shellpath.c:721
static BOOL PathIsExeW(LPCWSTR lpszPath)
Definition: shellpath.c:742

◆ PathIsExeW()

static BOOL PathIsExeW ( LPCWSTR  lpszPath)
static

Definition at line 742 of file shellpath.c.

744{
745 LPCWSTR lpszExtension = PathGetExtensionW(lpszPath);
746 int i;
747 static const WCHAR lpszExtensions[][4] =
748 {L"exe", L"com", L"pif",L"cmd", L"bat", L"scf",L"scr",L"" };
749
750 TRACE("path=%s\n",debugstr_w(lpszPath));
751
752 for(i=0; lpszExtensions[i][0]; i++)
753 if (!wcsicmp(lpszExtension,lpszExtensions[i])) return TRUE;
754
755 return FALSE;
756}

Referenced by PathIsExeAW().

◆ PathIsRelativeAW()

BOOL WINAPI PathIsRelativeAW ( LPCVOID  lpszPath)

Definition at line 701 of file shellpath.c.

702{
703 if (SHELL_OsIsUnicode())
704 return PathIsRelativeW( lpszPath );
705 return PathIsRelativeA( lpszPath );
706}
BOOL WINAPI PathIsRelativeA(const char *path)
Definition: path.c:996
BOOL WINAPI PathIsRelativeW(const WCHAR *path)
Definition: path.c:1006

◆ PathIsRootAW()

BOOL WINAPI PathIsRootAW ( LPCVOID  lpszPath)

Definition at line 711 of file shellpath.c.

712{
713 if (SHELL_OsIsUnicode())
714 return PathIsRootW(lpszPath);
715 return PathIsRootA(lpszPath);
716}
BOOL WINAPI PathIsRootA(const char *path)
Definition: path.c:1064
BOOL WINAPI PathIsRootW(const WCHAR *path)
Definition: path.c:1077

◆ PathIsSameRootAW()

BOOL WINAPI PathIsSameRootAW ( LPCVOID  lpszPath1,
LPCVOID  lpszPath2 
)

Definition at line 801 of file shellpath.c.

802{
803 if (SHELL_OsIsUnicode())
804 return PathIsSameRootW(lpszPath1, lpszPath2);
805 return PathIsSameRootA(lpszPath1, lpszPath2);
806}
BOOL WINAPI PathIsSameRootW(const WCHAR *path1, const WCHAR *path2)
Definition: path.c:2552
BOOL WINAPI PathIsSameRootA(const char *path1, const char *path2)
Definition: path.c:2538

◆ PathIsUNCAW()

BOOL WINAPI PathIsUNCAW ( LPCVOID  lpszPath)

Definition at line 691 of file shellpath.c.

692{
693 if (SHELL_OsIsUnicode())
694 return PathIsUNCW( lpszPath );
695 return PathIsUNCA( lpszPath );
696}
BOOL WINAPI PathIsUNCW(const WCHAR *path)
Definition: path.c:989
BOOL WINAPI PathIsUNCA(const char *path)
Definition: path.c:982

◆ PathMakeUniqueNameA()

static BOOL PathMakeUniqueNameA ( LPSTR  lpszBuffer,
DWORD  dwBuffSize,
LPCSTR  lpszShortName,
LPCSTR  lpszLongName,
LPCSTR  lpszPathName 
)
static

Definition at line 912 of file shellpath.c.

918{
919 FIXME("%p %lu %s %s %s stub\n",
920 lpszBuffer, dwBuffSize, debugstr_a(lpszShortName),
921 debugstr_a(lpszLongName), debugstr_a(lpszPathName));
922 return TRUE;
923}

Referenced by PathMakeUniqueNameAW().

◆ PathMakeUniqueNameAW()

BOOL WINAPI PathMakeUniqueNameAW ( LPVOID  lpszBuffer,
DWORD  dwBuffSize,
LPCVOID  lpszShortName,
LPCVOID  lpszLongName,
LPCVOID  lpszPathName 
)

Definition at line 1093 of file shellpath.c.

1099{
1100 if (SHELL_OsIsUnicode())
1101 return PathMakeUniqueNameW(lpszBuffer,dwBuffSize, lpszShortName,lpszLongName,lpszPathName);
1102 return PathMakeUniqueNameA(lpszBuffer,dwBuffSize, lpszShortName,lpszLongName,lpszPathName);
1103}
static BOOL PathMakeUniqueNameW(LPWSTR lpszBuffer, DWORD dwBuffSize, LPCWSTR lpszShortName, LPCWSTR lpszLongName, LPCWSTR lpszPathName)
Definition: shellpath.c:1076
static BOOL PathMakeUniqueNameA(LPSTR lpszBuffer, DWORD dwBuffSize, LPCSTR lpszShortName, LPCSTR lpszLongName, LPCSTR lpszPathName)
Definition: shellpath.c:912

◆ PathMakeUniqueNameW()

static BOOL PathMakeUniqueNameW ( LPWSTR  lpszBuffer,
DWORD  dwBuffSize,
LPCWSTR  lpszShortName,
LPCWSTR  lpszLongName,
LPCWSTR  lpszPathName 
)
static

Definition at line 1076 of file shellpath.c.

1082{
1083 FIXME("%p %lu %s %s %s stub\n",
1084 lpszBuffer, dwBuffSize, debugstr_w(lpszShortName),
1085 debugstr_w(lpszLongName), debugstr_w(lpszPathName));
1086 return TRUE;
1087}

Referenced by PathMakeUniqueNameAW().

◆ PathMatchSpecAW()

BOOL WINAPI PathMatchSpecAW ( LPVOID  name,
LPVOID  mask 
)

Definition at line 791 of file shellpath.c.

792{
793 if (SHELL_OsIsUnicode())
794 return PathMatchSpecW( name, mask );
795 return PathMatchSpecA( name, mask );
796}
BOOL WINAPI PathMatchSpecA(const char *path, const char *mask)
Definition: path.c:2432
BOOL WINAPI PathMatchSpecW(const WCHAR *path, const WCHAR *mask)
Definition: path.c:2497
GLenum GLint GLuint mask
Definition: glext.h:6028

◆ PathParseIconLocationAW()

int WINAPI PathParseIconLocationAW ( LPVOID  lpszPath)

Definition at line 678 of file shellpath.c.

679{
681 return PathParseIconLocationW(lpszPath);
682 return PathParseIconLocationA(lpszPath);
683}
int WINAPI PathParseIconLocationA(char *path)
Definition: path.c:2599
int WINAPI PathParseIconLocationW(WCHAR *path)
Definition: path.c:2620

◆ PathProcessCommandA()

static LONG PathProcessCommandA ( LPCSTR  lpszPath,
LPSTR  lpszBuff,
DWORD  dwBuffSize,
DWORD  dwFlags 
)
static

Definition at line 1497 of file shellpath.c.

1502{
1503 FIXME("%s %p 0x%04lx 0x%04lx stub\n",
1504 lpszPath, lpszBuff, dwBuffSize, dwFlags);
1505 if(!lpszPath) return -1;
1506 if(lpszBuff) strcpy(lpszBuff, lpszPath);
1507 return strlen(lpszPath);
1508}

Referenced by PathProcessCommandAW().

◆ PathProcessCommandAW()

LONG WINAPI PathProcessCommandAW ( LPCVOID  lpszPath,
LPVOID  lpszBuff,
DWORD  dwBuffSize,
DWORD  dwFlags 
)

Definition at line 1531 of file shellpath.c.

1536{
1537 if (SHELL_OsIsUnicode())
1538 return PathProcessCommandW(lpszPath, lpszBuff, dwBuffSize, dwFlags);
1539 return PathProcessCommandA(lpszPath, lpszBuff, dwBuffSize, dwFlags);
1540}
static LONG PathProcessCommandW(LPCWSTR lpszPath, LPWSTR lpszBuff, DWORD dwBuffSize, DWORD dwFlags)
Definition: shellpath.c:1514
static LONG PathProcessCommandA(LPCSTR lpszPath, LPSTR lpszBuff, DWORD dwBuffSize, DWORD dwFlags)
Definition: shellpath.c:1497

◆ PathProcessCommandW()

static LONG PathProcessCommandW ( LPCWSTR  lpszPath,
LPWSTR  lpszBuff,
DWORD  dwBuffSize,
DWORD  dwFlags 
)
static

Definition at line 1514 of file shellpath.c.

1519{
1520 FIXME("(%s, %p, 0x%04lx, 0x%04lx) stub\n",
1521 debugstr_w(lpszPath), lpszBuff, dwBuffSize, dwFlags);
1522 if(!lpszPath) return -1;
1523 if(lpszBuff) lstrcpyW(lpszBuff, lpszPath);
1524 return lstrlenW(lpszPath);
1525}

Referenced by PathProcessCommandAW().

◆ PathQualifyA()

static BOOL PathQualifyA ( LPCSTR  pszPath)
static

Definition at line 1387 of file shellpath.c.

1388{
1389 FIXME("%s\n",pszPath);
1390 return FALSE;
1391}

Referenced by PathQualifyAW().

◆ PathQualifyAW()

BOOL WINAPI PathQualifyAW ( LPCVOID  pszPath)

Definition at line 1405 of file shellpath.c.

1406{
1407 if (SHELL_OsIsUnicode())
1408 return PathQualifyW(pszPath);
1409 return PathQualifyA(pszPath);
1410}
static BOOL PathQualifyW(LPCWSTR pszPath)
Definition: shellpath.c:1396
static BOOL PathQualifyA(LPCSTR pszPath)
Definition: shellpath.c:1387

◆ PathQualifyW()

static BOOL PathQualifyW ( LPCWSTR  pszPath)
static

Definition at line 1396 of file shellpath.c.

1397{
1398 FIXME("%s\n",debugstr_w(pszPath));
1399 return FALSE;
1400}

Referenced by PathQualifyAW().

◆ PathQuoteSpacesAW()

VOID WINAPI PathQuoteSpacesAW ( LPVOID  lpszPath)

Definition at line 656 of file shellpath.c.

657{
659 PathQuoteSpacesW(lpszPath);
660 else
661 PathQuoteSpacesA(lpszPath);
662}
void WINAPI PathQuoteSpacesA(char *path)
Definition: path.c:2502
void WINAPI PathQuoteSpacesW(WCHAR *path)
Definition: path.c:2520

◆ PathRemoveArgsAW()

void WINAPI PathRemoveArgsAW ( LPVOID  lpszPath)

Definition at line 578 of file shellpath.c.

579{
580 if (SHELL_OsIsUnicode())
581 PathRemoveArgsW(lpszPath);
582 else
583 PathRemoveArgsA(lpszPath);
584}
void WINAPI PathRemoveArgsW(LPWSTR lpszPath)
Definition: path.c:153
void WINAPI PathRemoveArgsA(LPSTR lpszPath)
Definition: path.c:130

◆ PathRemoveBlanksAW()

void WINAPI PathRemoveBlanksAW ( LPVOID  str)

Definition at line 645 of file shellpath.c.

646{
649 else
651}
void WINAPI PathRemoveBlanksW(WCHAR *path)
Definition: path.c:1886
void WINAPI PathRemoveBlanksA(char *path)
Definition: path.c:1862
const WCHAR * str

◆ PathRemoveExtensionAW()

void WINAPI PathRemoveExtensionAW ( LPVOID  lpszPath)

Definition at line 589 of file shellpath.c.

590{
591 if (SHELL_OsIsUnicode())
592 PathRemoveExtensionW(lpszPath);
593 else
594 PathRemoveExtensionA(lpszPath);
595}
void WINAPI PathRemoveExtensionW(WCHAR *path)
Definition: path.c:1922
void WINAPI PathRemoveExtensionA(char *path)
Definition: path.c:1910

◆ PathRemoveFileSpecAW()

BOOL WINAPI PathRemoveFileSpecAW ( LPVOID  lpszPath)

Definition at line 547 of file shellpath.c.

548{
549 if (SHELL_OsIsUnicode())
550 return PathRemoveFileSpecW(lpszPath);
551 return PathRemoveFileSpecA(lpszPath);
552}
BOOL WINAPI PathRemoveFileSpecA(char *path)
Definition: path.c:1084
BOOL WINAPI PathRemoveFileSpecW(WCHAR *path)
Definition: path.c:1121

◆ PathResolveA()

static BOOL PathResolveA ( char *  path,
const char **  dirs,
DWORD  flags 
)
static

Definition at line 1412 of file shellpath.c.

1413{
1414 BOOL is_file_spec = PathIsFileSpecA(path);
1415 DWORD dwWhich = flags & PRF_DONTFINDLNK ? 0xf : 0xbf;
1416
1417 TRACE("(%s,%p,0x%08lx)\n", debugstr_a(path), dirs, flags);
1418
1419 if (flags & PRF_VERIFYEXISTS)
1420 {
1421 if (PathFindOnPathExA(path, dirs, dwWhich))
1422 {
1424 return TRUE;
1425 }
1426 if (!is_file_spec)
1427 {
1429 if (PathFileExistsDefExtA(path, dwWhich))
1430 return TRUE;
1431 }
1433 return FALSE;
1434 }
1435
1436 if (is_file_spec)
1437 {
1439 return FALSE;
1440 }
1441
1443
1444 return TRUE;
1445}
#define PRF_VERIFYEXISTS
Definition: PathResolve.cpp:38
#define PRF_DONTFINDLNK
Definition: PathResolve.cpp:42
#define SetLastError(x)
Definition: compat.h:752
DWORD WINAPI GetFullPathNameA(IN LPCSTR lpFileName, IN DWORD nBufferLength, OUT LPSTR lpBuffer, OUT LPSTR *lpFilePart)
Definition: path.c:1051
BOOL WINAPI PathIsFileSpecA(const char *path)
Definition: path.c:1801
BOOL WINAPI PathFileExistsDefExtA(LPSTR lpszPath, DWORD dwWhich)
Definition: path.c:248
BOOL WINAPI PathFindOnPathExA(LPSTR lpszFile, LPCSTR *lppszOtherDirs, DWORD dwWhich)
Definition: path.c:360

Referenced by PathResolveAW().

◆ PathResolveAW()

BOOL WINAPI PathResolveAW ( void *  path,
const void **  paths,
DWORD  flags 
)

Definition at line 1485 of file shellpath.c.

1486{
1487 if (SHELL_OsIsUnicode())
1488 return PathResolveW(path, (const WCHAR **)paths, flags);
1489 else
1490 return PathResolveA(path, (const char **)paths, flags);
1491}
static BOOL PathResolveA(char *path, const char **dirs, DWORD flags)
Definition: shellpath.c:1412
BOOL WINAPI PathResolveW(WCHAR *path, const WCHAR **dirs, DWORD flags)
Definition: shellpath.c:1447
GLsizei const GLuint * paths
Definition: glext.h:11717

◆ PathResolveW()

BOOL WINAPI PathResolveW ( WCHAR *  path,
const WCHAR **  dirs,
DWORD  flags 
)

Definition at line 1447 of file shellpath.c.

1448{
1449 BOOL is_file_spec = PathIsFileSpecW(path);
1450 DWORD dwWhich = flags & PRF_DONTFINDLNK ? 0xf : 0xbf;
1451
1452 TRACE("(%s,%p,0x%08lx)\n", debugstr_w(path), dirs, flags);
1453
1454 if (flags & PRF_VERIFYEXISTS)
1455 {
1456 if (PathFindOnPathExW(path, dirs, dwWhich))
1457 {
1459 return TRUE;
1460 }
1461 if (!is_file_spec)
1462 {
1464 if (PathFileExistsDefExtW(path, dwWhich))
1465 return TRUE;
1466 }
1468 return FALSE;
1469 }
1470
1471 if (is_file_spec)
1472 {
1474 return FALSE;
1475 }
1476
1478
1479 return TRUE;
1480}
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
Definition: path.c:1164
BOOL WINAPI PathIsFileSpecW(const WCHAR *path)
Definition: path.c:1818
BOOL WINAPI PathFindOnPathExW(LPWSTR lpszFile, LPCWSTR *lppszOtherDirs, DWORD dwWhich)
Definition: path.c:404
BOOL WINAPI PathFileExistsDefExtW(LPWSTR lpszPath, DWORD dwWhich)
Definition: path.c:170

Referenced by FindExecutableW(), PathProcessCommandW(), PathResolveAW(), CShellLink::SetTargetFromPIDLOrPath(), SH32_EvaluateValidExecApp(), and SHELL_FindExecutable().

◆ PathSetDlgItemPathAW()

VOID WINAPI PathSetDlgItemPathAW ( HWND  hDlg,
int  id,
LPCVOID  pszPath 
)

Definition at line 1549 of file shellpath.c.

1550{
1551 if (SHELL_OsIsUnicode())
1552 PathSetDlgItemPathW(hDlg, id, pszPath);
1553 else
1554 PathSetDlgItemPathA(hDlg, id, pszPath);
1555}
VOID WINAPI PathSetDlgItemPathA(HWND hDlg, int id, LPCSTR lpszPath)
Definition: path.c:1246
VOID WINAPI PathSetDlgItemPathW(HWND hDlg, int id, LPCWSTR lpszPath)
Definition: path.c:1264

◆ PathStripPathAW()

void WINAPI PathStripPathAW ( LPVOID  lpszPath)

Definition at line 557 of file shellpath.c.

558{
559 if (SHELL_OsIsUnicode())
560 PathStripPathW(lpszPath);
561 else
562 PathStripPathA(lpszPath);
563}
void WINAPI PathStripPathA(char *path)
Definition: path.c:2292
void WINAPI PathStripPathW(WCHAR *path)
Definition: path.c:2304

◆ PathStripToRootAW()

BOOL WINAPI PathStripToRootAW ( LPVOID  lpszPath)

Definition at line 568 of file shellpath.c.

569{
570 if (SHELL_OsIsUnicode())
571 return PathStripToRootW(lpszPath);
572 return PathStripToRootA(lpszPath);
573}
BOOL WINAPI PathStripToRootW(WCHAR *path)
Definition: path.c:1171
BOOL WINAPI PathStripToRootA(char *path)
Definition: path.c:1157

◆ PathUnquoteSpacesAW()

VOID WINAPI PathUnquoteSpacesAW ( LPVOID  str)

Definition at line 667 of file shellpath.c.

668{
671 else
673}
void WINAPI PathUnquoteSpacesW(WCHAR *path)
Definition: path.c:1982
void WINAPI PathUnquoteSpacesA(char *path)
Definition: path.c:1964

◆ PathYetAnotherMakeUniqueName()

BOOL WINAPI PathYetAnotherMakeUniqueName ( LPWSTR  buffer,
LPCWSTR  path,
LPCWSTR  shortname,
LPCWSTR  longname 
)

Definition at line 1108 of file shellpath.c.

1109{
1110 WCHAR pathW[MAX_PATH], retW[MAX_PATH];
1111 const WCHAR *file, *ext;
1112 int i = 2;
1113
1114 TRACE("(%p, %s, %s, %s)\n", buffer, debugstr_w(path), debugstr_w(shortname), debugstr_w(longname));
1115
1116 file = longname ? longname : shortname;
1118 lstrcpyW(retW, pathW);
1120
1122
1123 /* now try to make it unique */
1124 while (PathFileExistsW(retW))
1125 {
1126 swprintf(retW, ARRAY_SIZE(retW), L"%s (%d)%s", pathW, i, ext);
1127 i++;
1128 }
1129
1130 lstrcpyW(buffer, retW);
1131 TRACE("ret - %s\n", debugstr_w(buffer));
1132
1133 return TRUE;
1134}
static const WCHAR *const ext[]
Definition: module.c:53
static const WCHAR pathW[]
Definition: path.c:2368

Referenced by BrFolder_NewFolder(), CNewMenu::CreateNewFolder(), CDefaultContextMenu::DoCreateNewFolder(), CDeskLinkDropHandler::Drop(), FinishDlgProc(), loadShell32(), and CNewMenu::NewItemByNonCommand().

◆ redirect_known_folder()

static HRESULT redirect_known_folder ( REFKNOWNFOLDERID  rfid,
HWND  hwnd,
KF_REDIRECT_FLAGS  flags,
LPCWSTR  pszTargetPath,
UINT  cFolders,
KNOWNFOLDERID const *  pExclusion,
LPWSTR *  ppszError 
)
static

Definition at line 4785 of file shellpath.c.

4793{
4794 HRESULT hr;
4795 HKEY rootKey = HKEY_LOCAL_MACHINE, hKey;
4796 WCHAR sGuid[39];
4797 LPWSTR lpRegistryPath = NULL, lpSrcPath = NULL;
4798 TRACE("(%s, %p, 0x%08x, %s, %d, %p, %p)\n", debugstr_guid(rfid), hwnd, flags, debugstr_w(pszTargetPath), cFolders, pExclusion, ppszError);
4799
4800 if (ppszError) *ppszError = NULL;
4801
4802 hr = get_known_folder_registry_path(rfid, NULL, &lpRegistryPath);
4803
4804 if(SUCCEEDED(hr))
4805 hr = get_known_folder_path_by_id(rfid, lpRegistryPath, 0, &lpSrcPath);
4806
4807 free(lpRegistryPath);
4808
4809 /* get path to redirection storage */
4810 if(SUCCEEDED(hr))
4811 hr = get_known_folder_redirection_place(rfid, &rootKey);
4812
4813 /* write redirection information */
4814 if(SUCCEEDED(hr))
4815 hr = HRESULT_FROM_WIN32(RegCreateKeyExW(rootKey, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders", 0, NULL, 0, KEY_WRITE, NULL, &hKey, NULL));
4816
4817 if(SUCCEEDED(hr))
4818 {
4819 StringFromGUID2(rfid, sGuid, ARRAY_SIZE(sGuid));
4820
4821 hr = HRESULT_FROM_WIN32(RegSetValueExW(hKey, sGuid, 0, REG_SZ, (LPBYTE)pszTargetPath, (lstrlenW(pszTargetPath)+1)*sizeof(WCHAR)));
4822
4824 }
4825
4826 /* make sure destination path exists */
4827 SHCreateDirectory(NULL, pszTargetPath);
4828
4829 /* copy content if required */
4831 {
4832 WCHAR srcPath[MAX_PATH+1], dstPath[MAX_PATH+1];
4833 SHFILEOPSTRUCTW fileOp;
4834
4835 ZeroMemory(srcPath, sizeof(srcPath));
4836 lstrcpyW(srcPath, lpSrcPath);
4837 lstrcatW(srcPath, L"\\*");
4838
4839 ZeroMemory(dstPath, sizeof(dstPath));
4840 lstrcpyW(dstPath, pszTargetPath);
4841
4842 ZeroMemory(&fileOp, sizeof(fileOp));
4843
4845 fileOp.wFunc = FO_MOVE;
4846 else
4847 fileOp.wFunc = FO_COPY;
4848
4849 fileOp.pFrom = srcPath;
4850 fileOp.pTo = dstPath;
4851 fileOp.fFlags = FOF_NO_UI;
4852
4853 hr = (SHFileOperationW(&fileOp)==0 ? S_OK : E_FAIL);
4854
4856 {
4857 ZeroMemory(srcPath, sizeof(srcPath));
4858 lstrcpyW(srcPath, lpSrcPath);
4859
4860 ZeroMemory(&fileOp, sizeof(fileOp));
4861 fileOp.wFunc = FO_DELETE;
4862 fileOp.pFrom = srcPath;
4863 fileOp.fFlags = FOF_NO_UI;
4864
4865 hr = (SHFileOperationW(&fileOp)==0 ? S_OK : E_FAIL);
4866 }
4867 }
4868
4869 CoTaskMemFree(lpSrcPath);
4870
4871 return hr;
4872}
static HRESULT get_known_folder_redirection_place(REFKNOWNFOLDERID rfid, HKEY *rootKey)
Definition: shellpath.c:4749
GLuint srcPath
Definition: glext.h:11718
#define KEY_WRITE
Definition: nt_native.h:1034
#define FO_DELETE
Definition: shellapi.h:138
#define FO_COPY
Definition: shellapi.h:137
#define FOF_NO_UI
Definition: shellapi.h:157
#define FO_MOVE
Definition: shellapi.h:136
int WINAPI SHFileOperationW(LPSHFILEOPSTRUCTW lpFileOp)
Definition: shlfileop.cpp:2200
int WINAPI SHCreateDirectory(HWND hWnd, LPCWSTR path)
Definition: shlfileop.cpp:948
LPCWSTR pFrom
Definition: shellapi.h:370
FILEOP_FLAGS fFlags
Definition: shellapi.h:372

Referenced by foldermanager_Redirect(), and knownfolder_SetPath().

◆ register_folder()

static HRESULT register_folder ( const KNOWNFOLDERID *  rfid,
const KNOWNFOLDER_DEFINITION *  pKFD 
)
static

Definition at line 5489 of file shellpath.c.

5490{
5491 HRESULT hr;
5492 HKEY hKey = NULL;
5493 DWORD dwDisp;
5495
5497 TRACE("registry path: %s\n", debugstr_w(registryPath));
5498
5499 if(SUCCEEDED(hr))
5501
5502 if(SUCCEEDED(hr))
5503 {
5504 hr = HRESULT_FROM_WIN32(RegSetValueExW(hKey, L"Category", 0, REG_DWORD, (LPBYTE)&pKFD->category, sizeof(pKFD->category)));
5505
5506 if(SUCCEEDED(hr) && pKFD->dwAttributes != 0)
5507 hr = HRESULT_FROM_WIN32(RegSetValueExW(hKey, L"Attributes", 0, REG_DWORD, (LPBYTE)&pKFD->dwAttributes, sizeof(pKFD->dwAttributes)));
5508
5509 if(SUCCEEDED(hr))
5510 hr = HRESULT_FROM_WIN32(RegSetValueExW(hKey, L"Name", 0, REG_SZ, (LPBYTE)pKFD->pszName, (lstrlenW(pKFD->pszName)+1)*sizeof(WCHAR) ));
5511
5512 if(SUCCEEDED(hr) && pKFD->pszParsingName)
5513 hr = HRESULT_FROM_WIN32(RegSetValueExW(hKey, L"ParsingName", 0, REG_SZ, (LPBYTE)pKFD->pszParsingName, (lstrlenW(pKFD->pszParsingName)+1)*sizeof(WCHAR) ));
5514
5515 if(SUCCEEDED(hr) && !IsEqualGUID(&pKFD->fidParent, &GUID_NULL))
5516 {
5517 WCHAR sParentGuid[39];
5518 StringFromGUID2(&pKFD->fidParent, sParentGuid, ARRAY_SIZE(sParentGuid));
5519
5520 /* this known folder has parent folder */
5521 hr = HRESULT_FROM_WIN32(RegSetValueExW(hKey, L"ParentFolder", 0, REG_SZ, (LPBYTE)sParentGuid, sizeof(sParentGuid)));
5522 }
5523
5524 if(SUCCEEDED(hr) && pKFD->category != KF_CATEGORY_VIRTUAL && pKFD->pszRelativePath)
5525 hr = HRESULT_FROM_WIN32(RegSetValueExW(hKey, L"RelativePath", 0, REG_SZ, (LPBYTE)pKFD->pszRelativePath, (lstrlenW(pKFD->pszRelativePath)+1)*sizeof(WCHAR) ));
5526
5528
5529 if(FAILED(hr))
5531 }
5532
5534 return hr;
5535}
#define REG_DWORD
Definition: sdbapi.c:615

Referenced by foldermanager_RegisterFolder(), and register_system_knownfolders().

◆ register_system_knownfolders()

static void register_system_knownfolders ( void  )
static

Definition at line 5727 of file shellpath.c.

5728{
5729 int i;
5730
5731 for (i = 0; i < ARRAY_SIZE(CSIDL_Data); ++i)
5732 {
5733 const CSIDL_DATA *folder = &CSIDL_Data[i];
5734 if(folder->name){
5736
5737 /* register_folder won't modify kfd, so cast away const instead of
5738 * reallocating */
5739 kfd.category = folder->category;
5740 kfd.pszName = (WCHAR *)folder->name;
5741 kfd.pszDescription = NULL;
5742 kfd.fidParent = folder->parent ? *folder->parent : GUID_NULL;
5743 kfd.pszRelativePath = (WCHAR *)folder->path;
5744 kfd.pszParsingName = (WCHAR *)folder->parsing;
5745 kfd.pszTooltip = NULL;
5746 kfd.pszLocalizedName = NULL;
5747 kfd.pszIcon = NULL;
5748 kfd.pszSecurity = NULL;
5749 kfd.dwAttributes = folder->attributes;
5750 kfd.kfdFlags = folder->flags;
5751 kfd.ftidType = folder->typeid ? *folder->typeid : GUID_NULL;
5752 register_folder(folder->id, &kfd);
5753 }
5754 }
5755}
BSTR path
Definition: filesystem.c:108
KF_DEFINITION_FLAGS kfdFlags
Definition: shobjidl.idl:4111

Referenced by SHELL_RegisterShellFolders().

◆ set_folder_attributes()

static HRESULT set_folder_attributes ( void  )
static

Definition at line 4318 of file shellpath.c.

4319{
4320 static const struct
4321 {
4322 const CLSID *clsid;
4323 unsigned int wfparsing : 1;
4324 unsigned int wfdisplay : 1;
4325 unsigned int hideasdel : 1;
4326 DWORD attr;
4327 DWORD call_for_attr;
4328 } folders[] =
4329 {
4330#ifndef __REACTOS__
4333 SFGAO_FILESYSANCESTOR|SFGAO_FOLDER|SFGAO_HASSUBFOLDER, SFGAO_FILESYSTEM },
4334#endif
4335 { &CLSID_FolderShortcut, FALSE, FALSE, FALSE,
4336 SFGAO_FILESYSTEM|SFGAO_FOLDER|SFGAO_LINK,
4337 SFGAO_HASSUBFOLDER|SFGAO_FILESYSTEM|SFGAO_FOLDER|SFGAO_FILESYSANCESTOR },
4338 { &CLSID_MyDocuments, TRUE, FALSE, FALSE,
4339 SFGAO_FILESYSANCESTOR|SFGAO_FOLDER|SFGAO_HASSUBFOLDER, SFGAO_FILESYSTEM },
4340 { &CLSID_RecycleBin, FALSE, FALSE, FALSE,
4341 SFGAO_FOLDER|SFGAO_DROPTARGET|SFGAO_HASPROPSHEET },
4342 { &CLSID_ControlPanel, FALSE, TRUE, TRUE,
4343 SFGAO_FOLDER|SFGAO_HASSUBFOLDER },
4344 { &CLSID_Printers, FALSE, FALSE, FALSE,
4345 SFGAO_FOLDER|SFGAO_CANLINK }
4346 };
4347
4348 unsigned int i;
4349 WCHAR buffer[39 + ARRAY_SIZE(L"CLSID\\") + ARRAY_SIZE(L"\\ShellFolder")];
4350 LONG res;
4351 HKEY hkey;
4352
4353 for (i = 0; i < ARRAY_SIZE(folders); i++)
4354 {
4355 lstrcpyW( buffer, L"CLSID\\" );
4356 StringFromGUID2( folders[i].clsid, buffer + lstrlenW(buffer), 39 );
4357 lstrcatW( buffer, L"\\ShellFolder" );
4359 KEY_READ | KEY_WRITE, NULL, &hkey, NULL);
4360 if (res) return HRESULT_FROM_WIN32( res );
4361 if (folders[i].wfparsing)
4362 res = RegSetValueExW( hkey, L"WantsFORPARSING", 0, REG_SZ, (const BYTE *)L"", sizeof(WCHAR) );
4363 if (folders[i].wfdisplay)
4364 res = RegSetValueExW( hkey, L"WantsFORDISPLAY", 0, REG_SZ, (const BYTE *)L"", sizeof(WCHAR) );
4365 if (folders[i].hideasdel)
4366 res = RegSetValueExW( hkey, L"HideAsDeletePerUser", 0, REG_SZ, (const BYTE *)L"", sizeof(WCHAR) );
4367 if (folders[i].attr)
4368 res = RegSetValueExW( hkey, L"Attributes", 0, REG_DWORD,
4369 (const BYTE *)&folders[i].attr, sizeof(DWORD));
4370 if (folders[i].call_for_attr)
4371 res = RegSetValueExW( hkey, L"CallForAttributes", 0, REG_DWORD,
4372 (const BYTE *)&folders[i].call_for_attr, sizeof(DWORD));
4373 RegCloseKey( hkey );
4374 }
4375 return S_OK;
4376}
const GUID CLSID_UnixDosFolder
const GUID CLSID_UnixFolder
GLuint res
Definition: glext.h:9613
const CLSID * clsid
Definition: msctf.cpp:50
#define KEY_READ
Definition: nt_native.h:1026
Definition: cookie.c:202
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
unsigned char BYTE
Definition: xxhash.c:193

Referenced by SHELL_RegisterShellFolders().

◆ SHELL_RegisterShellFolders()

HRESULT SHELL_RegisterShellFolders ( void  )

Definition at line 5757 of file shellpath.c.

5758{
5759 HRESULT hr;
5760
5762 if (SUCCEEDED(hr))
5764 if (SUCCEEDED(hr))
5766#ifndef __REACTOS__
5767 if (SUCCEEDED(hr))
5769#endif
5770 if (SUCCEEDED(hr))
5772 if (SUCCEEDED(hr))
5774 return hr;
5775}
static HRESULT set_folder_attributes(void)
Definition: shellpath.c:4318
static HRESULT _SHRegisterUserShellFolders(BOOL bDefault)
Definition: shellpath.c:4167
static void register_system_knownfolders(void)
Definition: shellpath.c:5727
static HRESULT create_extra_folders(void)
Definition: shellpath.c:4265
static HRESULT _SHRegisterCommonShellFolders(void)
Definition: shellpath.c:4232

Referenced by DllRegisterServer().

◆ SHGetFolderLocation()

HRESULT WINAPI SHGetFolderLocation ( HWND  hwndOwner,
int  nFolder,
HANDLE  hToken,
DWORD  dwReserved,
LPITEMIDLIST *  ppidl 
)

Definition at line 4467 of file shellpath.c.

4473{
4475#ifdef __REACTOS__
4477#endif
4478
4479 TRACE("%p 0x%08x %p 0x%08lx %p\n",
4480 hwndOwner, nFolder, hToken, dwReserved, ppidl);
4481
4482 if (!ppidl)
4483 return E_INVALIDARG;
4484 if (dwReserved)
4485 return E_INVALIDARG;
4486
4487#ifdef __REACTOS__
4488 if ((nFolder & CSIDL_FLAG_NO_ALIAS) &&
4490 {
4491 *ppidl = ILCreateFromPathW(szPath);
4492 if (*ppidl)
4493 return S_OK;
4494 }
4495#endif
4496 /* The virtual folders' locations are not user-dependent */
4497 *ppidl = NULL;
4498 switch (nFolder & CSIDL_FOLDER_MASK)
4499 {
4500 case CSIDL_DESKTOP:
4501 *ppidl = _ILCreateDesktop();
4502 break;
4503
4504 case CSIDL_PERSONAL:
4505 *ppidl = _ILCreateMyDocuments();
4506 break;
4507
4508 case CSIDL_INTERNET:
4509 *ppidl = _ILCreateIExplore();
4510 break;
4511
4512 case CSIDL_CONTROLS:
4513 *ppidl = _ILCreateControlPanel();
4514 break;
4515
4516 case CSIDL_PRINTERS:
4517 *ppidl = _ILCreatePrinters();
4518 break;
4519
4520 case CSIDL_BITBUCKET:
4521 *ppidl = _ILCreateBitBucket();
4522 break;
4523
4524 case CSIDL_DRIVES:
4525 *ppidl = _ILCreateMyComputer();
4526 break;
4527
4528 case CSIDL_NETWORK:
4529 *ppidl = _ILCreateNetwork();
4530 break;
4531
4532#ifdef __REACTOS__
4533 case CSIDL_CONNECTIONS:
4534 hr = SHGetFolderLocationHelper(hwndOwner, CSIDL_CONTROLS, &CLSID_NetworkConnections, ppidl);
4535 break;
4536#endif
4537
4538 default:
4539 {
4541
4542 hr = SHGetFolderPathW(hwndOwner, nFolder, hToken,
4544 if (SUCCEEDED(hr))
4545 {
4546 DWORD attributes=0;
4547
4548 TRACE("Value=%s\n", debugstr_w(szPath));
4550 }
4552 {
4553 /* unlike SHGetFolderPath, SHGetFolderLocation in shell32
4554 * version 6.0 returns E_FAIL for nonexistent paths
4555 */
4556 hr = E_FAIL;
4557 }
4558 }
4559 }
4560 if(*ppidl)
4561 hr = S_OK;
4562
4563 TRACE("-- (new pidl %p)\n",*ppidl);
4564 return hr;
4565}
BOOL WINAPI SHGetSpecialFolderPathW(HWND hwndOwner, LPWSTR szPath, int nFolder, BOOL bCreate)
Definition: shellpath.c:4394
LPCWSTR szPath
Definition: env.c:37
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:95
static HANDLE ACCESS_MASK ULONG attributes
Definition: om.c:94
LPITEMIDLIST _ILCreateMyComputer(void)
Definition: pidl.c:1807
LPITEMIDLIST _ILCreateIExplore(void)
Definition: pidl.c:1819
HRESULT WINAPI SHILCreateFromPathW(LPCWSTR path, LPITEMIDLIST *ppidl, DWORD *attributes)
Definition: pidl.c:404
LPITEMIDLIST _ILCreateDesktop(void)
Definition: pidl.c:1796
LPITEMIDLIST _ILCreateNetwork(void)
Definition: pidl.c:1870
LPITEMIDLIST _ILCreatePrinters(void)
Definition: pidl.c:1843
LPITEMIDLIST _ILCreateControlPanel(void)
Definition: pidl.c:1825
LPITEMIDLIST WINAPI ILCreateFromPathW(LPCWSTR path)
Definition: pidl.c:1108
LPITEMIDLIST _ILCreateMyDocuments(void)
Definition: pidl.c:1813
LPITEMIDLIST _ILCreateBitBucket(void)
Definition: pidl.c:1876
@ SHGFP_TYPE_CURRENT
Definition: shlobj.h:2196
#define CSIDL_FLAG_NO_ALIAS
Definition: shlobj.h:2280
#define CSIDL_CONNECTIONS
Definition: shlobj.h:2268
#define CSIDL_PRINTERS
Definition: shlobj.h:2224
#define CSIDL_DESKTOP
Definition: shlobj.h:2220
#define CSIDL_NETWORK
Definition: shlobj.h:2237
#define CSIDL_DRIVES
Definition: shlobj.h:2236
#define CSIDL_INTERNET
Definition: shlobj.h:2221
#define CSIDL_CONTROLS
Definition: shlobj.h:2223
#define CSIDL_BITBUCKET
Definition: shlobj.h:2230

Referenced by CBandSiteMenu::_CreateBuiltInISFBand(), CShellMenuCallback::AddStartMenuItems(), BrFolder_OnInitDialog(), LoadRdpSettingsFromFile(), loadShell32(), SaveRdpSettingsToFile(), SHCreateFromDesktop(), SHELL32_ReparentAsAliasPidl(), CDesktopFolder::ShellUrlParseDisplayName(), SHEmptyRecycleBinW(), SHGetSpecialFolderLocation(), START_TEST(), TestCommandLine(), and TestCompareIDList().

◆ SHGetFolderPathA()

HRESULT WINAPI SHGetFolderPathA ( HWND  hwndOwner,
int  nFolder,
HANDLE  hToken,
DWORD  dwFlags,
LPSTR  pszPath 
)

Definition at line 4048 of file shellpath.c.

4054{
4055 WCHAR szTemp[MAX_PATH];
4056 HRESULT hr;
4057
4058 TRACE("%p,%d,%p,%#lx,%p\n", hwndOwner, nFolder, hToken, dwFlags, pszPath);
4059
4060 if (pszPath)
4061 *pszPath = '\0';
4062 hr = SHGetFolderPathW(hwndOwner, nFolder, hToken, dwFlags, szTemp);
4063 if (SUCCEEDED(hr) && pszPath)
4064 WideCharToMultiByte(CP_ACP, 0, szTemp, -1, pszPath, MAX_PATH, NULL,
4065 NULL);
4066
4067 return hr;
4068}
#define CP_ACP
Definition: compat.h:109
#define WideCharToMultiByte
Definition: compat.h:111

Referenced by ini_absent(), ini_present(), loadShell32(), pf_exists(), ppc_present(), SHGetSpecialFolderPathA(), test_profile_items(), test_SHGetFolderPathA(), and test_SHGetFolderPathAndSubDirA().

◆ SHGetFolderPathAndSubDirA()

HRESULT WINAPI SHGetFolderPathAndSubDirA ( HWND  hwndOwner,
int  nFolder,
HANDLE  hToken,
DWORD  dwFlags,
LPCSTR  pszSubPath,
LPSTR  pszPath 
)

Definition at line 3829 of file shellpath.c.

3836{
3837 int length;
3838 HRESULT hr = S_OK;
3839 LPWSTR pszSubPathW = NULL;
3840 LPWSTR pszPathW = NULL;
3841
3842 TRACE("%p,%#x,%p,%#lx,%s,%p\n", hwndOwner, nFolder, hToken, dwFlags, debugstr_a(pszSubPath), pszPath);
3843
3844 if(pszPath) {
3845 pszPathW = malloc(MAX_PATH * sizeof(WCHAR));
3846 if(!pszPathW) {
3848 goto cleanup;
3849 }
3850 }
3851 TRACE("%08x,%08lx,%s\n",nFolder, dwFlags, debugstr_w(pszSubPathW));
3852
3853 /* SHGetFolderPathAndSubDirW does not distinguish if pszSubPath isn't
3854 * set (null), or an empty string.therefore call it without the parameter set
3855 * if pszSubPath is an empty string
3856 */
3857 if (pszSubPath && pszSubPath[0]) {
3858 length = MultiByteToWideChar(CP_ACP, 0, pszSubPath, -1, NULL, 0);
3859 pszSubPathW = malloc(length * sizeof(WCHAR));
3860 if(!pszSubPathW) {
3862 goto cleanup;
3863 }
3864 MultiByteToWideChar(CP_ACP, 0, pszSubPath, -1, pszSubPathW, length);
3865 }
3866
3867 hr = SHGetFolderPathAndSubDirW(hwndOwner, nFolder, hToken, dwFlags, pszSubPathW, pszPathW);
3868
3869 if (SUCCEEDED(hr) && pszPath)
3870 WideCharToMultiByte(CP_ACP, 0, pszPathW, -1, pszPath, MAX_PATH, NULL, NULL);
3871
3872cleanup:
3873 free(pszPathW);
3874 free(pszSubPathW);
3875 return hr;
3876}
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define MultiByteToWideChar
Definition: compat.h:110
static void cleanup(void)
Definition: main.c:1335

Referenced by test_SHGetFolderPathAndSubDirA().

◆ SHGetFolderPathAndSubDirW()

HRESULT WINAPI SHGetFolderPathAndSubDirW ( HWND  hwndOwner,
int  nFolder,
HANDLE  hToken,
DWORD  dwFlags,
LPCWSTR  pszSubPath,
LPWSTR  pszPath 
)

Definition at line 3881 of file shellpath.c.

3888{
3889 HRESULT hr;
3890 WCHAR szBuildPath[MAX_PATH], szTemp[MAX_PATH];
3893 int ret;
3894
3895 TRACE("%p,%#x,%p,%#lx,%s,%p\n", hwndOwner, nFolder, hToken, dwFlags, debugstr_w(pszSubPath), pszPath);
3896
3897 /* Windows always NULL-terminates the resulting path regardless of success
3898 * or failure, so do so first
3899 */
3900 if (pszPath)
3901 *pszPath = '\0';
3902
3904 return E_INVALIDARG;
3906 return E_INVALIDARG;
3907 szTemp[0] = 0;
3909 switch (type)
3910 {
3912 hr = E_INVALIDARG;
3913 break;
3915 hr = S_FALSE;
3916 break;
3920 hr = S_OK;
3921 break;
3925 hr = S_OK;
3926 break;
3930 hr = S_OK;
3931 break;
3932 case CSIDL_Type_CurrVer:
3934 break;
3935 case CSIDL_Type_User:
3936 hr = _SHGetUserProfilePath(hToken, dwFlags, folder, szTemp);
3937 break;
3941 break;
3942 default:
3943 FIXME("bogus type %d, please fix\n", type);
3944 hr = E_INVALIDARG;
3945 break;
3946 }
3947
3948 /* Expand environment strings if necessary */
3949 if (*szTemp == '%')
3950#ifndef __REACTOS__
3951 hr = _SHExpandEnvironmentStrings(szTemp, szBuildPath);
3952#else
3953 hr = _SHExpandEnvironmentStrings(hToken, szTemp, szBuildPath, _countof(szBuildPath));
3954#endif
3955 else
3956 lstrcpyW(szBuildPath, szTemp);
3957
3958 if (FAILED(hr)) goto end;
3959
3960 if(pszSubPath) {
3961 /* make sure the new path does not exceed the buffer length
3962 * and remember to backslash and terminate it */
3963 if(MAX_PATH < (lstrlenW(szBuildPath) + lstrlenW(pszSubPath) + 2)) {
3965 goto end;
3966 }
3967 PathAppendW(szBuildPath, pszSubPath);
3968 PathRemoveBackslashW(szBuildPath);
3969 }
3970 /* Copy the path if it's available before we might return */
3971 if (SUCCEEDED(hr) && pszPath)
3972 lstrcpyW(pszPath, szBuildPath);
3973
3974 /* if we don't care about existing directories we are ready */
3976
3977 if (PathFileExistsW(szBuildPath)) goto end;
3978
3979 /* not existing but we are not allowed to create it. The return value
3980 * is verified against shell32 version 6.0.
3981 */
3982 if (!(nFolder & CSIDL_FLAG_CREATE))
3983 {
3985 goto end;
3986 }
3987
3988#ifndef __REACTOS__
3989 /* create symbolic links rather than directories for specific
3990 * user shell folders */
3991 if (!pszSubPath)
3992 _SHCreateSymbolicLink(folder, szBuildPath);
3993#endif
3994
3995 /* create directory/directories */
3996 ret = SHCreateDirectoryExW(hwndOwner, szBuildPath, NULL);
3997 if (ret && ret != ERROR_ALREADY_EXISTS)
3998 {
3999 ERR("Failed to create directory %s.\n", debugstr_w(szBuildPath));
4000 hr = E_FAIL;
4001 goto end;
4002 }
4003
4004 TRACE("Created missing system directory %s\n", debugstr_w(szBuildPath));
4005end:
4006#ifdef __REACTOS__
4007 /* create desktop.ini for custom icon */
4008 if ((nFolder & CSIDL_FLAG_CREATE) &&
4009 CSIDL_Data[folder].nShell32IconIndex)
4010 {
4011 WCHAR szIconLocation[MAX_PATH];
4013
4014 /* make the directory a read-only folder */
4015 dwAttributes = GetFileAttributesW(szBuildPath);
4017 SetFileAttributesW(szBuildPath, dwAttributes);
4018
4019 /* build the desktop.ini file path */
4020 PathAppendW(szBuildPath, L"desktop.ini");
4021
4022 /* build the icon location */
4023 StringCchPrintfW(szIconLocation, _countof(szIconLocation),
4024 L"%%SystemRoot%%\\system32\\shell32.dll,%d",
4025 CSIDL_Data[folder].nShell32IconIndex);
4026
4027 /* write desktop.ini */
4028 WritePrivateProfileStringW(L".ShellClassInfo", L"IconResource", szIconLocation, szBuildPath);
4029
4030 /* flush! */
4031 WritePrivateProfileStringW(NULL, NULL, NULL, szBuildPath);
4032
4033 /* make the desktop.ini a system and hidden file */
4034 dwAttributes = GetFileAttributesW(szBuildPath);
4036 SetFileAttributesW(szBuildPath, dwAttributes);
4037 }
4038#endif
4039 TRACE("returning 0x%08lx (final path is %s)\n", hr, debugstr_w(szBuildPath));
4040 return hr;
4041}
#define ERR(fmt,...)
Definition: precomp.h:57
BOOL WINAPI SetFileAttributesW(LPCWSTR lpFileName, DWORD dwFileAttributes)
Definition: fileinfo.c:779
UINT WINAPI GetSystemWow64DirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2439
BOOL WINAPI WritePrivateProfileStringW(LPCWSTR section, LPCWSTR entry, LPCWSTR string, LPCWSTR filename)
Definition: profile.c:1453
WCHAR *WINAPI PathRemoveBackslashW(WCHAR *path)
Definition: path.c:2016
static HRESULT _SHGetCurrentVersionPath(DWORD dwFlags, BYTE folder, LPWSTR pszPath)
Definition: shellpath.c:3169
static void _SHCreateSymbolicLink(int nFolder, const WCHAR *path)
Definition: shellpath.c:3766
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
#define FILE_ATTRIBUTE_HIDDEN
Definition: nt_native.h:703
#define FILE_ATTRIBUTE_SYSTEM
Definition: nt_native.h:704
int WINAPI SHCreateDirectoryExW(HWND hWnd, LPCWSTR path, LPSECURITY_ATTRIBUTES sec)
Definition: shlfileop.cpp:1006
#define CSIDL_FLAG_DONT_VERIFY
Definition: shlobj.h:2281
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
CSIDL_Type type
Definition: shellpath.c:1810
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:228
#define ERROR_FILENAME_EXCED_RANGE
Definition: winerror.h:385

Referenced by CBandSiteMenu::_GetQLaunchPidl(), create_extra_folders(), CreateShortcuts(), SHGetFolderPathAndSubDirA(), SHGetFolderPathW(), SHGetKnownFolderPath(), and ThemePageDlgProc().

◆ SHGetFolderPathEx()

HRESULT WINAPI SHGetFolderPathEx ( REFKNOWNFOLDERID  rfid,
DWORD  flags,
HANDLE  token,
LPWSTR  path,
DWORD  len 
)

Definition at line 4648 of file shellpath.c.

4649{
4650 HRESULT hr;
4651 WCHAR *buffer;
4652
4653 TRACE("%s, 0x%08lx, %p, %p, %lu\n", debugstr_guid(rfid), flags, token, path, len);
4654
4655 if (!path || !len) return E_INVALIDARG;
4656
4658 if (SUCCEEDED( hr ))
4659 {
4660 if (lstrlenW( buffer ) + 1 > len)
4661 {
4664 }
4665 lstrcpyW( path, buffer );
4667 }
4668 return hr;
4669}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat token
Definition: glfuncs.h:210

Referenced by loadShell32().

◆ SHGetFolderPathW()

◆ SHGetKnownFolderIDList()

HRESULT WINAPI SHGetKnownFolderIDList ( REFKNOWNFOLDERID  rfid,
DWORD  flags,
HANDLE  token,
PIDLIST_ABSOLUTE *  pidl 
)

Definition at line 5661 of file shellpath.c.

5662{
5663 TRACE("%s, 0x%08lx, %p, %p\n", debugstr_guid(rfid), flags, token, pidl);
5664
5665 if (!pidl)
5666 return E_INVALIDARG;
5667
5668 if (flags)
5669 FIXME("unsupported flags: 0x%08lx\n", flags);
5670
5671 if (token)
5672 FIXME("user token is not used.\n");
5673
5674 *pidl = NULL;
5675 if (IsEqualIID(rfid, &FOLDERID_Desktop))
5676 *pidl = _ILCreateDesktop();
5677 else if (IsEqualIID(rfid, &FOLDERID_RecycleBinFolder))
5678 *pidl = _ILCreateBitBucket();
5679 else if (IsEqualIID(rfid, &FOLDERID_ComputerFolder))
5680 *pidl = _ILCreateMyComputer();
5681 else if (IsEqualIID(rfid, &FOLDERID_PrintersFolder))
5682 *pidl = _ILCreatePrinters();
5683 else if (IsEqualIID(rfid, &FOLDERID_ControlPanelFolder))
5684 *pidl = _ILCreateControlPanel();
5685 else if (IsEqualIID(rfid, &FOLDERID_NetworkFolder))
5686 *pidl = _ILCreateNetwork();
5687 else if (IsEqualIID(rfid, &FOLDERID_Documents))
5688 *pidl = _ILCreateMyDocuments();
5689 else
5690 {
5691 DWORD attributes = 0;
5692 WCHAR *pathW;
5693 HRESULT hr;
5694
5696 if (FAILED(hr))
5697 return hr;
5698
5701 return hr;
5702 }
5703
5704 return *pidl ? S_OK : E_FAIL;
5705}
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

Referenced by knownfolder_GetIDList(), loadShell32(), SHCreateItemInKnownFolder(), and SHGetKnownFolderItem().

◆ SHGetKnownFolderItem()

HRESULT WINAPI SHGetKnownFolderItem ( REFKNOWNFOLDERID  rfid,
KNOWN_FOLDER_FLAG  flags,
HANDLE  hToken,
REFIID  riid,
void **  ppv 
)

Definition at line 5707 of file shellpath.c.

5709{
5710 PIDLIST_ABSOLUTE pidl;
5711 HRESULT hr;
5712
5713 TRACE("%s, 0x%08x, %p, %s, %p\n", debugstr_guid(rfid), flags, hToken, debugstr_guid(riid), ppv);
5714
5715 hr = SHGetKnownFolderIDList(rfid, flags, hToken, &pidl);
5716 if (FAILED(hr))
5717 {
5718 *ppv = NULL;
5719 return hr;
5720 }
5721
5723 CoTaskMemFree(pidl);
5724 return hr;
5725}
EXTERN_C HRESULT WINAPI SHCreateItemFromIDList(_In_ PCIDLIST_ABSOLUTE pidl, _In_ REFIID riid, _Out_ void **ppv)
Definition: CShellItem.cpp:512

Referenced by knownfolder_GetShellItem().

◆ SHGetKnownFolderPath()

HRESULT WINAPI SHGetKnownFolderPath ( REFKNOWNFOLDERID  rfid,
DWORD  flags,
HANDLE  token,
WCHAR **  ret_path 
)

Definition at line 4593 of file shellpath.c.

4594{
4596 HRESULT hr;
4597 int folder = csidl_from_id(rfid), shgfp_flags;
4598
4599 TRACE("%s, 0x%08lx, %p, %p\n", debugstr_guid(rfid), flags, token, ret_path);
4600
4601 *ret_path = NULL;
4602
4603 if (folder < 0)
4605
4608 {
4609 FIXME("flags 0x%08lx not supported\n", flags);
4610 return E_INVALIDARG;
4611 }
4612
4614 {
4615 WARN("Invalid flags mask %#lx.\n", flags);
4616 return E_INVALIDARG;
4617 }
4618
4620 {
4621 FIXME("Ignoring KF_FLAG_NOT_PARENT_RELATIVE.\n");
4622 flags &= ~KF_FLAG_NOT_PARENT_RELATIVE;
4623 }
4624
4627
4628 hr = SHGetFolderPathAndSubDirW( 0, folder, token, shgfp_flags, NULL, pathW );
4629 if (FAILED( hr ))
4630 {
4631 TRACE("Failed to get folder path, %#lx.\n", hr);
4632 return hr;
4633 }
4634
4635 TRACE("Final path is %s, %#lx\n", debugstr_w(pathW), hr);
4636
4637 *ret_path = CoTaskMemAlloc((lstrlenW(pathW) + 1) * sizeof(WCHAR));
4638 if (!*ret_path)
4639 return E_OUTOFMEMORY;
4640 lstrcpyW(*ret_path, pathW);
4641
4642 return hr;
4643}
@ KF_FLAG_NOT_PARENT_RELATIVE
Definition: shlobj.h:100
@ KF_FLAG_NO_ALIAS
Definition: shlobj.h:103
@ KF_FLAG_SIMPLE_IDLIST
Definition: shlobj.h:99
@ KF_FLAG_DONT_UNEXPAND
Definition: shlobj.h:104
@ KF_FLAG_DONT_VERIFY
Definition: shlobj.h:105
@ KF_FLAG_CREATE
Definition: shlobj.h:106
@ KF_FLAG_INIT
Definition: shlobj.h:102
#define KF_FLAG_DEFAULT_PATH
Definition: shlobj.h:354
#define CSIDL_FLAG_MASK
Definition: shlobj.h:2284

Referenced by get_known_folder_path_by_id(), init_function_pointers(), loadShell32(), open_cached_revocation_file(), SHGetFolderPathEx(), and SHGetKnownFolderIDList().

◆ SHGetSpecialFolderLocation()

HRESULT WINAPI SHGetSpecialFolderLocation ( HWND  hwndOwner,
INT  nFolder,
LPITEMIDLIST *  ppidl 
)

Definition at line 4574 of file shellpath.c.

4578{
4580
4581 TRACE("(%p,0x%x,%p)\n", hwndOwner,nFolder,ppidl);
4582
4583 if (!ppidl)
4584 return E_INVALIDARG;
4585
4586 hr = SHGetFolderLocation(hwndOwner, nFolder, NULL, 0, ppidl);
4587 return hr;
4588}
HRESULT WINAPI SHGetFolderLocation(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwReserved, LPITEMIDLIST *ppidl)
Definition: shellpath.c:4467

Referenced by _GetDocumentsPidl(), CShellMenuCallback::AddOrSetMenuItem(), CreateFolder2Instance(), DoGetPidl(), DoInitAliasPIDLs(), DoTestEntry(), DynamicSHGetSpecialFolderPathW(), ebrowser_browse_to_desktop(), FILEDLG95_InitControls(), FILEDLG95_LOOKIN_Init(), FILEDLG95_OnWMCommand(), filedlg_collect_places_pidls(), GetFavoritesFolder(), GetFavsLocation(), GetMergedFolder(), GetParsingName(), CSendToMenu::GetSpecialFolder(), CSearchBar::Invoke(), CFontBackgroundMenu::InvokeCommand(), IShellBrowserImpl_Construct(), loadShell32(), MRUList_PidlList_0(), CACListISF::NextLocation(), CShellMenuCallback::OnGetContextMenu(), PidlBrowse(), CAddressEditBox::PopulateComboBox(), CShellBrowser::RelayCommands(), RSHELL_CStartMenu_CreateInstance(), SHAddToRecentDocs(), SHCloneSpecialIDList(), Shell_ParsePrinterName(), SHELL_ShowItemIDListProperties(), SHExplorerParseCmdLine(), CRecycleBinCleaner::ShowProperties(), START_TEST(), test_ACListISF_FAVORITES(), test_ACListISF_MYCOMPUTER(), test_get_file_info_iconlist(), test_namespace(), test_parameters(), test_printers_folder(), test_SHCreateShellItem(), test_SHCreateShellItemArray(), test_ShellItemBindToHandler(), test_ShellItemGetAttributes(), test_SHGetIDListFromObject(), test_SHGetNameFromIDList(), test_SHGetPathFromIDList(), VariantToIdlist(), and WshCollection_Item().

◆ SHGetSpecialFolderPathA()

BOOL WINAPI SHGetSpecialFolderPathA ( HWND  hwndOwner,
LPSTR  szPath,
int  nFolder,
BOOL  bCreate 
)

Definition at line 4381 of file shellpath.c.

4386{
4387 return SHGetFolderPathA(hwndOwner, nFolder + (bCreate ? CSIDL_FLAG_CREATE : 0), NULL, 0,
4388 szPath) == S_OK;
4389}
HRESULT WINAPI SHGetFolderPathA(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPSTR pszPath)
Definition: shellpath.c:4048
_In_ int _In_ BOOL bCreate
Definition: shlobj.h:1565

Referenced by get_cache_path(), init_strings(), loadShell32(), main(), SHGetSpecialFolderPathAW(), test_BindToObject(), test_find_file(), and test_GetDisplayName().

◆ SHGetSpecialFolderPathAW()

BOOL WINAPI SHGetSpecialFolderPathAW ( HWND  hwndOwner,
LPVOID  szPath,
int  nFolder,
BOOL  bCreate 
)

Definition at line 4433 of file shellpath.c.

4439{
4440 if (SHELL_OsIsUnicode())
4441 return SHGetSpecialFolderPathW (hwndOwner, szPath, nFolder, bCreate);
4442 return SHGetSpecialFolderPathA (hwndOwner, szPath, nFolder, bCreate);
4443}
BOOL WINAPI SHGetSpecialFolderPathA(HWND hwndOwner, LPSTR szPath, int nFolder, BOOL bCreate)
Definition: shellpath.c:4381

◆ SHGetSpecialFolderPathW()

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shell  )

Variable Documentation

◆ ApplicationDestinationsVtbl

const IApplicationDestinationsVtbl ApplicationDestinationsVtbl
static
Initial value:
=
{
}
static HRESULT WINAPI ApplicationDestinations_RemoveAllDestinations(IApplicationDestinations *iface)
Definition: shellpath.c:1653
static HRESULT WINAPI ApplicationDestinations_RemoveDestination(IApplicationDestinations *iface, IUnknown *punk)
Definition: shellpath.c:1644
static HRESULT WINAPI ApplicationDestinations_SetAppID(IApplicationDestinations *iface, const WCHAR *appid)
Definition: shellpath.c:1635
static HRESULT WINAPI ApplicationDestinations_QueryInterface(IApplicationDestinations *iface, REFIID riid, LPVOID *ppv)
Definition: shellpath.c:1587
static ULONG WINAPI ApplicationDestinations_AddRef(IApplicationDestinations *iface)
Definition: shellpath.c:1612
static ULONG WINAPI ApplicationDestinations_Release(IApplicationDestinations *iface)
Definition: shellpath.c:1622

Definition at line 1662 of file shellpath.c.

Referenced by ApplicationDestinations_Constructor().

◆ ApplicationDocumentListsVtbl

const IApplicationDocumentListsVtbl ApplicationDocumentListsVtbl
static
Initial value:
=
{
}
static ULONG WINAPI ApplicationDocumentLists_AddRef(IApplicationDocumentLists *iface)
Definition: shellpath.c:1731
static ULONG WINAPI ApplicationDocumentLists_Release(IApplicationDocumentLists *iface)
Definition: shellpath.c:1741
static HRESULT WINAPI ApplicationDocumentLists_GetList(IApplicationDocumentLists *iface, APPDOCLISTTYPE list_type, UINT item_count, REFIID riid, void **obj)
Definition: shellpath.c:1764
static HRESULT WINAPI ApplicationDocumentLists_QueryInterface(IApplicationDocumentLists *iface, REFIID riid, LPVOID *ppv)
Definition: shellpath.c:1706
static HRESULT WINAPI ApplicationDocumentLists_SetAppID(IApplicationDocumentLists *iface, const WCHAR *appid)
Definition: shellpath.c:1754

Definition at line 1775 of file shellpath.c.

Referenced by ApplicationDocumentLists_Constructor().

◆ CSIDL_Data

◆ foldermanager_vtbl

const struct IKnownFolderManagerVtbl foldermanager_vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI foldermanager_GetFolderIds(IKnownFolderManager *iface, KNOWNFOLDERID **ppKFId, UINT *pCount)
Definition: shellpath.c:5369
static HRESULT WINAPI foldermanager_FindFolderFromPath(IKnownFolderManager *iface, LPCWSTR pszPath, FFFP_MODE mode, IKnownFolder **ppkf)
Definition: shellpath.c:5563
static HRESULT WINAPI foldermanager_GetFolder(IKnownFolderManager *iface, REFKNOWNFOLDERID rfid, IKnownFolder **ppkf)
Definition: shellpath.c:5411
static ULONG WINAPI foldermanager_AddRef(IKnownFolderManager *iface)
Definition: shellpath.c:5291
static HRESULT WINAPI foldermanager_FolderIdToCsidl(IKnownFolderManager *iface, REFKNOWNFOLDERID rfid, int *pnCsidl)
Definition: shellpath.c:5354
static HRESULT WINAPI foldermanager_GetFolderByName(IKnownFolderManager *iface, LPCWSTR pszCanonicalName, IKnownFolder **ppkf)
Definition: shellpath.c:5439
static ULONG WINAPI foldermanager_Release(IKnownFolderManager *iface)
Definition: shellpath.c:5298
static HRESULT WINAPI foldermanager_FolderIdFromCsidl(IKnownFolderManager *iface, int nCsidl, KNOWNFOLDERID *pfid)
Definition: shellpath.c:5341
static HRESULT WINAPI foldermanager_RegisterFolder(IKnownFolderManager *iface, REFKNOWNFOLDERID rfid, KNOWNFOLDER_DEFINITION const *pKFD)
Definition: shellpath.c:5537
static HRESULT WINAPI foldermanager_FindFolderFromIDList(IKnownFolderManager *iface, PCIDLIST_ABSOLUTE pidl, IKnownFolder **ppkf)
Definition: shellpath.c:5573
static HRESULT WINAPI foldermanager_QueryInterface(IKnownFolderManager *iface, REFIID riid, void **ppv)
Definition: shellpath.c:5312
static HRESULT WINAPI foldermanager_UnregisterFolder(IKnownFolderManager *iface, REFKNOWNFOLDERID rfid)
Definition: shellpath.c:5546
static HRESULT WINAPI foldermanager_Redirect(IKnownFolderManager *iface, REFKNOWNFOLDERID rfid, HWND hwnd, KF_REDIRECT_FLAGS flags, LPCWSTR pszTargetPath, UINT cFolders, KNOWNFOLDERID const *pExclusion, LPWSTR *ppszError)
Definition: shellpath.c:5582

Definition at line 5595 of file shellpath.c.

Referenced by foldermanager_create().

◆ is_win64

const BOOL is_win64 = sizeof(void *) > sizeof(int)
static

Definition at line 92 of file shellpath.c.

Referenced by _SHGetCurrentVersionPath(), and _SHGetDefaultValue().

◆ knownfolder_vtbl

const struct IKnownFolderVtbl knownfolder_vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI knownfolder_GetCategory(IKnownFolder *iface, KF_CATEGORY *pCategory)
Definition: shellpath.c:4982
static HRESULT WINAPI knownfolder_GetRedirectionCapabilities(IKnownFolder *iface, KF_REDIRECTION_CAPABILITIES *pCapabilities)
Definition: shellpath.c:5191
static HRESULT WINAPI knownfolder_QueryInterface(IKnownFolder *iface, REFIID riid, void **ppv)
Definition: shellpath.c:4909
static ULONG WINAPI knownfolder_Release(IKnownFolder *iface)
Definition: shellpath.c:4895
static HRESULT WINAPI knownfolder_SetPath(IKnownFolder *iface, DWORD dwFlags, LPCWSTR pszPath)
Definition: shellpath.c:5153
static HRESULT WINAPI knownfolder_GetShellItem(IKnownFolder *iface, DWORD flags, REFIID riid, void **ppv)
Definition: shellpath.c:5001
static HRESULT WINAPI knownfolder_GetFolderType(IKnownFolder *iface, FOLDERTYPEID *pftid)
Definition: shellpath.c:5183
static ULONG WINAPI knownfolder_AddRef(IKnownFolder *iface)
Definition: shellpath.c:4888
static HRESULT WINAPI knownfolder_GetIDList(IKnownFolder *iface, DWORD flags, PIDLIST_ABSOLUTE *ppidl)
Definition: shellpath.c:5173
static HRESULT WINAPI knownfolder_GetId(IKnownFolder *iface, KNOWNFOLDERID *pkfid)
Definition: shellpath.c:4970
static HRESULT WINAPI knownfolder_GetFolderDefinition(IKnownFolder *iface, KNOWNFOLDER_DEFINITION *pKFD)
Definition: shellpath.c:5201
static HRESULT WINAPI knownfolder_GetPath(IKnownFolder *iface, DWORD dwFlags, LPWSTR *ppszPath)
Definition: shellpath.c:5142

Definition at line 5244 of file shellpath.c.

Referenced by knownfolder_create().

◆ xdg_config

char* xdg_config
static

Definition at line 3621 of file shellpath.c.

Referenced by get_xdg_path(), and init_xdg_dirs().

◆ xdg_config_len

DWORD xdg_config_len
static

Definition at line 3622 of file shellpath.c.

Referenced by get_xdg_path(), and init_xdg_dirs().