ReactOS 0.4.15-dev-7788-g1ad9096
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 <assert.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 PATH_CHAR_CLASS_DOT   0x00000004
 
#define PATH_CHAR_CLASS_BACKSLASH   0x00000008
 
#define PATH_CHAR_CLASS_COLON   0x00000010
 
#define PATH_CHAR_CLASS_OTHER_VALID   0x00000100
 
#define VALID_SHORT_PATH_CHAR_CLASSES
 
#define MSDOS_8DOT3_LEN   12 /* MS-DOS 8.3 filename == length 12 */
 
#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 _NT_PRODUCT_TYPE NT_PRODUCT_TYPE
 
typedef enum _NT_PRODUCT_TYPEPNT_PRODUCT_TYPE
 
typedef enum _CSIDL_Type CSIDL_Type
 

Enumerations

enum  _NT_PRODUCT_TYPE {
  NtProductWinNt = 1 , NtProductLanManNt , NtProductServer , NtProductWinNt = 1 ,
  NtProductLanManNt , NtProductServer
}
 
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 DoGetProductType (PNT_PRODUCT_TYPE ProductType)
 
BOOL APIENTRY IsRemovableDrive (DWORD iDrive)
 
static BOOL WINAPI PathSearchOnExtensionsW (_Inout_ LPWSTR pszPath, _In_opt_ LPCWSTR *ppszDirs, _In_ BOOL bDoSearch, _In_ DWORD dwWhich)
 
static BOOL WINAPI PathIsAbsoluteW (_In_ LPCWSTR path)
 
static BOOL WINAPI PathMakeAbsoluteW (_Inout_ LPWSTR path)
 
BOOL WINAPI IsLFNDriveW (LPCWSTR lpszPath)
 
