ReactOS  0.4.15-dev-4857-g47842d7
shellpath.c File Reference
#include <wine/config.h>
#include <windef.h>
#include <winbase.h>
#include <shlobj.h>
#include <undocshell.h>
#include <shlwapi.h>
#include <sddl.h>
#include <strsafe.h>
#include <wine/debug.h>
#include <wine/unicode.h>
#include <shlwapi_undoc.h>
#include <shellutils.h>
#include <userenv.h>
#include "pidl.h"
#include "shell32_main.h"
#include "shresdef.h"
Include dependency graph for shellpath.c:

Go to the source code of this file.

Classes

struct  CSIDL_DATA
 

Macros

#define WIN32_NO_STATUS
 
#define _INC_WINDOWS
 
#define COBJMACROS
 
#define _WIN32_WINNT   _WIN32_WINNT_WS03
 
#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
}
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (shell)
 
static BOOL WINAPI PathSearchOnExtensionsW (LPWSTR pszPath, LPCWSTR *ppszDirs, BOOL bDoSearch, DWORD dwWhich)
 
static BOOL WINAPI PathIsAbsoluteW (LPCWSTR path)
 
static BOOL WINAPI PathMakeAbsoluteW (LPWSTR path)
 
static DWORD GetShortPathNameAbsentW (LPCWSTR pszLong, LPWSTR pszShort, DWORD cchShort)
 
BOOL WINAPI IsLFNDriveW (LPCWSTR lpszPath)
 
static VOID WINAPI PathQualifyExW (LPWSTR pszPath, LPCWSTR pszDir, DWORD dwFlags)
 
BOOL WINAPI PathAppendAW (LPVOID lpszPath1, LPCVOID lpszPath2)
 
static LPSTR PathGetExtensionA (LPCSTR lpszPath)
 
static LPWSTR PathGetExtensionW (LPCWSTR lpszPath)
 
LPVOID WINAPI SHPathGetExtensionW (LPCWSTR lpszPath, DWORD void1, DWORD void2)
 
BOOL WINAPI PathRemoveFileSpecAW (LPVOID lpszPath)
 
static void PathGetShortPathA (LPSTR pszPath)
 
static void PathGetShortPathW (LPWSTR pszPath)
 
VOID WINAPI PathGetShortPathAW (LPVOID pszPath)
 
BOOL WINAPI PathIsRootAW (LPCVOID lpszPath)
 
static BOOL PathIsExeA (LPCSTR lpszPath)
 
BOOL PathIsExeW (LPCWSTR lpszPath)
 
BOOL WINAPI PathIsExeAW (LPCVOID path)
 
BOOL WINAPI PathFileExistsAW (LPCVOID lpszPath)
 
BOOL WINAPI IsLFNDriveA (LPCSTR 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)
 
int WINAPI PathCleanupSpec (LPCWSTR lpszPathW, LPWSTR lpszFileW)
 
VOID WINAPI PathQualifyA (LPSTR pszPath)
 
VOID WINAPI PathQualifyW (LPWSTR pszPath)
 
VOID WINAPI PathQualifyAW (LPVOID pszPath)
 
BOOL WINAPI PathResolveA (LPSTR path, LPCSTR *dirs, DWORD flags)
 
BOOL WINAPI PathResolveW (LPWSTR path, LPCWSTR *dirs, DWORD flags)
 
BOOL WINAPI PathResolveAW (LPVOID path, LPCVOID *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)
 
static HRESULT _SHExpandEnvironmentStrings (LPCWSTR szSrc, LPWSTR szDest)
 
static HRESULT _SHGetUserShellFolderPath (HKEY rootKey, LPCWSTR userPrefix, LPCWSTR value, LPWSTR path)
 
BOOL _SHGetUserProfileDirectoryW (HANDLE hToken, LPWSTR szPath, LPDWORD lpcchPath)
 
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)
 
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)
 
HRESULT SHELL_RegisterShellFolders (void)
 
BOOL WINAPI SHGetSpecialFolderPathA (HWND hwndOwner, LPSTR szPath, int nFolder, BOOL bCreate)
 
BOOL WINAPI SHGetSpecialFolderPathW (HWND hwndOwner, LPWSTR 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)
 

Variables

static const BOOL is_win64 = sizeof(void *) > sizeof(int)
 
static const WCHAR Application_DataW [] = L"Application Data"
 
static const WCHAR Local_Settings_Application_DataW [] = L"Local Settings\\Application Data"
 
static const WCHAR Local_Settings_HistoryW [] = L"Local Settings\\History"
 
static const WCHAR Local_Settings_Temporary_Internet_FilesW [] = L"Local Settings\\Temporary Internet Files"
 
static const WCHAR MusicW [] = L"Music"
 
static const WCHAR PicturesW [] = L"Pictures"
 
static const WCHAR Program_FilesW [] = L"Program Files"
 
static const WCHAR Program_Files_Common_FilesW [] = L"Program Files\\Common Files"
 
static const WCHAR Start_Menu_ProgramsW [] = L"Start Menu\\Programs"
 
static const WCHAR Start_Menu_Admin_ToolsW [] = L"Start Menu\\Programs\\Administrative Tools"
 
static const WCHAR Start_Menu_StartupW [] = L"Start Menu\\Programs\\StartUp"
 
static const WCHAR szSHFolders [] = L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders"
 
static const WCHAR szSHUserFolders [] = L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders"
 
static const WCHAR szKnownFolderDescriptions [] = L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FolderDescriptions"
 
static const WCHAR szKnownFolderRedirections [] = L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders"
 
static const CSIDL_DATA CSIDL_Data []
 

Macro Definition Documentation

◆ _INC_WINDOWS

#define _INC_WINDOWS

Definition at line 29 of file shellpath.c.

◆ _WIN32_WINNT

#define _WIN32_WINNT   _WIN32_WINNT_WS03

Definition at line 54 of file shellpath.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 30 of file shellpath.c.

◆ CSIDL_APPDATA_LOCALLOW

#define CSIDL_APPDATA_LOCALLOW   0x004e

Definition at line 856 of file shellpath.c.

◆ CSIDL_CONTACTS

#define CSIDL_CONTACTS   0x0043

Definition at line 853 of file shellpath.c.

◆ CSIDL_DOWNLOADS

#define CSIDL_DOWNLOADS   0x0047

Definition at line 854 of file shellpath.c.

◆ CSIDL_LINKS

#define CSIDL_LINKS   0x004d

Definition at line 855 of file shellpath.c.

◆ CSIDL_SAVED_GAMES

#define CSIDL_SAVED_GAMES   0x0062

Definition at line 857 of file shellpath.c.

◆ CSIDL_SEARCHES

#define CSIDL_SEARCHES   0x0063

Definition at line 858 of file shellpath.c.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 28 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 

Definition at line 837 of file shellpath.c.

Function Documentation

◆ _GetUserSidStringFromToken()

static LPWSTR _GetUserSidStringFromToken ( HANDLE  Token)
static

Definition at line 1961 of file shellpath.c.

1962 {
1963  char InfoBuffer[64];
1964  PTOKEN_USER UserInfo;
1965  DWORD InfoSize;
1966  LPWSTR SidStr;
1967 
1968  UserInfo = (PTOKEN_USER) InfoBuffer;
1969  if (! GetTokenInformation(Token, TokenUser, InfoBuffer, sizeof(InfoBuffer),
1970  &InfoSize))
1971  {
1973  return NULL;
1974  UserInfo = HeapAlloc(GetProcessHeap(), 0, InfoSize);
1975  if (UserInfo == NULL)
1976  return NULL;
1977  if (! GetTokenInformation(Token, TokenUser, UserInfo, InfoSize,
1978  &InfoSize))
1979  {
1980  HeapFree(GetProcessHeap(), 0, UserInfo);
1981  return NULL;
1982  }
1983  }
1984 
1985  if (! ConvertSidToStringSidW(UserInfo->User.Sid, &SidStr))
1986  SidStr = NULL;
1987 
1988  if (UserInfo != (PTOKEN_USER) InfoBuffer)
1989  HeapFree(GetProcessHeap(), 0, UserInfo);
1990 
1991  return SidStr;
1992 }
_IRQL_requires_same_ _In_ PLSA_STRING _In_ SECURITY_LOGON_TYPE _In_ ULONG _In_ ULONG _In_opt_ PTOKEN_GROUPS _In_ PTOKEN_SOURCE _Out_ PVOID _Out_ PULONG _Inout_ PLUID _Out_ PHANDLE Token
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
BOOL WINAPI ConvertSidToStringSidW(PSID Sid, LPWSTR *StringSid)
Definition: security.c:3382
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
#define NULL
Definition: types.h:112
BOOL WINAPI GetTokenInformation(HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength)
Definition: security.c:413
struct _TOKEN_USER * PTOKEN_USER
SID_AND_ATTRIBUTES User
Definition: setypes.h:1006
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:594
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by _SHGetUserProfilePath().

◆ _SHExpandEnvironmentStrings()

static HRESULT _SHExpandEnvironmentStrings ( LPCWSTR  szSrc,
LPWSTR  szDest 
)
static

Definition at line 2196 of file shellpath.c.

2200 {
2201  HRESULT hr;
2202 #ifndef __REACTOS__
2203  WCHAR szTemp[MAX_PATH], szProfilesPrefix[MAX_PATH] = { 0 };
2204  HKEY key = NULL;
2205 #else
2206  WCHAR szTemp[MAX_PATH];
2207 #endif
2208 
2209  TRACE("%s, %p\n", debugstr_w(szSrc), szDest);
2210 
2211  if (!szSrc || !szDest) return E_INVALIDARG;
2212 
2213  /* short-circuit if there's nothing to expand */
2214  if (szSrc[0] != '%')
2215  {
2216  strcpyW(szDest, szSrc);
2217  hr = S_OK;
2218  goto end;
2219  }
2220 #ifndef __REACTOS__
2221  /* Get the profile prefix, we'll probably be needing it */
2223  if (SUCCEEDED(hr))
2224  {
2225  WCHAR def_val[MAX_PATH];
2226 
2227  /* get the system drive */
2228  GetSystemDirectoryW(def_val, MAX_PATH);
2229  strcpyW( def_val + 3, L"Users" );
2230 
2231  hr = _SHGetProfilesValue(key, L"ProfilesDirectory", szProfilesPrefix, def_val );
2232  }
2233 #else
2234  hr = S_OK;
2235 #endif
2236 
2237  *szDest = 0;
2238  strcpyW(szTemp, szSrc);
2239  while (SUCCEEDED(hr) && szTemp[0] == '%')
2240  {
2241  if (!strncmpiW(szTemp, L"%ALLUSERSPROFILE%", ARRAY_SIZE(L"%ALLUSERSPROFILE%")-1))
2242  {
2243 #ifndef __REACTOS__
2244  WCHAR szAllUsers[MAX_PATH];
2245 
2246  strcpyW(szDest, szProfilesPrefix);
2247  hr = _SHGetProfilesValue(key, L"AllUsersProfile", szAllUsers, L"Public");
2248  PathAppendW(szDest, szAllUsers);
2249 #else
2250  DWORD cchSize = cchDest;
2251  if (!GetAllUsersProfileDirectoryW(szDest, &cchSize))
2252  goto fallback_expand;
2253 #endif
2254  PathAppendW(szDest, szTemp + ARRAY_SIZE(L"%ALLUSERSPROFILE%")-1);
2255  }
2256 #ifndef __REACTOS__
2257  else if (!strncmpiW(szTemp, L"%PUBLIC%", ARRAY_SIZE(L"%PUBLIC%")-1))
2258  {
2259  WCHAR szAllUsers[MAX_PATH], def_val[MAX_PATH];
2260 
2261  GetSystemDirectoryW(def_val, MAX_PATH);
2262  strcpyW( def_val + 3, L"Users\\Public" );
2263 
2264  hr = _SHGetProfilesValue(key, L"Public", szAllUsers, def_val);
2265  PathAppendW(szDest, szAllUsers);
2266  PathAppendW(szDest, szTemp + ARRAY_SIZE(L"%PUBLIC%")-1);
2267  }
2268 #endif
2269  else if (!strncmpiW(szTemp, L"%USERPROFILE%", ARRAY_SIZE(L"%USERPROFILE%")-1))
2270  {
2271 #ifndef __REACTOS__
2273  DWORD userLen = MAX_PATH;
2274 
2275  strcpyW(szDest, szProfilesPrefix);
2276  GetUserNameW(userName, &userLen);
2277  PathAppendW(szDest, userName);
2278 #else
2279  DWORD cchSize = cchDest;
2280  if (!_SHGetUserProfileDirectoryW(hToken, szDest, &cchSize))
2281  goto fallback_expand;
2282 #endif
2283  PathAppendW(szDest, szTemp + ARRAY_SIZE(L"%USERPROFILE%")-1);
2284  }
2285  else if (!strncmpiW(szTemp, L"%SystemDrive%", ARRAY_SIZE(L"%SystemDrive%")-1))
2286  {
2287 #ifndef __REACTOS__
2288  GetSystemDirectoryW(szDest, MAX_PATH);
2289 #else
2290  if (!GetSystemDirectoryW(szDest, cchDest))
2291  goto fallback_expand;
2292 #endif
2293  strcpyW(szDest + 3, szTemp + ARRAY_SIZE(L"%SystemDrive%")-1 + 1);
2294  }
2295  else
2296 #ifdef __REACTOS__
2297 fallback_expand:
2298 #endif
2299  {
2300 #ifndef __REACTOS__
2301  DWORD ret = ExpandEnvironmentStringsW(szTemp, szDest, MAX_PATH);
2302 #else
2303  DWORD ret = SHExpandEnvironmentStringsForUserW(hToken, szTemp, szDest, cchDest);
2304 #endif
2305 
2306 #ifndef __REACTOS__
2307  if (ret > MAX_PATH)
2308 #else
2309  if (ret > cchDest)
2310 #endif
2312  else if (ret == 0)
2314  else if (!strcmpW( szTemp, szDest )) break; /* nothing expanded */
2315  }
2316  if (SUCCEEDED(hr)) strcpyW(szTemp, szDest);
2317  }
2318 end:
2319 #ifndef __REACTOS__
2320  if (key)
2321  RegCloseKey(key);
2322 #endif
2323  TRACE("returning 0x%08x (input was %s, output is %s)\n", hr,
2324  debugstr_w(szSrc), debugstr_w(szDest));
2325  return hr;
2326 }
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
HRESULT hr
Definition: shlfolder.c:183
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
#define strncmpiW(s1, s2, n)
Definition: unicode.h:40
BOOL WINAPI PathAppendW(LPWSTR lpszPath, LPCWSTR lpszAppend)
Definition: path.c:126
#define L(x)
Definition: ntvdm.h:50
BOOL _SHGetUserProfileDirectoryW(HANDLE hToken, LPWSTR szPath, LPDWORD lpcchPath)
Definition: shellpath.c:1740
if SUCCEEDED(hr)
#define debugstr_w
Definition: kernel32.h:32
#define E_INVALIDARG
Definition: ddrawi.h:101
static HRESULT _SHOpenProfilesKey(PHKEY pKey)
Definition: shellpath.c:2131
BOOL WINAPI GetUserNameW(LPWSTR lpszName, LPDWORD lpSize)
Definition: misc.c:291
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint end
Definition: gl.h:1545
int ret
#define E_NOT_SUFFICIENT_BUFFER
Definition: winerror.h:2345
#define S_OK
Definition: intsafe.h:52
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
BOOL WINAPI GetAllUsersProfileDirectoryW(_Out_opt_ LPWSTR lpProfileDir, _Inout_ LPDWORD lpcchSize)
Definition: profile.c:1310
#define ARRAY_SIZE(a)
Definition: main.h:24
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2313
static HRESULT _SHGetProfilesValue(HKEY profilesKey, LPCWSTR szValueName, LPWSTR szValue, LPCWSTR szDefault)
Definition: shellpath.c:2146
#define NULL
Definition: types.h:112
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
static const WCHAR userName[]
Definition: wnet.c:2154
WINE_UNICODE_INLINE int strcmpW(const WCHAR *str1, const WCHAR *str2)
Definition: unicode.h:229
#define RegCloseKey(hKey)
Definition: registry.h:47
Definition: copy.c:22

