From 51c74d82a917c6ceac5532e9f7f1b314315a9625 Mon Sep 17 00:00:00 2001 From: Juergen Schmied Date: Fri, 28 Apr 2000 20:23:46 +0000 Subject: [PATCH] Complete cleanup, bugfixes. New: PathStripPath, PathMakeUniqueName, PathStripToRoot, PathGetShortPath, PathParseIconLocation, PathRemoveExtension, PathRemoveArgs, PathAppend, PathBuildRoot, PathCanonicalize, PathFindNextComponent, PathRemoveFileSpec. --- dlls/shell32/brsfolder.c | 2 +- dlls/shell32/shellguid.c | 1 + dlls/shell32/shellpath.c | 2582 ++++++++++++++++++++----------- dlls/shell32/shlfileop.c | 42 +- dlls/shell32/shlfolder.c | 178 ++- dlls/shell32/shlmenu.c | 4 +- dlls/shell32/shlwapi.spec | 74 +- dlls/shell32/shres.rc | 2 + dlls/shell32/shresdef.h | 3 +- dlls/shell32/shv_bg_cmenu.c | 1 + include/shell.h | 84 +- include/shlobj.h | 27 - include/shlwapi.h | 36 + include/wine/obj_shellbrowser.h | 8 - include/wine/undocshell.h | 920 ++++++++++- 15 files changed, 2843 insertions(+), 1121 deletions(-) create mode 100644 include/shlwapi.h diff --git a/dlls/shell32/brsfolder.c b/dlls/shell32/brsfolder.c index 00f26f5569e..1eb7bcc39aa 100644 --- a/dlls/shell32/brsfolder.c +++ b/dlls/shell32/brsfolder.c @@ -278,6 +278,6 @@ LPITEMIDLIST WINAPI SHBrowseForFolderA (LPBROWSEINFOA lpbi) TRACE("(%lx,%s) empty stub!\n", (DWORD)lpbi, lpbi->lpszTitle); return (LPITEMIDLIST) DialogBoxParamA( shell32_hInstance, - "SHBRSFORFOLDER_MSGBOX", 0, + "SHBRSFORFOLDER_MSGBOX", lpbi->hwndOwner, BrsFolderDlgProc, (INT)lpbi ); } diff --git a/dlls/shell32/shellguid.c b/dlls/shell32/shellguid.c index 3fef58d21fe..49b545dd8bf 100644 --- a/dlls/shell32/shellguid.c +++ b/dlls/shell32/shellguid.c @@ -8,6 +8,7 @@ */ #define INITGUID +#include "shlwapi.h" /* #include "shlguid.h" */ /* diff --git a/dlls/shell32/shellpath.c b/dlls/shell32/shellpath.c index ab96739faa0..90375e1e545 100644 --- a/dlls/shell32/shellpath.c +++ b/dlls/shell32/shellpath.c @@ -11,192 +11,813 @@ #include "winversion.h" #include "winreg.h" #include "crtdll.h" -#include "tchar.h" #include "shlobj.h" #include "shell32_main.h" #include "windef.h" #include "options.h" +#include "wine/undocshell.h" +#include "shlwapi.h" DEFAULT_DEBUG_CHANNEL(shell) -/* Supported protocols for PathIsURL */ -LPSTR SupportedProtocol[] = {"http","https","ftp","gopher","file","mailto",""}; +/* + Combining and Constructing paths +*/ /************************************************************************* - * PathIsRootA + * PathAppendA [SHLWAPI.@] + * + * NOTES + * concat path lpszPath2 onto lpszPath1 + * + * FIXME + * the resulting path is also canonicalized */ -BOOL WINAPI PathIsRootA(LPCSTR x) -{ TRACE("%s\n",x); - if (*(x+1)==':' && *(x+2)=='\\') /* "X:\" */ - return 1; - if (*x=='\\') /* "\" */ - return 0; - if (x[0]=='\\' && x[1]=='\\') /* UNC "\\\" */ - { int foundbackslash = 0; - x=x+2; - while (*x) - { if (*x++=='\\') - foundbackslash++; - } - if (foundbackslash<=1) /* max 1 \ more ... */ - return 1; +LPSTR WINAPI PathAppendA( + LPSTR lpszPath1, + LPCSTR lpszPath2) +{ + TRACE("%s %s\n",lpszPath1, lpszPath2); + while (lpszPath2[0]=='\\') lpszPath2++; + return PathCombineA(lpszPath1,lpszPath1,lpszPath2); +} + +/************************************************************************* + * PathAppendW [SHLWAPI.@] + */ +LPSTR WINAPI PathAppendW( + LPWSTR lpszPath1, + LPCWSTR lpszPath2) +{ + FIXME("%s %s\n",debugstr_w(lpszPath1), debugstr_w(lpszPath2)); + return NULL; +} + +/************************************************************************* + * PathAppendAW [SHELL32.36] + */ +LPVOID WINAPI PathAppendAW( + LPVOID lpszPath1, + LPCVOID lpszPath2) +{ + if (VERSION_OsIsUnicode()) + return PathAppendW(lpszPath1, lpszPath2); + return PathAppendA(lpszPath1, lpszPath2); +} + +/************************************************************************* + * PathCombineA [SHLWAPI.@] + * + * NOTES + * if lpszFile='.' skip it + * szDest can be equal to lpszFile. Thats why we use sTemp + * + * FIXME + * the resulting path is also canonicalized + * If lpszSrcPath2 starts with a backslash it is appended + * to the root of lpszSrcPath1. + */ +LPSTR WINAPI PathCombineA( + LPSTR szDest, + LPCSTR lpszDir, + LPCSTR lpszFile) +{ + char sTemp[MAX_PATH]; + TRACE("%p %p->%s %p->%s\n",szDest, lpszDir, lpszDir, lpszFile, lpszFile); + + + if (!lpszFile || !lpszFile[0] || (lpszFile[0]=='.' && !lpszFile[1]) ) + { + strcpy(szDest,lpszDir); + return szDest; } - return 0; -} -/************************************************************************* - * PathIsRootW - */ -BOOL WINAPI PathIsRootW(LPCWSTR x) -{ TRACE("%s\n",debugstr_w(x)); - if (*(x+1)==':' && *(x+2)=='\\') /* "X:\" */ - return 1; - if (*x == (WCHAR) '\\') /* "\" */ - return 0; - if (x[0]==(WCHAR)'\\' && x[1]==(WCHAR)'\\') /* UNC "\\\" */ - { int foundbackslash = 0; - x=x+2; - while (*x) - { if (*x++==(WCHAR)'\\') - foundbackslash++; - } - if (foundbackslash<=1) /* max 1 \ more ... */ - return 1; + /* if lpszFile is a complete path don't care about lpszDir */ + if (PathIsRootA(lpszFile)) + { + strcpy(szDest,lpszFile); } - return 0; + else + { + strcpy(sTemp,lpszDir); + PathAddBackslashA(sTemp); + strcat(sTemp,lpszFile); + strcpy(szDest,sTemp); + } + return szDest; } /************************************************************************* - * PathIsRoot [SHELL32.29] + * PathCombineW [SHLWAPI.@] */ -BOOL WINAPI PathIsRootAW(LPCVOID x) -{ if (VERSION_OsIsUnicode()) - return PathIsRootW(x); - return PathIsRootA(x); +LPWSTR WINAPI PathCombineW( + LPWSTR szDest, + LPCWSTR lpszDir, + LPCWSTR lpszFile) +{ + WCHAR sTemp[MAX_PATH]; + TRACE("%p %p->%s %p->%s\n",szDest, lpszDir, debugstr_w(lpszDir), + lpszFile, debugstr_w(lpszFile)); + + + if (!lpszFile || !lpszFile[0] || (lpszFile[0]==(WCHAR)'.' && !lpszFile[1]) ) + { + CRTDLL_wcscpy(szDest,lpszDir); + return szDest; + } + /* if lpszFile is a complete path don't care about lpszDir */ + if (PathIsRootW(lpszFile)) + { + CRTDLL_wcscpy(szDest,lpszFile); + } + else + { + CRTDLL_wcscpy(sTemp,lpszDir); + PathAddBackslashW(sTemp); + CRTDLL_wcscat(sTemp,lpszFile); + CRTDLL_wcscpy(szDest,sTemp); + } + return szDest; } /************************************************************************* - * PathBuildRootA [SHELL32.30] + * PathCombineAW [SHELL32.37] */ -LPSTR WINAPI PathBuildRootA(LPSTR root,BYTE drive) { - TRACE("%p %i\n",root, drive); - strcpy(root,"A:\\"); - root[0]+=drive; - return root; +LPVOID WINAPI PathCombineAW( + LPVOID szDest, + LPCVOID lpszDir, + LPCVOID lpszFile) +{ + if (VERSION_OsIsUnicode()) + return PathCombineW( szDest, lpszDir, lpszFile ); + return PathCombineA( szDest, lpszDir, lpszFile ); } /************************************************************************* - * PathFindExtensionA + * PathAddBackslashA [SHLWAPI.@] * * NOTES - * returns pointer to last . in last pathcomponent or at \0. + * append \ if there is none */ -LPCSTR WINAPI PathFindExtensionA(LPCSTR path) -{ LPCSTR lastpoint = NULL; - TRACE("%p %s\n",path,path); - while (*path) - { if (*path=='\\'||*path==' ') +LPSTR WINAPI PathAddBackslashA(LPSTR lpszPath) +{ + int len; + TRACE("%p->%s\n",lpszPath,lpszPath); + + len = strlen(lpszPath); + if (len && lpszPath[len-1]!='\\') + { + lpszPath[len] = '\\'; + lpszPath[len+1]= 0x00; + return lpszPath+len+1; + } + return lpszPath+len; +} + +/************************************************************************* + * PathAddBackslashW [SHLWAPI.@] + */ +LPWSTR WINAPI PathAddBackslashW(LPWSTR lpszPath) +{ + int len; + TRACE("%p->%s\n",lpszPath,debugstr_w(lpszPath)); + + len = CRTDLL_wcslen(lpszPath); + if (len && lpszPath[len-1]!=(WCHAR)'\\') + { + lpszPath[len] = (WCHAR)'\\'; + lpszPath[len+1]= 0x00; + return lpszPath+len+1; + } + return lpszPath+len; +} + +/************************************************************************* + * PathAddBackslashAW [SHELL32.32] + */ +LPVOID WINAPI PathAddBackslashAW(LPVOID lpszPath) +{ + if(VERSION_OsIsUnicode()) + return PathAddBackslashW(lpszPath); + return PathAddBackslashA(lpszPath); +} + +/************************************************************************* + * PathBuildRootA [SHLWAPI.@] + */ +LPSTR WINAPI PathBuildRootA(LPSTR lpszPath, int drive) +{ + TRACE("%p %i\n",lpszPath, drive); + + strcpy(lpszPath,"A:\\"); + lpszPath[0]+=drive; + return lpszPath; +} + +/************************************************************************* + * PathBuildRootW [SHLWAPI.@] + */ +LPWSTR WINAPI PathBuildRootW(LPWSTR lpszPath, int drive) +{ + TRACE("%p %i\n",debugstr_w(lpszPath), drive); + + lstrcpyAtoW(lpszPath,"A:\\"); + lpszPath[0]+=drive; + return lpszPath; +} + +/************************************************************************* + * PathBuildRootAW [SHELL32.30] + */ +LPVOID WINAPI PathBuildRootAW(LPVOID lpszPath, int drive) +{ + if(VERSION_OsIsUnicode()) + return PathBuildRootW(lpszPath, drive); + return PathBuildRootA(lpszPath, drive); +} + +/* + Extracting Component Parts +*/ + +/************************************************************************* + * PathFindFileNameA [SHLWAPI.@] + */ +LPSTR WINAPI PathFindFileNameA(LPCSTR lpszPath) +{ + LPCSTR aslash; + aslash = lpszPath; + + TRACE("%s\n",aslash); + while (lpszPath[0]) + { + if (((lpszPath[0]=='\\') || (lpszPath[0]==':')) && lpszPath[1] && lpszPath[1]!='\\') + aslash = lpszPath+1; + lpszPath++; + } + return (LPSTR)aslash; + +} + +/************************************************************************* + * PathFindFileNameW [SHLWAPI.@] + */ +LPWSTR WINAPI PathFindFileNameW(LPCWSTR lpszPath) +{ + LPCWSTR wslash; + wslash = lpszPath; + + TRACE("%s\n",debugstr_w(wslash)); + while (lpszPath[0]) + { + if (((lpszPath[0]=='\\') || (lpszPath[0]==':')) && lpszPath[1] && lpszPath[1]!='\\') + wslash = lpszPath+1; + lpszPath++; + } + return (LPWSTR)wslash; +} + +/************************************************************************* + * PathFindFileNameAW [SHELL32.34] + */ +LPVOID WINAPI PathFindFileNameAW(LPCVOID lpszPath) +{ + if(VERSION_OsIsUnicode()) + return PathFindFileNameW(lpszPath); + return PathFindFileNameA(lpszPath); +} + +/************************************************************************* + * PathFindExtensionA [SHLWAPI.@] + * + * NOTES + * returns pointer to last . in last lpszPath component or at \0. + */ + +LPSTR WINAPI PathFindExtensionA(LPCSTR lpszPath) +{ + LPCSTR lastpoint = NULL; + + TRACE("%p %s\n",lpszPath,lpszPath); + + while (*lpszPath) + { + if (*lpszPath=='\\'||*lpszPath==' ') lastpoint=NULL; - if (*path=='.') - lastpoint=path; - path++; + if (*lpszPath=='.') + lastpoint=lpszPath; + lpszPath++; } - return lastpoint?lastpoint:path; + return (LPSTR)(lastpoint?lastpoint:lpszPath); } /************************************************************************* - * PathFindExtensionW - * - * NOTES - * returns pointer to last . in last pathcomponent or at \0. + * PathFindExtensionW [SHLWAPI.@] */ -LPCWSTR WINAPI PathFindExtensionW(LPCWSTR path) -{ LPCWSTR lastpoint = NULL; - TRACE("(%p %s)\n",path,debugstr_w(path)); - while (*path) - { if (*path==(WCHAR)'\\'||*path==(WCHAR)' ') +LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath) +{ + LPCWSTR lastpoint = NULL; + + TRACE("(%p %s)\n",lpszPath,debugstr_w(lpszPath)); + + while (*lpszPath) + { + if (*lpszPath==(WCHAR)'\\'||*lpszPath==(WCHAR)' ') lastpoint=NULL; - if (*path==(WCHAR)'.') - lastpoint=path; - path++; + if (*lpszPath==(WCHAR)'.') + lastpoint=lpszPath; + lpszPath++; } - return lastpoint?lastpoint:path; + return (LPWSTR)(lastpoint?lastpoint:lpszPath); } /************************************************************************* - * PathFindExtension [SHELL32.31] + * PathFindExtensionAW [SHELL32.31] + */ +LPVOID WINAPI PathFindExtensionAW(LPCVOID lpszPath) +{ + if (VERSION_OsIsUnicode()) + return PathFindExtensionW(lpszPath); + return PathFindExtensionA(lpszPath); + +} + +/************************************************************************* + * PathGetExtensionA [internal] * * NOTES - * returns pointer to last . in last pathcomponent or at \0. + * exported by ordinal + * return value points to the first char after the dot */ -LPCVOID WINAPI PathFindExtensionAW(LPCVOID path) -{ if (VERSION_OsIsUnicode()) - return PathFindExtensionW(path); - return PathFindExtensionA(path); +LPSTR WINAPI PathGetExtensionA(LPCSTR lpszPath) +{ + TRACE("(%s)\n",lpszPath); + lpszPath = PathFindExtensionA(lpszPath); + return (LPSTR)(*lpszPath?(lpszPath+1):lpszPath); } /************************************************************************* - * PathAddBackslashA - * - * NOTES - * append \ if there is none + * PathGetExtensionW [internal] */ -LPSTR WINAPI PathAddBackslashA(LPSTR path) -{ int len; - TRACE("%p->%s\n",path,path); +LPWSTR WINAPI PathGetExtensionW(LPCWSTR lpszPath) +{ + TRACE("(%s)\n",debugstr_w(lpszPath)); - len = strlen(path); - if (len && path[len-1]!='\\') - { path[len] = '\\'; - path[len+1]= 0x00; - return path+len+1; + lpszPath = PathFindExtensionW(lpszPath); + return (LPWSTR)(*lpszPath?(lpszPath+1):lpszPath); +} + +/************************************************************************* + * PathGetExtensionAW [SHELL32.158] + */ +LPVOID WINAPI PathGetExtensionAW(LPCVOID lpszPath) +{ + if (VERSION_OsIsUnicode()) + return PathGetExtensionW(lpszPath); + return PathGetExtensionA(lpszPath); +} + +/************************************************************************* + * PathGetArgsA [SHLWAPI.@] + * + * NOTES + * look for next arg in string. handle "quoted" strings + * returns pointer to argument *AFTER* the space. Or to the \0. + * + * FIXME + * quoting by '\' + */ +LPSTR WINAPI PathGetArgsA(LPCSTR lpszPath) +{ + BOOL qflag = FALSE; + + TRACE("%s\n",lpszPath); + + while (*lpszPath) + { + if ((*lpszPath==' ') && !qflag) + return (LPSTR)lpszPath+1; + if (*lpszPath=='"') + qflag=!qflag; + lpszPath++; } - return path+len; + return (LPSTR)lpszPath; + } /************************************************************************* - * PathAddBackslashW - * - * NOTES - * append \ if there is none + * PathGetArgsW [SHLWAPI.@] */ -LPWSTR WINAPI PathAddBackslashW(LPWSTR path) -{ int len; - TRACE("%p->%s\n",path,debugstr_w(path)); +LPWSTR WINAPI PathGetArgsW(LPCWSTR lpszPath) +{ + BOOL qflag = FALSE; - len = CRTDLL_wcslen(path); - if (len && path[len-1]!=(WCHAR)'\\') - { path[len] = (WCHAR)'\\'; - path[len+1]= 0x00; - return path+len+1; + TRACE("%s\n",debugstr_w(lpszPath)); + + while (*lpszPath) + { + if ((*lpszPath==' ') && !qflag) + return (LPWSTR)lpszPath+1; + if (*lpszPath=='"') + qflag=!qflag; + lpszPath++; } - return path+len; + return (LPWSTR)lpszPath; } /************************************************************************* - * PathAddBackslash [SHELL32.32] + * PathGetArgsAW [SHELL32.52] + */ +LPVOID WINAPI PathGetArgsAW(LPVOID lpszPath) +{ + if (VERSION_OsIsUnicode()) + return PathGetArgsW(lpszPath); + return PathGetArgsA(lpszPath); +} + +/************************************************************************* + * PathGetDriveNumberA [SHLWAPI.@] + */ +int WINAPI PathGetDriveNumberA(LPCSTR lpszPath) +{ + int chr = tolower(lpszPath[0]); + + TRACE ("%s\n",debugstr_a(lpszPath)); + + if (!lpszPath || lpszPath[1]!=':' || chr < 'a' || chr > 'z') return -1; + return tolower(lpszPath[0]) - 'a' ; +} + +/************************************************************************* + * PathGetDriveNumberW [SHLWAPI.@] + */ +int WINAPI PathGetDriveNumberW(LPCWSTR lpszPath) +{ + int chr = towlower(lpszPath[0]); + + TRACE ("%s\n",debugstr_w(lpszPath)); + + if (!lpszPath || lpszPath[1]!=':' || chr < 'a' || chr > 'z') return -1; + return tolower(lpszPath[0]) - 'a' ; +} + +/************************************************************************* + * PathGetDriveNumber [SHELL32.57] + */ +int WINAPI PathGetDriveNumberAW(LPVOID lpszPath) +{ + if (VERSION_OsIsUnicode()) + return PathGetDriveNumberW(lpszPath); + return PathGetDriveNumberA(lpszPath); +} + +/************************************************************************* + * PathRemoveFileSpecA [SHLWAPI.@] * * NOTES - * append \ if there is none + * truncates passed argument to a valid path + * returns if the string was modified or not. + * "\foo\xx\foo"-> "\foo\xx" + * "\" -> "\" + * "a:\foo" -> "a:\" */ -LPVOID WINAPI PathAddBackslashAW(LPVOID path) -{ if(VERSION_OsIsUnicode()) - return PathAddBackslashW(path); - return PathAddBackslashA(path); +BOOL WINAPI PathRemoveFileSpecA(LPSTR lpszPath) +{ + LPSTR cutplace; + + TRACE("%s\n",lpszPath); + + if (!lpszPath[0]) return 0; + + cutplace = PathFindFileNameA(lpszPath); + if (cutplace) + { + *cutplace='\0'; + if (PathIsRootA(lpszPath)) + { + PathAddBackslashA(lpszPath); + } + else + { + PathRemoveBackslashA(lpszPath); + } + return TRUE; + } + return FALSE; } /************************************************************************* - * PathRemoveBlanksA + * PathRemoveFileSpecW [SHLWAPI.@] + */ +BOOL WINAPI PathRemoveFileSpecW(LPWSTR lpszPath) +{ + LPWSTR cutplace; + + TRACE("%s\n",debugstr_w(lpszPath)); + + if (!lpszPath[0]) return 0; + cutplace = PathFindFileNameW(lpszPath); + if (cutplace) + { + *cutplace='\0'; + if (PathIsRootW(lpszPath)) + { + PathAddBackslashW(lpszPath); + } + else + { + PathRemoveBackslashW(lpszPath); + } + return TRUE; + } + return FALSE; +} + +/************************************************************************* + * PathRemoveFileSpec [SHELL32.35] + */ +BOOL WINAPI PathRemoveFileSpecAW(LPVOID lpszPath) +{ + if (VERSION_OsIsUnicode()) + return PathRemoveFileSpecW(lpszPath); + return PathRemoveFileSpecA(lpszPath); +} + +/************************************************************************* + * PathStripPathA [SHELLWAPI.@] + * + * NOTES + * removes the path from the beginning of a filename + */ +void WINAPI PathStripPathA(LPSTR lpszPath) +{ + LPSTR lpszFileName = PathFindFileNameA(lpszPath); + + TRACE("%s\n", lpszPath); + + if(lpszFileName) + RtlMoveMemory(lpszPath, lpszFileName, strlen(lpszFileName)); +} + +/************************************************************************* + * PathStripPathW [SHELLWAPI.@] + */ +void WINAPI PathStripPathW(LPWSTR lpszPath) +{ + LPWSTR lpszFileName = PathFindFileNameW(lpszPath); + + TRACE("%s\n", debugstr_w(lpszPath)); + if(lpszFileName) + RtlMoveMemory(lpszPath, lpszFileName, lstrlenW(lpszFileName)*sizeof(WCHAR)); +} + +/************************************************************************* + * PathStripPathAW [SHELL32.38] + */ +void WINAPI PathStripPathAW(LPVOID lpszPath) +{ + if (VERSION_OsIsUnicode()) + return PathStripPathW(lpszPath); + return PathStripPathA(lpszPath); +} + +/************************************************************************* + * PathStripToRootA [SHLWAPI.@] + */ +BOOL WINAPI PathStripToRootA(LPSTR lpszPath) +{ + TRACE("%s\n", lpszPath); + + /* X:\ */ + if (lpszPath[1]==':' && lpszPath[2]=='\\') + { + lpszPath[3]='\0'; + return TRUE; + } + + /* "\" */ + if (lpszPath[0]=='\\') + { + lpszPath[1]='\0'; + return TRUE; + } + + /* UNC "\\\" */ + if (lpszPath[0]=='\\' && lpszPath[1]=='\\') + { + int foundbackslash = 0; + lpszPath += 2; + while (*lpszPath) + { + if (*lpszPath=='\\') foundbackslash++; + if (foundbackslash==2) + { + *lpszPath = '\0'; + return TRUE; + } + lpszPath++; + } + } + + return FALSE; +} + +/************************************************************************* + * PathStripToRootW [SHLWAPI.@] + */ +BOOL WINAPI PathStripToRootW(LPWSTR lpszPath) +{ + TRACE("%s\n", debugstr_w(lpszPath)); + + /* X:\ */ + if (lpszPath[1]==':' && lpszPath[2]=='\\') + { + lpszPath[3]='\0'; + return TRUE; + } + + /* "\" */ + if (lpszPath[0]=='\\') + { + lpszPath[1]='\0'; + return TRUE; + } + + /* UNC "\\\" */ + if (lpszPath[0]=='\\' && lpszPath[1]=='\\') + { + int foundbackslash = 0; + lpszPath += 2; + while (*lpszPath) + { + if (*lpszPath=='\\') foundbackslash++; + if (foundbackslash==2) + { + *lpszPath = '\0'; + return TRUE; + } + lpszPath++; + } + } + + return FALSE; +} + +/************************************************************************* + * PathStripToRootAW [SHELL32.50] + */ +BOOL WINAPI PathStripToRootAW(LPVOID lpszPath) +{ + if (VERSION_OsIsUnicode()) + return PathStripToRootW(lpszPath); + return PathStripToRootA(lpszPath); +} + +/************************************************************************* + * PathRemoveArgsA [SHLWAPI.@] + */ +void WINAPI PathRemoveArgsA(LPSTR lpszPath) +{ + LPSTR lpszArgs = PathGetArgsA(lpszPath); + + TRACE("%s\n", lpszPath); + + if (lpszArgs) *(--lpszArgs)='\0'; +} + +/************************************************************************* + * PathRemoveArgsW [SHLWAPI.@] + */ +void WINAPI PathRemoveArgsW(LPWSTR lpszPath) +{ + LPWSTR lpszArgs = PathGetArgsW(lpszPath); + + TRACE("%s\n", debugstr_w(lpszPath)); + + if (lpszArgs) *(--lpszArgs)='\0'; +} + +/************************************************************************* + * PathRemoveArgsAW [SHELL32.251] + */ +void WINAPI PathRemoveArgsAW(LPVOID lpszPath) +{ + if (VERSION_OsIsUnicode()) + return PathRemoveArgsW(lpszPath); + return PathRemoveArgsA(lpszPath); +} + +/************************************************************************* + * PathRemoveExtensionA [SHLWAPI.@] + */ +void WINAPI PathRemoveExtensionA(LPSTR lpszPath) +{ + LPSTR lpszExtension = PathFindExtensionA(lpszPath); + + TRACE("%s\n", lpszPath); + + if (lpszExtension) *lpszExtension='\0'; +} + +/************************************************************************* + * PathRemoveExtensionW [SHLWAPI.@] + */ +void WINAPI PathRemoveExtensionW(LPWSTR lpszPath) +{ + LPWSTR lpszExtension = PathFindExtensionW(lpszPath); + + TRACE("%s\n", debugstr_w(lpszPath)); + + if (lpszExtension) *lpszExtension='\0'; +} + +/************************************************************************* + * PathRemoveExtensionAW [SHELL32.250] + */ +void WINAPI PathRemoveExtensionAW(LPVOID lpszPath) +{ + if (VERSION_OsIsUnicode()) + return PathRemoveExtensionW(lpszPath); + return PathRemoveExtensionA(lpszPath); +} + +/************************************************************************* + * PathRemoveBackslashA [SHLWAPI.@] + * + * If the path ends in a backslash it is replaced by a NULL + * and the address of the NULL is returned + * Otherwise + * the address of the last character is returned. + * + */ +LPSTR WINAPI PathRemoveBackslashA( LPSTR lpszPath ) +{ + LPSTR p = lpszPath; + + while (*lpszPath) p = lpszPath++; + if ( *p == (CHAR)'\\') *p = (CHAR)'\0'; + return p; +} + +/************************************************************************* + * PathRemoveBackslashW [SHLWAPI.@] + */ +LPWSTR WINAPI PathRemoveBackslashW( LPWSTR lpszPath ) +{ + LPWSTR p = lpszPath; + + while (*lpszPath); p = lpszPath++; + if ( *p == (WCHAR)'\\') *p = (WCHAR)'\0'; + return p; +} + +/* + Path Manipulations +*/ + +/************************************************************************* + * PathGetShortPathA [internal] + */ +LPSTR WINAPI PathGetShortPathA(LPSTR lpszPath) +{ + FIXME("%s stub\n", lpszPath); + return NULL; +} + +/************************************************************************* + * PathGetShortPathW [internal] + */ +LPWSTR WINAPI PathGetShortPathW(LPWSTR lpszPath) +{ + FIXME("%s stub\n", debugstr_w(lpszPath)); + return NULL; +} + +/************************************************************************* + * PathGetShortPathAW [SHELL32.92] + */ +LPVOID WINAPI PathGetShortPathAW(LPVOID lpszPath) +{ + if(VERSION_OsIsUnicode()) + return PathGetShortPathW(lpszPath); + return PathGetShortPathA(lpszPath); +} + +/************************************************************************* + * PathRemoveBlanksA [SHLWAPI.@] * * NOTES * remove spaces from beginning and end of passed string */ LPSTR WINAPI PathRemoveBlanksA(LPSTR str) -{ LPSTR x = str; +{ + LPSTR x = str; + TRACE("%s\n",str); + while (*x==' ') x++; if (x!=str) strcpy(str,x); @@ -211,14 +832,14 @@ LPSTR WINAPI PathRemoveBlanksA(LPSTR str) } /************************************************************************* - * PathRemoveBlanksW - * - * NOTES - * remove spaces from beginning and end of passed string + * PathRemoveBlanksW [SHLWAPI.@] */ LPWSTR WINAPI PathRemoveBlanksW(LPWSTR str) -{ LPWSTR x = str; +{ + LPWSTR x = str; + TRACE("%s\n",debugstr_w(str)); + while (*x==' ') x++; if (x!=str) CRTDLL_wcscpy(str,x); @@ -233,586 +854,57 @@ LPWSTR WINAPI PathRemoveBlanksW(LPWSTR str) } /************************************************************************* - * PathRemoveBlanks [SHELL32.33] - * - * NOTES - * remove spaces from beginning and end of passed string + * PathRemoveBlanksAW [SHELL32.33] */ LPVOID WINAPI PathRemoveBlanksAW(LPVOID str) -{ if(VERSION_OsIsUnicode()) +{ + if(VERSION_OsIsUnicode()) return PathRemoveBlanksW(str); return PathRemoveBlanksA(str); } /************************************************************************* - * PathFindFilenameA + * PathQuoteSpacesA [SHLWAPI.@] * * NOTES - * basename(char *fn); */ -LPCSTR WINAPI PathFindFilenameA(LPCSTR aptr) -{ LPCSTR aslash; - aslash = aptr; - - TRACE("%s\n",aslash); - while (aptr[0]) - { if (((aptr[0]=='\\') || (aptr[0]==':')) && aptr[1] && aptr[1]!='\\') - aslash = aptr+1; - aptr++; - } - return aslash; - -} - -/************************************************************************* - * PathFindFilenameW - * - * NOTES - * basename(char *fn); - */ -LPCWSTR WINAPI PathFindFilenameW(LPCWSTR wptr) -{ LPCWSTR wslash; - wslash = wptr; - - TRACE("%s\n",debugstr_w(wslash)); - while (wptr[0]) - { if (((wptr[0]=='\\') || (wptr[0]==':')) && wptr[1] && wptr[1]!='\\') - wslash = wptr+1; - wptr++; - } - return wslash; -} - -/************************************************************************* - * PathFindFilename [SHELL32.34] - * - * NOTES - * basename(char *fn); - */ -LPCVOID WINAPI PathFindFilenameAW(LPCVOID fn) +LPSTR WINAPI PathQuoteSpacesA(LPCSTR lpszPath) { - if(VERSION_OsIsUnicode()) - return PathFindFilenameW(fn); - return PathFindFilenameA(fn); -} - -/************************************************************************* - * PathRemoveFileSpecA [SHELL32.35] - * - * NOTES - * bool getpath(char *pathname); truncates passed argument to a valid path - * returns if the string was modified or not. - * "\foo\xx\foo"-> "\foo\xx" - * "\" -> "\" - * "a:\foo" -> "a:\" - */ -DWORD WINAPI PathRemoveFileSpecA(LPSTR fn) { - LPSTR x,cutplace; - TRACE("%s\n",fn); - if (!fn[0]) - return 0; - x=fn; - cutplace = fn; - while (*x) { - if (*x=='\\') { - cutplace=x++; - continue; - } - if (*x==':') { - x++; - if (*x=='\\') - cutplace=++x; - continue; /* already x++ed */ - } - x++; - } - if (!*cutplace) - return 0; - if (cutplace==fn) { - if (fn[0]=='\\') { - if (!fn[1]) - return 0; - fn[0]='\0'; - return 1; - } - } - *cutplace='\0'; - return 1; -} - -/************************************************************************* - * PathAppendA [SHELL32.36] - * - * NOTES - * concat_paths(char*target,const char*add); - * concats "target\\add" and writes them to target - */ -LPSTR WINAPI PathAppendA(LPSTR x1,LPSTR x2) { - TRACE("%s %s\n",x1,x2); - while (x2[0]=='\\') x2++; - return PathCombineA(x1,x1,x2); -} - -/************************************************************************* - * PathCombineA - * - * NOTES - * if lpszFile='.' skip it - * szDest can be equal to lpszFile. Thats why we use sTemp - */ -LPSTR WINAPI PathCombineA(LPSTR szDest, LPCSTR lpszDir, LPCSTR lpszFile) -{ char sTemp[MAX_PATH]; - TRACE("%p %p->%s %p->%s\n",szDest, lpszDir, lpszDir, lpszFile, lpszFile); - - - if (!lpszFile || !lpszFile[0] || (lpszFile[0]=='.' && !lpszFile[1]) ) - { strcpy(szDest,lpszDir); - return szDest; - } - - /* if lpszFile is a complete path don't care about lpszDir */ - if (PathIsRootA(lpszFile)) - { strcpy(szDest,lpszFile); - } - else - { strcpy(sTemp,lpszDir); - PathAddBackslashA(sTemp); - strcat(sTemp,lpszFile); - strcpy(szDest,sTemp); - } - return szDest; -} - -/************************************************************************* - * PathCombineW - * - * NOTES - * if lpszFile='.' skip it - * szDest can be equal to lpszFile. Thats why we use sTemp - */ -LPWSTR WINAPI PathCombineW(LPWSTR szDest, LPCWSTR lpszDir, LPCWSTR lpszFile) -{ WCHAR sTemp[MAX_PATH]; - TRACE("%p %p->%s %p->%s\n",szDest, lpszDir, debugstr_w(lpszDir), - lpszFile, debugstr_w(lpszFile)); - - - if (!lpszFile || !lpszFile[0] || (lpszFile[0]==(WCHAR)'.' && !lpszFile[1]) ) - { CRTDLL_wcscpy(szDest,lpszDir); - return szDest; - } - - /* if lpszFile is a complete path don't care about lpszDir */ - if (PathIsRootW(lpszFile)) - { CRTDLL_wcscpy(szDest,lpszFile); - } - else - { CRTDLL_wcscpy(sTemp,lpszDir); - PathAddBackslashW(sTemp); - CRTDLL_wcscat(sTemp,lpszFile); - CRTDLL_wcscpy(szDest,sTemp); - } - return szDest; -} - -/************************************************************************* - * PathCombine [SHELL32.37] - * - * NOTES - * if lpszFile='.' skip it - * szDest can be equal to lpszFile. Thats why we use sTemp - */ -LPVOID WINAPI PathCombineAW(LPVOID szDest, LPCVOID lpszDir, LPCVOID lpszFile) -{ if (VERSION_OsIsUnicode()) - return PathCombineW( szDest, lpszDir, lpszFile ); - return PathCombineA( szDest, lpszDir, lpszFile ); -} - -/************************************************************************* - * PathIsUNCA - * - * NOTES - * PathIsUNC(char*path); - */ -BOOL WINAPI PathIsUNCA(LPCSTR path) -{ TRACE("%s\n",path); - - if ((path[0]=='\\') && (path[1]=='\\')) - return TRUE; - return FALSE; -} - -/************************************************************************* - * PathIsUNCW - * - * NOTES - * PathIsUNC(char*path); - */ -BOOL WINAPI PathIsUNCW(LPCWSTR path) -{ TRACE("%s\n",debugstr_w(path)); - - if ((path[0]=='\\') && (path[1]=='\\')) - return TRUE; - return FALSE; -} - -/************************************************************************* - * PathIsUNC [SHELL32.39] - * - * NOTES - * PathIsUNC(char*path); - */ -BOOL WINAPI PathIsUNCAW (LPCVOID path) -{ if (VERSION_OsIsUnicode()) - return PathIsUNCW( path ); - return PathIsUNCA( path ); -} - -/************************************************************************* - * PathIsRelativeA - * - */ -BOOL WINAPI PathIsRelativeA (LPCSTR path) -{ TRACE("path=%s\n",path); - - if (path && (path[0]!='\\' && path[1]==':')) - return TRUE; - return FALSE; -} - -/************************************************************************* - * PathIsRelativeW - * - */ -BOOL WINAPI PathIsRelativeW (LPCWSTR path) -{ TRACE("path=%s\n",debugstr_w(path)); - - if (path && (path[0]!='\\' && path[1]==':')) - return TRUE; - return FALSE; -} - -/************************************************************************* - * PathIsRelative [SHELL32.40] - * - */ -BOOL WINAPI PathIsRelativeAW (LPCVOID path) -{ if (VERSION_OsIsUnicode()) - return PathIsRelativeW( path ); - return PathIsRelativeA( path ); -} - -/************************************************************************* - * PathIsExeA - * - */ -BOOL WINAPI PathIsExeA (LPCSTR path) -{ FIXME("path=%s\n",path); - return FALSE; -} - -/************************************************************************* - * PathIsExeW - * - */ -BOOL WINAPI PathIsExeW (LPCWSTR path) -{ FIXME("path=%s\n",debugstr_w(path)); - return FALSE; -} - -/************************************************************************* - * PathIsExe [SHELL32.43] - * - */ -BOOL WINAPI PathIsExeAW (LPCVOID path) -{ if (VERSION_OsIsUnicode()) - return PathIsExeW (path); - return PathIsExeA(path); -} - -/************************************************************************* - * PathFileExistsA [SHELL32.45] - * - * NOTES - * file_exists(char *fn); - */ -BOOL WINAPI PathFileExistsA(LPSTR fn) { - TRACE("%s\n",fn); - if (GetFileAttributesA(fn)==-1) - return FALSE; - else - return TRUE; -} -/************************************************************************* - * PathMatchSingleMask - * - * NOTES - * internal (used by PathMatchSpec) - */ -static BOOL PathMatchSingleMaskA(LPCSTR name, LPCSTR mask) -{ - while (*name && *mask && *mask!=';') { - if (*mask=='*') { - do { - if (PathMatchSingleMaskA(name,mask+1)) return 1; /* try substrings */ - } while (*name++); - return 0; - } - if (toupper(*mask)!=toupper(*name) && *mask!='?') return 0; - name++; - mask++; - } - if (!*name) { - while (*mask=='*') mask++; - if (!*mask || *mask==';') return 1; - } - return 0; -} -static BOOL PathMatchSingleMaskW(LPCWSTR name, LPCWSTR mask) -{ - while (*name && *mask && *mask!=';') { - if (*mask=='*') { - do { - if (PathMatchSingleMaskW(name,mask+1)) return 1; /* try substrings */ - } while (*name++); - return 0; - } - if (towupper(*mask)!=towupper(*name) && *mask!='?') return 0; - name++; - mask++; - } - if (!*name) { - while (*mask=='*') mask++; - if (!*mask || *mask==';') return 1; - } - return 0; -} - -/************************************************************************* - * PathMatchSpecA - * - * NOTES - * used from COMDLG32 - */ -BOOL WINAPI PathMatchSpecA(LPCSTR name, LPCSTR mask) -{ - TRACE("%s %s\n",name,mask); - - if (!lstrcmpA( mask, "*.*" )) return 1; /* we don't require a period */ - - while (*mask) { - if (PathMatchSingleMaskA(name,mask)) return 1; /* helper function */ - while (*mask && *mask!=';') mask++; - if (*mask==';') { - mask++; - while (*mask==' ') mask++; /* masks may be separated by "; " */ - } - } - return 0; -} - -/************************************************************************* - * PathMatchSpecW - * - * NOTES - * used from COMDLG32 - */ -BOOL WINAPI PathMatchSpecW(LPCWSTR name, LPCWSTR mask) -{ - WCHAR stemp[4]; - TRACE("%s %s\n",debugstr_w(name),debugstr_w(mask)); - - lstrcpyAtoW(stemp,"*.*"); - if (!lstrcmpW( mask, stemp )) return 1; /* we don't require a period */ - - while (*mask) { - if (PathMatchSingleMaskW(name,mask)) return 1; /* helper function */ - while (*mask && *mask!=';') mask++; - if (*mask==';') { - mask++; - while (*mask==' ') mask++; /* masks may be separated by "; " */ - } - } - return 0; -} - -/************************************************************************* - * PathMatchSpec [SHELL32.46] - * - * NOTES - * used from COMDLG32 - */ -BOOL WINAPI PathMatchSpecAW(LPVOID name, LPVOID mask) -{ if (VERSION_OsIsUnicode()) - return PathMatchSpecW( name, mask ); - return PathMatchSpecA( name, mask ); -} -/************************************************************************* - * PathSetDlgItemPathA - * NOTES - * use PathCompactPath to make sure, the path fits into the control - */ -BOOL WINAPI PathSetDlgItemPathA(HWND hDlg, int id, LPCSTR pszPath) -{ TRACE("%x %x %s\n",hDlg, id, pszPath); - return SetDlgItemTextA(hDlg, id, pszPath); -} - -/************************************************************************* - * PathSetDlgItemPathW - * NOTES - * use PathCompactPath to make sure, the path fits into the control - */ -BOOL WINAPI PathSetDlgItemPathW(HWND hDlg, int id, LPCWSTR pszPath) -{ TRACE("%x %x %s\n",hDlg, id, debugstr_w(pszPath)); - return SetDlgItemTextW(hDlg, id, pszPath); -} - -/************************************************************************* - * PathSetDlgItemPath [SHELL32.48] - * NOTES - * use PathCompactPath to make sure, the path fits into the control - */ -BOOL WINAPI PathSetDlgItemPathAW(HWND hDlg, int id, LPCVOID pszPath) -{ if (VERSION_OsIsUnicode()) - return PathSetDlgItemPathW(hDlg, id, pszPath); - return PathSetDlgItemPathA(hDlg, id, pszPath); -} - -/************************************************************************* - * PathQualifyA - */ -BOOL WINAPI PathQualifyA(LPCSTR pszPath) -{ FIXME("%s\n",pszPath); + FIXME("%s\n",lpszPath); return 0; } /************************************************************************* - * PathQualifyW + * PathQuoteSpacesW [SHLWAPI.@] */ -BOOL WINAPI PathQualifyW(LPCWSTR pszPath) -{ FIXME("%s\n",debugstr_w(pszPath)); - return 0; -} - -/************************************************************************* - * PathQualify [SHELL32.49] - */ -BOOL WINAPI PathQualifyAW(LPCVOID pszPath) -{ if (VERSION_OsIsUnicode()) - return PathQualifyW(pszPath); - return PathQualifyA(pszPath); -} - -/************************************************************************* - * PathResolve [SHELL32.51] - */ -DWORD WINAPI PathResolve(LPCSTR s,DWORD x2,DWORD x3) { - FIXME("(%s,0x%08lx,0x%08lx),stub!\n",s,x2,x3); - return 0; -} - -/************************************************************************* - * PathGetArgsA - * - * NOTES - * look for next arg in string. handle "quoted" strings - * returns pointer to argument *AFTER* the space. Or to the \0. - */ -LPCSTR WINAPI PathGetArgsA(LPCSTR cmdline) -{ BOOL qflag = FALSE; - - TRACE("%s\n",cmdline); - - while (*cmdline) - { if ((*cmdline==' ') && !qflag) - return cmdline+1; - if (*cmdline=='"') - qflag=!qflag; - cmdline++; - } - return cmdline; - -} - -/************************************************************************* - * PathGetArgsW - * - * NOTES - * look for next arg in string. handle "quoted" strings - * returns pointer to argument *AFTER* the space. Or to the \0. - */ -LPCWSTR WINAPI PathGetArgsW(LPCWSTR cmdline) -{ BOOL qflag = FALSE; - - TRACE("%s\n",debugstr_w(cmdline)); - - while (*cmdline) - { if ((*cmdline==' ') && !qflag) - return cmdline+1; - if (*cmdline=='"') - qflag=!qflag; - cmdline++; - } - return cmdline; -} - -/************************************************************************* - * PathGetArgs [SHELL32.52] - * - * NOTES - * look for next arg in string. handle "quoted" strings - * returns pointer to argument *AFTER* the space. Or to the \0. - */ -LPCVOID WINAPI PathGetArgsAW(LPVOID cmdline) -{ if (VERSION_OsIsUnicode()) - return PathGetArgsW(cmdline); - return PathGetArgsA(cmdline); -} - -/************************************************************************* - * PathQuoteSpacesA - * - * NOTES - * basename(char *fn); - */ -LPSTR WINAPI PathQuoteSpacesA(LPCSTR aptr) -{ FIXME("%s\n",aptr); - return 0; - -} - -/************************************************************************* - * PathQuoteSpacesW - * - * NOTES - * basename(char *fn); - */ -LPWSTR WINAPI PathQuoteSpacesW(LPCWSTR wptr) -{ FIXME("%s\n",debugstr_w(wptr)); +LPWSTR WINAPI PathQuoteSpacesW(LPCWSTR lpszPath) +{ + FIXME("%s\n",debugstr_w(lpszPath)); return 0; } /************************************************************************* - * PathQuoteSpaces [SHELL32.55] - * - * NOTES - * basename(char *fn); + * PathQuoteSpacesAW [SHELL32.55] */ -LPVOID WINAPI PathQuoteSpacesAW (LPCVOID fn) -{ if(VERSION_OsIsUnicode()) - return PathQuoteSpacesW(fn); - return PathQuoteSpacesA(fn); +LPVOID WINAPI PathQuoteSpacesAW (LPCVOID lpszPath) +{ + if(VERSION_OsIsUnicode()) + return PathQuoteSpacesW(lpszPath); + return PathQuoteSpacesA(lpszPath); } - /************************************************************************* - * PathUnquoteSpacesA + * PathUnquoteSpacesA [SHLWAPI.@] * * NOTES * unquote string (remove ") */ VOID WINAPI PathUnquoteSpacesA(LPSTR str) -{ DWORD len = lstrlenA(str); +{ + DWORD len = lstrlenA(str); + TRACE("%s\n",str); + if (*str!='"') return; if (str[len-1]!='"') @@ -823,13 +915,11 @@ VOID WINAPI PathUnquoteSpacesA(LPSTR str) } /************************************************************************* - * PathUnquoteSpacesW - * - * NOTES - * unquote string (remove ") + * PathUnquoteSpacesW [SHLWAPI.@] */ VOID WINAPI PathUnquoteSpacesW(LPWSTR str) -{ DWORD len = CRTDLL_wcslen(str); +{ + DWORD len = CRTDLL_wcslen(str); TRACE("%s\n",debugstr_w(str)); @@ -843,10 +933,7 @@ VOID WINAPI PathUnquoteSpacesW(LPWSTR str) } /************************************************************************* - * PathUnquoteSpaces [SHELL32.56] - * - * NOTES - * unquote string (remove ") + * PathUnquoteSpacesAW [SHELL32.56] */ VOID WINAPI PathUnquoteSpacesAW(LPVOID str) { @@ -857,32 +944,631 @@ VOID WINAPI PathUnquoteSpacesAW(LPVOID str) } /************************************************************************* - * PathGetDriveNumberA [SHLWAPI.@] - * + * PathParseIconLocationA [SHLWAPI.@] */ -HRESULT WINAPI PathGetDriveNumberA(LPSTR u) -{ FIXME("%s stub\n",debugstr_a(u)); +int WINAPI PathParseIconLocationA(LPSTR lpszPath) +{ + LPSTR lpstrComma = strchr(lpszPath, ','); + + FIXME("%s stub\n", debugstr_a(lpszPath)); + + if (lpstrComma && lpstrComma[1]) + { + lpstrComma[0]='\0'; +/* return atoi(&lpstrComma[1]); FIXME */ + } return 0; } /************************************************************************* - * PathGetDriveNumberW [SHLWAPI.@] - * + * PathParseIconLocationW [SHLWAPI.@] */ -HRESULT WINAPI PathGetDriveNumberW(LPWSTR u) -{ FIXME("%s stub\n",debugstr_w(u)); +int WINAPI PathParseIconLocationW(LPWSTR lpszPath) +{ + LPWSTR lpstrComma = CRTDLL_wcschr(lpszPath, ','); + + FIXME("%s stub\n", debugstr_w(lpszPath)); + + if (lpstrComma && lpstrComma[1]) + { + lpstrComma[0]='\0'; +/* return _wtoi(&lpstrComma[1]); FIXME */ + } return 0; } /************************************************************************* - * PathGetDriveNumber [SHELL32.57] - * + * PathParseIconLocationAW [SHELL32.249] */ -HRESULT WINAPI PathGetDriveNumberAW(LPVOID str) +int WINAPI PathParseIconLocationAW (LPVOID lpszPath) { if(VERSION_OsIsUnicode()) - return PathGetDriveNumberW(str); - return PathGetDriveNumberA(str); + return PathParseIconLocationW(lpszPath); + return PathParseIconLocationA(lpszPath); +} + +/* + Path Testing +*/ +/************************************************************************* + * PathIsUNCA [SHLWAPI.@] + * + * NOTES + * PathIsUNC(char*path); + */ +BOOL WINAPI PathIsUNCA(LPCSTR lpszPath) +{ + TRACE("%s\n",lpszPath); + + return (lpszPath && (lpszPath[0]=='\\') && (lpszPath[1]=='\\')); +} + +/************************************************************************* + * PathIsUNCW [SHLWAPI.@] + */ +BOOL WINAPI PathIsUNCW(LPCWSTR lpszPath) +{ + TRACE("%s\n",debugstr_w(lpszPath)); + + return (lpszPath && (lpszPath[0]=='\\') && (lpszPath[1]=='\\')); +} + +/************************************************************************* + * PathIsUNCAW [SHELL32.39] + */ +BOOL WINAPI PathIsUNCAW (LPCVOID lpszPath) +{ + if (VERSION_OsIsUnicode()) + return PathIsUNCW( lpszPath ); + return PathIsUNCA( lpszPath ); +} + +/************************************************************************* + * PathIsRelativeA [SHLWAPI.@] + */ +BOOL WINAPI PathIsRelativeA (LPCSTR lpszPath) +{ + TRACE("lpszPath=%s\n",lpszPath); + + return (lpszPath && (lpszPath[0]!='\\' && lpszPath[1]!=':')); +} + +/************************************************************************* + * PathIsRelativeW [SHLWAPI.@] + */ +BOOL WINAPI PathIsRelativeW (LPCWSTR lpszPath) +{ + TRACE("lpszPath=%s\n",debugstr_w(lpszPath)); + + return (lpszPath && (lpszPath[0]!='\\' && lpszPath[1]!=':')); +} + +/************************************************************************* + * PathIsRelativeAW [SHELL32.40] + */ +BOOL WINAPI PathIsRelativeAW (LPCVOID lpszPath) +{ + if (VERSION_OsIsUnicode()) + return PathIsRelativeW( lpszPath ); + return PathIsRelativeA( lpszPath ); +} + +/************************************************************************* + * PathIsRootA [SHLWAPI.@] + * + * notes + * TRUE if the path points to a root directory + */ +BOOL WINAPI PathIsRootA(LPCSTR lpszPath) +{ + TRACE("%s\n",lpszPath); + + /* X:\ */ + if (lpszPath[1]==':' && lpszPath[2]=='\\' && lpszPath[3]=='\0') + return TRUE; + + /* "\" */ + if (lpszPath[0]=='\\' && lpszPath[1]=='\0') + return TRUE; + + /* UNC "\\\" */ + if (lpszPath[0]=='\\' && lpszPath[1]=='\\') + { + int foundbackslash = 0; + lpszPath += 2; + while (*lpszPath) + { + if (*(lpszPath++)=='\\') foundbackslash++; + } + if (foundbackslash==1) + return TRUE; + } + return FALSE; +} + +/************************************************************************* + * PathIsRootW [SHLWAPI.@] + */ +BOOL WINAPI PathIsRootW(LPCWSTR lpszPath) +{ + TRACE("%s\n",debugstr_w(lpszPath)); + + /* X:\ */ + if (lpszPath[1]==':' && lpszPath[2]=='\\' && lpszPath[3]=='\0') + return TRUE; + + /* "\" */ + if (lpszPath[0]=='\\' && lpszPath[1]=='\0') + return TRUE; + + /* UNC "\\\" */ + if (lpszPath[0]=='\\' && lpszPath[1]=='\\') + { + int foundbackslash = 0; + lpszPath += 2; + while (*lpszPath) + { + if (*(lpszPath++)=='\\') foundbackslash++; + } + if (foundbackslash==1) + return TRUE; + } + return FALSE; + +} + +/************************************************************************* + * PathIsRootAW [SHELL32.29] + */ +BOOL WINAPI PathIsRootAW(LPCVOID lpszPath) +{ + if (VERSION_OsIsUnicode()) + return PathIsRootW(lpszPath); + return PathIsRootA(lpszPath); +} + +/************************************************************************* + * PathIsExeA [internal] + */ +BOOL WINAPI PathIsExeA (LPCSTR lpszPath) +{ + LPCSTR lpszExtension = PathGetExtensionA(lpszPath); + int i = 0; + static char * lpszExtensions[6] = {"exe", "com", "pid", "cmd", "bat", NULL }; + + TRACE("path=%s\n",lpszPath); + + for(i=0; lpszExtensions[i]; i++) + if (!strcasecmp(lpszExtension,lpszExtensions[i])) return TRUE; + + return FALSE; +} + +/************************************************************************* + * PathIsExeW [internal] + */ +BOOL WINAPI PathIsExeW (LPCWSTR lpszPath) +{ + LPCWSTR lpszExtension = PathGetExtensionW(lpszPath); + int i = 0; + static WCHAR lpszExtensions[6][4] = + {{'e','x','e','\0'}, {'c','o','m','\0'}, {'p','i','d','\0'}, + {'c','m','d','\0'}, {'b','a','t','\0'}, {'\0'} }; + + TRACE("path=%s\n",debugstr_w(lpszPath)); + + for(i=0; lpszExtensions[i]; i++) + if (!CRTDLL__wcsicmp(lpszExtension,lpszExtensions[i])) return TRUE; + + return FALSE; +} + +/************************************************************************* + * PathIsExeAW [SHELL32.43] + */ +BOOL WINAPI PathIsExeAW (LPCVOID path) +{ + if (VERSION_OsIsUnicode()) + return PathIsExeW (path); + return PathIsExeA(path); +} + +/************************************************************************* + * PathIsDirectoryA [SHLWAPI.@] + */ +BOOL WINAPI PathIsDirectoryA(LPCSTR lpszPath) +{ + HANDLE hFile; + WIN32_FIND_DATAA stffile; + + TRACE("%s\n", debugstr_a(lpszPath)); + + hFile = FindFirstFileA(lpszPath, &stffile); + + if ( hFile != INVALID_HANDLE_VALUE ) + { + FindClose (hFile); + return (stffile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY); + } + + return FALSE; +} + +/************************************************************************* + * PathIsDirectoryW [SHLWAPI.@] + */ +BOOL WINAPI PathIsDirectoryW(LPCWSTR lpszPath) +{ + HANDLE hFile; + WIN32_FIND_DATAW stffile; + + TRACE("%s\n", debugstr_w(lpszPath)); + + hFile = FindFirstFileW(lpszPath, &stffile); + + if ( hFile != INVALID_HANDLE_VALUE ) + { + FindClose (hFile); + return (stffile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY); + } + + return FALSE; +} + +/************************************************************************* + * PathIsDirectoryAW [SHELL32.159] + */ +BOOL WINAPI PathIsDirectoryAW (LPCVOID lpszPath) +{ + if (VERSION_OsIsUnicode()) + return PathIsDirectoryW (lpszPath); + return PathIsDirectoryA (lpszPath); +} + +/************************************************************************* + * PathFileExistsA [SHLWAPI.@] + * + * NOTES + * file_exists(char *fn); + */ +BOOL WINAPI PathFileExistsA(LPCSTR lpszPath) +{ + TRACE("%s\n",lpszPath); + return (GetFileAttributesA(lpszPath)!=-1); +} + +/************************************************************************* + * PathFileExistsW [SHLWAPI.@] + */ +BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath) +{ + TRACE("%s\n",debugstr_w(lpszPath)); + return (GetFileAttributesW(lpszPath)!=-1); +} + +/************************************************************************* + * PathFileExistsAW [SHELL32.45] + */ +BOOL WINAPI PathFileExistsAW (LPCVOID lpszPath) +{ + if (VERSION_OsIsUnicode()) + return PathFileExistsW (lpszPath); + return PathFileExistsA (lpszPath); +} + +/************************************************************************* + * PathMatchSingleMaskA [internal] + * + * NOTES + * internal (used by PathMatchSpec) + */ +static BOOL PathMatchSingleMaskA(LPCSTR name, LPCSTR mask) +{ + while (*name && *mask && *mask!=';') + { + if (*mask=='*') + { + do + { + if (PathMatchSingleMaskA(name,mask+1)) return 1; /* try substrings */ + } while (*name++); + return 0; + } + if (toupper(*mask)!=toupper(*name) && *mask!='?') return 0; + name++; + mask++; + } + if (!*name) + { + while (*mask=='*') mask++; + if (!*mask || *mask==';') return 1; + } + return 0; +} + +/************************************************************************* + * PathMatchSingleMaskW [internal] + */ +static BOOL PathMatchSingleMaskW(LPCWSTR name, LPCWSTR mask) +{ + while (*name && *mask && *mask!=';') + { + if (*mask=='*') + { + do + { + if (PathMatchSingleMaskW(name,mask+1)) return 1; /* try substrings */ + } while (*name++); + return 0; + } + if (towupper(*mask)!=towupper(*name) && *mask!='?') return 0; + name++; + mask++; + } + if (!*name) + { + while (*mask=='*') mask++; + if (!*mask || *mask==';') return 1; + } + return 0; +} +/************************************************************************* + * PathMatchSpecA [SHLWAPI.@] + * + * NOTES + * used from COMDLG32 + */ +BOOL WINAPI PathMatchSpecA(LPCSTR name, LPCSTR mask) +{ + TRACE("%s %s\n",name,mask); + + if (!lstrcmpA( mask, "*.*" )) return 1; /* we don't require a period */ + + while (*mask) + { + if (PathMatchSingleMaskA(name,mask)) return 1; /* helper function */ + while (*mask && *mask!=';') mask++; + if (*mask==';') + { + mask++; + while (*mask==' ') mask++; /* masks may be separated by "; " */ + } + } + return 0; +} + +/************************************************************************* + * PathMatchSpecW [SHLWAPI.@] + */ +BOOL WINAPI PathMatchSpecW(LPCWSTR name, LPCWSTR mask) +{ + WCHAR stemp[4]; + TRACE("%s %s\n",debugstr_w(name),debugstr_w(mask)); + + lstrcpyAtoW(stemp,"*.*"); + if (!lstrcmpW( mask, stemp )) return 1; /* we don't require a period */ + + while (*mask) + { + if (PathMatchSingleMaskW(name,mask)) return 1; /* helper function */ + while (*mask && *mask!=';') mask++; + if (*mask==';') + { + mask++; + while (*mask==' ') mask++; /* masks may be separated by "; " */ + } + } + return 0; +} + +/************************************************************************* + * PathMatchSpecAW [SHELL32.46] + */ +BOOL WINAPI PathMatchSpecAW(LPVOID name, LPVOID mask) +{ + if (VERSION_OsIsUnicode()) + return PathMatchSpecW( name, mask ); + return PathMatchSpecA( name, mask ); +} + +/************************************************************************* + * PathIsSameRootA [SHLWAPI.@] + * + * FIXME + * what to do with "\path" ?? + */ +BOOL WINAPI PathIsSameRootA(LPCSTR lpszPath1, LPCSTR lpszPath2) +{ + TRACE("%s %s\n", lpszPath1, lpszPath2); + + if (PathIsRelativeA(lpszPath1) || PathIsRelativeA(lpszPath2)) return FALSE; + + /* usual path */ + if ( toupper(lpszPath1[0])==toupper(lpszPath2[0]) && + lpszPath1[1]==':' && lpszPath2[1]==':' && + lpszPath1[2]=='\\' && lpszPath2[2]=='\\') + return TRUE; + + /* UNC */ + if (lpszPath1[0]=='\\' && lpszPath2[0]=='\\' && + lpszPath1[1]=='\\' && lpszPath2[1]=='\\') + { + int pos=2, bsfound=0; + while (lpszPath1[pos] && lpszPath2[pos] && + (lpszPath1[pos] == lpszPath2[pos])) + { + if (lpszPath1[pos]=='\\') bsfound++; + if (bsfound == 2) return TRUE; + pos++; + } + return (lpszPath1[pos] == lpszPath2[pos]); + } + return FALSE; +} + +/************************************************************************* + * PathIsSameRootW [SHLWAPI.@] + */ +BOOL WINAPI PathIsSameRootW(LPCWSTR lpszPath1, LPCWSTR lpszPath2) +{ + TRACE("%s %s\n", debugstr_w(lpszPath1), debugstr_w(lpszPath2)); + + if (PathIsRelativeW(lpszPath1) || PathIsRelativeW(lpszPath2)) return FALSE; + + /* usual path */ + if ( towupper(lpszPath1[0])==towupper(lpszPath2[0]) && + lpszPath1[1]==':' && lpszPath2[1]==':' && + lpszPath1[2]=='\\' && lpszPath2[2]=='\\') + return TRUE; + + /* UNC */ + if (lpszPath1[0]=='\\' && lpszPath2[0]=='\\' && + lpszPath1[1]=='\\' && lpszPath2[1]=='\\') + { + int pos=2, bsfound=0; + while (lpszPath1[pos] && lpszPath2[pos] && + (lpszPath1[pos] == lpszPath2[pos])) + { + if (lpszPath1[pos]=='\\') bsfound++; + if (bsfound == 2) return TRUE; + pos++; + } + return (lpszPath1[pos] == lpszPath2[pos]); + } + return FALSE; +} + +/************************************************************************* + * PathIsSameRootAW [SHELL32.650] + */ +BOOL WINAPI PathIsSameRootAW(LPCVOID lpszPath1, LPCVOID lpszPath2) +{ + if (VERSION_OsIsUnicode()) + return PathIsSameRootW(lpszPath1, lpszPath2); + return PathIsSameRootA(lpszPath1, lpszPath2); +} + +/************************************************************************* + * PathIsURLA + */ +BOOL WINAPI PathIsURLA(LPCSTR lpstrPath) +{ + LPSTR lpstrRes; + int iSize, i=0; + static LPSTR SupportedProtocol[] = + {"http","https","ftp","gopher","file","mailto",NULL}; + + if(!lpstrPath) return FALSE; + + /* get protocol */ + lpstrRes = strchr(lpstrPath,':'); + if(!lpstrRes) return FALSE; + iSize = lpstrRes - lpstrPath; + + while(SupportedProtocol[i]) + { + if (iSize == strlen(SupportedProtocol[i])) + if(!strncasecmp(lpstrPath, SupportedProtocol[i], iSize)); + return TRUE; + i++; + } + + return FALSE; +} + +/************************************************************************* + * PathIsURLW + */ +BOOL WINAPI PathIsURLW(LPCWSTR lpstrPath) +{ + LPWSTR lpstrRes; + int iSize, i=0; + static WCHAR SupportedProtocol[7][7] = + {{'h','t','t','p','\0'},{'h','t','t','p','s','\0'},{'f','t','p','\0'}, + {'g','o','p','h','e','r','\0'},{'f','i','l','e','\0'}, + {'m','a','i','l','t','o','\0'},{0}}; + + if(!lpstrPath) return FALSE; + + /* get protocol */ + lpstrRes = CRTDLL_wcschr(lpstrPath,':'); + if(!lpstrRes) return FALSE; + iSize = lpstrRes - lpstrPath; + + while(SupportedProtocol[i]) + { + if (iSize == CRTDLL_wcslen(SupportedProtocol[i])) + if(!CRTDLL__wcsnicmp(lpstrPath, SupportedProtocol[i], iSize)); + return TRUE; + i++; + } + + return FALSE; +} + +/************************************************************************* + * IsLFNDriveA [SHELL32.119] + * + * NOTES + * exported by ordinal Name + */ +BOOL WINAPI IsLFNDriveA(LPCSTR lpszPath) +{ + DWORD fnlen; + + if (!GetVolumeInformationA(lpszPath,NULL,0,NULL,&fnlen,NULL,NULL,0)) + return FALSE; + return fnlen>12; +} + +/* + Creating Something Unique +*/ +/************************************************************************* + * PathMakeUniqueNameA [internal] + */ +BOOL WINAPI PathMakeUniqueNameA( + LPSTR lpszBuffer, + DWORD dwBuffSize, + LPCSTR lpszShortName, + LPCSTR lpszLongName, + LPCSTR lpszPathName) +{ + FIXME("%p %lu %s %s %s stub\n", + lpszBuffer, dwBuffSize, debugstr_a(lpszShortName), + debugstr_a(lpszLongName), debugstr_a(lpszPathName)); + return TRUE; +} + +/************************************************************************* + * PathMakeUniqueNameW [internal] + */ +BOOL WINAPI PathMakeUniqueNameW( + LPWSTR lpszBuffer, + DWORD dwBuffSize, + LPCWSTR lpszShortName, + LPCWSTR lpszLongName, + LPCWSTR lpszPathName) +{ + FIXME("%p %lu %s %s %s stub\n", + lpszBuffer, dwBuffSize, debugstr_w(lpszShortName), + debugstr_w(lpszLongName), debugstr_w(lpszPathName)); + return TRUE; +} + +/************************************************************************* + * PathMakeUniqueNameAW [SHELL32.47] + */ +BOOL WINAPI PathMakeUniqueNameAW( + LPVOID lpszBuffer, + DWORD dwBuffSize, + LPCVOID lpszShortName, + LPCVOID lpszLongName, + LPCVOID lpszPathName) +{ + if (VERSION_OsIsUnicode()) + return PathMakeUniqueNameW(lpszBuffer,dwBuffSize, lpszShortName,lpszLongName,lpszPathName); + return PathMakeUniqueNameA(lpszBuffer,dwBuffSize, lpszShortName,lpszLongName,lpszPathName); } /************************************************************************* @@ -891,75 +1577,52 @@ HRESULT WINAPI PathGetDriveNumberAW(LPVOID str) * NOTES * exported by ordinal */ -BOOL WINAPI PathYetAnotherMakeUniqueNameA(LPDWORD x,LPDWORD y) { - FIXME("(%p,%p):stub.\n",x,y); +BOOL WINAPI PathYetAnotherMakeUniqueNameA( + LPSTR lpszBuffer, + LPCSTR lpszPathName, + LPCSTR lpszShortName, + LPCSTR lpszLongName) +{ + FIXME("(%p,%p, %p ,%p):stub.\n", + lpszBuffer, lpszPathName, lpszShortName, lpszLongName); return TRUE; } -/************************************************************************* - * IsLFNDriveA [SHELL32.119] - * - * NOTES - * exported by ordinal Name + +/* + cleaning and resolving paths */ -BOOL WINAPI IsLFNDriveA(LPCSTR path) { - DWORD fnlen; - - if (!GetVolumeInformationA(path,NULL,0,NULL,&fnlen,NULL,NULL,0)) - return FALSE; - return fnlen>12; -} /************************************************************************* - * PathFindOnPathA + * PathFindOnPathA [SHELL32.145] */ BOOL WINAPI PathFindOnPathA(LPSTR sFile, LPCSTR sOtherDirs) -{ FIXME("%s %s\n",sFile, sOtherDirs); +{ + FIXME("%s %s\n",sFile, sOtherDirs); return FALSE; } /************************************************************************* - * PathFindOnPathW + * PathFindOnPathW [SHELL32] */ BOOL WINAPI PathFindOnPathW(LPWSTR sFile, LPCWSTR sOtherDirs) -{ FIXME("%s %s\n",debugstr_w(sFile), debugstr_w(sOtherDirs)); +{ + FIXME("%s %s\n",debugstr_w(sFile), debugstr_w(sOtherDirs)); return FALSE; } /************************************************************************* - * PathFindOnPath [SHELL32.145] + * PathFindOnPathAW [SHELL32] */ BOOL WINAPI PathFindOnPathAW(LPVOID sFile, LPCVOID sOtherDirs) -{ if (VERSION_OsIsUnicode()) +{ + if (VERSION_OsIsUnicode()) return PathFindOnPathW(sFile, sOtherDirs); return PathFindOnPathA(sFile, sOtherDirs); } /************************************************************************* - * PathGetExtension [SHELL32.158] - * - * NOTES - * exported by ordinal - */ -LPCSTR WINAPI PathGetExtensionA(LPCSTR path,DWORD y,DWORD z) -{ TRACE("(%s,%08lx,%08lx)\n",path,y,z); - path = PathFindExtensionA(path); - return *path?(path+1):path; -} -LPCWSTR WINAPI PathGetExtensionW(LPCWSTR path,DWORD y,DWORD z) -{ TRACE("(%s, %08lx, %08lx)\n",debugstr_w(path),y,z); - path = PathFindExtensionW(path); - return *path?(path+1):path; -} -LPCVOID WINAPI PathGetExtensionAW(LPCVOID path,DWORD y,DWORD z) -{ if (VERSION_OsIsUnicode()) - return PathGetExtensionW(path,y,z); - return PathGetExtensionA(path,y,z); -} - -/************************************************************************* - * PathCleanupSpec [SHELL32.171] - * + * PathCleanupSpecA [SHELL32.171] */ DWORD WINAPI PathCleanupSpecA(LPSTR x, LPSTR y) { @@ -967,12 +1630,18 @@ DWORD WINAPI PathCleanupSpecA(LPSTR x, LPSTR y) return TRUE; } +/************************************************************************* + * PathCleanupSpecA [SHELL32] + */ DWORD WINAPI PathCleanupSpecW(LPWSTR x, LPWSTR y) { FIXME("(%p %s, %p %s) stub\n",x,debugstr_w(x),y,debugstr_w(y)); return TRUE; } +/************************************************************************* + * PathCleanupSpecAW [SHELL32] + */ DWORD WINAPI PathCleanupSpecAW (LPVOID x, LPVOID y) { if (VERSION_OsIsUnicode()) @@ -981,56 +1650,158 @@ DWORD WINAPI PathCleanupSpecAW (LPVOID x, LPVOID y) } /************************************************************************* - * SheGetDirW [SHELL32.281] - * + * PathQualifyA [SHELL32] */ -HRESULT WINAPI SheGetDirW(LPWSTR u, LPWSTR v) -{ FIXME("%p %p stub\n",u,v); +BOOL WINAPI PathQualifyA(LPCSTR pszPath) +{ + FIXME("%s\n",pszPath); return 0; } /************************************************************************* - * SheChangeDirW [SHELL32.274] - * + * PathQualifyW [SHELL32] */ -HRESULT WINAPI SheChangeDirW(LPWSTR u) -{ FIXME("(%s),stub\n",debugstr_w(u)); +BOOL WINAPI PathQualifyW(LPCWSTR pszPath) +{ + FIXME("%s\n",debugstr_w(pszPath)); return 0; } /************************************************************************* -* PathProcessCommand [SHELL32.653] -*/ -HRESULT WINAPI PathProcessCommandA (LPSTR lpCommand, LPSTR v, DWORD w, DWORD x) -{ - FIXME("%p(%s) %p 0x%04lx 0x%04lx stub\n", - lpCommand, lpCommand, v, w,x ); - lstrcpyA(v, lpCommand); - return 0; -} - -HRESULT WINAPI PathProcessCommandW (LPWSTR lpCommand, LPSTR v, DWORD w, DWORD x) -{ - FIXME("(%p %s, %p, 0x%04lx, 0x%04lx) stub\n", - lpCommand, debugstr_w(lpCommand), v, w,x ); - return 0; -} - -HRESULT WINAPI PathProcessCommandAW (LPVOID lpCommand, LPSTR v, DWORD w, DWORD x) + * PathQualifyAW [SHELL32] + */ +BOOL WINAPI PathQualifyAW(LPCVOID pszPath) { if (VERSION_OsIsUnicode()) - return PathProcessCommandW(lpCommand, v, w, x); - return PathProcessCommandA(lpCommand, v, w, x); + return PathQualifyW(pszPath); + return PathQualifyA(pszPath); } /************************************************************************* - * SHGetSpecialFolderPathA + * PathResolveA [SHELL32.51] + */ +BOOL WINAPI PathResolveA( + LPSTR lpszPath, + LPCSTR *alpszPaths, + DWORD dwFlags) +{ + FIXME("(%s,%p,0x%08lx),stub!\n", + lpszPath, *alpszPaths, dwFlags); + return 0; +} + +/************************************************************************* + * PathResolveW [SHELL32] + */ +BOOL WINAPI PathResolveW( + LPWSTR lpszPath, + LPCWSTR *alpszPaths, + DWORD dwFlags) +{ + FIXME("(%s,%p,0x%08lx),stub!\n", + debugstr_w(lpszPath), debugstr_w(*alpszPaths), dwFlags); + return 0; +} + +/************************************************************************* + * PathResolveAW [SHELL32] + */ +BOOL WINAPI PathResolveAW( + LPVOID lpszPath, + LPCVOID *alpszPaths, + DWORD dwFlags) +{ + if (VERSION_OsIsUnicode()) + return PathResolveW(lpszPath, (LPCWSTR*)alpszPaths, dwFlags); + return PathResolveA(lpszPath, (LPCSTR*)alpszPaths, dwFlags); +} + +/************************************************************************* +* PathProcessCommandA [SHELL32.653] +*/ +HRESULT WINAPI PathProcessCommandA ( + LPCSTR lpszPath, + LPSTR lpszBuff, + DWORD dwBuffSize, + DWORD dwFlags) +{ + FIXME("%s %p 0x%04lx 0x%04lx stub\n", + lpszPath, lpszBuff, dwBuffSize, dwFlags); + lstrcpyA(lpszBuff, lpszPath); + return 0; +} + +/************************************************************************* +* PathProcessCommandW +*/ +HRESULT WINAPI PathProcessCommandW ( + LPCWSTR lpszPath, + LPWSTR lpszBuff, + DWORD dwBuffSize, + DWORD dwFlags) +{ + FIXME("(%s, %p, 0x%04lx, 0x%04lx) stub\n", + debugstr_w(lpszPath), lpszBuff, dwBuffSize, dwFlags); + lstrcpyW(lpszBuff, lpszPath); + return 0; +} + +/************************************************************************* +* PathProcessCommandAW +*/ +HRESULT WINAPI PathProcessCommandAW ( + LPCVOID lpszPath, + LPVOID lpszBuff, + DWORD dwBuffSize, + DWORD dwFlags) +{ + if (VERSION_OsIsUnicode()) + return PathProcessCommandW(lpszPath, lpszBuff, dwBuffSize, dwFlags); + return PathProcessCommandA(lpszPath, lpszBuff, dwBuffSize, dwFlags); +} + +/* + special +*/ + +/************************************************************************* + * PathSetDlgItemPathA + * + * NOTES + * use PathCompactPath to make sure, the path fits into the control + */ +BOOL WINAPI PathSetDlgItemPathA(HWND hDlg, int id, LPCSTR pszPath) +{ TRACE("%x %x %s\n",hDlg, id, pszPath); + return SetDlgItemTextA(hDlg, id, pszPath); +} + +/************************************************************************* + * PathSetDlgItemPathW + */ +BOOL WINAPI PathSetDlgItemPathW(HWND hDlg, int id, LPCWSTR pszPath) +{ TRACE("%x %x %s\n",hDlg, id, debugstr_w(pszPath)); + return SetDlgItemTextW(hDlg, id, pszPath); +} + +/************************************************************************* + * PathSetDlgItemPathAW + */ +BOOL WINAPI PathSetDlgItemPathAW(HWND hDlg, int id, LPCVOID pszPath) +{ if (VERSION_OsIsUnicode()) + return PathSetDlgItemPathW(hDlg, id, pszPath); + return PathSetDlgItemPathA(hDlg, id, pszPath); +} + + +/************************************************************************* + * SHGetSpecialFolderPathA [SHELL32.175] * * converts csidl to path * */ static char * szSHFolders = "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders"; +static char * szSHUserFolders = "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders"; BOOL WINAPI SHGetSpecialFolderPathA ( HWND hwndOwner, @@ -1174,40 +1945,46 @@ BOOL WINAPI SHGetSpecialFolderPathA ( return FALSE; } - if (RegCreateKeyExA(hRootKey,szSHFolders,0,NULL,REG_OPTION_NON_VOLATILE,KEY_WRITE,NULL,&hKey,&dwDisp)) - { - return FALSE; - } + /* user shell folders */ + if (RegCreateKeyExA(hRootKey,szSHUserFolders,0,NULL,0,KEY_ALL_ACCESS,NULL,&hKey,&dwDisp)) return FALSE; if (RegQueryValueExA(hKey,szValueName,NULL,&dwType,(LPBYTE)szPath,&dwPathLen)) { - /* value not existing */ - if (bRelative) + RegCloseKey(hKey); + + /* shell folders */ + if (RegCreateKeyExA(hRootKey,szSHFolders,0,NULL,0,KEY_ALL_ACCESS,NULL,&hKey,&dwDisp)) return FALSE; + + if (RegQueryValueExA(hKey,szValueName,NULL,&dwType,(LPBYTE)szPath,&dwPathLen)) { - GetWindowsDirectoryA(szPath, MAX_PATH); - PathAddBackslashA(szPath); - strcat(szPath, szDefaultPath); + + /* value not existing */ + if (bRelative) + { + GetWindowsDirectoryA(szPath, MAX_PATH); + PathAddBackslashA(szPath); + strcat(szPath, szDefaultPath); + } + else + { + strcpy(szPath, "C:\\"); /* fixme ??? */ + strcat(szPath, szDefaultPath); + } + RegSetValueExA(hKey,szValueName,0,REG_SZ,(LPBYTE)szPath,strlen(szPath)+1); } - else - { - strcpy(szPath, szDefaultPath); - } - if (bCreate) - { - CreateDirectoryA(szPath,NULL); - } - RegSetValueExA(hKey,szValueName,0,REG_SZ,(LPBYTE)szPath,strlen(szPath)+1); } RegCloseKey(hKey); + if (bCreate && CreateDirectoryA(szPath,NULL)) + { + MESSAGE("Created not existing system directory '%s'\n", szPath); + } + return TRUE; } /************************************************************************* * SHGetSpecialFolderPathW - * - * converts csidl to path - * */ BOOL WINAPI SHGetSpecialFolderPathW ( HWND hwndOwner, @@ -1228,10 +2005,7 @@ BOOL WINAPI SHGetSpecialFolderPathW ( } /************************************************************************* - * SHGetSpecialFolderPath [SHELL32.175] - * - * converts csidl to path - * + * SHGetSpecialFolderPathAW */ BOOL WINAPI SHGetSpecialFolderPathAW ( HWND hwndOwner, @@ -1246,97 +2020,171 @@ BOOL WINAPI SHGetSpecialFolderPathAW ( } /************************************************************************* - * PathRemoveBackslashA - * - * If the path ends in a backslash it is replaced by a NULL - * and the address of the NULL is returned - * Otherwise - * the address of the last character is returned. + * PathCanonicalizeA * + * FIXME + * returnvalue */ -LPSTR WINAPI PathRemoveBackslashA( LPSTR lpPath ) + +BOOL WINAPI PathCanonicalizeA(LPSTR pszBuf, LPCSTR pszPath) { - LPSTR p = lpPath; + int OffsetMin = 0, OffsetSrc = 0, OffsetDst = 0, LenSrc = strlen(pszPath); + BOOL bModifyed = FALSE; + + TRACE("%p %s\n", pszBuf, pszPath); - while (*lpPath) p = lpPath++; - if ( *p == (CHAR)'\\') *p = (CHAR)'\0'; - return p; -} + pszBuf[OffsetDst]='\0'; -/************************************************************************* - * PathRemoveBackslashW - * - */ -LPWSTR WINAPI PathRemoveBackslashW( LPWSTR lpPath ) -{ - LPWSTR p = lpPath; + /* keep the root of the path */ + if( LenSrc && (pszPath[OffsetSrc]=='\\')) + { + pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--; + } + else if ( (LenSrc >= 2) && (pszPath[OffsetSrc+1] == ':')) + { + pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--; + pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--; + if (LenSrc && (pszPath[OffsetSrc] == '\\')) + { + pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--; + if (LenSrc == 1 && pszPath[OffsetSrc]=='.') + { + /* C:\. */ + OffsetSrc++; LenSrc--; bModifyed = TRUE; + } + else if (LenSrc == 2 && pszPath[OffsetSrc]=='.' && pszPath[OffsetSrc+1]=='.') + { + /* C:\.. */ + OffsetSrc+=2; LenSrc-=2; bModifyed = TRUE; + } + } + } - while (*lpPath); p = lpPath++; - if ( *p == (WCHAR)'\\') *p = (WCHAR)'\0'; - return p; + /* ".\" at the beginning of the path */ + if (LenSrc >= 2 && pszPath[OffsetSrc]=='.' && pszPath[OffsetSrc+1]=='\\') + { + OffsetSrc+=2; LenSrc-=2; bModifyed = TRUE; + } + + while ( LenSrc ) + { + if((LenSrc>=3) && (pszPath[OffsetSrc]=='\\') && (pszPath[OffsetSrc+1]=='.') && (pszPath[OffsetSrc+2]=='.')) + { + /* "\.." found, go one deeper */ + while((OffsetDst > OffsetMin) && (pszBuf[OffsetDst]!='\\')) OffsetDst--; + OffsetSrc += 3; LenSrc -= 3; bModifyed = TRUE; + if(OffsetDst == OffsetMin && pszPath[OffsetSrc]=='\\') OffsetSrc++; + pszBuf[OffsetDst] = '\0'; /* important for \..\.. */ + } + else if(LenSrc>=2 && pszPath[OffsetSrc]=='\\' && pszPath[OffsetSrc+1]=='.' ) + { + /* "\." found, skip it */ + OffsetSrc += 2; LenSrc-=2; bModifyed = TRUE; + } + else + { + pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; LenSrc--; + } + } + pszBuf[OffsetDst] = '\0'; + TRACE("-- %s %u\n", pszBuf, bModifyed); + return bModifyed; +} + + +/************************************************************************* + * PathCanonicalizeW + * + * FIXME + * returnvalue + */ +BOOL WINAPI PathCanonicalizeW(LPWSTR pszBuf, LPCWSTR pszPath) +{ + int OffsetMin = 0, OffsetSrc = 0, OffsetDst = 0, LenSrc = lstrlenW(pszPath); + BOOL bModifyed = FALSE; + + TRACE("%p %s\n", pszBuf, debugstr_w(pszPath)); + + pszBuf[OffsetDst]='\0'; + + /* keep the root of the path */ + if( LenSrc && (pszPath[OffsetSrc]=='\\')) + { + pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--; + } + else if ( (LenSrc >= 2) && (pszPath[OffsetSrc+1] == ':')) + { + pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--; + pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--; + if (LenSrc && (pszPath[OffsetSrc] == '\\')) + { + pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--; + if (LenSrc == 1 && pszPath[OffsetSrc]=='.') + { + /* C:\. */ + OffsetSrc++; LenSrc--; bModifyed = TRUE; + } + else if (LenSrc == 2 && pszPath[OffsetSrc]=='.' && pszPath[OffsetSrc+1]=='.') + { + /* C:\.. */ + OffsetSrc+=2; LenSrc-=2; bModifyed = TRUE; + } + } + } + + /* ".\" at the beginning of the path */ + if (LenSrc >= 2 && pszPath[OffsetSrc]=='.' && pszPath[OffsetSrc+1]=='\\') + { + OffsetSrc+=2; LenSrc-=2; bModifyed = TRUE; + } + + while ( LenSrc ) + { + if((LenSrc>=3) && (pszPath[OffsetSrc]=='\\') && (pszPath[OffsetSrc+1]=='.') && (pszPath[OffsetSrc+2]=='.')) + { + /* "\.." found, go one deeper */ + while((OffsetDst > OffsetMin) && (pszBuf[OffsetDst]!='\\')) OffsetDst--; + OffsetSrc += 3; LenSrc -= 3; bModifyed = TRUE; + if(OffsetDst == OffsetMin && pszPath[OffsetSrc]=='\\') OffsetSrc++; + pszBuf[OffsetDst] = '\0'; /* important for \..\.. */ + } + else if(LenSrc>=2 && pszPath[OffsetSrc]=='\\' && pszPath[OffsetSrc+1]=='.' ) + { + /* "\." found, skip it */ + OffsetSrc += 2; LenSrc-=2; bModifyed = TRUE; + } + else + { + pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; LenSrc--; + } + } + pszBuf[OffsetDst] = '\0'; + TRACE("-- %s %u\n", debugstr_w(pszBuf), bModifyed); + return bModifyed; } /************************************************************************* - * PathIsURLA - * + * PathFindNextComponentA */ -BOOL WINAPI PathIsURLA(LPCSTR lpstrPath) +LPSTR WINAPI PathFindNextComponentA(LPCSTR pszPath) { - LPSTR lpstrRes; - char lpstrFileType[10] = ""; - int iSize; - int i = 0; - /* sanity check */ - if(!lpstrPath) - return FALSE; - - /* get protocol */ - /* protocol://location */ - if(!(lpstrRes = strchr(lpstrPath,':'))) - { - return FALSE; - } - iSize = lpstrRes - lpstrPath; - if(iSize > sizeof(lpstrFileType)) - return FALSE; - - strncpy(lpstrFileType,lpstrPath,iSize); - - while(strlen(SupportedProtocol[i])) - { - if(!_stricmp(lpstrFileType,SupportedProtocol[i++])) - return TRUE; - } - - return FALSE; -} - -/************************************************************************* - * PathIsDirectoryA - * - */ -BOOL WINAPI PathIsDirectoryA(LPCSTR pszPath) -{ - FIXME("%s\n", debugstr_a(pszPath)); - return TRUE; + while( *pszPath ) + { + if(*pszPath++=='\\') + return (LPSTR)((*pszPath)? pszPath : NULL); + } + return NULL; } /************************************************************************* - * PathIsDirectoryW - * + * PathFindNextComponentW */ -BOOL WINAPI PathIsDirectoryW(LPCWSTR pszPath) +LPWSTR WINAPI PathFindNextComponentW(LPCWSTR pszPath) { - FIXME("%s\n", debugstr_w(pszPath)); - return TRUE; -} -/************************************************************************* - * PathIsDirectory - * - */ -BOOL WINAPI PathIsDirectoryAW (LPCVOID pszPath) -{ - if (VERSION_OsIsUnicode()) - return PathIsDirectoryW (pszPath); - return PathIsDirectoryA (pszPath); + while( *pszPath ) + { + if(*pszPath++=='\\') + return (LPWSTR)((*pszPath)? pszPath : NULL); + } + return NULL; } diff --git a/dlls/shell32/shlfileop.c b/dlls/shell32/shlfileop.c index f3954ce1787..c73fb532179 100644 --- a/dlls/shell32/shlfileop.c +++ b/dlls/shell32/shlfileop.c @@ -8,16 +8,33 @@ #include "winversion.h" #include "shlobj.h" +#include "shresdef.h" +#include "wine/undocshell.h" DEFAULT_DEBUG_CHANNEL(shell); +#define ASK_DELETE_FILE 1 +#define ASK_DELETE_FOLDER 2 +#define ASK_DELETE_MULTIPLE_FILE 3 + +static BOOL SHELL_WarnFolderDelete (int nKindOfDialog, LPCSTR szDir) +{ + char szCaption[255], szText[255], szBuffer[256]; + + LoadStringA(shell32_hInstance, IDS_DELETEFOLDER_TEXT, szText, sizeof(szText)); + LoadStringA(shell32_hInstance, IDS_DELETEFOLDER_CAPTION, szCaption, sizeof(szCaption)); + FormatMessageA(FORMAT_MESSAGE_FROM_STRING, szText, 0,0, szBuffer, sizeof(szBuffer), (DWORD*)&szDir); + + return (IDOK == MessageBoxA(GetActiveWindow(),szText, szCaption, MB_OKCANCEL | MB_ICONEXCLAMATION)); +} + /************************************************************************** * SHELL_DeleteDirectoryA() * * like rm -r */ -BOOL SHELL_DeleteDirectoryA(LPCSTR pszDir) +BOOL SHELL_DeleteDirectoryA(LPCSTR pszDir, BOOL bShowUI) { BOOL ret = FALSE; HANDLE hFind; @@ -28,6 +45,8 @@ BOOL SHELL_DeleteDirectoryA(LPCSTR pszDir) PathAddBackslashA(szTemp); strcat(szTemp, "*.*"); + if (bShowUI && !SHELL_WarnFolderDelete(ASK_DELETE_FOLDER, pszDir)) return FALSE; + if(INVALID_HANDLE_VALUE != (hFind = FindFirstFileA(szTemp, &wfd))) { do @@ -39,7 +58,7 @@ BOOL SHELL_DeleteDirectoryA(LPCSTR pszDir) strcat(szTemp, wfd.cFileName); if(FILE_ATTRIBUTE_DIRECTORY & wfd.dwFileAttributes) - SHELL_DeleteDirectoryA(szTemp); + SHELL_DeleteDirectoryA(szTemp, FALSE); else DeleteFileA(szTemp); } @@ -124,3 +143,22 @@ DWORD WINAPI SHFileOperationAW(LPVOID lpFileOp) return SHFileOperationW(lpFileOp); return SHFileOperationA(lpFileOp); } + +/************************************************************************* + * SheGetDirW [SHELL32.281] + * + */ +HRESULT WINAPI SheGetDirW(LPWSTR u, LPWSTR v) +{ FIXME("%p %p stub\n",u,v); + return 0; +} + +/************************************************************************* + * SheChangeDirW [SHELL32.274] + * + */ +HRESULT WINAPI SheChangeDirW(LPWSTR u) +{ FIXME("(%s),stub\n",debugstr_w(u)); + return 0; +} + diff --git a/dlls/shell32/shlfolder.c b/dlls/shell32/shlfolder.c index 5512f71035c..641e300aa28 100644 --- a/dlls/shell32/shlfolder.c +++ b/dlls/shell32/shlfolder.c @@ -208,6 +208,70 @@ static HRESULT SHELL32_GetDisplayNameOfChild( return hr; } +/*********************************************************************** + * SHELL32_GetItemAttributes + * + * NOTES + * observerd values: + * folder: 0xE0000177 FILESYSTEM | HASSUBFOLDER | FOLDER + * file: 0x40000177 FILESYSTEM + * drive: 0xf0000144 FILESYSTEM | HASSUBFOLDER | FOLDER | FILESYSANCESTOR + * mycomputer: 0xb0000154 HASSUBFOLDER | FOLDER | FILESYSANCESTOR + * (seems to be default for shell extensions if no registry entry exists) + * + * This functions does not set flags!! It only resets flags when nessesary. + */ +static HRESULT SHELL32_GetItemAttributes( + IShellFolder * psf, + LPITEMIDLIST pidl, + LPDWORD pdwAttributes) +{ + GUID const * clsid; + DWORD dwAttributes; + + TRACE("0x%08lx\n", *pdwAttributes); + + if (*pdwAttributes & (0xcff3fe88)) + WARN("attribute 0x%08lx not implemented\n", *pdwAttributes); + *pdwAttributes &= ~SFGAO_LINK; /* FIXME: for native filedialogs */ + + if (_ILIsDrive(pidl)) + { + *pdwAttributes &= 0xf0000144; + } + else if ((clsid=_ILGetGUIDPointer(pidl))) + { + if (HCR_GetFolderAttributes(clsid, &dwAttributes)) + { + *pdwAttributes &= dwAttributes; + } + else + { + *pdwAttributes &= 0xb0000154; + } + } + else if (_ILGetDataPointer(pidl)) + { + dwAttributes = _ILGetFileAttributes(pidl, NULL, 0); + *pdwAttributes &= ~SFGAO_FILESYSANCESTOR; + + if(( SFGAO_FOLDER & *pdwAttributes) && !(dwAttributes & FILE_ATTRIBUTE_DIRECTORY)) + *pdwAttributes &= ~(SFGAO_FOLDER|SFGAO_HASSUBFOLDER); + + if(( SFGAO_HIDDEN & *pdwAttributes) && !(dwAttributes & FILE_ATTRIBUTE_HIDDEN)) + *pdwAttributes &= ~SFGAO_HIDDEN; + + if(( SFGAO_READONLY & *pdwAttributes) && !(dwAttributes & FILE_ATTRIBUTE_READONLY)) + *pdwAttributes &= ~SFGAO_READONLY; + } + else + { + *pdwAttributes &= 0xb0000154; + } + TRACE("-- 0x%08lx\n", *pdwAttributes); + return S_OK; +} + /*********************************************************************** * IShellFolder implementation */ @@ -604,6 +668,17 @@ static HRESULT WINAPI IShellFolder_fnParseDisplayName( } else { + if (pdwAttributes && *pdwAttributes) + { + SHELL32_GetItemAttributes(_IShellFolder_(This), pidlTemp, pdwAttributes); +/* WIN32_FIND_DATAA fd; + SHGetDataFromIDListA(_IShellFolder_(This), pidlTemp, SHGDFIL_FINDDATA, &fd, sizeof(fd)); + if (!(FILE_ATTRIBUTE_DIRECTORY & fd.dwFileAttributes)) + *pdwAttributes &= ~SFGAO_FOLDER; + if (FILE_ATTRIBUTE_READONLY & fd.dwFileAttributes) + *pdwAttributes &= ~(SFGAO_CANDELETE|SFGAO_CANMOVE|SFGAO_CANRENAME ); +*/ + } hr = S_OK; } } @@ -682,12 +757,17 @@ static HRESULT WINAPI IShellFolder_fnBindToObject( IShellFolder2 * iface, LPCITE return E_FAIL; } } - else + else if(_ILIsFolder(pidl)) { LPITEMIDLIST pidltemp = ILCloneFirst(pidl); pShellFolder = IShellFolder_Constructor(iface, pidltemp); ILFree(pidltemp); } + else + { + ERR("can't bind to a file\n"); + return E_FAIL; + } if (_ILIsPidlSimple(pidl)) { @@ -901,19 +981,8 @@ static HRESULT WINAPI IShellFolder_fnGetAttributesOf( while (cidl > 0 && *apidl) { pdump (*apidl); - if (_ILIsFolder( *apidl)) - { - *rgfInOut &= 0xe0000177; - goto next; - } - else if (_ILIsValue( *apidl)) - { - *rgfInOut &= 0x40000177; - goto next; - } - hr = E_INVALIDARG; - -next: apidl++; + SHELL32_GetItemAttributes(_IShellFolder_(This), *apidl, rgfInOut); + apidl++; cidl--; } @@ -1436,7 +1505,7 @@ static HRESULT WINAPI ISFHelper_fnDeleteItems( LPITEMIDLIST pidl; MESSAGE("delete %s\n", szPath); - if (! RemoveDirectoryA(szPath)) return E_FAIL; + if (! SHELL_DeleteDirectoryA(szPath, TRUE)) return E_FAIL; pidl = ILCombine(This->absPidl, apidl[i]); SHChangeNotifyA(SHCNE_RMDIR, SHCNF_IDLIST, pidl, NULL); SHFree(pidl); @@ -1625,6 +1694,11 @@ static HRESULT WINAPI ISF_Desktop_fnParseDisplayName( else { hr = S_OK; + + if (pdwAttributes && *pdwAttributes) + { + SHELL32_GetItemAttributes(_IShellFolder_(This), pidlTemp, pdwAttributes); + } } *ppidl = pidlTemp; @@ -1769,12 +1843,14 @@ static HRESULT WINAPI ISF_Desktop_fnCreateViewObject( IShellFolder2 * iface, /************************************************************************** * ISF_Desktop_fnGetAttributesOf */ -static HRESULT WINAPI ISF_Desktop_fnGetAttributesOf(IShellFolder2 * iface,UINT cidl,LPCITEMIDLIST *apidl,DWORD *rgfInOut) +static HRESULT WINAPI ISF_Desktop_fnGetAttributesOf( + IShellFolder2 * iface, + UINT cidl, + LPCITEMIDLIST *apidl, + DWORD *rgfInOut) { _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) - GUID const * clsid; - DWORD attributes; HRESULT hr = S_OK; TRACE("(%p)->(cidl=%d apidl=%p mask=0x%08lx)\n",This,cidl,apidl, *rgfInOut); @@ -1785,37 +1861,8 @@ static HRESULT WINAPI ISF_Desktop_fnGetAttributesOf(IShellFolder2 * iface,UINT c while (cidl > 0 && *apidl) { pdump (*apidl); - - if ((clsid=_ILGetGUIDPointer(*apidl))) - { - if (IsEqualIID(clsid, &CLSID_MyComputer)) - { - *rgfInOut &= 0xb0000154; - goto next; - } - else if (HCR_GetFolderAttributes(clsid, &attributes)) - { - *rgfInOut &= attributes; - goto next; - } - else - { /* some shell-extension */ - *rgfInOut &= 0xb0000154; - } - } - else if (_ILIsFolder( *apidl)) - { - *rgfInOut &= 0xe0000177; - goto next; - } - else if (_ILIsValue( *apidl)) - { - *rgfInOut &= 0x40000177; - goto next; - } - hr = E_INVALIDARG; - -next: apidl++; + SHELL32_GetItemAttributes(_IShellFolder_(This), *apidl, rgfInOut); + apidl++; cidl--; } @@ -2086,6 +2133,10 @@ static HRESULT WINAPI ISF_MyComputer_fnParseDisplayName( } else { + if (pdwAttributes && *pdwAttributes) + { + SHELL32_GetItemAttributes(_IShellFolder_(This), pidlTemp, pdwAttributes); + } hr = S_OK; } *ppidl = pidlTemp; @@ -2213,12 +2264,14 @@ static HRESULT WINAPI ISF_MyComputer_fnCreateViewObject( IShellFolder2 * iface, /************************************************************************** * ISF_MyComputer_fnGetAttributesOf */ -static HRESULT WINAPI ISF_MyComputer_fnGetAttributesOf(IShellFolder2 * iface,UINT cidl,LPCITEMIDLIST *apidl,DWORD *rgfInOut) +static HRESULT WINAPI ISF_MyComputer_fnGetAttributesOf( + IShellFolder2 * iface, + UINT cidl, + LPCITEMIDLIST *apidl, + DWORD *rgfInOut) { _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) - GUID const * clsid; - DWORD attributes; HRESULT hr = S_OK; TRACE("(%p)->(cidl=%d apidl=%p mask=0x%08lx)\n",This,cidl,apidl,*rgfInOut); @@ -2226,28 +2279,11 @@ static HRESULT WINAPI ISF_MyComputer_fnGetAttributesOf(IShellFolder2 * iface,UIN if ( (!cidl) || (!apidl) || (!rgfInOut)) return E_INVALIDARG; - *rgfInOut = 0xffffffff; - while (cidl > 0 && *apidl) { pdump (*apidl); - - if (_ILIsDrive(*apidl)) - { - *rgfInOut &= 0xf0000144; - goto next; - } - else if ((clsid=_ILGetGUIDPointer(*apidl))) - { - if (HCR_GetFolderAttributes(clsid, &attributes)) - { - *rgfInOut &= attributes; - goto next; - } - } - hr = E_INVALIDARG; - -next: apidl++; + SHELL32_GetItemAttributes(_IShellFolder_(This), *apidl, rgfInOut); + apidl++; cidl--; } diff --git a/dlls/shell32/shlmenu.c b/dlls/shell32/shlmenu.c index dea173e8403..5b41ccc33db 100644 --- a/dlls/shell32/shlmenu.c +++ b/dlls/shell32/shlmenu.c @@ -444,7 +444,7 @@ HMENU WINAPI FileMenu_FindSubMenuByPidl( /************************************************************************* * FileMenu_AppendFilesForPidl [SHELL32.124] */ -HMENU WINAPI FileMenu_AppendFilesForPidl( +int WINAPI FileMenu_AppendFilesForPidl( HMENU hmenu, LPCITEMIDLIST pidl, BOOL bAddSeperator) @@ -490,7 +490,7 @@ int WINAPI FileMenu_AddFilesForPidl ( /************************************************************************* * FileMenu_TrackPopupMenuEx [SHELL32.116] */ -HRESULT WINAPI FileMenu_TrackPopupMenuEx ( +BOOL WINAPI FileMenu_TrackPopupMenuEx ( HMENU hMenu, UINT uFlags, int x, diff --git a/dlls/shell32/shlwapi.spec b/dlls/shell32/shlwapi.spec index c12c65de6a4..13e5be701b3 100644 --- a/dlls/shell32/shlwapi.spec +++ b/dlls/shell32/shlwapi.spec @@ -176,11 +176,11 @@ type win32 @ stub PathAddExtensionA @ stub PathAddExtensionW @ stdcall PathAppendA (str str) PathAppendA -@ stub PathAppendW +@ stdcall PathAppendW (str str) PathAppendW @ stdcall PathBuildRootA (ptr long) PathBuildRootA -@ stub PathBuildRootW -@ stub PathCanonicalizeA -@ stub PathCanonicalizeW +@ stdcall PathBuildRootW (ptr long) PathBuildRootW +@ stdcall PathCanonicalizeA (ptr str) PathCanonicalizeA +@ stdcall PathCanonicalizeW (ptr wstr) PathCanonicalizeW @ stdcall PathCombineA (ptr ptr ptr) PathCombineA @ stdcall PathCombineW (ptr ptr ptr) PathCombineW @ stub PathCommonPrefixA @@ -192,21 +192,21 @@ type win32 @ stub PathCreateFromUrlA @ stub PathCreateFromUrlW @ stdcall PathFileExistsA (str) PathFileExistsA -@ stub PathFileExistsW -@ stdcall PathFindExtensionA (ptr) PathFindExtensionA -@ stdcall PathFindExtensionW (ptr) PathFindExtensionW -@ stdcall PathFindFileNameA (ptr) PathFindFilenameA -@ stdcall PathFindFileNameW (ptr) PathFindFilenameW -@ stub PathFindNextComponentA -@ stub PathFindNextComponentW -@ stdcall PathFindOnPathA (ptr ptr) PathFindOnPathA -@ stdcall PathFindOnPathW (ptr ptr) PathFindOnPathW +@ stdcall PathFileExistsW (wstr) PathFileExistsW +@ stdcall PathFindExtensionA (str) PathFindExtensionA +@ stdcall PathFindExtensionW (wstr) PathFindExtensionW +@ stdcall PathFindFileNameA (str) PathFindFileNameA +@ stdcall PathFindFileNameW (wstr) PathFindFileNameW +@ stdcall PathFindNextComponentA (str) PathFindNextComponentA +@ stdcall PathFindNextComponentW (wstr) PathFindNextComponentW +@ stdcall PathFindOnPathA (str ptr) PathFindOnPathA +@ stdcall PathFindOnPathW (wstr ptr) PathFindOnPathW @ stdcall PathGetArgsA (str) PathGetArgsA -@ stdcall PathGetArgsW (str) PathGetArgsW +@ stdcall PathGetArgsW (wstr) PathGetArgsW @ stub PathGetCharTypeA @ stub PathGetCharTypeW -@ stdcall PathGetDriveNumberA(str) PathGetDriveNumberA -@ stdcall PathGetDriveNumberW(str) PathGetDriveNumberW +@ stdcall PathGetDriveNumberA (str) PathGetDriveNumberA +@ stdcall PathGetDriveNumberW (wstr) PathGetDriveNumberW @ stub PathIsContentTypeA @ stub PathIsContentTypeW @ stdcall PathIsDirectoryA(str) PathIsDirectoryA @@ -215,44 +215,44 @@ type win32 @ stub PathIsFileSpecW @ stub PathIsPrefixA @ stub PathIsPrefixW -@ stdcall PathIsRelativeA (ptr) PathIsRelativeA -@ stdcall PathIsRelativeW (ptr) PathIsRelativeW +@ stdcall PathIsRelativeA (str) PathIsRelativeA +@ stdcall PathIsRelativeW (wstr) PathIsRelativeW @ stdcall PathIsRootA(str) PathIsRootA @ stdcall PathIsRootW(wstr) PathIsRootW -@ stub PathIsSameRootA -@ stub PathIsSameRootW +@ stdcall PathIsSameRootA(str str) PathIsSameRootA +@ stdcall PathIsSameRootW(wstr wstr) PathIsSameRootW @ stub PathIsSystemFolderA @ stub PathIsSystemFolderW -@ stdcall PathIsUNCA (ptr) PathIsUNCA +@ stdcall PathIsUNCA (str) PathIsUNCA @ stub PathIsUNCServerA @ stub PathIsUNCServerShareA @ stub PathIsUNCServerShareW @ stub PathIsUNCServerW @ stdcall PathIsUNCW(wstr) PathIsUNCW @ stdcall PathIsURLA(str) PathIsURLA -@ stub PathIsURLW +@ stdcall PathIsURLW(wstr) PathIsURLW @ stub PathMakePrettyA @ stub PathMakePrettyW @ stub PathMakeSystemFolderA @ stub PathMakeSystemFolderW @ stdcall PathMatchSpecA (str str) PathMatchSpecA @ stdcall PathMatchSpecW (str str) PathMatchSpecW -@ stub PathParseIconLocationA -@ stub PathParseIconLocationW +@ stdcall PathParseIconLocationA (str) PathParseIconLocationA +@ stdcall PathParseIconLocationW (wstr) PathParseIconLocationW @ stdcall PathQuoteSpacesA (ptr) PathQuoteSpacesA @ stdcall PathQuoteSpacesW (ptr) PathQuoteSpacesW @ stub PathRelativePathToA @ stub PathRelativePathToW -@ stub PathRemoveArgsA -@ stub PathRemoveArgsW -@ stdcall PathRemoveBackslashA (ptr) PathRemoveBackslashA -@ stdcall PathRemoveBackslashW (ptr) PathRemoveBackslashW +@ stdcall PathRemoveArgsA(str)PathRemoveArgsA +@ stdcall PathRemoveArgsW(wstr)PathRemoveArgsW +@ stdcall PathRemoveBackslashA (str) PathRemoveBackslashA +@ stdcall PathRemoveBackslashW (wstr) PathRemoveBackslashW @ stdcall PathRemoveBlanksA(str) PathRemoveBlanksA @ stdcall PathRemoveBlanksW(wstr) PathRemoveBlanksW -@ stub PathRemoveExtensionA -@ stub PathRemoveExtensionW +@ stdcall PathRemoveExtensionA(str)PathRemoveExtensionA +@ stdcall PathRemoveExtensionW(wstr)PathRemoveExtensionW @ stdcall PathRemoveFileSpecA (str) PathRemoveFileSpecA -@ stub PathRemoveFileSpecW +@ stdcall PathRemoveFileSpecW (wstr) PathRemoveFileSpecW @ stub PathRenameExtensionA @ stub PathRenameExtensionW @ stub PathSearchAndQualifyA @@ -261,19 +261,19 @@ type win32 @ stdcall PathSetDlgItemPathW (long long ptr) PathSetDlgItemPathW @ stub PathSkipRootA @ stub PathSkipRootW -@ stub PathStripPathA -@ stub PathStripPathW -@ stub PathStripToRootA -@ stub PathStripToRootW +@ stdcall PathStripPathA(str)PathStripPathA +@ stdcall PathStripPathW(wstr)PathStripPathW +@ stdcall PathStripToRootA(str)PathStripToRootA +@ stdcall PathStripToRootW(wstr)PathStripToRootW @ stub PathUnmakeSystemFolderA @ stub PathUnmakeSystemFolderW @ stdcall PathUnquoteSpacesA (str) PathUnquoteSpacesA -@ stdcall PathUnquoteSpacesW (str) PathUnquoteSpacesW +@ stdcall PathUnquoteSpacesW (wstr) PathUnquoteSpacesW @ stub SHCreateShellPalette @ stub SHDeleteEmptyKeyA @ stub SHDeleteEmptyKeyW @ stdcall SHDeleteKeyA(long str)SHRegDeleteKeyA -@ stdcall SHDeleteKeyW(long str)SHRegDeleteKeyW +@ stdcall SHDeleteKeyW(long wstr)SHRegDeleteKeyW @ stub SHDeleteOrphanKeyA @ stub SHDeleteOrphanKeyW @ stub SHDeleteValueA diff --git a/dlls/shell32/shres.rc b/dlls/shell32/shres.rc index 03166413232..d5ea4112721 100644 --- a/dlls/shell32/shres.rc +++ b/dlls/shell32/shres.rc @@ -129,6 +129,8 @@ STRINGTABLE DISCARDABLE { IDS_CREATEFOLDER_DENIED "Can not create new Folder: Permission denied." IDS_CREATEFOLDER_CAPTION "Error during creating a new folder" + IDS_DELETEFOLDER_TEXT "Are you sure you want to delete %1 and all it's subfolders?" + IDS_DELETEFOLDER_CAPTION "Confirm file delete" } shv_accel ACCELERATORS diff --git a/dlls/shell32/shresdef.h b/dlls/shell32/shresdef.h index dfd2faecc27..7ac2d724c10 100644 --- a/dlls/shell32/shresdef.h +++ b/dlls/shell32/shresdef.h @@ -24,5 +24,6 @@ #define IDS_CREATEFOLDER_DENIED 30 #define IDS_CREATEFOLDER_CAPTION 31 - +#define IDS_DELETEFOLDER_TEXT 32 +#define IDS_DELETEFOLDER_CAPTION 33 #endif diff --git a/dlls/shell32/shv_bg_cmenu.c b/dlls/shell32/shv_bg_cmenu.c index b9b1b733aae..402fd622809 100644 --- a/dlls/shell32/shv_bg_cmenu.c +++ b/dlls/shell32/shv_bg_cmenu.c @@ -16,6 +16,7 @@ #include "shell32_main.h" #include "shellfolder.h" #include "shell.h" /* DROPFILESTRUCT */ +#include "wine/undocshell.h" DEFAULT_DEBUG_CHANNEL(shell) diff --git a/include/shell.h b/include/shell.h index 8a5e5c6c57b..bd43f456fe2 100644 --- a/include/shell.h +++ b/include/shell.h @@ -65,6 +65,7 @@ typedef struct { WORD cb; /* nr of bytes in this item */ BYTE abID[1];/* first byte in this item */ } SHITEMID,*LPSHITEMID; +typedef LPSHITEMID const LPCSHITEMID; typedef struct { SHITEMID mkid; /* first itemid in list */ @@ -87,94 +88,11 @@ DWORD WINAPI SHAddToRecentDocs(UINT uFlags, LPCVOID pv); * SHGetSpecialFolderLocation API */ HRESULT WINAPI SHGetSpecialFolderLocation(HWND, INT, LPITEMIDLIST *); -/**************************************************************************** -* string and path functions -*/ -BOOL WINAPI PathIsRootA(LPCSTR x); -BOOL WINAPI PathIsRootW(LPCWSTR x); -#define PathIsRoot WINELIB_NAME_AW(PathIsRoot) -BOOL WINAPI PathIsRootAW(LPCVOID x); - -LPSTR WINAPI PathAddBackslashA(LPSTR path); -LPWSTR WINAPI PathAddBackslashW(LPWSTR path); -#define PathAddBackslash WINELIB_NAME_AW(PathAddBackslash) -LPVOID WINAPI PathAddBackslashAW(LPVOID path); - -BOOL WINAPI PathQualifyA(LPCSTR path); -BOOL WINAPI PathQualifyW(LPCWSTR path); -#define PathQualify WINELIB_NAME_AW(PathQualify) -BOOL WINAPI PathQualifyAW(LPCVOID path); - -LPSTR WINAPI PathQuoteSpacesA(LPCSTR path); -LPWSTR WINAPI PathQuoteSpacesW(LPCWSTR path); -#define PathQuoteSpaces WINELIB_NAME_AW(PathQuoteSpaces) -LPVOID WINAPI PathQuoteSpacesAW(LPCVOID path); - -LPSTR WINAPI PathCombineA(LPSTR szDest, LPCSTR lpszDir, LPCSTR lpszFile); -LPWSTR WINAPI PathCombineW(LPWSTR szDest, LPCWSTR lpszDir, LPCWSTR lpszFile); -#define PathCombine WINELIB_NAME_AW(PathCombine) -LPVOID WINAPI PathCombineAW(LPVOID szDest, LPCVOID lpszDir, LPCVOID lpszFile); - -LPCSTR WINAPI PathFindExtensionA(LPCSTR path); -LPCWSTR WINAPI PathFindExtensionW(LPCWSTR path); -#define PathFindExtension WINELIB_NAME_AW(PathFindExtension) -LPCVOID WINAPI PathFindExtensionAW(LPCVOID path); - -LPCSTR WINAPI PathGetExtensionA(LPCSTR path, DWORD y, DWORD x); -LPCWSTR WINAPI PathGetExtensionW(LPCWSTR path, DWORD y, DWORD x); -#define PathGetExtension WINELIB_NAME_AW(PathGetExtension) -LPCVOID WINAPI PathGetExtensionAW(LPCVOID path, DWORD y, DWORD x); - -LPCSTR WINAPI PathFindFilenameA(LPCSTR path); -LPCWSTR WINAPI PathFindFilenameW(LPCWSTR path); -#define PathFindFilename WINELIB_NAME_AW(PathFindFilename) -LPCVOID WINAPI PathFindFilenameAW(LPCVOID path); - -BOOL WINAPI PathMatchSpecA(LPCSTR x, LPCSTR y); -BOOL WINAPI PathMatchSpecW(LPCWSTR x, LPCWSTR y); -#define PathMatchSpec WINELIB_NAME_AW(PathMatchSpec) -BOOL WINAPI PathMatchSpecAW(LPVOID x, LPVOID y); - -LPSTR WINAPI PathRemoveBlanksA(LPSTR str); -LPWSTR WINAPI PathRemoveBlanksW(LPWSTR str); -#define PathRemoveBlanks WINELIB_NAME_AW(PathRemoveBlanks) -LPVOID WINAPI PathRemoveBlanksAW(LPVOID str); - -BOOL WINAPI PathIsRelativeA(LPCSTR str); -BOOL WINAPI PathIsRelativeW(LPCWSTR str); -#define PathIsRelative WINELIB_NAME_AW(PathIsRelative) -BOOL WINAPI PathIsRelativeAW(LPCVOID str); - -BOOL WINAPI PathIsUNCA(LPCSTR str); -BOOL WINAPI PathIsUNCW(LPCWSTR str); -#define PathIsUNC WINELIB_NAME_AW(PathIsUNC) -BOOL WINAPI PathIsUNCAW(LPCVOID str); - -BOOL WINAPI PathIsURLA(LPCSTR str); -BOOL WINAPI PathIsURLW(LPCWSTR str); -#define PathIsURL WINELIB_NAME_AW(PathIsURL) -BOOL WINAPI PathIsURLAW(LPCVOID str); - -BOOL WINAPI PathFindOnPathA(LPSTR sFile, LPCSTR sOtherDirs); -BOOL WINAPI PathFindOnPathW(LPWSTR sFile, LPCWSTR sOtherDirs); -#define PathFindOnPath WINELIB_NAME_AW(PathFindOnPath) -BOOL WINAPI PathFindOnPathAW(LPVOID sFile, LPCVOID sOtherDirs); - -LPSTR WINAPI StrFormatByteSizeA ( DWORD dw, LPSTR pszBuf, UINT cchBuf ); -LPWSTR WINAPI StrFormatByteSizeW ( DWORD dw, LPWSTR pszBuf, UINT cchBuf ); -#define StrFormatByteSize WINELIB_NAME_AW(StrFormatByteSize) - -DWORD WINAPI PathCleanupSpecA(LPSTR x, LPSTR y); -DWORD WINAPI PathCleanupSpecW(LPWSTR x, LPWSTR y); -#define PathCleanupSpec WINELIB_NAME_AW(PathCleanupSpec) /**************************************************************************** * other functions */ -LPVOID WINAPI SHAlloc(DWORD len); -DWORD WINAPI SHFree(LPVOID x); - #define CSIDL_DESKTOP 0x0000 #define CSIDL_PROGRAMS 0x0002 #define CSIDL_CONTROLS 0x0003 diff --git a/include/shlobj.h b/include/shlobj.h index f245399ad39..a1ac5883fc7 100644 --- a/include/shlobj.h +++ b/include/shlobj.h @@ -72,13 +72,9 @@ extern UINT cfFileContents; * IShellView interface */ - - typedef GUID SHELLVIEWID; #define SV_CLASS_NAME ("SHELLDLL_DefView") -UINT WINAPI SHMapPIDLToSystemImageListIndex(LPSHELLFOLDER sh, LPITEMIDLIST pidl, UINT * pIndex); - /**************************************************************************** * IShellIcon interface */ @@ -341,29 +337,6 @@ typedef struct _SHELLVIEWDATA /* idl */ DWORD WINAPI SHGetMalloc(LPMALLOC *lpmal) ; -/**************************************************************************** - * Shell File Menu API - */ -/* FileMenu_Create nSelHeight */ -#define FM_FULL_SELHEIGHT -1; -#define FM_DEFAULT_SELHEIGHT 0 - -/* FileMenu_Create uFlags */ -#define FMF_SMALL_ICONS 0x00 -#define FMF_LARGE_ICONS 0x08 -#define FMF_NO_COLUMN_BREAK 0x10 - -/* FileMenu_InsertUsingPidl uFlags */ -#define FMF_NO_EMPTY_ITEM 0x01 -#define FMF_NO_PROGRAM_GROUPS 0x04 - -typedef void (CALLBACK * LPFNFMCALLBACK)(LPCITEMIDLIST pidlFolder, LPCITEMIDLIST pidlFile); - -/* FileMenu_AppendItem lpszText */ -#define FM_SEPARATOR (LPCSTR)1 -#define FM_BLANK_ICON -1 -#define FM_DEFAULT_HEIGHT 0 - /********************************************************************** * SHGetSettings () */ diff --git a/include/shlwapi.h b/include/shlwapi.h new file mode 100644 index 00000000000..36ffdf6ba98 --- /dev/null +++ b/include/shlwapi.h @@ -0,0 +1,36 @@ +#ifndef __WINE_SHLWAPI_H +#define __WINE_SHLWAPI_H + +#include "windef.h" +#include "wine/obj_queryassociations.h" + +#ifdef __cplusplus +extern "C" { +#endif /* defined(__cplusplus) */ + +LPSTR WINAPI PathFindFileNameA(LPCSTR pPath); +LPWSTR WINAPI PathFindFileNameW(LPCWSTR pPath); +#define PathFindFileName WINELIB_NAME_AW(PathFindFileName) +LPVOID WINAPI PathFindFileNameAW(LPCVOID path); + +int WINAPI PathGetDriveNumberA(LPCSTR lpszPath); +int WINAPI PathGetDriveNumberW(LPCWSTR lpszPath); +#define PathGetDriveNumber WINELIB_NAME_AW(PathGetDriveNumber) + +BOOL WINAPI PathCanonicalizeA(LPSTR lpszDst, LPCSTR lpszSrc); +BOOL WINAPI PathCanonicalizeW(LPWSTR lpszDst, LPCWSTR lpszSrc); +#define PathCanonicalize WINELIB_NAME_AW(PathCanonicalize) + +LPSTR WINAPI PathFindNextComponentA(LPCSTR pszPath); +LPWSTR WINAPI PathFindNextComponentW(LPCWSTR pszPath); +#define PathFindNextComponent WINELIB_NAME_AW(PathFindNextComponent) + +BOOL WINAPI PathIsURLA(LPCSTR pszPath); +BOOL WINAPI PathIsURLW(LPCWSTR pszPath); +#define PathIsURL WINELIB_NAME_AW(PathIsURL) + +#ifdef __cplusplus +} /* extern "C" */ +#endif /* defined(__cplusplus) */ + +#endif /* __WINE_SHLWAPI_H */ diff --git a/include/wine/obj_shellbrowser.h b/include/wine/obj_shellbrowser.h index 6b1a9ae59dd..368cf50b564 100644 --- a/include/wine/obj_shellbrowser.h +++ b/include/wine/obj_shellbrowser.h @@ -58,14 +58,6 @@ DEFINE_SHLGUID(IID_IShellBrowser, 0x000214E2L, 0, 0); #define FCT_CONFIGABLE 0x0002 #define FCT_ADDTOEND 0x0004 -/* undocumented, found in the web posted by Chris Becke */ -#define CWM_SETPATH (WM_USER+2) -#define CWM_WANTIDLE (WM_USER+3) -#define CWM_GETSETCURRENTINFO (WM_USER+4) -#define CWM_SELECTITEM (WM_USER+5) -#define CWM_STOPWAITING (WM_USER+6) -#define CWM_GETISHELLBROWSER (WM_USER+7) - #define ICOM_INTERFACE IShellBrowser #define IShellBrowser_METHODS \ ICOM_METHOD2(HRESULT, InsertMenusSB, HMENU, hmenuShared, LPOLEMENUGROUPWIDTHS, lpMenuWidths) \ diff --git a/include/wine/undocshell.h b/include/wine/undocshell.h index 1bdd0394e68..5ae92a53ddd 100644 --- a/include/wine/undocshell.h +++ b/include/wine/undocshell.h @@ -2,8 +2,11 @@ #define __WINE_UNDOCSHELL_H #include "windef.h" -#include "shell.h" -#include "wine/obj_shellfolder.h" /* strret */ +//#include "shell.h" +#include "commctrl.h" +#include "wine/obj_shellfolder.h" +#include "wine/obj_shellview.h" +#include "wine/obj_dragdrop.h" #ifdef __cplusplus extern "C" { @@ -14,46 +17,113 @@ extern "C" { */ LPITEMIDLIST WINAPI ILClone (LPCITEMIDLIST pidl); LPITEMIDLIST WINAPI ILCloneFirst(LPCITEMIDLIST pidl); -LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST iil1,LPCITEMIDLIST iil2); + +LPITEMIDLIST WINAPI ILCombine( + LPCITEMIDLIST iil1, + LPCITEMIDLIST iil2); DWORD WINAPI ILGetSize(LPITEMIDLIST pidl); LPITEMIDLIST WINAPI ILGetNext(LPITEMIDLIST pidl); LPITEMIDLIST WINAPI ILFindLastID(LPITEMIDLIST pidl); BOOL WINAPI ILRemoveLastID(LPCITEMIDLIST pidl); -LPITEMIDLIST WINAPI ILFindChild(LPCITEMIDLIST pidl1,LPCITEMIDLIST pidl2); -BOOL WINAPI ILIsEqual(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2); +LPITEMIDLIST WINAPI ILFindChild( + LPCITEMIDLIST pidl1, + LPCITEMIDLIST pidl2); -BOOL WINAPI ILGetDisplayName(LPCITEMIDLIST pidl,LPSTR path); +LPITEMIDLIST WINAPI ILAppendID( + LPITEMIDLIST pidl, + LPCSHITEMID lpItemID, + BOOL bAddToEnd); + +BOOL WINAPI ILIsEqual( + LPCITEMIDLIST pidl1, + LPCITEMIDLIST pidl2); + +BOOL WINAPI ILIsParent( + LPCITEMIDLIST pidlParent, + LPCITEMIDLIST pidlChild, + BOOL bImmediate); + +BOOL WINAPI ILGetDisplayName( + LPCITEMIDLIST pidl, + LPSTR path); DWORD WINAPI ILFree(LPITEMIDLIST pidl); +HRESULT WINAPI ILSaveToStream( + LPSTREAM pstrm, + LPCITEMIDLIST pidl); + +HRESULT WINAPI ILLoadFromStream( + LPSTREAM pstrm, + LPITEMIDLIST *ppidl); + +LPITEMIDLIST WINAPI ILGlobalClone(LPCITEMIDLIST pidl); +void WINAPI ILGlobalFree(LPCITEMIDLIST pidl); + LPITEMIDLIST WINAPI SHSimpleIDListFromPathA (LPCSTR lpszPath); LPITEMIDLIST WINAPI SHSimpleIDListFromPathW (LPCWSTR lpszPath); LPITEMIDLIST WINAPI SHSimpleIDListFromPathAW (LPCVOID lpszPath); -HRESULT WINAPI SHILCreateFromPathA (LPCSTR path, LPITEMIDLIST * ppidl, DWORD *attributes); -HRESULT WINAPI SHILCreateFromPathW (LPCWSTR path, LPITEMIDLIST * ppidl, DWORD *attributes); -HRESULT WINAPI SHILCreateFromPathAW (LPCVOID path, LPITEMIDLIST * ppidl, DWORD *attributes); +HRESULT WINAPI SHILCreateFromPathA ( + LPCSTR path, + LPITEMIDLIST * ppidl, + DWORD *attributes); + +HRESULT WINAPI SHILCreateFromPathW ( + LPCWSTR path, + LPITEMIDLIST * ppidl, + DWORD *attributes); + +HRESULT WINAPI SHILCreateFromPathAW ( + LPCVOID path, + LPITEMIDLIST * ppidl, + DWORD *attributes); LPITEMIDLIST WINAPI ILCreateFromPathA(LPCSTR path); LPITEMIDLIST WINAPI ILCreateFromPathW(LPCWSTR path); LPITEMIDLIST WINAPI ILCreateFromPathAW(LPCVOID path); +HRESULT WINAPI SHBindToParent( + LPCITEMIDLIST pidl, + REFIID riid, + LPVOID *ppv, + LPCITEMIDLIST *ppidlLast); + /* string functions */ -HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast); +HRESULT WINAPI StrRetToStrNA ( + LPVOID dest, + DWORD len, + LPSTRRET src, + LPITEMIDLIST pidl); -HRESULT WINAPI StrRetToStrNA (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl); -HRESULT WINAPI StrRetToStrNW (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl); -HRESULT WINAPI StrRetToStrNAW (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl); +HRESULT WINAPI StrRetToStrNW ( + LPVOID dest, + DWORD len, + LPSTRRET src, + LPITEMIDLIST pidl); -HRESULT WINAPI StrRetToBufA (LPSTRRET src, LPITEMIDLIST pidl, LPSTR dest, DWORD len); -HRESULT WINAPI StrRetToBufW (LPSTRRET src, LPITEMIDLIST pidl, LPWSTR dest, DWORD len); +HRESULT WINAPI StrRetToStrNAW ( + LPVOID dest, + DWORD len, + LPSTRRET src, + LPITEMIDLIST pidl); +HRESULT WINAPI StrRetToBufA ( + LPSTRRET src, + LPITEMIDLIST pidl, + LPSTR dest, + DWORD len); +HRESULT WINAPI StrRetToBufW ( + LPSTRRET src, + LPITEMIDLIST pidl, + LPWSTR dest, + DWORD len); /**************************************************************************** * SHChangeNotifyRegister API @@ -78,16 +148,822 @@ typedef struct } DWORDITEMID; HANDLE WINAPI SHChangeNotifyRegister( - HWND hwnd, - LONG dwFlags, - LONG wEventMask, - DWORD uMsg, - int cItems, - LPCNOTIFYREGISTER lpItems); + HWND hwnd, + LONG dwFlags, + LONG wEventMask, + DWORD uMsg, + int cItems, + LPCNOTIFYREGISTER lpItems); -BOOL WINAPI SHChangeNotifyDeregister( HANDLE hNotify); +BOOL WINAPI SHChangeNotifyDeregister(HANDLE hNotify); + +HANDLE WINAPI SHChangeNotification_Lock( + HANDLE hMemoryMap, + DWORD dwProcessId, + LPCITEMIDLIST **lppidls, + LPLONG lpwEventId); + +BOOL WINAPI SHChangeNotification_Unlock(HANDLE hLock); + +/**************************************************************************** + * Shell Common Dialogs + */ + +BOOL WINAPI PickIconDlg( + HWND hwndOwner, + LPSTR lpstrFile, + DWORD nMaxFile, + LPDWORD lpdwIconIndex); + +/* RunFileDlg flags */ +#define RFF_NOBROWSE 0x01 +#define RFF_NODEFAULT 0x02 +#define RFF_CALCDIRECTORY 0x04 +#define RFF_NOLABEL 0x08 +#define RFF_NOSEPARATEMEM 0x20 /* NT only */ + +/* RunFileFlg notification structure */ +typedef struct +{ + NMHDR hdr; + LPCSTR lpFile; + LPCSTR lpDirectory; + int nShow; +} NM_RUNFILEDLG, * LPNM_RUNFILEDLG; + +/* RunFileDlg notification return values */ +#define RF_OK 0x00 +#define RF_CANCEL 0x01 +#define RF_RETRY 0x02 + +void WINAPI RunFileDlg( + HWND hwndOwner, + HICON hIcon, + LPCSTR lpstrDirectory, + LPCSTR lpstrTitle, + LPCSTR lpstrDescription, + UINT uFlags); + +void WINAPI ExitWindowsDialog(HWND hwndOwner); + +int WINAPI RestartDialog( + HWND hwndOwner, + LPCSTR lpstrReason, + UINT uFlags); + +BOOL WINAPI GetFileNameFromBrowse( + HWND hwndOwner, + LPSTR lpstrFile, + DWORD nMaxFile, + LPCSTR lpstrInitialDir, + LPCSTR lpstrDefExt, + LPCSTR lpstrFilter, + LPCSTR lpstrTitle); + +BOOL WINAPI SHFindFiles( + LPCITEMIDLIST pidlRoot, + LPCITEMIDLIST pidlSavedSearch); + +BOOL WINAPI SHFindComputer( + LPCITEMIDLIST pidlRoot, + LPCITEMIDLIST pidlSavedSearch); + +/* SHObjectProperties flags */ +#define OPF_PRINTERNAME 0x01 +#define OPF_PATHNAME 0x02 + +BOOL WINAPI SHObjectProperties( + HWND hwndOwner, + UINT uFlags, + LPCSTR lpstrName, + LPCSTR lpstrParameters); + +void WINAPI SHHandleDiskFull(HWND hwndOwner, + UINT uDrive); + +int WINAPI SHOutOfMemoryMessageBox( + HWND hwndOwner, + LPCSTR lpCaption, + UINT uType); + +DWORD WINAPI SHNetConnectionDialog( + HWND hwndOwner, + LPCSTR lpstrRemoteName, + DWORD dwType); + +int WINAPIV ShellMessageBoxA( + HINSTANCE hInstance, + HWND hWnd, + LPCSTR lpText, + LPCSTR lpCaption, + UINT uType, + ...); + +int WINAPIV ShellMessageBoxW( + HINSTANCE hInstance, + HWND hWnd, + LPCWSTR lpText, + LPCWSTR lpCaption, + UINT uType, + ...); + +#define ShellMessageBox WINELIB_NAME_AW(ShellMessageBox) + +/**************************************************************************** + * Memory Routines + */ + +LPVOID WINAPI SHAlloc(ULONG cb); +void WINAPI SHFree(LPVOID pv); + +HANDLE WINAPI SHAllocShared( + LPVOID pv, + ULONG cb, + DWORD pid); + +BOOL WINAPI SHFreeShared( + HANDLE hMem, + DWORD pid); + +LPVOID WINAPI SHLockShared( + HANDLE hMem, + DWORD pid); + +BOOL WINAPI SHUnlockShared(LPVOID pv); + +/**************************************************************************** + * Cabinet Window Messages + */ + +#define CWM_SETPATH (WM_USER + 2) +#define CWM_WANTIDLE (WM_USER + 3) +#define CWM_GETSETCURRENTINFO (WM_USER + 4) +#define CWM_SELECTITEM (WM_USER + 5) +#define CWM_SELECTITEMSTR (WM_USER + 6) +#define CWM_GETISHELLBROWSER (WM_USER + 7) +#define CWM_TESTPATH (WM_USER + 9) +#define CWM_STATECHANGE (WM_USER + 10) +#define CWM_GETPATH (WM_USER + 12) + +/* CWM_TESTPATH types */ +#define CWTP_ISEQUAL 0 +#define CWTP_ISCHILD 1 + +/* CWM_TESTPATH structure */ +typedef struct +{ + DWORD dwType; + ITEMIDLIST idl; +} CWTESTPATHSTRUCT,* LPCWTESTPATHSTRUCT; + +/**************************************************************************** + * System Imagelist Routines + */ + +int WINAPI Shell_GetCachedImageIndex( + LPCSTR lpszFileName, + UINT nIconIndex, + BOOL bSimulateDoc); + +BOOL WINAPI Shell_GetImageLists( + HIMAGELIST *lphimlLarge, + HIMAGELIST *lphimlSmall); + +HICON WINAPI SHGetFileIcon( + DWORD dwReserved, + LPCSTR lpszPath, + DWORD dwFileAttributes, + UINT uFlags); + +int WINAPI SHMapPIDLToSystemImageListIndex( + LPSHELLFOLDER psf, + LPCITEMIDLIST pidl, + UINT * pOpenIndex); + +BOOL WINAPI FileIconInit(BOOL bFullInit); + +/**************************************************************************** + * File Menu Routines + */ +/* FileMenu_Create nSelHeight constants */ +#define FM_DEFAULT_SELHEIGHT -1 +#define FM_FULL_SELHEIGHT 0 + +/* FileMenu_Create flags */ +#define FMF_SMALL_ICONS 0x00 +#define FMF_LARGE_ICONS 0x08 +#define FMF_NO_COLUMN_BREAK 0x10 + +HMENU WINAPI FileMenu_Create( + COLORREF crBorderColor, + int nBorderWidth, + HBITMAP hBorderBmp, + int nSelHeight, + UINT uFlags); + +void WINAPI FileMenu_Destroy(HMENU hMenu); + +/* FileMenu_AppendItem constants */ +#define FM_SEPARATOR (LPCSTR)1 +#define FM_BLANK_ICON -1 +#define FM_DEFAULT_HEIGHT 0 + +BOOL WINAPI FileMenu_AppendItem( + HMENU hMenu, + LPCSTR lpszText, + UINT uID, + int iIcon, + HMENU hMenuPopup, + int nItemHeight); + +/* FileMenu_InsertUsingPidl flags */ +#define FMF_NO_EMPTY_ITEM 0x01 +#define FMF_NO_PROGRAM_GROUPS 0x04 + +/* FileMenu_InsertUsingPidl callback function */ +typedef void (CALLBACK *LPFNFMCALLBACK)(LPCITEMIDLIST pidlFolder, LPCITEMIDLIST pidlFile); + +int WINAPI FileMenu_InsertUsingPidl( + HMENU hMenu, + UINT uID, + LPCITEMIDLIST pidl, + UINT uFlags, + UINT uEnumFlags, + LPFNFMCALLBACK lpfnCallback); + +int WINAPI FileMenu_ReplaceUsingPidl( + HMENU hMenu, + UINT uID, + LPCITEMIDLIST pidl, + UINT uEnumFlags, + LPFNFMCALLBACK lpfnCallback); + +void WINAPI FileMenu_Invalidate(HMENU hMenu); + +HMENU WINAPI FileMenu_FindSubMenuByPidl( + HMENU hMenu, + LPCITEMIDLIST pidl); + +BOOL WINAPI FileMenu_TrackPopupMenuEx( + HMENU hMenu, + UINT uFlags, + int x, + int y, + HWND hWnd, + LPTPMPARAMS lptpm); + +BOOL WINAPI FileMenu_GetLastSelectedItemPidls( + UINT uReserved, + LPITEMIDLIST *ppidlFolder, + LPITEMIDLIST *ppidlItem); + +LRESULT WINAPI FileMenu_MeasureItem( + HWND hWnd, + LPMEASUREITEMSTRUCT lpmis); + +LRESULT WINAPI FileMenu_DrawItem( + HWND hWnd, + LPDRAWITEMSTRUCT lpdis); + +BOOL WINAPI FileMenu_InitMenuPopup(HMENU hMenu); + +void WINAPI FileMenu_AbortInitMenu(void); + +LRESULT WINAPI FileMenu_HandleMenuChar( + HMENU hMenu, + WPARAM wParam); + +BOOL WINAPI FileMenu_DeleteAllItems(HMENU hMenu); + +BOOL WINAPI FileMenu_DeleteItemByCmd( + HMENU hMenu, + UINT uID); + +BOOL WINAPI FileMenu_DeleteItemByIndex( + HMENU hMenu, + UINT uPos); + +BOOL WINAPI FileMenu_DeleteMenuItemByFirstID( + HMENU hMenu, + UINT uID); + +BOOL WINAPI FileMenu_DeleteSeparator(HMENU hMenu); + +BOOL WINAPI FileMenu_EnableItemByCmd( + HMENU hMenu, + UINT uID, + BOOL bEnable); + +DWORD WINAPI FileMenu_GetItemExtent( + HMENU hMenu, + UINT uPos); + +int WINAPI FileMenu_AppendFilesForPidl( + HMENU hMenu, + LPCITEMIDLIST pidl, + BOOL bAddSeparator); + +int WINAPI FileMenu_AddFilesForPidl( + HMENU hMenu, + UINT uReserved, + UINT uID, + LPCITEMIDLIST pidl, + UINT uFlags, + UINT uEnumFlags, + LPFNFMCALLBACK lpfnCallback); + +/**************************************************************************** + * Drag And Drop Routines + */ +HRESULT WINAPI SHLoadOLE(DWORD dwFlags); + +HRESULT WINAPI SHRegisterDragDrop( + HWND hWnd, + LPDROPTARGET lpDropTarget); + +HRESULT WINAPI SHRevokeDragDrop(HWND hWnd); + +HRESULT WINAPI SHDoDragDrop( + HWND hWnd, + LPDATAOBJECT lpDataObject, + LPDROPSOURCE lpDropSource, + DWORD dwOKEffect, + LPDWORD pdwEffect); + +BOOL WINAPI DAD_DragEnter(HWND hWnd); + +BOOL WINAPI DAD_DragEnterEx( + HWND hWnd, + POINT pt); + +BOOL WINAPI DAD_DragMove(POINT pt); + +/* DAD_AutoScroll return values */ +#define DAD_SCROLL_UP 1 +#define DAD_SCROLL_DOWN 2 +#define DAD_SCROLL_LEFT 4 +#define DAD_SCROLL_RIGHT 8 + +/* DAD_AutoScroll sample structure */ +typedef struct +{ + DWORD dwCount; + DWORD dwLastTime; + BOOL bWrapped; + POINT aptPositions[3]; + DWORD adwTimes[3]; +} SCROLLSAMPLES, *LPSCROLLSAMPLES; + +DWORD WINAPI DAD_AutoScroll(HWND hWnd, + LPSCROLLSAMPLES lpSamples, + LPPOINT lppt); + +BOOL WINAPI DAD_DragLeave(); + +BOOL WINAPI DAD_SetDragImageFromListView( + HWND hWnd, + POINT pt); + +BOOL WINAPI DAD_SetDragImage( + HIMAGELIST himlTrack, + LPPOINT lppt); + +BOOL WINAPI DAD_ShowDragImage(BOOL bShow); + +HRESULT WINAPI SHCreateStdEnumFmtEtc( + DWORD cFormats, + const FORMATETC *lpFormats, + LPENUMFORMATETC *ppenumFormatetc); + +HRESULT WINAPI CIDLData_CreateFromIDArray( + LPCITEMIDLIST pidlFolder, + DWORD cpidlFiles, + LPCITEMIDLIST *lppidlFiles, + LPDATAOBJECT *ppdataObject); + +/**************************************************************************** + * Path Manipulation Routines + */ + +LPSTR WINAPI PathAppend( + LPSTR lpszPath1, + LPCSTR lpszPath2); + +LPSTR WINAPI PathCombineA(LPSTR szDest, LPCSTR lpszDir, LPCSTR lpszFile); +LPWSTR WINAPI PathCombineW(LPWSTR szDest, LPCWSTR lpszDir, LPCWSTR lpszFile); +#define PathCombine WINELIB_NAME_AW(PathCombine) +LPVOID WINAPI PathCombineAW(LPVOID szDest, LPCVOID lpszDir, LPCVOID lpszFile); + +LPSTR WINAPI PathAddBackslashA(LPSTR path); +LPWSTR WINAPI PathAddBackslashW(LPWSTR path); +#define PathAddBackslash WINELIB_NAME_AW(PathAddBackslash) +LPVOID WINAPI PathAddBackslashAW(LPVOID path); + +LPSTR WINAPI PathRemoveBackslashA(LPSTR lpszPath); +LPWSTR WINAPI PathRemoveBackslashW(LPWSTR lpszPath); +#define PathRemoveBackslash WINELIB_NAME_AW(PathRemoveBackslash) + +LPSTR WINAPI PathBuildRoot( + LPSTR lpszPath, + int drive); + +LPSTR WINAPI PathFindExtensionA(LPCSTR path); +LPWSTR WINAPI PathFindExtensionW(LPCWSTR path); +#define PathFindExtension WINELIB_NAME_AW(PathFindExtension) +LPVOID WINAPI PathFindExtensionAW(LPCVOID path); + +LPSTR WINAPI PathGetExtensionA(LPCSTR lpszPath); +LPWSTR WINAPI PathGetExtensionW(LPCWSTR lpszPath); +#define PathGetExtension WINELIB_NAME_AW(PathGetExtension) +LPVOID WINAPI PathGetExtensionAW(LPCVOID lpszPath); + +LPSTR WINAPI PathGetArgs(LPCSTR lpszPath); + +BOOL WINAPI PathRemoveFileSpec(LPSTR lpszPath); + +LPSTR WINAPI PathGetShortPath(LPSTR lpszPath); + +LPSTR WINAPI PathRemoveBlanksA(LPSTR lpszPath); +LPWSTR WINAPI PathRemoveBlanksW(LPWSTR lpszPath); +#define PathRemoveBlanks WINELIB_NAME_AW(PathRemoveBlanks) +LPVOID WINAPI PathRemoveBlanksAW(LPVOID lpszPath); + +LPSTR WINAPI PathQuoteSpacesA(LPCSTR path); +LPWSTR WINAPI PathQuoteSpacesW(LPCWSTR path); +#define PathQuoteSpaces WINELIB_NAME_AW(PathQuoteSpaces) +LPVOID WINAPI PathQuoteSpacesAW(LPCVOID path); + +void WINAPI PathUnquoteSpaces(LPSTR lpszPath); + +BOOL WINAPI PathIsUNCA(LPCSTR lpszPath); +BOOL WINAPI PathIsUNCW(LPCWSTR lpszPath); +#define PathIsUNC WINELIB_NAME_AW(PathIsUNC) +BOOL WINAPI PathIsUNCAW(LPCVOID lpszPath); + +BOOL WINAPI PathIsRelativeA(LPCSTR lpszPath); +BOOL WINAPI PathIsRelativeW(LPCWSTR lpszPath); +#define PathIsRelative WINELIB_NAME_AW(PathIsRelative) +BOOL WINAPI PathIsRelativeAW(LPCVOID lpszPath); + +BOOL WINAPI PathIsRootA(LPCSTR x); +BOOL WINAPI PathIsRootW(LPCWSTR x); +#define PathIsRoot WINELIB_NAME_AW(PathIsRoot) +BOOL WINAPI PathIsRootAW(LPCVOID x); + +BOOL WINAPI PathIsExe(LPCSTR lpszPath); + +BOOL WINAPI PathIsDirectory(LPCSTR lpszPath); + +BOOL WINAPI PathFileExists(LPCSTR lpszPath); + +BOOL WINAPI PathMatchSpecA( + LPCSTR lpszPath, + LPCSTR lpszSpec); +BOOL WINAPI PathMatchSpecW( + LPCWSTR lpszPath, + LPCWSTR lpszSpec); +#define PathMatchSpec WINELIB_NAME_AW(PathMatchSpec) +BOOL WINAPI PathMatchSpecAW(LPVOID lpszPath, LPVOID lpszSpec); + +BOOL WINAPI PathMakeUniqueName( + LPSTR lpszBuffer, + DWORD dwBuffSize, + LPCSTR lpszShortName, + LPCSTR lpszLongName, + LPCSTR lpszPathName); + +BOOL WINAPI PathYetAnotherMakeUniqueName( + LPSTR lpszBuffer, + LPCSTR lpszPathName, + LPCSTR lpszShortName, + LPCSTR lpszLongName); + +BOOL WINAPI PathFindOnPath( + LPSTR lpszFile, + LPCSTR *alpszPaths); + +/* PathCleanupSpec return values */ +#define PCS_REPLACEDCHARS 0x00000001 +#define PCS_REMOVEDCHARS 0x00000002 +#define PCS_SHORTENED 0x00000004 +#define PCS_PATHTOOLONG 0x80000008 + +DWORD WINAPI PathCleanupSpec( + LPCSTR lpszPath, + LPSTR lpszFile); + +BOOL WINAPI PathQualifyA(LPCSTR path); +BOOL WINAPI PathQualifyW(LPCWSTR path); +#define PathQualify WINELIB_NAME_AW(PathQualify) +BOOL WINAPI PathQualifyAW(LPCVOID path); +/* PathResolve flags */ +#define PRF_CHECKEXISTANCE 0x01 +#define PRF_EXECUTABLE 0x02 +#define PRF_QUALIFYONPATH 0x04 +#define PRF_WINDOWS31 0x08 + +BOOL WINAPI PathResolve( + LPSTR lpszPath, + LPCSTR *alpszPaths, + DWORD dwFlags); + +BOOL WINAPI PathSetDlgItemPath( + HWND hDlg, + int nIDDlgItem, + LPCSTR lpszPath); + +/* PathProcessCommand flags */ +#define PPCF_QUOTEPATH 0x01 /* implies PPCF_INCLUDEARGS */ +#define PPCF_INCLUDEARGS 0x02 +#define PPCF_NODIRECTORIES 0x10 +#define PPCF_DONTRESOLVE 0x20 +#define PPCF_PATHISRELATIVE 0x40 + +int WINAPI PathProcessCommand( + LPCWSTR lpszPath, + LPWSTR lpszBuff, + DWORD dwBuffSize, + DWORD dwFlags); + +void WINAPI PathStripPath(LPWSTR lpszPath); + +BOOL WINAPI PathStripToRoot(LPWSTR lpszPath); + +void WINAPI PathRemoveArgs(LPWSTR lpszPath); + +void WINAPI PathRemoveExtension(LPWSTR lpszPath); + +int WINAPI PathParseIconLocation(LPWSTR lpszPath); + +BOOL WINAPI PathIsSameRoot( + LPCWSTR lpszPath1, + LPCWSTR lpszPath2); + +BOOL WINAPI PathFindOnPathA(LPSTR sFile, LPCSTR sOtherDirs); +BOOL WINAPI PathFindOnPathW(LPWSTR sFile, LPCWSTR sOtherDirs); +#define PathFindOnPath WINELIB_NAME_AW(PathFindOnPath) +BOOL WINAPI PathFindOnPathAW(LPVOID sFile, LPCVOID sOtherDirs); + +LPSTR WINAPI StrFormatByteSizeA ( DWORD dw, LPSTR pszBuf, UINT cchBuf ); +LPWSTR WINAPI StrFormatByteSizeW ( DWORD dw, LPWSTR pszBuf, UINT cchBuf ); +#define StrFormatByteSize WINELIB_NAME_AW(StrFormatByteSize) + +DWORD WINAPI PathCleanupSpecA(LPSTR x, LPSTR y); +DWORD WINAPI PathCleanupSpecW(LPWSTR x, LPWSTR y); +#define PathCleanupSpec WINELIB_NAME_AW(PathCleanupSpec) + +/**************************************************************************** + * Shell Namespace Routines + */ + +/* SHCreateShellFolderViewEx callback function */ +typedef HRESULT (CALLBACK* LPFNSFVCALLBACK)( + DWORD dwUser, + LPSHELLFOLDER pshf, + HWND hWnd, + UINT uMsg, + WPARAM wParam, + LPARAM lParam); + +/* SHCreateShellFolderViewEx structure */ +typedef struct +{ + DWORD dwSize; + LPSHELLFOLDER pshf; + DWORD dwUser; + LPCITEMIDLIST pidlFolder; + DWORD dwEventId; + LPFNSFVCALLBACK lpfnCallback; + UINT uViewMode; +} SHELLFOLDERVIEWINFO, * LPSHELLFOLDERVIEWINFO; +typedef const SHELLFOLDERVIEWINFO * LPCSHELLFOLDERVIEWINFO; + +HRESULT WINAPI SHCreateShellFolderViewEx( + LPCSHELLFOLDERVIEWINFO pshfvi, + LPSHELLVIEW *ppshv); + +/* SHCreateShellFolderViewEx callback messages */ +#define SFVCB_ADDTOMENU 0x0001 +#define SFVCB_INVOKECOMMAND 0x0002 +#define SFVCB_GETMENUHELP 0x0003 +#define SFVCB_GETTOOLBARTIP 0x0004 +#define SFVCB_GETTOOLBARINFO 0x0005 +#define SFVCB_ADDTOOLBARITEMS 0x0006 +#define SFVCB_INITMENUPOPUP 0x0007 +#define SFVCB_SELECTIONCHANGED 0x0008 +#define SFVCB_DRAWMENUITEM 0x0009 +#define SFVCB_MEASUREMENUITEM 0x000A +#define SFVCB_EXITMENULOOP 0x000B +#define SFVCB_VIEWRELEASE 0x000C +#define SFVCB_GETNAMELENGTH 0x000D +#define SFVCB_CHANGENOTIFY 0x000E +#define SFVCB_WINDOWCREATED 0x000F +#define SFVCB_WINDOWCLOSING 0x0010 +#define SFVCB_LISTREFRESHED 0x0011 +#define SFVCB_WINDOWFOCUSED 0x0012 +#define SFVCB_REGISTERCOPYHOOK 0x0014 +#define SFVCB_COPYHOOKCALLBACK 0x0015 +#define SFVCB_GETDETAILSOF 0x0017 +#define SFVCB_COLUMNCLICK 0x0018 +#define SFVCB_GETCHANGENOTIFYPIDL 0x0019 +#define SFVCB_GETESTIMATEDCOUNT 0x001A +#define SFVCB_ADJUSTVIEWMODE 0x001B +#define SFVCB_REMOVEFROMMENU 0x001C +#define SFVCB_ADDINGOBJECT 0x001D +#define SFVCB_REMOVINGOBJECT 0x001E +#define SFVCB_UPDATESTATUSBAR 0x001F +#define SFVCB_ISSLOWREFRESH 0x0020 +#define SFVCB_GETCOMMANDDIR 0x0021 +#define SFVCB_GETCOLUMNSTREAM 0x0022 +#define SFVCB_CANSELECTALL 0x0023 +#define SFVCB_DRAGSUCCEEDED 0x0024 +#define SFVCB_ISSTRICTREFRESH 0x0025 +#define SFVCB_ISCHILDOBJECT 0x0026 + +/* Generic structure used by several messages */ +typedef struct +{ + DWORD dwReserved; + DWORD dwReserved2; + LPCITEMIDLIST pidl; + LPDWORD lpdwUser; +} SFVCBINFO, * LPSFVCBINFO; +typedef const SFVCBINFO * LPCSFVCBINFO; + +/* SFVCB_ADDTOMENU structure */ +typedef struct +{ + HMENU hMenu; + UINT indexMenu; + UINT idCmdFirst; + UINT idCmdLast; +} SFVMENUINFO, * LPSFVMENUINFO; + +/* SFVCB_GETTOOLBARINFO structure */ +typedef struct +{ + UINT nButtons; + UINT uFlags; +} SFVTOOLBARINFO, * LPSFVTOOLBARINFO; + +/* SFVTOOLBARINFO flags */ +typedef enum +{ + SFVTI_ADDTOEND = 0, + SFVTI_ADDTOFRONT = 1, + SFVTI_OVERWRITE = 2 +} SFVTIF; + +/* SFVCB_SELECTIONCHANGED structure */ +typedef struct +{ + UINT uOldState; + UINT uNewState; + LPCITEMIDLIST pidl; + LPDWORD lpdwUser; +} SFVSELECTSTATE, * LPSFVSELECTSTATE; +typedef const SFVSELECTSTATE * LPCSFVSELECTSTATE; + +/* SFVCB_COPYHOOKCALLBACK structure */ +typedef struct +{ + HWND hwnd; + UINT wFunc; + UINT wFlags; + LPCSTR pszSrcFile; + DWORD dwSrcAttribs; + LPCSTR pszDestFile; + DWORD dwDestAttribs; +} SFVCOPYHOOKINFO, * LPSFVCOPYHOOKINFO; +typedef const SFVCOPYHOOKINFO * LPCSFVCOPYHOOKINFO; + +/* SFVCB_GETDETAILSOF structure */ +typedef struct +{ + LPCITEMIDLIST pidl; + int fmt; + int cx; + STRRET lpText; +} SFVCOLUMNINFO, * LPSFVCOLUMNINFO; + +int WINAPI SHShellFolderView_Message( + HWND hwndCabinet, + DWORD dwMessage, + DWORD dwParam); + +/* SHShellFolderView_Message messages */ +#define SFVM_REARRANGE 0x0001 +#define SFVM_GETARRANGECOLUMN 0x0002 +#define SFVM_ADDOBJECT 0x0003 +#define SFVM_GETITEMCOUNT 0x0004 +#define SFVM_GETITEMPIDL 0x0005 +#define SFVM_REMOVEOBJECT 0x0006 +#define SFVM_UPDATEOBJECT 0x0007 +#define SFVM_SETREDRAW 0x0008 +#define SFVM_GETSELECTEDOBJECTS 0x0009 +#define SFVM_ISDROPONSOURCE 0x000A +#define SFVM_MOVEICONS 0x000B +#define SFVM_GETDRAGPOINT 0x000C +#define SFVM_GETDROPPOINT 0x000D +#define SFVM_SETOBJECTPOS 0x000E +#define SFVM_ISDROPONBACKGROUND 0x000F +#define SFVM_CUTOBJECTS 0x0010 +#define SFVM_TOGGLEAUTOARRANGE 0x0011 +#define SFVM_LINEUPICONS 0x0012 +#define SFVM_GETAUTOARRANGE 0x0013 +#define SFVM_GETSELECTEDCOUNT 0x0014 +#define SFVM_GETITEMSPACING 0x0015 +#define SFVM_REFRESHOBJECT 0x0016 +#define SFVM_SETCLIPBOARDPOINTS 0x0017 + +/**************************************************************************** + * Misc Stuff + */ + +/* SHWaitForFileToOpen flags */ +#define SHWFF_ADD 0x01 +#define SHWFF_REMOVE 0x02 +#define SHWFF_WAIT 0x04 + +BOOL WINAPI SHWaitForFileToOpen( + LPCITEMIDLIST pidl, + DWORD dwFlags, + DWORD dwTimeout); + +WORD WINAPI ArrangeWindows( + HWND hwndParent, + DWORD dwReserved, + LPCRECT lpRect, + WORD cKids, + CONST HWND * lpKids); + +/* RegisterShellHook types */ +#define RSH_DEREGISTER 0 +#define RSH_REGISTER 1 +#define RSH_REGISTER_PROGMAN 2 +#define RSH_REGISTER_TASKMAN 3 + +BOOL WINAPI RegisterShellHook( + HWND hWnd, + DWORD dwType); + +/* SHCreateDefClassObject callback function */ +typedef HRESULT (CALLBACK *LPFNCDCOCALLBACK)( + LPUNKNOWN pUnkOuter, + REFIID riidObject, + LPVOID *ppvObject); + +HRESULT WINAPI SHCreateDefClassObject( + REFIID riidFactory, + LPVOID *ppvFactory, + LPFNCDCOCALLBACK lpfnCallback, + LPDWORD lpdwUsage, + REFIID riidObject); + +HRESULT WINAPI SHCoCreateInstance( + LPCSTR lpszClsid, + REFCLSID rClsid, + LPUNKNOWN pUnkOuter, + REFIID riid, + LPVOID *ppv); + +void WINAPI SHFreeUnusedLibraries(); + +/* SHCreateLinks flags */ +#define SHCLF_PREFIXNAME 0x01 +#define SHCLF_CREATEONDESKTOP 0x02 + +HRESULT WINAPI SHCreateLinks( + HWND hWnd, + LPCSTR lpszDir, + LPDATAOBJECT lpDataObject, + UINT uFlags, + LPITEMIDLIST *lppidlLinks); + +/* SHGetNewLinkInfo flags */ +#define SHGNLI_PIDL 0x01 +#define SHGNLI_PREFIXNAME 0x02 +#define SHGNLI_NOUNIQUE 0x04 + +BOOL WINAPI SHGetNewLinkInfoA( + LPCSTR pszLinkTo, + LPCSTR pszDir, + LPSTR pszName, + BOOL *pfMustCopy, + UINT uFlags); + +BOOL WINAPI SHGetNewLinkInfoW( + LPCWSTR pszLinkTo, + LPCWSTR pszDir, + LPWSTR pszName, + BOOL *pfMustCopy, + UINT uFlags); +#define SHGetNewLinkInfo WINELIB_NAME_AW(SHGetNewLinkInfo) + +/* policy functions */ +BOOL WINAPI SHInitRestricted(LPSTR, LPSTR); #ifdef __cplusplus } /* extern "C" */