ReactOS 0.4.15-dev-7942-gd23573b
path.c File Reference
#include "config.h"
#include "wine/port.h"
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#include "wine/unicode.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winreg.h"
#include "winternl.h"
#include "shlwapi.h"
#include "wine/debug.h"
Include dependency graph for path.c:

Go to the source code of this file.

Classes

struct  envvars_map
 

Macros

#define NO_SHLWAPI_STREAM
 
#define GET_FUNC(func, module, name, fail)
 
#define szWebLen   (sizeof(szWeb)/sizeof(WCHAR))
 
#define szWebMuiLen   ((sizeof(szWebMui)+1)/sizeof(WCHAR))
 
#define PATH_CHAR_CLASS_LETTER   0x00000001
 
#define PATH_CHAR_CLASS_ASTERIX   0x00000002
 
#define PATH_CHAR_CLASS_DOT   0x00000004
 
#define PATH_CHAR_CLASS_BACKSLASH   0x00000008
 
#define PATH_CHAR_CLASS_COLON   0x00000010
 
#define PATH_CHAR_CLASS_SEMICOLON   0x00000020
 
#define PATH_CHAR_CLASS_COMMA   0x00000040
 
#define PATH_CHAR_CLASS_SPACE   0x00000080
 
#define PATH_CHAR_CLASS_OTHER_VALID   0x00000100
 
#define PATH_CHAR_CLASS_DOUBLEQUOTE   0x00000200
 
#define PATH_CHAR_CLASS_INVALID   0x00000000
 
#define PATH_CHAR_CLASS_ANY   0xffffffff
 

Typedefs

typedef BOOL(WINAPIfnpIsNetDrive) (int)
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (shell)
 
HRESULT WINAPI SHGetWebFolderFilePathW (LPCWSTR, LPWSTR, DWORD)
 
static WCHARheap_strdupAtoW (LPCSTR str)
 
BOOL WINAPI PathAppendA (LPSTR lpszPath, LPCSTR lpszAppend)
 
BOOL WINAPI PathAppendW (LPWSTR lpszPath, LPCWSTR lpszAppend)
 
LPSTR WINAPI PathCombineA (LPSTR lpszDest, LPCSTR lpszDir, LPCSTR lpszFile)
 
LPWSTR WINAPI PathCombineW (LPWSTR lpszDest, LPCWSTR lpszDir, LPCWSTR lpszFile)
 
LPSTR WINAPI PathAddBackslashA (LPSTR lpszPath)
 
LPWSTR WINAPI PathAddBackslashW (LPWSTR lpszPath)
 
LPSTR WINAPI PathBuildRootA (LPSTR lpszPath, int drive)
 
LPWSTR WINAPI PathBuildRootW (LPWSTR lpszPath, int drive)
 
LPSTR WINAPI PathFindFileNameA (LPCSTR lpszPath)
 
LPWSTR WINAPI PathFindFileNameW (LPCWSTR lpszPath)
 
LPSTR WINAPI PathFindExtensionA (LPCSTR lpszPath)
 
LPWSTR WINAPI PathFindExtensionW (LPCWSTR lpszPath)
 
LPSTR WINAPI PathGetArgsA (LPCSTR lpszPath)
 
LPWSTR WINAPI PathGetArgsW (LPCWSTR lpszPath)
 
int WINAPI PathGetDriveNumberA (LPCSTR lpszPath)
 
int WINAPI PathGetDriveNumberW (const WCHAR *path)
 
BOOL WINAPI PathRemoveFileSpecA (LPSTR lpszPath)
 
BOOL WINAPI PathRemoveFileSpecW (LPWSTR lpszPath)
 
void WINAPI PathStripPathA (LPSTR lpszPath)
 
void WINAPI PathStripPathW (LPWSTR lpszPath)
 
BOOL WINAPI PathStripToRootA (LPSTR lpszPath)
 
BOOL WINAPI PathStripToRootW (LPWSTR lpszPath)
 
void WINAPI PathRemoveArgsA (LPSTR lpszPath)
 
void WINAPI PathRemoveArgsW (LPWSTR lpszPath)
 
void WINAPI PathRemoveExtensionA (LPSTR lpszPath)
 
void WINAPI PathRemoveExtensionW (LPWSTR lpszPath)
 
LPSTR WINAPI PathRemoveBackslashA (LPSTR lpszPath)
 
LPWSTR WINAPI PathRemoveBackslashW (LPWSTR lpszPath)
 
VOID WINAPI PathRemoveBlanksA (LPSTR lpszPath)
 
VOID WINAPI PathRemoveBlanksW (LPWSTR lpszPath)
 
VOID WINAPI PathQuoteSpacesA (LPSTR lpszPath)
 
VOID WINAPI PathQuoteSpacesW (LPWSTR lpszPath)
 
VOID WINAPI PathUnquoteSpacesA (LPSTR lpszPath)
 
VOID WINAPI PathUnquoteSpacesW (LPWSTR lpszPath)
 
int WINAPI PathParseIconLocationA (LPSTR lpszPath)
 
int WINAPI PathParseIconLocationW (LPWSTR lpszPath)
 
BOOL WINAPI PathFileExistsDefExtW (LPWSTR lpszPath, DWORD dwWhich)
 
BOOL WINAPI PathFileExistsDefExtA (LPSTR lpszPath, DWORD dwWhich)
 
static BOOL SHLWAPI_PathFindInOtherDirs (LPWSTR lpszFile, DWORD dwWhich)
 
BOOL WINAPI PathFindOnPathExA (LPSTR lpszFile, LPCSTR *lppszOtherDirs, DWORD dwWhich)
 
BOOL WINAPI PathFindOnPathExW (LPWSTR lpszFile, LPCWSTR *lppszOtherDirs, DWORD dwWhich)
 
BOOL WINAPI PathFindOnPathA (LPSTR lpszFile, LPCSTR *lppszOtherDirs)
 
BOOL WINAPI PathFindOnPathW (LPWSTR lpszFile, LPCWSTR *lppszOtherDirs)
 
BOOL WINAPI PathCompactPathExA (LPSTR lpszDest, LPCSTR lpszPath, UINT cchMax, DWORD dwFlags)
 
BOOL WINAPI PathCompactPathExW (LPWSTR lpszDest, LPCWSTR lpszPath, UINT cchMax, DWORD dwFlags)
 
BOOL WINAPI PathIsRelativeA (LPCSTR lpszPath)
 
BOOL WINAPI PathIsRelativeW (LPCWSTR lpszPath)
 
BOOL WINAPI PathIsRootA (LPCSTR lpszPath)
 
BOOL WINAPI PathIsRootW (LPCWSTR lpszPath)
 
BOOL WINAPI PathIsDirectoryA (LPCSTR lpszPath)
 
BOOL WINAPI PathIsDirectoryW (LPCWSTR lpszPath)
 
BOOL WINAPI PathFileExistsA (LPCSTR lpszPath)
 
BOOL WINAPI PathFileExistsW (LPCWSTR lpszPath)
 
BOOL WINAPI PathFileExistsAndAttributesA (LPCSTR lpszPath, DWORD *dwAttr)
 
BOOL WINAPI PathFileExistsAndAttributesW (LPCWSTR lpszPath, DWORD *dwAttr)
 
static BOOL PathMatchSingleMaskA (LPCSTR name, LPCSTR mask)
 
static BOOL PathMatchSingleMaskW (LPCWSTR name, LPCWSTR mask)
 
BOOL WINAPI PathMatchSpecA (LPCSTR lpszPath, LPCSTR lpszMask)
 
BOOL WINAPI PathMatchSpecW (LPCWSTR lpszPath, LPCWSTR lpszMask)
 
BOOL WINAPI PathIsSameRootA (LPCSTR lpszPath1, LPCSTR lpszPath2)
 
BOOL WINAPI PathIsSameRootW (LPCWSTR lpszPath1, LPCWSTR lpszPath2)
 
BOOL WINAPI PathIsContentTypeA (LPCSTR lpszPath, LPCSTR lpszContentType)
 
BOOL WINAPI PathIsContentTypeW (LPCWSTR lpszPath, LPCWSTR lpszContentType)
 
BOOL WINAPI PathIsFileSpecA (LPCSTR lpszPath)
 
BOOL WINAPI PathIsFileSpecW (LPCWSTR lpszPath)
 
BOOL WINAPI PathIsPrefixA (LPCSTR lpszPrefix, LPCSTR lpszPath)
 
BOOL WINAPI PathIsPrefixW (LPCWSTR lpszPrefix, LPCWSTR lpszPath)
 
BOOL WINAPI PathIsSystemFolderA (LPCSTR lpszPath, DWORD dwAttrib)
 
BOOL WINAPI PathIsSystemFolderW (LPCWSTR lpszPath, DWORD dwAttrib)
 
BOOL WINAPI PathIsUNCA (LPCSTR lpszPath)
 
BOOL WINAPI PathIsUNCW (LPCWSTR lpszPath)
 
BOOL WINAPI PathIsUNCServerA (LPCSTR lpszPath)
 
BOOL WINAPI PathIsUNCServerW (LPCWSTR lpszPath)
 
BOOL WINAPI PathIsUNCServerShareA (LPCSTR lpszPath)
 
BOOL WINAPI PathIsUNCServerShareW (LPCWSTR lpszPath)
 
BOOL WINAPI PathCanonicalizeA (LPSTR lpszBuf, LPCSTR lpszPath)
 
BOOL WINAPI PathCanonicalizeW (LPWSTR lpszBuf, LPCWSTR lpszPath)
 
LPSTR WINAPI PathFindNextComponentA (LPCSTR lpszPath)
 
LPWSTR WINAPI PathFindNextComponentW (LPCWSTR lpszPath)
 
BOOL WINAPI PathAddExtensionA (LPSTR lpszPath, LPCSTR lpszExtension)
 
BOOL WINAPI PathAddExtensionW (LPWSTR lpszPath, LPCWSTR lpszExtension)
 
BOOL WINAPI PathMakePrettyA (LPSTR lpszPath)
 
BOOL WINAPI PathMakePrettyW (LPWSTR lpszPath)
 
int WINAPI PathCommonPrefixA (LPCSTR lpszFile1, LPCSTR lpszFile2, LPSTR achPath)
 
int WINAPI PathCommonPrefixW (LPCWSTR lpszFile1, LPCWSTR lpszFile2, LPWSTR achPath)
 
BOOL WINAPI PathCompactPathA (HDC hDC, LPSTR lpszPath, UINT dx)
 
BOOL WINAPI PathCompactPathW (HDC hDC, LPWSTR lpszPath, UINT dx)
 
UINT WINAPI PathGetCharTypeA (UCHAR ch)
 
UINT WINAPI PathGetCharTypeW (WCHAR ch)
 
static BOOL SHLWAPI_UseSystemForSystemFolders (void)
 
BOOL WINAPI PathMakeSystemFolderA (LPCSTR lpszPath)
 
BOOL WINAPI PathMakeSystemFolderW (LPCWSTR lpszPath)
 
BOOL WINAPI PathRenameExtensionA (LPSTR lpszPath, LPCSTR lpszExt)
 
BOOL WINAPI PathRenameExtensionW (LPWSTR lpszPath, LPCWSTR lpszExt)
 
BOOL WINAPI PathSearchAndQualifyA (LPCSTR lpszPath, LPSTR lpszBuf, UINT cchBuf)
 
BOOL WINAPI PathSearchAndQualifyW (LPCWSTR lpszPath, LPWSTR lpszBuf, UINT cchBuf)
 
LPSTR WINAPI PathSkipRootA (LPCSTR lpszPath)
 
LPWSTR WINAPI PathSkipRootW (LPCWSTR lpszPath)
 
HRESULT WINAPI PathCreateFromUrlA (LPCSTR pszUrl, LPSTR pszPath, LPDWORD pcchPath, DWORD dwReserved)
 
HRESULT WINAPI PathCreateFromUrlW (LPCWSTR pszUrl, LPWSTR pszPath, LPDWORD pcchPath, DWORD dwReserved)
 
HRESULT WINAPI PathCreateFromUrlAlloc (LPCWSTR pszUrl, LPWSTR *pszPath, DWORD dwReserved)
 
BOOL WINAPI PathRelativePathToA (LPSTR lpszPath, LPCSTR lpszFrom, DWORD dwAttrFrom, LPCSTR lpszTo, DWORD dwAttrTo)
 
BOOL WINAPI PathRelativePathToW (LPWSTR lpszPath, LPCWSTR lpszFrom, DWORD dwAttrFrom, LPCWSTR lpszTo, DWORD dwAttrTo)
 
BOOL WINAPI PathUnmakeSystemFolderA (LPCSTR lpszPath)
 
BOOL WINAPI PathUnmakeSystemFolderW (LPCWSTR lpszPath)
 
VOID WINAPI PathSetDlgItemPathA (HWND hDlg, int id, LPCSTR lpszPath)
 
VOID WINAPI PathSetDlgItemPathW (HWND hDlg, int id, LPCWSTR lpszPath)
 
BOOL WINAPI PathIsNetworkPathA (LPCSTR lpszPath)
 
BOOL WINAPI PathIsNetworkPathW (LPCWSTR lpszPath)
 
BOOL WINAPI PathIsLFNFileSpecA (LPCSTR lpszPath)
 
BOOL WINAPI PathIsLFNFileSpecW (LPCWSTR lpszPath)
 
BOOL WINAPI PathIsDirectoryEmptyA (LPCSTR lpszPath)
 
BOOL WINAPI PathIsDirectoryEmptyW (LPCWSTR lpszPath)
 
LPCSTR WINAPI PathFindSuffixArrayA (LPCSTR lpszSuffix, LPCSTR *lppszArray, int dwCount)
 
LPCWSTR WINAPI PathFindSuffixArrayW (LPCWSTR lpszSuffix, LPCWSTR *lppszArray, int dwCount)
 
VOID WINAPI PathUndecorateA (LPSTR lpszPath)
 
VOID WINAPI PathUndecorateW (LPWSTR lpszPath)
 
BOOL WINAPI PathUnExpandEnvStringsA (LPCSTR path, LPSTR buffer, UINT buf_len)
 
static void init_envvars_map (struct envvars_map *map)
 
BOOL WINAPI PathUnExpandEnvStringsW (LPCWSTR path, LPWSTR buffer, UINT buf_len)
 
HRESULT WINAPI SHGetWebFolderFilePathA (LPCSTR lpszFile, LPSTR lpszPath, DWORD dwPathLen)
 
BOOL WINAPI PathIsValidCharA (char c, DWORD class)
 
BOOL WINAPI PathIsValidCharW (WCHAR c, DWORD class)
 

Variables

static HMODULE SHLWAPI_hshell32
 
static fnpIsNetDrive pIsNetDrive
 
static const WCHAR allusersprofileW [] = {'%','A','L','L','U','S','E','R','S','P','R','O','F','I','L','E','%',0}
 
static const WCHAR appdataW [] = {'%','A','P','P','D','A','T','A','%',0}
 
static const WCHAR programfilesW [] = {'%','P','r','o','g','r','a','m','F','i','l','e','s','%',0}
 
static const WCHAR systemrootW [] = {'%','S','y','s','t','e','m','R','o','o','t','%',0}
 
static const WCHAR systemdriveW [] = {'%','S','y','s','t','e','m','D','r','i','v','e','%',0}
 
static const WCHAR userprofileW [] = {'%','U','S','E','R','P','R','O','F','I','L','E','%',0}
 
static const DWORD SHELL_charclass []
 

Macro Definition Documentation

◆ GET_FUNC