Referenced by _SHGetUserShellFolderPath(), and SHGetFolderPathAndSubDirW().

◆ _SHGetAllUsersProfilePath()

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

Definition at line 2091 of file shellpath.c.

2093 {
2094  HRESULT hr;
2095 
2096  TRACE("0x%08x,0x%02x,%p\n", dwFlags, folder, pszPath);
2097 
2098  if (folder >= ARRAY_SIZE(CSIDL_Data))
2099  return E_INVALIDARG;
2101  return E_INVALIDARG;
2102  if (!pszPath)
2103  return E_INVALIDARG;
2104 
2106 #ifndef __REACTOS__
2107  hr = _SHGetDefaultValue(folder, pszPath);
2108 #else
2109  hr = _SHGetDefaultValue(NULL, folder, pszPath);
2110 #endif
2111  else
2112  {
2113 #ifndef __REACTOS__
2115 #else
2117 #endif
2118  CSIDL_Data[folder].szValueName, pszPath);
2119  if (FAILED(hr))
2120 #ifndef __REACTOS__
2121  hr = _SHGetDefaultValue(folder, pszPath);
2122 #else
2123  hr = _SHGetDefaultValue(NULL, folder, pszPath);
2124 #endif
2125  }
2126  TRACE("returning 0x%08x (output path is %s)\n", hr, debugstr_w(pszPath));
2127  return hr;
2128 }
Definition: fci.c:115
HRESULT hr
Definition: shlfolder.c:183
static const CSIDL_DATA CSIDL_Data[]
Definition: shellpath.c:870
#define debugstr_w
Definition: kernel32.h:32
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
static HRESULT _SHGetDefaultValue(BYTE folder, LPWSTR pszPath)
Definition: shellpath.c:1776
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define ARRAY_SIZE(a)
Definition: main.h:24
#define NULL
Definition: types.h:112
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static HRESULT _SHGetUserShellFolderPath(HKEY rootKey, LPCWSTR userPrefix, LPCWSTR value, LPWSTR path)
Definition: shellpath.c:1657
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by _SHRegisterFolders(), and SHGetFolderPathAndSubDirW().

◆ _SHGetCurrentVersionPath()

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

Definition at line 1892 of file shellpath.c.

1894 {
1895  HRESULT hr;
1896 
1897  TRACE("0x%08x,0x%02x,%p\n", dwFlags, folder, pszPath);
1898 
1899  if (folder >= ARRAY_SIZE(CSIDL_Data))
1900  return E_INVALIDARG;
1902  return E_INVALIDARG;
1903  if (!pszPath)
1904  return E_INVALIDARG;
1905 
1907 #ifndef __REACTOS__
1908  hr = _SHGetDefaultValue(folder, pszPath);
1909 #else
1910  hr = _SHGetDefaultValue(NULL, folder, pszPath);
1911 #endif
1912  else
1913  {
1914  HKEY hKey;
1915 
1916  if (RegCreateKeyW(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion", &hKey))
1917  hr = E_FAIL;
1918  else
1919  {
1920  DWORD dwType, dwPathLen = MAX_PATH * sizeof(WCHAR);
1921 
1922  if (RegQueryValueExW(hKey, CSIDL_Data[folder].szValueName, NULL,
1923  &dwType, (LPBYTE)pszPath, &dwPathLen) ||
1924  (dwType != REG_SZ && dwType != REG_EXPAND_SZ))
1925  {
1926 #ifndef __REACTOS__
1927  hr = _SHGetDefaultValue(folder, pszPath);
1928 #else
1929  hr = _SHGetDefaultValue(NULL, folder, pszPath);
1930 #endif
1931  dwType = REG_EXPAND_SZ;
1932  switch (folder)
1933  {
1936  /* these two should never be set on 32-bit setups */
1937  if (!is_win64)
1938  {
1939  BOOL is_wow64;
1941  if (!is_wow64) break;
1942  }
1943  /* fall through */
1944  default:
1945  RegSetValueExW(hKey, CSIDL_Data[folder].szValueName, 0, dwType,
1946  (LPBYTE)pszPath, (strlenW(pszPath)+1)*sizeof(WCHAR));
1947  }
1948  }
1949  else
1950  {
1951  pszPath[dwPathLen / sizeof(WCHAR)] = '\0';
1952  hr = S_OK;
1953  }
1954  RegCloseKey(hKey);
1955  }
1956  }
1957  TRACE("returning 0x%08x (output path is %s)\n", hr, debugstr_w(pszPath));
1958  return hr;
1959 }
Definition: fci.c:115
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
BOOL is_wow64
Definition: msi.c:54
HRESULT hr
Definition: shlfolder.c:183
static const CSIDL_DATA CSIDL_Data[]
Definition: shellpath.c:870
#define E_FAIL
Definition: ddrawi.h:102
#define CSIDL_PROGRAM_FILESX86
Definition: shlobj.h:2053
#define L(x)
Definition: ntvdm.h:50
unsigned char * LPBYTE
Definition: typedefs.h:53
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
#define E_INVALIDARG
Definition: ddrawi.h:101
static const BOOL is_win64
Definition: shellpath.c:58
BOOL WINAPI IsWow64Process(IN HANDLE hProcess, OUT PBOOL Wow64Process)
Definition: proc.c:1975
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:4899
#define TRACE(s)
Definition: solgame.cpp:4
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4120
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
static HRESULT _SHGetDefaultValue(BYTE folder, LPWSTR pszPath)
Definition: shellpath.c:1776
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
LONG WINAPI RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1199
#define GetCurrentProcess()
Definition: compat.h:618
#define CSIDL_PROGRAM_FILES_COMMONX86
Definition: shlobj.h:2055
#define S_OK
Definition: intsafe.h:52
FxAutoRegKey hKey
#define ARRAY_SIZE(a)
Definition: main.h:24
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
#define NULL
Definition: types.h:112
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define RegCloseKey(hKey)
Definition: registry.h:47
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define REG_SZ
Definition: layer.c:22

Referenced by SHGetFolderPathAndSubDirW().

◆ _SHGetDefaultValue()

static HRESULT _SHGetDefaultValue ( BYTE  folder,
LPWSTR  pszPath 
)
static

Definition at line 1776 of file shellpath.c.

1780 {
1781  HRESULT hr;
1782  WCHAR resourcePath[MAX_PATH];
1783 #ifdef __REACTOS__
1784  NT_PRODUCT_TYPE ProductType;
1785 #endif
1786 
1787  TRACE("0x%02x,%p\n", folder, pszPath);
1788 
1789  if (folder >= ARRAY_SIZE(CSIDL_Data))
1790  return E_INVALIDARG;
1791 
1792  if (!pszPath)
1793  return E_INVALIDARG;
1794 
1795 #ifdef __REACTOS__
1796  if (hToken != NULL && hToken != (HANDLE)-1)
1797  {
1798  FIXME("unsupported for user other than current or default\n");
1799  }
1800 #endif
1801 
1802  if (!is_win64)
1803  {
1804  BOOL is_wow64;
1805 
1806  switch (folder)
1807  {
1808  case CSIDL_PROGRAM_FILES:
1812  break;
1817  break;
1818  }
1819  }
1820 
1821  switch (CSIDL_Data[folder].type)
1822  {
1823  case CSIDL_Type_User:
1824  strcpyW(pszPath, L"%USERPROFILE%");
1825  break;
1826 #ifdef __REACTOS__
1827  case CSIDL_Type_InMyDocuments:
1828  strcpyW(pszPath, L"%USERPROFILE%");
1829  if (DoGetProductType(&ProductType) && ProductType == NtProductWinNt)
1830  {
1831  if (IS_INTRESOURCE(CSIDL_Data[CSIDL_MYDOCUMENTS].szDefaultPath))
1832  {
1833  WCHAR szItem[MAX_PATH];
1835  LOWORD(CSIDL_Data[CSIDL_MYDOCUMENTS].szDefaultPath),
1836  szItem, ARRAY_SIZE(szItem));
1837  PathAppendW(pszPath, szItem);
1838  }
1839  else
1840  {
1841  PathAppendW(pszPath, CSIDL_Data[CSIDL_MYDOCUMENTS].szDefaultPath);
1842  }
1843  }
1844  break;
1845 #endif
1846  case CSIDL_Type_AllUsers:
1847 #ifndef __REACTOS__
1848  strcpyW(pszPath, L"%PUBLIC%");
1849 #else
1850  strcpyW(pszPath, L"%ALLUSERSPROFILE%");
1851 #endif
1852  break;
1853  case CSIDL_Type_CurrVer:
1854  strcpyW(pszPath, L"%SystemDrive%");
1855  break;
1856  default:
1857  ; /* no corresponding env. var, do nothing */
1858  }
1859 
1860  hr = S_OK;
1861  if (CSIDL_Data[folder].szDefaultPath)
1862  {
1863  if (IS_INTRESOURCE(CSIDL_Data[folder].szDefaultPath))
1864  {
1866  LOWORD(CSIDL_Data[folder].szDefaultPath), resourcePath, MAX_PATH))
1867  {
1868  PathAppendW(pszPath, resourcePath);
1869  }
1870  else
1871  {
1872  ERR("(%d,%s), LoadString failed, missing translation?\n", folder,
1873  debugstr_w(pszPath));
1874  hr = E_FAIL;
1875  }
1876  }
1877  else
1878  {
1879  PathAppendW(pszPath, CSIDL_Data[folder].szDefaultPath);
1880  }
1881  }
1882  TRACE("returning 0x%08x\n", hr);
1883  return hr;
1884 }
Definition: fci.c:115
BOOL is_wow64
Definition: msi.c:54
HRESULT hr
Definition: shlfolder.c:183
static const CSIDL_DATA CSIDL_Data[]
Definition: shellpath.c:870
#define CSIDL_PROGRAM_FILES
Definition: shlobj.h:2049
#define E_FAIL
Definition: ddrawi.h:102
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
BOOL WINAPI PathAppendW(LPWSTR lpszPath, LPCWSTR lpszAppend)
Definition: path.c:126
#define CSIDL_PROGRAM_FILESX86
Definition: shlobj.h:2053
#define CSIDL_MYDOCUMENTS
Definition: shlobj.h:2024
#define L(x)
Definition: ntvdm.h:50
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_INVALIDARG
Definition: ddrawi.h:101
static const BOOL is_win64
Definition: shellpath.c:58
BOOL WINAPI IsWow64Process(IN HANDLE hProcess, OUT PBOOL Wow64Process)
Definition: proc.c:1975
#define TRACE(s)
Definition: solgame.cpp:4
#define IS_INTRESOURCE(i)
Definition: winuser.h:580
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
#define MAX_PATH
Definition: compat.h:34
#define GetCurrentProcess()
Definition: compat.h:618
#define CSIDL_PROGRAM_FILES_COMMONX86
Definition: shlobj.h:2055
#define CSIDL_PROGRAM_FILES_COMMON
Definition: shlobj.h:2054
#define ERR(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:52
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
#define shell32_hInstance
#define ARRAY_SIZE(a)
Definition: main.h:24
#define NULL
Definition: types.h:112
enum _NT_PRODUCT_TYPE NT_PRODUCT_TYPE
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define LOWORD(l)
Definition: pedump.c:82

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

◆ _SHGetProfilesValue()

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

Definition at line 2146 of file shellpath.c.

2148 {
2149  HRESULT hr;
2150  DWORD type, dwPathLen = MAX_PATH * sizeof(WCHAR);
2151  LONG lRet;
2152 
2153  TRACE("%p,%s,%p,%s\n", profilesKey, debugstr_w(szValueName), szValue,
2154  debugstr_w(szDefault));
2155  lRet = RegQueryValueExW(profilesKey, szValueName, NULL, &type,
2156  (LPBYTE)szValue, &dwPathLen);
2157  if (!lRet && (type == REG_SZ || type == REG_EXPAND_SZ) && dwPathLen
2158  && *szValue)
2159  {
2160  dwPathLen /= sizeof(WCHAR);
2161  szValue[dwPathLen] = '\0';
2162  hr = S_OK;
2163  }
2164  else
2165  {
2166  /* Missing or invalid value, set a default */
2167  lstrcpynW(szValue, szDefault, MAX_PATH);
2168  TRACE("Setting missing value %s to %s\n", debugstr_w(szValueName),
2169  debugstr_w(szValue));
2170  lRet = RegSetValueExW(profilesKey, szValueName, 0, REG_EXPAND_SZ,
2171  (LPBYTE)szValue,
2172  (strlenW(szValue) + 1) * sizeof(WCHAR));
2173  if (lRet)
2174  hr = HRESULT_FROM_WIN32(lRet);
2175  else
2176  hr = S_OK;
2177  }
2178  TRACE("returning 0x%08x (output value is %s)\n", hr, debugstr_w(szValue));
2179  return hr;
2180 }
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
HRESULT hr
Definition: shlfolder.c:183
#define lstrcpynW
Definition: compat.h:597
unsigned char * LPBYTE
Definition: typedefs.h:53
long LONG
Definition: pedump.c:60
#define debugstr_w
Definition: kernel32.h:32
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:4899
#define TRACE(s)
Definition: solgame.cpp:4
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4120
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
#define S_OK
Definition: intsafe.h:52
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
#define NULL
Definition: types.h:112
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define REG_SZ
Definition: layer.c:22

Referenced by _SHExpandEnvironmentStrings().

◆ _SHGetUserProfileDirectoryW()

BOOL _SHGetUserProfileDirectoryW ( HANDLE  hToken,
LPWSTR  szPath,
LPDWORD  lpcchPath 
)