static VOID WINAPI PathQualifyExW (_Inout_ LPWSTR pszPath, _Inout_opt_ LPCWSTR pszDir, _In_ 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 (_Inout_ LPWSTR path, _Inout_opt_ LPCWSTR *dirs, _In_ 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 55 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 1066 of file shellpath.c.

◆ CSIDL_CONTACTS

#define CSIDL_CONTACTS   0x0043

Definition at line 1063 of file shellpath.c.

◆ CSIDL_DOWNLOADS

#define CSIDL_DOWNLOADS   0x0047

Definition at line 1064 of file shellpath.c.

◆ CSIDL_LINKS

#define CSIDL_LINKS   0x004d

Definition at line 1065 of file shellpath.c.

◆ CSIDL_SAVED_GAMES

#define CSIDL_SAVED_GAMES   0x0062

Definition at line 1067 of file shellpath.c.

◆ CSIDL_SEARCHES

#define CSIDL_SEARCHES   0x0063

Definition at line 1068 of file shellpath.c.

◆ MSDOS_8DOT3_LEN

#define MSDOS_8DOT3_LEN   12 /* MS-DOS 8.3 filename == length 12 */

◆ PATH_CHAR_CLASS_BACKSLASH

#define PATH_CHAR_CLASS_BACKSLASH   0x00000008

◆ PATH_CHAR_CLASS_COLON

#define PATH_CHAR_CLASS_COLON   0x00000010

◆ PATH_CHAR_CLASS_DOT

#define PATH_CHAR_CLASS_DOT   0x00000004

◆ PATH_CHAR_CLASS_OTHER_VALID

#define PATH_CHAR_CLASS_OTHER_VALID   0x00000100

◆ VALID_SHORT_PATH_CHAR_CLASSES

#define VALID_SHORT_PATH_CHAR_CLASSES
Value:
( \
)
#define PATH_CHAR_CLASS_OTHER_VALID
#define PATH_CHAR_CLASS_COLON
#define PATH_CHAR_CLASS_BACKSLASH
#define PATH_CHAR_CLASS_DOT

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 28 of file shellpath.c.

Typedef Documentation

◆ CSIDL_Type

◆ NT_PRODUCT_TYPE

◆ PNT_PRODUCT_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 1047 of file shellpath.c.

1047 {
1049#ifdef __REACTOS__
1050 CSIDL_Type_InMyDocuments,
1051#endif
1059} CSIDL_Type;
enum _CSIDL_Type CSIDL_Type
@ CSIDL_Type_CurrVer
Definition: shellpath.c:1053
@ CSIDL_Type_AllUsers
Definition: shellpath.c:1052
@ CSIDL_Type_WindowsPath
Definition: shellpath.c:1056
@ CSIDL_Type_Disallowed
Definition: shellpath.c:1054
@ CSIDL_Type_SystemX86Path
Definition: shellpath.c:1058
@ CSIDL_Type_SystemPath
Definition: shellpath.c:1057
@ CSIDL_Type_User
Definition: shellpath.c:1048
@ CSIDL_Type_NonExistent
Definition: shellpath.c:1055

◆ _NT_PRODUCT_TYPE

Enumerator
NtProductWinNt 
NtProductLanManNt 
NtProductServer 
NtProductWinNt 
NtProductLanManNt 
NtProductServer 

Definition at line 62 of file shellpath.c.

63{
enum _NT_PRODUCT_TYPE NT_PRODUCT_TYPE
enum _NT_PRODUCT_TYPE * PNT_PRODUCT_TYPE
@ NtProductWinNt
Definition: shellpath.c:64
@ NtProductLanManNt
Definition: shellpath.c:65
@ NtProductServer
Definition: shellpath.c:66

Function Documentation

◆ _GetUserSidStringFromToken()

static LPWSTR _GetUserSidStringFromToken ( HANDLE  Token)
static

Definition at line 2171 of file shellpath.c.

2172{
2173 char InfoBuffer[64];
2174 PTOKEN_USER UserInfo;
2175 DWORD InfoSize;
2176 LPWSTR SidStr;
2177
2178 UserInfo = (PTOKEN_USER) InfoBuffer;
2179 if (! GetTokenInformation(Token, TokenUser, InfoBuffer, sizeof(InfoBuffer),
2180 &InfoSize))
2181 {
2183 return NULL;
2184 UserInfo = HeapAlloc(GetProcessHeap(), 0, InfoSize);
2185 if (UserInfo == NULL)
2186 return NULL;
2187 if (! GetTokenInformation(Token, TokenUser, UserInfo, InfoSize,
2188 &InfoSize))
2189 {
2190 HeapFree(GetProcessHeap(), 0, UserInfo);
2191 return NULL;
2192 }
2193 }
2194
2195 if (! ConvertSidToStringSidW(UserInfo->User.Sid, &SidStr))
2196 SidStr = NULL;
2197
2198 if (UserInfo != (PTOKEN_USER) InfoBuffer)
2199 HeapFree(GetProcessHeap(), 0, UserInfo);
2200
2201 return SidStr;
2202}
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define NULL
Definition: types.h:112
BOOL WINAPI GetTokenInformation(HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength)
Definition: security.c:411
BOOL WINAPI ConvertSidToStringSidW(PSID Sid, LPWSTR *StringSid)
Definition: security.c:3583
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
unsigned long DWORD
Definition: ntddk_ex.h:95
SID_AND_ATTRIBUTES User
Definition: setypes.h:1010
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
struct _TOKEN_USER * PTOKEN_USER
@ TokenUser
Definition: setypes.h:966
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by _SHGetUserProfilePath().

◆ _SHExpandEnvironmentStrings()

static HRESULT _SHExpandEnvironmentStrings ( LPCWSTR  szSrc,
LPWSTR  szDest 
)
static

Definition at line 2406 of file shellpath.c.

2410{
2411 HRESULT hr;
2412#ifndef __REACTOS__
2413 WCHAR szTemp[MAX_PATH], szProfilesPrefix[MAX_PATH] = { 0 };
2414 HKEY key = NULL;
2415#else
2416 WCHAR szTemp[MAX_PATH];
2417#endif
2418
2419 TRACE("%s, %p\n", debugstr_w(szSrc), szDest);
2420
2421 if (!szSrc || !szDest) return E_INVALIDARG;
2422
2423 /* short-circuit if there's nothing to expand */
2424 if (szSrc[0] != '%')
2425 {
2426 strcpyW(szDest, szSrc);
2427 hr = S_OK;
2428 goto end;
2429 }
2430#ifndef __REACTOS__
2431 /* Get the profile prefix, we'll probably be needing it */
2433 if (SUCCEEDED(hr))
2434 {
2435 WCHAR def_val[MAX_PATH];
2436
2437 /* get the system drive */
2438 GetSystemDirectoryW(def_val, MAX_PATH);
2439 strcpyW( def_val + 3, L"Users" );
2440
2441 hr = _SHGetProfilesValue(key, L"ProfilesDirectory", szProfilesPrefix, def_val );
2442 }
2443#else
2444 hr = S_OK;
2445#endif
2446
2447 *szDest = 0;
2448 strcpyW(szTemp, szSrc);
2449 while (SUCCEEDED(hr) && szTemp[0] == '%')
2450 {
2451 if (!strncmpiW(szTemp, L"%ALLUSERSPROFILE%", ARRAY_SIZE(L"%ALLUSERSPROFILE%")-1))
2452 {
2453#ifndef __REACTOS__
2454 WCHAR szAllUsers[MAX_PATH];
2455
2456 strcpyW(szDest, szProfilesPrefix);
2457 hr = _SHGetProfilesValue(key, L"AllUsersProfile", szAllUsers, L"Public");
2458 PathAppendW(szDest, szAllUsers);
2459#else
2460 DWORD cchSize = cchDest;
2461 if (!GetAllUsersProfileDirectoryW(szDest, &cchSize))
2462 goto fallback_expand;
2463#endif
2464 PathAppendW(szDest, szTemp + ARRAY_SIZE(L"%ALLUSERSPROFILE%")-1);
2465 }
2466#ifndef __REACTOS__
2467 else if (!strncmpiW(szTemp, L"%PUBLIC%", ARRAY_SIZE(L"%PUBLIC%")-1))
2468 {
2469 WCHAR szAllUsers[MAX_PATH], def_val[MAX_PATH];
2470
2471 GetSystemDirectoryW(def_val, MAX_PATH);
2472 strcpyW( def_val + 3, L"Users\\Public" );
2473
2474 hr = _SHGetProfilesValue(key, L"Public", szAllUsers, def_val);
2475 PathAppendW(szDest, szAllUsers);
2476 PathAppendW(szDest, szTemp + ARRAY_SIZE(L"%PUBLIC%")-1);
2477 }
2478#endif
2479 else if (!strncmpiW(szTemp, L"%USERPROFILE%", ARRAY_SIZE(L"%USERPROFILE%")-1))
2480 {
2481#ifndef __REACTOS__
2483 DWORD userLen = MAX_PATH;
2484
2485 strcpyW(szDest, szProfilesPrefix);
2486 GetUserNameW(userName, &userLen);
2487 PathAppendW(szDest, userName);
2488#else
2489 DWORD cchSize = cchDest;
2490 if (!_SHGetUserProfileDirectoryW(hToken, szDest, &cchSize))
2491 goto fallback_expand;
2492#endif
2493 PathAppendW(szDest, szTemp + ARRAY_SIZE(L"%USERPROFILE%")-1);
2494 }
2495 else if (!strncmpiW(szTemp, L"%SystemDrive%", ARRAY_SIZE(L"%SystemDrive%")-1))
2496 {
2497#ifndef __REACTOS__
2499#else
2500 if (!GetSystemDirectoryW(szDest, cchDest))
2501 goto fallback_expand;
2502#endif
2503 strcpyW(szDest + 3, szTemp + ARRAY_SIZE(L"%SystemDrive%")-1 + 1);
2504 }
2505 else
2506#ifdef __REACTOS__
2507fallback_expand:
2508#endif
2509 {
2510#ifndef __REACTOS__
2511 DWORD ret = ExpandEnvironmentStringsW(szTemp, szDest, MAX_PATH);
2512#else
2513 DWORD ret = SHExpandEnvironmentStringsForUserW(hToken, szTemp, szDest, cchDest);
2514#endif
2515
2516#ifndef __REACTOS__
2517 if (ret > MAX_PATH)
2518#else
2519 if (ret > cchDest)
2520#endif
2522 else if (ret == 0)
2524 else if (!strcmpW( szTemp, szDest )) break; /* nothing expanded */
2525 }
2526 if (SUCCEEDED(hr)) strcpyW(szTemp, szDest);
2527 }
2528end:
2529#ifndef __REACTOS__
2530 if (key)
2532#endif
2533 TRACE("returning 0x%08x (input was %s, output is %s)\n", hr,
2534 debugstr_w(szSrc), debugstr_w(szDest));
2535 return hr;
2536}
#define ARRAY_SIZE(A)
Definition: main.h:33
#define RegCloseKey(hKey)
Definition: registry.h:49
#define E_INVALIDARG
Definition: ddrawi.h:101
BOOL WINAPI GetUserNameW(LPWSTR lpszName, LPDWORD lpSize)
Definition: misc.c:291
#define MAX_PATH
Definition: compat.h:34
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2313
static HRESULT _SHOpenProfilesKey(PHKEY pKey)
Definition: shellpath.c:2341
static HRESULT _SHGetProfilesValue(HKEY profilesKey, LPCWSTR szValueName, LPWSTR szValue, LPCWSTR szDefault)
Definition: shellpath.c:2356
BOOL _SHGetUserProfileDirectoryW(HANDLE hToken, LPWSTR szPath, LPDWORD lpcchPath)
Definition: shellpath.c:1950
BOOL WINAPI GetAllUsersProfileDirectoryW(_Out_opt_ LPWSTR lpProfileDir, _Inout_ LPDWORD lpcchSize)
Definition: profile.c:1310
GLuint GLuint end
Definition: gl.h:1545
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define debugstr_w
Definition: kernel32.h:32
#define L(x)
Definition: ntvdm.h:50
#define PathAppendW
Definition: pathcch.h:309
#define strncmpiW(s1, s2, n)
Definition: unicode.h:40
#define strcmpW(s1, s2)
Definition: unicode.h:38
#define strcpyW(d, s)
Definition: unicode.h:29
HRESULT hr
Definition: shlfolder.c:183
#define TRACE(s)
Definition: solgame.cpp:4
Definition: copy.c:22
int ret
#define E_NOT_SUFFICIENT_BUFFER
Definition: winerror.h:2345
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
static const WCHAR userName[]
Definition: wnet.c:2154
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by _SHGetUserShellFolderPath(), and SHGetFolderPathAndSubDirW().

◆ _SHGetAllUsersProfilePath()

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

Definition at line 2301 of file shellpath.c.

2303{
2304 HRESULT hr;
2305
2306 TRACE("0x%08x,0x%02x,%p\n", dwFlags, folder, pszPath);
2307
2309 return E_INVALIDARG;
2311 return E_INVALIDARG;
2312 if (!pszPath)
2313 return E_INVALIDARG;
2314
2316#ifndef __REACTOS__
2317 hr = _SHGetDefaultValue(folder, pszPath);
2318#else
2319 hr = _SHGetDefaultValue(NULL, folder, pszPath);
2320#endif
2321 else
2322 {
2323#ifndef __REACTOS__
2325#else
2327#endif
2328 CSIDL_Data[folder].szValueName, pszPath);
2329 if (FAILED(hr))
2330#ifndef __REACTOS__
2331 hr = _SHGetDefaultValue(folder, pszPath);
2332#else
2333 hr = _SHGetDefaultValue(NULL, folder, pszPath);
2334#endif
2335 }
2336 TRACE("returning 0x%08x (output path is %s)\n", hr, debugstr_w(pszPath));
2337 return hr;
2338}
static HRESULT _SHGetDefaultValue(BYTE folder, LPWSTR pszPath)
Definition: shellpath.c:1986
static const CSIDL_DATA CSIDL_Data[]
Definition: shellpath.c:1080
static HRESULT _SHGetUserShellFolderPath(HKEY rootKey, LPCWSTR userPrefix, LPCWSTR value, LPWSTR path)
Definition: shellpath.c:1867
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define FAILED(hr)
Definition: intsafe.h:51
@ SHGFP_TYPE_DEFAULT
Definition: shlobj.h:2135
Definition: fci.c:116
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
#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 2102 of file shellpath.c.

2104{
2105 HRESULT hr;
2106
2107 TRACE("0x%08x,0x%02x,%p\n", dwFlags, folder, pszPath);
2108
2110 return E_INVALIDARG;
2112 return E_INVALIDARG;
2113 if (!pszPath)
2114 return E_INVALIDARG;
2115
2117#ifndef __REACTOS__
2118 hr = _SHGetDefaultValue(folder, pszPath);
2119#else
2120 hr = _SHGetDefaultValue(NULL, folder, pszPath);
2121#endif
2122 else
2123 {
2124 HKEY hKey;
2125
2126 if (RegCreateKeyW(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion", &hKey))
2127 hr = E_FAIL;
2128 else
2129 {
2130 DWORD dwType, dwPathLen = MAX_PATH * sizeof(WCHAR);
2131
2132 if (RegQueryValueExW(hKey, CSIDL_Data[folder].szValueName, NULL,
2133 &dwType, (LPBYTE)pszPath, &dwPathLen) ||
2134 (dwType != REG_SZ && dwType != REG_EXPAND_SZ))
2135 {
2136#ifndef __REACTOS__
2137 hr = _SHGetDefaultValue(folder, pszPath);
2138#else
2139 hr = _SHGetDefaultValue(NULL, folder, pszPath);
2140#endif
2141 dwType = REG_EXPAND_SZ;
2142 switch (folder)
2143 {
2146 /* these two should never be set on 32-bit setups */
2147 if (!is_win64)
2148 {
2149 BOOL is_wow64;
2151 if (!is_wow64) break;
2152 }
2153 /* fall through */
2154 default:
2155 RegSetValueExW(hKey, CSIDL_Data[folder].szValueName, 0, dwType,
2156 (LPBYTE)pszPath, (strlenW(pszPath)+1)*sizeof(WCHAR));
2157 }
2158 }
2159 else
2160 {
2161 pszPath[dwPathLen / sizeof(WCHAR)] = '\0';
2162 hr = S_OK;
2163 }
2165 }
2166 }
2167 TRACE("returning 0x%08x (output path is %s)\n", hr, debugstr_w(pszPath));
2168 return hr;
2169}
#define E_FAIL
Definition: ddrawi.h:102
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4911
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4132
LONG WINAPI RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1201
#define GetCurrentProcess()
Definition: compat.h:759
#define IsWow64Process
Definition: compat.h:760
BOOL is_wow64
Definition: msi.c:54
static const BOOL is_win64
Definition: shellpath.c:59
unsigned int BOOL
Definition: ntddk_ex.h:94
FxAutoRegKey hKey
#define REG_SZ
Definition: layer.c:22
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
#define strlenW(s)
Definition: unicode.h:28
#define CSIDL_PROGRAM_FILES_COMMONX86
Definition: shlobj.h:2201
#define CSIDL_PROGRAM_FILESX86
Definition: shlobj.h:2199
unsigned char * LPBYTE
Definition: typedefs.h:53

Referenced by SHGetFolderPathAndSubDirW().

◆ _SHGetDefaultValue()

static HRESULT _SHGetDefaultValue ( BYTE  folder,
LPWSTR  pszPath 
)
static

Definition at line 1986 of file shellpath.c.

1990{
1991 HRESULT hr;
1992 WCHAR resourcePath[MAX_PATH];
1993#ifdef __REACTOS__
1994 NT_PRODUCT_TYPE ProductType;
1995#endif
1996
1997 TRACE("0x%02x,%p\n", folder, pszPath);
1998
2000 return E_INVALIDARG;
2001
2002 if (!pszPath)
2003 return E_INVALIDARG;
2004
2005#ifdef __REACTOS__
2006 if (hToken != NULL && hToken != (HANDLE)-1)
2007 {
2008 FIXME("unsupported for user other than current or default\n");
2009 }
2010#endif
2011
2012 if (!is_win64)
2013 {
2014 BOOL is_wow64;
2015
2016 switch (folder)
2017 {
2022 break;
2027 break;
2028 }
2029 }
2030
2031 switch (CSIDL_Data[folder].type)
2032 {
2033 case CSIDL_Type_User:
2034 strcpyW(pszPath, L"%USERPROFILE%");
2035 break;
2036#ifdef __REACTOS__
2037 case CSIDL_Type_InMyDocuments:
2038 strcpyW(pszPath, L"%USERPROFILE%");
2039 if (DoGetProductType(&ProductType) && ProductType == NtProductWinNt)
2040 {
2041 if (IS_INTRESOURCE(CSIDL_Data[CSIDL_MYDOCUMENTS].szDefaultPath))
2042 {
2043 WCHAR szItem[MAX_PATH];
2045 LOWORD(CSIDL_Data[CSIDL_MYDOCUMENTS].szDefaultPath),
2046 szItem, ARRAY_SIZE(szItem));
2047 PathAppendW(pszPath, szItem);
2048 }
2049 else
2050 {
2051 PathAppendW(pszPath, CSIDL_Data[CSIDL_MYDOCUMENTS].szDefaultPath);
2052 }
2053 }
2054 break;
2055#endif
2057#ifndef __REACTOS__
2058 strcpyW(pszPath, L"%PUBLIC%");
2059#else
2060 strcpyW(pszPath, L"%ALLUSERSPROFILE%");
2061#endif
2062 break;
2063 case CSIDL_Type_CurrVer:
2064 strcpyW(pszPath, L"%SystemDrive%");
2065 break;
2066 default:
2067 ; /* no corresponding env. var, do nothing */
2068 }
2069
2070 hr = S_OK;
2071 if (CSIDL_Data[folder].szDefaultPath)
2072 {
2073 if (IS_INTRESOURCE(CSIDL_Data[folder].szDefaultPath))
2074 {
2076 LOWORD(CSIDL_Data[folder].szDefaultPath), resourcePath, MAX_PATH))
2077 {
2078 PathAppendW(pszPath, resourcePath);
2079 }
2080 else
2081 {
2082 ERR("(%d,%s), LoadString failed, missing translation?\n", folder,
2083 debugstr_w(pszPath));
2084 hr = E_FAIL;
2085 }
2086 }
2087 else
2088 {
2089 PathAppendW(pszPath, CSIDL_Data[folder].szDefaultPath);
2090 }
2091 }
2092 TRACE("returning 0x%08x\n", hr);
2093 return hr;
2094}
#define shell32_hInstance
#define FIXME(fmt,...)
Definition: debug.h:111
#define ERR(fmt,...)
Definition: debug.h:110
static BOOL DoGetProductType(PNT_PRODUCT_TYPE ProductType)
Definition: shellpath.c:71
#define LOWORD(l)
Definition: pedump.c:82
#define CSIDL_PROGRAM_FILES
Definition: shlobj.h:2195
#define CSIDL_MYDOCUMENTS
Definition: shlobj.h:2170
#define CSIDL_PROGRAM_FILES_COMMON
Definition: shlobj.h:2200
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define IS_INTRESOURCE(i)
Definition: winuser.h:580

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

◆ _SHGetProfilesValue()

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

Definition at line 2356 of file shellpath.c.

2358{
2359 HRESULT hr;
2360 DWORD type, dwPathLen = MAX_PATH * sizeof(WCHAR);
2361 LONG lRet;
2362
2363 TRACE("%p,%s,%p,%s\n", profilesKey, debugstr_w(szValueName), szValue,
2364 debugstr_w(szDefault));
2365 lRet = RegQueryValueExW(profilesKey, szValueName, NULL, &type,
2366 (LPBYTE)szValue, &dwPathLen);
2367 if (!lRet && (type == REG_SZ || type == REG_EXPAND_SZ) && dwPathLen
2368 && *szValue)
2369 {
2370 dwPathLen /= sizeof(WCHAR);
2371 szValue[dwPathLen] = '\0';
2372 hr = S_OK;
2373 }
2374 else
2375 {
2376 /* Missing or invalid value, set a default */
2377 lstrcpynW(szValue, szDefault, MAX_PATH);
2378 TRACE("Setting missing value %s to %s\n", debugstr_w(szValueName),
2379 debugstr_w(szValue));
2380 lRet = RegSetValueExW(profilesKey, szValueName, 0, REG_EXPAND_SZ,
2381 (LPBYTE)szValue,
2382 (strlenW(szValue) + 1) * sizeof(WCHAR));
2383 if (lRet)
2384 hr = HRESULT_FROM_WIN32(lRet);
2385 else
2386 hr = S_OK;
2387 }
2388 TRACE("returning 0x%08x (output value is %s)\n", hr, debugstr_w(szValue));
2389 return hr;
2390}
#define lstrcpynW
Definition: compat.h:738
long LONG
Definition: pedump.c:60

Referenced by _SHExpandEnvironmentStrings().

◆ _SHGetUserProfileDirectoryW()

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

Definition at line 1950 of file shellpath.c.

1951{
1952 BOOL result;
1953 if (!hToken)
1954 {
1956 result = GetUserProfileDirectoryW(hToken, szPath, lpcchPath);
1957 CloseHandle(hToken);
1958 }
1959 else if ((INT) hToken == -1)
1960 {
1962 }
1963 else
1964 {
1965 result = GetUserProfileDirectoryW(hToken, szPath, lpcchPath);
1966 }
1967 TRACE("_SHGetUserProfileDirectoryW returning %S\n", szPath);
1968 return result;
1969}
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:294
#define CloseHandle
Definition: compat.h:739
BOOL WINAPI GetDefaultUserProfileDirectoryW(_Out_opt_ LPWSTR lpProfileDir, _Inout_ LPDWORD lpcchSize)
Definition: profile.c:1443
BOOL WINAPI GetUserProfileDirectoryW(_In_ HANDLE hToken, _Out_opt_ LPWSTR lpProfileDir, _Inout_ LPDWORD lpcchSize)
Definition: profile.c:1792
GLuint64EXT * result
Definition: glext.h:11304
LPCWSTR szPath
Definition: env.c:37
int32_t INT
Definition: typedefs.h:58
#define TOKEN_QUERY
Definition: setypes.h:928

Referenced by _SHExpandEnvironmentStrings().

◆ _SHGetUserProfilePath()

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

Definition at line 2212 of file shellpath.c.

2214{
2215 const WCHAR *szValueName;
2216 WCHAR buffer[40];
2217 HRESULT hr;
2218
2219 TRACE("%p,0x%08x,0x%02x,%p\n", hToken, dwFlags, folder, pszPath);
2220
2222 return E_INVALIDARG;
2223#ifdef __REACTOS__
2225 CSIDL_Data[folder].type != CSIDL_Type_InMyDocuments)
2226#else
2228#endif
2229 {
2230 return E_INVALIDARG;
2231 }
2232 if (!pszPath)
2233 return E_INVALIDARG;
2234
2236 {
2237#ifndef __REACTOS__
2238 hr = _SHGetDefaultValue(folder, pszPath);
2239#else
2240 hr = _SHGetDefaultValue(hToken, folder, pszPath);
2241#endif
2242 }
2243 else
2244 {
2245 static const WCHAR DefaultW[] = L".Default";
2246 LPCWSTR userPrefix = NULL;
2247 HKEY hRootKey;
2248
2249 if (hToken == (HANDLE)-1)
2250 {
2251 hRootKey = HKEY_USERS;
2252 userPrefix = DefaultW;
2253 }
2254 else if (hToken == NULL)
2255 hRootKey = HKEY_CURRENT_USER;
2256 else
2257 {
2258 hRootKey = HKEY_USERS;
2259 userPrefix = _GetUserSidStringFromToken(hToken);
2260 if (userPrefix == NULL)
2261 {
2262 hr = E_FAIL;
2263 goto error;
2264 }
2265 }
2266
2267 /* For CSIDL_Type_User we also use the GUID if no szValueName is provided */
2268 szValueName = CSIDL_Data[folder].szValueName;
2269 if (!szValueName)
2270 {
2272 szValueName = &buffer[0];
2273 }
2274
2275#ifndef __REACTOS__
2276 hr = _SHGetUserShellFolderPath(hRootKey, userPrefix, szValueName, pszPath);
2277 if (FAILED(hr) && hRootKey != HKEY_LOCAL_MACHINE)
2278 hr = _SHGetUserShellFolderPath(HKEY_LOCAL_MACHINE, NULL, szValueName, pszPath);
2279 if (FAILED(hr))
2280 hr = _SHGetDefaultValue(folder, pszPath);
2281#else
2282 hr = _SHGetUserShellFolderPath(hRootKey, hToken, userPrefix, szValueName, pszPath);
2283 if (FAILED(hr) && hRootKey != HKEY_LOCAL_MACHINE)
2284 hr = _SHGetUserShellFolderPath(HKEY_LOCAL_MACHINE, hToken, NULL, szValueName, pszPath);
2285 if (FAILED(hr))
2286 hr = _SHGetDefaultValue(hToken, folder, pszPath);
2287#endif
2288 if (userPrefix != NULL && userPrefix != DefaultW)
2289 LocalFree((HLOCAL) userPrefix);
2290 }
2291error:
2292 TRACE("returning 0x%08x (output path is %s)\n", hr, debugstr_w(pszPath));
2293 return hr;
2294}
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2434
static LPWSTR _GetUserSidStringFromToken(HANDLE Token)
Definition: shellpath.c:2171
GLuint buffer
Definition: glext.h:5915
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
#define error(str)
Definition: mkdosfs.c:1605
LPCWSTR szValueName
Definition: shellpath.c:1075
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define HKEY_USERS
Definition: winreg.h:13
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by _SHRegisterFolders(), and SHGetFolderPathAndSubDirW().