#define GET_FUNC (   func,
  module,
  name,
  fail 
)
Value:
do { \
if (!func) { \
if (!SHLWAPI_h##module && !(SHLWAPI_h##module = LoadLibraryA(#module ".dll"))) return fail; \
func = (fn##func)GetProcAddress(SHLWAPI_h##module, name); \
if (!func) return fail; \
} \
} while (0)
#define GetProcAddress(x, y)
Definition: compat.h:753
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
GLenum func
Definition: glext.h:6028
Definition: name.c:39
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159

Definition at line 52 of file path.c.

◆ NO_SHLWAPI_STREAM

#define NO_SHLWAPI_STREAM

Definition at line 36 of file path.c.

◆ PATH_CHAR_CLASS_ANY

#define PATH_CHAR_CLASS_ANY   0xffffffff

Definition at line 4330 of file path.c.

◆ PATH_CHAR_CLASS_ASTERIX

#define PATH_CHAR_CLASS_ASTERIX   0x00000002

Definition at line 4319 of file path.c.

◆ PATH_CHAR_CLASS_BACKSLASH

#define PATH_CHAR_CLASS_BACKSLASH   0x00000008

Definition at line 4321 of file path.c.

◆ PATH_CHAR_CLASS_COLON

#define PATH_CHAR_CLASS_COLON   0x00000010

Definition at line 4322 of file path.c.

◆ PATH_CHAR_CLASS_COMMA

#define PATH_CHAR_CLASS_COMMA   0x00000040

Definition at line 4324 of file path.c.

◆ PATH_CHAR_CLASS_DOT

#define PATH_CHAR_CLASS_DOT   0x00000004

Definition at line 4320 of file path.c.

◆ PATH_CHAR_CLASS_DOUBLEQUOTE

#define PATH_CHAR_CLASS_DOUBLEQUOTE   0x00000200

Definition at line 4327 of file path.c.

◆ PATH_CHAR_CLASS_INVALID

#define PATH_CHAR_CLASS_INVALID   0x00000000

Definition at line 4329 of file path.c.

◆ PATH_CHAR_CLASS_LETTER

#define PATH_CHAR_CLASS_LETTER   0x00000001

Definition at line 4318 of file path.c.

◆ PATH_CHAR_CLASS_OTHER_VALID

#define PATH_CHAR_CLASS_OTHER_VALID   0x00000100

Definition at line 4326 of file path.c.

◆ PATH_CHAR_CLASS_SEMICOLON

#define PATH_CHAR_CLASS_SEMICOLON   0x00000020

Definition at line 4323 of file path.c.

◆ PATH_CHAR_CLASS_SPACE

#define PATH_CHAR_CLASS_SPACE   0x00000080

Definition at line 4325 of file path.c.

◆ szWebLen

#define szWebLen   (sizeof(szWeb)/sizeof(WCHAR))

◆ szWebMuiLen

#define szWebMuiLen   ((sizeof(szWebMui)+1)/sizeof(WCHAR))

Typedef Documentation

◆ fnpIsNetDrive

typedef BOOL(WINAPI * fnpIsNetDrive) (int)

Definition at line 65 of file path.c.

Function Documentation

◆ heap_strdupAtoW()

static WCHAR * heap_strdupAtoW ( LPCSTR  str)
inlinestatic

Definition at line 73 of file path.c.

74{
75 WCHAR *ret = NULL;
76
77 if (str)
78 {
80 ret = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
81 if (ret)
83 }
84
85 return ret;
86}
#define NULL
Definition: types.h:112
#define GetProcessHeap()
Definition: compat.h:736
#define CP_ACP
Definition: compat.h:109
#define HeapAlloc
Definition: compat.h:733
#define MultiByteToWideChar
Definition: compat.h:110
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
const WCHAR * str
int ret
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by PathUnExpandEnvStringsA().

◆ init_envvars_map()

static void init_envvars_map ( struct envvars_map map)
static

Definition at line 4175 of file path.c.

4176{
4177 while (map->var)
4178 {
4179 map->len = ExpandEnvironmentStringsW(map->var, map->path, sizeof(map->path)/sizeof(WCHAR));
4180 /* exclude null from length */
4181 if (map->len) map->len--;
4182 map++;
4183 }
4184}
Definition: _map.h:48
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519

Referenced by PathUnExpandEnvStringsW().

◆ PathAddBackslashA()

LPSTR WINAPI PathAddBackslashA ( LPSTR  lpszPath)

Definition at line 263 of file path.c.

264{
265 size_t iLen;
266 LPSTR prev = lpszPath;
267
268 TRACE("(%s)\n",debugstr_a(lpszPath));
269
270 if (!lpszPath || (iLen = strlen(lpszPath)) >= MAX_PATH)
271 return NULL;
272
273 if (iLen)
274 {
275 do {
276 lpszPath = CharNextA(prev);
277 if (*lpszPath)
278 prev = lpszPath;
279 } while (*lpszPath);
280 if (*prev != '\\')
281 {
282 *lpszPath++ = '\\';
283 *lpszPath = '\0';
284 }
285 }
286 return lpszPath;
287}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define MAX_PATH
Definition: compat.h:34
#define debugstr_a
Definition: kernel32.h:31
#define TRACE(s)
Definition: solgame.cpp:4
LPSTR WINAPI CharNextA(_In_ LPCSTR)
char * LPSTR
Definition: xmlstorage.h:182

◆ PathAddBackslashW()

LPWSTR WINAPI PathAddBackslashW ( LPWSTR  lpszPath)

Definition at line 294 of file path.c.

295{
296 size_t iLen;
297
298 TRACE("(%s)\n",debugstr_w(lpszPath));
299
300 if (!lpszPath || (iLen = strlenW(lpszPath)) >= MAX_PATH)
301 return NULL;
302
303 if (iLen)
304 {
305 lpszPath += iLen;
306 if (lpszPath[-1] != '\\')
307 {
308 *lpszPath++ = '\\';
309 *lpszPath = '\0';
310 }
311 }
312 return lpszPath;
313}
#define debugstr_w
Definition: kernel32.h:32
#define strlenW(s)
Definition: unicode.h:28

◆ PathAddExtensionA()

BOOL WINAPI PathAddExtensionA ( LPSTR  lpszPath,
LPCSTR  lpszExtension 
)

Definition at line 2615 of file path.c.

2616{
2617 size_t dwLen;
2618
2619 TRACE("(%s,%s)\n", debugstr_a(lpszPath), debugstr_a(lpszExtension));
2620
2621 if (!lpszPath || !lpszExtension || *(PathFindExtensionA(lpszPath)))
2622 return FALSE;
2623
2624 dwLen = strlen(lpszPath);
2625
2626 if (dwLen + strlen(lpszExtension) >= MAX_PATH)
2627 return FALSE;
2628
2629 strcpy(lpszPath + dwLen, lpszExtension);
2630 return TRUE;
2631}
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
LPSTR WINAPI PathFindExtensionA(LPCSTR lpszPath)
Definition: path.c:422

◆ PathAddExtensionW()

BOOL WINAPI PathAddExtensionW ( LPWSTR  lpszPath,
LPCWSTR  lpszExtension 
)

Definition at line 2638 of file path.c.

2639{
2640 size_t dwLen;
2641
2642 TRACE("(%s,%s)\n", debugstr_w(lpszPath), debugstr_w(lpszExtension));
2643
2644 if (!lpszPath || !lpszExtension || *(PathFindExtensionW(lpszPath)))
2645 return FALSE;
2646
2647 dwLen = strlenW(lpszPath);
2648
2649 if (dwLen + strlenW(lpszExtension) >= MAX_PATH)
2650 return FALSE;
2651
2652 strcpyW(lpszPath + dwLen, lpszExtension);
2653 return TRUE;
2654}
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
Definition: path.c:447
#define strcpyW(d, s)
Definition: unicode.h:29

◆ PathAppendA()

BOOL WINAPI PathAppendA ( LPSTR  lpszPath,
LPCSTR  lpszAppend 
)

Definition at line 106 of file path.c.

107{
108 TRACE("(%s,%s)\n",debugstr_a(lpszPath), debugstr_a(lpszAppend));
109
110 if (lpszPath && lpszAppend)
111 {
112 if (!PathIsUNCA(lpszAppend))
113 while (*lpszAppend == '\\')
114 lpszAppend++;
115 if (PathCombineA(lpszPath, lpszPath, lpszAppend))
116 return TRUE;
117 }
118 return FALSE;
119}
BOOL WINAPI PathIsUNCA(LPCSTR lpszPath)
Definition: path.c:2243
#define PathCombineA
Definition: pathcch.h:316

◆ PathAppendW()

BOOL WINAPI PathAppendW ( LPWSTR  lpszPath,
LPCWSTR  lpszAppend 
)

Definition at line 126 of file path.c.

127{
128 TRACE("(%s,%s)\n",debugstr_w(lpszPath), debugstr_w(lpszAppend));
129
130 if (lpszPath && lpszAppend)
131 {
132 if (!PathIsUNCW(lpszAppend))
133 while (*lpszAppend == '\\')
134 lpszAppend++;
135 if (PathCombineW(lpszPath, lpszPath, lpszAppend))
136 return TRUE;
137 }
138 return FALSE;
139}
BOOL WINAPI PathIsUNCW(LPCWSTR lpszPath)
Definition: path.c:2266
#define PathCombineW
Definition: pathcch.h:317

◆ PathBuildRootA()

LPSTR WINAPI PathBuildRootA ( LPSTR  lpszPath,
int  drive 
)

Definition at line 329 of file path.c.

330{
331 TRACE("(%p,%d)\n", lpszPath, drive);
332
333 if (lpszPath && drive >= 0 && drive < 26)
334 {
335 lpszPath[0] = 'A' + drive;
336 lpszPath[1] = ':';
337 lpszPath[2] = '\\';
338 lpszPath[3] = '\0';
339 }
340 return lpszPath;
341}

Referenced by ATL::CPathT< StringType >::PathBuildRootX(), and test_PathBuildRootA().

◆ PathBuildRootW()

LPWSTR WINAPI PathBuildRootW ( LPWSTR  lpszPath,
int  drive 
)

Definition at line 348 of file path.c.

349{
350 TRACE("(%p,%d)\n", lpszPath, drive);
351
352 if (lpszPath && drive >= 0 && drive < 26)
353 {
354 lpszPath[0] = 'A' + drive;
355 lpszPath[1] = ':';
356 lpszPath[2] = '\\';
357 lpszPath[3] = '\0';
358 }
359 return lpszPath;
360}

Referenced by IsLFNDriveW(), CDesktopBrowser::OnDeviceChange(), CDrivesFolder::ParseDisplayName(), ATL::CPathT< StringType >::PathBuildRootX(), and PathQualifyExW().

◆ PathCanonicalizeA()

BOOL WINAPI PathCanonicalizeA ( LPSTR  lpszBuf,
LPCSTR  lpszPath 
)

Definition at line 2413 of file path.c.

2414{
2415 BOOL bRet = FALSE;
2416
2417 TRACE("(%p,%s)\n", lpszBuf, debugstr_a(lpszPath));
2418
2419 if (lpszBuf)
2420 *lpszBuf = '\0';
2421
2422 if (!lpszBuf || !lpszPath)
2424 else
2425 {
2427 WCHAR szBuff[MAX_PATH];
2428 int ret = MultiByteToWideChar(CP_ACP,0,lpszPath,-1,szPath,MAX_PATH);
2429
2430 if (!ret) {
2431 WARN("Failed to convert string to widechar (too long?), LE %d.\n", GetLastError());
2432 return FALSE;
2433 }
2434 bRet = PathCanonicalizeW(szBuff, szPath);
2435 WideCharToMultiByte(CP_ACP,0,szBuff,-1,lpszBuf,MAX_PATH,0,0);
2436 }
2437 return bRet;
2438}
#define WARN(fmt,...)
Definition: debug.h:112
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define SetLastError(x)
Definition: compat.h:752
#define WideCharToMultiByte
Definition: compat.h:111
unsigned int BOOL
Definition: ntddk_ex.h:94
LPCWSTR szPath
Definition: env.c:37
#define PathCanonicalizeW
Definition: pathcch.h:313
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

◆ PathCanonicalizeW()

BOOL WINAPI PathCanonicalizeW ( LPWSTR  lpszBuf,
LPCWSTR  lpszPath 
)

Definition at line 2446 of file path.c.

2447{
2448 LPWSTR lpszDst = lpszBuf;
2449 LPCWSTR lpszSrc = lpszPath;
2450
2451 TRACE("(%p,%s)\n", lpszBuf, debugstr_w(lpszPath));
2452
2453 if (lpszBuf)
2454 *lpszDst = '\0';
2455
2456 if (!lpszBuf || !lpszPath)
2457 {
2459 return FALSE;
2460 }
2461
2462 if (!*lpszPath)
2463 {
2464 *lpszBuf++ = '\\';
2465 *lpszBuf = '\0';
2466 return TRUE;
2467 }
2468
2469 /* Copy path root */
2470 if (*lpszSrc == '\\')
2471 {
2472 *lpszDst++ = *lpszSrc++;
2473 }
2474 else if (*lpszSrc && lpszSrc[1] == ':')
2475 {
2476 /* X:\ */
2477 *lpszDst++ = *lpszSrc++;
2478 *lpszDst++ = *lpszSrc++;
2479 if (*lpszSrc == '\\')
2480 *lpszDst++ = *lpszSrc++;
2481 }
2482
2483 /* Canonicalize the rest of the path */
2484 while (*lpszSrc)
2485 {
2486 if (*lpszSrc == '.')
2487 {
2488 if (lpszSrc[1] == '\\' && (lpszSrc == lpszPath || lpszSrc[-1] == '\\' || lpszSrc[-1] == ':'))
2489 {
2490 lpszSrc += 2; /* Skip .\ */
2491 }
2492 else if (lpszSrc[1] == '.' && (lpszDst == lpszBuf || lpszDst[-1] == '\\'))
2493 {
2494 /* \.. backs up a directory, over the root if it has no \ following X:.
2495 * .. is ignored if it would remove a UNC server name or initial \\
2496 */
2497 if (lpszDst != lpszBuf)
2498 {
2499 *lpszDst = '\0'; /* Allow PathIsUNCServerShareA test on lpszBuf */
2500 if (lpszDst > lpszBuf+1 && lpszDst[-1] == '\\' &&
2501 (lpszDst[-2] != '\\' || lpszDst > lpszBuf+2))
2502 {
2503 if (lpszDst[-2] == ':' && (lpszDst > lpszBuf+3 || lpszDst[-3] == ':'))
2504 {
2505 lpszDst -= 2;
2506 while (lpszDst > lpszBuf && *lpszDst != '\\')
2507 lpszDst--;
2508 if (*lpszDst == '\\')
2509 lpszDst++; /* Reset to last '\' */
2510 else
2511 lpszDst = lpszBuf; /* Start path again from new root */
2512 }
2513 else if (lpszDst[-2] != ':' && !PathIsUNCServerShareW(lpszBuf))
2514 lpszDst -= 2;
2515 }
2516 while (lpszDst > lpszBuf && *lpszDst != '\\')
2517 lpszDst--;
2518 if (lpszDst == lpszBuf)
2519 {
2520 *lpszDst++ = '\\';
2521 lpszSrc++;
2522 }
2523 }
2524 lpszSrc += 2; /* Skip .. in src path */
2525 }
2526 else
2527 *lpszDst++ = *lpszSrc++;
2528 }
2529 else
2530 *lpszDst++ = *lpszSrc++;
2531 }
2532 /* Append \ to naked drive specs */
2533 if (lpszDst - lpszBuf == 2 && lpszDst[-1] == ':')
2534 *lpszDst++ = '\\';
2535 *lpszDst++ = '\0';
2536 return TRUE;
2537}
BOOL WINAPI PathIsUNCServerShareW(LPCWSTR lpszPath)
Definition: path.c:2378
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

◆ PathCombineA()

LPSTR WINAPI PathCombineA ( LPSTR  lpszDest,
LPCSTR  lpszDir,
LPCSTR  lpszFile 
)

Definition at line 159 of file path.c.

160{
161 WCHAR szDest[MAX_PATH];
162 WCHAR szDir[MAX_PATH];
163 WCHAR szFile[MAX_PATH];
164 TRACE("(%p,%s,%s)\n", lpszDest, debugstr_a(lpszDir), debugstr_a(lpszFile));
165
166 /* Invalid parameters */
167 if (!lpszDest)
168 return NULL;
169 if (!lpszDir && !lpszFile)
170 goto fail;
171
172 if (lpszDir)
173 if (!MultiByteToWideChar(CP_ACP,0,lpszDir,-1,szDir,MAX_PATH))
174 goto fail;
175
176 if (lpszFile)
177 if (!MultiByteToWideChar(CP_ACP,0,lpszFile,-1,szFile,MAX_PATH))
178 goto fail;
179
180 if (PathCombineW(szDest, lpszDir ? szDir : NULL, lpszFile ? szFile : NULL))
181 if (WideCharToMultiByte(CP_ACP,0,szDest,-1,lpszDest,MAX_PATH,0,0))
182 return lpszDest;
183
184fail:
185 lpszDest[0] = 0;
186 return NULL;
187}
WCHAR lpszDest[260]

◆ PathCombineW()

LPWSTR WINAPI PathCombineW ( LPWSTR  lpszDest,
LPCWSTR  lpszDir,
LPCWSTR  lpszFile 
)

Definition at line 194 of file path.c.

195{
196 WCHAR szTemp[MAX_PATH];
197 BOOL bUseBoth = FALSE, bStrip = FALSE;
198
199 TRACE("(%p,%s,%s)\n", lpszDest, debugstr_w(lpszDir), debugstr_w(lpszFile));
200
201 /* Invalid parameters */
202 if (!lpszDest)
203 return NULL;
204 if (!lpszDir && !lpszFile)
205 {
206 lpszDest[0] = 0;
207 return NULL;
208 }
209
210 if ((!lpszFile || !*lpszFile) && lpszDir)
211 {
212 /* Use dir only */
213 lstrcpynW(szTemp, lpszDir, MAX_PATH);
214 }
215 else if (!lpszDir || !*lpszDir || !PathIsRelativeW(lpszFile))
216 {
217 if (!lpszDir || !*lpszDir || *lpszFile != '\\' || PathIsUNCW(lpszFile))
218 {
219 /* Use file only */
220 lstrcpynW(szTemp, lpszFile, MAX_PATH);
221 }
222 else
223 {
224 bUseBoth = TRUE;
225 bStrip = TRUE;
226 }
227 }
228 else
229 bUseBoth = TRUE;
230
231 if (bUseBoth)
232 {
233 lstrcpynW(szTemp, lpszDir, MAX_PATH);
234 if (bStrip)
235 {
236 PathStripToRootW(szTemp);
237 lpszFile++; /* Skip '\' */
238 }
239 if (!PathAddBackslashW(szTemp) || strlenW(szTemp) + strlenW(lpszFile) >= MAX_PATH)
240 {
241 lpszDest[0] = 0;
242 return NULL;
243 }
244 strcatW(szTemp, lpszFile);
245 }
246
248 return lpszDest;
249}
#define lstrcpynW
Definition: compat.h:738
BOOL WINAPI PathStripToRootW(LPWSTR lpszPath)
Definition: path.c:733
BOOL WINAPI PathIsRelativeW(LPCWSTR lpszPath)
Definition: path.c:1579
#define PathAddBackslashW
Definition: pathcch.h:301
#define strcatW(d, s)
Definition: unicode.h:30

◆ PathCommonPrefixA()

int WINAPI PathCommonPrefixA ( LPCSTR  lpszFile1,
LPCSTR  lpszFile2,
LPSTR  achPath 
)

Definition at line 2751 of file path.c.

2752{
2753 size_t iLen = 0;
2754 LPCSTR lpszIter1 = lpszFile1;
2755 LPCSTR lpszIter2 = lpszFile2;
2756
2757 TRACE("(%s,%s,%p)\n", debugstr_a(lpszFile1), debugstr_a(lpszFile2), achPath);
2758
2759 if (achPath)
2760 *achPath = '\0';
2761
2762 if (!lpszFile1 || !lpszFile2)
2763 return 0;
2764
2765 /* Handle roots first */
2766 if (PathIsUNCA(lpszFile1))
2767 {
2768 if (!PathIsUNCA(lpszFile2))
2769 return 0;
2770 lpszIter1 += 2;
2771 lpszIter2 += 2;
2772 }
2773 else if (PathIsUNCA(lpszFile2))
2774 return 0; /* Know already lpszFile1 is not UNC */
2775
2776 do
2777 {
2778 /* Update len */
2779 if ((!*lpszIter1 || *lpszIter1 == '\\') &&
2780 (!*lpszIter2 || *lpszIter2 == '\\'))
2781 iLen = lpszIter1 - lpszFile1; /* Common to this point */
2782
2783 if (!*lpszIter1 || (tolower(*lpszIter1) != tolower(*lpszIter2)))
2784 break; /* Strings differ at this point */
2785
2786 lpszIter1++;
2787 lpszIter2++;
2788 } while (1);
2789
2790 if (iLen == 2)
2791 iLen++; /* Feature/Bug compatible with Win32 */
2792
2793 if (iLen && achPath)
2794 {
2795 memcpy(achPath,lpszFile1,iLen);
2796 achPath[iLen] = '\0';
2797 }
2798 return iLen;
2799}
int tolower(int c)
Definition: utclib.c:902
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
const char * LPCSTR
Definition: xmlstorage.h:183

Referenced by ATL::CPathT< StringType >::PathCommonPrefixX(), PathIsPrefixA(), PathIsSameRootA(), and test_PathCommonPrefixA().

◆ PathCommonPrefixW()

int WINAPI PathCommonPrefixW ( LPCWSTR  lpszFile1,
LPCWSTR  lpszFile2,
LPWSTR  achPath 
)

Definition at line 2806 of file path.c.

2807{
2808 size_t iLen = 0;
2809 LPCWSTR lpszIter1 = lpszFile1;
2810 LPCWSTR lpszIter2 = lpszFile2;
2811
2812 TRACE("(%s,%s,%p)\n", debugstr_w(lpszFile1), debugstr_w(lpszFile2), achPath);
2813
2814 if (achPath)
2815 *achPath = '\0';
2816
2817 if (!lpszFile1 || !lpszFile2)
2818 return 0;
2819
2820 /* Handle roots first */
2821 if (PathIsUNCW(lpszFile1))
2822 {
2823 if (!PathIsUNCW(lpszFile2))
2824 return 0;
2825 lpszIter1 += 2;
2826 lpszIter2 += 2;
2827 }
2828 else if (PathIsUNCW(lpszFile2))
2829 return 0; /* Know already lpszFile1 is not UNC */
2830
2831 do
2832 {
2833 /* Update len */
2834 if ((!*lpszIter1 || *lpszIter1 == '\\') &&
2835 (!*lpszIter2 || *lpszIter2 == '\\'))
2836 iLen = lpszIter1 - lpszFile1; /* Common to this point */
2837
2838 if (!*lpszIter1 || (tolowerW(*lpszIter1) != tolowerW(*lpszIter2)))
2839 break; /* Strings differ at this point */
2840
2841 lpszIter1++;
2842 lpszIter2++;
2843 } while (1);
2844
2845 if (iLen == 2)
2846 iLen++; /* Feature/Bug compatible with Win32 */
2847
2848 if (iLen && achPath)
2849 {
2850 memcpy(achPath,lpszFile1,iLen * sizeof(WCHAR));
2851 achPath[iLen] = '\0';
2852 }
2853 return iLen;
2854}
#define tolowerW(n)
Definition: unicode.h:44

Referenced by DynamicPathCommonPrefixW(), ATL::CPathT< StringType >::PathCommonPrefixX(), PathIsPrefixW(), PathIsSameRootW(), and PathRelativePathToW().

◆ PathCompactPathA()

BOOL WINAPI PathCompactPathA ( HDC  hDC,
LPSTR  lpszPath,
UINT  dx 
)

Definition at line 2870 of file path.c.

2871{
2872 BOOL bRet = FALSE;
2873
2874 TRACE("(%p,%s,%d)\n", hDC, debugstr_a(lpszPath), dx);
2875
2876 if (lpszPath)
2877 {
2880 bRet = PathCompactPathW(hDC, szPath, dx);
2881 WideCharToMultiByte(CP_ACP,0,szPath,-1,lpszPath,MAX_PATH,0,0);
2882 }
2883 return bRet;
2884}
static HDC hDC
Definition: 3dtext.c:33
BOOL WINAPI PathCompactPathW(HDC hDC, LPWSTR lpszPath, UINT dx)
Definition: path.c:2891
GLint dx
Definition: linetemp.h:97

Referenced by ATL::CPathT< StringType >::PathCompactPathX().

◆ PathCompactPathExA()

BOOL WINAPI PathCompactPathExA ( LPSTR  lpszDest,
LPCSTR  lpszPath,
UINT  cchMax,
DWORD  dwFlags 
)

Definition at line 1435 of file path.c.

1437{
1438 BOOL bRet = FALSE;
1439
1440 TRACE("(%p,%s,%d,0x%08x)\n", lpszDest, debugstr_a(lpszPath), cchMax, dwFlags);
1441
1442 if (lpszPath && lpszDest)
1443 {
1445 WCHAR szDest[MAX_PATH];
1446
1448 szDest[0] = '\0';
1449 bRet = PathCompactPathExW(szDest, szPath, cchMax, dwFlags);
1451 }
1452 return bRet;
1453}
UINT cchMax
BOOL WINAPI PathCompactPathExW(LPWSTR lpszDest, LPCWSTR lpszPath, UINT cchMax, DWORD dwFlags)
Definition: path.c:1460
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176

Referenced by ATL::CPathT< StringType >::PathCompactPathExX().

◆ PathCompactPathExW()

BOOL WINAPI PathCompactPathExW ( LPWSTR  lpszDest,
LPCWSTR  lpszPath,
UINT  cchMax,
DWORD  dwFlags 
)

Definition at line 1460 of file path.c.

1462{
1463 static const WCHAR szEllipses[] = { '.', '.', '.', '\0' };
1464 LPCWSTR lpszFile;
1465 DWORD dwLen, dwFileLen = 0;
1466
1467 TRACE("(%p,%s,%d,0x%08x)\n", lpszDest, debugstr_w(lpszPath), cchMax, dwFlags);
1468
1469 if (!lpszPath)
1470 return FALSE;
1471
1472 if (!lpszDest)
1473 {
1474 WARN("Invalid lpszDest would crash under Win32!\n");
1475 return FALSE;
1476 }
1477
1478 *lpszDest = '\0';
1479
1480 if (cchMax < 2)
1481 return TRUE;
1482
1483 dwLen = strlenW(lpszPath) + 1;
1484
1485 if (dwLen < cchMax)
1486 {
1487 /* Don't need to compact */
1488 memcpy(lpszDest, lpszPath, dwLen * sizeof(WCHAR));
1489 return TRUE;
1490 }
1491
1492 /* Path must be compacted to fit into lpszDest */
1493 lpszFile = PathFindFileNameW(lpszPath);
1494 dwFileLen = lpszPath + dwLen - lpszFile;
1495
1496 if (dwFileLen == dwLen)
1497 {
1498 /* No root in psth */
1499 if (cchMax <= 4)
1500 {
1501 while (--cchMax > 0) /* No room left for anything but ellipses */
1502 *lpszDest++ = '.';
1503 *lpszDest = '\0';
1504 return TRUE;
1505 }
1506 /* Compact the file name with ellipses at the end */
1507 cchMax -= 4;
1508 memcpy(lpszDest, lpszFile, cchMax * sizeof(WCHAR));
1509 strcpyW(lpszDest + cchMax, szEllipses);
1510 return TRUE;
1511 }
1512 /* We have a root in the path */
1513 lpszFile--; /* Start compacted filename with the path separator */
1514 dwFileLen++;
1515
1516 if (dwFileLen + 3 > cchMax)
1517 {
1518 /* Compact the file name */
1519 if (cchMax <= 4)
1520 {
1521 while (--cchMax > 0) /* No room left for anything but ellipses */
1522 *lpszDest++ = '.';
1523 *lpszDest = '\0';
1524 return TRUE;
1525 }
1526 strcpyW(lpszDest, szEllipses);
1527 lpszDest += 3;
1528 cchMax -= 4;
1529 *lpszDest++ = *lpszFile++;
1530 if (cchMax <= 4)
1531 {
1532 while (--cchMax > 0) /* No room left for anything but ellipses */
1533 *lpszDest++ = '.';
1534 *lpszDest = '\0';
1535 return TRUE;
1536 }
1537 cchMax -= 4;
1538 memcpy(lpszDest, lpszFile, cchMax * sizeof(WCHAR));
1539 strcpyW(lpszDest + cchMax, szEllipses);
1540 return TRUE;
1541 }
1542
1543 /* Only the root needs to be Compacted */
1544 dwLen = cchMax - dwFileLen - 3;
1545 memcpy(lpszDest, lpszPath, dwLen * sizeof(WCHAR));
1546 strcpyW(lpszDest + dwLen, szEllipses);
1547 strcpyW(lpszDest + dwLen + 3, lpszFile);
1548 return TRUE;
1549}
LPWSTR WINAPI PathFindFileNameW(LPCWSTR lpszPath)
Definition: path.c:394

Referenced by PathCompactPathExA(), and ATL::CPathT< StringType >::PathCompactPathExX().

◆ PathCompactPathW()

BOOL WINAPI PathCompactPathW ( HDC  hDC,
LPWSTR  lpszPath,
UINT  dx 
)

Definition at line 2891 of file path.c.

2892{
2893 static const WCHAR szEllipses[] = { '.', '.', '.', '\0' };
2894 BOOL bRet = TRUE;
2895 HDC hdc = 0;
2897 SIZE size;
2898 DWORD dwLen;
2899
2900 TRACE("(%p,%s,%d)\n", hDC, debugstr_w(lpszPath), dx);
2901
2902 if (!lpszPath)
2903 return FALSE;
2904
2905 if (!hDC)
2906 hdc = hDC = GetDC(0);
2907
2908 /* Get the length of the whole path */
2909 dwLen = strlenW(lpszPath);
2910 GetTextExtentPointW(hDC, lpszPath, dwLen, &size);
2911
2912 if ((UINT)size.cx > dx)
2913 {
2914 /* Path too big, must reduce it */
2915 LPWSTR sFile;
2916 DWORD dwEllipsesLen = 0, dwPathLen = 0;
2917
2918 sFile = PathFindFileNameW(lpszPath);
2919 if (sFile != lpszPath) sFile--;
2920
2921 /* Get the size of ellipses */
2922 GetTextExtentPointW(hDC, szEllipses, 3, &size);
2923 dwEllipsesLen = size.cx;
2924 /* Get the size of the file name */
2925 GetTextExtentPointW(hDC, sFile, strlenW(sFile), &size);
2926 dwPathLen = size.cx;
2927
2928 if (sFile != lpszPath)
2929 {
2930 LPWSTR sPath = sFile;
2931 BOOL bEllipses = FALSE;
2932
2933 /* The path includes a file name. Include as much of the path prior to
2934 * the file name as possible, allowing for the ellipses, e.g:
2935 * c:\some very long path\filename ==> c:\some v...\filename
2936 */
2937 lstrcpynW(buff, sFile, MAX_PATH);
2938
2939 do
2940 {
2941 DWORD dwTotalLen = bEllipses? dwPathLen + dwEllipsesLen : dwPathLen;
2942
2943 GetTextExtentPointW(hDC, lpszPath, sPath - lpszPath, &size);
2944 dwTotalLen += size.cx;
2945 if (dwTotalLen <= dx)
2946 break;
2947 sPath--;
2948 if (!bEllipses)
2949 {
2950 bEllipses = TRUE;
2951 sPath -= 2;
2952 }
2953 } while (sPath > lpszPath);
2954
2955 if (sPath > lpszPath)
2956 {
2957 if (bEllipses)
2958 {
2959 strcpyW(sPath, szEllipses);
2960 strcpyW(sPath+3, buff);
2961 }
2962 bRet = TRUE;
2963 goto end;
2964 }
2965 strcpyW(lpszPath, szEllipses);
2966 strcpyW(lpszPath+3, buff);
2967 bRet = FALSE;
2968 goto end;
2969 }
2970
2971 /* Trim the path by adding ellipses to the end, e.g:
2972 * A very long file name.txt ==> A very...
2973 */
2974 dwLen = strlenW(lpszPath);
2975
2976 if (dwLen > MAX_PATH - 3)
2977 dwLen = MAX_PATH - 3;
2978 lstrcpynW(buff, sFile, dwLen);
2979
2980 do {
2981 dwLen--;
2982 GetTextExtentPointW(hDC, buff, dwLen, &size);
2983 } while (dwLen && size.cx + dwEllipsesLen > dx);
2984
2985 if (!dwLen)
2986 {
2987 DWORD dwWritten = 0;
2988
2989 dwEllipsesLen /= 3; /* Size of a single '.' */
2990
2991 /* Write as much of the Ellipses string as possible */
2992 while (dwWritten + dwEllipsesLen < dx && dwLen < 3)
2993 {
2994 *lpszPath++ = '.';
2995 dwWritten += dwEllipsesLen;
2996 dwLen++;
2997 }
2998 *lpszPath = '\0';
2999 bRet = FALSE;
3000 }
3001 else
3002 {
3003 strcpyW(buff + dwLen, szEllipses);
3004 strcpyW(lpszPath, buff);
3005 }
3006 }
3007
3008end:
3009 if (hdc)
3010 ReleaseDC(0, hdc);
3011
3012 return bRet;
3013}
static unsigned char buff[32768]
Definition: fatten.c:17
GLuint GLuint end
Definition: gl.h:1545
GLsizeiptr size
Definition: glext.h:5919
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:92
unsigned int UINT
Definition: ndis.h:50
BOOL WINAPI GetTextExtentPointW(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE lpsz)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC WINAPI GetDC(_In_opt_ HWND)

Referenced by CZipExtract::CCompleteSettingsPage::OnSetActive(), PathCompactPathA(), ATL::CPathT< StringType >::PathCompactPathX(), and PathSetDlgItemPathW().

◆ PathCreateFromUrlA()

HRESULT WINAPI PathCreateFromUrlA ( LPCSTR  pszUrl,
LPSTR  pszPath,
LPDWORD  pcchPath,
DWORD  dwReserved 
)

Definition at line 3306 of file path.c.

3308{
3309 WCHAR bufW[MAX_PATH];
3310 WCHAR *pathW = bufW;
3311 UNICODE_STRING urlW;
3312 HRESULT ret;
3313 DWORD lenW = sizeof(bufW)/sizeof(WCHAR), lenA;
3314
3315 if (!pszUrl || !pszPath || !pcchPath || !*pcchPath)
3316 return E_INVALIDARG;
3317
3318 if(!RtlCreateUnicodeStringFromAsciiz(&urlW, pszUrl))
3319 return E_INVALIDARG;
3320 if((ret = PathCreateFromUrlW(urlW.Buffer, pathW, &lenW, dwReserved)) == E_POINTER) {
3321 pathW = HeapAlloc(GetProcessHeap(), 0, lenW * sizeof(WCHAR));
3322 ret = PathCreateFromUrlW(urlW.Buffer, pathW, &lenW, dwReserved);
3323 }
3324 if(ret == S_OK) {
3325 RtlUnicodeToMultiByteSize(&lenA, pathW, lenW * sizeof(WCHAR));
3326 if(*pcchPath > lenA) {
3327 RtlUnicodeToMultiByteN(pszPath, *pcchPath - 1, &lenA, pathW, lenW * sizeof(WCHAR));
3328 pszPath[lenA] = 0;
3329 *pcchPath = lenA;
3330 } else {
3331 *pcchPath = lenA + 1;
3332 ret = E_POINTER;
3333 }
3334 }
3335 if(pathW != bufW) HeapFree(GetProcessHeap(), 0, pathW);
3336 RtlFreeUnicodeString(&urlW);
3337 return ret;
3338}
#define E_INVALIDARG
Definition: ddrawi.h:101
#define HeapFree(x, y, z)
Definition: compat.h:735
HRESULT WINAPI PathCreateFromUrlW(LPCWSTR pszUrl, LPWSTR pszPath, LPDWORD pcchPath, DWORD dwReserved)
Definition: path.c:3355
#define S_OK
Definition: intsafe.h:52
static LPWSTR PDWORD pcchPath
Definition: asmcache.c:747
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:95
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
_Use_decl_annotations_ NTSTATUS NTAPI RtlUnicodeToMultiByteN(_Out_ PCHAR MbString, _In_ ULONG MbSize, _Out_opt_ PULONG ResultSize, _In_ PCWCH UnicodeString, _In_ ULONG UnicodeSize)
Definition: nlsboot.c:107
_Use_decl_annotations_ NTSTATUS NTAPI RtlUnicodeToMultiByteSize(_Out_ PULONG MbSize, _In_ PCWCH UnicodeString, _In_ ULONG UnicodeSize)
Definition: nlsboot.c:145
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define E_POINTER
Definition: winerror.h:2365

Referenced by FileProtocolHandlerA().

◆ PathCreateFromUrlAlloc()

HRESULT WINAPI PathCreateFromUrlAlloc ( LPCWSTR  pszUrl,
LPWSTR pszPath,
DWORD  dwReserved 
)

Definition at line 3497 of file path.c.

3499{
3500 WCHAR pathW[MAX_PATH];
3501 DWORD size;
3502 HRESULT hr;
3503
3504 size = MAX_PATH;
3505 hr = PathCreateFromUrlW(pszUrl, pathW, &size, dwReserved);
3506 if (SUCCEEDED(hr))
3507 {
3508 /* Yes, this is supposed to crash if pszPath is NULL */
3509 *pszPath = StrDupW(pathW);
3510 }
3511 return hr;
3512}
LPWSTR WINAPI StrDupW(LPCWSTR lpszStr)
Definition: string.c:1093
#define SUCCEEDED(hr)
Definition: intsafe.h:50
HRESULT hr
Definition: shlfolder.c:183

◆ PathCreateFromUrlW()

HRESULT WINAPI PathCreateFromUrlW ( LPCWSTR  pszUrl,
LPWSTR  pszPath,
LPDWORD  pcchPath,
DWORD  dwReserved 
)

Definition at line 3355 of file path.c.

3357{
3358 static const WCHAR file_colon[] = { 'f','i','l','e',':',0 };
3359 static const WCHAR localhost[] = { 'l','o','c','a','l','h','o','s','t',0 };
3360 DWORD nslashes, unescape, len;
3361 const WCHAR *src;
3362 WCHAR *tpath, *dst;
3363 HRESULT ret;
3364
3365 TRACE("(%s,%p,%p,0x%08x)\n", debugstr_w(pszUrl), pszPath, pcchPath, dwReserved);
3366
3367 if (!pszUrl || !pszPath || !pcchPath || !*pcchPath)
3368 return E_INVALIDARG;
3369
3370 if (lstrlenW(pszUrl) < 5)
3371 return E_INVALIDARG;
3372
3374 file_colon, 5) != CSTR_EQUAL)
3375 return E_INVALIDARG;
3376 pszUrl += 5;
3377 ret = S_OK;
3378
3379 src = pszUrl;
3380 nslashes = 0;
3381 while (*src == '/' || *src == '\\') {
3382 nslashes++;
3383 src++;
3384 }
3385
3386 /* We need a temporary buffer so we can compute what size to ask for.
3387 * We know that the final string won't be longer than the current pszUrl
3388 * plus at most two backslashes. All the other transformations make it
3389 * shorter.
3390 */
3391 len = 2 + lstrlenW(pszUrl) + 1;
3392 if (*pcchPath < len)
3393 tpath = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
3394 else
3395 tpath = pszPath;
3396
3397 len = 0;
3398 dst = tpath;
3399 unescape = 1;
3400 switch (nslashes)
3401 {
3402 case 0:
3403 /* 'file:' + escaped DOS path */
3404 break;
3405 case 1:
3406 /* 'file:/' + escaped DOS path */
3407 /* fall through */
3408 case 3:
3409 /* 'file:///' (implied localhost) + escaped DOS path */
3410 if (!isalphaW(*src) || (src[1] != ':' && src[1] != '|'))
3411 src -= 1;
3412 break;
3413 case 2:
3415 src, 9, localhost, 9) == CSTR_EQUAL && (src[9] == '/' || src[9] == '\\'))
3416 {
3417 /* 'file://localhost/' + escaped DOS path */
3418 src += 10;
3419 }
3420 else if (isalphaW(*src) && (src[1] == ':' || src[1] == '|'))
3421 {
3422 /* 'file://' + unescaped DOS path */
3423 unescape = 0;
3424 }
3425 else
3426 {
3427 /* 'file://hostname:port/path' (where path is escaped)
3428 * or 'file:' + escaped UNC path (\\server\share\path)
3429 * The second form is clearly specific to Windows and it might
3430 * even be doing a network lookup to try to figure it out.
3431 */
3432 while (*src && *src != '/' && *src != '\\')
3433 src++;
3434 len = src - pszUrl;
3435 StrCpyNW(dst, pszUrl, len + 1);
3436 dst += len;
3437 if (*src && isalphaW(src[1]) && (src[2] == ':' || src[2] == '|'))
3438 {
3439 /* 'Forget' to add a trailing '/', just like Windows */
3440 src++;
3441 }
3442 }
3443 break;
3444 case 4:
3445 /* 'file://' + unescaped UNC path (\\server\share\path) */
3446 unescape = 0;
3447 if (isalphaW(*src) && (src[1] == ':' || src[1] == '|'))
3448 break;
3449 /* fall through */
3450 default:
3451 /* 'file:/...' + escaped UNC path (\\server\share\path) */
3452 src -= 2;
3453 }
3454
3455 /* Copy the remainder of the path */
3456 len += lstrlenW(src);
3457 StrCpyW(dst, src);
3458
3459 /* First do the Windows-specific path conversions */
3460 for (dst = tpath; *dst; dst++)
3461 if (*dst == '/') *dst = '\\';
3462 if (isalphaW(*tpath) && tpath[1] == '|')
3463 tpath[1] = ':'; /* c| -> c: */
3464
3465 /* And only then unescape the path (i.e. escaped slashes are left as is) */
3466 if (unescape)
3467 {
3469 if (ret == S_OK)
3470 {
3471 /* When working in-place UrlUnescapeW() does not set len */
3472 len = lstrlenW(tpath);
3473 }
3474 }
3475
3476 if (*pcchPath < len + 1)
3477 {
3478 ret = E_POINTER;
3479 *pcchPath = len + 1;
3480 }
3481 else
3482 {
3483 *pcchPath = len;
3484 if (tpath != pszPath)
3485 StrCpyW(pszPath, tpath);
3486 }
3487 if (tpath != pszPath)
3488 HeapFree(GetProcessHeap(), 0, tpath);
3489
3490 TRACE("Returning (%u) %s\n", *pcchPath, debugstr_w(pszPath));
3491 return ret;
3492}
#define lstrlenW
Definition: compat.h:750
LPWSTR WINAPI StrCpyNW(LPWSTR dst, LPCWSTR src, int count)
Definition: string.c:536
LPWSTR WINAPI StrCpyW(LPWSTR lpszStr, LPCWSTR lpszSrc)
Definition: string.c:514
HRESULT WINAPI UrlUnescapeW(LPWSTR pszUrl, LPWSTR pszUnescaped, LPDWORD pcchUnescaped, DWORD dwFlags)
Definition: url.c:1367
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
BOOL unescape(WCHAR *str, size_t *len)
Definition: lex.c:227
INT WINAPI CompareStringW(LCID lcid, DWORD flags, LPCWSTR str1, INT len1, LPCWSTR str2, INT len2)
Definition: lang.c:2671
static const BYTE localhost[]
Definition: encode.c:1442
#define LOCALE_INVARIANT
#define isalphaW(n)
Definition: unicode.h:48
#define URL_UNESCAPE_INPLACE
Definition: shlwapi.h:1224
#define NORM_IGNORECASE
Definition: winnls.h:176
#define CSTR_EQUAL
Definition: winnls.h:456