Definition at line 1740 of file shellpath.c.

1741 {
1742  BOOL result;
1743  if (!hToken)
1744  {
1746  result = GetUserProfileDirectoryW(hToken, szPath, lpcchPath);
1747  CloseHandle(hToken);
1748  }
1749  else if ((INT) hToken == -1)
1750  {
1752  }
1753  else
1754  {
1755  result = GetUserProfileDirectoryW(hToken, szPath, lpcchPath);
1756  }
1757  TRACE("_SHGetUserProfileDirectoryW returning %S\n", szPath);
1758  return result;
1759 }
BOOL WINAPI GetDefaultUserProfileDirectoryW(_Out_opt_ LPWSTR lpProfileDir, _Inout_ LPDWORD lpcchSize)
Definition: profile.c:1443
#define CloseHandle
Definition: compat.h:598
GLuint64EXT * result
Definition: glext.h:11304
BOOL WINAPI GetUserProfileDirectoryW(_In_ HANDLE hToken, _Out_opt_ LPWSTR lpProfileDir, _Inout_ LPDWORD lpcchSize)
Definition: profile.c:1792
int32_t INT
Definition: typedefs.h:58
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TRACE(s)
Definition: solgame.cpp:4
#define TOKEN_QUERY
Definition: setypes.h:924
#define GetCurrentProcess()
Definition: compat.h:618
LPCWSTR szPath
Definition: env.c:37
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:296

Referenced by _SHExpandEnvironmentStrings().

◆ _SHGetUserProfilePath()

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

Definition at line 2002 of file shellpath.c.

2004 {
2005  const WCHAR *szValueName;
2006  WCHAR buffer[40];
2007  HRESULT hr;
2008 
2009  TRACE("%p,0x%08x,0x%02x,%p\n", hToken, dwFlags, folder, pszPath);
2010 
2011  if (folder >= ARRAY_SIZE(CSIDL_Data))
2012  return E_INVALIDARG;
2013 #ifdef __REACTOS__
2015  CSIDL_Data[folder].type != CSIDL_Type_InMyDocuments)
2016 #else
2018 #endif
2019  {
2020  return E_INVALIDARG;
2021  }
2022  if (!pszPath)
2023  return E_INVALIDARG;
2024 
2026  {
2027 #ifndef __REACTOS__
2028  hr = _SHGetDefaultValue(folder, pszPath);
2029 #else
2030  hr = _SHGetDefaultValue(hToken, folder, pszPath);
2031 #endif
2032  }
2033  else
2034  {
2035  static const WCHAR DefaultW[] = L".Default";
2036  LPCWSTR userPrefix = NULL;
2037  HKEY hRootKey;
2038 
2039  if (hToken == (HANDLE)-1)
2040  {
2041  hRootKey = HKEY_USERS;
2042  userPrefix = DefaultW;
2043  }
2044  else if (hToken == NULL)
2045  hRootKey = HKEY_CURRENT_USER;
2046  else
2047  {
2048  hRootKey = HKEY_USERS;
2049  userPrefix = _GetUserSidStringFromToken(hToken);
2050  if (userPrefix == NULL)
2051  {
2052  hr = E_FAIL;
2053  goto error;
2054  }
2055  }
2056 
2057  /* For CSIDL_Type_User we also use the GUID if no szValueName is provided */
2058  szValueName = CSIDL_Data[folder].szValueName;
2059  if (!szValueName)
2060  {
2062  szValueName = &buffer[0];
2063  }
2064 
2065 #ifndef __REACTOS__
2066  hr = _SHGetUserShellFolderPath(hRootKey, userPrefix, szValueName, pszPath);
2067  if (FAILED(hr) && hRootKey != HKEY_LOCAL_MACHINE)
2068  hr = _SHGetUserShellFolderPath(HKEY_LOCAL_MACHINE, NULL, szValueName, pszPath);
2069  if (FAILED(hr))
2070  hr = _SHGetDefaultValue(folder, pszPath);
2071 #else
2072  hr = _SHGetUserShellFolderPath(hRootKey, hToken, userPrefix, szValueName, pszPath);
2073  if (FAILED(hr) && hRootKey != HKEY_LOCAL_MACHINE)
2074  hr = _SHGetUserShellFolderPath(HKEY_LOCAL_MACHINE, hToken, NULL, szValueName, pszPath);
2075  if (FAILED(hr))
2076  hr = _SHGetDefaultValue(hToken, folder, pszPath);
2077 #endif
2078  if (userPrefix != NULL && userPrefix != DefaultW)
2079  LocalFree((HLOCAL) userPrefix);
2080  }
2081 error:
2082  TRACE("returning 0x%08x (output path is %s)\n", hr, debugstr_w(pszPath));
2083  return hr;
2084 }
#define HKEY_USERS
Definition: winreg.h:13
Definition: fci.c:115
HRESULT hr
Definition: shlfolder.c:183
#define error(str)
Definition: mkdosfs.c:1605
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define HKEY_CURRENT_USER
Definition: winreg.h:11
static const CSIDL_DATA CSIDL_Data[]
Definition: shellpath.c:870
GLuint buffer
Definition: glext.h:5915
#define E_FAIL
Definition: ddrawi.h:102
#define L(x)
Definition: ntvdm.h:50
#define debugstr_w
Definition: kernel32.h:32
#define E_INVALIDARG
Definition: ddrawi.h:101
struct CFFOLDER folder
Definition: fdi.c:102
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2434
static HRESULT _SHGetDefaultValue(BYTE folder, LPWSTR pszPath)
Definition: shellpath.c:1776
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define ARRAY_SIZE(a)
Definition: main.h:24
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
static LPWSTR _GetUserSidStringFromToken(HANDLE Token)
Definition: shellpath.c:1961
#define NULL
Definition: types.h:112
LPCWSTR szValueName
Definition: shellpath.c:865
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static HRESULT _SHGetUserShellFolderPath(HKEY rootKey, LPCWSTR userPrefix, LPCWSTR value, LPWSTR path)
Definition: shellpath.c:1657
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by _SHRegisterFolders(), and SHGetFolderPathAndSubDirW().

◆ _SHGetUserShellFolderPath()

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

Definition at line 1657 of file shellpath.c.

1662 {
1663  HRESULT hr;
1664  WCHAR shellFolderPath[MAX_PATH], userShellFolderPath[MAX_PATH];
1665  LPCWSTR pShellFolderPath, pUserShellFolderPath;
1666  HKEY userShellFolderKey, shellFolderKey;
1667  DWORD dwType, dwPathLen;
1668 
1669  TRACE("%p,%s,%s,%p\n",rootKey, debugstr_w(userPrefix), debugstr_w(value),
1670  path);
1671 
1672  if (userPrefix)
1673  {
1674  strcpyW(shellFolderPath, userPrefix);
1675  PathAddBackslashW(shellFolderPath);
1676  strcatW(shellFolderPath, szSHFolders);
1677  pShellFolderPath = shellFolderPath;
1678  strcpyW(userShellFolderPath, userPrefix);
1679  PathAddBackslashW(userShellFolderPath);
1680  strcatW(userShellFolderPath, szSHUserFolders);
1681  pUserShellFolderPath = userShellFolderPath;
1682  }
1683  else
1684  {
1685  pUserShellFolderPath = szSHUserFolders;
1686  pShellFolderPath = szSHFolders;
1687  }
1688 
1689  if (RegCreateKeyW(rootKey, pShellFolderPath, &shellFolderKey))
1690  {
1691  TRACE("Failed to create %s\n", debugstr_w(pShellFolderPath));
1692  return E_FAIL;
1693  }
1694  if (RegCreateKeyW(rootKey, pUserShellFolderPath, &userShellFolderKey))
1695  {
1696  TRACE("Failed to create %s\n",
1697  debugstr_w(pUserShellFolderPath));
1698  RegCloseKey(shellFolderKey);
1699  return E_FAIL;
1700  }
1701 
1702  dwPathLen = MAX_PATH * sizeof(WCHAR);
1703  if (!RegQueryValueExW(userShellFolderKey, value, NULL, &dwType,
1704  (LPBYTE)path, &dwPathLen) && (dwType == REG_EXPAND_SZ || dwType == REG_SZ))
1705  {
1706  LONG ret;
1707 
1708  path[dwPathLen / sizeof(WCHAR)] = '\0';
1709  if (dwType == REG_EXPAND_SZ && path[0] == '%')
1710  {
1711  WCHAR szTemp[MAX_PATH];
1712 
1713 #ifndef __REACTOS__
1715 #else
1716  hr = _SHExpandEnvironmentStrings(hToken, path, szTemp, _countof(szTemp));
1717  if (FAILED(hr))
1718  goto end;
1719 #endif
1720  lstrcpynW(path, szTemp, MAX_PATH);
1721  }
1722  ret = RegSetValueExW(shellFolderKey, value, 0, REG_SZ, (LPBYTE)path,
1723  (strlenW(path) + 1) * sizeof(WCHAR));
1724  if (ret != ERROR_SUCCESS)
1726  else
1727  hr = S_OK;
1728  }
1729  else
1730  hr = E_FAIL;
1731 #ifdef __REACTOS__
1732 end:
1733 #endif
1734  RegCloseKey(shellFolderKey);
1735  RegCloseKey(userShellFolderKey);
1736  TRACE("returning 0x%08x\n", hr);
1737  return hr;
1738 }
Definition: pdh_main.c:93
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define ERROR_SUCCESS
Definition: deptool.c:10
HRESULT hr
Definition: shlfolder.c:183
static HRESULT _SHExpandEnvironmentStrings(LPCWSTR szSrc, LPWSTR szDest)
Definition: shellpath.c:2196
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define E_FAIL
Definition: ddrawi.h:102
#define lstrcpynW
Definition: compat.h:597
static const WCHAR szSHUserFolders[]
Definition: shellpath.c:831
unsigned char * LPBYTE
Definition: typedefs.h:53
LPWSTR WINAPI PathAddBackslashW(LPWSTR lpszPath)
Definition: path.c:294
long LONG
Definition: pedump.c:60
#define debugstr_w
Definition: kernel32.h:32
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:4899
#define TRACE(s)
Definition: solgame.cpp:4
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4120
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint end
Definition: gl.h:1545
int ret
LONG WINAPI RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1199
#define S_OK
Definition: intsafe.h:52
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
WINE_UNICODE_INLINE WCHAR * strcatW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:242
#define NULL
Definition: types.h:112
static const WCHAR szSHFolders[]
Definition: shellpath.c:830
#define RegCloseKey(hKey)
Definition: registry.h:47
#define REG_SZ
Definition: layer.c:22

Referenced by _SHGetAllUsersProfilePath(), and _SHGetUserProfilePath().

◆ _SHOpenProfilesKey()

static HRESULT _SHOpenProfilesKey ( PHKEY  pKey)
static

Definition at line 2131 of file shellpath.c.

2132 {
2133  LONG lRet;
2134  DWORD disp;
2135 
2136  lRet = RegCreateKeyExW(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList", 0, NULL, 0,
2137  KEY_ALL_ACCESS, NULL, pKey, &disp);
2138  return HRESULT_FROM_WIN32(lRet);
2139 }
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
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:1091
#define L(x)
Definition: ntvdm.h:50
long LONG
Definition: pedump.c:60
unsigned long DWORD
Definition: ntddk_ex.h:95
FxRegKey * pKey
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define NULL
Definition: types.h:112
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by _SHExpandEnvironmentStrings().

◆ _SHRegisterCommonShellFolders()

static HRESULT _SHRegisterCommonShellFolders ( void  )
static

Definition at line 2795 of file shellpath.c.

2796 {
2797  static const UINT folders[] = {
2810  };
2811  HRESULT hr;
2812 
2813  TRACE("\n");
2815  szSHFolders, folders, ARRAY_SIZE(folders));
2816  TRACE("returning 0x%08x\n", hr);
2817  return hr;
2818 }
HRESULT hr
Definition: shlfolder.c:183
#define CSIDL_COMMON_DESKTOPDIRECTORY
Definition: shlobj.h:2036
#define CSIDL_COMMON_FAVORITES
Definition: shlobj.h:2042
static HRESULT _SHRegisterFolders(HKEY hRootKey, HANDLE hToken, LPCWSTR szUserShellFolderPath, LPCWSTR szShellFolderPath, const UINT folders[], UINT foldersLen)
Definition: shellpath.c:2625
#define CSIDL_COMMON_STARTUP
Definition: shlobj.h:2035
#define CSIDL_COMMON_PICTURES
Definition: shlobj.h:2062
#define CSIDL_COMMON_TEMPLATES
Definition: shlobj.h:2056
static const WCHAR szSHUserFolders[]
Definition: shellpath.c:831
#define CSIDL_COMMON_PROGRAMS
Definition: shlobj.h:2034
#define CSIDL_COMMON_STARTMENU
Definition: shlobj.h:2033
#define CSIDL_COMMON_ADMINTOOLS
Definition: shlobj.h:2058
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
#define CSIDL_COMMON_VIDEO
Definition: shlobj.h:2063
#define CSIDL_COMMON_APPDATA
Definition: shlobj.h:2046
#define CSIDL_COMMON_MUSIC
Definition: shlobj.h:2061
#define ARRAY_SIZE(a)
Definition: main.h:24
#define CSIDL_COMMON_DOCUMENTS
Definition: shlobj.h:2057
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
static const WCHAR szSHFolders[]
Definition: shellpath.c:830
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

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 2625 of file shellpath.c.