◆ _SHGetUserShellFolderPath()

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

Definition at line 1867 of file shellpath.c.

1872{
1873 HRESULT hr;
1874 WCHAR shellFolderPath[MAX_PATH], userShellFolderPath[MAX_PATH];
1875 LPCWSTR pShellFolderPath, pUserShellFolderPath;
1876 HKEY userShellFolderKey, shellFolderKey;
1877 DWORD dwType, dwPathLen;
1878
1879 TRACE("%p,%s,%s,%p\n",rootKey, debugstr_w(userPrefix), debugstr_w(value),
1880 path);
1881
1882 if (userPrefix)
1883 {
1884 strcpyW(shellFolderPath, userPrefix);
1885 PathAddBackslashW(shellFolderPath);
1886 strcatW(shellFolderPath, szSHFolders);
1887 pShellFolderPath = shellFolderPath;
1888 strcpyW(userShellFolderPath, userPrefix);
1889 PathAddBackslashW(userShellFolderPath);
1890 strcatW(userShellFolderPath, szSHUserFolders);
1891 pUserShellFolderPath = userShellFolderPath;
1892 }
1893 else
1894 {
1895 pUserShellFolderPath = szSHUserFolders;
1896 pShellFolderPath = szSHFolders;
1897 }
1898
1899 if (RegCreateKeyW(rootKey, pShellFolderPath, &shellFolderKey))
1900 {
1901 TRACE("Failed to create %s\n", debugstr_w(pShellFolderPath));
1902 return E_FAIL;
1903 }
1904 if (RegCreateKeyW(rootKey, pUserShellFolderPath, &userShellFolderKey))
1905 {
1906 TRACE("Failed to create %s\n",
1907 debugstr_w(pUserShellFolderPath));
1908 RegCloseKey(shellFolderKey);
1909 return E_FAIL;
1910 }
1911
1912 dwPathLen = MAX_PATH * sizeof(WCHAR);
1913 if (!RegQueryValueExW(userShellFolderKey, value, NULL, &dwType,
1914 (LPBYTE)path, &dwPathLen) && (dwType == REG_EXPAND_SZ || dwType == REG_SZ))
1915 {
1916 LONG ret;
1917
1918 path[dwPathLen / sizeof(WCHAR)] = '\0';
1919 if (dwType == REG_EXPAND_SZ && path[0] == '%')
1920 {
1921 WCHAR szTemp[MAX_PATH];
1922
1923#ifndef __REACTOS__
1925#else
1926 hr = _SHExpandEnvironmentStrings(hToken, path, szTemp, _countof(szTemp));
1927 if (FAILED(hr))
1928 goto end;
1929#endif
1930 lstrcpynW(path, szTemp, MAX_PATH);
1931 }
1932 ret = RegSetValueExW(shellFolderKey, value, 0, REG_SZ, (LPBYTE)path,
1933 (strlenW(path) + 1) * sizeof(WCHAR));
1934 if (ret != ERROR_SUCCESS)
1936 else
1937 hr = S_OK;
1938 }
1939 else
1940 hr = E_FAIL;
1941#ifdef __REACTOS__
1942end:
1943#endif
1944 RegCloseKey(shellFolderKey);
1945 RegCloseKey(userShellFolderKey);
1946 TRACE("returning 0x%08x\n", hr);
1947 return hr;
1948}
#define ERROR_SUCCESS
Definition: deptool.c:10
static const WCHAR szSHUserFolders[]
Definition: shellpath.c:1041
static HRESULT _SHExpandEnvironmentStrings(LPCWSTR szSrc, LPWSTR szDest)
Definition: shellpath.c:2406
static const WCHAR szSHFolders[]
Definition: shellpath.c:1040
#define PathAddBackslashW
Definition: pathcch.h:301
#define strcatW(d, s)
Definition: unicode.h:30
#define _countof(array)
Definition: sndvol32.h:68
Definition: pdh_main.c:94

Referenced by _SHGetAllUsersProfilePath(), and _SHGetUserProfilePath().

◆ _SHOpenProfilesKey()

static HRESULT _SHOpenProfilesKey ( PHKEY  pKey)
static

Definition at line 2341 of file shellpath.c.

2342{
2343 LONG lRet;
2344 DWORD disp;
2345
2346 lRet = RegCreateKeyExW(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList", 0, NULL, 0,
2347 KEY_ALL_ACCESS, NULL, pKey, &disp);
2348 return HRESULT_FROM_WIN32(lRet);
2349}
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1096
FxRegKey * pKey
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041

Referenced by _SHExpandEnvironmentStrings().

◆ _SHRegisterCommonShellFolders()

static HRESULT _SHRegisterCommonShellFolders ( void  )
static

Definition at line 3005 of file shellpath.c.

3006{
3007 static const UINT folders[] = {
3020 };
3021 HRESULT hr;
3022
3023 TRACE("\n");
3025 szSHFolders, folders, ARRAY_SIZE(folders));
3026 TRACE("returning 0x%08x\n", hr);
3027 return hr;
3028}
static HRESULT _SHRegisterFolders(HKEY hRootKey, HANDLE hToken, LPCWSTR szUserShellFolderPath, LPCWSTR szShellFolderPath, const UINT folders[], UINT foldersLen)
Definition: shellpath.c:2835
unsigned int UINT
Definition: ndis.h:50
#define CSIDL_COMMON_TEMPLATES
Definition: shlobj.h:2202
#define CSIDL_COMMON_DESKTOPDIRECTORY
Definition: shlobj.h:2182
#define CSIDL_COMMON_STARTMENU
Definition: shlobj.h:2179
#define CSIDL_COMMON_APPDATA
Definition: shlobj.h:2192
#define CSIDL_COMMON_PROGRAMS
Definition: shlobj.h:2180
#define CSIDL_COMMON_FAVORITES
Definition: shlobj.h:2188
#define CSIDL_COMMON_MUSIC
Definition: shlobj.h:2207
#define CSIDL_COMMON_VIDEO
Definition: shlobj.h:2209
#define CSIDL_COMMON_PICTURES
Definition: shlobj.h:2208
#define CSIDL_COMMON_STARTUP
Definition: shlobj.h:2181
#define CSIDL_COMMON_DOCUMENTS
Definition: shlobj.h:2203
#define CSIDL_COMMON_ADMINTOOLS
Definition: shlobj.h:2204

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

2838{
2839 const WCHAR *szValueName;
2840 WCHAR buffer[40];
2841 UINT i;
2843 HRESULT hr = S_OK;
2844 HKEY hUserKey = NULL, hKey = NULL;
2845 DWORD dwType, dwPathLen;
2846 LONG ret;
2847
2848 TRACE("%p,%p,%s,%p,%u\n", hRootKey, hToken,
2849 debugstr_w(szUserShellFolderPath), folders, foldersLen);
2850
2851 ret = RegCreateKeyW(hRootKey, szUserShellFolderPath, &hUserKey);
2852 if (ret)
2854 else
2855 {
2856 ret = RegCreateKeyW(hRootKey, szShellFolderPath, &hKey);
2857 if (ret)
2859 }
2860 for (i = 0; SUCCEEDED(hr) && i < foldersLen; i++)
2861 {
2862 dwPathLen = MAX_PATH * sizeof(WCHAR);
2863
2864 /* For CSIDL_Type_User we also use the GUID if no szValueName is provided */
2865 szValueName = CSIDL_Data[folders[i]].szValueName;
2866#ifdef __REACTOS__
2867 if (!szValueName &&
2868 (CSIDL_Data[folders[i]].type == CSIDL_Type_User ||
2869 CSIDL_Data[folders[i]].type == CSIDL_Type_InMyDocuments))
2870#else
2871 if (!szValueName && CSIDL_Data[folders[i]].type == CSIDL_Type_User)
2872#endif
2873 {
2874 StringFromGUID2( CSIDL_Data[folders[i]].id, buffer, 39 );
2875 szValueName = &buffer[0];
2876 }
2877
2878 if (!RegQueryValueExW(hUserKey, szValueName, NULL,
2879 &dwType, (LPBYTE)path, &dwPathLen) &&
2880 (dwType == REG_SZ || dwType == REG_EXPAND_SZ))
2881 {
2883 hToken, SHGFP_TYPE_CURRENT, path);
2884 }
2885 else
2886 {
2887 *path = '\0';
2888#ifdef __REACTOS__
2889 if (CSIDL_Data[folders[i]].type == CSIDL_Type_User ||
2890 CSIDL_Data[folders[i]].type == CSIDL_Type_InMyDocuments)
2891#else
2892 if (CSIDL_Data[folders[i]].type == CSIDL_Type_User)
2893#endif
2894 _SHGetUserProfilePath(hToken, SHGFP_TYPE_CURRENT, folders[i],
2895 path);
2896 else if (CSIDL_Data[folders[i]].type == CSIDL_Type_AllUsers)
2898 else if (CSIDL_Data[folders[i]].type == CSIDL_Type_WindowsPath)
2899 {
2901 if (CSIDL_Data[folders[i]].szDefaultPath &&
2902 !IS_INTRESOURCE(CSIDL_Data[folders[i]].szDefaultPath))
2903 {
2905 strcatW(path, CSIDL_Data[folders[i]].szDefaultPath);
2906 }
2907 }
2908 else
2909 hr = E_FAIL;
2910 if (*path)
2911 {
2912 ret = RegSetValueExW(hUserKey, szValueName, 0, REG_EXPAND_SZ,
2913 (LPBYTE)path, (strlenW(path) + 1) * sizeof(WCHAR));
2914 if (ret)
2916 else
2917 {
2919 hToken, SHGFP_TYPE_CURRENT, path);
2920 ret = RegSetValueExW(hKey, szValueName, 0, REG_SZ,
2921 (LPBYTE)path, (strlenW(path) + 1) * sizeof(WCHAR));
2922 if (ret)
2924 }
2925 }
2926 }
2927 }
2928 if (hUserKey)
2929 RegCloseKey(hUserKey);
2930 if (hKey)
2932
2933 TRACE("returning 0x%08x\n", hr);
2934 return hr;
2935}
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2352
HRESULT WINAPI SHGetFolderPathW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath)
Definition: shellpath.c:2558
static HRESULT _SHGetAllUsersProfilePath(DWORD dwFlags, BYTE folder, LPWSTR pszPath)
Definition: shellpath.c:2301
static HRESULT _SHGetUserProfilePath(HANDLE hToken, DWORD dwFlags, BYTE folder, LPWSTR pszPath)
Definition: shellpath.c:2212
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define CSIDL_FLAG_CREATE
@ SHGFP_TYPE_CURRENT
Definition: shlobj.h:2134