Referenced by CDesktopFolder::_ParseDisplayNameByParent(), DocObjectService_FireBeforeNavigate2(), InternetCrackUrlW(), on_before_navigate2(), parse_path_from_url(), PathCreateFromUrlA(), PathCreateFromUrlAlloc(), SHELL_execute(), and CDownloadManager::ThreadFunc().

◆ PathFileExistsA()

BOOL WINAPI PathFileExistsA ( LPCSTR  lpszPath)

Definition at line 1755 of file path.c.

1756{
1757 UINT iPrevErrMode;
1758 DWORD dwAttr;
1759
1760 TRACE("(%s)\n",debugstr_a(lpszPath));
1761
1762 if (!lpszPath)
1763 return FALSE;
1764
1765 /* Prevent a dialog box if path is on a disk that has been ejected. */
1766 iPrevErrMode = SetErrorMode(SEM_FAILCRITICALERRORS);
1767 dwAttr = GetFileAttributesA(lpszPath);
1768 SetErrorMode(iPrevErrMode);
1769 return dwAttr != INVALID_FILE_ATTRIBUTES;
1770}
UINT WINAPI SetErrorMode(IN UINT uMode)
Definition: except.c:751
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
Definition: fileinfo.c:636
#define SEM_FAILCRITICALERRORS
Definition: rtltypes.h:69
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23

Referenced by DoTestEntry(), PathFileExistsAW(), ATL::CPathT< StringType >::PathFileExistsX(), and START_TEST().

◆ PathFileExistsAndAttributesA()

BOOL WINAPI PathFileExistsAndAttributesA ( LPCSTR  lpszPath,
DWORD dwAttr 
)

Definition at line 1806 of file path.c.

1807{
1808 UINT iPrevErrMode;
1809 DWORD dwVal = 0;
1810
1811 TRACE("(%s %p)\n", debugstr_a(lpszPath), dwAttr);
1812
1813 if (dwAttr)
1814 *dwAttr = INVALID_FILE_ATTRIBUTES;
1815
1816 if (!lpszPath)
1817 return FALSE;
1818
1819 iPrevErrMode = SetErrorMode(SEM_FAILCRITICALERRORS);
1820 dwVal = GetFileAttributesA(lpszPath);
1821 SetErrorMode(iPrevErrMode);
1822 if (dwAttr)
1823 *dwAttr = dwVal;
1824 return (dwVal != INVALID_FILE_ATTRIBUTES);
1825}

◆ PathFileExistsAndAttributesW()

BOOL WINAPI PathFileExistsAndAttributesW ( LPCWSTR  lpszPath,
DWORD dwAttr 
)

Definition at line 1832 of file path.c.

1833{
1834 UINT iPrevErrMode;
1835 DWORD dwVal;
1836
1837 TRACE("(%s %p)\n", debugstr_w(lpszPath), dwAttr);
1838
1839 if (!lpszPath)
1840 return FALSE;
1841
1842 iPrevErrMode = SetErrorMode(SEM_FAILCRITICALERRORS);
1843 dwVal = GetFileAttributesW(lpszPath);
1844 SetErrorMode(iPrevErrMode);
1845 if (dwAttr)
1846 *dwAttr = dwVal;
1847 return (dwVal != INVALID_FILE_ATTRIBUTES);
1848}
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652

Referenced by PathResolveW().

◆ PathFileExistsDefExtA()

BOOL WINAPI PathFileExistsDefExtA ( LPSTR  lpszPath,
DWORD  dwWhich 
)

Definition at line 1195 of file path.c.

1196{
1197 BOOL bRet = FALSE;
1198
1199 TRACE("(%s,%d)\n", debugstr_a(lpszPath), dwWhich);
1200
1201 if (lpszPath)
1202 {
1205 bRet = PathFileExistsDefExtW(szPath, dwWhich);
1206 if (bRet)
1207 WideCharToMultiByte(CP_ACP,0,szPath,-1,lpszPath,MAX_PATH,0,0);
1208 }
1209 return bRet;
1210}
BOOL WINAPI PathFileExistsDefExtW(LPWSTR lpszPath, DWORD dwWhich)
Definition: path.c:1117

◆ PathFileExistsDefExtW()

BOOL WINAPI PathFileExistsDefExtW ( LPWSTR  lpszPath,
DWORD  dwWhich 
)

Definition at line 1117 of file path.c.