2628 {
2629  const WCHAR *szValueName;
2630  WCHAR buffer[40];
2631  UINT i;
2632  WCHAR path[MAX_PATH];
2633  HRESULT hr = S_OK;
2634  HKEY hUserKey = NULL, hKey = NULL;
2635  DWORD dwType, dwPathLen;
2636  LONG ret;
2637 
2638  TRACE("%p,%p,%s,%p,%u\n", hRootKey, hToken,
2639  debugstr_w(szUserShellFolderPath), folders, foldersLen);
2640 
2641  ret = RegCreateKeyW(hRootKey, szUserShellFolderPath, &hUserKey);
2642  if (ret)
2644  else
2645  {
2646  ret = RegCreateKeyW(hRootKey, szShellFolderPath, &hKey);
2647  if (ret)
2649  }
2650  for (i = 0; SUCCEEDED(hr) && i < foldersLen; i++)
2651  {
2652  dwPathLen = MAX_PATH * sizeof(WCHAR);
2653 
2654  /* For CSIDL_Type_User we also use the GUID if no szValueName is provided */
2655  szValueName = CSIDL_Data[folders[i]].szValueName;
2656 #ifdef __REACTOS__
2657  if (!szValueName &&
2658  (CSIDL_Data[folders[i]].type == CSIDL_Type_User ||
2659  CSIDL_Data[folders[i]].type == CSIDL_Type_InMyDocuments))
2660 #else
2661  if (!szValueName && CSIDL_Data[folders[i]].type == CSIDL_Type_User)
2662 #endif
2663  {
2664  StringFromGUID2( CSIDL_Data[folders[i]].id, buffer, 39 );
2665  szValueName = &buffer[0];
2666  }
2667 
2668  if (!RegQueryValueExW(hUserKey, szValueName, NULL,
2669  &dwType, (LPBYTE)path, &dwPathLen) &&
2670  (dwType == REG_SZ || dwType == REG_EXPAND_SZ))
2671  {
2672  hr = SHGetFolderPathW(NULL, folders[i] | CSIDL_FLAG_CREATE,
2673  hToken, SHGFP_TYPE_CURRENT, path);
2674  }
2675  else
2676  {
2677  *path = '\0';
2678 #ifdef __REACTOS__
2679  if (CSIDL_Data[folders[i]].type == CSIDL_Type_User ||
2680  CSIDL_Data[folders[i]].type == CSIDL_Type_InMyDocuments)
2681 #else
2682  if (CSIDL_Data[folders[i]].type == CSIDL_Type_User)
2683 #endif
2684  _SHGetUserProfilePath(hToken, SHGFP_TYPE_CURRENT, folders[i],
2685  path);
2686  else if (CSIDL_Data[folders[i]].type == CSIDL_Type_AllUsers)
2688  else if (CSIDL_Data[folders[i]].type == CSIDL_Type_WindowsPath)
2689  {
2691  if (CSIDL_Data[folders[i]].szDefaultPath &&
2692  !IS_INTRESOURCE(CSIDL_Data[folders[i]].szDefaultPath))
2693  {
2695  strcatW(path, CSIDL_Data[folders[i]].szDefaultPath);
2696  }
2697  }
2698  else
2699  hr = E_FAIL;
2700  if (*path)
2701  {
2702  ret = RegSetValueExW(hUserKey, szValueName, 0, REG_EXPAND_SZ,
2703  (LPBYTE)path, (strlenW(path) + 1) * sizeof(WCHAR));
2704  if (ret)
2706  else
2707  {
2708  hr = SHGetFolderPathW(NULL, folders[i] | CSIDL_FLAG_CREATE,
2709  hToken, SHGFP_TYPE_CURRENT, path);
2710  ret = RegSetValueExW(hKey, szValueName, 0, REG_SZ,
2711  (LPBYTE)path, (strlenW(path) + 1) * sizeof(WCHAR));
2712  if (ret)
2714  }
2715  }
2716  }
2717  }
2718  if (hUserKey)
2719  RegCloseKey(hUserKey);
2720  if (hKey)
2721  RegCloseKey(hKey);
2722 
2723  TRACE("returning 0x%08x\n", hr);
2724  return hr;
2725 }
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
HRESULT hr
Definition: shlfolder.c:183
static const CSIDL_DATA CSIDL_Data[]
Definition: shellpath.c:870
GLuint buffer
Definition: glext.h:5915
#define E_FAIL
Definition: ddrawi.h:102
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2352
unsigned char * LPBYTE
Definition: typedefs.h:53
LPWSTR WINAPI PathAddBackslashW(LPWSTR lpszPath)
Definition: path.c:294
long LONG
Definition: pedump.c:60
if SUCCEEDED(hr)
#define debugstr_w
Definition: kernel32.h:32
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:4899
#define TRACE(s)
Definition: solgame.cpp:4
#define IS_INTRESOURCE(i)
Definition: winuser.h:580
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4120
__wchar_t WCHAR
Definition: xmlstorage.h:180
static HRESULT _SHGetUserProfilePath(HANDLE hToken, DWORD dwFlags, BYTE folder, LPWSTR pszPath)
Definition: shellpath.c:2002
LONG HRESULT
Definition: typedefs.h:79
#define MAX_PATH
Definition: compat.h:34
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2434
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
static HRESULT _SHGetAllUsersProfilePath(DWORD dwFlags, BYTE folder, LPWSTR pszPath)
Definition: shellpath.c:2091
LONG WINAPI RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1199
#define S_OK
Definition: intsafe.h:52
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
FxAutoRegKey hKey
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
WINE_UNICODE_INLINE WCHAR * strcatW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:242
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define CSIDL_FLAG_CREATE
HRESULT WINAPI SHGetFolderPathW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath)
Definition: shellpath.c:2348
LPCWSTR szValueName
Definition: shellpath.c:865
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define RegCloseKey(hKey)
Definition: registry.h:47
#define REG_SZ
Definition: layer.c:22

Referenced by _SHRegisterCommonShellFolders(), and _SHRegisterUserShellFolders().

◆ _SHRegisterUserShellFolders()

static HRESULT _SHRegisterUserShellFolders ( BOOL  bDefault)
static

Definition at line 2727 of file shellpath.c.

2728 {
2729  static const UINT folders[] = {
2733  CSIDL_APPDATA,
2734  CSIDL_STARTUP,
2735  CSIDL_RECENT,
2736  CSIDL_SENDTO,
2738  CSIDL_MYMUSIC,
2739  CSIDL_MYVIDEO,
2741  CSIDL_NETHOOD,
2746  CSIDL_COOKIES,
2747  CSIDL_HISTORY,
2749  CSIDL_FONTS,
2751 /* Cannot use #if _WIN32_WINNT >= 0x0600 because _WIN32_WINNT == 0x0600 here. */
2752 #ifndef __REACTOS__
2755  CSIDL_LINKS,
2759 #endif
2760  };
2761  WCHAR userShellFolderPath[MAX_PATH], shellFolderPath[MAX_PATH];
2762  LPCWSTR pUserShellFolderPath, pShellFolderPath;
2763  HRESULT hr = S_OK;
2764  HKEY hRootKey;
2765  HANDLE hToken;
2766 
2767  TRACE("%s\n", bDefault ? "TRUE" : "FALSE");
2768  if (bDefault)
2769  {
2770  hToken = (HANDLE)-1;
2771  hRootKey = HKEY_USERS;
2772  strcpyW(userShellFolderPath, L".Default");
2773  PathAddBackslashW(userShellFolderPath);
2774  strcatW(userShellFolderPath, szSHUserFolders);
2775  pUserShellFolderPath = userShellFolderPath;
2776  strcpyW(shellFolderPath, L".Default");
2777  PathAddBackslashW(shellFolderPath);
2778  strcatW(shellFolderPath, szSHFolders);
2779  pShellFolderPath = shellFolderPath;
2780  }
2781  else
2782  {
2783  hToken = NULL;
2784  hRootKey = HKEY_CURRENT_USER;
2785  pUserShellFolderPath = szSHUserFolders;
2786  pShellFolderPath = szSHFolders;
2787  }
2788 
2789  hr = _SHRegisterFolders(hRootKey, hToken, pUserShellFolderPath,
2790  pShellFolderPath, folders, ARRAY_SIZE(folders));
2791  TRACE("returning 0x%08x\n", hr);
2792  return hr;
2793 }
#define HKEY_USERS
Definition: winreg.h:13
#define CSIDL_COOKIES
Definition: shlobj.h:2044
#define CSIDL_MYVIDEO
Definition: shlobj.h:2026
HRESULT hr
Definition: shlfolder.c:183
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define CSIDL_MYPICTURES
Definition: shlobj.h:2050
#define CSIDL_CONTACTS
Definition: shellpath.c:853
#define HKEY_CURRENT_USER
Definition: winreg.h:11
static HRESULT _SHRegisterFolders(HKEY hRootKey, HANDLE hToken, LPCWSTR szUserShellFolderPath, LPCWSTR szShellFolderPath, const UINT folders[], UINT foldersLen)
Definition: shellpath.c:2625
#define CSIDL_HISTORY
Definition: shlobj.h:2045
#define CSIDL_FONTS
Definition: shlobj.h:2031
#define CSIDL_INTERNET_CACHE
Definition: shlobj.h:2043
static const WCHAR szSHUserFolders[]
Definition: shellpath.c:831
#define CSIDL_RECENT
Definition: shlobj.h:2020
#define L(x)
Definition: ntvdm.h:50
#define CSIDL_FAVORITES
Definition: shlobj.h:2018
LPWSTR WINAPI PathAddBackslashW(LPWSTR lpszPath)
Definition: path.c:294
#define CSIDL_SEARCHES
Definition: shellpath.c:858
#define TRACE(s)
Definition: solgame.cpp:4
#define CSIDL_ADMINTOOLS
Definition: shlobj.h:2059
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
#define CSIDL_LOCAL_APPDATA
Definition: shlobj.h:2039
#define CSIDL_SENDTO
Definition: shlobj.h:2021
#define CSIDL_APPDATA
Definition: shlobj.h:2037
#define MAX_PATH
Definition: compat.h:34
static HANDLE
Definition: shellpath.c:88
#define CSIDL_STARTUP
Definition: shlobj.h:2019
#define CSIDL_LINKS
Definition: shellpath.c:855
#define CSIDL_APPDATA_LOCALLOW
Definition: shellpath.c:856
#define S_OK
Definition: intsafe.h:52
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
#define CSIDL_DOWNLOADS
Definition: shellpath.c:854
#define ARRAY_SIZE(a)
Definition: main.h:24
#define CSIDL_PRINTHOOD
Definition: shlobj.h:2038
WINE_UNICODE_INLINE WCHAR * strcatW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:242
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define CSIDL_SAVED_GAMES
Definition: shellpath.c:857
#define CSIDL_NETHOOD
Definition: shlobj.h:2030
static const WCHAR szSHFolders[]
Definition: shellpath.c:830
#define CSIDL_PERSONAL
Definition: shlobj.h:2017
#define CSIDL_STARTMENU
Definition: shlobj.h:2023
#define CSIDL_DESKTOPDIRECTORY
Definition: shlobj.h:2027
#define CSIDL_PROGRAMS
Definition: shlobj.h:2014
#define CSIDL_TEMPLATES
Definition: shlobj.h:2032
#define CSIDL_MYMUSIC
Definition: shlobj.h:2025

Referenced by SHELL_RegisterShellFolders().

◆ GetShortPathNameAbsentW()

static DWORD GetShortPathNameAbsentW ( LPCWSTR  pszLong,
LPWSTR  pszShort,
DWORD  cchShort 
)
static

Definition at line 151 of file shellpath.c.

152 {
153  FIXME("GetShortPathNameAbsentW(%ls, %p, %ld): stub\n", pszLong, pszShort, cchShort);
154  StringCchCopyW(pszShort, cchShort, pszLong);
155  return lstrlenW(pszShort);
156 }
#define lstrlenW
Definition: compat.h:609
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
#define FIXME(fmt,...)
Definition: debug.h:111

Referenced by PathQualifyExW().

◆ IsLFNDriveA()

BOOL WINAPI IsLFNDriveA ( LPCSTR  lpszPath)

Definition at line 408 of file shellpath.c.

409 {
410  DWORD fnlen;
411 
412  if (!GetVolumeInformationA(lpszPath, NULL, 0, NULL, &fnlen, NULL, NULL, 0))
413  return FALSE;
414  return fnlen > 12;
415 }
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
#define FALSE
Definition: types.h:117
unsigned long DWORD
Definition: ntddk_ex.h:95
#define NULL
Definition: types.h:112

Referenced by IsLFNDriveAW().

◆ IsLFNDriveAW()

BOOL WINAPI IsLFNDriveAW ( LPCVOID  lpszPath)

Definition at line 432 of file shellpath.c.

433 {
434  if (SHELL_OsIsUnicode())
435  return IsLFNDriveW(lpszPath);
436  return IsLFNDriveA(lpszPath);
437 }
static __inline BOOL SHELL_OsIsUnicode(void)
Definition: shell32_main.h:130
BOOL WINAPI IsLFNDriveW(LPCWSTR lpszPath)
Definition: shellpath.c:420
BOOL WINAPI IsLFNDriveA(LPCSTR lpszPath)
Definition: shellpath.c:408

◆ IsLFNDriveW()

BOOL WINAPI IsLFNDriveW ( LPCWSTR  lpszPath)

Definition at line 420 of file shellpath.c.

421 {
422  DWORD fnlen;
423 
424  if (!GetVolumeInformationW(lpszPath, NULL, 0, NULL, &fnlen, NULL, NULL, 0))
425  return FALSE;
426  return fnlen > 12;
427 }
#define FALSE
Definition: types.h:117
unsigned long DWORD
Definition: ntddk_ex.h:95
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
#define NULL
Definition: types.h:112

Referenced by IsLFNDriveAW(), and PathQualifyExW().

◆ PathAppendAW()

BOOL WINAPI PathAppendAW ( LPVOID  lpszPath1,
LPCVOID  lpszPath2 
)

Definition at line 238 of file shellpath.c.

241 {
242  if (SHELL_OsIsUnicode())
243  return PathAppendW(lpszPath1, lpszPath2);
244  return PathAppendA(lpszPath1, lpszPath2);
245 }
BOOL WINAPI PathAppendA(LPSTR lpszPath, LPCSTR lpszAppend)
Definition: path.c:106
static __inline BOOL SHELL_OsIsUnicode(void)
Definition: shell32_main.h:130
BOOL WINAPI PathAppendW(LPWSTR lpszPath, LPCWSTR lpszAppend)
Definition: path.c:126

◆ PathCleanupSpec()

int WINAPI PathCleanupSpec ( LPCWSTR  lpszPathW,
LPWSTR  lpszFileW 
)

Definition at line 529 of file shellpath.c.