Referenced by _SHRegisterCommonShellFolders(), and _SHRegisterUserShellFolders().

◆ _SHRegisterUserShellFolders()

static HRESULT _SHRegisterUserShellFolders ( BOOL  bDefault)
static

Definition at line 2937 of file shellpath.c.

2938{
2939 static const UINT folders[] = {
2961/* Cannot use #if _WIN32_WINNT >= 0x0600 because _WIN32_WINNT == 0x0600 here. */
2962#ifndef __REACTOS__
2969#endif
2970 };
2971 WCHAR userShellFolderPath[MAX_PATH], shellFolderPath[MAX_PATH];
2972 LPCWSTR pUserShellFolderPath, pShellFolderPath;
2973 HRESULT hr = S_OK;
2974 HKEY hRootKey;
2975 HANDLE hToken;
2976
2977 TRACE("%s\n", bDefault ? "TRUE" : "FALSE");
2978 if (bDefault)
2979 {
2980 hToken = (HANDLE)-1;
2981 hRootKey = HKEY_USERS;
2982 strcpyW(userShellFolderPath, L".Default");
2983 PathAddBackslashW(userShellFolderPath);
2984 strcatW(userShellFolderPath, szSHUserFolders);
2985 pUserShellFolderPath = userShellFolderPath;
2986 strcpyW(shellFolderPath, L".Default");
2987 PathAddBackslashW(shellFolderPath);
2988 strcatW(shellFolderPath, szSHFolders);
2989 pShellFolderPath = shellFolderPath;
2990 }
2991 else
2992 {
2993 hToken = NULL;
2994 hRootKey = HKEY_CURRENT_USER;
2995 pUserShellFolderPath = szSHUserFolders;
2996 pShellFolderPath = szSHFolders;
2997 }
2998
2999 hr = _SHRegisterFolders(hRootKey, hToken, pUserShellFolderPath,
3000 pShellFolderPath, folders, ARRAY_SIZE(folders));
3001 TRACE("returning 0x%08x\n", hr);
3002 return hr;
3003}
#define CSIDL_LINKS
Definition: shellpath.c:1065
#define CSIDL_APPDATA_LOCALLOW
Definition: shellpath.c:1066
#define CSIDL_DOWNLOADS
Definition: shellpath.c:1064
#define CSIDL_SEARCHES
Definition: shellpath.c:1068
#define CSIDL_SAVED_GAMES
Definition: shellpath.c:1067
#define CSIDL_CONTACTS
Definition: shellpath.c:1063
#define CSIDL_TEMPLATES
Definition: shlobj.h:2178
#define CSIDL_INTERNET_CACHE
Definition: shlobj.h:2189
#define CSIDL_DESKTOPDIRECTORY
Definition: shlobj.h:2173
#define CSIDL_SENDTO
Definition: shlobj.h:2167
#define CSIDL_RECENT
Definition: shlobj.h:2166
#define CSIDL_ADMINTOOLS
Definition: shlobj.h:2205
#define CSIDL_FONTS
Definition: shlobj.h:2177
#define CSIDL_PERSONAL
Definition: shlobj.h:2163
#define CSIDL_FAVORITES
Definition: shlobj.h:2164
#define CSIDL_MYPICTURES
Definition: shlobj.h:2196
#define CSIDL_COOKIES
Definition: shlobj.h:2190
#define CSIDL_HISTORY
Definition: shlobj.h:2191
#define CSIDL_LOCAL_APPDATA
Definition: shlobj.h:2185
#define CSIDL_STARTMENU
Definition: shlobj.h:2169
#define CSIDL_PROGRAMS
Definition: shlobj.h:2160
#define CSIDL_APPDATA
Definition: shlobj.h:2183
#define CSIDL_PRINTHOOD
Definition: shlobj.h:2184
#define CSIDL_STARTUP
Definition: shlobj.h:2165
#define CSIDL_MYMUSIC
Definition: shlobj.h:2171
#define CSIDL_NETHOOD
Definition: shlobj.h:2176
#define CSIDL_MYVIDEO
Definition: shlobj.h:2172
PVOID HANDLE
Definition: typedefs.h:73

Referenced by SHELL_RegisterShellFolders().

◆ DoGetProductType()

static BOOL DoGetProductType ( PNT_PRODUCT_TYPE  ProductType)
static

Definition at line 71 of file shellpath.c.

72{
73 HKEY hKey;
74 LONG error;
75 WCHAR szValue[9];
76 DWORD cbValue;
77 static DWORD s_dwProductType = 0;
78
79 if (s_dwProductType != 0)
80 {
81 *ProductType = s_dwProductType;
82 return TRUE;
83 }
84
85 *ProductType = NtProductServer;
86
87 error = RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\ProductOptions", 0, KEY_READ, &hKey);
88 if (error)
89 return FALSE;
90
91 cbValue = sizeof(szValue);
92 error = RegGetValueW(hKey, NULL, L"ProductType", RRF_RT_REG_SZ, NULL, (PVOID)szValue, &cbValue);
93 if (!error)
94 {
95 if (lstrcmpW(szValue, L"WinNT") == 0)
96 *ProductType = NtProductWinNt;
97 else if (lstrcmpW(szValue, L"LanmanNT") == 0)
98 *ProductType = NtProductLanManNt;
99 }
100
101 s_dwProductType = *ProductType;
102
104 return TRUE;
105}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3362
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:1969
#define RRF_RT_REG_SZ
Definition: driver.c:575
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
#define KEY_READ
Definition: nt_native.h:1023

Referenced by _SHGetDefaultValue().

◆ IsLFNDriveA()

BOOL WINAPI IsLFNDriveA ( LPCSTR  lpszPath)

Definition at line 581 of file shellpath.c.

582{
583 WCHAR szBuffW[MAX_PATH], *pszW = NULL;
584 if (lpszPath)
585 {
586 SHAnsiToUnicode(lpszPath, szBuffW, _countof(szBuffW));
587 pszW = szBuffW;
588 }
589 return IsLFNDriveW(pszW);
590}
BOOL WINAPI IsLFNDriveW(LPCWSTR lpszPath)
Definition: shellpath.c:595
DWORD WINAPI SHAnsiToUnicode(LPCSTR lpSrcStr, LPWSTR lpDstStr, int iLen)
Definition: string.c:2659

Referenced by IsLFNDriveAW().

◆ IsLFNDriveAW()

BOOL WINAPI IsLFNDriveAW ( LPCVOID  lpszPath)

Definition at line 645 of file shellpath.c.

646{
647 if (SHELL_OsIsUnicode())
648 return IsLFNDriveW(lpszPath);
649 return IsLFNDriveA(lpszPath);
650}
BOOL WINAPI IsLFNDriveA(LPCSTR lpszPath)
Definition: shellpath.c:581
static __inline BOOL SHELL_OsIsUnicode(void)
Definition: shell32_main.h:140

◆ IsLFNDriveW()

BOOL WINAPI IsLFNDriveW ( LPCWSTR  lpszPath)

Definition at line 595 of file shellpath.c.

596{
597 DWORD cchMaxFileName, iDrive;
598 WCHAR szRoot[MAX_PATH];
599
600 if (lpszPath == NULL || lpszPath[0] == UNICODE_NULL)
601 {
602 szRoot[0] = 0;
603 GetWindowsDirectoryW(szRoot, _countof(szRoot));
604 lpszPath = szRoot;
605 }
606
607 if (PathIsUNCW(lpszPath))
608 {
609 StringCchCopyW(szRoot, _countof(szRoot), lpszPath);
610 PathStripToRootW(szRoot);
611
612 if (StrChrW(szRoot + 2, L'\\') == NULL)
613 return TRUE; /* LFN */
614
615 StringCchCatW(szRoot, _countof(szRoot), L"\\"); /* Add a backslash */
616 }
617 else
618 {
619 assert(!PathIsRelativeW(lpszPath)); /* Assuming absolute path... */
620
621 iDrive = ((lpszPath[0] - L'A') & 0x1F);
622 PathBuildRootW(szRoot, iDrive);
623
624 if (!IsRemovableDrive(iDrive))
625 {
626 /* FIXME: Cache correctly */
627 }
628 }
629
630#define MSDOS_8DOT3_LEN 12 /* MS-DOS 8.3 filename == length 12 */
631
632 /* GetVolumeInformation requires a root path */
633 if (!GetVolumeInformationW(szRoot, NULL, 0, NULL, &cchMaxFileName, NULL, NULL, 0))
634 {
635 /* Don't return FALSE when GetVolumeInformationW fails. */
636 return TRUE;
637 }
638
639 return cchMaxFileName > MSDOS_8DOT3_LEN;
640}
LPWSTR WINAPI StrChrW(LPCWSTR lpszStr, WCHAR ch)
Definition: string.c:468
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
BOOL APIENTRY IsRemovableDrive(DWORD iDrive)
Definition: shellpath.c:107
#define MSDOS_8DOT3_LEN
BOOL WINAPI PathStripToRootW(LPWSTR lpszPath)
Definition: path.c:733
LPWSTR WINAPI PathBuildRootW(LPWSTR lpszPath, int drive)
Definition: path.c:348
BOOL WINAPI PathIsUNCW(LPCWSTR lpszPath)
Definition: path.c:2266
BOOL WINAPI PathIsRelativeW(LPCWSTR lpszPath)
Definition: path.c:1579
#define assert(x)
Definition: debug.h:53
#define UNICODE_NULL
STRSAFEAPI StringCchCatW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:325
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149

Referenced by IsLFNDriveA(), IsLFNDriveAW(), and PathQualifyExW().

◆ IsRemovableDrive()

BOOL APIENTRY IsRemovableDrive ( DWORD  iDrive)

Definition at line 107 of file shellpath.c.

108{
109 WCHAR szRoot[] = L"C:\\";
110 assert(L'A' + iDrive <= L'Z');
111 szRoot[0] = (WCHAR)(L'A' + iDrive);
112 return GetDriveTypeW(szRoot) == DRIVE_REMOVABLE;
113}
UINT WINAPI GetDriveTypeW(IN LPCWSTR lpRootPathName)
Definition: disk.c:497
#define DRIVE_REMOVABLE
Definition: winbase.h:251

Referenced by IsLFNDriveW().

◆ PathAppendAW()

BOOL WINAPI PathAppendAW ( LPVOID  lpszPath1,
LPCVOID  lpszPath2 
)

Definition at line 411 of file shellpath.c.

414{
415 if (SHELL_OsIsUnicode())
416 return PathAppendW(lpszPath1, lpszPath2);
417 return PathAppendA(lpszPath1, lpszPath2);
418}
#define PathAppendA
Definition: pathcch.h:308

◆ PathCleanupSpec()

int WINAPI PathCleanupSpec ( LPCWSTR  lpszPathW,
LPWSTR  lpszFileW 
)

Definition at line 742 of file shellpath.c.