1118{
1119 static const WCHAR pszExts[][5] = { { '.', 'p', 'i', 'f', 0},
1120 { '.', 'c', 'o', 'm', 0},
1121 { '.', 'e', 'x', 'e', 0},
1122 { '.', 'b', 'a', 't', 0},
1123 { '.', 'l', 'n', 'k', 0},
1124 { '.', 'c', 'm', 'd', 0},
1125 { 0, 0, 0, 0, 0} };
1126
1127 TRACE("(%s,%d)\n", debugstr_w(lpszPath), dwWhich);
1128
1129 if (!lpszPath || PathIsUNCServerW(lpszPath) || PathIsUNCServerShareW(lpszPath))
1130 return FALSE;
1131
1132 if (dwWhich)
1133 {
1134 LPCWSTR szExt = PathFindExtensionW(lpszPath);
1135#ifndef __REACTOS__
1136 if (!*szExt || dwWhich & 0x40)
1137#else
1138 if (!*szExt || dwWhich & WHICH_OPTIONAL)
1139#endif
1140 {
1141 size_t iChoose = 0;
1142 int iLen = lstrlenW(lpszPath);
1143 if (iLen > (MAX_PATH - 5))
1144 return FALSE;
1145#ifndef __REACTOS__
1146 while ( (dwWhich & 0x1) && pszExts[iChoose][0] )
1147#else
1148 while (pszExts[iChoose][0])
1149#endif
1150 {
1151#ifdef __REACTOS__
1152 if (dwWhich & 0x1)
1153 {
1155#endif
1156 lstrcpyW(lpszPath + iLen, pszExts[iChoose]);
1157 if (PathFileExistsW(lpszPath))
1158 return TRUE;
1159#ifdef __REACTOS__
1160 }
1161#endif
1162 iChoose++;
1163 dwWhich >>= 1;
1164 }
1165 *(lpszPath + iLen) = (WCHAR)'\0';
1166 return FALSE;
1167 }
1168 }
1169 return PathFileExistsW(lpszPath);
1170}
#define lstrcpyW
Definition: compat.h:749
BOOL WINAPI PathIsUNCServerW(LPCWSTR lpszPath)
Definition: path.c:2323
BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath)
Definition: path.c:1777
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define WHICH_OPTIONAL
#define GetFileAttributes
Definition: winbase.h:3815

Referenced by PathFileExistsDefExtA(), PathFindOnPathExA(), PathFindOnPathExW(), PathSearchOnExtensionsW(), and SHLWAPI_PathFindInOtherDirs().

◆ PathFileExistsW()

BOOL WINAPI PathFileExistsW ( LPCWSTR  lpszPath)

Definition at line 1777 of file path.c.

1778{
1779 UINT iPrevErrMode;
1780 DWORD dwAttr;
1781
1782 TRACE("(%s)\n",debugstr_w(lpszPath));
1783
1784 if (!lpszPath)
1785 return FALSE;
1786
1787 iPrevErrMode = SetErrorMode(SEM_FAILCRITICALERRORS);
1788 dwAttr = GetFileAttributesW(lpszPath);
1789 SetErrorMode(iPrevErrMode);
1790 return dwAttr != INVALID_FILE_ATTRIBUTES;
1791}

Referenced by CFSDropTarget::_GetUniqueFileName(), BrowseCallbackProc(), CAvailableApplicationInfo::CAvailableApplicationInfo(), copy_dir_to_dir(), copy_file(), copy_file_to_file(), copy_files(), copy_to_dir(), create_dest_dirs(), DoGetZipName(), DoTestEntry(), CMyDocsDropHandler::Drop(), CDeskLinkDropHandler::Drop(), FILEDLG95_InitControls(), FILEDLG95_OnOpen(), FILEDLG95_ValidatePathAction(), FindSubProgram(), GetSubProgramPath(), CFileDefExt::InitOpensWithField(), LoadOSList(), move_file_to_file(), move_files(), move_to_dir(), CACListISF::Next(), on_default_action(), CShellLink::OnNotify(), OpenMailer(), PathFileExistsAW(), PathFileExistsDefExtW(), ATL::CPathT< StringType >::PathFileExistsX(), PathYetAnotherMakeUniqueName(), CDirectoryWatcher::ProcessNotification(), CShellLink::Save(), SHAddToRecentDocs(), SHCreatePropertyBagOnProfileSection(), ShellExecCmdLine(), SHExplorerParseCmdLine(), SHGetFolderPathAndSubDirW(), SHGetWebFolderFilePathW(), ShowCreateShortcutWizard(), SHPropertyBag_OnIniFile(), SHSimpleIDListFromPathA(), SHSimpleIDListFromPathW(), START_TEST(), TEST_Start(), try_find_new_name(), and WelcomeDlgProc().

◆ PathFindExtensionA()

LPSTR WINAPI PathFindExtensionA ( LPCSTR  lpszPath)

Definition at line 422 of file path.c.

423{
424 LPCSTR lastpoint = NULL;
425
426 TRACE("(%s)\n", debugstr_a(lpszPath));
427
428 if (lpszPath)
429 {
430 while (*lpszPath)
431 {
432 if (*lpszPath == '\\' || *lpszPath==' ')
433 lastpoint = NULL;
434 else if (*lpszPath == '.')
435 lastpoint = lpszPath;
436 lpszPath = CharNextA(lpszPath);
437 }
438 }
439 return (LPSTR)(lastpoint ? lastpoint : lpszPath);
440}

Referenced by _ILGetExtension(), FD31_UpdateResult(), FILEDLG95_OnOpen(), PathAddExtensionA(), ATL::CPathT< StringType >::PathFindExtensionX(), PathGetExtensionA(), PathIsContentTypeA(), PathRemoveExtensionA(), PathRenameExtensionA(), PathUndecorateA(), and test_PathFindExtensionA().

◆ PathFindExtensionW()

LPWSTR WINAPI PathFindExtensionW ( LPCWSTR  lpszPath)

Definition at line 447 of file path.c.

448{
449 LPCWSTR lastpoint = NULL;
450
451 TRACE("(%s)\n", debugstr_w(lpszPath));
452
453 if (lpszPath)
454 {
455 while (*lpszPath)
456 {
457 if (*lpszPath == '\\' || *lpszPath==' ')
458 lastpoint = NULL;
459 else if (*lpszPath == '.')
460 lastpoint = lpszPath;
461 lpszPath++;
462 }
463 }
464 return (LPWSTR)(lastpoint ? lastpoint : lpszPath);
465}

Referenced by CFileSysEnum::_AddFindResult(), CFSDropTarget::_DoDrop(), add_favs_to_menu(), COpenWithList::AddAppToMRUList(), CFSFolder::CompareIDs(), CRecycleBin::CompareIDs(), CreateShortcut(), CFontExt::Drop(), CDeskLinkDropHandler::Drop(), ExtensionFromPidl(), FD31_UpdateResult(), FileCompareWildTitle(), FILEDLG95_OnOpen(), FM_InitMenuPopup(), get_first_ext_from_spec(), GetAssocClass(), CRecycleBin::GetDetailsOf(), CMainWindow::GetSaveFileName(), CQueryAssociations::Init(), CLayerUIPropPage::InitFile(), CFileDefExt::InitFileType(), COpenWithMenu::Initialize(), CFileDefExt::InitOpensWithField(), COpenWithMenu::InvokeCommand(), LoadPropSheetHandlers(), COpenWithList::LoadRecommended(), OFNHookProc(), on_default_action(), CShellLink::OnNotify(), CDefView::OnNotify(), PathAddExtensionW(), PathFileExistsDefExtW(), ATL::CPathT< StringType >::PathFindExtensionX(), PathGetExtensionW(), PathIsContentTypeW(), PathRemoveExtensionW(), PathRenameExtensionW(), PathSearchOnExtensionsW(), PathUndecorateW(), PathYetAnotherMakeUniqueName(), process_extensions(), BtrfsContextMenu::reflink_copy(), CImageDx::SaveDx(), CMainWindow::saveImage(), COpenWithList::SetDefaultHandler(), CFSFolder::SetNameOf(), SH_GetTargetTypeByPath(), SHAddToRecentDocs(), SHELL32_GetFSItemAttributes(), SHELL_FS_HideExtension(), ShellExecute_GetClassKey(), SHGetFileInfoW(), ShowCreateShortcutWizard(), test_properties(), try_find_new_name(), and URLDownloadToCacheFileW().

◆ PathFindFileNameA()

LPSTR WINAPI PathFindFileNameA ( LPCSTR  lpszPath)

Definition at line 373 of file path.c.

374{
375 LPCSTR lastSlash = lpszPath;
376
377 TRACE("(%s)\n",debugstr_a(lpszPath));
378
379 while (lpszPath && *lpszPath)
380 {
381 if ((*lpszPath == '\\' || *lpszPath == '/' || *lpszPath == ':') &&
382 lpszPath[1] && lpszPath[1] != '\\' && lpszPath[1] != '/')
383 lastSlash = lpszPath + 1;
384 lpszPath = CharNextA(lpszPath);
385 }
386 return (LPSTR)lastSlash;
387}

Referenced by FD31_UpdateResult(), FILEDLG95_OnOpen(), GetFileDialog95(), ATL::CPathT< StringType >::PathFindFileNameX(), and PathStripPathA().

◆ PathFindFileNameW()

LPWSTR WINAPI PathFindFileNameW ( LPCWSTR  lpszPath)

Definition at line 394 of file path.c.

395{
396 LPCWSTR lastSlash = lpszPath;
397
398 TRACE("(%s)\n",debugstr_w(lpszPath));
399
400 while (lpszPath && *lpszPath)
401 {
402 if ((*lpszPath == '\\' || *lpszPath == '/' || *lpszPath == ':') &&
403 lpszPath[1] && lpszPath[1] != '\\' && lpszPath[1] != '/')
404 lastSlash = lpszPath + 1;
405 lpszPath++;
406 }
407 return (LPWSTR)lastSlash;
408}

Referenced by _CZipAskPassword(), _CZipAskReplace(), CFSDropTarget::_DoDrop(), _ILCreate(), COpenWithList::Add(), CheckForError(), CFontExt::CompareIDs(), CRecycleBin::CompareIDs(), copy_file(), copy_file_to_file(), create_target_directory(), CreateSendToMyDocuments(), DoGetFileTitle(), CDeskLinkDropHandler::Drop(), FD31_UpdateResult(), FILEDLG95_OnOpen(), FinishDlgProc(), CFileDefExt::GeneralPageProc(), get_volume_path_parent(), CFontExt::GetDetailsOf(), GetFileDialog95(), CShellLink::GetPath(), COpenWithDialog::Init(), CFileDefExt::InitFilePath(), CFileDefExt::InitGeneralPage(), CFileDefExt::InitOpensWithField(), IsTitleWild(), COpenWithList::LoadFromProgIdKey(), LoadPropSheetHandlers(), move_file_to_file(), msi_dialog_directorylist_up(), OFNHookProc(), CShellLink::OnInitDialog(), OpenMailer(), PathCompactPathExW(), PathCompactPathW(), ATL::CPathT< StringType >::PathFindFileNameX(), PathStripPathW(), Preview_UpdateTitle(), BtrfsContextMenu::reflink_copy(), SetFileInfo(), SH_ShowPropertiesDialog(), SHAddToRecentDocs(), SHCreatePropertyBagOnProfileSection(), SHGetFileInfoW(), ShowCreateShortcutWizard(), test_MultipleFiles(), and TEST_Start().

◆ PathFindNextComponentA()

LPSTR WINAPI PathFindNextComponentA ( LPCSTR  lpszPath)

Definition at line 2556 of file path.c.

2557{
2558 LPSTR lpszSlash;
2559
2560 TRACE("(%s)\n", debugstr_a(lpszPath));
2561
2562 if(!lpszPath || !*lpszPath)
2563 return NULL;
2564
2565 if ((lpszSlash = StrChrA(lpszPath, '\\')))
2566 {
2567 if (lpszSlash[1] == '\\')
2568 lpszSlash++;
2569 return lpszSlash + 1;
2570 }
2571 return (LPSTR)lpszPath + strlen(lpszPath);
2572}
LPSTR WINAPI StrChrA(LPCSTR lpszStr, WORD ch)
Definition: string.c:270

◆ PathFindNextComponentW()

LPWSTR WINAPI PathFindNextComponentW ( LPCWSTR  lpszPath)

Definition at line 2579 of file path.c.

2580{
2581 LPWSTR lpszSlash;
2582
2583 TRACE("(%s)\n", debugstr_w(lpszPath));
2584
2585 if(!lpszPath || !*lpszPath)
2586 return NULL;
2587
2588 if ((lpszSlash = StrChrW(lpszPath, '\\')))
2589 {
2590 if (lpszSlash[1] == '\\')
2591 lpszSlash++;
2592 return lpszSlash + 1;
2593 }
2594 return (LPWSTR)lpszPath + strlenW(lpszPath);
2595}
LPWSTR WINAPI StrChrW(LPCWSTR lpszStr, WCHAR ch)
Definition: string.c:468

Referenced by FILEDLG95_ValidatePathAction(), PathRelativePathToW(), and Test_GetDisplayNameOf().

◆ PathFindOnPathA()

BOOL WINAPI PathFindOnPathA ( LPSTR  lpszFile,
LPCSTR lppszOtherDirs 
)

Definition at line 1392 of file path.c.

1393{
1394 TRACE("(%s,%p)\n", debugstr_a(lpszFile), lppszOtherDirs);
1395 return PathFindOnPathExA(lpszFile, lppszOtherDirs, 0);
1396 }
BOOL WINAPI PathFindOnPathExA(LPSTR lpszFile, LPCSTR *lppszOtherDirs, DWORD dwWhich)
Definition: path.c:1307

◆ PathFindOnPathExA()

BOOL WINAPI PathFindOnPathExA ( LPSTR  lpszFile,
LPCSTR lppszOtherDirs,
DWORD  dwWhich 
)

Definition at line 1307 of file path.c.

1308{
1309 WCHAR szFile[MAX_PATH];
1311
1312 TRACE("(%s,%p,%08x)\n", debugstr_a(lpszFile), lppszOtherDirs, dwWhich);
1313
1314 if (!lpszFile || !PathIsFileSpecA(lpszFile))
1315 return FALSE;
1316
1317 MultiByteToWideChar(CP_ACP,0,lpszFile,-1,szFile,MAX_PATH);
1318
1319 /* Search provided directories first */
1320 if (lppszOtherDirs && *lppszOtherDirs)
1321 {
1322 WCHAR szOther[MAX_PATH];
1323 LPCSTR *lpszOtherPath = lppszOtherDirs;
1324
1325 while (lpszOtherPath && *lpszOtherPath && (*lpszOtherPath)[0])
1326 {
1327 MultiByteToWideChar(CP_ACP,0,*lpszOtherPath,-1,szOther,MAX_PATH);
1328 PathCombineW(buff, szOther, szFile);
1329 if (PathFileExistsDefExtW(buff, dwWhich))
1330 {
1331 WideCharToMultiByte(CP_ACP,0,buff,-1,lpszFile,MAX_PATH,0,0);
1332 return TRUE;
1333 }
1334 lpszOtherPath++;
1335 }
1336 }
1337 /* Not found, try system and path dirs */
1338 if (SHLWAPI_PathFindInOtherDirs(szFile, dwWhich))
1339 {
1340 WideCharToMultiByte(CP_ACP,0,szFile,-1,lpszFile,MAX_PATH,0,0);
1341 return TRUE;
1342 }
1343 return FALSE;
1344}
static BOOL SHLWAPI_PathFindInOtherDirs(LPWSTR lpszFile, DWORD dwWhich)
Definition: path.c:1217
BOOL WINAPI PathIsFileSpecA(LPCSTR lpszPath)
Definition: path.c:2112

Referenced by PathFindOnPathA().

◆ PathFindOnPathExW()

BOOL WINAPI PathFindOnPathExW ( LPWSTR  lpszFile,
LPCWSTR lppszOtherDirs,
DWORD  dwWhich 
)

Definition at line 1351 of file path.c.

1352{
1354
1355 TRACE("(%s,%p,%08x)\n", debugstr_w(lpszFile), lppszOtherDirs, dwWhich);
1356
1357 if (!lpszFile || !PathIsFileSpecW(lpszFile))
1358 return FALSE;
1359
1360 /* Search provided directories first */
1361 if (lppszOtherDirs && *lppszOtherDirs)
1362 {
1363 LPCWSTR *lpszOtherPath = lppszOtherDirs;
1364 while (lpszOtherPath && *lpszOtherPath && (*lpszOtherPath)[0])
1365 {
1366 PathCombineW(buff, *lpszOtherPath, lpszFile);
1367 if (PathFileExistsDefExtW(buff, dwWhich))
1368 {
1369 strcpyW(lpszFile, buff);
1370 return TRUE;
1371 }
1372 lpszOtherPath++;
1373 }
1374 }
1375 /* Not found, try system and path dirs */
1376 return SHLWAPI_PathFindInOtherDirs(lpszFile, dwWhich);
1377}
BOOL WINAPI PathIsFileSpecW(LPCWSTR lpszPath)
Definition: path.c:2133

Referenced by PathFindOnPathW(), PathSearchOnExtensionsW(), ShellExecCmdLine(), and WelcomeDlgProc().

◆ PathFindOnPathW()

BOOL WINAPI PathFindOnPathW ( LPWSTR  lpszFile,
LPCWSTR lppszOtherDirs 
)

Definition at line 1403 of file path.c.

1404{
1405 TRACE("(%s,%p)\n", debugstr_w(lpszFile), lppszOtherDirs);
1406 return PathFindOnPathExW(lpszFile,lppszOtherDirs, 0);
1407}
BOOL WINAPI PathFindOnPathExW(LPWSTR lpszFile, LPCWSTR *lppszOtherDirs, DWORD dwWhich)
Definition: path.c:1351

Referenced by DoEntry(), and PathResolveW().

◆ PathFindSuffixArrayA()

LPCSTR WINAPI PathFindSuffixArrayA ( LPCSTR  lpszSuffix,
LPCSTR lppszArray,
int  dwCount 
)

Definition at line 3993 of file path.c.

3994{
3995 size_t dwLen;
3996 int dwRet = 0;
3997
3998 TRACE("(%s,%p,%d)\n",debugstr_a(lpszSuffix), lppszArray, dwCount);
3999
4000 if (lpszSuffix && lppszArray && dwCount > 0)
4001 {
4002 dwLen = strlen(lpszSuffix);
4003
4004 while (dwRet < dwCount)
4005 {
4006 size_t dwCompareLen = strlen(*lppszArray);
4007 if (dwCompareLen < dwLen)
4008 {
4009 if (!strcmp(lpszSuffix + dwLen - dwCompareLen, *lppszArray))
4010 return *lppszArray; /* Found */
4011 }
4012 dwRet++;
4013 lppszArray++;
4014 }
4015 }
4016 return NULL;
4017}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469

◆ PathFindSuffixArrayW()

LPCWSTR WINAPI PathFindSuffixArrayW ( LPCWSTR  lpszSuffix,
LPCWSTR lppszArray,
int  dwCount 
)

Definition at line 4024 of file path.c.

4025{
4026 size_t dwLen;
4027 int dwRet = 0;
4028
4029 TRACE("(%s,%p,%d)\n",debugstr_w(lpszSuffix), lppszArray, dwCount);
4030
4031 if (lpszSuffix && lppszArray && dwCount > 0)
4032 {
4033 dwLen = strlenW(lpszSuffix);
4034
4035 while (dwRet < dwCount)
4036 {
4037 size_t dwCompareLen = strlenW(*lppszArray);
4038 if (dwCompareLen < dwLen)
4039 {
4040 if (!strcmpW(lpszSuffix + dwLen - dwCompareLen, *lppszArray))
4041 return *lppszArray; /* Found */
4042 }
4043 dwRet++;
4044 lppszArray++;
4045 }
4046 }
4047 return NULL;
4048}
#define strcmpW(s1, s2)
Definition: unicode.h:38

◆ PathGetArgsA()

LPSTR WINAPI PathGetArgsA ( LPCSTR  lpszPath)

Definition at line 481 of file path.c.

482{
483 BOOL bSeenQuote = FALSE;
484
485 TRACE("(%s)\n",debugstr_a(lpszPath));
486
487 if (lpszPath)
488 {
489 while (*lpszPath)
490 {
491 if ((*lpszPath==' ') && !bSeenQuote)
492 return (LPSTR)lpszPath + 1;
493 if (*lpszPath == '"')
494 bSeenQuote = !bSeenQuote;
495 lpszPath = CharNextA(lpszPath);
496 }
497 }
498 return (LPSTR)lpszPath;
499}

Referenced by PathRemoveArgsA().

◆ PathGetArgsW()

LPWSTR WINAPI PathGetArgsW ( LPCWSTR  lpszPath)

Definition at line 506 of file path.c.

507{
508 BOOL bSeenQuote = FALSE;
509
510 TRACE("(%s)\n",debugstr_w(lpszPath));
511
512 if (lpszPath)
513 {
514 while (*lpszPath)
515 {
516 if ((*lpszPath==' ') && !bSeenQuote)
517 return (LPWSTR)lpszPath + 1;
518 if (*lpszPath == '"')
519 bSeenQuote = !bSeenQuote;
520 lpszPath++;
521 }
522 }
523 return (LPWSTR)lpszPath;
524}

Referenced by RunOnceExEntry::Exec(), CAddressEditBox::ExecuteCommandLine(), LanguagesPageProc(), CShellLink::OnNotify(), PathRemoveArgsW(), SHExplorerParseCmdLine(), and WelcomeDlgProc().

◆ PathGetCharTypeA()

UINT WINAPI PathGetCharTypeA ( UCHAR  ch)

Definition at line 3026 of file path.c.

3027{
3028 return PathGetCharTypeW(ch);
3029}
UINT WINAPI PathGetCharTypeW(WCHAR ch)
Definition: path.c:3036

Referenced by PathCleanupSpec().

◆ PathGetCharTypeW()

UINT WINAPI PathGetCharTypeW ( WCHAR  ch)

Definition at line 3036 of file path.c.