530 {
531  int i = 0;
532  DWORD rc = 0;
533  int length = 0;
534 
535  if (SHELL_OsIsUnicode())
536  {
537  LPWSTR p = lpszFileW;
538 
539  TRACE("Cleanup %s\n",debugstr_w(lpszFileW));
540 
541  if (lpszPathW)
542  length = strlenW(lpszPathW);
543 
544  while (*p)
545  {
546  int gct = PathGetCharTypeW(*p);
547  if (gct == GCT_INVALID || gct == GCT_WILD || gct == GCT_SEPARATOR)
548  {
549  lpszFileW[i]='-';
550  rc |= PCS_REPLACEDCHAR;
551  }
552  else
553  lpszFileW[i]=*p;
554  i++;
555  p++;
556  if (length + i == MAX_PATH)
557  {
558  rc |= PCS_FATAL | PCS_PATHTOOLONG;
559  break;
560  }
561  }
562  lpszFileW[i]=0;
563  }
564  else
565  {
566  LPSTR lpszFileA = (LPSTR)lpszFileW;
567  LPCSTR lpszPathA = (LPCSTR)lpszPathW;
568  LPSTR p = lpszFileA;
569 
570  TRACE("Cleanup %s\n",debugstr_a(lpszFileA));
571 
572  if (lpszPathA)
573  length = strlen(lpszPathA);
574 
575  while (*p)
576  {
577  int gct = PathGetCharTypeA(*p);
578  if (gct == GCT_INVALID || gct == GCT_WILD || gct == GCT_SEPARATOR)
579  {
580  lpszFileA[i]='-';
581  rc |= PCS_REPLACEDCHAR;
582  }
583  else
584  lpszFileA[i]=*p;
585  i++;
586  p++;
587  if (length + i == MAX_PATH)
588  {
589  rc |= PCS_FATAL | PCS_PATHTOOLONG;
590  break;
591  }
592  }
593  lpszFileA[i]=0;
594  }
595  return rc;
596 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
UINT WINAPI PathGetCharTypeW(WCHAR ch)
Definition: path.c:3035
static __inline BOOL SHELL_OsIsUnicode(void)
Definition: shell32_main.h:130
static LPSTR
Definition: shellpath.c:88
char * LPSTR
Definition: xmlstorage.h:182
#define PCS_FATAL
Definition: shlobj.h:331
#define PCS_PATHTOOLONG
Definition: shlobj.h:335
#define GCT_WILD
Definition: shlwapi.h:778
#define GCT_INVALID
Definition: shlwapi.h:775
#define debugstr_w
Definition: kernel32.h:32
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
const char * LPCSTR
Definition: xmlstorage.h:183
UINT WINAPI PathGetCharTypeA(UCHAR ch)
Definition: path.c:3025
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
#define MAX_PATH
Definition: compat.h:34
#define GCT_SEPARATOR
Definition: shlwapi.h:779
unsigned long DWORD
Definition: ntddk_ex.h:95
#define PCS_REPLACEDCHAR
Definition: shlobj.h:332
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
GLfloat GLfloat p
Definition: glext.h:8902
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ PathFileExistsAW()

BOOL WINAPI PathFileExistsAW ( LPCVOID  lpszPath)

Definition at line 398 of file shellpath.c.

399 {
400  if (SHELL_OsIsUnicode())
401  return PathFileExistsW (lpszPath);
402  return PathFileExistsA (lpszPath);
403 }
BOOL WINAPI PathFileExistsA(LPCSTR lpszPath)
Definition: path.c:1754
static __inline BOOL SHELL_OsIsUnicode(void)
Definition: shell32_main.h:130
BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath)
Definition: path.c:1776

◆ PathGetExtensionA()

static LPSTR PathGetExtensionA ( LPCSTR  lpszPath)
static

Definition at line 254 of file shellpath.c.

255 {
256  TRACE("(%s)\n",lpszPath);
257 
258  lpszPath = PathFindExtensionA(lpszPath);
259  return (LPSTR)(*lpszPath?(lpszPath+1):lpszPath);
260 }
char * LPSTR
Definition: xmlstorage.h:182
#define TRACE(s)
Definition: solgame.cpp:4
LPSTR WINAPI PathFindExtensionA(LPCSTR lpszPath)
Definition: path.c:422

Referenced by PathIsExeA().

◆ PathGetExtensionW()

static LPWSTR PathGetExtensionW ( LPCWSTR  lpszPath)
static

Definition at line 265 of file shellpath.c.

266 {
267  TRACE("(%s)\n",debugstr_w(lpszPath));
268 
269  lpszPath = PathFindExtensionW(lpszPath);
270  return (LPWSTR)(*lpszPath?(lpszPath+1):lpszPath);
271 }
#define debugstr_w
Definition: kernel32.h:32
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
Definition: path.c:447
#define TRACE(s)
Definition: solgame.cpp:4
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by PathIsExeW(), and SHPathGetExtensionW().

◆ PathGetShortPathA()

static void PathGetShortPathA ( LPSTR  pszPath)
static

Definition at line 298 of file shellpath.c.

299 {
300  CHAR path[MAX_PATH];
301 
302  TRACE("%s\n", pszPath);
303 
304  if (GetShortPathNameA(pszPath, path, MAX_PATH))
305  {
306  lstrcpyA(pszPath, path);
307  }
308 }
char CHAR
Definition: xmlstorage.h:175
#define TRACE(s)
Definition: solgame.cpp:4
DWORD WINAPI GetShortPathNameA(IN LPCSTR lpszLongPath, OUT LPSTR lpszShortPath, IN DWORD cchBuffer)
Definition: path.c:1752
#define MAX_PATH
Definition: compat.h:34
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100

Referenced by PathGetShortPathAW().

◆ PathGetShortPathAW()

VOID WINAPI PathGetShortPathAW ( LPVOID  pszPath)

Definition at line 328 of file shellpath.c.

329 {
330  if(SHELL_OsIsUnicode())
331  PathGetShortPathW(pszPath);
332  PathGetShortPathA(pszPath);
333 }
static __inline BOOL SHELL_OsIsUnicode(void)
Definition: shell32_main.h:130
static void PathGetShortPathW(LPWSTR pszPath)
Definition: shellpath.c:313
static void PathGetShortPathA(LPSTR pszPath)
Definition: shellpath.c:298

◆ PathGetShortPathW()

static void PathGetShortPathW ( LPWSTR  pszPath)
static

Definition at line 313 of file shellpath.c.

314 {
316 
317  TRACE("%s\n", debugstr_w(pszPath));
318 
319  if (GetShortPathNameW(pszPath, path, MAX_PATH))
320  {
321  lstrcpyW(pszPath, path);
322  }
323 }
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
DWORD WINAPI GetShortPathNameW(IN LPCWSTR lpszLongPath, OUT LPWSTR lpszShortPath, IN DWORD cchBuffer)
Definition: path.c:1833
#define MAX_PATH
Definition: compat.h:34
#define lstrcpyW
Definition: compat.h:608

Referenced by PathGetShortPathAW().

◆ PathIsAbsoluteW()

static BOOL WINAPI PathIsAbsoluteW ( LPCWSTR  path)
static

Definition at line 129 of file shellpath.c.

130 {
131  return PathIsUNCW(path) || (PathGetDriveNumberW(path) != -1 && path[2] == L'\\');
132 }
#define L(x)
Definition: ntvdm.h:50
int WINAPI PathGetDriveNumberW(const WCHAR *path)
Definition: path.c:553
BOOL WINAPI PathIsUNCW(LPCWSTR lpszPath)
Definition: path.c:2265

Referenced by PathResolveW().

◆ PathIsExeA()

static BOOL PathIsExeA ( LPCSTR  lpszPath)
static

Definition at line 352 of file shellpath.c.

353 {
354  LPCSTR lpszExtension = PathGetExtensionA(lpszPath);
355  int i;
356  static const char * const lpszExtensions[] =
357  {"exe", "com", "pif", "cmd", "bat", "scf", "scr", NULL };
358 
359  TRACE("path=%s\n",lpszPath);
360 
361  for(i=0; lpszExtensions[i]; i++)
362  if (!lstrcmpiA(lpszExtension,lpszExtensions[i])) return TRUE;
363 
364  return FALSE;
365 }
int WINAPI lstrcmpiA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:42
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
const char * LPCSTR
Definition: xmlstorage.h:183
#define TRACE(s)
Definition: solgame.cpp:4
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 NULL
Definition: types.h:112
static LPSTR PathGetExtensionA(LPCSTR lpszPath)
Definition: shellpath.c:254

Referenced by PathIsExeAW().

◆ PathIsExeAW()

BOOL WINAPI PathIsExeAW ( LPCVOID  path)

Definition at line 388 of file shellpath.c.

389 {
390  if (SHELL_OsIsUnicode())
391  return PathIsExeW (path);
392  return PathIsExeA(path);
393 }
static __inline BOOL SHELL_OsIsUnicode(void)
Definition: shell32_main.h:130
BOOL PathIsExeW(LPCWSTR lpszPath)
Definition: shellpath.c:370
static BOOL PathIsExeA(LPCSTR lpszPath)
Definition: shellpath.c:352

◆ PathIsExeW()

BOOL PathIsExeW ( LPCWSTR  lpszPath)

Definition at line 370 of file shellpath.c.

371 {
372  LPCWSTR lpszExtension = PathGetExtensionW(lpszPath);
373  int i;
374  static const WCHAR lpszExtensions[][4] =
375  {L"exe", L"com", L"pif", L"cmd", L"bat", L"scf", L"scr", L"" };
376 
377  TRACE("path=%s\n",debugstr_w(lpszPath));
378 
379  for(i=0; lpszExtensions[i][0]; i++)
380  if (!wcsicmp(lpszExtension,lpszExtensions[i])) return TRUE;
381 
382  return FALSE;
383 }
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define TRUE
Definition: types.h:120
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define wcsicmp
Definition: compat.h:15
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
static LPWSTR PathGetExtensionW(LPCWSTR lpszPath)
Definition: shellpath.c:265

Referenced by CFileDefExt::InitGeneralPage(), COpenWithMenu::Initialize(), PathIsExeAW(), and SHELL_execute().

◆ PathIsRootAW()

BOOL WINAPI PathIsRootAW ( LPCVOID  lpszPath)

Definition at line 342 of file shellpath.c.

343 {
344  if (SHELL_OsIsUnicode())
345  return PathIsRootW(lpszPath);
346  return PathIsRootA(lpszPath);
347 }
static __inline BOOL SHELL_OsIsUnicode(void)
Definition: shell32_main.h:130
BOOL WINAPI PathIsRootW(LPCWSTR lpszPath)
Definition: path.c:1641
BOOL WINAPI PathIsRootA(LPCSTR lpszPath)
Definition: path.c:1601

◆ PathMakeAbsoluteW()

static BOOL WINAPI PathMakeAbsoluteW ( LPWSTR  path)
static

Definition at line 135 of file shellpath.c.

136 {
138  DWORD cch;
139 
140  if (path == NULL)
141  return FALSE;
143  if (!cch || cch > _countof(path1))
144  return FALSE;
145  return (PathCombineW(path, path1, path) != NULL);
146 }
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:615
#define FALSE
Definition: types.h:117
static const WCHAR path1[]
Definition: path.c:28
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
#define NULL
Definition: types.h:112
IN PCTCH IN DWORD cch
Definition: pager.h:36
LPWSTR WINAPI PathCombineW(LPWSTR lpszDest, LPCWSTR lpszDir, LPCWSTR lpszFile)
Definition: path.c:194

Referenced by PathResolveW().

◆ PathMakeUniqueNameA()

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

Definition at line 445 of file shellpath.c.

451 {
452  FIXME("%p %u %s %s %s stub\n",
453  lpszBuffer, dwBuffSize, debugstr_a(lpszShortName),
454  debugstr_a(lpszLongName), debugstr_a(lpszPathName));
455  return TRUE;
456 }
#define TRUE
Definition: types.h:120
#define FIXME(fmt,...)
Definition: debug.h:111
#define debugstr_a
Definition: kernel32.h:31

Referenced by PathMakeUniqueNameAW().

◆ PathMakeUniqueNameAW()

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

Definition at line 477 of file shellpath.c.

483 {
484  if (SHELL_OsIsUnicode())
485  return PathMakeUniqueNameW(lpszBuffer,dwBuffSize, lpszShortName,lpszLongName,lpszPathName);
486  return PathMakeUniqueNameA(lpszBuffer,dwBuffSize, lpszShortName,lpszLongName,lpszPathName);
487 }
static BOOL PathMakeUniqueNameW(LPWSTR lpszBuffer, DWORD dwBuffSize, LPCWSTR lpszShortName, LPCWSTR lpszLongName, LPCWSTR lpszPathName)
Definition: shellpath.c:461
static __inline BOOL SHELL_OsIsUnicode(void)
Definition: shell32_main.h:130
static BOOL PathMakeUniqueNameA(LPSTR lpszBuffer, DWORD dwBuffSize, LPCSTR lpszShortName, LPCSTR lpszLongName, LPCSTR lpszPathName)
Definition: shellpath.c:445

◆ PathMakeUniqueNameW()

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

Definition at line 461 of file shellpath.c.

467 {
468  FIXME("%p %u %s %s %s stub\n",
469  lpszBuffer, dwBuffSize, debugstr_w(lpszShortName),
470  debugstr_w(lpszLongName), debugstr_w(lpszPathName));
471  return TRUE;
472 }
#define TRUE
Definition: types.h:120
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111

Referenced by PathMakeUniqueNameAW().

◆ PathProcessCommandA()

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

Definition at line 767 of file shellpath.c.