743{
744 int i = 0;
745 DWORD rc = 0;
746 int length = 0;
747
748 if (SHELL_OsIsUnicode())
749 {
750 LPWSTR p = lpszFileW;
751
752 TRACE("Cleanup %s\n",debugstr_w(lpszFileW));
753
754 if (lpszPathW)
755 length = strlenW(lpszPathW);
756
757 while (*p)
758 {
759 int gct = PathGetCharTypeW(*p);
760 if (gct == GCT_INVALID || gct == GCT_WILD || gct == GCT_SEPARATOR)
761 {
762 lpszFileW[i]='-';
763 rc |= PCS_REPLACEDCHAR;
764 }
765 else
766 lpszFileW[i]=*p;
767 i++;
768 p++;
769 if (length + i == MAX_PATH)
770 {
772 break;
773 }
774 }
775 lpszFileW[i]=0;
776 }
777 else
778 {
779 LPSTR lpszFileA = (LPSTR)lpszFileW;
780 LPCSTR lpszPathA = (LPCSTR)lpszPathW;
781 LPSTR p = lpszFileA;
782
783 TRACE("Cleanup %s\n",debugstr_a(lpszFileA));
784
785 if (lpszPathA)
786 length = strlen(lpszPathA);
787
788 while (*p)
789 {
790 int gct = PathGetCharTypeA(*p);
791 if (gct == GCT_INVALID || gct == GCT_WILD || gct == GCT_SEPARATOR)
792 {
793 lpszFileA[i]='-';
794 rc |= PCS_REPLACEDCHAR;
795 }
796 else
797 lpszFileA[i]=*p;
798 i++;
799 p++;
800 if (length + i == MAX_PATH)
801 {
803 break;
804 }
805 }
806 lpszFileA[i]=0;
807 }
808 return rc;
809}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
UINT WINAPI PathGetCharTypeA(UCHAR ch)
Definition: path.c:3026
UINT WINAPI PathGetCharTypeW(WCHAR ch)
Definition: path.c:3036
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
GLfloat GLfloat p
Definition: glext.h:8902
#define debugstr_a
Definition: kernel32.h:31
#define PCS_REPLACEDCHAR
Definition: shlobj.h:360
#define PCS_PATHTOOLONG
Definition: shlobj.h:363
#define PCS_FATAL
Definition: shlobj.h:359
#define GCT_SEPARATOR
Definition: shlwapi.h:779
#define GCT_INVALID
Definition: shlwapi.h:775
#define GCT_WILD
Definition: shlwapi.h:778
const char * LPCSTR
Definition: xmlstorage.h:183
char * LPSTR
Definition: xmlstorage.h:182

Referenced by FinishDlgProc().

◆ PathFileExistsAW()

BOOL WINAPI PathFileExistsAW ( LPCVOID  lpszPath)

Definition at line 571 of file shellpath.c.

572{
573 if (SHELL_OsIsUnicode())
574 return PathFileExistsW (lpszPath);
575 return PathFileExistsA (lpszPath);
576}
BOOL WINAPI PathFileExistsA(LPCSTR lpszPath)
Definition: path.c:1755
BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath)
Definition: path.c:1777

◆ PathGetExtensionA()

static LPSTR PathGetExtensionA ( LPCSTR  lpszPath)
static

Definition at line 427 of file shellpath.c.

428{
429 TRACE("(%s)\n",lpszPath);
430
431 lpszPath = PathFindExtensionA(lpszPath);
432 return (LPSTR)(*lpszPath?(lpszPath+1):lpszPath);
433}
LPSTR WINAPI PathFindExtensionA(LPCSTR lpszPath)
Definition: path.c:422

Referenced by PathIsExeA().

◆ PathGetExtensionW()

static LPWSTR PathGetExtensionW ( LPCWSTR  lpszPath)
static

Definition at line 438 of file shellpath.c.

439{
440 TRACE("(%s)\n",debugstr_w(lpszPath));
441
442 lpszPath = PathFindExtensionW(lpszPath);
443 return (LPWSTR)(*lpszPath?(lpszPath+1):lpszPath);
444}
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
Definition: path.c:447

Referenced by PathIsExeW(), and SHPathGetExtensionW().

◆ PathGetShortPathA()

static void PathGetShortPathA ( LPSTR  pszPath)
static

Definition at line 471 of file shellpath.c.

472{
474
475 TRACE("%s\n", pszPath);
476
477 if (GetShortPathNameA(pszPath, path, MAX_PATH))
478 {
479 lstrcpyA(pszPath, path);
480 }
481}
DWORD WINAPI GetShortPathNameA(IN LPCSTR lpszLongPath, OUT LPSTR lpszShortPath, IN DWORD cchBuffer)
Definition: path.c:1752
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
char CHAR
Definition: xmlstorage.h:175

Referenced by PathGetShortPathAW().

◆ PathGetShortPathAW()

VOID WINAPI PathGetShortPathAW ( LPVOID  pszPath)

Definition at line 501 of file shellpath.c.

502{
504 PathGetShortPathW(pszPath);
505 PathGetShortPathA(pszPath);
506}
static void PathGetShortPathA(LPSTR pszPath)
Definition: shellpath.c:471
static void PathGetShortPathW(LPWSTR pszPath)
Definition: shellpath.c:486

◆ PathGetShortPathW()

static void PathGetShortPathW ( LPWSTR  pszPath)
static

Definition at line 486 of file shellpath.c.

487{
489
490 TRACE("%s\n", debugstr_w(pszPath));
491
492 if (GetShortPathNameW(pszPath, path, MAX_PATH))
493 {
494 lstrcpyW(pszPath, path);
495 }
496}
#define lstrcpyW
Definition: compat.h:749
DWORD WINAPI GetShortPathNameW(IN LPCWSTR lpszLongPath, OUT LPWSTR lpszShortPath, IN DWORD cchBuffer)
Definition: path.c:1833

Referenced by PathGetShortPathAW().

◆ PathIsAbsoluteW()

static BOOL WINAPI PathIsAbsoluteW ( _In_ LPCWSTR  path)
static

Definition at line 136 of file shellpath.c.

137{
138 return PathIsUNCW(path) || (PathGetDriveNumberW(path) != -1 && path[2] == L'\\');
139}
int WINAPI PathGetDriveNumberW(const WCHAR *path)
Definition: path.c:553

Referenced by PathResolveW().

◆ PathIsExeA()

static BOOL PathIsExeA ( LPCSTR  lpszPath)
static

Definition at line 525 of file shellpath.c.

526{
527 LPCSTR lpszExtension = PathGetExtensionA(lpszPath);
528 int i;
529 static const char * const lpszExtensions[] =
530 {"exe", "com", "pif", "cmd", "bat", "scf", "scr", NULL };
531
532 TRACE("path=%s\n",lpszPath);
533
534 for(i=0; lpszExtensions[i]; i++)
535 if (!lstrcmpiA(lpszExtension,lpszExtensions[i])) return TRUE;
536
537 return FALSE;
538}
static LPSTR PathGetExtensionA(LPCSTR lpszPath)
Definition: shellpath.c:427
int WINAPI lstrcmpiA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:42

Referenced by PathIsExeAW().

◆ PathIsExeAW()

BOOL WINAPI PathIsExeAW ( LPCVOID  path)

Definition at line 561 of file shellpath.c.

562{
563 if (SHELL_OsIsUnicode())
564 return PathIsExeW (path);
565 return PathIsExeA(path);
566}
static BOOL PathIsExeA(LPCSTR lpszPath)
Definition: shellpath.c:525
BOOL PathIsExeW(LPCWSTR lpszPath)
Definition: shellpath.c:543

◆ PathIsExeW()

BOOL PathIsExeW ( LPCWSTR  lpszPath)

Definition at line 543 of file shellpath.c.

544{
545 LPCWSTR lpszExtension = PathGetExtensionW(lpszPath);
546 int i;
547 static const WCHAR lpszExtensions[][4] =
548 {L"exe", L"com", L"pif", L"cmd", L"bat", L"scf", L"scr", L"" };
549
550 TRACE("path=%s\n",debugstr_w(lpszPath));
551
552 for(i=0; lpszExtensions[i][0]; i++)
553 if (!wcsicmp(lpszExtension,lpszExtensions[i])) return TRUE;
554
555 return FALSE;
556}
#define wcsicmp
Definition: compat.h:15
static LPWSTR PathGetExtensionW(LPCWSTR lpszPath)
Definition: shellpath.c:438

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

◆ PathIsRootAW()

BOOL WINAPI PathIsRootAW ( LPCVOID  lpszPath)

Definition at line 515 of file shellpath.c.

516{
517 if (SHELL_OsIsUnicode())
518 return PathIsRootW(lpszPath);
519 return PathIsRootA(lpszPath);
520}
BOOL WINAPI PathIsRootW(LPCWSTR lpszPath)
Definition: path.c:1642
BOOL WINAPI PathIsRootA(LPCSTR lpszPath)
Definition: path.c:1602

◆ PathMakeAbsoluteW()

static BOOL WINAPI PathMakeAbsoluteW ( _Inout_ LPWSTR  path)
static

Definition at line 141 of file shellpath.c.

142{
144 DWORD cch;
145
146 if (path == NULL)
147 return FALSE;
149 if (!cch || cch > _countof(path1))
150 return FALSE;
151 return (PathCombineW(path, path1, path) != NULL);
152}
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:756
static DWORD DWORD void LPSTR DWORD cch
Definition: str.c:202
static const WCHAR path1[]
Definition: path.c:28
#define PathCombineW
Definition: pathcch.h:317

Referenced by PathResolveW().

◆ PathMakeUniqueNameA()

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

Definition at line 658 of file shellpath.c.

664{
665 FIXME("%p %u %s %s %s stub\n",
666 lpszBuffer, dwBuffSize, debugstr_a(lpszShortName),
667 debugstr_a(lpszLongName), debugstr_a(lpszPathName));
668 return TRUE;
669}

Referenced by PathMakeUniqueNameAW().

◆ PathMakeUniqueNameAW()

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

Definition at line 690 of file shellpath.c.

696{
697 if (SHELL_OsIsUnicode())
698 return PathMakeUniqueNameW(lpszBuffer,dwBuffSize, lpszShortName,lpszLongName,lpszPathName);
699 return PathMakeUniqueNameA(lpszBuffer,dwBuffSize, lpszShortName,lpszLongName,lpszPathName);
700}
static BOOL PathMakeUniqueNameW(LPWSTR lpszBuffer, DWORD dwBuffSize, LPCWSTR lpszShortName, LPCWSTR lpszLongName, LPCWSTR lpszPathName)
Definition: shellpath.c:674
static BOOL PathMakeUniqueNameA(LPSTR lpszBuffer, DWORD dwBuffSize, LPCSTR lpszShortName, LPCSTR lpszLongName, LPCSTR lpszPathName)
Definition: shellpath.c:658

◆ PathMakeUniqueNameW()

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

Definition at line 674 of file shellpath.c.

680{
681 FIXME("%p %u %s %s %s stub\n",
682 lpszBuffer, dwBuffSize, debugstr_w(lpszShortName),
683 debugstr_w(lpszLongName), debugstr_w(lpszPathName));
684 return TRUE;
685}

Referenced by PathMakeUniqueNameAW().

◆ PathProcessCommandA()

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

Definition at line 977 of file shellpath.c.

982{
983 FIXME("%s %p 0x%04x 0x%04x stub\n",
984 lpszPath, lpszBuff, dwBuffSize, dwFlags);
985 if(!lpszPath) return -1;
986 if(lpszBuff) strcpy(lpszBuff, lpszPath);
987 return strlen(lpszPath);
988}
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 1009 of file shellpath.c.

1014{
1015 if (SHELL_OsIsUnicode())
1016 return PathProcessCommandW(lpszPath, lpszBuff, dwBuffSize, dwFlags);
1017 return PathProcessCommandA(lpszPath, lpszBuff, dwBuffSize, dwFlags);
1018}
static LONG PathProcessCommandW(LPCWSTR lpszPath, LPWSTR lpszBuff, DWORD dwBuffSize, DWORD dwFlags)
Definition: shellpath.c:993
static LONG PathProcessCommandA(LPCSTR lpszPath, LPSTR lpszBuff, DWORD dwBuffSize, DWORD dwFlags)
Definition: shellpath.c:977

◆ PathProcessCommandW()

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

Definition at line 993 of file shellpath.c.

998{
999 FIXME("(%s, %p, 0x%04x, 0x%04x) stub\n",
1000 debugstr_w(lpszPath), lpszBuff, dwBuffSize, dwFlags);
1001 if(!lpszPath) return -1;
1002 if(lpszBuff) strcpyW(lpszBuff, lpszPath);
1003 return strlenW(lpszPath);
1004}

Referenced by PathProcessCommandAW().

◆ PathQualifyA()

VOID WINAPI PathQualifyA ( LPSTR  pszPath)

Definition at line 814 of file shellpath.c.