3037{
3038 UINT flags = 0;
3039
3040 TRACE("(%d)\n", ch);
3041
3042 if (!ch || ch < ' ' || ch == '<' || ch == '>' ||
3043 ch == '"' || ch == '|' || ch == '/')
3044 flags = GCT_INVALID; /* Invalid */
3045 else if (ch == '*' || ch=='?')
3046 flags = GCT_WILD; /* Wildchars */
3047 else if ((ch == '\\') || (ch == ':'))
3048 return GCT_SEPARATOR; /* Path separators */
3049 else
3050 {
3051 if (ch < 126)
3052 {
3053 if (((ch & 0x1) && ch != ';') || !ch || isalnum(ch) || ch == '$' || ch == '&' || ch == '(' ||
3054 ch == '.' || ch == '@' || ch == '^' ||
3055 ch == '\'' || ch == 130 || ch == '`')
3056 flags |= GCT_SHORTCHAR; /* All these are valid for DOS */
3057 }
3058 else
3059 flags |= GCT_SHORTCHAR; /* Bug compatible with win32 */
3060 flags |= GCT_LFNCHAR; /* Valid for long file names */
3061 }
3062 return flags;
3063}
GLbitfield flags
Definition: glext.h:7161
_Check_return_ _CRTIMP int __cdecl isalnum(_In_ int _C)
#define GCT_SHORTCHAR
Definition: shlwapi.h:777
#define GCT_LFNCHAR
Definition: shlwapi.h:776
#define GCT_SEPARATOR
Definition: shlwapi.h:779
#define GCT_INVALID
Definition: shlwapi.h:775
#define GCT_WILD
Definition: shlwapi.h:778

Referenced by PathCleanupSpec(), and PathGetCharTypeA().

◆ PathGetDriveNumberA()

int WINAPI PathGetDriveNumberA ( LPCSTR  lpszPath)

Definition at line 538 of file path.c.

539{
540 TRACE ("(%s)\n",debugstr_a(lpszPath));
541
542 if (lpszPath && !IsDBCSLeadByte(*lpszPath) && lpszPath[1] == ':' &&
543 tolower(*lpszPath) >= 'a' && tolower(*lpszPath) <= 'z')
544 return tolower(*lpszPath) - 'a';
545 return -1;
546}
BOOL WINAPI IsDBCSLeadByte(BYTE TestByte)
Definition: nls.c:2359

Referenced by ATL::CPathT< StringType >::PathGetDriveNumberX(), PathIsNetworkPathA(), and test_PathGetDriveNumber().

◆ PathGetDriveNumberW()

int WINAPI PathGetDriveNumberW ( const WCHAR path)

Definition at line 553 of file path.c.

554{
555 WCHAR drive;
556
557 static const WCHAR nt_prefixW[] = {'\\','\\','?','\\'};
558
559 TRACE("(%s)\n", debugstr_w(path));
560
561 if (!path)
562 return -1;
563
564 if (!strncmpW(path, nt_prefixW, 4))
565 path += 4;
566
567 drive = tolowerW(path[0]);
568 if (drive < 'a' || drive > 'z' || path[1] != ':')
569 return -1;
570
571 return drive - 'a';
572}
#define strncmpW(s1, s2, n)
Definition: unicode.h:36

Referenced by COMDLG32_GetCanonicalPath(), ATL::CPathT< StringType >::PathGetDriveNumberX(), PathIsAbsoluteW(), PathIsNetworkPathW(), PathQualifyExW(), SHChangeNotify(), SHIsRemovableDrive(), and test_PathGetDriveNumber().

◆ PathIsContentTypeA()

BOOL WINAPI PathIsContentTypeA ( LPCSTR  lpszPath,
LPCSTR  lpszContentType 
)

Definition at line 2058 of file path.c.