772 {
773  FIXME("%s %p 0x%04x 0x%04x stub\n",
774  lpszPath, lpszBuff, dwBuffSize, dwFlags);
775  if(!lpszPath) return -1;
776  if(lpszBuff) strcpy(lpszBuff, lpszPath);
777  return strlen(lpszPath);
778 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define FIXME(fmt,...)
Definition: debug.h:111
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388

Referenced by PathProcessCommandAW().

◆ PathProcessCommandAW()

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

Definition at line 799 of file shellpath.c.

804 {
805  if (SHELL_OsIsUnicode())
806  return PathProcessCommandW(lpszPath, lpszBuff, dwBuffSize, dwFlags);
807  return PathProcessCommandA(lpszPath, lpszBuff, dwBuffSize, dwFlags);
808 }
static LONG PathProcessCommandA(LPCSTR lpszPath, LPSTR lpszBuff, DWORD dwBuffSize, DWORD dwFlags)
Definition: shellpath.c:767
static LONG PathProcessCommandW(LPCWSTR lpszPath, LPWSTR lpszBuff, DWORD dwBuffSize, DWORD dwFlags)
Definition: shellpath.c:783
static __inline BOOL SHELL_OsIsUnicode(void)
Definition: shell32_main.h:130
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175

◆ PathProcessCommandW()

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

Definition at line 783 of file shellpath.c.

788 {
789  FIXME("(%s, %p, 0x%04x, 0x%04x) stub\n",
790  debugstr_w(lpszPath), lpszBuff, dwBuffSize, dwFlags);
791  if(!lpszPath) return -1;
792  if(lpszBuff) strcpyW(lpszBuff, lpszPath);
793  return strlenW(lpszPath);
794 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219

Referenced by PathProcessCommandAW().

◆ PathQualifyA()

VOID WINAPI PathQualifyA ( LPSTR  pszPath)

Definition at line 601 of file shellpath.c.

602 {
604  TRACE("%s\n",pszPath);
607  SHUnicodeToAnsi(szPath, pszPath, MAX_PATH);
608 }
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
DWORD WINAPI SHAnsiToUnicode(LPCSTR lpSrcStr, LPWSTR lpDstStr, int iLen)
Definition: string.c:2659
VOID WINAPI PathQualifyW(LPWSTR pszPath)
Definition: shellpath.c:613
INT WINAPI SHUnicodeToAnsi(LPCWSTR lpSrcStr, LPSTR lpDstStr, INT iLen)
Definition: string.c:2783
LPCWSTR szPath
Definition: env.c:37

Referenced by PathQualifyAW().

◆ PathQualifyAW()

VOID WINAPI PathQualifyAW ( LPVOID  pszPath)

Definition at line 622 of file shellpath.c.

623 {
624  if (SHELL_OsIsUnicode())
625  PathQualifyW(pszPath);
626  else
627  PathQualifyA(pszPath);
628 }
static __inline BOOL SHELL_OsIsUnicode(void)
Definition: shell32_main.h:130
VOID WINAPI PathQualifyW(LPWSTR pszPath)
Definition: shellpath.c:613
VOID WINAPI PathQualifyA(LPSTR pszPath)
Definition: shellpath.c:601

◆ PathQualifyExW()

static VOID WINAPI PathQualifyExW ( LPWSTR  pszPath,
LPCWSTR  pszDir,
DWORD  dwFlags 
)
static

Definition at line 161 of file shellpath.c.

162 {
163  WCHAR szRoot[MAX_PATH], szCopy[MAX_PATH], szCurDir[MAX_PATH];
164  LPWSTR pch;
165  LONG cch;
166  BOOL bCheckLFN;
167 
168  if (FAILED(StringCchCopyW(szCopy, _countof(szCopy), pszPath)))
169  return;
170 
171  FixSlashesAndColonW(szCopy);
172 
173  if (pszDir)
174  {
175  cch = GetCurrentDirectoryW(_countof(szCurDir), szCurDir);
177  pszDir = NULL;
178  }
179 
180  if (!GetFullPathNameW(szCopy, _countof(szRoot), szRoot, NULL))
181  goto Quit;
182 
183  if (PathIsUNCW(szRoot)) /* it begins with double backslash */
184  {
185  pch = StrChrW(&szRoot[2], L'\\');
186  if (pch)
187  {
188  pch = StrChrW(&pch[1], L'\\');
189  if (pch)
190  *pch = 0;
191  if (!PathAddBackslashW(szRoot))
192  goto Quit;
193  /* szRoot is like \\MyServer\MyShare\ */
194  bCheckLFN = TRUE;
195  }
196  else
197  {
198  bCheckLFN = FALSE;
199  }
200  }
201  else
202  {
203  if (!PathStripToRootW(szRoot) || !PathAddBackslashW(szRoot))
204  goto Quit;
205  /* szRoot is like X:\ */
206  bCheckLFN = TRUE;
207  }
208 
209  if (bCheckLFN && !IsLFNDriveW(szRoot)) /* not a long filename drive */
210  {
211  if (!GetFullPathNameW(szCopy, _countof(szRoot), szRoot, NULL))
212  goto Quit;
213  if (!GetShortPathNameW(szRoot, szCopy, _countof(szCopy)) &&
214  !GetShortPathNameAbsentW(szRoot, szCopy, _countof(szCopy)))
215  {
216  goto Quit;
217  }
218  }
219 
220  PathRemoveBackslashW(szCopy);
221  StringCchCopyW(pszPath, MAX_PATH, szCopy);
222 
223  if ((dwFlags & 1) == 0)
224  {
225  cch = lstrlenW(pszPath);
226  if (cch > 0 && pszPath[cch - 1] == L'.')
227  pszPath[cch - 1] = 0;
228  }
229 
230 Quit:
231  if (pszDir)
232  SetCurrentDirectoryW(szCurDir);
233 }
#define TRUE
Definition: types.h:120
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:615
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
Definition: path.c:1106
#define lstrlenW
Definition: compat.h:609
#define pch(ap)
Definition: match.c:418
VOID WINAPI FixSlashesAndColonW(LPWSTR lpwstr)
Definition: ordinal.c:4401
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
BOOL WINAPI PathStripToRootW(LPWSTR lpszPath)
Definition: path.c:733
LPWSTR WINAPI PathAddBackslashW(LPWSTR lpszPath)
Definition: path.c:294
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
BOOL WINAPI IsLFNDriveW(LPCWSTR lpszPath)
Definition: shellpath.c:420
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
DWORD WINAPI GetShortPathNameW(IN LPCWSTR lpszLongPath, OUT LPWSTR lpszShortPath, IN DWORD cchBuffer)
Definition: path.c:1833
_In_ LPCSTR pszDir
Definition: shellapi.h:582
#define MAX_PATH
Definition: compat.h:34
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
LPWSTR WINAPI PathRemoveBackslashW(LPWSTR lpszPath)
Definition: path.c:867
BOOL WINAPI SetCurrentDirectoryW(IN LPCWSTR lpPathName)
Definition: path.c:2249
LPWSTR WINAPI StrChrW(LPCWSTR lpszStr, WCHAR ch)
Definition: string.c:468
#define NULL
Definition: types.h:112
static DWORD GetShortPathNameAbsentW(LPCWSTR pszLong, LPWSTR pszShort, DWORD cchShort)
Definition: shellpath.c:151
BOOL WINAPI PathIsUNCW(LPCWSTR lpszPath)
Definition: path.c:2265
WCHAR * LPWSTR
Definition: xmlstorage.h:184
IN PCTCH IN DWORD cch
Definition: pager.h:36

Referenced by PathQualifyW(), and PathResolveW().

◆ PathQualifyW()

VOID WINAPI PathQualifyW ( LPWSTR  pszPath)

Definition at line 613 of file shellpath.c.

614 {
615  TRACE("%s\n",debugstr_w(pszPath));
616  PathQualifyExW(pszPath, NULL, 0);
617 }
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
static VOID WINAPI PathQualifyExW(LPWSTR pszPath, LPCWSTR pszDir, DWORD dwFlags)
Definition: shellpath.c:161
#define NULL
Definition: types.h:112

Referenced by PathQualifyA(), and PathQualifyAW().

◆ PathRemoveFileSpecAW()

BOOL WINAPI PathRemoveFileSpecAW ( LPVOID  lpszPath)

Definition at line 284 of file shellpath.c.

285 {
286  if (SHELL_OsIsUnicode())
287  return PathRemoveFileSpecW(lpszPath);
288  return PathRemoveFileSpecA(lpszPath);
289 }
BOOL WINAPI PathRemoveFileSpecW(LPWSTR lpszPath)
Definition: path.c:629
static __inline BOOL SHELL_OsIsUnicode(void)
Definition: shell32_main.h:130
BOOL WINAPI PathRemoveFileSpecA(LPSTR lpszPath)
Definition: path.c:586

◆ PathResolveA()

BOOL WINAPI PathResolveA ( LPSTR  path,
LPCSTR dirs,
DWORD  flags 
)

Definition at line 630 of file shellpath.c.

631 {
632  BOOL ret = FALSE;
633  LPWSTR *dirsW = NULL;
634  DWORD iDir, cDirs, cbDirs;
635  WCHAR pathW[MAX_PATH];
636 
637  TRACE("PathResolveA(%s,%p,0x%08x)\n", debugstr_a(path), dirs, flags);
638 
639  if (dirs)
640  {
641  for (cDirs = 0; dirs[cDirs]; ++cDirs)
642  ;
643 
644  cbDirs = (cDirs + 1) * sizeof(LPWSTR);
645  dirsW = SHAlloc(cbDirs);
646  if (!dirsW)
647  goto Cleanup;
648 
649  ZeroMemory(dirsW, cbDirs);
650  for (iDir = 0; iDir < cDirs; ++iDir)
651  {
652  __SHCloneStrAtoW(&dirsW[iDir], dirs[iDir]);
653  if (dirsW[iDir] == NULL)
654  goto Cleanup;
655  }
656  }
657 
658  SHAnsiToUnicode(path, pathW, _countof(pathW));
659 
660  ret = PathResolveW(pathW, (LPCWSTR*)dirsW, flags);
661  if (ret)
662  SHUnicodeToAnsi(pathW, path, MAX_PATH);
663 
664 Cleanup:
665  if (dirsW)
666  {
667  for (iDir = 0; iDir < cDirs; ++iDir)
668  {
669  SHFree(dirsW[iDir]);
670  }
671  SHFree(dirsW);
672  }
673  return ret;
674 }
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define ZeroMemory
Definition: winbase.h:1667
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI PathResolveW(LPWSTR path, LPCWSTR *dirs, DWORD flags)
Definition: shellpath.c:676
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
DWORD WINAPI SHAnsiToUnicode(LPCSTR lpSrcStr, LPWSTR lpDstStr, int iLen)
Definition: string.c:2659
unsigned long DWORD
Definition: ntddk_ex.h:95
GLbitfield flags
Definition: glext.h:7161
int ret
INT WINAPI SHUnicodeToAnsi(LPCWSTR lpSrcStr, LPSTR lpDstStr, INT iLen)
Definition: string.c:2783
static const WCHAR Cleanup[]
Definition: register.c:80
static __inline LPWSTR __SHCloneStrAtoW(WCHAR **target, const char *source)
Definition: shell32_main.h:160
#define NULL
Definition: types.h:112
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:326
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LPVOID WINAPI SHAlloc(SIZE_T len)
Definition: shellole.c:304

Referenced by PathResolveAW().

◆ PathResolveAW()

BOOL WINAPI PathResolveAW ( LPVOID  path,
LPCVOID paths,
DWORD  flags 
)

Definition at line 756 of file shellpath.c.

757 {
758  if (SHELL_OsIsUnicode())
759  return PathResolveW(path, (LPCWSTR*)paths, flags);
760  else
761  return PathResolveA(path, (LPCSTR*)paths, flags);
762 }
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
static __inline BOOL SHELL_OsIsUnicode(void)
Definition: shell32_main.h:130
BOOL WINAPI PathResolveW(LPWSTR path, LPCWSTR *dirs, DWORD flags)
Definition: shellpath.c:676
const char * LPCSTR
Definition: xmlstorage.h:183
GLbitfield flags
Definition: glext.h:7161
GLsizei const GLuint * paths
Definition: glext.h:11717
BOOL WINAPI PathResolveA(LPSTR path, LPCSTR *dirs, DWORD flags)
Definition: shellpath.c:630

◆ PathResolveW()

BOOL WINAPI PathResolveW ( LPWSTR  path,
LPCWSTR dirs,
DWORD  flags 
)

Definition at line 676 of file shellpath.c.

677 {
679 
680  TRACE("PathResolveW(%s,%p,0x%08x)\n", debugstr_w(path), dirs, flags);
681 
682  if (flags & PRF_VERIFYEXISTS)
684 
686 
687  if (PathIsRootW(path))
688  {
689  if ((path[0] == L'\\' && path[1] == 0) ||
691  {
692  if (flags & PRF_FIRSTDIRDEF)
693  PathQualifyExW(path, dirs[0], 0);
694  else
695  PathQualifyExW(path, NULL, 0);
696  }
697 
698  if (flags & PRF_VERIFYEXISTS)
700  return TRUE;
701  }
702  else if (PathIsFileSpecW(path))
703  {
704  if ((flags & PRF_TRYPROGRAMEXTENSIONS) && PathSearchOnExtensionsW(path, dirs, TRUE, dwWhich))
705  return TRUE;
706 
707  if (PathFindOnPathW(path, dirs))
708  {
709 #if (_WIN32_WINNT >= _WIN32_WINNT_VISTA)
710  if (!(flags & PRF_REQUIREABSOLUTE))
711  return TRUE;
712 
713  if (!PathIsAbsoluteW(path))
715 #else
716  return TRUE;
717 #endif
718  }
719  }
720  else if (!PathIsURLW(path))
721  {
722  if (flags & PRF_FIRSTDIRDEF)
723  PathQualifyExW(path, *dirs, 1);
724  else
725  PathQualifyExW(path, NULL, 1);
726 
727  if (flags & PRF_VERIFYEXISTS)
728  {
730  PathSearchOnExtensionsW(path, dirs, FALSE, dwWhich))
731  {
732  return TRUE;
733  }
735  {
736  return FALSE;
737  }
738  }
739 
740 #if (_WIN32_WINNT >= _WIN32_WINNT_VISTA)
742  {
743  if (!PathIsAbsoluteW(path))
745  }
746 #endif
747  return TRUE;
748  }
749 
750  return FALSE;
751 }
BOOL WINAPI PathFileExistsAndAttributesW(LPCWSTR lpszPath, DWORD *dwAttr)
Definition: path.c:1831
#define WHICH_DEFAULT
#define TRUE
Definition: types.h:120
#define PRF_FIRSTDIRDEF
Definition: PathResolve.cpp:32
#define PRF_DONTFINDLNK
Definition: PathResolve.cpp:33
#define PRF_VERIFYEXISTS
Definition: PathResolve.cpp:29
#define PRF_TRYPROGRAMEXTENSIONS
Definition: PathResolve.cpp:31
BOOL WINAPI PathIsURLW(LPCWSTR lpstrPath)
Definition: url.c:2432
static BOOL WINAPI PathIsAbsoluteW(LPCWSTR path)
Definition: shellpath.c:129
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
BOOL WINAPI PathIsUNCServerShareW(LPCWSTR lpszPath)
Definition: path.c:2377
#define debugstr_w
Definition: kernel32.h:32
#define PRF_REQUIREABSOLUTE
Definition: PathResolve.cpp:36
BOOL WINAPI PathIsFileSpecW(LPCWSTR lpszPath)
Definition: path.c:2132
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
BOOL WINAPI PathIsRootW(LPCWSTR lpszPath)
Definition: path.c:1641
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:611
GLbitfield flags
Definition: glext.h:7161
static BOOL WINAPI PathSearchOnExtensionsW(LPWSTR pszPath, LPCWSTR *ppszDirs, BOOL bDoSearch, DWORD dwWhich)
Definition: shellpath.c:116
static VOID WINAPI PathQualifyExW(LPWSTR pszPath, LPCWSTR pszDir, DWORD dwFlags)
Definition: shellpath.c:161
#define WHICH_LNK
VOID WINAPI PathUnquoteSpacesW(LPWSTR lpszPath)
Definition: path.c:1034
#define NULL
Definition: types.h:112
BOOL WINAPI PathIsUNCServerW(LPCWSTR lpszPath)
Definition: path.c:2322
static BOOL WINAPI PathMakeAbsoluteW(LPWSTR path)
Definition: shellpath.c:135
BOOL WINAPI PathFindOnPathW(LPWSTR lpszFile, LPCWSTR *lppszOtherDirs)
Definition: path.c:1402

Referenced by PathResolveA(), PathResolveAW(), and CShellLink::SetTargetFromPIDLOrPath().

◆ PathSearchOnExtensionsW()

static BOOL WINAPI PathSearchOnExtensionsW ( LPWSTR  pszPath,
LPCWSTR ppszDirs,
BOOL  bDoSearch,
DWORD  dwWhich 
)
static

Definition at line 116 of file shellpath.c.

117 {
118  if (*PathFindExtensionW(pszPath) != 0)
119  return FALSE;
120 
121  if (bDoSearch)
122  return PathFindOnPathExW(pszPath, ppszDirs, dwWhich);
123  else
124  return PathFileExistsDefExtW(pszPath, dwWhich);
125 }
#define FALSE
Definition: types.h:117
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
Definition: path.c:447
BOOL WINAPI PathFileExistsDefExtW(LPWSTR lpszPath, DWORD dwWhich)
Definition: path.c:1117
BOOL WINAPI PathFindOnPathExW(LPWSTR lpszFile, LPCWSTR *lppszOtherDirs, DWORD dwWhich)
Definition: path.c:1350

Referenced by PathResolveW().

◆ PathYetAnotherMakeUniqueName()

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

Definition at line 492 of file shellpath.c.

493 {
494  WCHAR pathW[MAX_PATH], retW[MAX_PATH];
495  const WCHAR *file, *ext;
496  int i = 2;
497 
498  TRACE("(%p, %s, %s, %s)\n", buffer, debugstr_w(path), debugstr_w(shortname), debugstr_w(longname));
499 
500  file = longname ? longname : shortname;
501  PathCombineW(pathW, path, file);
502  strcpyW(retW, pathW);
503  PathRemoveExtensionW(pathW);
504 
506 
507  /* now try to make it unique */
508  while (PathFileExistsW(retW))
509  {
510  sprintfW(retW, L"%s (%d)%s", pathW, i, ext);
511  i++;
512  }
513 
514  strcpyW(buffer, retW);
515  TRACE("ret - %s\n", debugstr_w(buffer));
516 
517  return TRUE;
518 }
#define TRUE
Definition: types.h:120
GLuint buffer
Definition: glext.h:5915
#define L(x)
Definition: ntvdm.h:50
void WINAPI PathRemoveExtensionW(LPWSTR lpszPath)
Definition: path.c:823
#define debugstr_w
Definition: kernel32.h:32
char ext[3]
Definition: mkdosfs.c:358
BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath)
Definition: path.c:1776
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
Definition: path.c:447
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
const char file[]
Definition: icontest.c:11
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
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 sprintfW
Definition: unicode.h:58
LPWSTR WINAPI PathCombineW(LPWSTR lpszDest, LPCWSTR lpszDir, LPCWSTR lpszFile)
Definition: path.c:194
Definition: fci.c:126

Referenced by BrsFolder_NewFolder(), CNewMenu::CreateNewFolder(), CDefaultContextMenu::DoCreateNewFolder(), loadShell32(), and CNewMenu::NewItemByNonCommand().

◆ SHELL_RegisterShellFolders()

HRESULT SHELL_RegisterShellFolders ( void  )

Definition at line 2823 of file shellpath.c.

2824 {
2825  HRESULT hr;
2826 
2828  if (SUCCEEDED(hr))
2830  if (SUCCEEDED(hr))
2832  return hr;
2833 }
static HRESULT _SHRegisterCommonShellFolders(void)
Definition: shellpath.c:2795
HRESULT hr
Definition: shlfolder.c:183
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
if SUCCEEDED(hr)
static HRESULT _SHRegisterUserShellFolders(BOOL bDefault)
Definition: shellpath.c:2727
LONG HRESULT
Definition: typedefs.h:79

Referenced by DllRegisterServer().

◆ SHGetFolderLocation()

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

Definition at line 2883 of file shellpath.c.

2889 {
2891 #ifdef __REACTOS__
2893 #endif
2894 
2895  TRACE("%p 0x%08x %p 0x%08x %p\n",
2896  hwndOwner, nFolder, hToken, dwReserved, ppidl);
2897 
2898  if (!ppidl)
2899  return E_INVALIDARG;
2900  if (dwReserved)
2901  return E_INVALIDARG;
2902 
2903 #ifdef __REACTOS__
2904  if ((nFolder & CSIDL_FLAG_NO_ALIAS) &&
2906  {
2907  *ppidl = ILCreateFromPathW(szPath);
2908  if (*ppidl)
2909  return S_OK;
2910  }
2911 #endif
2912  /* The virtual folders' locations are not user-dependent */
2913  *ppidl = NULL;
2914  switch (nFolder & CSIDL_FOLDER_MASK)
2915  {
2916  case CSIDL_DESKTOP:
2917  *ppidl = _ILCreateDesktop();
2918  break;
2919 
2920  case CSIDL_PERSONAL:
2921  *ppidl = _ILCreateMyDocuments();
2922  break;
2923 
2924  case CSIDL_INTERNET:
2925  *ppidl = _ILCreateIExplore();
2926  break;
2927 
2928  case CSIDL_CONTROLS:
2929  *ppidl = _ILCreateControlPanel();
2930  break;
2931 
2932  case CSIDL_PRINTERS:
2933  *ppidl = _ILCreatePrinters();
2934  break;
2935 
2936  case CSIDL_BITBUCKET:
2937  *ppidl = _ILCreateBitBucket();
2938  break;
2939 
2940  case CSIDL_DRIVES:
2941  *ppidl = _ILCreateMyComputer();
2942  break;
2943 
2944  case CSIDL_NETWORK:
2945  *ppidl = _ILCreateNetwork();
2946  break;
2947 
2948  default:
2949  {
2951 
2952  hr = SHGetFolderPathW(hwndOwner, nFolder, hToken,
2954  if (SUCCEEDED(hr))
2955  {
2956  DWORD attributes=0;
2957 
2958  TRACE("Value=%s\n", debugstr_w(szPath));
2959  hr = SHILCreateFromPathW(szPath, ppidl, &attributes);
2960  }
2962  {
2963  /* unlike SHGetFolderPath, SHGetFolderLocation in shell32
2964  * version 6.0 returns E_FAIL for nonexistent paths
2965  */
2966  hr = E_FAIL;
2967  }
2968  }
2969  }
2970  if(*ppidl)
2971  hr = S_OK;
2972 
2973  TRACE("-- (new pidl %p)\n",*ppidl);
2974  return hr;
2975 }
LPITEMIDLIST _ILCreateDesktop(void)
Definition: pidl.c:1602
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
HRESULT hr
Definition: shlfolder.c:183
LPITEMIDLIST _ILCreatePrinters(void)
Definition: pidl.c:1650
#define CSIDL_DESKTOP
Definition: shlobj.h:2012
_In_ int nFolder
Definition: shlobj.h:1444
#define CSIDL_BITBUCKET
Definition: shlobj.h:2022
#define E_FAIL
Definition: ddrawi.h:102
#define CSIDL_CONTROLS
Definition: shlobj.h:2015
#define CSIDL_FOLDER_MASK
Definition: shlobj.h:2070
#define CSIDL_PRINTERS
Definition: shlobj.h:2016
#define CSIDL_DRIVES
Definition: shlobj.h:2028
#define FALSE
Definition: types.h:117
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:90
if SUCCEEDED(hr)
#define debugstr_w
Definition: kernel32.h:32
#define E_INVALIDARG
Definition: ddrawi.h:101
LPITEMIDLIST _ILCreateMyComputer(void)
Definition: pidl.c:1613
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
LPITEMIDLIST _ILCreateNetwork(void)
Definition: pidl.c:1669
#define S_OK
Definition: intsafe.h:52
BOOL WINAPI SHGetSpecialFolderPathW(HWND hwndOwner, LPWSTR szPath, int nFolder, BOOL bCreate)
Definition: shellpath.c:2851
LPCWSTR szPath
Definition: env.c:37
#define NULL
Definition: types.h:112
#define CSIDL_INTERNET
Definition: shlobj.h:2013
HRESULT WINAPI SHILCreateFromPathW(LPCWSTR path, LPITEMIDLIST *ppidl, DWORD *attributes)
Definition: pidl.c:392
#define CSIDL_PERSONAL
Definition: shlobj.h:2017
HRESULT WINAPI SHGetFolderPathW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath)
Definition: shellpath.c:2348
LPITEMIDLIST _ILCreateIExplore(void)
Definition: pidl.c:1625
LPITEMIDLIST WINAPI ILCreateFromPathW(LPCWSTR path)
Definition: pidl.c:982
LPITEMIDLIST _ILCreateMyDocuments(void)
Definition: pidl.c:1619
LPITEMIDLIST _ILCreateControlPanel(void)
Definition: pidl.c:1631
#define CSIDL_NETWORK
Definition: shlobj.h:2029
LPITEMIDLIST _ILCreateBitBucket(void)
Definition: pidl.c:1675
#define CSIDL_FLAG_NO_ALIAS
Definition: shlobj.h:2072

Referenced by CBandSiteMenu::_CreateBuiltInISFBand(), BrsFolder_OnCreate(), ILIsParentOrSpecialParent(), CExplorerBand::InitializeExplorerBand(), CExplorerBand::InsertSubitems(), LoadRdpSettingsFromFile(), loadShell32(), CShellMenuCallback::OnGetSubMenu(), SaveRdpSettingsToFile(), SHCreateFromDesktop(), SHEmptyRecycleBinW(), SHGetSpecialFolderLocation(), START_TEST(), TestCommandLine(), and TestCompareIDList().

◆ SHGetFolderPathA()

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

Definition at line 2595 of file shellpath.c.

2601 {
2602  WCHAR szTemp[MAX_PATH];
2603  HRESULT hr;
2604 
2605  TRACE("%p,%d,%p,%#x,%p\n", hwndOwner, nFolder, hToken, dwFlags, pszPath);
2606 
2607  if (pszPath)
2608  *pszPath = '\0';
2609  hr = SHGetFolderPathW(hwndOwner, nFolder, hToken, dwFlags, szTemp);
2610  if (SUCCEEDED(hr) && pszPath)
2611  WideCharToMultiByte(CP_ACP, 0, szTemp, -1, pszPath, MAX_PATH, NULL,
2612  NULL);
2613 
2614  return hr;
2615 }
#define WideCharToMultiByte
Definition: compat.h:111
HRESULT hr
Definition: shlfolder.c:183
#define CP_ACP
Definition: compat.h:109
_In_ int nFolder
Definition: shlobj.h:1444
if SUCCEEDED(hr)
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
#define MAX_PATH
Definition: compat.h:34
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define NULL
Definition: types.h:112
HRESULT WINAPI SHGetFolderPathW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath)
Definition: shellpath.c:2348

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 2361 of file shellpath.c.

2368 {
2369  int length;
2370  HRESULT hr = S_OK;
2371  LPWSTR pszSubPathW = NULL;
2372  LPWSTR pszPathW = NULL;
2373 
2374  TRACE("%p,%#x,%p,%#x,%s,%p\n", hwndOwner, nFolder, hToken, dwFlags, debugstr_a(pszSubPath), pszPath);
2375 
2376  if(pszPath) {
2377  pszPathW = HeapAlloc(GetProcessHeap(), 0, MAX_PATH * sizeof(WCHAR));
2378  if(!pszPathW) {
2380  goto cleanup;
2381  }
2382  }
2383  TRACE("%08x,%08x,%s\n",nFolder, dwFlags, debugstr_w(pszSubPathW));
2384 
2385  /* SHGetFolderPathAndSubDirW does not distinguish if pszSubPath isn't
2386  * set (null), or an empty string.therefore call it without the parameter set
2387  * if pszSubPath is an empty string
2388  */
2389  if (pszSubPath && pszSubPath[0]) {
2390  length = MultiByteToWideChar(CP_ACP, 0, pszSubPath, -1, NULL, 0);
2391  pszSubPathW = HeapAlloc(GetProcessHeap(), 0, length * sizeof(WCHAR));
2392  if(!pszSubPathW) {
2394  goto cleanup;
2395  }
2396  MultiByteToWideChar(CP_ACP, 0, pszSubPath, -1, pszSubPathW, length);
2397  }
2398 
2399  hr = SHGetFolderPathAndSubDirW(hwndOwner, nFolder, hToken, dwFlags, pszSubPathW, pszPathW);
2400 
2401  if (SUCCEEDED(hr) && pszPath)
2402  WideCharToMultiByte(CP_ACP, 0, pszPathW, -1, pszPath, MAX_PATH, NULL, NULL);
2403 
2404 cleanup:
2405  HeapFree(GetProcessHeap(), 0, pszPathW);
2406  HeapFree(GetProcessHeap(), 0, pszSubPathW);
2407  return hr;
2408 }
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define WideCharToMultiByte
Definition: compat.h:111
HRESULT hr
Definition: shlfolder.c:183
#define CP_ACP
Definition: compat.h:109
_In_ int nFolder
Definition: shlobj.h:1444
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
if SUCCEEDED(hr)
#define debugstr_w
Definition: kernel32.h:32
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
LONG HRESULT
Definition: typedefs.h:79
#define MAX_PATH
Definition: compat.h:34
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define S_OK
Definition: intsafe.h:52
#define NULL
Definition: types.h:112
#define MultiByteToWideChar
Definition: compat.h:110
char * cleanup(char *str)
Definition: wpickclick.c:99
WCHAR * LPWSTR
Definition: xmlstorage.h:184
HRESULT WINAPI SHGetFolderPathAndSubDirW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPCWSTR pszSubPath, LPWSTR pszPath)
Definition: shellpath.c:2413
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by test_SHGetFolderPathAndSubDirA().

