ReactOS  0.4.15-dev-2991-g632fa1c
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)
GLenum func
Definition: glext.h:6028
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
Definition: name.c:38
#define GetProcAddress(x, y)
Definition: compat.h:612

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 4328 of file path.c.

◆ PATH_CHAR_CLASS_ASTERIX

#define PATH_CHAR_CLASS_ASTERIX   0x00000002

Definition at line 4317 of file path.c.

◆ PATH_CHAR_CLASS_BACKSLASH

#define PATH_CHAR_CLASS_BACKSLASH   0x00000008

Definition at line 4319 of file path.c.

◆ PATH_CHAR_CLASS_COLON

#define PATH_CHAR_CLASS_COLON   0x00000010

Definition at line 4320 of file path.c.

◆ PATH_CHAR_CLASS_COMMA

#define PATH_CHAR_CLASS_COMMA   0x00000040

Definition at line 4322 of file path.c.

◆ PATH_CHAR_CLASS_DOT

#define PATH_CHAR_CLASS_DOT   0x00000004

Definition at line 4318 of file path.c.

◆ PATH_CHAR_CLASS_DOUBLEQUOTE

#define PATH_CHAR_CLASS_DOUBLEQUOTE   0x00000200

Definition at line 4325 of file path.c.

◆ PATH_CHAR_CLASS_INVALID

#define PATH_CHAR_CLASS_INVALID   0x00000000

Definition at line 4327 of file path.c.

◆ PATH_CHAR_CLASS_LETTER

#define PATH_CHAR_CLASS_LETTER   0x00000001

Definition at line 4316 of file path.c.

◆ PATH_CHAR_CLASS_OTHER_VALID

#define PATH_CHAR_CLASS_OTHER_VALID   0x00000100

Definition at line 4324 of file path.c.

◆ PATH_CHAR_CLASS_SEMICOLON

#define PATH_CHAR_CLASS_SEMICOLON   0x00000020

Definition at line 4321 of file path.c.

◆ PATH_CHAR_CLASS_SPACE

#define PATH_CHAR_CLASS_SPACE   0x00000080

Definition at line 4323 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  {
79  DWORD len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
80  ret = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
81  if (ret)
83  }
84 
85  return ret;
86 }
#define CP_ACP
Definition: compat.h:109
DWORD ret
Definition: path.c:47
const WCHAR * str
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
#define NULL
Definition: types.h:112
#define MultiByteToWideChar
Definition: compat.h:110

Referenced by PathUnExpandEnvStringsA().

◆ init_envvars_map()

static void init_envvars_map ( struct envvars_map map)
static

Definition at line 4174 of file path.c.

4175 {
4176  while (map->var)
4177  {
4178  map->len = ExpandEnvironmentStringsW(map->var, map->path, sizeof(map->path)/sizeof(WCHAR));
4179  /* exclude null from length */
4180  if (map->len) map->len--;
4181  map++;
4182  }
4183 }
__wchar_t WCHAR
Definition: xmlstorage.h:180
Definition: _map.h:44
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
char * LPSTR
Definition: xmlstorage.h:182
LPSTR WINAPI CharNextA(_In_ LPCSTR)
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
#define MAX_PATH
Definition: compat.h:34
#define NULL
Definition: types.h:112

Referenced by ATL::CPathT< StringType >::PathAddBackslashX(), and test_PathAddBackslash().

◆ 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 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
#define MAX_PATH
Definition: compat.h:34
#define NULL
Definition: types.h:112

Referenced by CDesktopFolder::_GetSFFromPidl(), _SHGetUserShellFolderPath(), _SHRegisterFolders(), _SHRegisterUserShellFolders(), ACTION_AppSearchComponents(), ACTION_AppSearchDr(), ACTION_RecurseSearchDirectory(), ACTION_SearchDirectory(), app_search_file(), COMDLG32_GetCanonicalPath(), CControlPanelEnum::CreateCPanelEnumList(), DoGetBaseName(), FILEDLG95_InitControls(), FILEDLG95_ValidatePathAction(), find_published_source(), get_drive_type(), CFSFolder::GetDisplayNameOf(), CRecycleBinEnum::Initialize(), CFileSysEnum::Initialize(), CRecycleBin::InvokeCommand(), CRecycleBinItemContextMenu::InvokeCommand(), ITERATE_RemoveFiles(), MMSYS_InstallDevice(), msi_dialog_directorylist_up(), msi_load_media_info(), OpenColorProfileW(), CFSFolder::ParseDisplayName(), ATL::CPathT< StringType >::PathAddBackslashX(), PathCombineW(), PathIsDirectoryEmptyW(), PathQualifyExW(), ready_media(), RenderHDROP(), set_installer_properties(), SHCreateDirectoryExW(), SHELL_execute(), ShellExecCmdLine(), ShellLink_UpdatePath(), SHGetFolderPathAndSubDirW(), SHGetNewLinkInfoW(), ShowCreateShortcutWizard(), source_matches_volume(), START_TEST(), test_PathSearchAndQualify(), CDownloadManager::ThreadFunc(), and wWinMain().

◆ PathAddExtensionA()

BOOL WINAPI PathAddExtensionA ( LPSTR  lpszPath,
LPCSTR  lpszExtension 
)

Definition at line 2614 of file path.c.

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

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

◆ PathAddExtensionW()

BOOL WINAPI PathAddExtensionW ( LPWSTR  lpszPath,
LPCWSTR  lpszExtension 
)

Definition at line 2637 of file path.c.

2638 {
2639  size_t dwLen;
2640 
2641  TRACE("(%s,%s)\n", debugstr_w(lpszPath), debugstr_w(lpszExtension));
2642 
2643  if (!lpszPath || !lpszExtension || *(PathFindExtensionW(lpszPath)))
2644  return FALSE;
2645 
2646  dwLen = strlenW(lpszPath);
2647 
2648  if (dwLen + strlenW(lpszExtension) >= MAX_PATH)
2649  return FALSE;
2650 
2651  strcpyW(lpszPath + dwLen, lpszExtension);
2652  return TRUE;
2653 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define debugstr_w
Definition: kernel32.h:32
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
Definition: path.c:447
#define TRACE(s)
Definition: solgame.cpp:4
#define MAX_PATH
Definition: compat.h:34
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219

Referenced by FileCompareWildTitle(), ATL::CPathT< StringType >::PathAddExtensionX(), SHELL_TryAppPathW(), and WriteMinidump().

◆ 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 }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
LPSTR WINAPI PathCombineA(LPSTR lpszDest, LPCSTR lpszDir, LPCSTR lpszFile)
Definition: path.c:159
BOOL WINAPI PathIsUNCA(LPCSTR lpszPath)
Definition: path.c:2242

Referenced by DoTestEntries(), GetSubProgramPath(), PathAppendAW(), ATL::CPathT< StringType >::PathAppendX(), SHAddToRecentDocs(), START_TEST(), test_PathAppendA(), test_SdbGetPermLayerKeys(), test_SetPermLayer(), test_Sign_Media(), and write_resource_file().

◆ 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 }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
BOOL WINAPI PathIsUNCW(LPCWSTR lpszPath)
Definition: path.c:2265
LPWSTR WINAPI PathCombineW(LPWSTR lpszDest, LPCWSTR lpszDir, LPCWSTR lpszFile)
Definition: path.c:194

Referenced by _SHExpandEnvironmentStrings(), _SHGetDefaultValue(), ACTION_RecurseSearchDirectory(), add_favs_to_menu(), addFileHelper(), CDirectoryList::AddPathsFromDirectory(), AvailableStrings::AvailableStrings(), CCommonFolder< CRegistryFolder, RegPidlEntry, CRegistryFolderExtractIcon >::BindToObject(), CreateSendToDeskLink(), CreateSendToMyDocuments(), CreateSendToZip(), CAvailableApps::DeleteCurrentAppsDB(), CAppScrnshotPreview::DisplayImage(), DllRegisterServer(), DoAddFilesFromItem(), DoDeleteSpecW(), DoInitPaths(), CFontExt::DoInstallFontFile(), DoTestEntry(), CDeskLinkDropHandler::Drop(), FileCompareBothWild(), FileCompareOneSideWild(), FileCompareWildTitle(), FillDefaultSettings(), FinishDlgProc(), CFSFolder::GetCustomViewInfo(), CCommonFolder< CRegistryFolder, RegPidlEntry, CRegistryFolderExtractIcon >::GetDisplayNameOf(), getIconLocationForDrive(), getIconLocationForFolder(), GetStorageDirectory(), GetSubProgramPath(), CFileDefExt::InitFolderCustomizePage(), CFileDefExt::OnFolderCustApply(), PathAppendAW(), PathAppendNoDirEscapeW(), ATL::CPathT< StringType >::PathAppendX(), CDirectoryWatcher::ProcessNotification(), CAvailableApplicationInfo::RetrieveGeneralInfo(), SHAddToRecentDocs(), SHGetFolderPathAndSubDirW(), SHLWAPI_PathFindInOtherDirs(), START_TEST(), testRegStoreSavedCerts(), and CDownloadManager::ThreadFunc().

◆ 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 }
#define TRACE(s)
Definition: solgame.cpp:4
static char drive[2]
Definition: batch.c:28

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 }
#define TRACE(s)
Definition: solgame.cpp:4
static char drive[2]
Definition: batch.c:28

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

◆ PathCanonicalizeA()

BOOL WINAPI PathCanonicalizeA ( LPSTR  lpszBuf,
LPCSTR  lpszPath 
)