2059{
2060 LPCSTR szExt;
2061 DWORD dwDummy;
2062 char szBuff[MAX_PATH];
2063
2064 TRACE("(%s,%s)\n", debugstr_a(lpszPath), debugstr_a(lpszContentType));
2065
2066 if (lpszPath && (szExt = PathFindExtensionA(lpszPath)) && *szExt &&
2067 !SHGetValueA(HKEY_CLASSES_ROOT, szExt, "Content Type",
2068 REG_NONE, szBuff, &dwDummy) &&
2069 !strcasecmp(lpszContentType, szBuff))
2070 {
2071 return TRUE;
2072 }
2073 return FALSE;
2074}
DWORD WINAPI SHGetValueA(HKEY hKey, LPCSTR lpszSubKey, LPCSTR lpszValue, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
Definition: reg.c:1207
#define strcasecmp
Definition: fake.h:9
#define REG_NONE
Definition: nt_native.h:1492
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10

◆ PathIsContentTypeW()

BOOL WINAPI PathIsContentTypeW ( LPCWSTR  lpszPath,
LPCWSTR  lpszContentType 
)

Definition at line 2081 of file path.c.

2082{
2083 static const WCHAR szContentType[] = { 'C','o','n','t','e','n','t',' ','T','y','p','e','\0' };
2084 LPCWSTR szExt;
2085 DWORD dwDummy;
2086 WCHAR szBuff[MAX_PATH];
2087
2088 TRACE("(%s,%s)\n", debugstr_w(lpszPath), debugstr_w(lpszContentType));
2089
2090 if (lpszPath && (szExt = PathFindExtensionW(lpszPath)) && *szExt &&
2091 !SHGetValueW(HKEY_CLASSES_ROOT, szExt, szContentType,
2092 REG_NONE, szBuff, &dwDummy) &&
2093 !strcmpiW(lpszContentType, szBuff))
2094 {
2095 return TRUE;
2096 }
2097 return FALSE;
2098}
DWORD WINAPI SHGetValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
Definition: reg.c:1236
#define strcmpiW(s1, s2)
Definition: unicode.h:39

◆ PathIsDirectoryA()

BOOL WINAPI PathIsDirectoryA ( LPCSTR  lpszPath)

Definition at line 1698 of file path.c.

1699{
1700 DWORD dwAttr;
1701
1702 TRACE("(%s)\n", debugstr_a(lpszPath));
1703
1704 if (!lpszPath || PathIsUNCServerA(lpszPath))
1705 return FALSE;
1706
1707 if (PathIsUNCServerShareA(lpszPath))
1708 {
1709 FIXME("UNC Server Share not yet supported - FAILING\n");
1710 return FALSE;
1711 }
1712
1713 if ((dwAttr = GetFileAttributesA(lpszPath)) == INVALID_FILE_ATTRIBUTES)
1714 return FALSE;
1715 return dwAttr & FILE_ATTRIBUTE_DIRECTORY;
1716}
#define FIXME(fmt,...)
Definition: debug.h:111
BOOL WINAPI PathIsUNCServerA(LPCSTR lpszPath)
Definition: path.c:2301
BOOL WINAPI PathIsUNCServerShareA(LPCSTR lpszPath)
Definition: path.c:2351

Referenced by ATL::CPathT< StringType >::PathIsDirectoryX().

◆ PathIsDirectoryEmptyA()

BOOL WINAPI PathIsDirectoryEmptyA ( LPCSTR  lpszPath)

Definition at line 3911 of file path.c.

3912{
3913 BOOL bRet = FALSE;
3914
3915 TRACE("(%s)\n",debugstr_a(lpszPath));
3916
3917 if (lpszPath)
3918 {
3922 }
3923 return bRet;
3924}
BOOL WINAPI PathIsDirectoryEmptyW(LPCWSTR lpszPath)
Definition: path.c:3931

◆ PathIsDirectoryEmptyW()

BOOL WINAPI PathIsDirectoryEmptyW ( LPCWSTR  lpszPath)

Definition at line 3931 of file path.c.

3932{
3933 static const WCHAR szAllFiles[] = { '*', '.', '*', '\0' };
3934 WCHAR szSearch[MAX_PATH];
3935 DWORD dwLen;
3936 HANDLE hfind;
3937 BOOL retVal = TRUE;
3939
3940 TRACE("(%s)\n",debugstr_w(lpszPath));
3941
3942 if (!lpszPath || !PathIsDirectoryW(lpszPath))
3943 return FALSE;
3944
3945 lstrcpynW(szSearch, lpszPath, MAX_PATH);
3946 PathAddBackslashW(szSearch);
3947 dwLen = strlenW(szSearch);
3948 if (dwLen > MAX_PATH - 4)
3949 return FALSE;
3950
3951 strcpyW(szSearch + dwLen, szAllFiles);
3952 hfind = FindFirstFileW(szSearch, &find_data);
3953 if (hfind == INVALID_HANDLE_VALUE)
3954 return FALSE;
3955
3956 do
3957 {
3958 if (find_data.cFileName[0] == '.')
3959 {
3960 if (find_data.cFileName[1] == '\0') continue;
3961 if (find_data.cFileName[1] == '.' && find_data.cFileName[2] == '\0') continue;
3962 }
3963
3964 retVal = FALSE;
3965 break;
3966 }
3967 while (FindNextFileW(hfind, &find_data));
3968
3969 FindClose(hfind);
3970 return retVal;
3971}
static int find_data(const struct Vector *v, const BYTE *pData, int size)
Definition: filtermapper.c:162
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:382
BOOL WINAPI PathIsDirectoryW(LPCWSTR lpszPath)
Definition: path.c:1723

Referenced by move_dir_to_dir(), and PathIsDirectoryEmptyA().

◆ PathIsDirectoryW()

◆ PathIsFileSpecA()

BOOL WINAPI PathIsFileSpecA ( LPCSTR  lpszPath)

Definition at line 2112 of file path.c.

2113{
2114 TRACE("(%s)\n", debugstr_a(lpszPath));
2115
2116 if (!lpszPath)
2117 return FALSE;
2118
2119 while (*lpszPath)
2120 {
2121 if (*lpszPath == '\\' || *lpszPath == ':')
2122 return FALSE;
2123 lpszPath = CharNextA(lpszPath);
2124 }
2125 return TRUE;
2126}

Referenced by PathFindOnPathExA(), and ATL::CPathT< StringType >::PathIsFileSpecX().

◆ PathIsFileSpecW()

BOOL WINAPI PathIsFileSpecW ( LPCWSTR  lpszPath)

Definition at line 2133 of file path.c.

2134{
2135 TRACE("(%s)\n", debugstr_w(lpszPath));
2136
2137 if (!lpszPath)
2138 return FALSE;
2139
2140 while (*lpszPath)
2141 {
2142 if (*lpszPath == '\\' || *lpszPath == ':')
2143 return FALSE;
2144 lpszPath++;
2145 }
2146 return TRUE;
2147}

Referenced by Control_LoadApplet(), PathFindOnPathExW(), ATL::CPathT< StringType >::PathIsFileSpecX(), PathResolveW(), and CShellLink::SetTargetFromPIDLOrPath().

◆ PathIsLFNFileSpecA()

BOOL WINAPI PathIsLFNFileSpecA ( LPCSTR  lpszPath)

Definition at line 3822 of file path.c.

3823{
3824 DWORD dwNameLen = 0, dwExtLen = 0;
3825
3826 TRACE("(%s)\n",debugstr_a(lpszPath));
3827
3828 if (!lpszPath)
3829 return FALSE;
3830
3831 while (*lpszPath)
3832 {
3833 if (*lpszPath == ' ')
3834 return TRUE; /* DOS names cannot have spaces */
3835 if (*lpszPath == '.')
3836 {
3837 if (dwExtLen)
3838 return TRUE; /* DOS names have only one dot */
3839 dwExtLen = 1;
3840 }
3841 else if (dwExtLen)
3842 {
3843 dwExtLen++;
3844 if (dwExtLen > 4)
3845 return TRUE; /* DOS extensions are <= 3 chars*/
3846 }
3847 else
3848 {
3849 dwNameLen++;
3850 if (dwNameLen > 8)
3851 return TRUE; /* DOS names are <= 8 chars */
3852 }
3853 lpszPath += IsDBCSLeadByte(*lpszPath) ? 2 : 1;
3854 }
3855 return FALSE; /* Valid DOS path */
3856}

◆ PathIsLFNFileSpecW()

BOOL WINAPI PathIsLFNFileSpecW ( LPCWSTR  lpszPath)

Definition at line 3863 of file path.c.

3864{
3865 DWORD dwNameLen = 0, dwExtLen = 0;
3866
3867 TRACE("(%s)\n",debugstr_w(lpszPath));
3868
3869 if (!lpszPath)
3870 return FALSE;
3871
3872 while (*lpszPath)
3873 {
3874 if (*lpszPath == ' ')
3875 return TRUE; /* DOS names cannot have spaces */
3876 if (*lpszPath == '.')
3877 {
3878 if (dwExtLen)
3879 return TRUE; /* DOS names have only one dot */
3880 dwExtLen = 1;
3881 }
3882 else if (dwExtLen)
3883 {
3884 dwExtLen++;
3885 if (dwExtLen > 4)
3886 return TRUE; /* DOS extensions are <= 3 chars*/
3887 }
3888 else
3889 {
3890 dwNameLen++;
3891 if (dwNameLen > 8)
3892 return TRUE; /* DOS names are <= 8 chars */
3893 }
3894 lpszPath++;
3895 }
3896 return FALSE; /* Valid DOS path */
3897}

◆ PathIsNetworkPathA()

BOOL WINAPI PathIsNetworkPathA ( LPCSTR  lpszPath)

Definition at line 3763 of file path.c.

3764{
3765 int dwDriveNum;
3766
3767 TRACE("(%s)\n",debugstr_a(lpszPath));
3768
3769 if (!lpszPath)
3770 return FALSE;
3771 if (*lpszPath == '\\' && lpszPath[1] == '\\')
3772 return TRUE;
3773 dwDriveNum = PathGetDriveNumberA(lpszPath);
3774 if (dwDriveNum == -1)
3775 return FALSE;
3776#ifdef __REACTOS__
3777 return IsNetDrive(dwDriveNum);
3778#else
3779 GET_FUNC(pIsNetDrive, shell32, (LPCSTR)66, FALSE); /* ord 66 = shell32.IsNetDrive */
3780 return pIsNetDrive(dwDriveNum);
3781#endif
3782}
#define GET_FUNC(func, module, name, fail)
Definition: path.c:52
int WINAPI PathGetDriveNumberA(LPCSTR lpszPath)
Definition: path.c:538
static fnpIsNetDrive pIsNetDrive
Definition: path.c:66
static HANDLE shell32
Definition: animate.c:36
EXTERN_C int WINAPI IsNetDrive(int drive)
Definition: shlfileop.cpp:2210

◆ PathIsNetworkPathW()

BOOL WINAPI PathIsNetworkPathW ( LPCWSTR  lpszPath)

Definition at line 3789 of file path.c.

3790{
3791 int dwDriveNum;
3792
3793 TRACE("(%s)\n", debugstr_w(lpszPath));
3794
3795 if (!lpszPath)
3796 return FALSE;
3797 if (*lpszPath == '\\' && lpszPath[1] == '\\')
3798 return TRUE;
3799 dwDriveNum = PathGetDriveNumberW(lpszPath);
3800 if (dwDriveNum == -1)
3801 return FALSE;
3802#ifdef __REACTOS__
3803 return IsNetDrive(dwDriveNum);
3804#else
3805 GET_FUNC(pIsNetDrive, shell32, (LPCSTR)66, FALSE); /* ord 66 = shell32.IsNetDrive */
3806 return pIsNetDrive(dwDriveNum);
3807#endif
3808}
int WINAPI PathGetDriveNumberW(const WCHAR *path)
Definition: path.c:553

◆ PathIsPrefixA()

BOOL WINAPI PathIsPrefixA ( LPCSTR  lpszPrefix,
LPCSTR  lpszPath 
)

Definition at line 2162 of file path.c.

2163{
2164 TRACE("(%s,%s)\n", debugstr_a(lpszPrefix), debugstr_a(lpszPath));
2165
2166 if (lpszPrefix && lpszPath &&
2167 PathCommonPrefixA(lpszPath, lpszPrefix, NULL) == (int)strlen(lpszPrefix))
2168 return TRUE;
2169 return FALSE;
2170}
int WINAPI PathCommonPrefixA(LPCSTR lpszFile1, LPCSTR lpszFile2, LPSTR achPath)
Definition: path.c:2751

Referenced by ATL::CPathT< StringType >::PathIsPrefixX().

◆ PathIsPrefixW()

BOOL WINAPI PathIsPrefixW ( LPCWSTR  lpszPrefix,
LPCWSTR  lpszPath 
)

Definition at line 2177 of file path.c.

2178{
2179 TRACE("(%s,%s)\n", debugstr_w(lpszPrefix), debugstr_w(lpszPath));
2180
2181 if (lpszPrefix && lpszPath &&
2182 PathCommonPrefixW(lpszPath, lpszPrefix, NULL) == (int)strlenW(lpszPrefix))
2183 return TRUE;
2184 return FALSE;
2185}
int WINAPI PathCommonPrefixW(LPCWSTR lpszFile1, LPCWSTR lpszFile2, LPWSTR achPath)
Definition: path.c:2806

Referenced by ATL::CPathT< StringType >::PathIsPrefixX().

◆ PathIsRelativeA()

BOOL WINAPI PathIsRelativeA ( LPCSTR  lpszPath)

Definition at line 1563 of file path.c.

1564{
1565 TRACE("(%s)\n",debugstr_a(lpszPath));
1566
1567 if (!lpszPath || !*lpszPath || IsDBCSLeadByte(*lpszPath))
1568 return TRUE;
1569 if (*lpszPath == '\\' || (*lpszPath && lpszPath[1] == ':'))
1570 return FALSE;
1571 return TRUE;
1572}

Referenced by ATL::CPathT< StringType >::PathIsRelativeX(), and TestGetModuleFileNameA().

◆ PathIsRelativeW()

◆ PathIsRootA()

BOOL WINAPI PathIsRootA ( LPCSTR  lpszPath)

Definition at line 1602 of file path.c.

1603{
1604 TRACE("(%s)\n", debugstr_a(lpszPath));
1605
1606 if (lpszPath && *lpszPath)
1607 {
1608 if (*lpszPath == '\\')
1609 {
1610 if (!lpszPath[1])
1611 return TRUE; /* \ */
1612 else if (lpszPath[1]=='\\')
1613 {
1614 BOOL bSeenSlash = FALSE;
1615 lpszPath += 2;
1616
1617 /* Check for UNC root path */
1618 while (*lpszPath)
1619 {
1620 if (*lpszPath == '\\')
1621 {
1622 if (bSeenSlash)
1623 return FALSE;
1624 bSeenSlash = TRUE;
1625 }
1626 lpszPath = CharNextA(lpszPath);
1627 }
1628 return TRUE;
1629 }
1630 }
1631 else if (lpszPath[1] == ':' && lpszPath[2] == '\\' && lpszPath[3] == '\0')
1632 return TRUE; /* X:\ */
1633 }
1634 return FALSE;
1635}

Referenced by PathIsRootAW(), ATL::CPathT< StringType >::PathIsRootX(), PathRemoveBackslashA(), PathStripToRootA(), and START_TEST().

◆ PathIsRootW()

BOOL WINAPI PathIsRootW ( LPCWSTR  lpszPath)

Definition at line 1642 of file path.c.

1643{
1644 TRACE("(%s)\n", debugstr_w(lpszPath));
1645
1646 if (lpszPath && *lpszPath)
1647 {
1648 if (*lpszPath == '\\')
1649 {
1650 if (!lpszPath[1])
1651 return TRUE; /* \ */
1652 else if (lpszPath[1]=='\\')
1653 {
1654 BOOL bSeenSlash = FALSE;
1655 lpszPath += 2;
1656
1657 /* Check for UNC root path */
1658 while (*lpszPath)
1659 {
1660 if (*lpszPath == '\\')
1661 {
1662 if (bSeenSlash)
1663 return FALSE;
1664 bSeenSlash = TRUE;
1665 }
1666 lpszPath++;
1667 }
1668 return TRUE;
1669 }
1670 }
1671 else if (lpszPath[1] == ':' && lpszPath[2] == '\\' && lpszPath[3] == '\0')
1672 return TRUE; /* X:\ */
1673 }
1674 return FALSE;
1675}

Referenced by CFSDropTarget::_DoDrop(), IsDriveFloppyW(), PathIsRootAW(), ATL::CPathT< StringType >::PathIsRootX(), PathRemoveBackslashW(), PathResolveW(), and PathStripToRootW().

◆ PathIsSameRootA()

BOOL WINAPI PathIsSameRootA ( LPCSTR  lpszPath1,
LPCSTR  lpszPath2 
)

Definition at line 2003 of file path.c.

2004{
2005 LPCSTR lpszStart;
2006 int dwLen;
2007
2008 TRACE("(%s,%s)\n", debugstr_a(lpszPath1), debugstr_a(lpszPath2));
2009
2010 if (!lpszPath1 || !lpszPath2 || !(lpszStart = PathSkipRootA(lpszPath1)))
2011 return FALSE;
2012
2013 dwLen = PathCommonPrefixA(lpszPath1, lpszPath2, NULL) + 1;
2014 if (lpszStart - lpszPath1 > dwLen)
2015 return FALSE; /* Paths not common up to length of the root */
2016 return TRUE;
2017}
LPSTR WINAPI PathSkipRootA(LPCSTR lpszPath)
Definition: path.c:3247

Referenced by ATL::CPathT< StringType >::PathIsSameRootX().

◆ PathIsSameRootW()

BOOL WINAPI PathIsSameRootW ( LPCWSTR  lpszPath1,
LPCWSTR  lpszPath2 
)

Definition at line 2024 of file path.c.

2025{
2026 LPCWSTR lpszStart;
2027 int dwLen;
2028
2029 TRACE("(%s,%s)\n", debugstr_w(lpszPath1), debugstr_w(lpszPath2));
2030
2031 if (!lpszPath1 || !lpszPath2 || !(lpszStart = PathSkipRootW(lpszPath1)))
2032 return FALSE;
2033
2034 dwLen = PathCommonPrefixW(lpszPath1, lpszPath2, NULL) + 1;
2035 if (lpszStart - lpszPath1 > dwLen)
2036 return FALSE; /* Paths not common up to length of the root */
2037 return TRUE;
2038}
LPWSTR WINAPI PathSkipRootW(LPCWSTR lpszPath)
Definition: path.c:3278

Referenced by ATL::CPathT< StringType >::PathIsSameRootX().

◆ PathIsSystemFolderA()

BOOL WINAPI PathIsSystemFolderA ( LPCSTR  lpszPath,
DWORD  dwAttrib 
)

Definition at line 2200 of file path.c.

2201{
2202 TRACE("(%s,0x%08x)\n", debugstr_a(lpszPath), dwAttrib);
2203
2204 if (lpszPath && *lpszPath)
2205 dwAttrib = GetFileAttributesA(lpszPath);
2206
2207 if (dwAttrib == INVALID_FILE_ATTRIBUTES || !(dwAttrib & FILE_ATTRIBUTE_DIRECTORY) ||
2209 return FALSE;
2210 return TRUE;
2211}
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
#define FILE_ATTRIBUTE_SYSTEM
Definition: nt_native.h:704

◆ PathIsSystemFolderW()

BOOL WINAPI PathIsSystemFolderW ( LPCWSTR  lpszPath,
DWORD  dwAttrib 
)

Definition at line 2218 of file path.c.

2219{
2220 TRACE("(%s,0x%08x)\n", debugstr_w(lpszPath), dwAttrib);
2221
2222 if (lpszPath && *lpszPath)
2223 dwAttrib = GetFileAttributesW(lpszPath);
2224
2225 if (dwAttrib == INVALID_FILE_ATTRIBUTES || !(dwAttrib & FILE_ATTRIBUTE_DIRECTORY) ||
2227 return FALSE;
2228 return TRUE;
2229}

Referenced by CViewStatePropertyBag::_IsSystemFolder().

◆ PathIsUNCA()

BOOL WINAPI PathIsUNCA ( LPCSTR  lpszPath)

Definition at line 2243 of file path.c.

2244{
2245 TRACE("(%s)\n",debugstr_a(lpszPath));
2246
2247/*
2248 * On Windows 2003, tests show that strings starting with "\\?" are
2249 * considered UNC, while on Windows Vista+ this is not the case anymore.
2250 */
2251// #ifdef __REACTOS__
2252#if (_WIN32_WINNT >= _WIN32_WINNT_VISTA)
2253 if (lpszPath && (lpszPath[0]=='\\') && (lpszPath[1]=='\\') && (lpszPath[2]!='?'))
2254#else
2255 if (lpszPath && (lpszPath[0]=='\\') && (lpszPath[1]=='\\'))
2256#endif
2257 return TRUE;
2258 return FALSE;
2259}

Referenced by PathAppendA(), PathCommonPrefixA(), and ATL::CPathT< StringType >::PathIsUNCX().

◆ PathIsUNCServerA()

BOOL WINAPI PathIsUNCServerA ( LPCSTR  lpszPath)

Definition at line 2301 of file path.c.

2302{
2303 TRACE("(%s)\n", debugstr_a(lpszPath));
2304
2305 if (lpszPath && *lpszPath++ == '\\' && *lpszPath++ == '\\')
2306 {
2307 while (*lpszPath)
2308 {
2309 if (*lpszPath == '\\')
2310 return FALSE;
2311 lpszPath = CharNextA(lpszPath);
2312 }
2313 return TRUE;
2314 }
2315 return FALSE;
2316}

Referenced by PathIsDirectoryA(), and ATL::CPathT< StringType >::PathIsUNCServerX().

◆ PathIsUNCServerShareA()

BOOL WINAPI PathIsUNCServerShareA ( LPCSTR  lpszPath)

Definition at line 2351 of file path.c.

2352{
2353 TRACE("(%s)\n", debugstr_a(lpszPath));
2354
2355 if (lpszPath && *lpszPath++ == '\\' && *lpszPath++ == '\\')
2356 {
2357 BOOL bSeenSlash = FALSE;
2358 while (*lpszPath)
2359 {
2360 if (*lpszPath == '\\')
2361 {
2362 if (bSeenSlash)
2363 return FALSE;
2364 bSeenSlash = TRUE;
2365 }
2366 lpszPath = CharNextA(lpszPath);
2367 }
2368 return bSeenSlash;
2369 }
2370 return FALSE;
2371}

Referenced by PathIsDirectoryA(), and ATL::CPathT< StringType >::PathIsUNCServerShareX().

◆ PathIsUNCServerShareW()

BOOL WINAPI PathIsUNCServerShareW ( LPCWSTR  lpszPath)

Definition at line 2378 of file path.c.

2379{
2380 TRACE("(%s)\n", debugstr_w(lpszPath));
2381
2382 if (lpszPath && *lpszPath++ == '\\' && *lpszPath++ == '\\')
2383 {
2384 BOOL bSeenSlash = FALSE;
2385 while (*lpszPath)
2386 {
2387 if (*lpszPath == '\\')
2388 {
2389 if (bSeenSlash)
2390 return FALSE;
2391 bSeenSlash = TRUE;
2392 }
2393 lpszPath++;
2394 }
2395 return bSeenSlash;
2396 }
2397 return FALSE;
2398}

Referenced by PathCanonicalizeW(), PathFileExistsDefExtW(), PathIsDirectoryW(), and ATL::CPathT< StringType >::PathIsUNCServerShareX().

◆ PathIsUNCServerW()

BOOL WINAPI PathIsUNCServerW ( LPCWSTR  lpszPath)

Definition at line 2323 of file path.c.

2324{
2325 TRACE("(%s)\n", debugstr_w(lpszPath));
2326
2327 if (lpszPath && lpszPath[0] == '\\' && lpszPath[1] == '\\')
2328 {
2329 return !strchrW( lpszPath + 2, '\\' );
2330 }
2331 return FALSE;
2332}
#define strchrW(s, c)
Definition: unicode.h:34

Referenced by PathFileExistsDefExtW(), PathIsDirectoryW(), and ATL::CPathT< StringType >::PathIsUNCServerX().

◆ PathIsUNCW()

BOOL WINAPI PathIsUNCW ( LPCWSTR  lpszPath)

Definition at line 2266 of file path.c.

2267{
2268 TRACE("(%s)\n",debugstr_w(lpszPath));
2269
2270/*
2271 * On Windows 2003, tests show that strings starting with "\\?" are
2272 * considered UNC, while on Windows Vista+ this is not the case anymore.
2273 */
2274// #ifdef __REACTOS__
2275#if (_WIN32_WINNT >= _WIN32_WINNT_VISTA)
2276 if (lpszPath && (lpszPath[0]=='\\') && (lpszPath[1]=='\\') && (lpszPath[2]!='?'))
2277#else
2278 if (lpszPath && (lpszPath[0]=='\\') && (lpszPath[1]=='\\'))
2279#endif
2280 return TRUE;
2281 return FALSE;
2282}

Referenced by _ILIsNetworkPlace(), CDesktopFolder::_ParseDisplayNameByParent(), IsLFNDriveW(), PathAppendW(), PathCombineW(), PathCommonPrefixW(), PathIsAbsoluteW(), ATL::CPathT< StringType >::PathIsUNCX(), and PathQualifyExW().

◆ PathIsValidCharA()

BOOL WINAPI PathIsValidCharA ( char  c,
DWORD  class 
)

Definition at line 4406 of file path.c.

4407{
4408 if ((unsigned)c > 0x7e)
4409 return class & PATH_CHAR_CLASS_OTHER_VALID;
4410
4411 return class & SHELL_charclass[(unsigned)c];
4412}
#define PATH_CHAR_CLASS_OTHER_VALID
Definition: path.c:4326
static const DWORD SHELL_charclass[]
Definition: path.c:4333
const GLubyte * c
Definition: glext.h:8905
static unsigned(__cdecl *hash_bstr)(bstr_t s)

◆ PathIsValidCharW()

BOOL WINAPI PathIsValidCharW ( WCHAR  c,
DWORD  class 
)

Definition at line 4419 of file path.c.

4420{
4421 if (c > 0x7e)
4422 return class & PATH_CHAR_CLASS_OTHER_VALID;
4423
4424 return class & SHELL_charclass[c];
4425}
#define c
Definition: ke_i.h:80

Referenced by PathIsValidElement(), PathQualifyExW(), and UrlUnescapeAndMakeFileNameValid().

◆ PathMakePrettyA()

BOOL WINAPI PathMakePrettyA ( LPSTR  lpszPath)

Definition at line 2668 of file path.c.

2669{
2670 LPSTR pszIter = lpszPath;
2671
2672 TRACE("(%s)\n", debugstr_a(lpszPath));
2673
2674 if (!pszIter)
2675 return FALSE;
2676
2677 if (*pszIter)
2678 {
2679 do
2680 {
2681 if (islower(*pszIter) || IsDBCSLeadByte(*pszIter))
2682 return FALSE; /* Not DOS path */
2683 pszIter++;
2684 } while (*pszIter);
2685 pszIter = lpszPath + 1;
2686 while (*pszIter)
2687 {
2688 *pszIter = tolower(*pszIter);
2689 pszIter++;
2690 }
2691 }
2692 return TRUE;
2693}
#define islower(c)
Definition: acclib.h:72

Referenced by ATL::CPathT< StringType >::PathMakePrettyX(), and test_PathMakePretty().

◆ PathMakePrettyW()

BOOL WINAPI PathMakePrettyW ( LPWSTR  lpszPath)

Definition at line 2700 of file path.c.

2701{
2702 LPWSTR pszIter = lpszPath;
2703
2704 TRACE("(%s)\n", debugstr_w(lpszPath));
2705
2706 if (!pszIter)
2707 return FALSE;
2708
2709 if (*pszIter)
2710 {
2711 do
2712 {
2713 if (islowerW(*pszIter))
2714 return FALSE; /* Not DOS path */
2715 pszIter++;
2716 } while (*pszIter);
2717 pszIter = lpszPath + 1;
2718 while (*pszIter)
2719 {
2720 *pszIter = tolowerW(*pszIter);
2721 pszIter++;
2722 }
2723 }
2724 return TRUE;
2725}
#define islowerW(n)
Definition: unicode.h:46

Referenced by ATL::CPathT< StringType >::PathMakePrettyX().

◆ PathMakeSystemFolderA()

BOOL WINAPI PathMakeSystemFolderA ( LPCSTR  lpszPath)

Definition at line 3100 of file path.c.

3101{
3102 BOOL bRet = FALSE;
3103
3104 TRACE("(%s)\n", debugstr_a(lpszPath));
3105
3106 if (lpszPath && *lpszPath)
3107 {
3111 }
3112 return bRet;
3113}
BOOL WINAPI PathMakeSystemFolderW(LPCWSTR lpszPath)
Definition: path.c:3120

◆ PathMakeSystemFolderW()

BOOL WINAPI PathMakeSystemFolderW ( LPCWSTR  lpszPath)

Definition at line 3120 of file path.c.

3121{
3122 DWORD dwDefaultAttr = FILE_ATTRIBUTE_READONLY, dwAttr;
3124
3125 TRACE("(%s)\n", debugstr_w(lpszPath));
3126
3127 if (!lpszPath || !*lpszPath)
3128 return FALSE;
3129
3130 /* If the directory is already a system directory, don't do anything */
3132 if (!strcmpW(buff, lpszPath))
3133 return TRUE;
3134
3136 if (!strcmpW(buff, lpszPath))
3137 return TRUE;
3138
3139 /* "UseSystemForSystemFolders" Tells Win what attributes to use */
3141 dwDefaultAttr = FILE_ATTRIBUTE_SYSTEM;
3142
3143 if ((dwAttr = GetFileAttributesW(lpszPath)) == INVALID_FILE_ATTRIBUTES)
3144 return FALSE;
3145
3146 /* Change file attributes to system attributes */
3148 return SetFileAttributesW(lpszPath, dwAttr | dwDefaultAttr);
3149}
BOOL WINAPI SetFileAttributesW(LPCWSTR lpFileName, DWORD dwFileAttributes)
Definition: fileinfo.c:794
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2313
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2352
static BOOL SHLWAPI_UseSystemForSystemFolders(void)
Definition: path.c:3070
#define FILE_ATTRIBUTE_HIDDEN
Definition: nt_native.h:703

Referenced by PathMakeSystemFolderA(), and SHCreatePropertyBagOnProfileSection().

◆ PathMatchSingleMaskA()

static BOOL PathMatchSingleMaskA ( LPCSTR  name,
LPCSTR  mask 
)
static

Definition at line 1853 of file path.c.

1854{
1855 while (*name && *mask && *mask!=';')
1856 {
1857 if (*mask == '*')
1858 {
1859 do
1860 {
1862 return TRUE; /* try substrings */
1863 } while (*name++);
1864 return FALSE;
1865 }
1866
1867 if (toupper(*mask) != toupper(*name) && *mask != '?')
1868 return FALSE;
1869
1870 name = CharNextA(name);
1871 mask = CharNextA(mask);
1872 }
1873
1874 if (!*name)
1875 {
1876 while (*mask == '*')
1877 mask++;
1878 if (!*mask || *mask == ';')
1879 return TRUE;
1880 }
1881 return FALSE;
1882}
int toupper(int c)
Definition: utclib.c:881
static BOOL PathMatchSingleMaskA(LPCSTR name, LPCSTR mask)
Definition: path.c:1853
GLenum GLint GLuint mask
Definition: glext.h:6028

Referenced by PathMatchSingleMaskA(), and PathMatchSpecA().

◆ PathMatchSingleMaskW()

static BOOL PathMatchSingleMaskW ( LPCWSTR  name,
LPCWSTR  mask 
)
static

Definition at line 1887 of file path.c.

1888{
1889 while (*name && *mask && *mask != ';')
1890 {
1891 if (*mask == '*')
1892 {
1893 do
1894 {
1896 return TRUE; /* try substrings */
1897 } while (*name++);
1898 return FALSE;
1899 }
1900
1901 if (toupperW(*mask) != toupperW(*name) && *mask != '?')
1902 return FALSE;
1903
1904 name++;
1905 mask++;
1906 }
1907 if (!*name)
1908 {
1909 while (*mask == '*')
1910 mask++;
1911 if (!*mask || *mask == ';')
1912 return TRUE;
1913 }
1914 return FALSE;
1915}
static BOOL PathMatchSingleMaskW(LPCWSTR name, LPCWSTR mask)
Definition: path.c:1887
#define toupperW(n)
Definition: unicode.h:45

Referenced by PathMatchSingleMaskW(), and PathMatchSpecW().

◆ PathMatchSpecA()

BOOL WINAPI PathMatchSpecA ( LPCSTR  lpszPath,
LPCSTR  lpszMask 
)

Definition at line 1935 of file path.c.

1936{
1937 TRACE("(%s,%s)\n", lpszPath, lpszMask);
1938
1939 if (!lstrcmpA(lpszMask, "*.*"))
1940 return TRUE; /* Matches every path */
1941
1942 while (*lpszMask)
1943 {
1944 while (*lpszMask == ' ')
1945 lpszMask++; /* Eat leading spaces */
1946
1947 if (PathMatchSingleMaskA(lpszPath, lpszMask))
1948 return TRUE; /* Matches the current mask */
1949
1950 while (*lpszMask && *lpszMask != ';')
1951 lpszMask = CharNextA(lpszMask); /* masks separated by ';' */
1952
1953 if (*lpszMask == ';')
1954 lpszMask++;
1955 }
1956 return FALSE;
1957}
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18

Referenced by ATL::CPathT< StringType >::PathMatchSpecX(), and test_PathMatchSpec().

◆ PathMatchSpecW()

BOOL WINAPI PathMatchSpecW ( LPCWSTR  lpszPath,
LPCWSTR  lpszMask 
)

Definition at line 1964 of file path.c.

1965{
1966 static const WCHAR szStarDotStar[] = { '*', '.', '*', '\0' };
1967
1968 TRACE("(%s,%s)\n", debugstr_w(lpszPath), debugstr_w(lpszMask));
1969
1970 if (!lstrcmpW(lpszMask, szStarDotStar))
1971 return TRUE; /* Matches every path */
1972
1973 while (*lpszMask)
1974 {
1975 while (*lpszMask == ' ')
1976 lpszMask++; /* Eat leading spaces */
1977
1978 if (PathMatchSingleMaskW(lpszPath, lpszMask))
1979 return TRUE; /* Matches the current path */
1980
1981 while (*lpszMask && *lpszMask != ';')
1982 lpszMask++; /* masks separated by ';' */
1983
1984 if (*lpszMask == ';')
1985 lpszMask++;
1986 }
1987 return FALSE;
1988}
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170

Referenced by FileNameMatch(), FTP_ParseNextFile(), ICommDlgBrowser3_fnIncludeObject(), IShellBrowserImpl_ICommDlgBrowser_IncludeObject(), on_command_filetype(), and ATL::CPathT< StringType >::PathMatchSpecX().

◆ PathParseIconLocationA()

int WINAPI PathParseIconLocationA ( LPSTR  lpszPath)

Definition at line 1067 of file path.c.

1068{
1069 int iRet = 0;
1070 LPSTR lpszComma;
1071
1072 TRACE("(%s)\n", debugstr_a(lpszPath));
1073
1074 if (lpszPath)
1075 {
1076 if ((lpszComma = strchr(lpszPath, ',')))
1077 {
1078 *lpszComma++ = '\0';
1079 iRet = StrToIntA(lpszComma);
1080 }
1081 PathUnquoteSpacesA(lpszPath);
1082 PathRemoveBlanksA(lpszPath);
1083 }
1084 return iRet;
1085}
char * strchr(const char *String, int ch)
Definition: utclib.c:501
INT WINAPI StrToIntA(LPCSTR lpszStr)
Definition: string.c:374
VOID WINAPI PathUnquoteSpacesA(LPSTR lpszPath)
Definition: path.c:1012
VOID WINAPI PathRemoveBlanksA(LPSTR lpszPath)
Definition: path.c:894

◆ PathParseIconLocationW()

int WINAPI PathParseIconLocationW ( LPWSTR  lpszPath)

Definition at line 1092 of file path.c.

1093{
1094 int iRet = 0;
1095 LPWSTR lpszComma;
1096
1097 TRACE("(%s)\n", debugstr_w(lpszPath));
1098
1099 if (lpszPath)
1100 {
1101 if ((lpszComma = StrChrW(lpszPath, ',')))
1102 {
1103 *lpszComma++ = '\0';
1104 iRet = StrToIntW(lpszComma);
1105 }
1106 PathUnquoteSpacesW(lpszPath);
1107 PathRemoveBlanksW(lpszPath);
1108 }
1109 return iRet;
1110}
INT WINAPI StrToIntW(LPCWSTR lpString)
Definition: string.c:411
VOID WINAPI PathUnquoteSpacesW(LPWSTR lpszPath)
Definition: path.c:1034
VOID WINAPI PathRemoveBlanksW(LPWSTR lpszPath)
Definition: path.c:920

Referenced by CAppsListView::AddApplication(), DoFileTypeIconLocation(), getIconLocationForDrive(), getIconLocationForFolder(), and CFileDefExt::InitFolderCustomizePage().

◆ PathQuoteSpacesA()

VOID WINAPI PathQuoteSpacesA ( LPSTR  lpszPath)

Definition at line 955 of file path.c.

956{
957 TRACE("(%s)\n", debugstr_a(lpszPath));
958
959 if(lpszPath && StrChrA(lpszPath,' '))
960 {
961 size_t iLen = strlen(lpszPath) + 1;
962
963 if (iLen + 2 < MAX_PATH)
964 {
965 memmove(lpszPath + 1, lpszPath, iLen);
966 lpszPath[0] = '"';
967 lpszPath[iLen] = '"';
968 lpszPath[iLen + 1] = '\0';
969 }
970 }
971}
#define memmove(s1, s2, n)
Definition: mkisofs.h:881

Referenced by ATL::CPathT< StringType >::PathQuoteSpacesX().

◆ PathQuoteSpacesW()

VOID WINAPI PathQuoteSpacesW ( LPWSTR  lpszPath)

Definition at line 978 of file path.c.

979{
980 TRACE("(%s)\n", debugstr_w(lpszPath));
981
982 if(lpszPath && StrChrW(lpszPath,' '))
983 {
984 int iLen = strlenW(lpszPath) + 1;
985
986 if (iLen + 2 < MAX_PATH)
987 {
988 memmove(lpszPath + 1, lpszPath, iLen * sizeof(WCHAR));
989 lpszPath[0] = '"';
990 lpszPath[iLen] = '"';
991 lpszPath[iLen + 1] = '\0';
992 }
993 }
994}

Referenced by ATL::CPathT< StringType >::PathQuoteSpacesX(), and RunFontViewer().

◆ PathRelativePathToA()

BOOL WINAPI PathRelativePathToA ( LPSTR  lpszPath,
LPCSTR  lpszFrom,
DWORD  dwAttrFrom,
LPCSTR  lpszTo,
DWORD  dwAttrTo 
)

Definition at line 3546 of file path.c.

3548{
3549 BOOL bRet = FALSE;
3550
3551 TRACE("(%p,%s,0x%08x,%s,0x%08x)\n", lpszPath, debugstr_a(lpszFrom),
3552 dwAttrFrom, debugstr_a(lpszTo), dwAttrTo);
3553
3554 if(lpszPath && lpszFrom && lpszTo)
3555 {
3557 WCHAR szFrom[MAX_PATH];
3558 WCHAR szTo[MAX_PATH];
3559 MultiByteToWideChar(CP_ACP,0,lpszFrom,-1,szFrom,MAX_PATH);
3560 MultiByteToWideChar(CP_ACP,0,lpszTo,-1,szTo,MAX_PATH);
3561 bRet = PathRelativePathToW(szPath,szFrom,dwAttrFrom,szTo,dwAttrTo);
3562 WideCharToMultiByte(CP_ACP,0,szPath,-1,lpszPath,MAX_PATH,0,0);
3563 }
3564 return bRet;
3565}
BOOL WINAPI PathRelativePathToW(LPWSTR lpszPath, LPCWSTR lpszFrom, DWORD dwAttrFrom, LPCWSTR lpszTo, DWORD dwAttrTo)
Definition: path.c:3572

Referenced by ATL::CPathT< StringType >::PathRelativePathToX().

◆ PathRelativePathToW()

BOOL WINAPI PathRelativePathToW ( LPWSTR  lpszPath,
LPCWSTR  lpszFrom,
DWORD  dwAttrFrom,
LPCWSTR  lpszTo,
DWORD  dwAttrTo 
)

Definition at line 3572 of file path.c.

3574{
3575 static const WCHAR szPrevDirSlash[] = { '.', '.', '\\', '\0' };
3576 static const WCHAR szPrevDir[] = { '.', '.', '\0' };
3577 WCHAR szFrom[MAX_PATH];
3578 WCHAR szTo[MAX_PATH];
3579 DWORD dwLen;
3580
3581 TRACE("(%p,%s,0x%08x,%s,0x%08x)\n", lpszPath, debugstr_w(lpszFrom),
3582 dwAttrFrom, debugstr_w(lpszTo), dwAttrTo);
3583
3584 if(!lpszPath || !lpszFrom || !lpszTo)
3585 return FALSE;
3586
3587 *lpszPath = '\0';
3588 lstrcpynW(szFrom, lpszFrom, MAX_PATH);
3589 lstrcpynW(szTo, lpszTo, MAX_PATH);
3590
3591 if(!(dwAttrFrom & FILE_ATTRIBUTE_DIRECTORY))
3592 PathRemoveFileSpecW(szFrom);
3593 if(!(dwAttrTo & FILE_ATTRIBUTE_DIRECTORY))
3594 PathRemoveFileSpecW(szTo);
3595
3596 /* Paths can only be relative if they have a common root */
3597 if(!(dwLen = PathCommonPrefixW(szFrom, szTo, 0)))
3598 return FALSE;
3599
3600 /* Strip off lpszFrom components to the root, by adding "..\" */
3601 lpszFrom = szFrom + dwLen;
3602 if (!*lpszFrom)
3603 {
3604 lpszPath[0] = '.';
3605 lpszPath[1] = '\0';
3606 }
3607 if (*lpszFrom == '\\')
3608 lpszFrom++;
3609
3610 while (*lpszFrom)
3611 {
3612 lpszFrom = PathFindNextComponentW(lpszFrom);
3613 strcatW(lpszPath, *lpszFrom ? szPrevDirSlash : szPrevDir);
3614 }
3615
3616 /* From the root add the components of lpszTo */
3617 lpszTo += dwLen;
3618 /* We check lpszTo[-1] to avoid skipping end of string. See the notes for
3619 * this function.
3620 */
3621 if (*lpszTo && lpszTo[-1])
3622 {
3623 if (*lpszTo != '\\')
3624 lpszTo--;
3625 dwLen = strlenW(lpszPath);
3626 if (dwLen + strlenW(lpszTo) >= MAX_PATH)
3627 {
3628 *lpszPath = '\0';
3629 return FALSE;
3630 }
3631 strcpyW(lpszPath + dwLen, lpszTo);
3632 }
3633 return TRUE;
3634}
BOOL WINAPI PathRemoveFileSpecW(LPWSTR lpszPath)
Definition: path.c:629
LPWSTR WINAPI PathFindNextComponentW(LPCWSTR lpszPath)
Definition: path.c:2579

Referenced by PathRelativePathToA(), and ATL::CPathT< StringType >::PathRelativePathToX().

◆ PathRemoveArgsA()

void WINAPI PathRemoveArgsA ( LPSTR  lpszPath)

Definition at line 756 of file path.c.

757{
758 TRACE("(%s)\n",debugstr_a(lpszPath));
759
760 if(lpszPath)
761 {
762 LPSTR lpszArgs = PathGetArgsA(lpszPath);
763 if (*lpszArgs)
764 lpszArgs[-1] = '\0';
765 else
766 {
767 LPSTR lpszLastChar = CharPrevA(lpszPath, lpszArgs);
768 if(*lpszLastChar == ' ')
769 *lpszLastChar = '\0';
770 }
771 }
772}
LPSTR WINAPI PathGetArgsA(LPCSTR lpszPath)
Definition: path.c:481
LPSTR WINAPI CharPrevA(_In_ LPCSTR, _In_ LPCSTR)

Referenced by ATL::CPathT< StringType >::PathRemoveArgsX().

◆ PathRemoveArgsW()

void WINAPI PathRemoveArgsW ( LPWSTR  lpszPath)

Definition at line 779 of file path.c.

780{
781 TRACE("(%s)\n",debugstr_w(lpszPath));
782
783 if(lpszPath)
784 {
785 LPWSTR lpszArgs = PathGetArgsW(lpszPath);
786 if (*lpszArgs || (lpszArgs > lpszPath && lpszArgs[-1] == ' '))
787 lpszArgs[-1] = '\0';
788 }
789}
LPWSTR WINAPI PathGetArgsW(LPCWSTR lpszPath)
Definition: path.c:506

Referenced by RunOnceExEntry::Exec(), CAddressEditBox::ExecuteCommandLine(), CShellLink::OnNotify(), ATL::CPathT< StringType >::PathRemoveArgsX(), and WelcomeDlgProc().

◆ PathRemoveBackslashA()

LPSTR WINAPI PathRemoveBackslashA ( LPSTR  lpszPath)

Definition at line 847 of file path.c.

848{
849 LPSTR szTemp = NULL;
850
851 TRACE("(%s)\n", debugstr_a(lpszPath));
852
853 if(lpszPath)
854 {
855 szTemp = CharPrevA(lpszPath, lpszPath + strlen(lpszPath));
856 if (!PathIsRootA(lpszPath) && *szTemp == '\\')
857 *szTemp = '\0';
858 }
859 return szTemp;
860}
BOOL WINAPI PathIsRootA(LPCSTR lpszPath)
Definition: path.c:1602

Referenced by ATL::CPathT< StringType >::PathRemoveBackslashX().

◆ PathRemoveBackslashW()

LPWSTR WINAPI PathRemoveBackslashW ( LPWSTR  lpszPath)

Definition at line 867 of file path.c.

868{
869 LPWSTR szTemp = NULL;
870
871 TRACE("(%s)\n", debugstr_w(lpszPath));
872
873 if(lpszPath)
874 {
875 szTemp = lpszPath + strlenW(lpszPath);
876 if (szTemp > lpszPath) szTemp--;
877 if (!PathIsRootW(lpszPath) && *szTemp == '\\')
878 *szTemp = '\0';
879 }
880 return szTemp;
881}
BOOL WINAPI PathIsRootW(LPCWSTR lpszPath)
Definition: path.c:1642

Referenced by CFileDefExt::InitFilePath(), msi_dialog_update_directory_combo(), PathQualifyExW(), ATL::CPathT< StringType >::PathRemoveBackslashX(), SH_ShowPropertiesDialog(), and SHGetFolderPathAndSubDirW().

◆ PathRemoveBlanksA()

VOID WINAPI PathRemoveBlanksA ( LPSTR  lpszPath)

Definition at line 894 of file path.c.

895{
896 TRACE("(%s)\n", debugstr_a(lpszPath));
897
898 if(lpszPath && *lpszPath)
899 {
900 LPSTR start = lpszPath;
901
902 while (*lpszPath == ' ')
903 lpszPath = CharNextA(lpszPath);
904
905 while(*lpszPath)
906 *start++ = *lpszPath++;
907
908 if (start != lpszPath)
909 while (start[-1] == ' ')
910 start--;
911 *start = '\0';
912 }
913}
GLuint start
Definition: gl.h:1545

Referenced by PathParseIconLocationA(), and ATL::CPathT< StringType >::PathRemoveBlanksX().

◆ PathRemoveBlanksW()

VOID WINAPI PathRemoveBlanksW ( LPWSTR  lpszPath)

Definition at line 920 of file path.c.

921{
922 TRACE("(%s)\n", debugstr_w(lpszPath));
923
924 if(lpszPath && *lpszPath)
925 {
926 LPWSTR start = lpszPath;
927
928 while (*lpszPath == ' ')
929 lpszPath++;
930
931 while(*lpszPath)
932 *start++ = *lpszPath++;
933
934 if (start != lpszPath)
935 while (start[-1] == ' ')
936 start--;
937 *start = '\0';
938 }
939}

Referenced by PathParseIconLocationW(), ATL::CPathT< StringType >::PathRemoveBlanksX(), and RouteTheCallW().

◆ PathRemoveExtensionA()

void WINAPI PathRemoveExtensionA ( LPSTR  lpszPath)

Definition at line 806 of file path.c.

807{
808 TRACE("(%s)\n", debugstr_a(lpszPath));
809
810 if (lpszPath)
811 {
812 lpszPath = PathFindExtensionA(lpszPath);
813 if (lpszPath && *lpszPath != '\0')
814 *lpszPath = '\0';
815 }
816}

Referenced by ATL::CPathT< StringType >::PathRemoveExtensionX().

◆ PathRemoveExtensionW()

◆ PathRemoveFileSpecA()

BOOL WINAPI PathRemoveFileSpecA ( LPSTR  lpszPath)

Definition at line 586 of file path.c.

587{
588 LPSTR lpszFileSpec = lpszPath;
589 BOOL bModified = FALSE;
590
591 TRACE("(%s)\n",debugstr_a(lpszPath));
592
593 if(lpszPath)
594 {
595 /* Skip directory or UNC path */
596 if (*lpszPath == '\\')
597 lpszFileSpec = ++lpszPath;
598 if (*lpszPath == '\\')
599 lpszFileSpec = ++lpszPath;
600
601 while (*lpszPath)
602 {
603 if(*lpszPath == '\\')
604 lpszFileSpec = lpszPath; /* Skip dir */
605 else if(*lpszPath == ':')
606 {
607 lpszFileSpec = ++lpszPath; /* Skip drive */
608 if (*lpszPath == '\\')
609 lpszFileSpec++;
610 }
611 if (!(lpszPath = CharNextA(lpszPath)))
612 break;
613 }
614
615 if (*lpszFileSpec)
616 {
617 *lpszFileSpec = '\0';
618 bModified = TRUE;
619 }
620 }
621 return bModified;
622}

Referenced by PathRemoveFileSpecAW(), ATL::CPathT< StringType >::PathRemoveFileSpecX(), and PathStripToRootA().

◆ PathRemoveFileSpecW()

BOOL WINAPI PathRemoveFileSpecW ( LPWSTR  lpszPath)

Definition at line 629 of file path.c.

630{
631 LPWSTR lpszFileSpec = lpszPath;
632 BOOL bModified = FALSE;
633
634 TRACE("(%s)\n",debugstr_w(lpszPath));
635
636 if(lpszPath)
637 {
638 /* Skip directory or UNC path */
639 if (*lpszPath == '\\')
640 lpszFileSpec = ++lpszPath;
641 if (*lpszPath == '\\')
642 lpszFileSpec = ++lpszPath;
643
644 while (*lpszPath)
645 {
646 if(*lpszPath == '\\')
647 lpszFileSpec = lpszPath; /* Skip dir */
648 else if(*lpszPath == ':')
649 {
650 lpszFileSpec = ++lpszPath; /* Skip drive */
651 if (*lpszPath == '\\')
652 lpszFileSpec++;
653 }
654 lpszPath++;
655 }
656
657 if (*lpszFileSpec)
658 {
659 *lpszFileSpec = '\0';
660 bModified = TRUE;
661 }
662 }
663 return bModified;
664}

Referenced by CFSDropTarget::_CopyItems(), CDirectoryList::AddPathsFromDirectory(), DoBuildFilesAndDirs(), DoDeleteSpecW(), DoGetBaseName(), DoTestEntry(), CDeskLinkDropHandler::Drop(), CZipExtract::Extract(), FileCompareBothWild(), FileCompareOneSideWild(), FileCompareWildTitle(), FindSubProgram(), FinishDlgProc(), GetSubProgramPath(), CShellLink::OnInitDialog(), PathQualifyExW(), PathRelativePathToW(), PathRemoveFileSpecAW(), ATL::CPathT< StringType >::PathRemoveFileSpecX(), PathStripToRootW(), pBuildFileList(), search_dr(), search_file(), SHCreatePropertyBagOnProfileSection(), and SHGetShellStyleHInstance().

◆ PathRenameExtensionA()

BOOL WINAPI PathRenameExtensionA ( LPSTR  lpszPath,
LPCSTR  lpszExt 
)

Definition at line 3164 of file path.c.

3165{
3166 LPSTR lpszExtension;
3167
3168 TRACE("(%s,%s)\n", debugstr_a(lpszPath), debugstr_a(lpszExt));
3169
3170 lpszExtension = PathFindExtensionA(lpszPath);
3171
3172 if (!lpszExtension || (lpszExtension - lpszPath + strlen(lpszExt) >= MAX_PATH))
3173 return FALSE;
3174
3175 strcpy(lpszExtension, lpszExt);
3176 return TRUE;
3177}

◆ PathRenameExtensionW()

BOOL WINAPI PathRenameExtensionW ( LPWSTR  lpszPath,
LPCWSTR  lpszExt 
)

Definition at line 3184 of file path.c.

3185{
3186 LPWSTR lpszExtension;
3187
3188 TRACE("(%s,%s)\n", debugstr_w(lpszPath), debugstr_w(lpszExt));
3189
3190 lpszExtension = PathFindExtensionW(lpszPath);
3191
3192 if (!lpszExtension || (lpszExtension - lpszPath + strlenW(lpszExt) >= MAX_PATH))
3193 return FALSE;
3194
3195 strcpyW(lpszExtension, lpszExt);
3196 return TRUE;
3197}

◆ PathSearchAndQualifyA()

BOOL WINAPI PathSearchAndQualifyA ( LPCSTR  lpszPath,
LPSTR  lpszBuf,
UINT  cchBuf 
)

Definition at line 3212 of file path.c.

3213{
3214 TRACE("(%s,%p,0x%08x)\n", debugstr_a(lpszPath), lpszBuf, cchBuf);
3215
3216 if(SearchPathA(NULL, lpszPath, NULL, cchBuf, lpszBuf, NULL))
3217 return TRUE;
3218 return !!GetFullPathNameA(lpszPath, cchBuf, lpszBuf, NULL);
3219}
DWORD WINAPI SearchPathA(IN LPCSTR lpPath OPTIONAL, IN LPCSTR lpFileName, IN LPCSTR lpExtension OPTIONAL, IN DWORD nBufferLength, OUT LPSTR lpBuffer, OUT LPSTR *lpFilePart OPTIONAL)
Definition: path.c:1123
DWORD WINAPI GetFullPathNameA(IN LPCSTR lpFileName, IN DWORD nBufferLength, OUT LPSTR lpBuffer, OUT LPSTR *lpFilePart)
Definition: path.c:993

◆ PathSearchAndQualifyW()

BOOL WINAPI PathSearchAndQualifyW ( LPCWSTR  lpszPath,
LPWSTR  lpszBuf,
UINT  cchBuf 
)

Definition at line 3226 of file path.c.

3227{
3228 TRACE("(%s,%p,0x%08x)\n", debugstr_w(lpszPath), lpszBuf, cchBuf);
3229
3230 if(SearchPathW(NULL, lpszPath, NULL, cchBuf, lpszBuf, NULL))
3231 return TRUE;
3232 return !!GetFullPathNameW(lpszPath, cchBuf, lpszBuf, NULL);
3233}
DWORD WINAPI SearchPathW(IN LPCWSTR lpPath OPTIONAL, IN LPCWSTR lpFileName, IN LPCWSTR lpExtension OPTIONAL, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart OPTIONAL)
Definition: path.c:1298
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
Definition: path.c:1106

Referenced by create_uri(), and test_PathSearchAndQualify().

◆ PathSetDlgItemPathA()

VOID WINAPI PathSetDlgItemPathA ( HWND  hDlg,
int  id,
LPCSTR  lpszPath 
)

Definition at line 3701 of file path.c.

3702{
3704
3705 TRACE("(%p,%8x,%s)\n",hDlg, id, debugstr_a(lpszPath));
3706
3707 if (lpszPath)
3709 else
3710 szPath[0] = '\0';
3711 PathSetDlgItemPathW(hDlg, id, szPath);
3712}
VOID WINAPI PathSetDlgItemPathW(HWND hDlg, int id, LPCWSTR lpszPath)
Definition: path.c:3719

◆ PathSetDlgItemPathW()

VOID WINAPI PathSetDlgItemPathW ( HWND  hDlg,
int  id,
LPCWSTR  lpszPath 
)

Definition at line 3719 of file path.c.

3720{
3721 WCHAR path[MAX_PATH + 1];
3722 HWND hwItem;
3723 RECT rect;
3724 HDC hdc;
3725 HGDIOBJ hPrevObj;
3726
3727 TRACE("(%p,%8x,%s)\n",hDlg, id, debugstr_w(lpszPath));
3728
3729 if (!(hwItem = GetDlgItem(hDlg, id)))
3730 return;
3731
3732 if (lpszPath)
3733 lstrcpynW(path, lpszPath, sizeof(path) / sizeof(WCHAR));
3734 else
3735 path[0] = '\0';
3736
3737 GetClientRect(hwItem, &rect);
3738 hdc = GetDC(hDlg);
3739 hPrevObj = SelectObject(hdc, (HGDIOBJ)SendMessageW(hwItem,WM_GETFONT,0,0));
3740
3741 if (hPrevObj)
3742 {
3743 PathCompactPathW(hdc, path, rect.right);
3744 SelectObject(hdc, hPrevObj);
3745 }
3746
3747 ReleaseDC(hDlg, hdc);
3748 SetWindowTextW(hwItem, path);
3749}
& rect
Definition: startmenu.cpp:1413
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
#define WM_GETFONT
Definition: winuser.h:1651
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by PathSetDlgItemPathA().

◆ PathSkipRootA()

LPSTR WINAPI PathSkipRootA ( LPCSTR  lpszPath)

Definition at line 3247 of file path.c.

3248{
3249 TRACE("(%s)\n", debugstr_a(lpszPath));
3250
3251 if (!lpszPath || !*lpszPath)
3252 return NULL;
3253
3254 if (*lpszPath == '\\' && lpszPath[1] == '\\')
3255 {
3256 /* Network share: skip share server and mount point */
3257 lpszPath += 2;
3258 if ((lpszPath = StrChrA(lpszPath, '\\')) &&
3259 (lpszPath = StrChrA(lpszPath + 1, '\\')))
3260 lpszPath++;
3261 return (LPSTR)lpszPath;
3262 }
3263
3264 if (IsDBCSLeadByte(*lpszPath))
3265 return NULL;
3266
3267 /* Check x:\ */
3268 if (lpszPath[0] && lpszPath[1] == ':' && lpszPath[2] == '\\')
3269 return (LPSTR)lpszPath + 3;
3270 return NULL;
3271}

Referenced by PathIsSameRootA(), and ATL::CPathT< StringType >::PathSkipRootX().

◆ PathSkipRootW()

LPWSTR WINAPI PathSkipRootW ( LPCWSTR  lpszPath)

Definition at line 3278 of file path.c.

3279{
3280 TRACE("(%s)\n", debugstr_w(lpszPath));
3281
3282 if (!lpszPath || !*lpszPath)
3283 return NULL;
3284
3285 if (*lpszPath == '\\' && lpszPath[1] == '\\')
3286 {
3287 /* Network share: skip share server and mount point */
3288 lpszPath += 2;
3289 if ((lpszPath = StrChrW(lpszPath, '\\')) &&
3290 (lpszPath = StrChrW(lpszPath + 1, '\\')))
3291 lpszPath++;
3292 return (LPWSTR)lpszPath;
3293 }
3294
3295 /* Check x:\ */
3296 if (lpszPath[0] && lpszPath[1] == ':' && lpszPath[2] == '\\')
3297 return (LPWSTR)lpszPath + 3;
3298 return NULL;
3299}

Referenced by PathIsSameRootW(), and ATL::CPathT< StringType >::PathSkipRootX().

◆ PathStripPathA()

void WINAPI PathStripPathA ( LPSTR  lpszPath)

Definition at line 677 of file path.c.

678{
679 TRACE("(%s)\n", debugstr_a(lpszPath));
680
681 if (lpszPath)
682 {
683 LPSTR lpszFileName = PathFindFileNameA(lpszPath);
684 if(lpszFileName != lpszPath)
685 RtlMoveMemory(lpszPath, lpszFileName, strlen(lpszFileName)+1);
686 }
687}
LPSTR WINAPI PathFindFileNameA(LPCSTR lpszPath)
Definition: path.c:373
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:264

Referenced by ATL::CPathT< StringType >::PathStripPathX(), SHAddToRecentDocs(), and test_PathStripPathA().

◆ PathStripPathW()

void WINAPI PathStripPathW ( LPWSTR  lpszPath)

Definition at line 694 of file path.c.

695{
696 LPWSTR lpszFileName;
697
698 TRACE("(%s)\n", debugstr_w(lpszPath));
699 lpszFileName = PathFindFileNameW(lpszPath);
700 if(lpszFileName != lpszPath)
701 RtlMoveMemory(lpszPath, lpszFileName, (strlenW(lpszFileName)+1)*sizeof(WCHAR));
702}

Referenced by CZipExtract::Extract(), CQueryAssociations::GetString(), msi_dialog_update_directory_combo(), ATL::CPathT< StringType >::PathStripPathX(), and TestModuleRegistry().

◆ PathStripToRootA()

BOOL WINAPI PathStripToRootA ( LPSTR  lpszPath)

Definition at line 716 of file path.c.

717{
718 TRACE("(%s)\n", debugstr_a(lpszPath));
719
720 if (!lpszPath)
721 return FALSE;
722 while(!PathIsRootA(lpszPath))
723 if (!PathRemoveFileSpecA(lpszPath))
724 return FALSE;
725 return TRUE;
726}
BOOL WINAPI PathRemoveFileSpecA(LPSTR lpszPath)
Definition: path.c:586

Referenced by ATL::CPathT< StringType >::PathStripToRootX().

◆ PathStripToRootW()

BOOL WINAPI PathStripToRootW ( LPWSTR  lpszPath)

Definition at line 733 of file path.c.

734{
735 TRACE("(%s)\n", debugstr_w(lpszPath));
736
737 if (!lpszPath)
738 return FALSE;
739 while(!PathIsRootW(lpszPath))
740 if (!PathRemoveFileSpecW(lpszPath))
741 return FALSE;
742 return TRUE;
743}

Referenced by get_drive_type(), IsLFNDriveW(), PathCombineW(), PathQualifyExW(), ATL::CPathT< StringType >::PathStripToRootX(), SHExplorerParseCmdLine(), source_matches_volume(), START_TEST(), and TRASH_CanTrashFile().

◆ PathUndecorateA()

VOID WINAPI PathUndecorateA ( LPSTR  lpszPath)

Definition at line 4064 of file path.c.

4065{
4066 TRACE("(%s)\n",debugstr_a(lpszPath));
4067
4068 if (lpszPath)
4069 {
4070 LPSTR lpszExt = PathFindExtensionA(lpszPath);
4071 if (lpszExt > lpszPath && lpszExt[-1] == ']')
4072 {
4073 LPSTR lpszSkip = lpszExt - 2;
4074 if (*lpszSkip == '[')
4075 lpszSkip++; /* [] (no number) */
4076 else
4077 while (lpszSkip > lpszPath && isdigit(lpszSkip[-1]))
4078 lpszSkip--;
4079 if (lpszSkip > lpszPath && lpszSkip[-1] == '[' && lpszSkip[-2] != '\\')
4080 {
4081 /* remove the [n] */
4082 lpszSkip--;
4083 while (*lpszExt)
4084 *lpszSkip++ = *lpszExt++;
4085 *lpszSkip = '\0';
4086 }
4087 }
4088 }
4089}
#define isdigit(c)
Definition: acclib.h:68

◆ PathUndecorateW()

VOID WINAPI PathUndecorateW ( LPWSTR  lpszPath)

Definition at line 4096 of file path.c.

4097{
4098 TRACE("(%s)\n",debugstr_w(lpszPath));
4099
4100 if (lpszPath)
4101 {
4102 LPWSTR lpszExt = PathFindExtensionW(lpszPath);
4103 if (lpszExt > lpszPath && lpszExt[-1] == ']')
4104 {
4105 LPWSTR lpszSkip = lpszExt - 2;
4106 if (*lpszSkip == '[')
4107 lpszSkip++; /* [] (no number) */
4108 else
4109 while (lpszSkip > lpszPath && isdigitW(lpszSkip[-1]))
4110 lpszSkip--;
4111 if (lpszSkip > lpszPath && lpszSkip[-1] == '[' && lpszSkip[-2] != '\\')
4112 {
4113 /* remove the [n] */
4114 lpszSkip--;
4115 while (*lpszExt)
4116 *lpszSkip++ = *lpszExt++;
4117 *lpszSkip = '\0';
4118 }
4119 }
4120 }
4121}
#define isdigitW(n)
Definition: unicode.h:50

◆ PathUnExpandEnvStringsA()

BOOL WINAPI PathUnExpandEnvStringsA ( LPCSTR  path,
LPSTR  buffer,
UINT  buf_len 
)

Definition at line 4138 of file path.c.

4139{
4140 WCHAR bufferW[MAX_PATH], *pathW;
4141 DWORD len;
4142 BOOL ret;
4143
4144 TRACE("(%s, %p, %d)\n", debugstr_a(path), buffer, buf_len);
4145
4146 pathW = heap_strdupAtoW(path);
4147 if (!pathW) return FALSE;
4148
4149 ret = PathUnExpandEnvStringsW(pathW, bufferW, MAX_PATH);
4150 HeapFree(GetProcessHeap(), 0, pathW);
4151 if (!ret) return FALSE;
4152
4153 len = WideCharToMultiByte(CP_ACP, 0, bufferW, -1, NULL, 0, NULL, NULL);
4154 if (buf_len < len + 1) return FALSE;
4155
4156 WideCharToMultiByte(CP_ACP, 0, bufferW, -1, buffer, buf_len, NULL, NULL);
4157 return TRUE;
4158}
BOOL WINAPI PathUnExpandEnvStringsW(LPCWSTR path, LPWSTR buffer, UINT buf_len)
Definition: path.c:4191
static WCHAR * heap_strdupAtoW(LPCSTR str)
Definition: path.c:73
GLuint buffer
Definition: glext.h:5915

◆ PathUnExpandEnvStringsW()

BOOL WINAPI PathUnExpandEnvStringsW ( LPCWSTR  path,
LPWSTR  buffer,
UINT  buf_len 
)

Definition at line 4191 of file path.c.

4192{
4193 static struct envvars_map null_var = {NULL, 0, {0}, 0};
4194 struct envvars_map *match = &null_var, *cur;
4195 struct envvars_map envvars[] = {
4196 { allusersprofileW, sizeof(allusersprofileW)/sizeof(WCHAR) },
4197 { appdataW, sizeof(appdataW)/sizeof(WCHAR) },
4198 { programfilesW, sizeof(programfilesW)/sizeof(WCHAR) },
4199 { systemrootW, sizeof(systemrootW)/sizeof(WCHAR) },
4200 { systemdriveW, sizeof(systemdriveW)/sizeof(WCHAR) },
4201 { userprofileW, sizeof(userprofileW)/sizeof(WCHAR) },
4202 { NULL }
4203 };
4204 DWORD pathlen;
4205 UINT needed;
4206
4207 TRACE("(%s, %p, %d)\n", debugstr_w(path), buffer, buf_len);
4208
4209 pathlen = strlenW(path);
4210 init_envvars_map(envvars);
4211 cur = envvars;
4212 while (cur->var)
4213 {
4214 /* path can't contain expanded value or value wasn't retrieved */
4215 if (cur->len == 0 || cur->len > pathlen || strncmpiW(cur->path, path, cur->len))
4216 {
4217 cur++;
4218 continue;
4219 }
4220
4221 if (cur->len > match->len)
4222 match = cur;
4223 cur++;
4224 }
4225
4226 /* 'varlen' includes NULL termination char */
4227 needed = match->varlen + pathlen - match->len;
4228 if (match->len == 0 || needed > buf_len) return FALSE;
4229
4230 strcpyW(buffer, match->var);
4231 strcatW(buffer, &path[match->len]);
4232 TRACE("ret %s\n", debugstr_w(buffer));
4233
4234 return TRUE;
4235}
static const WCHAR userprofileW[]
Definition: path.c:4165
static const WCHAR systemdriveW[]
Definition: path.c:4164
static const WCHAR programfilesW[]
Definition: path.c:4162
static const WCHAR allusersprofileW[]
Definition: path.c:4160
static const WCHAR appdataW[]
Definition: path.c:4161
static void init_envvars_map(struct envvars_map *map)
Definition: path.c:4175
static const WCHAR systemrootW[]
Definition: path.c:4163
FxCollectionEntry * cur
#define strncmpiW(s1, s2, n)
Definition: unicode.h:40
Definition: match.c:28

Referenced by PathUnExpandEnvStringsA(), and CShellLink::SetIconLocation().

◆ PathUnmakeSystemFolderA()

BOOL WINAPI PathUnmakeSystemFolderA ( LPCSTR  lpszPath)

Definition at line 3649 of file path.c.

3650{
3651 DWORD dwAttr;
3652
3653 TRACE("(%s)\n", debugstr_a(lpszPath));
3654
3655 if (!lpszPath || !*lpszPath || (dwAttr = GetFileAttributesA(lpszPath)) == INVALID_FILE_ATTRIBUTES ||
3656 !(dwAttr & FILE_ATTRIBUTE_DIRECTORY))
3657 return FALSE;
3658
3660 return SetFileAttributesA(lpszPath, dwAttr);
3661}
BOOL WINAPI SetFileAttributesA(LPCSTR lpFileName, DWORD dwFileAttributes)
Definition: fileinfo.c:776

◆ PathUnmakeSystemFolderW()

BOOL WINAPI PathUnmakeSystemFolderW ( LPCWSTR  lpszPath)

Definition at line 3668 of file path.c.

3669{
3670 DWORD dwAttr;
3671
3672 TRACE("(%s)\n", debugstr_w(lpszPath));
3673
3674 if (!lpszPath || !*lpszPath || (dwAttr = GetFileAttributesW(lpszPath)) == INVALID_FILE_ATTRIBUTES ||
3675 !(dwAttr & FILE_ATTRIBUTE_DIRECTORY))
3676 return FALSE;
3677
3679 return SetFileAttributesW(lpszPath, dwAttr);
3680}

◆ PathUnquoteSpacesA()

VOID WINAPI PathUnquoteSpacesA ( LPSTR  lpszPath)

Definition at line 1012 of file path.c.

1013{
1014 TRACE("(%s)\n", debugstr_a(lpszPath));
1015
1016 if (lpszPath && *lpszPath == '"')
1017 {
1018 DWORD dwLen = strlen(lpszPath) - 1;
1019
1020 if (lpszPath[dwLen] == '"')
1021 {
1022 lpszPath[dwLen] = '\0';
1023 for (; *lpszPath; lpszPath++)
1024 *lpszPath = lpszPath[1];
1025 }
1026 }
1027}

Referenced by HCR_RegGetIconA(), PathParseIconLocationA(), ATL::CPathT< StringType >::PathUnquoteSpacesX(), and test_PathUnquoteSpaces().

◆ PathUnquoteSpacesW()

VOID WINAPI PathUnquoteSpacesW ( LPWSTR  lpszPath)

Definition at line 1034 of file path.c.

1035{
1036 TRACE("(%s)\n", debugstr_w(lpszPath));
1037
1038 if (lpszPath && *lpszPath == '"')
1039 {
1040 DWORD dwLen = strlenW(lpszPath) - 1;
1041
1042 if (lpszPath[dwLen] == '"')
1043 {
1044 lpszPath[dwLen] = '\0';
1045 for (; *lpszPath; lpszPath++)
1046 *lpszPath = lpszPath[1];
1047 }
1048 }
1049}

Referenced by CFSExtractIcon_CreateInstance(), CAddressEditBox::ExecuteCommandLine(), HCR_RegGetIconW(), CFileDefExt::InitOpensWithField(), LanguagesPageProc(), CShellLink::OnNotify(), PathParseIconLocationW(), PathResolveW(), ATL::CPathT< StringType >::PathUnquoteSpacesX(), Preview_OnCreate(), CShellLink::SetPath(), and test_PathUnquoteSpaces().

◆ SHGetWebFolderFilePathA()

HRESULT WINAPI SHGetWebFolderFilePathA ( LPCSTR  lpszFile,
LPSTR  lpszPath,
DWORD  dwPathLen 
)

Definition at line 4251 of file path.c.

4252{
4253 WCHAR szFile[MAX_PATH], szPath[MAX_PATH];
4254 HRESULT hRet;
4255
4256 TRACE("(%s,%p,%d)\n", lpszFile, lpszPath, dwPathLen);
4257
4258 MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, szFile, MAX_PATH);
4259 szPath[0] = '\0';
4260 hRet = SHGetWebFolderFilePathW(szFile, szPath, dwPathLen);
4261 WideCharToMultiByte(CP_ACP, 0, szPath, -1, lpszPath, dwPathLen, 0, 0);
4262 return hRet;
4263}
HRESULT WINAPI SHGetWebFolderFilePathW(LPCWSTR, LPWSTR, DWORD)
Definition: path.c:4270

◆ SHGetWebFolderFilePathW()

HRESULT WINAPI SHGetWebFolderFilePathW ( LPCWSTR  lpszFile,
LPWSTR  lpszPath,
DWORD  dwPathLen 
)

Definition at line 4270 of file path.c.

4271{
4272 static const WCHAR szWeb[] = {'\\','W','e','b','\\','\0'};
4273 static const WCHAR szWebMui[] = {'m','u','i','\\','%','0','4','x','\\','\0'};
4274#define szWebLen (sizeof(szWeb)/sizeof(WCHAR))
4275#define szWebMuiLen ((sizeof(szWebMui)+1)/sizeof(WCHAR))
4276 DWORD dwLen, dwFileLen;
4277 LANGID lidSystem, lidUser;
4278
4279 TRACE("(%s,%p,%d)\n", debugstr_w(lpszFile), lpszPath, dwPathLen);
4280
4281 /* Get base directory for web content */
4282 dwLen = GetSystemWindowsDirectoryW(lpszPath, dwPathLen);
4283 if (dwLen > 0 && lpszPath[dwLen-1] == '\\')
4284 dwLen--;
4285
4286 dwFileLen = strlenW(lpszFile);
4287
4288 if (dwLen + dwFileLen + szWebLen >= dwPathLen)
4289 return E_FAIL; /* lpszPath too short */
4290
4291 strcpyW(lpszPath+dwLen, szWeb);
4292 dwLen += szWebLen;
4293 dwPathLen = dwPathLen - dwLen; /* Remaining space */
4294
4295 lidSystem = GetSystemDefaultUILanguage();
4296 lidUser = GetUserDefaultUILanguage();
4297
4298 if (lidSystem != lidUser)
4299 {
4300 if (dwFileLen + szWebMuiLen < dwPathLen)
4301 {
4302 /* Use localised content in the users UI language if present */
4303 wsprintfW(lpszPath + dwLen, szWebMui, lidUser);
4304 strcpyW(lpszPath + dwLen + szWebMuiLen, lpszFile);
4305 if (PathFileExistsW(lpszPath))
4306 return S_OK;
4307 }
4308 }
4309
4310 /* Fall back to OS default installed content */
4311 strcpyW(lpszPath + dwLen, lpszFile);
4312 if (PathFileExistsW(lpszPath))
4313 return S_OK;
4314 return E_FAIL;
4315}
#define E_FAIL
Definition: ddrawi.h:102
UINT WINAPI GetSystemWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2397
#define szWebMuiLen
#define szWebLen
LANGID WINAPI GetUserDefaultUILanguage(void)
Definition: lang.c:816
LANGID WINAPI GetSystemDefaultUILanguage(void)
Definition: lang.c:836
USHORT LANGID
Definition: mui.h:9
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)

Referenced by SHGetWebFolderFilePathA().

◆ SHLWAPI_PathFindInOtherDirs()

static BOOL SHLWAPI_PathFindInOtherDirs ( LPWSTR  lpszFile,
DWORD  dwWhich 
)
static

Definition at line 1217 of file path.c.

1218{
1219 static const WCHAR szSystem[] = { 'S','y','s','t','e','m','\0'};
1220 static const WCHAR szPath[] = { 'P','A','T','H','\0'};
1221 DWORD dwLenPATH;
1222 LPCWSTR lpszCurr;
1223 WCHAR *lpszPATH;
1225
1226 TRACE("(%s,%08x)\n", debugstr_w(lpszFile), dwWhich);
1227
1228 /* Try system directories */
1230 if (!PathAppendW(buff, lpszFile))
1231 return FALSE;
1232 if (PathFileExistsDefExtW(buff, dwWhich))
1233 {
1234 strcpyW(lpszFile, buff);
1235 return TRUE;
1236 }
1238 if (!PathAppendW(buff, szSystem ) || !PathAppendW(buff, lpszFile))
1239 return FALSE;
1240 if (PathFileExistsDefExtW(buff, dwWhich))
1241 {
1242 strcpyW(lpszFile, buff);
1243 return TRUE;
1244 }
1246 if (!PathAppendW(buff, lpszFile))
1247 return FALSE;
1248 if (PathFileExistsDefExtW(buff, dwWhich))
1249 {
1250 strcpyW(lpszFile, buff);
1251 return TRUE;
1252 }
1253 /* Try dirs listed in %PATH% */
1255
1256 if (!dwLenPATH || !(lpszPATH = HeapAlloc(GetProcessHeap(), 0, (dwLenPATH + 1) * sizeof (WCHAR))))
1257 return FALSE;
1258
1259 GetEnvironmentVariableW(szPath, lpszPATH, dwLenPATH + 1);
1260 lpszCurr = lpszPATH;
1261 while (lpszCurr)
1262 {
1263 LPCWSTR lpszEnd = lpszCurr;
1264 LPWSTR pBuff = buff;
1265
1266 while (*lpszEnd == ' ')
1267 lpszEnd++;
1268 while (*lpszEnd && *lpszEnd != ';')
1269 *pBuff++ = *lpszEnd++;
1270 *pBuff = '\0';
1271
1272 if (*lpszEnd)
1273 lpszCurr = lpszEnd + 1;
1274 else
1275 lpszCurr = NULL; /* Last Path, terminate after this */
1276
1277 if (!PathAppendW(buff, lpszFile))
1278 {
1279 HeapFree(GetProcessHeap(), 0, lpszPATH);
1280 return FALSE;
1281 }
1282 if (PathFileExistsDefExtW(buff, dwWhich))
1283 {
1284 strcpyW(lpszFile, buff);
1285 HeapFree(GetProcessHeap(), 0, lpszPATH);
1286 return TRUE;
1287 }
1288 }
1289 HeapFree(GetProcessHeap(), 0, lpszPATH);
1290 return FALSE;
1291}
#define GetEnvironmentVariableW(x, y, z)
Definition: compat.h:755
#define PathAppendW
Definition: pathcch.h:309

Referenced by PathFindOnPathExA(), and PathFindOnPathExW().

◆ SHLWAPI_UseSystemForSystemFolders()

static BOOL SHLWAPI_UseSystemForSystemFolders ( void  )
static

Definition at line 3070 of file path.c.

3071{
3072 static BOOL bCheckedReg = FALSE;
3073 static BOOL bUseSystemForSystemFolders = FALSE;
3074
3075 if (!bCheckedReg)
3076 {
3077 bCheckedReg = TRUE;
3078
3079 /* Key tells Win what file attributes to use on system folders */
3081 "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer",
3082 "UseSystemForSystemFolders", 0, 0, 0))
3083 bUseSystemForSystemFolders = TRUE;
3084 }
3085 return bUseSystemForSystemFolders;
3086}
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by PathMakeSystemFolderW().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shell  )