815{
817 TRACE("%s\n",pszPath);
821}
VOID WINAPI PathQualifyW(LPWSTR pszPath)
Definition: shellpath.c:826
INT WINAPI SHUnicodeToAnsi(LPCWSTR lpSrcStr, LPSTR lpDstStr, INT iLen)
Definition: string.c:2783

Referenced by PathQualifyAW().

◆ PathQualifyAW()

VOID WINAPI PathQualifyAW ( LPVOID  pszPath)

Definition at line 835 of file shellpath.c.

836{
837 if (SHELL_OsIsUnicode())
838 PathQualifyW(pszPath);
839 else
840 PathQualifyA(pszPath);
841}
VOID WINAPI PathQualifyA(LPSTR pszPath)
Definition: shellpath.c:814

◆ PathQualifyExW()

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

Definition at line 158 of file shellpath.c.

159{
160 INT iDrive, cchPathLeft;
161 WCHAR szTemp[MAX_PATH], szRoot[MAX_PATH];
162 PWCHAR pchTemp = szTemp, pchPath;
163 BOOL bLFN;
164
165 TRACE("(%s,%s,0x%08x)\n", debugstr_w(pszPath), debugstr_w(pszDir), dwFlags);
166
167 /* Save pszPath path into szTemp for rebuilding the path later */
168 if (FAILED(StringCchCopyW(szTemp, _countof(szTemp), pszPath)))
169 return;
170
171 /* Replace every '/' by '\' */
172 FixSlashesAndColonW(szTemp);
173
174 cchPathLeft = MAX_PATH;
175
176 /* Build the root-like path on pszPath, and set pchTemp */
177 if (!PathIsUNCW(szTemp))
178 {
179 /*
180 * Non-UNC path.
181 * Determine and normalize the root drive.
182 */
183 iDrive = PathGetDriveNumberW(szTemp);
184 if (iDrive == -1)
185 {
186 /*
187 * No drive was specified in the path. Try to find one from the
188 * optional directory (if this fails, fall back to the one of the
189 * Windows directory).
190 */
191 if (!pszDir || FAILED(StringCchCopyW(szRoot, _countof(szRoot), pszDir)))
192 {
193 /* pszDir was invalid or NULL. Fall back to the
194 * Windows directory and find its root. */
195 szRoot[0] = UNICODE_NULL;
196 GetWindowsDirectoryW(szRoot, _countof(szRoot));
197 iDrive = PathGetDriveNumberW(szRoot);
198 if (iDrive != -1)
199 PathBuildRootW(szRoot, iDrive);
200 }
201
202 if (szTemp[0] == L'\\')
203 {
204 PathStripToRootW(szRoot);
205 }
206 }
207 else
208 {
209 /*
210 * A drive is specified in the path, that can be either of the
211 * form 'C:\xxx' or of the form 'C:xxx' (relative path). Isolate
212 * the root part 'C:' and the rest of the path 'xxx' in pchTemp.
213 */
214 PathBuildRootW(szRoot, iDrive);
215 pchTemp += 2;
216 if (*pchTemp == L'\\')
217 ++pchTemp;
218 }
219
220 bLFN = IsLFNDriveW(szRoot);
221 if (!bLFN)
222 {
223 PWCHAR pch;
224 for (pch = pchTemp; *pch != UNICODE_NULL; ++pch)
225 {
226#define PATH_CHAR_CLASS_DOT 0x00000004
227#define PATH_CHAR_CLASS_BACKSLASH 0x00000008
228#define PATH_CHAR_CLASS_COLON 0x00000010
229#define PATH_CHAR_CLASS_OTHER_VALID 0x00000100
230#define VALID_SHORT_PATH_CHAR_CLASSES ( \
231 PATH_CHAR_CLASS_DOT | \
232 PATH_CHAR_CLASS_BACKSLASH | \
233 PATH_CHAR_CLASS_COLON | \
234 PATH_CHAR_CLASS_OTHER_VALID \
235)
237 {
238 *pch = L'_';
239 }
240 }
241 }
242
243 StringCchCopyW(pszPath, MAX_PATH, szRoot);
244 cchPathLeft -= lstrlenW(pszPath) + 1;
245 }
246 else /* UNC path: Begins with double backslash */
247 {
248 bLFN = IsLFNDriveW(pchTemp);
249 if (bLFN)
250 {
251 pszPath[2] = UNICODE_NULL; /* Cut off */
252 cchPathLeft -= (2 + 1);
253 pchTemp += 2;
254 }
255 else
256 {
257 PWCHAR pchSlash = StrChrW(pszPath + 2, L'\\');
258 if (pchSlash)
259 pchSlash = StrChrW(pchSlash + 1, L'\\');
260
261 if (pchSlash)
262 {
263 *(pchSlash + 1) = UNICODE_NULL; /* Cut off */
264 pchTemp += pchSlash - pszPath;
265 cchPathLeft -= (INT)(SIZE_T)(pchSlash - pszPath) + 1;
266 }
267 else
268 {
269 bLFN = TRUE;
270 pszPath[2] = UNICODE_NULL; /* Cut off */
271 cchPathLeft -= 2;
272 pchTemp += 2;
273 }
274 }
275 }
276 /* Now pszPath is a root-like path or an empty string. */
277
278 /* Start appending the path components of szTemp to pszPath. */
279 while (*pchTemp && cchPathLeft > 0)
280 {
281 /* Collapse any .\ and ..\ parts in the path */
282 if (*pchTemp == L'.')
283 {
284 BOOL bDots = FALSE; /* '.' or '..' ? */
285
286 if (pchTemp[1] == UNICODE_NULL || pchTemp[1] == L'\\')
287 {
288 /* Component '.' */
289 bDots = TRUE;
290 }
291 else if (pchTemp[1] == L'.' && (pchTemp[2] == UNICODE_NULL || pchTemp[2] == L'\\'))
292 {
293 /* Component '..' */
294 PathRemoveFileSpecW(pszPath); /* Remove the last component from pszPath */
295 bDots = TRUE;
296 }
297
298 /* If a '.' or '..' was encountered, skip to the next component */
299 if (bDots)
300 {
301 while (*pchTemp && *pchTemp != L'\\')
302 {
303 ++pchTemp;
304 }
305
306 while (*pchTemp == L'\\')
307 {
308 ++pchTemp;
309 }
310
311 continue;
312 }
313 }
314
315 /* Otherwise, copy the other path component */
316
317 if (!PathAddBackslashW(pszPath)) /* Append a backslash at the end */
318 break;
319
320 --cchPathLeft;
321
322 pchPath = &pszPath[lstrlenW(pszPath)];
323
324 if (!bLFN) /* Not LFN? */
325 {
326 /* Copy MS-DOS 8.3 filename */
327 PWCHAR pchDot = NULL;
328 INT ich;
329 WCHAR szTitle[8 + 1] = L"";
330 INT cchTitle = 0;
331 WCHAR szDotExtension[1 + 3 + 1] = L"";
332 INT cchDotExtension = 0;
333
334 /* Copy the component to szTitle and szDotExtension... */
335 while (*pchTemp && *pchTemp != L'\\')
336 {
337 if (*pchTemp == L'.')
338 {
339 pchDot = pchTemp; /* Remember the last position */
340
341 /* Clear szDotExtension */
342 cchDotExtension = 0;
343 ZeroMemory(szDotExtension, sizeof(szDotExtension));
344 }
345
346 if (pchDot)
347 {
348 if (cchDotExtension < 1 + 3)
349 szDotExtension[cchDotExtension++] = *pchTemp;
350 }
351 else
352 {
353 if (cchTitle < 8)
354 szTitle[cchTitle++] = *pchTemp;
355 }
356
357 ++pchTemp;
358 }
359
360 /* Add file title 'szTitle' to pchPath */
361 for (ich = 0; szTitle[ich] && cchPathLeft > 0; ++ich)
362 {
363 *pchPath++ = szTitle[ich];
364 --cchPathLeft;
365 }
366
367 /* Add file extension 'szDotExtension' to pchPath */
368 if (pchDot)
369 {
370 for (ich = 0; szDotExtension[ich] && cchPathLeft > 0; ++ich)
371 {
372 *pchPath++ = szDotExtension[ich];
373 --cchPathLeft;
374 }
375 }
376 }
377 else /* LFN */
378 {
379 /* Copy the component up to the next separator */
380 while (*pchTemp != UNICODE_NULL && *pchTemp != L'\\' && cchPathLeft > 0)
381 {
382 *pchPath++ = *pchTemp++;
383 --cchPathLeft;
384 }
385 }
386
387 /* Skip the backslashes */
388 while (*pchTemp == L'\\')
389 {
390 ++pchTemp;
391 }
392
393 /* Keep null-terminated */
394 *pchPath = UNICODE_NULL;
395 }
396
397 /* Remove any trailing backslash */
398 PathRemoveBackslashW(pszPath);
399
400 if (!(dwFlags & 1)) /* Remove the trailing dot? */
401 {
402 pchPath = CharPrevW(pszPath, pszPath + lstrlenW(pszPath));
403 if (*pchPath == L'.')
404 *pchPath = UNICODE_NULL;
405 }
406}
#define lstrlenW
Definition: compat.h:750
#define VALID_SHORT_PATH_CHAR_CLASSES
VOID WINAPI FixSlashesAndColonW(LPWSTR lpwstr)
Definition: ordinal.c:4514
BOOL WINAPI PathRemoveFileSpecW(LPWSTR lpszPath)
Definition: path.c:629
BOOL WINAPI PathIsValidCharW(WCHAR c, DWORD class)
Definition: path.c:4419
LPWSTR WINAPI PathRemoveBackslashW(LPWSTR lpszPath)
Definition: path.c:867
TCHAR szTitle[MAX_LOADSTRING]
Definition: magnifier.c:35
#define pch(ap)
Definition: match.c:418
#define INT
Definition: polytest.cpp:20
_In_ LPCSTR pszDir
Definition: shellapi.h:581
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint16_t * PWCHAR
Definition: typedefs.h:56
#define ZeroMemory
Definition: winbase.h:1712
LPWSTR WINAPI CharPrevW(_In_ LPCWSTR, _In_ LPCWSTR)

Referenced by PathQualifyW(), and PathResolveW().

◆ PathQualifyW()

VOID WINAPI PathQualifyW ( LPWSTR  pszPath)

Definition at line 826 of file shellpath.c.

827{
828 TRACE("%s\n",debugstr_w(pszPath));
829 PathQualifyExW(pszPath, NULL, 0);
830}
static VOID WINAPI PathQualifyExW(_Inout_ LPWSTR pszPath, _Inout_opt_ LPCWSTR pszDir, _In_ DWORD dwFlags)
Definition: shellpath.c:158

Referenced by PathQualifyA(), and PathQualifyAW().

◆ PathRemoveFileSpecAW()

BOOL WINAPI PathRemoveFileSpecAW ( LPVOID  lpszPath)

Definition at line 457 of file shellpath.c.

458{
459 if (SHELL_OsIsUnicode())
460 return PathRemoveFileSpecW(lpszPath);
461 return PathRemoveFileSpecA(lpszPath);
462}
BOOL WINAPI PathRemoveFileSpecA(LPSTR lpszPath)
Definition: path.c:586

◆ PathResolveA()

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

Definition at line 843 of file shellpath.c.

844{
845 BOOL ret = FALSE;
846 LPWSTR *dirsW = NULL;
847 DWORD iDir, cDirs, cbDirs;
848 WCHAR pathW[MAX_PATH];
849
850 TRACE("(%s,%p,0x%08x)\n", debugstr_a(path), dirs, flags);
851
852 if (dirs)
853 {
854 for (cDirs = 0; dirs[cDirs]; ++cDirs)
855 ;
856
857 cbDirs = (cDirs + 1) * sizeof(LPWSTR);
858 dirsW = SHAlloc(cbDirs);
859 if (!dirsW)
860 goto Cleanup;
861
862 ZeroMemory(dirsW, cbDirs);
863 for (iDir = 0; iDir < cDirs; ++iDir)
864 {
865 __SHCloneStrAtoW(&dirsW[iDir], dirs[iDir]);
866 if (dirsW[iDir] == NULL)
867 goto Cleanup;
868 }
869 }
870
871 SHAnsiToUnicode(path, pathW, _countof(pathW));
872
873 ret = PathResolveW(pathW, (LPCWSTR*)dirsW, flags);
874 if (ret)
876
877Cleanup:
878 if (dirsW)
879 {
880 for (iDir = 0; iDir < cDirs; ++iDir)
881 {
882 SHFree(dirsW[iDir]);
883 }
884 SHFree(dirsW);
885 }
886 return ret;
887}
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:326
LPVOID WINAPI SHAlloc(SIZE_T len)
Definition: shellole.c:304
BOOL WINAPI PathResolveW(_Inout_ LPWSTR path, _Inout_opt_ LPCWSTR *dirs, _In_ DWORD flags)
Definition: shellpath.c:889
static const WCHAR Cleanup[]
Definition: register.c:80
GLbitfield flags
Definition: glext.h:7161
static __inline LPWSTR __SHCloneStrAtoW(WCHAR **target, const char *source)
Definition: shell32_main.h:170