Definition at line 2412 of file path.c.

2413 {
2414  BOOL bRet = FALSE;
2415 
2416  TRACE("(%p,%s)\n", lpszBuf, debugstr_a(lpszPath));
2417 
2418  if (lpszBuf)
2419  *lpszBuf = '\0';
2420 
2421  if (!lpszBuf || !lpszPath)
2423  else
2424  {
2426  WCHAR szBuff[MAX_PATH];
2427  int ret = MultiByteToWideChar(CP_ACP,0,lpszPath,-1,szPath,MAX_PATH);
2428 
2429  if (!ret) {
2430  WARN("Failed to convert string to widechar (too long?), LE %d.\n", GetLastError());
2431  return FALSE;
2432  }
2433  bRet = PathCanonicalizeW(szBuff, szPath);
2434  WideCharToMultiByte(CP_ACP,0,szBuff,-1,lpszBuf,MAX_PATH,0,0);
2435  }
2436  return bRet;
2437 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define WideCharToMultiByte
Definition: compat.h:111
BOOL WINAPI PathCanonicalizeW(LPWSTR lpszBuf, LPCWSTR lpszPath)
Definition: path.c:2445
#define CP_ACP
Definition: compat.h:109
#define WARN(fmt,...)
Definition: debug.h:112
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
DWORD ret
Definition: path.c:47
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
#define MAX_PATH
Definition: compat.h:34
#define SetLastError(x)
Definition: compat.h:611
LPCWSTR szPath
Definition: env.c:37
#define MultiByteToWideChar
Definition: compat.h:110

Referenced by ATL::CPathT< StringType >::PathCanonicalizeX(), and test_PathCanonicalizeA().

◆ PathCanonicalizeW()

BOOL WINAPI PathCanonicalizeW ( LPWSTR  lpszBuf,
LPCWSTR  lpszPath 
)

Definition at line 2445 of file path.c.

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

Referenced by COMDLG32_GetCanonicalPath(), PathAppendNoDirEscapeW(), PathCanonicalizeA(), ATL::CPathT< StringType >::PathCanonicalizeX(), and PathCombineW().

◆ 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 
184 fail:
185  lpszDest[0] = 0;
186  return NULL;
187 }
#define WideCharToMultiByte
Definition: compat.h:111
#define CP_ACP
Definition: compat.h:109
WCHAR lpszDest[260]
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
#define MAX_PATH
Definition: compat.h:34
#define NULL
Definition: types.h:112
#define MultiByteToWideChar
Definition: compat.h:110
LPWSTR WINAPI PathCombineW(LPWSTR lpszDest, LPCWSTR lpszDir, LPCWSTR lpszFile)
Definition: path.c:194

Referenced by create_file(), delete_file(), expect_files(), CZipExtract::Extract(), PathAppendA(), ATL::CPathT< StringType >::PathCombineX(), test_items(), test_PathCombineA(), test_SdbGetPermLayerKeys(), test_Sign_Media(), and wrapSdbSetPermLayerKeys2().

◆ 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 
247  PathCanonicalizeW(lpszDest, szTemp);
248  return lpszDest;
249 }
BOOL WINAPI PathIsRelativeW(LPCWSTR lpszPath)
Definition: path.c:1578
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
BOOL WINAPI PathCanonicalizeW(LPWSTR lpszBuf, LPCWSTR lpszPath)
Definition: path.c:2445
#define TRUE
Definition: types.h:120
#define lstrcpynW
Definition: compat.h:597
#define FALSE
Definition: types.h:117
BOOL WINAPI PathStripToRootW(LPWSTR lpszPath)
Definition: path.c:733
LPWSTR WINAPI PathAddBackslashW(LPWSTR lpszPath)
Definition: path.c:294
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
WCHAR lpszDest[260]
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
WINE_UNICODE_INLINE WCHAR * strcatW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:242
#define NULL
Definition: types.h:112
BOOL WINAPI PathIsUNCW(LPCWSTR lpszPath)
Definition: path.c:2265

Referenced by CFileSysEnum::_AddFindResult(), CFSFolder::_CreateShellExtInstance(), CFSDropTarget::_DoDrop(), CFSFolder::BindToObject(), BuildPathsList(), compat_catpath(), copy_dir_to_dir(), copy_file(), copy_to_dir(), CACListISF::Expand(), move_dir_to_dir(), move_to_dir(), parse_file_list(), PathAppendW(), PathCombineA(), ATL::CPathT< StringType >::PathCombineX(), PathFindOnPathExA(), PathFindOnPathExW(), PathMakeAbsoluteW(), PathYetAnotherMakeUniqueName(), pBuildFileList(), RecursiveFind(), SetChmPath(), CFSFolder::SetNameOf(), SHELL_DeleteDirectoryW(), SHGetFileInfoW(), test_items(), and test_PathCombineW().

◆ PathCommonPrefixA()

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

Definition at line 2750 of file path.c.

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

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

◆ PathCommonPrefixW()

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

Definition at line 2805 of file path.c.

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

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

◆ PathCompactPathA()

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

Definition at line 2869 of file path.c.

2870 {
2871  BOOL bRet = FALSE;
2872 
2873  TRACE("(%p,%s,%d)\n", hDC, debugstr_a(lpszPath), dx);
2874 
2875  if (lpszPath)
2876  {
2878  MultiByteToWideChar(CP_ACP,0,lpszPath,-1,szPath,MAX_PATH);
2879  bRet = PathCompactPathW(hDC, szPath, dx);
2880  WideCharToMultiByte(CP_ACP,0,szPath,-1,lpszPath,MAX_PATH,0,0);
2881  }
2882  return bRet;
2883 }
#define WideCharToMultiByte
Definition: compat.h:111
#define CP_ACP
Definition: compat.h:109
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI PathCompactPathW(HDC hDC, LPWSTR lpszPath, UINT dx)
Definition: path.c:2890
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
#define MAX_PATH
Definition: compat.h:34
static HDC hDC
Definition: 3dtext.c:33
LPCWSTR szPath
Definition: env.c:37
GLint dx
Definition: linetemp.h:97
#define MultiByteToWideChar
Definition: compat.h:110

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

◆ PathCompactPathExA()

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

Definition at line 1434 of file path.c.

1436 {
1437  BOOL bRet = FALSE;
1438 
1439  TRACE("(%p,%s,%d,0x%08x)\n", lpszDest, debugstr_a(lpszPath), cchMax, dwFlags);
1440 
1441  if (lpszPath && lpszDest)
1442  {
1444  WCHAR szDest[MAX_PATH];
1445 
1446  MultiByteToWideChar(CP_ACP,0,lpszPath,-1,szPath,MAX_PATH);
1447  szDest[0] = '\0';
1448  bRet = PathCompactPathExW(szDest, szPath, cchMax, dwFlags);
1449  WideCharToMultiByte(CP_ACP,0,szDest,-1,lpszDest,MAX_PATH,0,0);
1450  }
1451  return bRet;
1452 }
#define WideCharToMultiByte
Definition: compat.h:111
#define CP_ACP
Definition: compat.h:109
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
WCHAR lpszDest[260]
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
#define MAX_PATH
Definition: compat.h:34
UINT cchMax
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
LPCWSTR szPath
Definition: env.c:37
BOOL WINAPI PathCompactPathExW(LPWSTR lpszDest, LPCWSTR lpszPath, UINT cchMax, DWORD dwFlags)
Definition: path.c:1459
#define MultiByteToWideChar
Definition: compat.h:110

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

◆ PathCompactPathExW()

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

Definition at line 1459 of file path.c.

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

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

◆ PathCompactPathW()

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

Definition at line 2890 of file path.c.

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

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 3305 of file path.c.

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

Referenced by FileProtocolHandlerA().

◆ PathCreateFromUrlAlloc()

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

Definition at line 3496 of file path.c.

3498 {
3499  WCHAR pathW[MAX_PATH];
3500  DWORD size;
3501  HRESULT hr;
3502 
3503  size = MAX_PATH;
3504  hr = PathCreateFromUrlW(pszUrl, pathW, &size, dwReserved);
3505  if (SUCCEEDED(hr))
3506  {
3507  /* Yes, this is supposed to crash if pszPath is NULL */
3508  *pszPath = StrDupW(pathW);
3509  }
3510  return hr;
3511 }
HRESULT WINAPI PathCreateFromUrlW(LPCWSTR pszUrl, LPWSTR pszPath, LPDWORD pcchPath, DWORD dwReserved)
Definition: path.c:3354
HRESULT hr
Definition: shlfolder.c:183
LPWSTR WINAPI StrDupW(LPCWSTR lpszStr)
Definition: string.c:1089
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:90
if SUCCEEDED(hr)
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95

◆ PathCreateFromUrlW()

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

Definition at line 3354 of file path.c.

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

Referenced by 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 1754 of file path.c.

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

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

◆ PathFileExistsAndAttributesA()

BOOL WINAPI PathFileExistsAndAttributesA ( LPCSTR  lpszPath,
DWORD dwAttr 
)

Definition at line 1805 of file path.c.