Variable Documentation

◆ allusersprofileW

const WCHAR allusersprofileW[] = {'%','A','L','L','U','S','E','R','S','P','R','O','F','I','L','E','%',0}
static

Definition at line 4160 of file path.c.

Referenced by PathUnExpandEnvStringsW().

◆ appdataW

const WCHAR appdataW[] = {'%','A','P','P','D','A','T','A','%',0}
static

Definition at line 4161 of file path.c.

Referenced by PathUnExpandEnvStringsW().

◆ pIsNetDrive

fnpIsNetDrive pIsNetDrive
static

Definition at line 66 of file path.c.

Referenced by PathIsNetworkPathA(), and PathIsNetworkPathW().

◆ programfilesW

const WCHAR programfilesW[] = {'%','P','r','o','g','r','a','m','F','i','l','e','s','%',0}
static

Definition at line 4162 of file path.c.

Referenced by PathUnExpandEnvStringsW(), and test_StdRegProv().

◆ SHELL_charclass

const DWORD SHELL_charclass[]
static

◆ SHLWAPI_hshell32

HMODULE SHLWAPI_hshell32
static

Definition at line 62 of file path.c.

◆ systemdriveW

const WCHAR systemdriveW[] = {'%','S','y','s','t','e','m','D','r','i','v','e','%',0}
static

Definition at line 4164 of file path.c.

Referenced by PathUnExpandEnvStringsW(), and test_Win32_OperatingSystem().

◆ systemrootW

const WCHAR systemrootW[] = {'%','S','y','s','t','e','m','R','o','o','t','%',0}
static

Definition at line 4163 of file path.c.

Referenced by create_file_test(), and PathUnExpandEnvStringsW().

◆ userprofileW

const WCHAR userprofileW[] = {'%','U','S','E','R','P','R','O','F','I','L','E','%',0}
static

Definition at line 4165 of file path.c.

Referenced by PathUnExpandEnvStringsW().