Referenced by PathResolveAW().

◆ PathResolveAW()

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

Definition at line 966 of file shellpath.c.

967{
968 if (SHELL_OsIsUnicode())
969 return PathResolveW(path, (LPCWSTR*)paths, flags);
970 else
971 return PathResolveA(path, (LPCSTR*)paths, flags);
972}
BOOL WINAPI PathResolveA(LPSTR path, LPCSTR *dirs, DWORD flags)
Definition: shellpath.c:843
GLsizei const GLuint * paths
Definition: glext.h:11717

◆ PathResolveW()

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

Definition at line 889 of file shellpath.c.

890{
891 DWORD dwWhich = WHICH_DEFAULT; /* The extensions to be searched */
892
893 TRACE("(%s,%p,0x%08x)\n", debugstr_w(path), dirs, flags);
894
896 dwWhich &= ~WHICH_LNK; /* Don't search '.LNK' (shortcut) */
897
899 SetLastError(ERROR_FILE_NOT_FOUND); /* We set this error code at first in verification */
900
902
903 if (PathIsRootW(path)) /* Root path */
904 {
905 if (path[0] == L'\\' && path[1] == UNICODE_NULL) /* '\' only? */
906 PathQualifyExW(path, ((flags & PRF_FIRSTDIRDEF) ? *dirs : NULL), 0); /* Qualify */
907
909 return PathFileExistsAndAttributesW(path, NULL); /* Check the existence */
910
911 return TRUE;
912 }
913
914 if (PathIsFileSpecW(path)) /* Filename only */
915 {
916 /* Try to find the path with program extensions applied? */
918 PathSearchOnExtensionsW(path, dirs, TRUE, dwWhich))
919 {
920 return TRUE; /* Found */
921 }
922
923 /* Try to find the filename in the directories */
924 if (PathFindOnPathW(path, dirs))
925 goto CheckAbsoluteAndFinish;
926
927 return FALSE; /* Not found */
928 }
929
930 if (PathIsURLW(path)) /* URL? */
931 return FALSE;
932
933 /* Qualify the path */
934 PathQualifyExW(path, ((flags & PRF_FIRSTDIRDEF) ? *dirs : NULL), 1);
935
936 TRACE("(%s)\n", debugstr_w(path));
937
938 if (!(flags & PRF_VERIFYEXISTS)) /* Don't verify the existence? */
939 return TRUE;
940
941 /* Try to find the path with program extensions applied? */
943 !PathSearchOnExtensionsW(path, dirs, FALSE, dwWhich))
944 {
946 return FALSE; /* Not found */
947 }
948
949CheckAbsoluteAndFinish:
950#if (_WIN32_WINNT >= _WIN32_WINNT_WS03)
952 return TRUE;
953
955 return FALSE;
956
958#else
959 return TRUE; /* Found */
960#endif
961}
#define PRF_VERIFYEXISTS
Definition: PathResolve.cpp:38
#define PRF_TRYPROGRAMEXTENSIONS
Definition: PathResolve.cpp:40
#define PRF_REQUIREABSOLUTE
Definition: PathResolve.cpp:45
#define PRF_FIRSTDIRDEF
Definition: PathResolve.cpp:41
#define PRF_DONTFINDLNK
Definition: PathResolve.cpp:42
#define SetLastError(x)
Definition: compat.h:752
static BOOL WINAPI PathMakeAbsoluteW(_Inout_ LPWSTR path)
Definition: shellpath.c:141
static BOOL WINAPI PathSearchOnExtensionsW(_Inout_ LPWSTR pszPath, _In_opt_ LPCWSTR *ppszDirs, _In_ BOOL bDoSearch, _In_ DWORD dwWhich)
Definition: shellpath.c:120
static BOOL WINAPI PathIsAbsoluteW(_In_ LPCWSTR path)
Definition: shellpath.c:136
BOOL WINAPI PathFindOnPathW(LPWSTR lpszFile, LPCWSTR *lppszOtherDirs)
Definition: path.c:1403
VOID WINAPI PathUnquoteSpacesW(LPWSTR lpszPath)
Definition: path.c:1034
BOOL WINAPI PathIsFileSpecW(LPCWSTR lpszPath)
Definition: path.c:2133
BOOL WINAPI PathFileExistsAndAttributesW(LPCWSTR lpszPath, DWORD *dwAttr)
Definition: path.c:1832
BOOL WINAPI PathIsURLW(LPCWSTR lpstrPath)
Definition: url.c:2432
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define WHICH_DEFAULT

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

◆ PathSearchOnExtensionsW()

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

Definition at line 120 of file shellpath.c.

125{
126 if (*PathFindExtensionW(pszPath) != 0)
127 return FALSE;
128
129 if (bDoSearch)
130 return PathFindOnPathExW(pszPath, ppszDirs, dwWhich);
131 else
132 return PathFileExistsDefExtW(pszPath, dwWhich);
133}
BOOL WINAPI PathFindOnPathExW(LPWSTR lpszFile, LPCWSTR *lppszOtherDirs, DWORD dwWhich)
Definition: path.c:1351
BOOL WINAPI PathFileExistsDefExtW(LPWSTR lpszPath, DWORD dwWhich)
Definition: path.c:1117

Referenced by PathResolveW().

◆ PathYetAnotherMakeUniqueName()

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

Definition at line 705 of file shellpath.c.

706{
707 WCHAR pathW[MAX_PATH], retW[MAX_PATH];
708 const WCHAR *file, *ext;
709 int i = 2;
710
711 TRACE("(%p, %s, %s, %s)\n", buffer, debugstr_w(path), debugstr_w(shortname), debugstr_w(longname));
712
713 file = longname ? longname : shortname;
714 PathCombineW(pathW, path, file);
715 strcpyW(retW, pathW);
717
719
720 /* now try to make it unique */
721 while (PathFileExistsW(retW))
722 {
723 sprintfW(retW, L"%s (%d)%s", pathW, i, ext);
724 i++;
725 }
726
727 strcpyW(buffer, retW);
728 TRACE("ret - %s\n", debugstr_w(buffer));
729
730 return TRUE;
731}
static const WCHAR *const ext[]
Definition: module.c:53
void WINAPI PathRemoveExtensionW(LPWSTR lpszPath)
Definition: path.c:823
#define sprintfW
Definition: unicode.h:58
Definition: fci.c:127

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

◆ SHELL_RegisterShellFolders()

HRESULT SHELL_RegisterShellFolders ( void  )

Definition at line 3033 of file shellpath.c.

3034{
3035 HRESULT hr;
3036
3038 if (SUCCEEDED(hr))
3040 if (SUCCEEDED(hr))
3042 return hr;
3043}
static HRESULT _SHRegisterUserShellFolders(BOOL bDefault)
Definition: shellpath.c:2937
static HRESULT _SHRegisterCommonShellFolders(void)
Definition: shellpath.c:3005

Referenced by DllRegisterServer().

◆ SHGetFolderLocation()

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

Definition at line 3093 of file shellpath.c.