1806 {
1807  UINT iPrevErrMode;
1808  DWORD dwVal = 0;
1809 
1810  TRACE("(%s %p)\n", debugstr_a(lpszPath), dwAttr);
1811 
1812  if (dwAttr)
1813  *dwAttr = INVALID_FILE_ATTRIBUTES;
1814 
1815  if (!lpszPath)
1816  return FALSE;
1817 
1818  iPrevErrMode = SetErrorMode(SEM_FAILCRITICALERRORS);
1819  dwVal = GetFileAttributesA(lpszPath);
1820  SetErrorMode(iPrevErrMode);
1821  if (dwAttr)
1822  *dwAttr = dwVal;
1823  return (dwVal != INVALID_FILE_ATTRIBUTES);
1824 }
UINT WINAPI SetErrorMode(IN UINT uMode)
Definition: except.c:749
#define SEM_FAILCRITICALERRORS
Definition: rtltypes.h:69
#define FALSE
Definition: types.h:117
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
Definition: fileinfo.c:636
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
unsigned long DWORD
Definition: ntddk_ex.h:95
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
unsigned int UINT
Definition: ndis.h:50

◆ PathFileExistsAndAttributesW()

BOOL WINAPI PathFileExistsAndAttributesW ( LPCWSTR  lpszPath,
DWORD dwAttr 
)

Definition at line 1831 of file path.c.

1832 {
1833  UINT iPrevErrMode;
1834  DWORD dwVal;
1835 
1836  TRACE("(%s %p)\n", debugstr_w(lpszPath), dwAttr);
1837 
1838  if (!lpszPath)
1839  return FALSE;
1840 
1841  iPrevErrMode = SetErrorMode(SEM_FAILCRITICALERRORS);
1842  dwVal = GetFileAttributesW(lpszPath);
1843  SetErrorMode(iPrevErrMode);
1844  if (dwAttr)
1845  *dwAttr = dwVal;
1846  return (dwVal != INVALID_FILE_ATTRIBUTES);
1847 }
UINT WINAPI SetErrorMode(IN UINT uMode)
Definition: except.c:749
#define SEM_FAILCRITICALERRORS
Definition: rtltypes.h:69
#define FALSE
Definition: types.h:117
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
unsigned int UINT
Definition: ndis.h:50

Referenced by PathResolveW().

◆ PathFileExistsDefExtA()

BOOL WINAPI PathFileExistsDefExtA ( LPSTR  lpszPath,
DWORD  dwWhich 
)

Definition at line 1194 of file path.c.

1195 {
1196  BOOL bRet = FALSE;
1197 
1198  TRACE("(%s,%d)\n", debugstr_a(lpszPath), dwWhich);
1199 
1200  if (lpszPath)
1201  {
1203  MultiByteToWideChar(CP_ACP,0,lpszPath,-1,szPath,MAX_PATH);
1204  bRet = PathFileExistsDefExtW(szPath, dwWhich);
1205  if (bRet)
1206  WideCharToMultiByte(CP_ACP,0,szPath,-1,lpszPath,MAX_PATH,0,0);
1207  }
1208  return bRet;
1209 }
#define WideCharToMultiByte
Definition: compat.h:111
#define CP_ACP
Definition: compat.h:109
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
#define MAX_PATH
Definition: compat.h:34
BOOL WINAPI PathFileExistsDefExtW(LPWSTR lpszPath, DWORD dwWhich)
Definition: path.c:1117
LPCWSTR szPath
Definition: env.c:37
#define MultiByteToWideChar
Definition: compat.h:110

◆ 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  {
1154 #endif
1155  lstrcpyW(lpszPath + iLen, pszExts[iChoose]);
1156  if (PathFileExistsW(lpszPath))
1157  return TRUE;
1158 #ifdef __REACTOS__
1159  }
1160 #endif
1161  iChoose++;
1162  dwWhich >>= 1;
1163  }
1164  *(lpszPath + iLen) = (WCHAR)'\0';
1165  return FALSE;
1166  }
1167  }
1168  return PathFileExistsW(lpszPath);
1169 }
#define WHICH_OPTIONAL
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define TRUE
Definition: types.h:120
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
#define lstrlenW
Definition: compat.h:609
#define FALSE
Definition: types.h:117
BOOL WINAPI PathIsUNCServerShareW(LPCWSTR lpszPath)
Definition: path.c:2377
#define debugstr_w
Definition: kernel32.h:32
BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath)
Definition: path.c:1776
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
Definition: path.c:447
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
#define lstrcpyW
Definition: compat.h:608
BOOL WINAPI PathIsUNCServerW(LPCWSTR lpszPath)
Definition: path.c:2322

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

◆ PathFileExistsW()

BOOL WINAPI PathFileExistsW ( LPCWSTR  lpszPath)

Definition at line 1776 of file path.c.

1777 {
1778  UINT iPrevErrMode;
1779  DWORD dwAttr;
1780 
1781  TRACE("(%s)\n",debugstr_w(lpszPath));
1782 
1783  if (!lpszPath)
1784  return FALSE;
1785 
1786  iPrevErrMode = SetErrorMode(SEM_FAILCRITICALERRORS);
1787  dwAttr = GetFileAttributesW(lpszPath);
1788  SetErrorMode(iPrevErrMode);
1789  return dwAttr != INVALID_FILE_ATTRIBUTES;
1790 }
UINT WINAPI SetErrorMode(IN UINT uMode)
Definition: except.c:749
#define SEM_FAILCRITICALERRORS
Definition: rtltypes.h:69
#define FALSE
Definition: types.h:117
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
unsigned int UINT
Definition: ndis.h:50

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

◆ 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 }
char * LPSTR
Definition: xmlstorage.h:182
LPSTR WINAPI CharNextA(_In_ LPCSTR)
const char * LPCSTR
Definition: xmlstorage.h:183
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
#define NULL
Definition: types.h:112

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 }
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
#define NULL
Definition: types.h:112
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by CFileSysEnum::_AddFindResult(), CFSDropTarget::_DoDrop(), add_favs_to_menu(), COpenWithList::AddAppToMRUList(), CFSFolder::CompareIDs(), CRecycleBin::CompareIDs(), CreateShortcut(), CFontExt::Drop(), ExtensionFromPidl(), FD31_UpdateResult(), FileCompareWildTitle(), FILEDLG95_OnOpen(), FinishDlgProc(), FM_InitMenuPopup(), get_first_ext_from_spec(), CRecycleBin::GetDetailsOf(), CLayerUIPropPage::InitFile(), CFileDefExt::InitFileType(), COpenWithMenu::Initialize(), CFileDefExt::InitOpensWithField(), COpenWithMenu::InvokeCommand(), LoadPropSheetHandlers(), COpenWithList::LoadRecommended(), 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(), COpenWithList::SetDefaultHandler(), CFSFolder::SetNameOf(), SH_GetTargetTypeByPath(), SHAddToRecentDocs(), SHELL32_GetFSItemAttributes(), SHELL_FS_HideExtension(), ShellExecute_GetClassKey(), SHGetFileInfoW(), ShowCreateShortcutWizard(), 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 }
char * LPSTR
Definition: xmlstorage.h:182
LPSTR WINAPI CharNextA(_In_ LPCSTR)
const char * LPCSTR
Definition: xmlstorage.h:183
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31

Referenced by _CZipAskPassword(), _CZipAskReplace(), 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 }
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by CFSDropTarget::_DoDrop(), _ILCreate(), COpenWithList::Add(), CFontExt::CompareIDs(), CRecycleBin::CompareIDs(), copy_file(), copy_file_to_file(), create_target_directory(), CreateSendToMyDocuments(), CCopyToMenu::DoGetFileTitle(), CMoveToMenu::DoGetFileTitle(), CDeskLinkDropHandler::Drop(), FD31_UpdateResult(), FILEDLG95_OnOpen(), CFileDefExt::GeneralPageProc(), get_volume_path_parent(), CFontExt::GetDetailsOf(), GetFileDialog95(), CShellLink::GetPath(), COpenWithDialog::Init(), CFileDefExt::InitFilePath(), CFileDefExt::InitGeneralPage(), CFileDefExt::InitOpensWithField(), CShellMenuCallback::InsertRecentItem(), IsTitleWild(), COpenWithList::LoadFromProgIdKey(), LoadPropSheetHandlers(), msi_dialog_directorylist_up(), CShellLink::OnInitDialog(), PathCompactPathExW(), PathCompactPathW(), ATL::CPathT< StringType >::PathFindFileNameX(), PathStripPathW(), pLoadImageFromNode(), BtrfsContextMenu::reflink_copy(), SH_ShowPropertiesDialog(), SHAddToRecentDocs(), SHGetFileInfoW(), ShowCreateShortcutWizard(), and WelcomeDlgProc().

◆ PathFindNextComponentA()

LPSTR WINAPI PathFindNextComponentA ( LPCSTR  lpszPath)

Definition at line 2555 of file path.c.