◆ SHGetFolderPathAndSubDirW()

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

Definition at line 2413 of file shellpath.c.

2420 {
2421  HRESULT hr;
2422  WCHAR szBuildPath[MAX_PATH], szTemp[MAX_PATH];
2424  CSIDL_Type type;
2425  int ret;
2426 
2427  TRACE("%p,%#x,%p,%#x,%s,%p\n", hwndOwner, nFolder, hToken, dwFlags, debugstr_w(pszSubPath), pszPath);
2428 
2429  /* Windows always NULL-terminates the resulting path regardless of success
2430  * or failure, so do so first
2431  */
2432  if (pszPath)
2433  *pszPath = '\0';
2434 
2435  if (folder >= ARRAY_SIZE(CSIDL_Data))
2436  return E_INVALIDARG;
2438  return E_INVALIDARG;
2439  szTemp[0] = 0;
2441  switch (type)
2442  {
2443  case CSIDL_Type_Disallowed:
2444  hr = E_INVALIDARG;
2445  break;
2447  hr = S_FALSE;
2448  break;
2450  GetWindowsDirectoryW(szTemp, MAX_PATH);
2451  if (CSIDL_Data[folder].szDefaultPath &&
2452  !IS_INTRESOURCE(CSIDL_Data[folder].szDefaultPath) &&
2453  *CSIDL_Data[folder].szDefaultPath)
2454  {
2455  PathAddBackslashW(szTemp);
2456  strcatW(szTemp, CSIDL_Data[folder].szDefaultPath);
2457  }
2458  hr = S_OK;
2459  break;
2460  case CSIDL_Type_SystemPath:
2461  GetSystemDirectoryW(szTemp, MAX_PATH);
2462  if (CSIDL_Data[folder].szDefaultPath &&
2463  !IS_INTRESOURCE(CSIDL_Data[folder].szDefaultPath) &&
2464  *CSIDL_Data[folder].szDefaultPath)
2465  {
2466  PathAddBackslashW(szTemp);
2467  strcatW(szTemp, CSIDL_Data[folder].szDefaultPath);
2468  }
2469  hr = S_OK;
2470  break;
2473  if (CSIDL_Data[folder].szDefaultPath &&
2474  !IS_INTRESOURCE(CSIDL_Data[folder].szDefaultPath) &&
2475  *CSIDL_Data[folder].szDefaultPath)
2476  {
2477  PathAddBackslashW(szTemp);
2478  strcatW(szTemp, CSIDL_Data[folder].szDefaultPath);
2479  }
2480  hr = S_OK;
2481  break;
2482  case CSIDL_Type_CurrVer:
2484  break;
2485  case CSIDL_Type_User:
2486 #ifdef __REACTOS__
2487  case CSIDL_Type_InMyDocuments:
2488 #endif
2489  hr = _SHGetUserProfilePath(hToken, dwFlags, folder, szTemp);
2490  break;
2491  case CSIDL_Type_AllUsers:
2493  break;
2494  default:
2495  FIXME("bogus type %d, please fix\n", type);
2496  hr = E_INVALIDARG;
2497  break;
2498  }
2499 
2500  /* Expand environment strings if necessary */
2501  if (*szTemp == '%')
2502 #ifndef __REACTOS__
2503  hr = _SHExpandEnvironmentStrings(szTemp, szBuildPath);
2504 #else
2505  hr = _SHExpandEnvironmentStrings(hToken, szTemp, szBuildPath, _countof(szBuildPath));
2506 #endif
2507  else
2508  strcpyW(szBuildPath, szTemp);
2509 
2510  if (FAILED(hr)) goto end;
2511 
2512  if(pszSubPath) {
2513  /* make sure the new path does not exceed the buffer length
2514  * and remember to backslash and terminate it */
2515  if(MAX_PATH < (lstrlenW(szBuildPath) + lstrlenW(pszSubPath) + 2)) {
2517  goto end;
2518  }
2519  PathAppendW(szBuildPath, pszSubPath);
2520  PathRemoveBackslashW(szBuildPath);
2521  }
2522  /* Copy the path if it's available before we might return */
2523  if (SUCCEEDED(hr) && pszPath)
2524  strcpyW(pszPath, szBuildPath);
2525 
2526  /* if we don't care about existing directories we are ready */
2527  if(nFolder & CSIDL_FLAG_DONT_VERIFY) goto end;
2528 
2529  if (PathFileExistsW(szBuildPath)) goto end;
2530 
2531  /* not existing but we are not allowed to create it. The return value
2532  * is verified against shell32 version 6.0.
2533  */
2534  if (!(nFolder & CSIDL_FLAG_CREATE))
2535  {
2537  goto end;
2538  }
2539 
2540  /* create directory/directories */
2541  ret = SHCreateDirectoryExW(hwndOwner, szBuildPath, NULL);
2542  if (ret && ret != ERROR_ALREADY_EXISTS)
2543  {
2544  ERR("Failed to create directory %s.\n", debugstr_w(szBuildPath));
2545  hr = E_FAIL;
2546  goto end;
2547  }
2548 
2549  TRACE("Created missing system directory %s\n", debugstr_w(szBuildPath));
2550 
2551 end:
2552 #ifdef __REACTOS__
2553  /* create desktop.ini for custom icon */
2554  if ((nFolder & CSIDL_FLAG_CREATE) &&
2555  CSIDL_Data[folder].nShell32IconIndex)
2556  {
2557  WCHAR szIconLocation[MAX_PATH];
2559 
2560  /* make the directory a read-only folder */
2561  dwAttributes = GetFileAttributesW(szBuildPath);
2563  SetFileAttributesW(szBuildPath, dwAttributes);
2564 
2565  /* build the desktop.ini file path */
2566  PathAppendW(szBuildPath, L"desktop.ini");
2567 
2568  /* build the icon location */
2569  StringCchPrintfW(szIconLocation, _countof(szIconLocation),
2570  L"%%SystemRoot%%\\system32\\shell32.dll,%d",
2571  CSIDL_Data[folder].nShell32IconIndex);
2572 
2573  /* write desktop.ini */
2574  WritePrivateProfileStringW(L".ShellClassInfo", L"IconResource", szIconLocation, szBuildPath);
2575 
2576  /* flush! */
2577  WritePrivateProfileStringW(NULL, NULL, NULL, szBuildPath);
2578 
2579  /* make the desktop.ini a system and hidden file */
2580  dwAttributes = GetFileAttributesW(szBuildPath);
2582  SetFileAttributesW(szBuildPath, dwAttributes);
2583  }
2584 #endif
2585 
2586  TRACE("returning 0x%08x (final path is %s)\n", hr, debugstr_w(szBuildPath));
2587  return hr;
2588 }
BOOL WINAPI SetFileAttributesW(LPCWSTR lpFileName, DWORD dwFileAttributes)
Definition: fileinfo.c:794
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
Definition: fci.c:115
HRESULT hr
Definition: shlfolder.c:183
static HRESULT _SHExpandEnvironmentStrings(LPCWSTR szSrc, LPWSTR szDest)
Definition: shellpath.c:2196
#define CSIDL_FLAG_DONT_VERIFY
Definition: shlobj.h:2073
#define FILE_ATTRIBUTE_SYSTEM
Definition: nt_native.h:704
static HRESULT _SHGetCurrentVersionPath(DWORD dwFlags, BYTE folder, LPWSTR pszPath)
Definition: shellpath.c:1892
static const CSIDL_DATA CSIDL_Data[]
Definition: shellpath.c:870
_In_ int nFolder
Definition: shlobj.h:1444
enum _CSIDL_Type CSIDL_Type
#define lstrlenW
Definition: compat.h:609
#define E_FAIL
Definition: ddrawi.h:102
DWORD dwAttributes
Definition: vdmdbg.h:34
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2352
BOOL WINAPI PathAppendW(LPWSTR lpszPath, LPCWSTR lpszAppend)
Definition: path.c:126
#define CSIDL_FOLDER_MASK
Definition: shlobj.h:2070
#define L(x)
Definition: ntvdm.h:50
LPWSTR WINAPI PathAddBackslashW(LPWSTR lpszPath)
Definition: path.c:294
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652
if SUCCEEDED(hr)
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
#define S_FALSE
Definition: winerror.h:2357
#define E_INVALIDARG
Definition: ddrawi.h:101
BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath)
Definition: path.c:1776
struct CFFOLDER folder
Definition: fdi.c:102
#define TRACE(s)
Definition: solgame.cpp:4
#define IS_INTRESOURCE(i)
Definition: winuser.h:580
__wchar_t WCHAR
Definition: xmlstorage.h:180
static HRESULT _SHGetUserProfilePath(HANDLE hToken, DWORD dwFlags, BYTE folder, LPWSTR pszPath)
Definition: shellpath.c:2002
LONG HRESULT
Definition: typedefs.h:79
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint end
Definition: gl.h:1545
int ret
static HRESULT _SHGetAllUsersProfilePath(DWORD dwFlags, BYTE folder, LPWSTR pszPath)
Definition: shellpath.c:2091
UINT WINAPI GetSystemWow64DirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2421
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
LPWSTR WINAPI PathRemoveBackslashW(LPWSTR lpszPath)
Definition: path.c:867
BOOL WINAPI WritePrivateProfileStringW(LPCWSTR section, LPCWSTR entry, LPCWSTR string, LPCWSTR filename)
Definition: profile.c:1453
#define ERR(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:52
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
#define ARRAY_SIZE(a)
Definition: main.h:24
int WINAPI SHCreateDirectoryExW(HWND hWnd, LPCWSTR path, LPSECURITY_ATTRIBUTES sec)
Definition: shlfileop.cpp:915
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
WINE_UNICODE_INLINE WCHAR * strcatW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:242
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2313
#define FILE_ATTRIBUTE_HIDDEN
Definition: nt_native.h:703
#define NULL
Definition: types.h:112
#define CSIDL_FLAG_CREATE
CSIDL_Type type
Definition: shellpath.c:864
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:106
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define ERROR_FILENAME_EXCED_RANGE
Definition: winerror.h:263

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