3099{
3101#ifdef __REACTOS__
3103#endif
3104
3105 TRACE("%p 0x%08x %p 0x%08x %p\n",
3106 hwndOwner, nFolder, hToken, dwReserved, ppidl);
3107
3108 if (!ppidl)
3109 return E_INVALIDARG;
3110 if (dwReserved)
3111 return E_INVALIDARG;
3112
3113#ifdef __REACTOS__
3114 if ((nFolder & CSIDL_FLAG_NO_ALIAS) &&
3116 {
3117 *ppidl = ILCreateFromPathW(szPath);
3118 if (*ppidl)
3119 return S_OK;
3120 }
3121#endif
3122 /* The virtual folders' locations are not user-dependent */
3123 *ppidl = NULL;
3124 switch (nFolder & CSIDL_FOLDER_MASK)
3125 {
3126 case CSIDL_DESKTOP:
3127 *ppidl = _ILCreateDesktop();
3128 break;
3129
3130 case CSIDL_PERSONAL:
3131 *ppidl = _ILCreateMyDocuments();
3132 break;
3133
3134 case CSIDL_INTERNET:
3135 *ppidl = _ILCreateIExplore();
3136 break;
3137
3138 case CSIDL_CONTROLS:
3139 *ppidl = _ILCreateControlPanel();
3140 break;
3141
3142 case CSIDL_PRINTERS:
3143 *ppidl = _ILCreatePrinters();
3144 break;
3145
3146 case CSIDL_BITBUCKET:
3147 *ppidl = _ILCreateBitBucket();
3148 break;
3149
3150 case CSIDL_DRIVES:
3151 *ppidl = _ILCreateMyComputer();
3152 break;
3153
3154 case CSIDL_NETWORK:
3155 *ppidl = _ILCreateNetwork();
3156 break;
3157
3158 default:
3159 {
3161
3162 hr = SHGetFolderPathW(hwndOwner, nFolder, hToken,
3164 if (SUCCEEDED(hr))
3165 {
3166 DWORD attributes=0;
3167
3168 TRACE("Value=%s\n", debugstr_w(szPath));
3169 hr = SHILCreateFromPathW(szPath, ppidl, &attributes);
3170 }
3172 {
3173 /* unlike SHGetFolderPath, SHGetFolderLocation in shell32
3174 * version 6.0 returns E_FAIL for nonexistent paths
3175 */
3176 hr = E_FAIL;
3177 }
3178 }
3179 }
3180 if(*ppidl)
3181 hr = S_OK;
3182
3183 TRACE("-- (new pidl %p)\n",*ppidl);
3184 return hr;
3185}
BOOL WINAPI SHGetSpecialFolderPathW(HWND hwndOwner, LPWSTR szPath, int nFolder, BOOL bCreate)
Definition: shellpath.c:3061
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:95
LPITEMIDLIST _ILCreateMyComputer(void)
Definition: pidl.c:1628
LPITEMIDLIST _ILCreateIExplore(void)
Definition: pidl.c:1640
HRESULT WINAPI SHILCreateFromPathW(LPCWSTR path, LPITEMIDLIST *ppidl, DWORD *attributes)
Definition: pidl.c:392
LPITEMIDLIST _ILCreateDesktop(void)
Definition: pidl.c:1617
LPITEMIDLIST _ILCreateNetwork(void)
Definition: pidl.c:1684
LPITEMIDLIST _ILCreatePrinters(void)
Definition: pidl.c:1665
LPITEMIDLIST _ILCreateControlPanel(void)
Definition: pidl.c:1646
LPITEMIDLIST WINAPI ILCreateFromPathW(LPCWSTR path)
Definition: pidl.c:986
LPITEMIDLIST _ILCreateMyDocuments(void)
Definition: pidl.c:1634
LPITEMIDLIST _ILCreateBitBucket(void)
Definition: pidl.c:1690
#define CSIDL_FLAG_NO_ALIAS
Definition: shlobj.h:2218
#define CSIDL_PRINTERS
Definition: shlobj.h:2162
#define CSIDL_FOLDER_MASK
Definition: shlobj.h:2216
#define CSIDL_DESKTOP
Definition: shlobj.h:2158
#define CSIDL_NETWORK
Definition: shlobj.h:2175
#define CSIDL_DRIVES
Definition: shlobj.h:2174
#define CSIDL_INTERNET
Definition: shlobj.h:2159
#define CSIDL_CONTROLS
Definition: shlobj.h:2161
#define CSIDL_BITBUCKET
Definition: shlobj.h:2168
_In_ int nFolder
Definition: shlobj.h:1510

Referenced by CBandSiteMenu::_CreateBuiltInISFBand(), CShellMenuCallback::AddStartMenuItems(), BrsFolder_OnCreate(), ILIsParentOrSpecialParent(), CExplorerBand::InitializeExplorerBand(), CExplorerBand::InsertSubitems(), LoadRdpSettingsFromFile(), loadShell32(), 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 2805 of file shellpath.c.

2811{
2812 WCHAR szTemp[MAX_PATH];
2813 HRESULT hr;
2814
2815 TRACE("%p,%d,%p,%#x,%p\n", hwndOwner, nFolder, hToken, dwFlags, pszPath);
2816
2817 if (pszPath)
2818 *pszPath = '\0';
2819 hr = SHGetFolderPathW(hwndOwner, nFolder, hToken, dwFlags, szTemp);
2820 if (SUCCEEDED(hr) && pszPath)
2821 WideCharToMultiByte(CP_ACP, 0, szTemp, -1, pszPath, MAX_PATH, NULL,
2822 NULL);
2823
2824 return hr;
2825}
#define CP_ACP
Definition: compat.h:109
#define WideCharToMultiByte
Definition: compat.h:111

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

◆ SHGetFolderPathAndSubDirA()

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

Definition at line 2571 of file shellpath.c.

2578{
2579 int length;
2580 HRESULT hr = S_OK;
2581 LPWSTR pszSubPathW = NULL;
2582 LPWSTR pszPathW = NULL;
2583
2584 TRACE("%p,%#x,%p,%#x,%s,%p\n", hwndOwner, nFolder, hToken, dwFlags, debugstr_a(pszSubPath), pszPath);
2585
2586 if(pszPath) {
2587 pszPathW = HeapAlloc(GetProcessHeap(), 0, MAX_PATH * sizeof(WCHAR));
2588 if(!pszPathW) {
2590 goto cleanup;
2591 }
2592 }
2593 TRACE("%08x,%08x,%s\n",nFolder, dwFlags, debugstr_w(pszSubPathW));
2594
2595 /* SHGetFolderPathAndSubDirW does not distinguish if pszSubPath isn't
2596 * set (null), or an empty string.therefore call it without the parameter set
2597 * if pszSubPath is an empty string
2598 */
2599 if (pszSubPath && pszSubPath[0]) {
2600 length = MultiByteToWideChar(CP_ACP, 0, pszSubPath, -1, NULL, 0);
2601 pszSubPathW = HeapAlloc(GetProcessHeap(), 0, length * sizeof(WCHAR));
2602 if(!pszSubPathW) {
2604 goto cleanup;
2605 }
2606 MultiByteToWideChar(CP_ACP, 0, pszSubPath, -1, pszSubPathW, length);
2607 }
2608
2609 hr = SHGetFolderPathAndSubDirW(hwndOwner, nFolder, hToken, dwFlags, pszSubPathW, pszPathW);
2610
2611 if (SUCCEEDED(hr) && pszPath)
2612 WideCharToMultiByte(CP_ACP, 0, pszPathW, -1, pszPath, MAX_PATH, NULL, NULL);
2613
2614cleanup:
2615 HeapFree(GetProcessHeap(), 0, pszPathW);
2616 HeapFree(GetProcessHeap(), 0, pszSubPathW);
2617 return hr;
2618}
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define MultiByteToWideChar
Definition: compat.h:110
static void cleanup(void)
Definition: main.c:1335
HRESULT WINAPI SHGetFolderPathAndSubDirW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPCWSTR pszSubPath, LPWSTR pszPath)
Definition: shellpath.c:2623

Referenced by test_SHGetFolderPathAndSubDirA().

◆ SHGetFolderPathAndSubDirW()

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

Definition at line 2623 of file shellpath.c.

2630{
2631 HRESULT hr;
2632 WCHAR szBuildPath[MAX_PATH], szTemp[MAX_PATH];
2635 int ret;
2636
2637 TRACE("%p,%#x,%p,%#x,%s,%p\n", hwndOwner, nFolder, hToken, dwFlags, debugstr_w(pszSubPath), pszPath);
2638
2639 /* Windows always NULL-terminates the resulting path regardless of success
2640 * or failure, so do so first
2641 */
2642 if (pszPath)
2643 *pszPath = '\0';
2644
2646 return E_INVALIDARG;
2648 return E_INVALIDARG;
2649 szTemp[0] = 0;
2651 switch (type)
2652 {
2654 hr = E_INVALIDARG;
2655 break;
2657 hr = S_FALSE;
2658 break;
2661 if (CSIDL_Data[folder].szDefaultPath &&
2662 !IS_INTRESOURCE(CSIDL_Data[folder].szDefaultPath) &&
2663 *CSIDL_Data[folder].szDefaultPath)
2664 {
2665 PathAddBackslashW(szTemp);
2666 strcatW(szTemp, CSIDL_Data[folder].szDefaultPath);
2667 }
2668 hr = S_OK;
2669 break;
2672 if (CSIDL_Data[folder].szDefaultPath &&
2673 !IS_INTRESOURCE(CSIDL_Data[folder].szDefaultPath) &&
2674 *CSIDL_Data[folder].szDefaultPath)
2675 {
2676 PathAddBackslashW(szTemp);
2677 strcatW(szTemp, CSIDL_Data[folder].szDefaultPath);
2678 }
2679 hr = S_OK;
2680 break;
2683 if (CSIDL_Data[folder].szDefaultPath &&
2684 !IS_INTRESOURCE(CSIDL_Data[folder].szDefaultPath) &&
2685 *CSIDL_Data[folder].szDefaultPath)
2686 {
2687 PathAddBackslashW(szTemp);
2688 strcatW(szTemp, CSIDL_Data[folder].szDefaultPath);
2689 }
2690 hr = S_OK;
2691 break;
2692 case CSIDL_Type_CurrVer:
2694 break;
2695 case CSIDL_Type_User:
2696#ifdef __REACTOS__
2697 case CSIDL_Type_InMyDocuments:
2698#endif
2699 hr = _SHGetUserProfilePath(hToken, dwFlags, folder, szTemp);
2700 break;
2703 break;
2704 default:
2705 FIXME("bogus type %d, please fix\n", type);
2706 hr = E_INVALIDARG;
2707 break;
2708 }
2709
2710 /* Expand environment strings if necessary */
2711 if (*szTemp == '%')
2712#ifndef __REACTOS__
2713 hr = _SHExpandEnvironmentStrings(szTemp, szBuildPath);
2714#else
2715 hr = _SHExpandEnvironmentStrings(hToken, szTemp, szBuildPath, _countof(szBuildPath));
2716#endif
2717 else
2718 strcpyW(szBuildPath, szTemp);
2719
2720 if (FAILED(hr)) goto end;
2721
2722 if(pszSubPath) {
2723 /* make sure the new path does not exceed the buffer length
2724 * and remember to backslash and terminate it */
2725 if(MAX_PATH < (lstrlenW(szBuildPath) + lstrlenW(pszSubPath) + 2)) {
2727 goto end;
2728 }
2729 PathAppendW(szBuildPath, pszSubPath);
2730 PathRemoveBackslashW(szBuildPath);
2731 }
2732 /* Copy the path if it's available before we might return */
2733 if (SUCCEEDED(hr) && pszPath)
2734 strcpyW(pszPath, szBuildPath);
2735
2736 /* if we don't care about existing directories we are ready */
2738
2739 if (PathFileExistsW(szBuildPath)) goto end;
2740
2741 /* not existing but we are not allowed to create it. The return value
2742 * is verified against shell32 version 6.0.
2743 */
2744 if (!(nFolder & CSIDL_FLAG_CREATE))
2745 {
2747 goto end;
2748 }
2749
2750 /* create directory/directories */
2751 ret = SHCreateDirectoryExW(hwndOwner, szBuildPath, NULL);
2752 if (ret && ret != ERROR_ALREADY_EXISTS)
2753 {
2754 ERR("Failed to create directory %s.\n", debugstr_w(szBuildPath));
2755 hr = E_FAIL;
2756 goto end;
2757 }
2758
2759 TRACE("Created missing system directory %s\n", debugstr_w(szBuildPath));
2760
2761end:
2762#ifdef __REACTOS__
2763 /* create desktop.ini for custom icon */
2764 if ((nFolder & CSIDL_FLAG_CREATE) &&
2765 CSIDL_Data[folder].nShell32IconIndex)
2766 {
2767 WCHAR szIconLocation[MAX_PATH];
2769
2770 /* make the directory a read-only folder */
2771 dwAttributes = GetFileAttributesW(szBuildPath);
2773 SetFileAttributesW(szBuildPath, dwAttributes);
2774
2775 /* build the desktop.ini file path */
2776 PathAppendW(szBuildPath, L"desktop.ini");
2777
2778 /* build the icon location */
2779 StringCchPrintfW(szIconLocation, _countof(szIconLocation),
2780 L"%%SystemRoot%%\\system32\\shell32.dll,%d",
2781 CSIDL_Data[folder].nShell32IconIndex);
2782
2783 /* write desktop.ini */
2784 WritePrivateProfileStringW(L".ShellClassInfo", L"IconResource", szIconLocation, szBuildPath);
2785
2786 /* flush! */
2787 WritePrivateProfileStringW(NULL, NULL, NULL, szBuildPath);
2788
2789 /* make the desktop.ini a system and hidden file */
2790 dwAttributes = GetFileAttributesW(szBuildPath);
2792 SetFileAttributesW(szBuildPath, dwAttributes);
2793 }
2794#endif
2795
2796 TRACE("returning 0x%08x (final path is %s)\n", hr, debugstr_w(szBuildPath));
2797 return hr;
2798}
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652
BOOL WINAPI SetFileAttributesW(LPCWSTR lpFileName, DWORD dwFileAttributes)
Definition: fileinfo.c:794
UINT WINAPI GetSystemWow64DirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2421
BOOL WINAPI WritePrivateProfileStringW(LPCWSTR section, LPCWSTR entry, LPCWSTR string, LPCWSTR filename)
Definition: profile.c:1453
static HRESULT _SHGetCurrentVersionPath(DWORD dwFlags, BYTE folder, LPWSTR pszPath)
Definition: shellpath.c:2102
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
#define FILE_ATTRIBUTE_HIDDEN
Definition: nt_native.h:703
#define FILE_ATTRIBUTE_SYSTEM
Definition: nt_native.h:704
int WINAPI SHCreateDirectoryExW(HWND hWnd, LPCWSTR path, LPSECURITY_ATTRIBUTES sec)
Definition: shlfileop.cpp:905
#define CSIDL_FLAG_DONT_VERIFY
Definition: shlobj.h:2219
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
CSIDL_Type type
Definition: shellpath.c:1074
DWORD dwAttributes
Definition: vdmdbg.h:34
#define S_FALSE
Definition: winerror.h:2357
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:106
#define ERROR_FILENAME_EXCED_RANGE
Definition: winerror.h:263

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

◆ SHGetFolderPathW()

◆ SHGetSpecialFolderLocation()

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

Definition at line 3194 of file shellpath.c.

3198{
3200
3201 TRACE("(%p,0x%x,%p)\n", hwndOwner,nFolder,ppidl);
3202
3203 if (!ppidl)
3204 return E_INVALIDARG;
3205
3206 hr = SHGetFolderLocation(hwndOwner, nFolder, NULL, 0, ppidl);
3207 return hr;
3208}
HRESULT WINAPI SHGetFolderLocation(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwReserved, LPITEMIDLIST *ppidl)
Definition: shellpath.c:3093

Referenced by _GetDocumentsPidl(), CShellMenuCallback::AddOrSetMenuItem(), DoGetPidl(), DoInitAliasPIDLs(), DoTestEntry(), DynamicSHGetSpecialFolderPathW(), ebrowser_browse_to_desktop(), FILEDLG95_InitControls(), FILEDLG95_LOOKIN_Init(), FILEDLG95_OnWMCommand(), filedlg_collect_places_pidls(), GetFavoritesFolder(), GetFavsLocation(), GetMergedFolder(), GetParsingName(), CSendToMenu::GetSpecialFolder(), IShellBrowserImpl_Construct(), loadShell32(), MRUList_PidlList_0(), CACListISF::NextLocation(), CShellMenuCallback::OnGetContextMenu(), 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 3048 of file shellpath.c.

3053{
3054 return SHGetFolderPathA(hwndOwner, nFolder + (bCreate ? CSIDL_FLAG_CREATE : 0), NULL, 0,
3055 szPath) == S_OK;
3056}
HRESULT WINAPI SHGetFolderPathA(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPSTR pszPath)
Definition: shellpath.c:2805
_In_ int _In_ BOOL bCreate
Definition: shlobj.h:1511

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

◆ SHGetSpecialFolderPathW()

◆ SHPathGetExtensionW()

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

Definition at line 449 of file shellpath.c.

450{
451 return PathGetExtensionW(lpszPath);
452}

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shell  )

Variable Documentation

◆ Application_DataW

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

Definition at line 1026 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 1027 of file shellpath.c.

◆ Local_Settings_HistoryW

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

Definition at line 1028 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 1029 of file shellpath.c.

◆ MusicW

const WCHAR MusicW[] = L"Music"
static

Definition at line 1030 of file shellpath.c.

◆ PicturesW

const WCHAR PicturesW[] = L"Pictures"
static

Definition at line 1031 of file shellpath.c.

◆ Program_Files_Common_FilesW

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

Definition at line 1033 of file shellpath.c.

◆ Program_FilesW

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

Definition at line 1032 of file shellpath.c.

◆ Start_Menu_Admin_ToolsW

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

Definition at line 1035 of file shellpath.c.

◆ Start_Menu_ProgramsW

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

Definition at line 1034 of file shellpath.c.

◆ Start_Menu_StartupW

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

Definition at line 1036 of file shellpath.c.

◆ szKnownFolderDescriptions

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

Definition at line 1043 of file shellpath.c.

◆ szKnownFolderRedirections

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

Definition at line 1044 of file shellpath.c.

◆ szSHFolders

◆ szSHUserFolders

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