2556 {
2557  LPSTR lpszSlash;
2558 
2559  TRACE("(%s)\n", debugstr_a(lpszPath));
2560 
2561  if(!lpszPath || !*lpszPath)
2562  return NULL;
2563 
2564  if ((lpszSlash = StrChrA(lpszPath, '\\')))
2565  {
2566  if (lpszSlash[1] == '\\')
2567  lpszSlash++;
2568  return lpszSlash + 1;
2569  }
2570  return (LPSTR)lpszPath + strlen(lpszPath);
2571 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * LPSTR
Definition: xmlstorage.h:182
LPSTR WINAPI StrChrA(LPCSTR lpszStr, WORD ch)
Definition: string.c:270
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
#define NULL
Definition: types.h:112

◆ PathFindNextComponentW()

LPWSTR WINAPI PathFindNextComponentW ( LPCWSTR  lpszPath)

Definition at line 2578 of file path.c.

2579 {
2580  LPWSTR lpszSlash;
2581 
2582  TRACE("(%s)\n", debugstr_w(lpszPath));
2583 
2584  if(!lpszPath || !*lpszPath)
2585  return NULL;
2586 
2587  if ((lpszSlash = StrChrW(lpszPath, '\\')))
2588  {
2589  if (lpszSlash[1] == '\\')
2590  lpszSlash++;
2591  return lpszSlash + 1;
2592  }
2593  return (LPWSTR)lpszPath + strlenW(lpszPath);
2594 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
LPWSTR WINAPI StrChrW(LPCWSTR lpszStr, WCHAR ch)
Definition: string.c:468
#define NULL
Definition: types.h:112
WCHAR * LPWSTR
Definition: xmlstorage.h:184

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

◆ PathFindOnPathA()

BOOL WINAPI PathFindOnPathA ( LPSTR  lpszFile,
LPCSTR lppszOtherDirs 
)

Definition at line 1391 of file path.c.

1392 {
1393  TRACE("(%s,%p)\n", debugstr_a(lpszFile), lppszOtherDirs);
1394  return PathFindOnPathExA(lpszFile, lppszOtherDirs, 0);
1395  }
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
BOOL WINAPI PathFindOnPathExA(LPSTR lpszFile, LPCSTR *lppszOtherDirs, DWORD dwWhich)
Definition: path.c:1306

◆ PathFindOnPathExA()

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

Definition at line 1306 of file path.c.

1307 {
1308  WCHAR szFile[MAX_PATH];
1309  WCHAR buff[MAX_PATH];
1310 
1311  TRACE("(%s,%p,%08x)\n", debugstr_a(lpszFile), lppszOtherDirs, dwWhich);
1312 
1313  if (!lpszFile || !PathIsFileSpecA(lpszFile))
1314  return FALSE;
1315 
1316  MultiByteToWideChar(CP_ACP,0,lpszFile,-1,szFile,MAX_PATH);
1317 
1318  /* Search provided directories first */
1319  if (lppszOtherDirs && *lppszOtherDirs)
1320  {
1321  WCHAR szOther[MAX_PATH];
1322  LPCSTR *lpszOtherPath = lppszOtherDirs;
1323 
1324  while (lpszOtherPath && *lpszOtherPath && (*lpszOtherPath)[0])
1325  {
1326  MultiByteToWideChar(CP_ACP,0,*lpszOtherPath,-1,szOther,MAX_PATH);
1327  PathCombineW(buff, szOther, szFile);
1328  if (PathFileExistsDefExtW(buff, dwWhich))
1329  {
1330  WideCharToMultiByte(CP_ACP,0,buff,-1,lpszFile,MAX_PATH,0,0);
1331  return TRUE;
1332  }
1333  lpszOtherPath++;
1334  }
1335  }
1336  /* Not found, try system and path dirs */
1337  if (SHLWAPI_PathFindInOtherDirs(szFile, dwWhich))
1338  {
1339  WideCharToMultiByte(CP_ACP,0,szFile,-1,lpszFile,MAX_PATH,0,0);
1340  return TRUE;
1341  }
1342  return FALSE;
1343 }
#define WideCharToMultiByte
Definition: compat.h:111
#define TRUE
Definition: types.h:120
#define CP_ACP
Definition: compat.h:109
#define FALSE
Definition: types.h:117
const char * LPCSTR
Definition: xmlstorage.h:183
BOOL WINAPI PathIsFileSpecA(LPCSTR lpszPath)
Definition: path.c:2111
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
#define MAX_PATH
Definition: compat.h:34
static BOOL SHLWAPI_PathFindInOtherDirs(LPWSTR lpszFile, DWORD dwWhich)
Definition: path.c:1216
BOOL WINAPI PathFileExistsDefExtW(LPWSTR lpszPath, DWORD dwWhich)
Definition: path.c:1117
#define MultiByteToWideChar
Definition: compat.h:110
LPWSTR WINAPI PathCombineW(LPWSTR lpszDest, LPCWSTR lpszDir, LPCWSTR lpszFile)
Definition: path.c:194
static unsigned char buff[32768]
Definition: fatten.c:17

Referenced by PathFindOnPathA().

◆ PathFindOnPathExW()

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

Definition at line 1350 of file path.c.

1351 {
1352  WCHAR buff[MAX_PATH];
1353 
1354  TRACE("(%s,%p,%08x)\n", debugstr_w(lpszFile), lppszOtherDirs, dwWhich);
1355 
1356  if (!lpszFile || !PathIsFileSpecW(lpszFile))
1357  return FALSE;
1358 
1359  /* Search provided directories first */
1360  if (lppszOtherDirs && *lppszOtherDirs)
1361  {
1362  LPCWSTR *lpszOtherPath = lppszOtherDirs;
1363  while (lpszOtherPath && *lpszOtherPath && (*lpszOtherPath)[0])
1364  {
1365  PathCombineW(buff, *lpszOtherPath, lpszFile);
1366  if (PathFileExistsDefExtW(buff, dwWhich))
1367  {
1368  strcpyW(lpszFile, buff);
1369  return TRUE;
1370  }
1371  lpszOtherPath++;
1372  }
1373  }
1374  /* Not found, try system and path dirs */
1375  return SHLWAPI_PathFindInOtherDirs(lpszFile, dwWhich);
1376 }
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define debugstr_w
Definition: kernel32.h:32
BOOL WINAPI PathIsFileSpecW(LPCWSTR lpszPath)
Definition: path.c:2132
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
static BOOL SHLWAPI_PathFindInOtherDirs(LPWSTR lpszFile, DWORD dwWhich)
Definition: path.c:1216
BOOL WINAPI PathFileExistsDefExtW(LPWSTR lpszPath, DWORD dwWhich)
Definition: path.c:1117
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
LPWSTR WINAPI PathCombineW(LPWSTR lpszDest, LPCWSTR lpszDir, LPCWSTR lpszFile)
Definition: path.c:194
static unsigned char buff[32768]
Definition: fatten.c:17

Referenced by PathFindOnPathW(), and PathSearchOnExtensionsW().

◆ PathFindOnPathW()

BOOL WINAPI PathFindOnPathW ( LPWSTR  lpszFile,
LPCWSTR lppszOtherDirs 
)

Definition at line 1402 of file path.c.

1403 {
1404  TRACE("(%s,%p)\n", debugstr_w(lpszFile), lppszOtherDirs);
1405  return PathFindOnPathExW(lpszFile,lppszOtherDirs, 0);
1406 }
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
BOOL WINAPI PathFindOnPathExW(LPWSTR lpszFile, LPCWSTR *lppszOtherDirs, DWORD dwWhich)
Definition: path.c:1350

Referenced by DoEntry(), and PathResolveW().

◆ PathFindSuffixArrayA()

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

Definition at line 3992 of file path.c.

3993 {
3994  size_t dwLen;
3995  int dwRet = 0;
3996 
3997  TRACE("(%s,%p,%d)\n",debugstr_a(lpszSuffix), lppszArray, dwCount);
3998 
3999  if (lpszSuffix && lppszArray && dwCount > 0)
4000  {
4001  dwLen = strlen(lpszSuffix);
4002 
4003  while (dwRet < dwCount)
4004  {
4005  size_t dwCompareLen = strlen(*lppszArray);
4006  if (dwCompareLen < dwLen)
4007  {
4008  if (!strcmp(lpszSuffix + dwLen - dwCompareLen, *lppszArray))
4009  return *lppszArray; /* Found */
4010  }
4011  dwRet++;
4012  lppszArray++;
4013  }
4014  }
4015  return NULL;
4016 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
#define NULL
Definition: types.h:112
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 4023 of file path.c.

4024 {
4025  size_t dwLen;
4026  int dwRet = 0;
4027 
4028  TRACE("(%s,%p,%d)\n",debugstr_w(lpszSuffix), lppszArray, dwCount);
4029 
4030  if (lpszSuffix && lppszArray && dwCount > 0)
4031  {
4032  dwLen = strlenW(lpszSuffix);
4033 
4034  while (dwRet < dwCount)
4035  {
4036  size_t dwCompareLen = strlenW(*lppszArray);
4037  if (dwCompareLen < dwLen)
4038  {
4039  if (!strcmpW(lpszSuffix + dwLen - dwCompareLen, *lppszArray))
4040  return *lppszArray; /* Found */
4041  }
4042  dwRet++;
4043  lppszArray++;
4044  }
4045  }
4046  return NULL;
4047 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
#define NULL
Definition: types.h:112
WINE_UNICODE_INLINE int strcmpW(const WCHAR *str1, const WCHAR *str2)
Definition: unicode.h:229

◆ 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 }
char * LPSTR
Definition: xmlstorage.h:182
LPSTR WINAPI CharNextA(_In_ LPCSTR)
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31

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 }
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by CShellLink::OnNotify(), PathRemoveArgsW(), and SHExplorerParseCmdLine().

◆ PathGetCharTypeA()

UINT WINAPI PathGetCharTypeA ( UCHAR  ch)

Definition at line 3025 of file path.c.

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

Referenced by PathCleanupSpec().

◆ PathGetCharTypeW()

UINT WINAPI PathGetCharTypeW ( WCHAR  ch)

Definition at line 3035 of file path.c.

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

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:2232
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
int tolower(int c)
Definition: utclib.c:902

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 }
WINE_UNICODE_INLINE int strncmpW(const WCHAR *str1, const WCHAR *str2, int n)
Definition: unicode.h:235
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
WINE_UNICODE_INLINE WCHAR tolowerW(WCHAR ch)
Definition: unicode.h:135
static char drive[2]
Definition: batch.c:28

Referenced by COMDLG32_GetCanonicalPath(), CDrivesFolder::ParseDisplayName(), CDesktopFolder::ParseDisplayName(), ATL::CPathT< StringType >::PathGetDriveNumberX(), PathIsAbsoluteW(), PathIsNetworkPathW(), and test_PathGetDriveNumber().

◆ PathIsContentTypeA()

BOOL WINAPI PathIsContentTypeA ( LPCSTR  lpszPath,
LPCSTR  lpszContentType 
)

Definition at line 2057 of file path.c.

2058 {
2059  LPCSTR szExt;
2060  DWORD dwDummy;
2061  char szBuff[MAX_PATH];
2062 
2063  TRACE("(%s,%s)\n", debugstr_a(lpszPath), debugstr_a(lpszContentType));
2064 
2065  if (lpszPath && (szExt = PathFindExtensionA(lpszPath)) && *szExt &&
2066  !SHGetValueA(HKEY_CLASSES_ROOT, szExt, "Content Type",
2067  REG_NONE, szBuff, &dwDummy) &&
2068  !strcasecmp(lpszContentType, szBuff))
2069  {
2070  return TRUE;
2071  }
2072  return FALSE;
2073 }
#define strcasecmp
Definition: fake.h:9
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
const char * LPCSTR
Definition: xmlstorage.h:183
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
LPSTR WINAPI PathFindExtensionA(LPCSTR lpszPath)
Definition: path.c:422
DWORD WINAPI SHGetValueA(HKEY hKey, LPCSTR lpszSubKey, LPCSTR lpszValue, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
Definition: reg.c:1207
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
#define REG_NONE
Definition: nt_native.h:1492

◆ PathIsContentTypeW()

BOOL WINAPI PathIsContentTypeW ( LPCWSTR  lpszPath,
LPCWSTR  lpszContentType 
)

Definition at line 2080 of file path.c.

2081 {
2082  static const WCHAR szContentType[] = { 'C','o','n','t','e','n','t',' ','T','y','p','e','\0' };
2083  LPCWSTR szExt;
2084  DWORD dwDummy;
2085  WCHAR szBuff[MAX_PATH];
2086 
2087  TRACE("(%s,%s)\n", debugstr_w(lpszPath), debugstr_w(lpszContentType));
2088 
2089  if (lpszPath && (szExt = PathFindExtensionW(lpszPath)) && *szExt &&
2090  !SHGetValueW(HKEY_CLASSES_ROOT, szExt, szContentType,
2091  REG_NONE, szBuff, &dwDummy) &&
2092  !strcmpiW(lpszContentType, szBuff))
2093  {
2094  return TRUE;
2095  }
2096  return FALSE;
2097 }
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define debugstr_w
Definition: kernel32.h:32
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
Definition: path.c:447
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
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
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
#define REG_NONE
Definition: nt_native.h:1492

◆ PathIsDirectoryA()

BOOL WINAPI PathIsDirectoryA ( LPCSTR  lpszPath)

Definition at line 1697 of file path.c.

1698 {
1699  DWORD dwAttr;
1700 
1701  TRACE("(%s)\n", debugstr_a(lpszPath));
1702 
1703  if (!lpszPath || PathIsUNCServerA(lpszPath))
1704  return FALSE;
1705 
1706  if (PathIsUNCServerShareA(lpszPath))
1707  {
1708  FIXME("UNC Server Share not yet supported - FAILING\n");
1709  return FALSE;
1710  }
1711 
1712  if ((dwAttr = GetFileAttributesA(lpszPath)) == INVALID_FILE_ATTRIBUTES)
1713  return FALSE;
1714  return dwAttr & FILE_ATTRIBUTE_DIRECTORY;
1715 }
BOOL WINAPI PathIsUNCServerShareA(LPCSTR lpszPath)
Definition: path.c:2350
#define FALSE
Definition: types.h:117
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
Definition: fileinfo.c:636
#define FIXME(fmt,...)
Definition: debug.h:111
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
BOOL WINAPI PathIsUNCServerA(LPCSTR lpszPath)
Definition: path.c:2300
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
unsigned long DWORD
Definition: ntddk_ex.h:95
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23

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

◆ PathIsDirectoryEmptyA()

BOOL WINAPI PathIsDirectoryEmptyA ( LPCSTR  lpszPath)

Definition at line 3910 of file path.c.

3911 {
3912  BOOL bRet = FALSE;
3913 
3914  TRACE("(%s)\n",debugstr_a(lpszPath));
3915 
3916  if (lpszPath)
3917  {
3919  MultiByteToWideChar(CP_ACP,0,lpszPath,-1,szPath,MAX_PATH);
3920  bRet = PathIsDirectoryEmptyW(szPath);
3921  }
3922  return bRet;
3923 }
#define CP_ACP
Definition: compat.h:109
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
#define MAX_PATH
Definition: compat.h:34
BOOL WINAPI PathIsDirectoryEmptyW(LPCWSTR lpszPath)
Definition: path.c:3930
LPCWSTR szPath
Definition: env.c:37
#define MultiByteToWideChar
Definition: compat.h:110

◆ PathIsDirectoryEmptyW()

BOOL WINAPI PathIsDirectoryEmptyW ( LPCWSTR  lpszPath)

Definition at line 3930 of file path.c.

3931 {
3932  static const WCHAR szAllFiles[] = { '*', '.', '*', '\0' };
3933  WCHAR szSearch[MAX_PATH];
3934  DWORD dwLen;
3935  HANDLE hfind;
3936  BOOL retVal = TRUE;
3938 
3939  TRACE("(%s)\n",debugstr_w(lpszPath));
3940 
3941  if (!lpszPath || !PathIsDirectoryW(lpszPath))
3942  return FALSE;
3943 
3944  lstrcpynW(szSearch, lpszPath, MAX_PATH);
3945  PathAddBackslashW(szSearch);
3946  dwLen = strlenW(szSearch);
3947  if (dwLen > MAX_PATH - 4)
3948  return FALSE;
3949 
3950  strcpyW(szSearch + dwLen, szAllFiles);
3951  hfind = FindFirstFileW(szSearch, &find_data);
3952  if (hfind == INVALID_HANDLE_VALUE)
3953  return FALSE;
3954 
3955  do
3956  {
3957  if (find_data.cFileName[0] == '.')
3958  {
3959  if (find_data.cFileName[1] == '\0') continue;
3960  if (find_data.cFileName[1] == '.' && find_data.cFileName[2] == '\0') continue;
3961  }
3962 
3963  retVal = FALSE;
3964  break;
3965  }
3966  while (FindNextFileW(hfind, &find_data));
3967 
3968  FindClose(hfind);
3969  return retVal;
3970 }
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:382
BOOL WINAPI PathIsDirectoryW(LPCWSTR lpszPath)
Definition: path.c:1722
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define TRUE
Definition: types.h:120
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
static int find_data(const struct Vector *v, const BYTE *pData, int size)
Definition: filtermapper.c:162
#define lstrcpynW
Definition: compat.h:597
#define FALSE
Definition: types.h:117
LPWSTR WINAPI PathAddBackslashW(LPWSTR lpszPath)
Definition: path.c:294
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502

Referenced by move_dir_to_dir(), and PathIsDirectoryEmptyA().

◆ PathIsDirectoryW()

BOOL WINAPI PathIsDirectoryW ( LPCWSTR  lpszPath)

Definition at line 1722 of file path.c.

1723 {
1724  DWORD dwAttr;
1725 
1726  TRACE("(%s)\n", debugstr_w(lpszPath));
1727 
1728  if (!lpszPath || PathIsUNCServerW(lpszPath))
1729  return FALSE;
1730 
1731  if (PathIsUNCServerShareW(lpszPath))
1732  {
1733  FIXME("UNC Server Share not yet supported - FAILING\n");
1734  return FALSE;
1735  }
1736 
1737  if ((dwAttr = GetFileAttributesW(lpszPath)) == INVALID_FILE_ATTRIBUTES)
1738  return FALSE;
1739  return dwAttr & FILE_ATTRIBUTE_DIRECTORY;
1740 }
#define FALSE
Definition: types.h:117
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652
BOOL WINAPI PathIsUNCServerShareW(LPCWSTR lpszPath)
Definition: path.c:2377
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
BOOL WINAPI PathIsUNCServerW(LPCWSTR lpszPath)
Definition: path.c:2322

Referenced by CDirectoryList::AddPathsFromDirectory(), BrsFolder_OnCommand(), copy_file(), create_target_directory(), CreateDirectoryWatcherFromRegEntry(), CAppScrnshotPreview::DisplayImage(), DoAddFilesFromItem(), DoInit(), DoTestEntry(), CFontExt::Drop(), FILEDLG95_InitControls(), CFSFolder::GetCustomViewInfo(), getIconLocationForDrive(), getIconLocationForFolder(), CFileDefExt::Initialize(), LoadPropSheetHandlers(), CACListISF::Next(), PathIsDirectoryEmptyW(), ATL::CPathT< StringType >::PathIsDirectoryX(), CDirectoryWatcher::ProcessNotification(), SHAddToRecentDocs(), SHELL_execute(), SHExplorerParseCmdLine(), ShowCreateShortcutWizard(), WindowProc(), and wWinMain().

◆ PathIsFileSpecA()

BOOL WINAPI PathIsFileSpecA ( LPCSTR  lpszPath)

Definition at line 2111 of file path.c.

2112 {
2113  TRACE("(%s)\n", debugstr_a(lpszPath));
2114 
2115  if (!lpszPath)
2116  return FALSE;
2117 
2118  while (*lpszPath)
2119  {
2120  if (*lpszPath == '\\' || *lpszPath == ':')
2121  return FALSE;
2122  lpszPath = CharNextA(lpszPath);
2123  }
2124  return TRUE;
2125 }
#define TRUE
Definition: types.h:120
LPSTR WINAPI CharNextA(_In_ LPCSTR)
#define FALSE
Definition: types.h:117
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31

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

◆ PathIsFileSpecW()

BOOL WINAPI PathIsFileSpecW ( LPCWSTR  lpszPath)

Definition at line 2132 of file path.c.

2133 {
2134  TRACE("(%s)\n", debugstr_w(lpszPath));
2135 
2136  if (!lpszPath)
2137  return FALSE;
2138 
2139  while (*lpszPath)
2140  {
2141  if (*lpszPath == '\\' || *lpszPath == ':')
2142  return FALSE;
2143  lpszPath++;
2144  }
2145  return TRUE;
2146 }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4

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

◆ PathIsLFNFileSpecA()

BOOL WINAPI PathIsLFNFileSpecA ( LPCSTR  lpszPath)

Definition at line 3821 of file path.c.

3822 {
3823  DWORD dwNameLen = 0, dwExtLen = 0;
3824 
3825  TRACE("(%s)\n",debugstr_a(lpszPath));
3826 
3827  if (!lpszPath)
3828  return FALSE;
3829 
3830  while (*lpszPath)
3831  {
3832  if (*lpszPath == ' ')
3833  return TRUE; /* DOS names cannot have spaces */
3834  if (*lpszPath == '.')
3835  {
3836  if (dwExtLen)
3837  return TRUE; /* DOS names have only one dot */
3838  dwExtLen = 1;
3839  }
3840  else if (dwExtLen)
3841  {
3842  dwExtLen++;
3843  if (dwExtLen > 4)
3844  return TRUE; /* DOS extensions are <= 3 chars*/
3845  }
3846  else
3847  {
3848  dwNameLen++;
3849  if (dwNameLen > 8)
3850  return TRUE; /* DOS names are <= 8 chars */
3851  }
3852  lpszPath += IsDBCSLeadByte(*lpszPath) ? 2 : 1;
3853  }
3854  return FALSE; /* Valid DOS path */
3855 }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
BOOL WINAPI IsDBCSLeadByte(BYTE TestByte)
Definition: nls.c:2232
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
unsigned long DWORD
Definition: ntddk_ex.h:95

◆ PathIsLFNFileSpecW()

BOOL WINAPI PathIsLFNFileSpecW ( LPCWSTR  lpszPath)

Definition at line 3862 of file path.c.

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

◆ PathIsNetworkPathA()

BOOL WINAPI PathIsNetworkPathA ( LPCSTR  lpszPath)

Definition at line 3762 of file path.c.

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

◆ PathIsNetworkPathW()

BOOL WINAPI PathIsNetworkPathW ( LPCWSTR  lpszPath)

Definition at line 3788 of file path.c.

3789 {
3790  int dwDriveNum;
3791 
3792  TRACE("(%s)\n", debugstr_w(lpszPath));
3793 
3794  if (!lpszPath)
3795  return FALSE;
3796  if (*lpszPath == '\\' && lpszPath[1] == '\\')
3797  return TRUE;
3798  dwDriveNum = PathGetDriveNumberW(lpszPath);
3799  if (dwDriveNum == -1)
3800  return FALSE;
3801 #ifdef __REACTOS__
3802  return IsNetDrive(dwDriveNum);
3803 #else
3804  GET_FUNC(pIsNetDrive, shell32, (LPCSTR)66, FALSE); /* ord 66 = shell32.IsNetDrive */
3805  return pIsNetDrive(dwDriveNum);
3806 #endif
3807 }
#define TRUE
Definition: types.h:120
EXTERN_C int WINAPI IsNetDrive(int drive)
Definition: shlfileop.cpp:2142
static HANDLE shell32
Definition: animate.c:36
#define FALSE
Definition: types.h:117
#define debugstr_w
Definition: kernel32.h:32
static fnpIsNetDrive pIsNetDrive
Definition: path.c:66
const char * LPCSTR
Definition: xmlstorage.h:183
#define GET_FUNC(func, module, name, fail)
Definition: path.c:52
#define TRACE(s)
Definition: solgame.cpp:4
int WINAPI PathGetDriveNumberW(const WCHAR *path)
Definition: path.c:553

◆ PathIsPrefixA()

BOOL WINAPI PathIsPrefixA ( LPCSTR  lpszPrefix,
LPCSTR  lpszPath 
)

Definition at line 2161 of file path.c.

2162 {
2163  TRACE("(%s,%s)\n", debugstr_a(lpszPrefix), debugstr_a(lpszPath));
2164 
2165  if (lpszPrefix && lpszPath &&
2166  PathCommonPrefixA(lpszPath, lpszPrefix, NULL) == (int)strlen(lpszPrefix))
2167  return TRUE;
2168  return FALSE;
2169 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define TRUE
Definition: types.h:120
int WINAPI PathCommonPrefixA(LPCSTR lpszFile1, LPCSTR lpszFile2, LPSTR achPath)
Definition: path.c:2750
#define FALSE
Definition: types.h:117
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
#define NULL
Definition: types.h:112

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

◆ PathIsPrefixW()

BOOL WINAPI PathIsPrefixW ( LPCWSTR  lpszPrefix,
LPCWSTR  lpszPath 
)

Definition at line 2176 of file path.c.

2177 {
2178  TRACE("(%s,%s)\n", debugstr_w(lpszPrefix), debugstr_w(lpszPath));
2179 
2180  if (lpszPrefix && lpszPath &&
2181  PathCommonPrefixW(lpszPath, lpszPrefix, NULL) == (int)strlenW(lpszPrefix))
2182  return TRUE;
2183  return FALSE;
2184 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
int WINAPI PathCommonPrefixW(LPCWSTR lpszFile1, LPCWSTR lpszFile2, LPWSTR achPath)
Definition: path.c:2805
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
#define NULL
Definition: types.h:112

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

◆ PathIsRelativeA()

BOOL WINAPI PathIsRelativeA ( LPCSTR  lpszPath)

Definition at line 1562 of file path.c.

1563 {
1564  TRACE("(%s)\n",debugstr_a(lpszPath));
1565 
1566  if (!lpszPath || !*lpszPath || IsDBCSLeadByte(*lpszPath))
1567  return TRUE;
1568  if (*lpszPath == '\\' || (*lpszPath && lpszPath[1] == ':'))
1569  return FALSE;
1570  return TRUE;
1571 }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
BOOL WINAPI IsDBCSLeadByte(BYTE TestByte)
Definition: nls.c:2232
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31

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

◆ PathIsRelativeW()

◆ PathIsRootA()

BOOL WINAPI PathIsRootA ( LPCSTR  lpszPath)

Definition at line 1601 of file path.c.

1602 {
1603  TRACE("(%s)\n", debugstr_a(lpszPath));
1604 
1605  if (lpszPath && *lpszPath)
1606  {
1607  if (*lpszPath == '\\')
1608  {
1609  if (!lpszPath[1])
1610  return TRUE; /* \ */
1611  else if (lpszPath[1]=='\\')
1612  {
1613  BOOL bSeenSlash = FALSE;
1614  lpszPath += 2;
1615 
1616  /* Check for UNC root path */
1617  while (*lpszPath)
1618  {
1619  if (*lpszPath == '\\')
1620  {
1621  if (bSeenSlash)
1622  return FALSE;
1623  bSeenSlash = TRUE;
1624  }
1625  lpszPath = CharNextA(lpszPath);
1626  }
1627  return TRUE;
1628  }
1629  }
1630  else if (lpszPath[1] == ':' && lpszPath[2] == '\\' && lpszPath[3] == '\0')
1631  return TRUE; /* X:\ */
1632  }
1633  return FALSE;
1634 }
#define TRUE
Definition: types.h:120
LPSTR WINAPI CharNextA(_In_ LPCSTR)
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31

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

◆ PathIsRootW()

BOOL WINAPI PathIsRootW ( LPCWSTR  lpszPath)

Definition at line 1641 of file path.c.

1642 {
1643  TRACE("(%s)\n", debugstr_w(lpszPath));
1644 
1645  if (lpszPath && *lpszPath)
1646  {
1647  if (*lpszPath == '\\')
1648  {
1649  if (!lpszPath[1])
1650  return TRUE; /* \ */
1651  else if (lpszPath[1]=='\\')
1652  {
1653  BOOL bSeenSlash = FALSE;
1654  lpszPath += 2;
1655 
1656  /* Check for UNC root path */
1657  while (*lpszPath)
1658  {
1659  if (*lpszPath == '\\')
1660  {
1661  if (bSeenSlash)
1662  return FALSE;
1663  bSeenSlash = TRUE;
1664  }
1665  lpszPath++;
1666  }
1667  return TRUE;
1668  }
1669  }
1670  else if (lpszPath[1] == ':' && lpszPath[2] == '\\' && lpszPath[3] == '\0')
1671  return TRUE; /* X:\ */
1672  }
1673  return FALSE;
1674 }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4

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

◆ PathIsSameRootA()

BOOL WINAPI PathIsSameRootA ( LPCSTR  lpszPath1,
LPCSTR  lpszPath2 
)

Definition at line 2002 of file path.c.

2003 {
2004  LPCSTR lpszStart;
2005  int dwLen;
2006 
2007  TRACE("(%s,%s)\n", debugstr_a(lpszPath1), debugstr_a(lpszPath2));
2008 
2009  if (!lpszPath1 || !lpszPath2 || !(lpszStart = PathSkipRootA(lpszPath1)))
2010  return FALSE;
2011 
2012  dwLen = PathCommonPrefixA(lpszPath1, lpszPath2, NULL) + 1;
2013  if (lpszStart - lpszPath1 > dwLen)
2014  return FALSE; /* Paths not common up to length of the root */
2015  return TRUE;
2016 }
#define TRUE
Definition: types.h:120
int WINAPI PathCommonPrefixA(LPCSTR lpszFile1, LPCSTR lpszFile2, LPSTR achPath)
Definition: path.c:2750
#define FALSE
Definition: types.h:117
const char * LPCSTR
Definition: xmlstorage.h:183
LPSTR WINAPI PathSkipRootA(LPCSTR lpszPath)
Definition: path.c:3246
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
#define NULL
Definition: types.h:112

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

◆ PathIsSameRootW()

BOOL WINAPI PathIsSameRootW ( LPCWSTR  lpszPath1,
LPCWSTR  lpszPath2 
)

Definition at line 2023 of file path.c.

2024 {
2025  LPCWSTR lpszStart;
2026  int dwLen;
2027 
2028  TRACE("(%s,%s)\n", debugstr_w(lpszPath1), debugstr_w(lpszPath2));
2029 
2030  if (!lpszPath1 || !lpszPath2 || !(lpszStart = PathSkipRootW(lpszPath1)))
2031  return FALSE;
2032 
2033  dwLen = PathCommonPrefixW(lpszPath1, lpszPath2, NULL) + 1;
2034  if (lpszStart - lpszPath1 > dwLen)
2035  return FALSE; /* Paths not common up to length of the root */
2036  return TRUE;
2037 }
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
int WINAPI PathCommonPrefixW(LPCWSTR lpszFile1, LPCWSTR lpszFile2, LPWSTR achPath)
Definition: path.c:2805
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
LPWSTR WINAPI PathSkipRootW(LPCWSTR lpszPath)
Definition: path.c:3277
#define NULL
Definition: types.h:112

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

◆ PathIsSystemFolderA()

BOOL WINAPI PathIsSystemFolderA ( LPCSTR  lpszPath,
DWORD  dwAttrib 
)

Definition at line 2199 of file path.c.

2200 {
2201  TRACE("(%s,0x%08x)\n", debugstr_a(lpszPath), dwAttrib);
2202 
2203  if (lpszPath && *lpszPath)
2204  dwAttrib = GetFileAttributesA(lpszPath);
2205 
2206  if (dwAttrib == INVALID_FILE_ATTRIBUTES || !(dwAttrib & FILE_ATTRIBUTE_DIRECTORY) ||
2208  return FALSE;
2209  return TRUE;
2210 }
#define TRUE
Definition: types.h:120
#define FILE_ATTRIBUTE_SYSTEM
Definition: nt_native.h:704
#define FALSE
Definition: types.h:117
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
Definition: fileinfo.c:636
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23

◆ PathIsSystemFolderW()

BOOL WINAPI PathIsSystemFolderW ( LPCWSTR  lpszPath,
DWORD  dwAttrib 
)

Definition at line 2217 of file path.c.

2218 {
2219  TRACE("(%s,0x%08x)\n", debugstr_w(lpszPath), dwAttrib);
2220 
2221  if (lpszPath && *lpszPath)
2222  dwAttrib = GetFileAttributesW(lpszPath);
2223 
2224  if (dwAttrib == INVALID_FILE_ATTRIBUTES || !(dwAttrib & FILE_ATTRIBUTE_DIRECTORY) ||
2226  return FALSE;
2227  return TRUE;
2228 }
#define TRUE
Definition: types.h:120
#define FILE_ATTRIBUTE_SYSTEM
Definition: nt_native.h:704
#define FALSE
Definition: types.h:117
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652
#define debugstr_w
Definition: kernel32.h:32
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define TRACE(s)
Definition: solgame.cpp:4
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23

◆ PathIsUNCA()

BOOL WINAPI PathIsUNCA ( LPCSTR  lpszPath)

Definition at line 2242 of file path.c.

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

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

◆ PathIsUNCServerA()

BOOL WINAPI PathIsUNCServerA ( LPCSTR  lpszPath)

Definition at line 2300 of file path.c.

2301 {
2302  TRACE("(%s)\n", debugstr_a(lpszPath));
2303 
2304  if (lpszPath && *lpszPath++ == '\\' && *lpszPath++ == '\\')
2305  {
2306  while (*lpszPath)
2307  {
2308  if (*lpszPath == '\\')
2309  return FALSE;
2310  lpszPath = CharNextA(lpszPath);
2311  }
2312  return TRUE;
2313  }
2314  return FALSE;
2315 }
#define TRUE
Definition: types.h:120
LPSTR WINAPI CharNextA(_In_ LPCSTR)
#define FALSE
Definition: types.h:117
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31

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

◆ PathIsUNCServerShareA()

BOOL WINAPI PathIsUNCServerShareA ( LPCSTR  lpszPath)

Definition at line 2350 of file path.c.

2351 {
2352  TRACE("(%s)\n", debugstr_a(lpszPath));
2353 
2354  if (lpszPath && *lpszPath++ == '\\' && *lpszPath++ == '\\')
2355  {
2356  BOOL bSeenSlash = FALSE;
2357  while (*lpszPath)
2358  {
2359  if (*lpszPath == '\\')
2360  {
2361  if (bSeenSlash)
2362  return FALSE;
2363  bSeenSlash = TRUE;
2364  }
2365  lpszPath = CharNextA(lpszPath);
2366  }
2367  return bSeenSlash;
2368  }
2369  return FALSE;
2370 }
#define TRUE
Definition: types.h:120
LPSTR WINAPI CharNextA(_In_ LPCSTR)
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31

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

◆ PathIsUNCServerShareW()

BOOL WINAPI PathIsUNCServerShareW ( LPCWSTR  lpszPath)

Definition at line 2377 of file path.c.

2378 {
2379  TRACE("(%s)\n", debugstr_w(lpszPath));
2380 
2381  if (lpszPath && *lpszPath++ == '\\' && *lpszPath++ == '\\')
2382  {
2383  BOOL bSeenSlash = FALSE;
2384  while (*lpszPath)
2385  {
2386  if (*lpszPath == '\\')
2387  {
2388  if (bSeenSlash)
2389  return FALSE;
2390  bSeenSlash = TRUE;
2391  }
2392  lpszPath++;
2393  }
2394  return bSeenSlash;
2395  }
2396  return FALSE;
2397 }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4

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

◆ PathIsUNCServerW()

BOOL WINAPI PathIsUNCServerW ( LPCWSTR  lpszPath)

Definition at line 2322 of file path.c.

2323 {
2324  TRACE("(%s)\n", debugstr_w(lpszPath));
2325 
2326  if (lpszPath && lpszPath[0] == '\\' && lpszPath[1] == '\\')
2327  {
2328  return !strchrW( lpszPath + 2, '\\' );
2329  }
2330  return FALSE;
2331 }
WINE_UNICODE_INLINE WCHAR * strchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:248
#define FALSE
Definition: types.h:117
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4

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

◆ PathIsUNCW()

BOOL WINAPI PathIsUNCW ( LPCWSTR  lpszPath)

Definition at line 2265 of file path.c.

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

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

◆ PathIsValidCharA()

BOOL WINAPI PathIsValidCharA ( char  c,
DWORD  class 
)

Definition at line 4403 of file path.c.

4404 {
4405  if ((unsigned)c > 0x7e)
4406  return class & PATH_CHAR_CLASS_OTHER_VALID;
4407 
4408  return class & SHELL_charclass[(unsigned)c];
4409 }
#define PATH_CHAR_CLASS_OTHER_VALID
Definition: path.c:4324
const GLubyte * c
Definition: glext.h:8905
static const DWORD SHELL_charclass[]
Definition: path.c:4330
static unsigned(__cdecl *hash_bstr)(bstr_t s)

◆ PathIsValidCharW()

BOOL WINAPI PathIsValidCharW ( WCHAR  c,
DWORD  class 
)

Definition at line 4416 of file path.c.

4417 {
4418  if (c > 0x7e)
4419  return class & PATH_CHAR_CLASS_OTHER_VALID;
4420 
4421  return class & SHELL_charclass[c];
4422 }
#define PATH_CHAR_CLASS_OTHER_VALID
Definition: path.c:4324
const GLubyte * c
Definition: glext.h:8905
static const DWORD SHELL_charclass[]
Definition: path.c:4330
#define c
Definition: ke_i.h:80

◆ PathMakePrettyA()

BOOL WINAPI PathMakePrettyA ( LPSTR  lpszPath)

Definition at line 2667 of file path.c.

2668 {
2669  LPSTR pszIter = lpszPath;
2670 
2671  TRACE("(%s)\n", debugstr_a(lpszPath));
2672 
2673  if (!pszIter)
2674  return FALSE;
2675 
2676  if (*pszIter)
2677  {
2678  do
2679  {
2680  if (islower(*pszIter) || IsDBCSLeadByte(*pszIter))
2681  return FALSE; /* Not DOS path */
2682  pszIter++;
2683  } while (*pszIter);
2684  pszIter = lpszPath + 1;
2685  while (*pszIter)
2686  {
2687  *pszIter = tolower(*pszIter);
2688  pszIter++;
2689  }
2690  }
2691  return TRUE;
2692 }
#define TRUE
Definition: types.h:120
char * LPSTR
Definition: xmlstorage.h:182
#define FALSE
Definition: types.h:117
BOOL WINAPI IsDBCSLeadByte(BYTE TestByte)
Definition: nls.c:2232
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
#define islower(c)
Definition: acclib.h:72
int tolower(int c)
Definition: utclib.c:902

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

◆ PathMakePrettyW()

BOOL WINAPI PathMakePrettyW ( LPWSTR  lpszPath)

Definition at line 2699 of file path.c.

2700 {
2701  LPWSTR pszIter = lpszPath;
2702 
2703  TRACE("(%s)\n", debugstr_w(lpszPath));
2704 
2705  if (!pszIter)
2706  return FALSE;
2707 
2708  if (*pszIter)
2709  {
2710  do
2711  {
2712  if (islowerW(*pszIter))
2713  return FALSE; /* Not DOS path */
2714  pszIter++;
2715  } while (*pszIter);
2716  pszIter = lpszPath + 1;
2717  while (*pszIter)
2718  {
2719  *pszIter = tolowerW(*pszIter);
2720  pszIter++;
2721  }
2722  }
2723  return TRUE;
2724 }
WINE_UNICODE_INLINE int islowerW(WCHAR wc)
Definition: unicode.h:180
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
WINE_UNICODE_INLINE WCHAR tolowerW(WCHAR ch)
Definition: unicode.h:135
WCHAR * LPWSTR
Definition: xmlstorage.h:184

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

◆ PathMakeSystemFolderA()

BOOL WINAPI PathMakeSystemFolderA ( LPCSTR  lpszPath)

Definition at line 3099 of file path.c.

3100 {
3101  BOOL bRet = FALSE;
3102 
3103  TRACE("(%s)\n", debugstr_a(lpszPath));
3104 
3105  if (lpszPath && *lpszPath)
3106  {
3108  MultiByteToWideChar(CP_ACP,0,lpszPath,-1,szPath,MAX_PATH);
3109  bRet = PathMakeSystemFolderW(szPath);
3110  }
3111  return bRet;
3112 }
#define CP_ACP
Definition: compat.h:109
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
BOOL WINAPI PathMakeSystemFolderW(LPCWSTR lpszPath)
Definition: path.c:3119
#define MAX_PATH
Definition: compat.h:34
LPCWSTR szPath
Definition: env.c:37
#define MultiByteToWideChar
Definition: compat.h:110

◆ PathMakeSystemFolderW()

BOOL WINAPI PathMakeSystemFolderW ( LPCWSTR  lpszPath)

Definition at line 3119 of file path.c.

3120 {
3121  DWORD dwDefaultAttr = FILE_ATTRIBUTE_READONLY, dwAttr;
3122  WCHAR buff[MAX_PATH];
3123 
3124  TRACE("(%s)\n", debugstr_w(lpszPath));
3125 
3126  if (!lpszPath || !*lpszPath)
3127  return FALSE;
3128 
3129  /* If the directory is already a system directory, don't do anything */
3131  if (!strcmpW(buff, lpszPath))
3132  return TRUE;
3133 
3135  if (!strcmpW(buff, lpszPath))
3136  return TRUE;
3137 
3138  /* "UseSystemForSystemFolders" Tells Win what attributes to use */
3140  dwDefaultAttr = FILE_ATTRIBUTE_SYSTEM;
3141 
3142  if ((dwAttr = GetFileAttributesW(lpszPath)) == INVALID_FILE_ATTRIBUTES)
3143  return FALSE;
3144 
3145  /* Change file attributes to system attributes */
3147  return SetFileAttributesW(lpszPath, dwAttr | dwDefaultAttr);
3148 }
BOOL WINAPI SetFileAttributesW(LPCWSTR lpFileName, DWORD dwFileAttributes)
Definition: fileinfo.c:794
#define TRUE
Definition: types.h:120
#define FILE_ATTRIBUTE_SYSTEM
Definition: nt_native.h:704
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2351
static BOOL SHLWAPI_UseSystemForSystemFolders(void)
Definition: path.c:3069
#define FALSE
Definition: types.h:117
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
unsigned long DWORD
Definition: ntddk_ex.h:95
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2312
#define FILE_ATTRIBUTE_HIDDEN
Definition: nt_native.h:703
WINE_UNICODE_INLINE int strcmpW(const WCHAR *str1, const WCHAR *str2)
Definition: unicode.h:229
static unsigned char buff[32768]
Definition: fatten.c:17

Referenced by PathMakeSystemFolderA().

◆ PathMatchSingleMaskA()

static BOOL PathMatchSingleMaskA ( LPCSTR  name,
LPCSTR  mask 
)
static

Definition at line 1852 of file path.c.

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

Referenced by PathMatchSpecA().

◆ PathMatchSingleMaskW()

static BOOL PathMatchSingleMaskW ( LPCWSTR  name,
LPCWSTR  mask 
)
static

Definition at line 1886 of file path.c.

1887 {
1888  while (*name && *mask && *mask != ';')
1889  {
1890  if (*mask == '*')
1891  {
1892  do
1893  {
1895  return TRUE; /* try substrings */
1896  } while (*name++);
1897  return FALSE;
1898  }
1899 
1900  if (toupperW(*mask) != toupperW(*name) && *mask != '?')
1901  return FALSE;
1902 
1903  name++;
1904  mask++;
1905  }
1906  if (!*name)
1907  {
1908  while (*mask == '*')
1909  mask++;
1910  if (!*mask || *mask == ';')
1911  return TRUE;
1912  }
1913  return FALSE;
1914 }
#define TRUE
Definition: types.h:120
static BOOL PathMatchSingleMaskW(LPCWSTR name, LPCWSTR mask)
Definition: path.c:1886
GLenum GLint GLuint mask
Definition: glext.h:6028
#define FALSE
Definition: types.h:117
WINE_UNICODE_INLINE WCHAR toupperW(WCHAR ch)
Definition: unicode.h:141
Definition: name.c:38

Referenced by PathMatchSpecW().

◆ PathMatchSpecA()

BOOL WINAPI PathMatchSpecA ( LPCSTR  lpszPath,
LPCSTR  lpszMask 
)

Definition at line 1934 of file path.c.

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

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

◆ PathMatchSpecW()

BOOL WINAPI PathMatchSpecW ( LPCWSTR  lpszPath,
LPCWSTR  lpszMask 
)

Definition at line 1963 of file path.c.

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

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 }
VOID WINAPI PathRemoveBlanksA(LPSTR lpszPath)
Definition: path.c:894
char * LPSTR
Definition: xmlstorage.h:182
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
VOID WINAPI PathUnquoteSpacesA(LPSTR lpszPath)
Definition: path.c:1012
char * strchr(const char *String, int ch)
Definition: utclib.c:501
INT WINAPI StrToIntA(LPCSTR lpszStr)
Definition: string.c:374

◆ 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 }
VOID WINAPI PathRemoveBlanksW(LPWSTR lpszPath)
Definition: path.c:920
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
VOID WINAPI PathUnquoteSpacesW(LPWSTR lpszPath)
Definition: path.c:1034
LPWSTR WINAPI StrChrW(LPCWSTR lpszStr, WCHAR ch)
Definition: string.c:468
INT WINAPI StrToIntW(LPCWSTR lpString)
Definition: string.c:411
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by CAppsListView::AddInstalledApplication(), 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
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
LPSTR WINAPI StrChrA(LPCSTR lpszStr, WORD ch)
Definition: string.c:270
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
#define MAX_PATH
Definition: compat.h:34

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 }
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
LPWSTR WINAPI StrChrW(LPCWSTR lpszStr, WCHAR ch)
Definition: string.c:468

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 3545 of file path.c.

3547 {
3548  BOOL bRet = FALSE;
3549 
3550  TRACE("(%p,%s,0x%08x,%s,0x%08x)\n", lpszPath, debugstr_a(lpszFrom),
3551  dwAttrFrom, debugstr_a(lpszTo), dwAttrTo);
3552 
3553  if(lpszPath && lpszFrom && lpszTo)
3554  {
3556  WCHAR szFrom[MAX_PATH];
3557  WCHAR szTo[MAX_PATH];
3558  MultiByteToWideChar(CP_ACP,0,lpszFrom,-1,szFrom,MAX_PATH);
3559  MultiByteToWideChar(CP_ACP,0,lpszTo,-1,szTo,MAX_PATH);
3560  bRet = PathRelativePathToW(szPath,szFrom,dwAttrFrom,szTo,dwAttrTo);
3561  WideCharToMultiByte(CP_ACP,0,szPath,-1,lpszPath,MAX_PATH,0,0);
3562  }
3563  return bRet;
3564 }
#define WideCharToMultiByte
Definition: compat.h:111
#define CP_ACP
Definition: compat.h:109
BOOL WINAPI PathRelativePathToW(LPWSTR lpszPath, LPCWSTR lpszFrom, DWORD dwAttrFrom, LPCWSTR lpszTo, DWORD dwAttrTo)
Definition: path.c:3571
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
#define MAX_PATH
Definition: compat.h:34
LPCWSTR szPath
Definition: env.c:37
#define MultiByteToWideChar
Definition: compat.h:110

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

◆ PathRelativePathToW()

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

Definition at line 3571 of file path.c.

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