◆ SHGetFolderPathW()

HRESULT WINAPI SHGetFolderPathW ( HWND  hwndOwner,
int  nFolder,
HANDLE  hToken,
DWORD  dwFlags,
LPWSTR  pszPath 
)

Definition at line 2348 of file shellpath.c.

2354 {
2355  HRESULT hr = SHGetFolderPathAndSubDirW(hwndOwner, nFolder, hToken, dwFlags, NULL, pszPath);
2358  return hr;
2359 }
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
HRESULT hr
Definition: shlfolder.c:183
_In_ int nFolder
Definition: shlobj.h:1444
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
LONG HRESULT
Definition: typedefs.h:79
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define NULL
Definition: types.h:112
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:106
HRESULT WINAPI SHGetFolderPathAndSubDirW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPCWSTR pszSubPath, LPWSTR pszPath)
Definition: shellpath.c:2413

Referenced by _SHRegisterFolders(), AutoStartupApplications(), BrsFolder_NewFolder(), CJournaledTestList::CJournaledTestList(), create_ie_menu(), create_profile_directory(), CreateObjectsFromPersistFolder(), DllRegisterServer(), FILEDLG95_InitControls(), FillDefaultSettings(), format_filelist_filename(), GetDefaultUserSendTo(), Initialize(), CFontExt::Initialize(), LoadThemes(), OnAddStartMenuItems(), OnAdvancedStartMenuItems(), OnBrowseButton(), OnClearRecentItems(), RegisterTypeLibraries(), set_installer_properties(), Settings_GetOutputPath(), SHGetFolderLocation(), SHGetFolderPathA(), SHGetSpecialFolderPathW(), test_namespace(), TestDefaultFormat(), and testRegStoreSavedCerts().

◆ SHGetSpecialFolderLocation()

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

Definition at line 2984 of file shellpath.c.

2988 {
2990 
2991  TRACE("(%p,0x%x,%p)\n", hwndOwner,nFolder,ppidl);
2992 
2993  if (!ppidl)
2994  return E_INVALIDARG;
2995 
2996  hr = SHGetFolderLocation(hwndOwner, nFolder, NULL, 0, ppidl);
2997  return hr;
2998 }
HRESULT hr
Definition: shlfolder.c:183
_In_ int nFolder
Definition: shlobj.h:1444
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
#define NULL
Definition: types.h:112
HRESULT WINAPI SHGetFolderLocation(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwReserved, LPITEMIDLIST *ppidl)
Definition: shellpath.c:2883

Referenced by _GetDocumentsPidl(), DoGetPidl(), DoInitAliasPIDLs(), DoTestEntry(), ebrowser_browse_to_desktop(), FILEDLG95_InitControls(), FILEDLG95_LOOKIN_Init(), FILEDLG95_OnWMCommand(), filedlg_collect_places_pidls(), GetFavoritesFolder(), GetMergedFolder(), CSendToMenu::GetSpecialFolder(), IShellBrowserImpl_Construct(), loadShell32(), CACListISF::NextLocation(), CShellBrowser::OnOrganizeFavorites(), PidlBrowse(), CAddressEditBox::PopulateComboBox(), RSHELL_CStartMenu_CreateInstance(), SHAddToRecentDocs(), SHCloneSpecialIDList(), SHExplorerParseCmdLine(), SpecialFolderPath::SpecialFolderPath(), 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 2838 of file shellpath.c.

2843 {
2844  return SHGetFolderPathA(hwndOwner, nFolder + (bCreate ? CSIDL_FLAG_CREATE : 0), NULL, 0,
2845  szPath) == S_OK;
2846 }
_In_ int nFolder
Definition: shlobj.h:1444
#define S_OK
Definition: intsafe.h:52
_In_ int _In_ BOOL bCreate
Definition: shlobj.h:1444
HRESULT WINAPI SHGetFolderPathA(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPSTR pszPath)
Definition: shellpath.c:2595
LPCWSTR szPath
Definition: env.c:37
#define NULL
Definition: types.h:112
#define CSIDL_FLAG_CREATE

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

◆ SHGetSpecialFolderPathW()

BOOL WINAPI SHGetSpecialFolderPathW ( HWND  hwndOwner,
LPWSTR  szPath,
int  nFolder,
BOOL  bCreate 
)

◆ SHPathGetExtensionW()

LPVOID WINAPI SHPathGetExtensionW ( LPCWSTR  lpszPath,
DWORD  void1,
DWORD  void2 
)

Definition at line 276 of file shellpath.c.

277 {
278  return PathGetExtensionW(lpszPath);
279 }
static LPWSTR PathGetExtensionW(LPCWSTR lpszPath)
Definition: shellpath.c:265

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shell  )

Variable Documentation

◆ Application_DataW

const WCHAR Application_DataW[] = L"Application Data"
static

Definition at line 816 of file shellpath.c.

◆ CSIDL_Data

◆ is_win64

◆ Local_Settings_Application_DataW

const WCHAR Local_Settings_Application_DataW[] = L"Local Settings\\Application Data"
static

Definition at line 817 of file shellpath.c.

◆ Local_Settings_HistoryW

const WCHAR Local_Settings_HistoryW[] = L"Local Settings\\History"
static

Definition at line 818 of file shellpath.c.

◆ Local_Settings_Temporary_Internet_FilesW

const WCHAR Local_Settings_Temporary_Internet_FilesW[] = L"Local Settings\\Temporary Internet Files"
static

Definition at line 819 of file shellpath.c.

◆ MusicW

const WCHAR MusicW[] = L"Music"
static

Definition at line 820 of file shellpath.c.

◆ PicturesW

const WCHAR PicturesW[] = L"Pictures"
static

Definition at line 821 of file shellpath.c.

◆ Program_Files_Common_FilesW

const WCHAR Program_Files_Common_FilesW[] = L"Program Files\\Common Files"
static

Definition at line 823 of file shellpath.c.

◆ Program_FilesW

const WCHAR Program_FilesW[] = L"Program Files"
static

Definition at line 822 of file shellpath.c.

◆ Start_Menu_Admin_ToolsW

const WCHAR Start_Menu_Admin_ToolsW[] = L"Start Menu\\Programs\\Administrative Tools"
static

Definition at line 825 of file shellpath.c.

◆ Start_Menu_ProgramsW

const WCHAR Start_Menu_ProgramsW[] = L"Start Menu\\Programs"
static

Definition at line 824 of file shellpath.c.

◆ Start_Menu_StartupW

const WCHAR Start_Menu_StartupW[] = L"Start Menu\\Programs\\StartUp"
static

Definition at line 826 of file shellpath.c.

◆ szKnownFolderDescriptions

const WCHAR szKnownFolderDescriptions[] = L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FolderDescriptions"
static

Definition at line 833 of file shellpath.c.

◆ szKnownFolderRedirections

const WCHAR szKnownFolderRedirections[] = L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders"
static

Definition at line 834 of file shellpath.c.

◆ szSHFolders

const WCHAR szSHFolders[] = L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders"
static

◆ szSHUserFolders

const WCHAR szSHUserFolders[] = L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders"
static