Moved shlwapi routines from shell32.dll to shlwapi.dll.
diff --git a/dlls/Makefile.in b/dlls/Makefile.in index cfb9967..ac0533b 100644 --- a/dlls/Makefile.in +++ b/dlls/Makefile.in
@@ -393,9 +393,8 @@ olecli/libolecli32.so: libolesvr32.so libole32.so olepro32/libolepro32.so: liboleaut32.so libole32.so opengl32/libopengl32.so: libx11drv.so libgdi32.so -shell32/libshell32.so: libole32.so +shell32/libshell32.so: libole32.so libshlwapi.so shfolder/libshfolder.so: libshell32.so -shlwapi/libshlwapi.so: libshell32.so urlmon/liburlmon.so: libole32.so version/libversion.so: liblz32.so win32s/libw32skrnl.so: libkernel32.so
diff --git a/dlls/shell32/Makefile.in b/dlls/shell32/Makefile.in index 6a7b972..9f1efe1 100644 --- a/dlls/shell32/Makefile.in +++ b/dlls/shell32/Makefile.in
@@ -5,7 +5,7 @@ MODULE = shell32 SOVERSION = 1.0 ALTNAMES = shell -IMPORTS = ole32 +IMPORTS = ole32 shlwapi C_SRCS = \ brsfolder.c \ @@ -19,7 +19,6 @@ iconcache.c \ memorystream.c \ pidl.c \ - regstream.c \ shell32_main.c \ shell.c \ shellguid.c \
diff --git a/dlls/shell32/shell32.spec b/dlls/shell32/shell32.spec index d06184b..12937d8 100644 --- a/dlls/shell32/shell32.spec +++ b/dlls/shell32/shell32.spec
@@ -3,6 +3,7 @@ init Shell32LibMain rsrc shres +import shlwapi.dll import user32.dll import comctl32.dll @@ -91,7 +92,7 @@ 82 stdcall DragQueryFileA(long long ptr long) DragQueryFileA 83 stub CIDLData_CreateFromIDArray 84 stub SHIsBadInterfacePtr - 85 stdcall OpenRegStream(long str str long) SHOpenRegStreamA + 85 forward OpenRegStream shlwapi.SHOpenRegStreamA 86 stdcall SHRegisterDragDrop(long ptr) SHRegisterDragDrop 87 stdcall SHRevokeDragDrop(long) SHRevokeDragDrop 88 stdcall SHDoDragDrop(long long long long long) SHDoDragDrop
diff --git a/dlls/shell32/shell32_main.c b/dlls/shell32/shell32_main.c index 8138757..3b247b7 100644 --- a/dlls/shell32/shell32_main.c +++ b/dlls/shell32/shell32_main.c
@@ -749,42 +749,6 @@ return S_OK; } -/*********************************************************************** - * DllGetVersion [SHLWAPI] - * - * Retrieves version information of the 'SHLWAPI.DLL' - * - * PARAMS - * pdvi [O] pointer to version information structure. - * - * RETURNS - * Success: S_OK - * Failure: E_INVALIDARG - * - * NOTES - * Returns version of a SHLWAPI.dll from IE5.01. - */ - -HRESULT WINAPI SHLWAPI_DllGetVersion (DLLVERSIONINFO *pdvi) -{ - if (pdvi->cbSize != sizeof(DLLVERSIONINFO)) - { - WARN("wrong DLLVERSIONINFO size from app"); - return E_INVALIDARG; - } - - pdvi->dwMajorVersion = 5; - pdvi->dwMinorVersion = 0; - pdvi->dwBuildNumber = 2314; - pdvi->dwPlatformID = 1000; - - TRACE("%lu.%lu.%lu.%lu\n", - pdvi->dwMajorVersion, pdvi->dwMinorVersion, - pdvi->dwBuildNumber, pdvi->dwPlatformID); - - return S_OK; -} - /************************************************************************* * global variables of the shell32.dll * all are once per process
diff --git a/dlls/shell32/shellord.c b/dlls/shell32/shellord.c index 3a05a7f..9939bd9 100644 --- a/dlls/shell32/shellord.c +++ b/dlls/shell32/shellord.c
@@ -961,69 +961,6 @@ } /************************************************************************* - * SHCreateShellPalette - */ -HPALETTE WINAPI SHCreateShellPalette(HDC hdc) -{ - FIXME("stub\n"); - return CreateHalftonePalette(hdc); -} -/************************************************************************* - * wnsprintfA [SHLWAPI] - */ -int WINAPIV wnsprintfA(LPSTR lpOut, int cchLimitIn, LPCSTR lpFmt, ...) -{ - va_list valist; - INT res; - - va_start( valist, lpFmt ); - res = wvsnprintfA( lpOut, cchLimitIn, lpFmt, valist ); - va_end( valist ); - return res; -} - -/************************************************************************* - * wnsprintfW [SHLWAPI] - */ -int WINAPIV wnsprintfW(LPWSTR lpOut, int cchLimitIn, LPCWSTR lpFmt, ...) -{ - va_list valist; - INT res; - - va_start( valist, lpFmt ); - res = wvsnprintfW( lpOut, cchLimitIn, lpFmt, valist ); - va_end( valist ); - return res; -} -/************************************************************************* - * UrlEscapeA [SHLWAPI] - */ -HRESULT WINAPI UrlEscapeA( - LPCSTR pszUrl, - LPSTR pszEscaped, - LPDWORD pcchEscaped, - DWORD dwFlags) -{ - FIXME("(%s %p %p 0x%08lx)stub\n",debugstr_a(pszUrl), - pszEscaped, pcchEscaped, dwFlags); - return 0; -} - -/************************************************************************* - * UrlEscapeW [SHLWAPI] - */ -HRESULT WINAPI UrlEscapeW( - LPCWSTR pszUrl, - LPWSTR pszEscaped, - LPDWORD pcchEscaped, - DWORD dwFlags) -{ - FIXME("(%s %p %p 0x%08lx)stub\n",debugstr_w(pszUrl), - pszEscaped, pcchEscaped, dwFlags); - return 0; -} - -/************************************************************************* * SHELL32_714 [SHELL32] */ DWORD WINAPI SHELL32_714(LPVOID x) @@ -1031,13 +968,3 @@ FIXME("(%s)stub\n", debugstr_w(x)); return 0; } - -/************************************************************************* - * SHIsLowMemoryMachine [SHLWAPI.@] - */ -DWORD WINAPI SHIsLowMemoryMachine (DWORD x) -{ - FIXME("0x%08lx\n", x); - return 0; -} -
diff --git a/dlls/shell32/shellpath.c b/dlls/shell32/shellpath.c index 74ed93e..407253b 100644 --- a/dlls/shell32/shellpath.c +++ b/dlls/shell32/shellpath.c
@@ -27,38 +27,6 @@ */ /************************************************************************* - * PathAppendA [SHLWAPI.@] - * - * NOTES - * concat path lpszPath2 onto lpszPath1 - * - * FIXME - * the resulting path is also canonicalized - */ -BOOL WINAPI PathAppendA( - LPSTR lpszPath1, - LPCSTR lpszPath2) -{ - TRACE("%s %s\n",lpszPath1, lpszPath2); - while (lpszPath2[0]=='\\') lpszPath2++; - PathCombineA(lpszPath1,lpszPath1,lpszPath2); - return TRUE; -} - -/************************************************************************* - * PathAppendW [SHLWAPI.@] - */ -BOOL WINAPI PathAppendW( - LPWSTR lpszPath1, - LPCWSTR lpszPath2) -{ - TRACE("%s %s\n",debugstr_w(lpszPath1), debugstr_w(lpszPath2)); - while (lpszPath2[0]=='\\') lpszPath2++; - PathCombineW(lpszPath1,lpszPath1,lpszPath2); - return TRUE; -} - -/************************************************************************* * PathAppendAW [SHELL32.36] */ BOOL WINAPI PathAppendAW( @@ -71,94 +39,6 @@ } /************************************************************************* - * 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 - */ -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 (PathGetDriveNumberA(lpszFile) != -1) - { - strcpy(szDest,lpszFile); - } - else if (lpszFile[0] == '\\' ) - { - strcpy(sTemp,lpszDir); - PathStripToRootA(sTemp); - strcat(sTemp,lpszFile); - strcpy(szDest,sTemp); - } - else - { - strcpy(sTemp,lpszDir); - PathAddBackslashA(sTemp); - strcat(sTemp,lpszFile); - strcpy(szDest,sTemp); - } - return szDest; -} - -/************************************************************************* - * PathCombineW [SHLWAPI.@] - */ -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]) ) - { - strcpyW(szDest,lpszDir); - return szDest; - } - - /* if lpszFile is a complete path don't care about lpszDir */ - if (PathGetDriveNumberW(lpszFile) != -1) - { - strcpyW(szDest,lpszFile); - } - else if (lpszFile[0] == (WCHAR)'\\' ) - { - strcpyW(sTemp,lpszDir); - PathStripToRootW(sTemp); - strcatW(sTemp,lpszFile); - strcpyW(szDest,sTemp); - } - else - { - strcpyW(sTemp,lpszDir); - PathAddBackslashW(sTemp); - strcatW(sTemp,lpszFile); - strcpyW(szDest,sTemp); - } - return szDest; -} - -/************************************************************************* * PathCombineAW [SHELL32.37] */ LPVOID WINAPI PathCombineAW( @@ -172,45 +52,6 @@ } /************************************************************************* - * PathAddBackslashA [SHLWAPI.@] - * - * NOTES - * append \ if there is none - */ -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 = strlenW(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) @@ -221,30 +62,6 @@ } /************************************************************************* - * 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) @@ -259,42 +76,6 @@ */ /************************************************************************* - * PathFindFileNameA [SHLWAPI.@] - */ -LPSTR WINAPI PathFindFileNameA(LPCSTR lpszPath) -{ - LPCSTR lastSlash = lpszPath; - - TRACE("%s\n",lpszPath); - while (*lpszPath) - { - if ( isSlash(lpszPath[0]) && lpszPath[1]) - lastSlash = lpszPath+1; - lpszPath = CharNextA(lpszPath); - } - return (LPSTR)lastSlash; - -} - -/************************************************************************* - * 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 = CharNextW(lpszPath); - } - return (LPWSTR)wslash; -} - -/************************************************************************* * PathFindFileNameAW [SHELL32.34] */ LPVOID WINAPI PathFindFileNameAW(LPCVOID lpszPath) @@ -305,50 +86,6 @@ } /************************************************************************* - * 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 (*lpszPath=='.') - lastpoint=lpszPath; - lpszPath = CharNextA(lpszPath); - } - return (LPSTR)(lastpoint?lastpoint:lpszPath); -} - -/************************************************************************* - * PathFindExtensionW [SHLWAPI.@] - */ -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 (*lpszPath==(WCHAR)'.') - lastpoint=lpszPath; - lpszPath = CharNextW(lpszPath); - } - return (LPWSTR)(lastpoint?lastpoint:lpszPath); -} - -/************************************************************************* * PathFindExtensionAW [SHELL32.31] */ LPVOID WINAPI PathFindExtensionAW(LPCVOID lpszPath) @@ -360,32 +97,6 @@ } /************************************************************************* - * PathGetExtensionA [internal] - * - * NOTES - * exported by ordinal - * return value points to the first char after the dot - */ -LPSTR WINAPI PathGetExtensionA(LPCSTR lpszPath) -{ - TRACE("(%s)\n",lpszPath); - - lpszPath = PathFindExtensionA(lpszPath); - return (LPSTR)(*lpszPath?(lpszPath+1):lpszPath); -} - -/************************************************************************* - * PathGetExtensionW [internal] - */ -LPWSTR WINAPI PathGetExtensionW(LPCWSTR lpszPath) -{ - TRACE("(%s)\n",debugstr_w(lpszPath)); - - lpszPath = PathFindExtensionW(lpszPath); - return (LPWSTR)(*lpszPath?(lpszPath+1):lpszPath); -} - -/************************************************************************* * PathGetExtensionAW [SHELL32.158] */ LPVOID WINAPI PathGetExtensionAW(LPCVOID lpszPath) @@ -396,53 +107,6 @@ } /************************************************************************* - * 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 = CharNextA(lpszPath); - } - return (LPSTR)lpszPath; -} - -/************************************************************************* - * PathGetArgsW [SHLWAPI.@] - */ -LPWSTR WINAPI PathGetArgsW(LPCWSTR lpszPath) -{ - BOOL qflag = FALSE; - - TRACE("%s\n",debugstr_w(lpszPath)); - - while (*lpszPath) - { - if ((*lpszPath==' ') && !qflag) - return (LPWSTR)lpszPath+1; - if (*lpszPath=='"') - qflag=!qflag; - lpszPath = CharNextW(lpszPath); - } - return (LPWSTR)lpszPath; -} - -/************************************************************************* * PathGetArgsAW [SHELL32.52] */ LPVOID WINAPI PathGetArgsAW(LPVOID lpszPath) @@ -453,32 +117,6 @@ } /************************************************************************* - * 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 = tolowerW(lpszPath[0]); - - TRACE ("%s\n",debugstr_w(lpszPath)); - - if (!lpszPath || lpszPath[1]!=':' || chr < 'a' || chr > 'z') return -1; - return tolowerW(lpszPath[0]) - 'a' ; -} - -/************************************************************************* * PathGetDriveNumber [SHELL32.57] */ int WINAPI PathGetDriveNumberAW(LPVOID lpszPath) @@ -489,81 +127,6 @@ } /************************************************************************* - * PathRemoveFileSpecA [SHLWAPI.@] - * - * NOTES - * truncates passed argument to a valid path - * returns if the string was modified or not. - * "\foo\xx\foo"-> "\foo\xx" - * "\" -> "\" - * "a:\foo" -> "a:\" - */ -BOOL WINAPI PathRemoveFileSpecA(LPSTR lpszPath) -{ - LPSTR cutplace = lpszPath; - BOOL ret = FALSE; - - TRACE("%s\n",lpszPath); - - if(lpszPath) - { - while (*lpszPath == '\\') cutplace = ++lpszPath; - - while (*lpszPath) - { - if(lpszPath[0] == '\\') cutplace = lpszPath; - - if(lpszPath[0] == ':') - { - cutplace = lpszPath + 1; - if (lpszPath[1] == '\\') cutplace++; - lpszPath++; - } - lpszPath = CharNextA(lpszPath); - if (!lpszPath) break; - } - - ret = (*cutplace!='\0'); - *cutplace = '\0'; - } - return ret; -} - -/************************************************************************* - * PathRemoveFileSpecW [SHLWAPI.@] - */ -BOOL WINAPI PathRemoveFileSpecW(LPWSTR lpszPath) -{ - LPWSTR cutplace = lpszPath; - BOOL ret = FALSE; - - TRACE("%s\n",debugstr_w(lpszPath)); - - if(lpszPath) - { - while (*lpszPath == '\\') cutplace = ++lpszPath; - - while (*lpszPath) - { - if(lpszPath[0] == '\\') cutplace = lpszPath; - - if(lpszPath[0] == ':') - { - cutplace = lpszPath + 1; - if (lpszPath[1] == '\\') cutplace++; - lpszPath++; - } - lpszPath = CharNextW(lpszPath); - if (!lpszPath) break; - } - - ret = (*cutplace!='\0'); - *cutplace = '\0'; - } - return ret; -} - -/************************************************************************* * PathRemoveFileSpec [SHELL32.35] */ BOOL WINAPI PathRemoveFileSpecAW(LPVOID lpszPath) @@ -574,34 +137,6 @@ } /************************************************************************* - * 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)+1); -} - -/************************************************************************* - * PathStripPathW [SHELLWAPI.@] - */ -void WINAPI PathStripPathW(LPWSTR lpszPath) -{ - LPWSTR lpszFileName = PathFindFileNameW(lpszPath); - - TRACE("%s\n", debugstr_w(lpszPath)); - if(lpszFileName) - RtlMoveMemory(lpszPath, lpszFileName, (lstrlenW(lpszFileName)+1)*sizeof(WCHAR)); -} - -/************************************************************************* * PathStripPathAW [SHELL32.38] */ void WINAPI PathStripPathAW(LPVOID lpszPath) @@ -612,32 +147,6 @@ } /************************************************************************* - * PathStripToRootA [SHLWAPI.@] - */ -BOOL WINAPI PathStripToRootA(LPSTR lpszPath) -{ - TRACE("%s\n", lpszPath); - - if (!lpszPath) return FALSE; - while(!PathIsRootA(lpszPath)) - if (!PathRemoveFileSpecA(lpszPath)) return FALSE; - return TRUE; -} - -/************************************************************************* - * PathStripToRootW [SHLWAPI.@] - */ -BOOL WINAPI PathStripToRootW(LPWSTR lpszPath) -{ - TRACE("%s\n", debugstr_w(lpszPath)); - - if (!lpszPath) return FALSE; - while(!PathIsRootW(lpszPath)) - if (!PathRemoveFileSpecW(lpszPath)) return FALSE; - return TRUE; -} - -/************************************************************************* * PathStripToRootAW [SHELL32.50] */ BOOL WINAPI PathStripToRootAW(LPVOID lpszPath) @@ -648,43 +157,6 @@ } /************************************************************************* - * PathRemoveArgsA [SHLWAPI.@] - * - */ -void WINAPI PathRemoveArgsA(LPSTR lpszPath) -{ - TRACE("%s\n",lpszPath); - - if(lpszPath) - { - LPSTR lpszArgs = PathGetArgsA(lpszPath); - if (!*lpszArgs) - { - LPSTR lpszLastChar = CharPrevA(lpszPath, lpszArgs); - if(*lpszLastChar==' ') *lpszLastChar = '\0'; - } - } -} - -/************************************************************************* - * PathRemoveArgsW [SHLWAPI.@] - */ -void WINAPI PathRemoveArgsW(LPWSTR lpszPath) -{ - TRACE("%s\n", debugstr_w(lpszPath)); - - if(lpszPath) - { - LPWSTR lpszArgs = PathGetArgsW(lpszPath); - if (!*lpszArgs) - { - LPWSTR lpszLastChar = CharPrevW(lpszPath, lpszArgs); - if(*lpszLastChar==' ') *lpszLastChar = '\0'; - } - } -} - -/************************************************************************* * PathRemoveArgsAW [SHELL32.251] */ void WINAPI PathRemoveArgsAW(LPVOID lpszPath) @@ -695,30 +167,6 @@ } /************************************************************************* - * 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) @@ -728,53 +176,6 @@ 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. - * - * FIXME - * "c:\": keep backslash - */ -LPSTR WINAPI PathRemoveBackslashA( LPSTR lpszPath ) -{ - int len; - LPSTR szTemp = NULL; - - if(lpszPath) - { - len = strlen(lpszPath); - szTemp = CharPrevA(lpszPath, lpszPath+len); - if (! PathIsRootA(lpszPath)) - { - if (*szTemp == '\\') *szTemp = '\0'; - } - } - return szTemp; -} - -/************************************************************************* - * PathRemoveBackslashW [SHLWAPI.@] - */ -LPWSTR WINAPI PathRemoveBackslashW( LPWSTR lpszPath ) -{ - int len; - LPWSTR szTemp = NULL; - - if(lpszPath) - { - len = lstrlenW(lpszPath); - szTemp = CharPrevW(lpszPath, lpszPath+len); - if (! PathIsRootW(lpszPath)) - { - if (*szTemp == '\\') *szTemp = '\0'; - } - } - return szTemp; -} /* Path Manipulations @@ -809,47 +210,6 @@ } /************************************************************************* - * PathRemoveBlanksA [SHLWAPI.@] - * - * NOTES - * remove spaces from beginning and end of passed string - */ -void WINAPI PathRemoveBlanksA(LPSTR str) -{ - LPSTR x = str; - - TRACE("%s\n",str); - - if(str) - { - while (*x==' ') x = CharNextA(x); - if (x!=str) strcpy(str,x); - x=str+strlen(str)-1; - while (*x==' ') x = CharPrevA(str, x); - if (*x==' ') *x='\0'; - } -} - -/************************************************************************* - * PathRemoveBlanksW [SHLWAPI.@] - */ -void WINAPI PathRemoveBlanksW(LPWSTR str) -{ - LPWSTR x = str; - - TRACE("%s\n",debugstr_w(str)); - - if(str) - { - while (*x==' ') x = CharNextW(x); - if (x!=str) lstrcpyW(str,x); - x=str+lstrlenW(str)-1; - while (*x==' ') x = CharPrevW(str, x); - if (*x==' ') *x='\0'; - } -} - -/************************************************************************* * PathRemoveBlanksAW [SHELL32.33] */ void WINAPI PathRemoveBlanksAW(LPVOID str) @@ -860,47 +220,6 @@ } /************************************************************************* - * PathQuoteSpacesA [SHLWAPI.@] - * - */ -LPSTR WINAPI PathQuoteSpacesA(LPSTR lpszPath) -{ - TRACE("%s\n",lpszPath); - - if(StrChrA(lpszPath,' ')) - { - int len = strlen(lpszPath); - RtlMoveMemory(lpszPath+1, lpszPath, len); - *(lpszPath++) = '"'; - lpszPath += len; - *(lpszPath++) = '"'; - *(lpszPath) = '\0'; - return --lpszPath; - } - return 0; -} - -/************************************************************************* - * PathQuoteSpacesW [SHLWAPI.@] - */ -LPWSTR WINAPI PathQuoteSpacesW(LPWSTR lpszPath) -{ - TRACE("%s\n",debugstr_w(lpszPath)); - - if(StrChrW(lpszPath,' ')) - { - int len = lstrlenW(lpszPath); - RtlMoveMemory(lpszPath+1, lpszPath, len*sizeof(WCHAR)); - *(lpszPath++) = '"'; - lpszPath += len; - *(lpszPath++) = '"'; - *(lpszPath) = '\0'; - return --lpszPath; - } - return 0; -} - -/************************************************************************* * PathQuoteSpacesAW [SHELL32.55] */ LPVOID WINAPI PathQuoteSpacesAW (LPVOID lpszPath) @@ -911,45 +230,6 @@ } /************************************************************************* - * PathUnquoteSpacesA [SHLWAPI.@] - * - * NOTES - * unquote string (remove ") - */ -VOID WINAPI PathUnquoteSpacesA(LPSTR str) -{ - DWORD len = lstrlenA(str); - - TRACE("%s\n",str); - - if (*str!='"') - return; - if (str[len-1]!='"') - return; - str[len-1]='\0'; - lstrcpyA(str,str+1); - return; -} - -/************************************************************************* - * PathUnquoteSpacesW [SHLWAPI.@] - */ -VOID WINAPI PathUnquoteSpacesW(LPWSTR str) -{ - DWORD len = strlenW(str); - - TRACE("%s\n",debugstr_w(str)); - - if (*str!='"') - return; - if (str[len-1]!='"') - return; - str[len-1]='\0'; - strcpyW(str,str+1); - return; -} - -/************************************************************************* * PathUnquoteSpacesAW [SHELL32.56] */ VOID WINAPI PathUnquoteSpacesAW(LPVOID str) @@ -961,43 +241,6 @@ } /************************************************************************* - * PathParseIconLocationA [SHLWAPI.@] - */ -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 */ - } - - PathUnquoteSpacesA(lpszPath); - return 0; -} - -/************************************************************************* - * PathParseIconLocationW [SHLWAPI.@] - */ -int WINAPI PathParseIconLocationW(LPWSTR lpszPath) -{ - LPWSTR lpstrComma = strchrW(lpszPath, ','); - - FIXME("%s stub\n", debugstr_w(lpszPath)); - - if (lpstrComma && lpstrComma[1]) - { - lpstrComma[0]='\0'; -/* return _wtoi(&lpstrComma[1]); FIXME */ - } - PathUnquoteSpacesW(lpszPath); - return 0; -} - -/************************************************************************* * PathParseIconLocationAW [SHELL32.249] */ int WINAPI PathParseIconLocationAW (LPVOID lpszPath) @@ -1011,29 +254,6 @@ ########## 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) @@ -1044,26 +264,6 @@ } /************************************************************************* - * 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) @@ -1074,72 +274,6 @@ } /************************************************************************* - * 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 "\\<computer>\<share>" */ - if (lpszPath[0]=='\\' && lpszPath[1]=='\\') - { - int foundbackslash = 0; - lpszPath += 2; - while (*lpszPath) - { - if (*lpszPath=='\\') foundbackslash++; - lpszPath = CharNextA(lpszPath); - } - 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 "\\<computer>\<share>" */ - if (lpszPath[0]=='\\' && lpszPath[1]=='\\') - { - int foundbackslash = 0; - lpszPath += 2; - while (*lpszPath) - { - if (*lpszPath=='\\') foundbackslash++; - lpszPath = CharNextW(lpszPath); - } - if (foundbackslash <= 1) - return TRUE; - } - return FALSE; - -} - -/************************************************************************* * PathIsRootAW [SHELL32.29] */ BOOL WINAPI PathIsRootAW(LPCVOID lpszPath) @@ -1150,42 +284,6 @@ } /************************************************************************* - * 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 (!strcmpiW(lpszExtension,lpszExtensions[i])) return TRUE; - - return FALSE; -} - -/************************************************************************* * PathIsExeAW [SHELL32.43] */ BOOL WINAPI PathIsExeAW (LPCVOID path) @@ -1196,32 +294,6 @@ } /************************************************************************* - * PathIsDirectoryA [SHLWAPI.@] - */ -BOOL WINAPI PathIsDirectoryA(LPCSTR lpszPath) -{ - DWORD dwAttr; - - TRACE("%s\n", debugstr_a(lpszPath)); - - dwAttr = GetFileAttributesA(lpszPath); - return (dwAttr != -1) ? dwAttr & FILE_ATTRIBUTE_DIRECTORY : 0; -} - -/************************************************************************* - * PathIsDirectoryW [SHLWAPI.@] - */ -BOOL WINAPI PathIsDirectoryW(LPCWSTR lpszPath) -{ - DWORD dwAttr; - - TRACE("%s\n", debugstr_w(lpszPath)); - - dwAttr = GetFileAttributesW(lpszPath); - return (dwAttr != -1) ? dwAttr & FILE_ATTRIBUTE_DIRECTORY : 0; -} - -/************************************************************************* * PathIsDirectoryAW [SHELL32.159] */ BOOL WINAPI PathIsDirectoryAW (LPCVOID lpszPath) @@ -1232,27 +304,6 @@ } /************************************************************************* - * 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) @@ -1263,111 +314,6 @@ } /************************************************************************* - * 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 = CharNextA(name); - mask = CharNextA(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 (toupperW(*mask)!=toupperW(*name) && *mask!='?') return 0; - name = CharNextW(name); - mask = CharNextW(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 = CharNextA(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 = CharNextW(mask); - if (*mask==';') - { - mask++; - while (*mask==' ') mask++; /* masks may be separated by "; " */ - } - } - return 0; -} - -/************************************************************************* * PathMatchSpecAW [SHELL32.46] */ BOOL WINAPI PathMatchSpecAW(LPVOID name, LPVOID mask) @@ -1378,73 +324,6 @@ } /************************************************************************* - * 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++; /* fixme: use CharNext*/ - } - 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 ( toupperW(lpszPath1[0])==toupperW(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++;/* fixme: use CharNext*/ - } - return (lpszPath1[pos] == lpszPath2[pos]); - } - return FALSE; -} - -/************************************************************************* * PathIsSameRootAW [SHELL32.650] */ BOOL WINAPI PathIsSameRootAW(LPCVOID lpszPath1, LPCVOID lpszPath2) @@ -1455,64 +334,6 @@ } /************************************************************************* - * 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 = strchrW(lpstrPath,':'); - if(!lpstrRes) return FALSE; - iSize = lpstrRes - lpstrPath; - - while(SupportedProtocol[i]) - { - if (iSize == strlenW(SupportedProtocol[i])) - if(!strncmpiW(lpstrPath, SupportedProtocol[i], iSize)) - return TRUE; - i++; - } - - return FALSE; -} - -/************************************************************************* * IsLFNDriveA [SHELL32.119] * * NOTES @@ -1527,118 +348,6 @@ return fnlen>12; } -/************************************************************************* - * PathIsContentTypeA - */ -BOOL WINAPI PathIsContentTypeA(LPCSTR pszPath, LPCSTR pszContentType) -{ - FIXME("%s %s\n", pszPath, pszContentType); - return FALSE; -} - -/************************************************************************* - * PathIsContentTypeW - */ -BOOL WINAPI PathIsContentTypeW(LPCWSTR pszPath, LPCWSTR pszContentType) -{ - FIXME("%s %s\n", debugstr_w(pszPath), debugstr_w(pszContentType)); - return FALSE; -} - -/************************************************************************* - * PathIsFileSpecA - */ -BOOL WINAPI PathIsFileSpecA(LPCSTR pszPath) -{ - FIXME("%s\n", pszPath); - return FALSE; -} - -/************************************************************************* - * PathIsFileSpecW - */ -BOOL WINAPI PathIsFileSpecW(LPCWSTR pszPath) -{ - FIXME("%s\n", debugstr_w(pszPath)); - return FALSE; -} - -/************************************************************************* - * PathIsPrefixA - */ -BOOL WINAPI PathIsPrefixA(LPCSTR pszPrefix, LPCSTR pszPath) -{ - FIXME("%s %s\n", pszPrefix, pszPath); - return FALSE; -} - -/************************************************************************* - * PathIsPrefixW - */ -BOOL WINAPI PathIsPrefixW(LPCWSTR pszPrefix, LPCWSTR pszPath) -{ - FIXME("%s %s\n", debugstr_w(pszPrefix), debugstr_w(pszPath)); - return FALSE; -} - -/************************************************************************* - * PathIsSystemFolderA - */ -BOOL WINAPI PathIsSystemFolderA(LPCSTR pszPath, DWORD dwAttrb) -{ - FIXME("%s 0x%08lx\n", pszPath, dwAttrb); - return FALSE; -} - -/************************************************************************* - * PathIsSystemFolderW - */ -BOOL WINAPI PathIsSystemFolderW(LPCWSTR pszPath, DWORD dwAttrb) -{ - FIXME("%s 0x%08lx\n", debugstr_w(pszPath), dwAttrb); - return FALSE; -} - -/************************************************************************* - * PathIsUNCServerA - */ -BOOL WINAPI PathIsUNCServerA( - LPCSTR pszPath) -{ - FIXME("%s\n", pszPath); - return FALSE; -} - -/************************************************************************* - * PathIsUNCServerW - */ -BOOL WINAPI PathIsUNCServerW( - LPCWSTR pszPath) -{ - FIXME("%s\n", debugstr_w(pszPath)); - return FALSE; -} - -/************************************************************************* - * PathIsUNCServerShareA - */ -BOOL WINAPI PathIsUNCServerShareA( - LPCSTR pszPath) -{ - FIXME("%s\n", pszPath); - return FALSE; -} - -/************************************************************************* - * PathIsUNCServerShareW - */ -BOOL WINAPI PathIsUNCServerShareW( - LPCWSTR pszPath) -{ - FIXME("%s\n", debugstr_w(pszPath)); - return FALSE; -} - /* ########## Creating Something Unique ########## */ @@ -1712,24 +421,6 @@ */ /************************************************************************* - * PathFindOnPathA [SHELL32.145] - */ -BOOL WINAPI PathFindOnPathA(LPSTR sFile, LPCSTR sOtherDirs) -{ - FIXME("%s %s\n",sFile, sOtherDirs); - return FALSE; -} - -/************************************************************************* - * PathFindOnPathW [SHELL32] - */ -BOOL WINAPI PathFindOnPathW(LPWSTR sFile, LPCWSTR sOtherDirs) -{ - FIXME("%s %s\n",debugstr_w(sFile), debugstr_w(sOtherDirs)); - return FALSE; -} - -/************************************************************************* * PathFindOnPathAW [SHELL32] */ BOOL WINAPI PathFindOnPathAW(LPVOID sFile, LPCVOID sOtherDirs) @@ -1740,24 +431,6 @@ } /************************************************************************* - * PathCleanupSpecA [SHELL32.171] - */ -DWORD WINAPI PathCleanupSpecA(LPSTR x, LPSTR y) -{ - FIXME("(%p %s, %p %s) stub\n",x,debugstr_a(x),y,debugstr_a(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) @@ -1878,56 +551,11 @@ return PathProcessCommandA(lpszPath, lpszBuff, dwBuffSize, dwFlags); } -/************************************************************************* - * PathCompactPathExA - */ -BOOL WINAPI PathCompactPathExA( - LPSTR pszOut, - LPCSTR pszSrc, - UINT cchMax, - DWORD dwFlags) -{ - FIXME("%p %s 0x%08x 0x%08lx\n", pszOut, pszSrc, cchMax, dwFlags); - return FALSE; -} - -/************************************************************************* - * PathCompactPathExW - */ -BOOL WINAPI PathCompactPathExW( - LPWSTR pszOut, - LPCWSTR pszSrc, - UINT cchMax, - DWORD dwFlags) -{ - FIXME("%p %s 0x%08x 0x%08lx\n", pszOut, debugstr_w(pszSrc), cchMax, dwFlags); - return FALSE; -} - /* ########## 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) @@ -2216,474 +844,3 @@ CSIDL_FOLDER_MASK & nFolder, CSIDL_FLAG_CREATE & nFolder )) ? S_OK : E_FAIL; } - -/************************************************************************* - * PathCanonicalizeA - * - * FIXME - * returnvalue, use CharNext - */ - -BOOL WINAPI PathCanonicalizeA(LPSTR pszBuf, LPCSTR pszPath) -{ - int OffsetMin = 0, OffsetSrc = 0, OffsetDst = 0, LenSrc = strlen(pszPath); - BOOL bModifyed = FALSE; - - TRACE("%p %s\n", pszBuf, 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", pszBuf, bModifyed); - return bModifyed; -} - - -/************************************************************************* - * PathCanonicalizeW - * - * FIXME - * returnvalue, use CharNext - */ -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; -} - -/************************************************************************* - * PathFindNextComponentA - * - * NOTES - * special cases: - * "" null - * aa "" (pointer to traling NULL) - * aa\ "" (pointer to traling NULL) - * aa\\ "" (pointer to traling NULL) - * aa\\bb bb - * aa\\\bb \bb - * c:\aa\ "aa\" - * \\aa aa - * \\aa\b aa\b -*/ -LPSTR WINAPI PathFindNextComponentA(LPCSTR pszPath) -{ - LPSTR pos; - - TRACE("%s\n", pszPath); - - if(!pszPath || !*pszPath) return NULL; - if(!(pos = StrChrA(pszPath, '\\'))) - return (LPSTR) pszPath + strlen(pszPath); - pos++; - if(pos[0] == '\\') pos++; - return pos; -} - -/************************************************************************* - * PathFindNextComponentW - */ -LPWSTR WINAPI PathFindNextComponentW(LPCWSTR pszPath) -{ - LPWSTR pos; - - TRACE("%s\n", debugstr_w(pszPath)); - - if(!pszPath || !*pszPath) return NULL; - if (!(pos = StrChrW(pszPath, '\\'))) - return (LPWSTR) pszPath + lstrlenW(pszPath); - pos++; - if(pos[0] == '\\') pos++; - return pos; -} - -/************************************************************************* - * PathAddExtensionA - * - * NOTES - * it adds never a dot - */ - -BOOL WINAPI PathAddExtensionA( - LPSTR pszPath, - LPCSTR pszExtension) -{ - if (*pszPath) - { - if (*(PathFindExtensionA(pszPath))) return FALSE; - - if (!pszExtension || *pszExtension=='\0') - strcat(pszPath, "exe"); - else - strcat(pszPath, pszExtension); - } - - return TRUE; -} - -/************************************************************************* - * PathAddExtensionW - */ -BOOL WINAPI PathAddExtensionW( - LPWSTR pszPath, - LPCWSTR pszExtension) -{ - static const WCHAR ext[] = { 'e','x','e',0 }; - - if (*pszPath) - { - if (*(PathFindExtensionW(pszPath))) return FALSE; - - if (!pszExtension || *pszExtension=='\0') - lstrcatW(pszPath, ext); - else - lstrcatW(pszPath, pszExtension); - } - return TRUE; - -} - -/************************************************************************* - * PathMakePrettyA - */ -BOOL WINAPI PathMakePrettyA( - LPSTR lpPath) -{ - FIXME("%s\n", lpPath); - return TRUE; -} - -/************************************************************************* - * PathMakePrettyW - */ -BOOL WINAPI PathMakePrettyW( - LPWSTR lpPath) -{ - FIXME("%s\n", debugstr_w(lpPath)); - return TRUE; - -} - -/************************************************************************* - * PathCommonPrefixA - */ -int WINAPI PathCommonPrefixA( - LPCSTR pszFile1, - LPCSTR pszFile2, - LPSTR achPath) -{ - FIXME("%s %s %p\n", pszFile1, pszFile2, achPath); - return 0; -} - -/************************************************************************* - * PathCommonPrefixW - */ -int WINAPI PathCommonPrefixW( - LPCWSTR pszFile1, - LPCWSTR pszFile2, - LPWSTR achPath) -{ - FIXME("%s %s %p\n", debugstr_w(pszFile1), debugstr_w(pszFile2),achPath ); - return 0; -} - -/************************************************************************* - * PathCompactPathA - */ -BOOL WINAPI PathCompactPathA(HDC hDC, LPSTR pszPath, UINT dx) -{ - FIXME("0x%08x %s 0x%08x\n", hDC, pszPath, dx); - return FALSE; -} - -/************************************************************************* - * PathCompactPathW - */ -BOOL WINAPI PathCompactPathW(HDC hDC, LPWSTR pszPath, UINT dx) -{ - FIXME("0x%08x %s 0x%08x\n", hDC, debugstr_w(pszPath), dx); - return FALSE; -} - -/************************************************************************* - * PathGetCharTypeA - */ -UINT WINAPI PathGetCharTypeA(UCHAR ch) -{ - FIXME("%c\n", ch); - return 0; -} - -/************************************************************************* - * PathGetCharTypeW - */ -UINT WINAPI PathGetCharTypeW(WCHAR ch) -{ - FIXME("%c\n", ch); - return 0; -} - -/************************************************************************* - * PathMakeSystemFolderA - */ -BOOL WINAPI PathMakeSystemFolderA(LPCSTR pszPath) -{ - FIXME("%s\n", pszPath); - return FALSE; -} - -/************************************************************************* - * PathMakeSystemFolderW - */ -BOOL WINAPI PathMakeSystemFolderW(LPCWSTR pszPath) -{ - FIXME("%s\n", debugstr_w(pszPath)); - return FALSE; -} - -/************************************************************************* - * PathRenameExtensionA - */ -BOOL WINAPI PathRenameExtensionA(LPSTR pszPath, LPCSTR pszExt) -{ - FIXME("%s %s\n", pszPath, pszExt); - return FALSE; -} - -/************************************************************************* - * PathRenameExtensionW - */ -BOOL WINAPI PathRenameExtensionW(LPWSTR pszPath, LPCWSTR pszExt) -{ - FIXME("%s %s\n", debugstr_w(pszPath), debugstr_w(pszExt)); - return FALSE; -} - -/************************************************************************* - * PathSearchAndQualifyA - */ -BOOL WINAPI PathSearchAndQualifyA( - LPCSTR pszPath, - LPSTR pszBuf, - UINT cchBuf) -{ - FIXME("%s %s 0x%08x\n", pszPath, pszBuf, cchBuf); - return FALSE; -} - -/************************************************************************* - * PathSearchAndQualifyW - */ -BOOL WINAPI PathSearchAndQualifyW( - LPCWSTR pszPath, - LPWSTR pszBuf, - UINT cchBuf) -{ - FIXME("%s %s 0x%08x\n", debugstr_w(pszPath), debugstr_w(pszBuf), cchBuf); - return FALSE; -} - -/************************************************************************* - * PathSkipRootA - */ -LPSTR WINAPI PathSkipRootA(LPCSTR pszPath) -{ - FIXME("%s\n", pszPath); - return (LPSTR)pszPath; -} - -/************************************************************************* - * PathSkipRootW - */ -LPWSTR WINAPI PathSkipRootW(LPCWSTR pszPath) -{ - FIXME("%s\n", debugstr_w(pszPath)); - return (LPWSTR)pszPath; -} - -/************************************************************************* - * PathCreateFromUrlA - */ -HRESULT WINAPI PathCreateFromUrlA( - LPCSTR pszUrl, - LPSTR pszPath, - LPDWORD pcchPath, - DWORD dwFlags) -{ - FIXME("%s %p %p 0x%08lx\n", - pszUrl, pszPath, pcchPath, dwFlags); - return S_OK; -} - -/************************************************************************* - * PathCreateFromUrlW - */ -HRESULT WINAPI PathCreateFromUrlW( - LPCWSTR pszUrl, - LPWSTR pszPath, - LPDWORD pcchPath, - DWORD dwFlags) -{ - FIXME("%s %p %p 0x%08lx\n", - debugstr_w(pszUrl), pszPath, pcchPath, dwFlags); - return S_OK; -} - -/************************************************************************* - * PathRelativePathToA - */ -BOOL WINAPI PathRelativePathToA( - LPSTR pszPath, - LPCSTR pszFrom, - DWORD dwAttrFrom, - LPCSTR pszTo, - DWORD dwAttrTo) -{ - FIXME("%s %s 0x%08lx %s 0x%08lx\n", - pszPath, pszFrom, dwAttrFrom, pszTo, dwAttrTo); - return FALSE; -} - -/************************************************************************* - * PathRelativePathToW - */ -BOOL WINAPI PathRelativePathToW( - LPWSTR pszPath, - LPCWSTR pszFrom, - DWORD dwAttrFrom, - LPCWSTR pszTo, - DWORD dwAttrTo) -{ - FIXME("%s %s 0x%08lx %s 0x%08lx\n", - debugstr_w(pszPath), debugstr_w(pszFrom), dwAttrFrom, debugstr_w(pszTo), dwAttrTo); - return FALSE; -} - -/************************************************************************* - * PathUnmakeSystemFolderA - */ -BOOL WINAPI PathUnmakeSystemFolderA(LPCSTR pszPath) -{ - FIXME("%s\n", pszPath); - return FALSE; -} - -/************************************************************************* - * PathUnmakeSystemFolderW - */ -BOOL WINAPI PathUnmakeSystemFolderW(LPCWSTR pszPath) -{ - FIXME("%s\n", debugstr_w(pszPath)); - return FALSE; -}
diff --git a/dlls/shell32/shellreg.c b/dlls/shell32/shellreg.c index 450f038..2d639ef 100644 --- a/dlls/shell32/shellreg.c +++ b/dlls/shell32/shellreg.c
@@ -44,7 +44,7 @@ } /************************************************************************* - * SHRegQueryValueExA SHQueryValueExA [SHELL32.509][SHLWAPI.@] + * SHRegQueryValueExA [SHELL32.509] * */ HRESULT WINAPI SHRegQueryValueExA( @@ -75,7 +75,7 @@ } /************************************************************************* - * SHRegQueryValueExW, SHQueryValueExW [NT4.0:SHELL32.511][SHLWAPI.@] + * SHRegQueryValueExW [NT4.0:SHELL32.511] * * FIXME * if the datatype REG_EXPAND_SZ then expand the string and change @@ -96,170 +96,8 @@ return ret; } - /* SHGetValue: Gets a value from the registry */ - /************************************************************************* - * SHGetValueA - * - * Gets a value from the registry - */ -DWORD WINAPI SHGetValueA( - HKEY hkey, - LPCSTR pSubKey, - LPCSTR pValue, - LPDWORD pwType, - LPVOID pvData, - LPDWORD pbData) -{ - HKEY hSubKey; - DWORD res; - - TRACE("(%s %s)\n", pSubKey, pValue); - - if((res = RegOpenKeyA(hkey, pSubKey, &hSubKey))) return res; - res = RegQueryValueExA(hSubKey, pValue, 0, pwType, pvData, pbData); - RegCloseKey( hSubKey ); - - return res; -} - -/************************************************************************* - * SHGetValueW - * - * Gets a value from the registry - */ -DWORD WINAPI SHGetValueW( - HKEY hkey, - LPCWSTR pSubKey, - LPCWSTR pValue, - LPDWORD pwType, - LPVOID pvData, - LPDWORD pbData) -{ - HKEY hSubKey; - DWORD res; - - TRACE("(%s %s)\n", debugstr_w(pSubKey), debugstr_w(pValue)); - - if((res = RegOpenKeyW(hkey, pSubKey, &hSubKey))) return res; - res = RegQueryValueExW(hSubKey, pValue, 0, pwType, pvData, pbData); - RegCloseKey( hSubKey ); - - return res; -} - -/* gets a user-specific registry value. */ - -/************************************************************************* - * SHRegGetUSValueA - * - * Gets a user-specific registry value - */ -LONG WINAPI SHRegGetUSValueA( - LPCSTR pSubKey, - LPCSTR pValue, - LPDWORD pwType, - LPVOID pvData, - LPDWORD pbData, - BOOL fIgnoreHKCU, - LPVOID pDefaultData, - DWORD wDefaultDataSize) -{ - FIXME("(%p),stub!\n", pSubKey); - return ERROR_SUCCESS; /* return success */ -} - -/************************************************************************* - * SHRegGetUSValueW - * - * Gets a user-specific registry value - */ -LONG WINAPI SHRegGetUSValueW( - LPCWSTR pSubKey, - LPCWSTR pValue, - LPDWORD pwType, - LPVOID pvData, - LPDWORD pbData, - BOOL flagIgnoreHKCU, - LPVOID pDefaultData, - DWORD wDefaultDataSize) -{ - FIXME("(%p),stub!\n", pSubKey); - return ERROR_SUCCESS; /* return success */ -} - -/************************************************************************* - * SHRegGetBoolUSValueA - */ -BOOL WINAPI SHRegGetBoolUSValueA( - LPCSTR pszSubKey, - LPCSTR pszValue, - BOOL fIgnoreHKCU, - BOOL fDefault) -{ - FIXME("%s %s\n", pszSubKey,pszValue); - return fDefault; -} - -/************************************************************************* - * SHRegGetBoolUSValueW - */ -BOOL WINAPI SHRegGetBoolUSValueW( - LPCWSTR pszSubKey, - LPCWSTR pszValue, - BOOL fIgnoreHKCU, - BOOL fDefault) -{ - FIXME("%s %s\n", debugstr_w(pszSubKey),debugstr_w(pszValue)); - return fDefault; -} - -/************************************************************************* - * SHRegQueryUSValueA [SHLWAPI] - */ -LONG WINAPI SHRegQueryUSValueA( - HKEY/*HUSKEY*/ hUSKey, - LPCSTR pszValue, - LPDWORD pdwType, - void *pvData, - LPDWORD pcbData, - BOOL fIgnoreHKCU, - void *pvDefaultData, - DWORD dwDefaultDataSize) -{ - FIXME("%s stub\n",pszValue); - return 1; -} - -/************************************************************************* - * SHRegGetPathA - */ -DWORD WINAPI SHRegGetPathA( - HKEY hKey, - LPCSTR pcszSubKey, - LPCSTR pcszValue, - LPSTR pszPath, - DWORD dwFlags) -{ - FIXME("%s %s\n", pcszSubKey, pcszValue); - return 0; -} - -/************************************************************************* - * SHRegGetPathW - */ -DWORD WINAPI SHRegGetPathW( - HKEY hKey, - LPCWSTR pcszSubKey, - LPCWSTR pcszValue, - LPWSTR pszPath, - DWORD dwFlags) -{ - FIXME("%s %s\n", debugstr_w(pcszSubKey), debugstr_w(pcszValue)); - return 0; -} -/************************************************************************* - * SHRegDeleteKeyA and SHDeleteKeyA + * SHRegDeleteKeyA [SHELL32] */ HRESULT WINAPI SHRegDeleteKeyA( HKEY hkey, @@ -270,7 +108,7 @@ } /************************************************************************* - * SHRegDeleteKeyW and SHDeleteKeyA + * SHRegDeleteKeyW [SHELL32] */ HRESULT WINAPI SHRegDeleteKeyW( HKEY hkey, @@ -281,21 +119,6 @@ } /************************************************************************* - * SHSetValueA [SHLWAPI] - */ -DWORD WINAPI SHSetValueA( - HKEY hkey, - LPCSTR pszSubKey, - LPCSTR pszValue, - DWORD dwType, - LPCVOID pvData, - DWORD cbData) -{ - FIXME("(%s %s)stub\n",pszSubKey, pszValue); - return 1; -} - -/************************************************************************* * SHRegCloseKey [NT4.0:SHELL32.505] * */
diff --git a/dlls/shell32/shellstring.c b/dlls/shell32/shellstring.c index f01b6df..c6f08fd 100644 --- a/dlls/shell32/shellstring.c +++ b/dlls/shell32/shellstring.c
@@ -27,65 +27,14 @@ */ HRESULT WINAPI StrRetToStrNA (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl) { - TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl); - - switch (src->uType) - { - case STRRET_WSTR: - WideCharToMultiByte(CP_ACP, 0, src->u.pOleStr, -1, (LPSTR)dest, len, NULL, NULL); - SHFree(src->u.pOleStr); - break; - - case STRRET_CSTRA: - lstrcpynA((LPSTR)dest, src->u.cStr, len); - break; - - case STRRET_OFFSETA: - lstrcpynA((LPSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len); - break; - - default: - FIXME("unknown type!\n"); - if (len) - { - *(LPSTR)dest = '\0'; - } - return(FALSE); - } - return S_OK; + return StrRetToBufA( src, pidl, dest, len ); } HRESULT WINAPI StrRetToStrNW (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl) { - TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl); - - switch (src->uType) - { - case STRRET_WSTR: - lstrcpynW((LPWSTR)dest, src->u.pOleStr, len); - SHFree(src->u.pOleStr); - break; - - case STRRET_CSTRA: - lstrcpynAtoW((LPWSTR)dest, src->u.cStr, len); - break; - - case STRRET_OFFSETA: - if (pidl) - { - lstrcpynAtoW((LPWSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len); - } - break; - - default: - FIXME("unknown type!\n"); - if (len) - { *(LPSTR)dest = '\0'; - } - return(FALSE); - } - return S_OK; + return StrRetToBufW( src, pidl, dest, len ); } + HRESULT WINAPI StrRetToStrNAW (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl) { if(VERSION_OsIsUnicode()) @@ -93,32 +42,6 @@ return StrRetToStrNA (dest, len, src, pidl); } -/************************************************************************* - * StrRetToBufA [SHLWAPI.@] - * - * converts a STRRET to a normal string - * - * NOTES - * the pidl is for STRRET OFFSET - */ -HRESULT WINAPI StrRetToBufA (LPSTRRET src, LPITEMIDLIST pidl, LPSTR dest, DWORD len) -{ - return StrRetToStrNA(dest, len, src, pidl); -} - -/************************************************************************* - * StrRetToBufW [SHLWAPI.@] - * - * converts a STRRET to a normal string - * - * NOTES - * the pidl is for STRRET OFFSET - */ -HRESULT WINAPI StrRetToBufW (LPSTRRET src, LPITEMIDLIST pidl, LPWSTR dest, DWORD len) -{ - return StrRetToStrNW(dest, len, src, pidl); -} - /************************* string functions ****************************/ /************************************************************************* @@ -176,202 +99,6 @@ return strncmpiW(wstr1, wstr2, len); } -/************************************************************************* - * StrStrA [SHLWAPI] - */ -LPSTR WINAPI StrStrA(LPCSTR lpFirst, LPCSTR lpSrch) -{ - while (*lpFirst) - { - LPCSTR p1 = lpFirst, p2 = lpSrch; - while (*p1 && *p2 && *p1 == *p2) { p1++; p2++; } - if (!*p2) return (LPSTR)lpFirst; - lpFirst++; - } - return NULL; -} - -/************************************************************************* - * StrStrW [SHLWAPI] - */ -LPWSTR WINAPI StrStrW(LPCWSTR lpFirst, LPCWSTR lpSrch) -{ - while (*lpFirst) - { - LPCWSTR p1 = lpFirst, p2 = lpSrch; - while (*p1 && *p2 && *p1 == *p2) { p1++; p2++; } - if (!*p2) return (LPWSTR)lpFirst; - lpFirst++; - } - return NULL; -} - -/************************************************************************* - * StrStrIA [SHLWAPI] - */ -LPSTR WINAPI StrStrIA(LPCSTR lpFirst, LPCSTR lpSrch) -{ - while (*lpFirst) - { - LPCSTR p1 = lpFirst, p2 = lpSrch; - while (*p1 && *p2 && toupper(*p1) == toupper(*p2)) { p1++; p2++; } - if (!*p2) return (LPSTR)lpFirst; - lpFirst++; - } - return NULL; -} - -/************************************************************************* - * StrStrIW [SHLWAPI] - */ -LPWSTR WINAPI StrStrIW(LPCWSTR lpFirst, LPCWSTR lpSrch) -{ - while (*lpFirst) - { - LPCWSTR p1 = lpFirst, p2 = lpSrch; - while (*p1 && *p2 && toupperW(*p1) == toupperW(*p2)) { p1++; p2++; } - if (!*p2) return (LPWSTR)lpFirst; - lpFirst++; - } - return NULL; -} - -/************************************************************************* - * StrToIntA [SHLWAPI] - */ -int WINAPI StrToIntA(LPCSTR lpSrc) -{ - TRACE("%s\n", lpSrc); - return atol(lpSrc); -} - -/************************************************************************* - * StrToIntW [SHLWAPI] - */ -int WINAPI StrToIntW(LPCWSTR lpSrc) -{ - int ret; - LPSTR lpStr = HEAP_strdupWtoA(GetProcessHeap(),0,lpSrc); - - TRACE("%s\n", debugstr_w(lpSrc)); - - ret = atol(lpStr); - HeapFree(GetProcessHeap(),0,lpStr); - return ret; -} - -/************************************************************************* - * StrDupA [SHLWAPI] - */ -LPSTR WINAPI StrDupA (LPCSTR lpSrc) -{ - int len = strlen(lpSrc); - LPSTR lpDest = (LPSTR) LocalAlloc(LMEM_FIXED, len+1); - - TRACE("%s\n", lpSrc); - - if (lpDest) strcpy(lpDest, lpSrc); - return lpDest; -} - -/************************************************************************* - * StrDupW [SHLWAPI] - */ -LPWSTR WINAPI StrDupW (LPCWSTR lpSrc) -{ - int len = lstrlenW(lpSrc); - LPWSTR lpDest = (LPWSTR) LocalAlloc(LMEM_FIXED, sizeof(WCHAR) * (len+1)); - - TRACE("%s\n", debugstr_w(lpSrc)); - - if (lpDest) lstrcpyW(lpDest, lpSrc); - return lpDest; -} - -/************************************************************************* - * StrCSpnA [SHLWAPI] - */ -int WINAPI StrCSpnA (LPCSTR lpStr, LPCSTR lpSet) -{ - int i,j, pos = strlen(lpStr); - - TRACE("(%p %s %p %s)\n", - lpStr, debugstr_a(lpStr), lpSet, debugstr_a(lpSet)); - - for (i=0; i < strlen(lpSet) ; i++ ) - { - for (j = 0; j < pos;j++) - { - if (lpStr[j] == lpSet[i]) - { - pos = j; - } - } - } - TRACE("-- %u\n", pos); - return pos; -} - -/************************************************************************* - * StrCSpnW [SHLWAPI] - */ -int WINAPI StrCSpnW (LPCWSTR lpStr, LPCWSTR lpSet) -{ - int i,j, pos = lstrlenW(lpStr); - - TRACE("(%p %s %p %s)\n", - lpStr, debugstr_w(lpStr), lpSet, debugstr_w(lpSet)); - - for (i=0; i < lstrlenW(lpSet) ; i++ ) - { - for (j = 0; j < pos;j++) - { - if (lpStr[j] == lpSet[i]) - { - pos = j; - } - } - } - TRACE("-- %u\n", pos); - return pos; -} - -/************************************************************************* - * StrCatBuffA [SHLWAPI] - * - * Appends back onto front, stopping when front is size-1 characters long. - * Returns front. - * - */ -LPSTR WINAPI StrCatBuffA(LPSTR front, LPCSTR back, INT size) -{ - LPSTR dst = front + lstrlenA(front); - LPCSTR src = back, end = front + size - 1; - - while(dst < end && *src) - *dst++ = *src++; - *dst = '\0'; - return front; -} - -/************************************************************************* - * StrCatBuffW [SHLWAPI] - * - * Appends back onto front, stopping when front is size-1 characters long. - * Returns front. - * - */ -LPWSTR WINAPI StrCatBuffW(LPWSTR front, LPCWSTR back, INT size) -{ - LPWSTR dst = front + lstrlenW(front); - LPCWSTR src = back, end = front + size - 1; - - while(dst < end && *src) - *dst++ = *src++; - *dst = '\0'; - return front; -} - /************************* OLESTR functions ****************************/ /************************************************************************ @@ -456,48 +183,3 @@ return OleStrToStrNW (lpOut, nOut, lpIn, nIn); return OleStrToStrNA (lpOut, nOut, lpIn, nIn); } - -/************************************************************************* - * StrFormatByteSizeA [SHLWAPI] - */ -LPSTR WINAPI StrFormatByteSizeA ( DWORD dw, LPSTR pszBuf, UINT cchBuf ) -{ char buf[64]; - TRACE("%lx %p %i\n", dw, pszBuf, cchBuf); - if ( dw<1024L ) - { sprintf (buf,"%3.1f bytes", (FLOAT)dw); - } - else if ( dw<1048576L) - { sprintf (buf,"%3.1f KB", (FLOAT)dw/1024); - } - else if ( dw < 1073741824L) - { sprintf (buf,"%3.1f MB", (FLOAT)dw/1048576L); - } - else - { sprintf (buf,"%3.1f GB", (FLOAT)dw/1073741824L); - } - lstrcpynA (pszBuf, buf, cchBuf); - return pszBuf; -} - -/************************************************************************* - * StrFormatByteSizeW [SHLWAPI] - */ -LPWSTR WINAPI StrFormatByteSizeW ( DWORD dw, LPWSTR pszBuf, UINT cchBuf ) -{ char buf[64]; - TRACE("%lx %p %i\n", dw, pszBuf, cchBuf); - if ( dw<1024L ) - { sprintf (buf,"%3.1f bytes", (FLOAT)dw); - } - else if ( dw<1048576L) - { sprintf (buf,"%3.1f KB", (FLOAT)dw/1024); - } - else if ( dw < 1073741824L) - { sprintf (buf,"%3.1f MB", (FLOAT)dw/1048576L); - } - else - { sprintf (buf,"%3.1f GB", (FLOAT)dw/1073741824L); - } - lstrcpynAtoW (pszBuf, buf, cchBuf); - return pszBuf; -} -
diff --git a/dlls/shlwapi/Makefile.in b/dlls/shlwapi/Makefile.in index 817af6a..86fecb2 100644 --- a/dlls/shlwapi/Makefile.in +++ b/dlls/shlwapi/Makefile.in
@@ -4,11 +4,14 @@ VPATH = @srcdir@ MODULE = shlwapi SOVERSION = 1.0 -IMPORTS = shell32 C_SRCS = \ ordinal.c \ - shlwapi_main.c + path.c \ + reg.c \ + regstream.c \ + shlwapi_main.c \ + string.c @MAKE_DLL_RULES@
diff --git a/dlls/shlwapi/ordinal.c b/dlls/shlwapi/ordinal.c index 0493ff2..dd0f5c3 100644 --- a/dlls/shlwapi/ordinal.c +++ b/dlls/shlwapi/ordinal.c
@@ -83,8 +83,13 @@ LPWSTR str, /* [out] buffer */ INT cmax) /* [in] size of buffer */ { - TRACE("(%s %p 0x%08x)stub\n", debugstr_guid(guid), str, cmax); - return StringFromGUID2(guid, str, cmax); + char xguid[40]; + + sprintf( xguid, "{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", + guid->Data1, guid->Data2, guid->Data3, + guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3], + guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7] ); + return MultiByteToWideChar( CP_ACP, 0, xguid, -1, str, cmax ); } /************************************************************************* @@ -388,3 +393,49 @@ return 0xabba1247; } +/************************************************************************* + * UrlEscapeA [SHLWAPI] + */ +HRESULT WINAPI UrlEscapeA( + LPCSTR pszUrl, + LPSTR pszEscaped, + LPDWORD pcchEscaped, + DWORD dwFlags) +{ + FIXME("(%s %p %p 0x%08lx)stub\n",debugstr_a(pszUrl), + pszEscaped, pcchEscaped, dwFlags); + return 0; +} + +/************************************************************************* + * UrlEscapeW [SHLWAPI] + */ +HRESULT WINAPI UrlEscapeW( + LPCWSTR pszUrl, + LPWSTR pszEscaped, + LPDWORD pcchEscaped, + DWORD dwFlags) +{ + FIXME("(%s %p %p 0x%08lx)stub\n",debugstr_w(pszUrl), + pszEscaped, pcchEscaped, dwFlags); + return 0; +} + + +/************************************************************************* + * SHCreateShellPalette [SHLWAPI.@] + */ +HPALETTE WINAPI SHCreateShellPalette(HDC hdc) +{ + FIXME("stub\n"); + return CreateHalftonePalette(hdc); +} + +/************************************************************************* + * SHIsLowMemoryMachine [SHLWAPI.@] + */ +DWORD WINAPI SHIsLowMemoryMachine (DWORD x) +{ + FIXME("0x%08lx\n", x); + return 0; +}
diff --git a/dlls/shlwapi/path.c b/dlls/shlwapi/path.c new file mode 100644 index 0000000..4582d49 --- /dev/null +++ b/dlls/shlwapi/path.c
@@ -0,0 +1,1885 @@ +/* + * Path Functions + */ + +#include <ctype.h> +#include <string.h> + +#include "winerror.h" +#include "wine/unicode.h" +#include "wine/undocshell.h" +#include "shlwapi.h" +#include "debugtools.h" + +DEFAULT_DEBUG_CHANNEL(shell); + +#define isSlash(x) ((x)=='\\' || (x)=='/') +/* + ########## Combining and Constructing paths ########## +*/ + +/************************************************************************* + * PathAppendA [SHLWAPI.@] + * + * NOTES + * concat path lpszPath2 onto lpszPath1 + * + * FIXME + * the resulting path is also canonicalized + */ +BOOL WINAPI PathAppendA( + LPSTR lpszPath1, + LPCSTR lpszPath2) +{ + TRACE("%s %s\n",lpszPath1, lpszPath2); + while (lpszPath2[0]=='\\') lpszPath2++; + PathCombineA(lpszPath1,lpszPath1,lpszPath2); + return TRUE; +} + +/************************************************************************* + * PathAppendW [SHLWAPI.@] + */ +BOOL WINAPI PathAppendW( + LPWSTR lpszPath1, + LPCWSTR lpszPath2) +{ + TRACE("%s %s\n",debugstr_w(lpszPath1), debugstr_w(lpszPath2)); + while (lpszPath2[0]=='\\') lpszPath2++; + PathCombineW(lpszPath1,lpszPath1,lpszPath2); + return TRUE; +} + +/************************************************************************* + * 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 + */ +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 (PathGetDriveNumberA(lpszFile) != -1) + { + strcpy(szDest,lpszFile); + } + else if (lpszFile[0] == '\\' ) + { + strcpy(sTemp,lpszDir); + PathStripToRootA(sTemp); + strcat(sTemp,lpszFile); + strcpy(szDest,sTemp); + } + else + { + strcpy(sTemp,lpszDir); + PathAddBackslashA(sTemp); + strcat(sTemp,lpszFile); + strcpy(szDest,sTemp); + } + return szDest; +} + +/************************************************************************* + * PathCombineW [SHLWAPI.@] + */ +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]) ) + { + strcpyW(szDest,lpszDir); + return szDest; + } + + /* if lpszFile is a complete path don't care about lpszDir */ + if (PathGetDriveNumberW(lpszFile) != -1) + { + strcpyW(szDest,lpszFile); + } + else if (lpszFile[0] == (WCHAR)'\\' ) + { + strcpyW(sTemp,lpszDir); + PathStripToRootW(sTemp); + strcatW(sTemp,lpszFile); + strcpyW(szDest,sTemp); + } + else + { + strcpyW(sTemp,lpszDir); + PathAddBackslashW(sTemp); + strcatW(sTemp,lpszFile); + strcpyW(szDest,sTemp); + } + return szDest; +} + +/************************************************************************* + * PathAddBackslashA [SHLWAPI.@] + * + * NOTES + * append \ if there is none + */ +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 = strlenW(lpszPath); + if (len && lpszPath[len-1]!=(WCHAR)'\\') + { + lpszPath[len] = (WCHAR)'\\'; + lpszPath[len+1]= 0x00; + return lpszPath+len+1; + } + return lpszPath+len; +} + +/************************************************************************* + * 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; +} + +/* + Extracting Component Parts +*/ + +/************************************************************************* + * PathFindFileNameA [SHLWAPI.@] + */ +LPSTR WINAPI PathFindFileNameA(LPCSTR lpszPath) +{ + LPCSTR lastSlash = lpszPath; + + TRACE("%s\n",lpszPath); + while (*lpszPath) + { + if ( isSlash(lpszPath[0]) && lpszPath[1]) + lastSlash = lpszPath+1; + lpszPath = CharNextA(lpszPath); + } + return (LPSTR)lastSlash; + +} + +/************************************************************************* + * 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 = CharNextW(lpszPath); + } + return (LPWSTR)wslash; +} + +/************************************************************************* + * 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 (*lpszPath=='.') + lastpoint=lpszPath; + lpszPath = CharNextA(lpszPath); + } + return (LPSTR)(lastpoint?lastpoint:lpszPath); +} + +/************************************************************************* + * PathFindExtensionW [SHLWAPI.@] + */ +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 (*lpszPath==(WCHAR)'.') + lastpoint=lpszPath; + lpszPath = CharNextW(lpszPath); + } + return (LPWSTR)(lastpoint?lastpoint:lpszPath); +} + +/************************************************************************* + * PathGetExtensionA [internal] + * + * NOTES + * exported by ordinal + * return value points to the first char after the dot + */ +LPSTR WINAPI PathGetExtensionA(LPCSTR lpszPath) +{ + TRACE("(%s)\n",lpszPath); + + lpszPath = PathFindExtensionA(lpszPath); + return (LPSTR)(*lpszPath?(lpszPath+1):lpszPath); +} + +/************************************************************************* + * PathGetExtensionW [internal] + */ +LPWSTR WINAPI PathGetExtensionW(LPCWSTR lpszPath) +{ + TRACE("(%s)\n",debugstr_w(lpszPath)); + + lpszPath = PathFindExtensionW(lpszPath); + return (LPWSTR)(*lpszPath?(lpszPath+1):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 = CharNextA(lpszPath); + } + return (LPSTR)lpszPath; +} + +/************************************************************************* + * PathGetArgsW [SHLWAPI.@] + */ +LPWSTR WINAPI PathGetArgsW(LPCWSTR lpszPath) +{ + BOOL qflag = FALSE; + + TRACE("%s\n",debugstr_w(lpszPath)); + + while (*lpszPath) + { + if ((*lpszPath==' ') && !qflag) + return (LPWSTR)lpszPath+1; + if (*lpszPath=='"') + qflag=!qflag; + lpszPath = CharNextW(lpszPath); + } + return (LPWSTR)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 = tolowerW(lpszPath[0]); + + TRACE ("%s\n",debugstr_w(lpszPath)); + + if (!lpszPath || lpszPath[1]!=':' || chr < 'a' || chr > 'z') return -1; + return tolowerW(lpszPath[0]) - 'a' ; +} + +/************************************************************************* + * PathRemoveFileSpecA [SHLWAPI.@] + * + * NOTES + * truncates passed argument to a valid path + * returns if the string was modified or not. + * "\foo\xx\foo"-> "\foo\xx" + * "\" -> "\" + * "a:\foo" -> "a:\" + */ +BOOL WINAPI PathRemoveFileSpecA(LPSTR lpszPath) +{ + LPSTR cutplace = lpszPath; + BOOL ret = FALSE; + + TRACE("%s\n",lpszPath); + + if(lpszPath) + { + while (*lpszPath == '\\') cutplace = ++lpszPath; + + while (*lpszPath) + { + if(lpszPath[0] == '\\') cutplace = lpszPath; + + if(lpszPath[0] == ':') + { + cutplace = lpszPath + 1; + if (lpszPath[1] == '\\') cutplace++; + lpszPath++; + } + lpszPath = CharNextA(lpszPath); + if (!lpszPath) break; + } + + ret = (*cutplace!='\0'); + *cutplace = '\0'; + } + return ret; +} + +/************************************************************************* + * PathRemoveFileSpecW [SHLWAPI.@] + */ +BOOL WINAPI PathRemoveFileSpecW(LPWSTR lpszPath) +{ + LPWSTR cutplace = lpszPath; + BOOL ret = FALSE; + + TRACE("%s\n",debugstr_w(lpszPath)); + + if(lpszPath) + { + while (*lpszPath == '\\') cutplace = ++lpszPath; + + while (*lpszPath) + { + if(lpszPath[0] == '\\') cutplace = lpszPath; + + if(lpszPath[0] == ':') + { + cutplace = lpszPath + 1; + if (lpszPath[1] == '\\') cutplace++; + lpszPath++; + } + lpszPath = CharNextW(lpszPath); + if (!lpszPath) break; + } + + ret = (*cutplace!='\0'); + *cutplace = '\0'; + } + return ret; +} + +/************************************************************************* + * 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)+1); +} + +/************************************************************************* + * PathStripPathW [SHELLWAPI.@] + */ +void WINAPI PathStripPathW(LPWSTR lpszPath) +{ + LPWSTR lpszFileName = PathFindFileNameW(lpszPath); + + TRACE("%s\n", debugstr_w(lpszPath)); + if(lpszFileName) + RtlMoveMemory(lpszPath, lpszFileName, (lstrlenW(lpszFileName)+1)*sizeof(WCHAR)); +} + +/************************************************************************* + * PathStripToRootA [SHLWAPI.@] + */ +BOOL WINAPI PathStripToRootA(LPSTR lpszPath) +{ + TRACE("%s\n", lpszPath); + + if (!lpszPath) return FALSE; + while(!PathIsRootA(lpszPath)) + if (!PathRemoveFileSpecA(lpszPath)) return FALSE; + return TRUE; +} + +/************************************************************************* + * PathStripToRootW [SHLWAPI.@] + */ +BOOL WINAPI PathStripToRootW(LPWSTR lpszPath) +{ + TRACE("%s\n", debugstr_w(lpszPath)); + + if (!lpszPath) return FALSE; + while(!PathIsRootW(lpszPath)) + if (!PathRemoveFileSpecW(lpszPath)) return FALSE; + return TRUE; +} + +/************************************************************************* + * PathRemoveArgsA [SHLWAPI.@] + * + */ +void WINAPI PathRemoveArgsA(LPSTR lpszPath) +{ + TRACE("%s\n",lpszPath); + + if(lpszPath) + { + LPSTR lpszArgs = PathGetArgsA(lpszPath); + if (!*lpszArgs) + { + LPSTR lpszLastChar = CharPrevA(lpszPath, lpszArgs); + if(*lpszLastChar==' ') *lpszLastChar = '\0'; + } + } +} + +/************************************************************************* + * PathRemoveArgsW [SHLWAPI.@] + */ +void WINAPI PathRemoveArgsW(LPWSTR lpszPath) +{ + TRACE("%s\n", debugstr_w(lpszPath)); + + if(lpszPath) + { + LPWSTR lpszArgs = PathGetArgsW(lpszPath); + if (!*lpszArgs) + { + LPWSTR lpszLastChar = CharPrevW(lpszPath, lpszArgs); + if(*lpszLastChar==' ') *lpszLastChar = '\0'; + } + } +} + +/************************************************************************* + * 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'; +} + +/************************************************************************* + * 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. + * + * FIXME + * "c:\": keep backslash + */ +LPSTR WINAPI PathRemoveBackslashA( LPSTR lpszPath ) +{ + int len; + LPSTR szTemp = NULL; + + if(lpszPath) + { + len = strlen(lpszPath); + szTemp = CharPrevA(lpszPath, lpszPath+len); + if (! PathIsRootA(lpszPath)) + { + if (*szTemp == '\\') *szTemp = '\0'; + } + } + return szTemp; +} + +/************************************************************************* + * PathRemoveBackslashW [SHLWAPI.@] + */ +LPWSTR WINAPI PathRemoveBackslashW( LPWSTR lpszPath ) +{ + int len; + LPWSTR szTemp = NULL; + + if(lpszPath) + { + len = lstrlenW(lpszPath); + szTemp = CharPrevW(lpszPath, lpszPath+len); + if (! PathIsRootW(lpszPath)) + { + if (*szTemp == '\\') *szTemp = '\0'; + } + } + return szTemp; +} + + +/* + Path Manipulations +*/ + +/************************************************************************* + * PathRemoveBlanksA [SHLWAPI.@] + * + * NOTES + * remove spaces from beginning and end of passed string + */ +void WINAPI PathRemoveBlanksA(LPSTR str) +{ + LPSTR x = str; + + TRACE("%s\n",str); + + if(str) + { + while (*x==' ') x = CharNextA(x); + if (x!=str) strcpy(str,x); + x=str+strlen(str)-1; + while (*x==' ') x = CharPrevA(str, x); + if (*x==' ') *x='\0'; + } +} + +/************************************************************************* + * PathRemoveBlanksW [SHLWAPI.@] + */ +void WINAPI PathRemoveBlanksW(LPWSTR str) +{ + LPWSTR x = str; + + TRACE("%s\n",debugstr_w(str)); + + if(str) + { + while (*x==' ') x = CharNextW(x); + if (x!=str) lstrcpyW(str,x); + x=str+lstrlenW(str)-1; + while (*x==' ') x = CharPrevW(str, x); + if (*x==' ') *x='\0'; + } +} + +/************************************************************************* + * PathQuoteSpacesA [SHLWAPI.@] + * + */ +LPSTR WINAPI PathQuoteSpacesA(LPSTR lpszPath) +{ + TRACE("%s\n",lpszPath); + + if(StrChrA(lpszPath,' ')) + { + int len = strlen(lpszPath); + RtlMoveMemory(lpszPath+1, lpszPath, len); + *(lpszPath++) = '"'; + lpszPath += len; + *(lpszPath++) = '"'; + *(lpszPath) = '\0'; + return --lpszPath; + } + return 0; +} + +/************************************************************************* + * PathQuoteSpacesW [SHLWAPI.@] + */ +LPWSTR WINAPI PathQuoteSpacesW(LPWSTR lpszPath) +{ + TRACE("%s\n",debugstr_w(lpszPath)); + + if(StrChrW(lpszPath,' ')) + { + int len = lstrlenW(lpszPath); + RtlMoveMemory(lpszPath+1, lpszPath, len*sizeof(WCHAR)); + *(lpszPath++) = '"'; + lpszPath += len; + *(lpszPath++) = '"'; + *(lpszPath) = '\0'; + return --lpszPath; + } + return 0; +} + +/************************************************************************* + * PathUnquoteSpacesA [SHLWAPI.@] + * + * NOTES + * unquote string (remove ") + */ +VOID WINAPI PathUnquoteSpacesA(LPSTR str) +{ + DWORD len = lstrlenA(str); + + TRACE("%s\n",str); + + if (*str!='"') + return; + if (str[len-1]!='"') + return; + str[len-1]='\0'; + lstrcpyA(str,str+1); + return; +} + +/************************************************************************* + * PathUnquoteSpacesW [SHLWAPI.@] + */ +VOID WINAPI PathUnquoteSpacesW(LPWSTR str) +{ + DWORD len = strlenW(str); + + TRACE("%s\n",debugstr_w(str)); + + if (*str!='"') + return; + if (str[len-1]!='"') + return; + str[len-1]='\0'; + strcpyW(str,str+1); + return; +} + +/************************************************************************* + * PathParseIconLocationA [SHLWAPI.@] + */ +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 */ + } + + PathUnquoteSpacesA(lpszPath); + return 0; +} + +/************************************************************************* + * PathParseIconLocationW [SHLWAPI.@] + */ +int WINAPI PathParseIconLocationW(LPWSTR lpszPath) +{ + LPWSTR lpstrComma = strchrW(lpszPath, ','); + + FIXME("%s stub\n", debugstr_w(lpszPath)); + + if (lpstrComma && lpstrComma[1]) + { + lpstrComma[0]='\0'; +/* return _wtoi(&lpstrComma[1]); FIXME */ + } + PathUnquoteSpacesW(lpszPath); + return 0; +} + +/* + ########## cleaning and resolving paths ########## + */ + +/************************************************************************* + * PathFindOnPathA [SHLWAPI.@] + */ +BOOL WINAPI PathFindOnPathA(LPSTR sFile, LPCSTR sOtherDirs) +{ + FIXME("%s %s\n",sFile, sOtherDirs); + return FALSE; +} + +/************************************************************************* + * PathFindOnPathW [SHLWAPI.@] + */ +BOOL WINAPI PathFindOnPathW(LPWSTR sFile, LPCWSTR sOtherDirs) +{ + FIXME("%s %s\n",debugstr_w(sFile), debugstr_w(sOtherDirs)); + return FALSE; +} + +/************************************************************************* + * PathCleanupSpecA [SHLWAPI.@] + */ +DWORD WINAPI PathCleanupSpecA(LPSTR x, LPSTR y) +{ + FIXME("(%p %s, %p %s) stub\n",x,debugstr_a(x),y,debugstr_a(y)); + return TRUE; +} + +/************************************************************************* + * PathCleanupSpecW [SHLWAPI.@] + */ +DWORD WINAPI PathCleanupSpecW(LPWSTR x, LPWSTR y) +{ + FIXME("(%p %s, %p %s) stub\n",x,debugstr_w(x),y,debugstr_w(y)); + return TRUE; +} + +/************************************************************************* + * PathCompactPathExA [SHLWAPI.@] + */ +BOOL WINAPI PathCompactPathExA( + LPSTR pszOut, + LPCSTR pszSrc, + UINT cchMax, + DWORD dwFlags) +{ + FIXME("%p %s 0x%08x 0x%08lx\n", pszOut, pszSrc, cchMax, dwFlags); + return FALSE; +} + +/************************************************************************* + * PathCompactPathExW [SHLWAPI.@] + */ +BOOL WINAPI PathCompactPathExW( + LPWSTR pszOut, + LPCWSTR pszSrc, + UINT cchMax, + DWORD dwFlags) +{ + FIXME("%p %s 0x%08x 0x%08lx\n", pszOut, debugstr_w(pszSrc), cchMax, dwFlags); + return FALSE; +} + +/* + ########## 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]=='\\')); +} + +/************************************************************************* + * 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]!=':')); +} + +/************************************************************************* + * 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 "\\<computer>\<share>" */ + if (lpszPath[0]=='\\' && lpszPath[1]=='\\') + { + int foundbackslash = 0; + lpszPath += 2; + while (*lpszPath) + { + if (*lpszPath=='\\') foundbackslash++; + lpszPath = CharNextA(lpszPath); + } + 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 "\\<computer>\<share>" */ + if (lpszPath[0]=='\\' && lpszPath[1]=='\\') + { + int foundbackslash = 0; + lpszPath += 2; + while (*lpszPath) + { + if (*lpszPath=='\\') foundbackslash++; + lpszPath = CharNextW(lpszPath); + } + if (foundbackslash <= 1) + return TRUE; + } + return FALSE; + +} + +/************************************************************************* + * 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 (!strcmpiW(lpszExtension,lpszExtensions[i])) return TRUE; + + return FALSE; +} + +/************************************************************************* + * PathIsDirectoryA [SHLWAPI.@] + */ +BOOL WINAPI PathIsDirectoryA(LPCSTR lpszPath) +{ + DWORD dwAttr; + + TRACE("%s\n", debugstr_a(lpszPath)); + + dwAttr = GetFileAttributesA(lpszPath); + return (dwAttr != -1) ? dwAttr & FILE_ATTRIBUTE_DIRECTORY : 0; +} + +/************************************************************************* + * PathIsDirectoryW [SHLWAPI.@] + */ +BOOL WINAPI PathIsDirectoryW(LPCWSTR lpszPath) +{ + DWORD dwAttr; + + TRACE("%s\n", debugstr_w(lpszPath)); + + dwAttr = GetFileAttributesW(lpszPath); + return (dwAttr != -1) ? dwAttr & FILE_ATTRIBUTE_DIRECTORY : 0; +} + +/************************************************************************* + * 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); +} + +/************************************************************************* + * 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 = CharNextA(name); + mask = CharNextA(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 (toupperW(*mask)!=toupperW(*name) && *mask!='?') return 0; + name = CharNextW(name); + mask = CharNextW(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 = CharNextA(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 = CharNextW(mask); + if (*mask==';') + { + mask++; + while (*mask==' ') mask++; /* masks may be separated by "; " */ + } + } + return 0; +} + +/************************************************************************* + * 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++; /* fixme: use CharNext*/ + } + 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 ( toupperW(lpszPath1[0])==toupperW(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++;/* fixme: use CharNext*/ + } + return (lpszPath1[pos] == lpszPath2[pos]); + } + return FALSE; +} + +/************************************************************************* + * 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 = strchrW(lpstrPath,':'); + if(!lpstrRes) return FALSE; + iSize = lpstrRes - lpstrPath; + + while(SupportedProtocol[i]) + { + if (iSize == strlenW(SupportedProtocol[i])) + if(!strncmpiW(lpstrPath, SupportedProtocol[i], iSize)) + return TRUE; + i++; + } + + return FALSE; +} + + +/************************************************************************* + * PathIsContentTypeA [SHLWAPI.@] + */ +BOOL WINAPI PathIsContentTypeA(LPCSTR pszPath, LPCSTR pszContentType) +{ + FIXME("%s %s\n", pszPath, pszContentType); + return FALSE; +} + +/************************************************************************* + * PathIsContentTypeW [SHLWAPI.@] + */ +BOOL WINAPI PathIsContentTypeW(LPCWSTR pszPath, LPCWSTR pszContentType) +{ + FIXME("%s %s\n", debugstr_w(pszPath), debugstr_w(pszContentType)); + return FALSE; +} + +/************************************************************************* + * PathIsFileSpecA [SHLWAPI.@] + */ +BOOL WINAPI PathIsFileSpecA(LPCSTR pszPath) +{ + FIXME("%s\n", pszPath); + return FALSE; +} + +/************************************************************************* + * PathIsFileSpecW [SHLWAPI.@] + */ +BOOL WINAPI PathIsFileSpecW(LPCWSTR pszPath) +{ + FIXME("%s\n", debugstr_w(pszPath)); + return FALSE; +} + +/************************************************************************* + * PathIsPrefixA [SHLWAPI.@] + */ +BOOL WINAPI PathIsPrefixA(LPCSTR pszPrefix, LPCSTR pszPath) +{ + FIXME("%s %s\n", pszPrefix, pszPath); + return FALSE; +} + +/************************************************************************* + * PathIsPrefixW [SHLWAPI.@] + */ +BOOL WINAPI PathIsPrefixW(LPCWSTR pszPrefix, LPCWSTR pszPath) +{ + FIXME("%s %s\n", debugstr_w(pszPrefix), debugstr_w(pszPath)); + return FALSE; +} + +/************************************************************************* + * PathIsSystemFolderA [SHLWAPI.@] + */ +BOOL WINAPI PathIsSystemFolderA(LPCSTR pszPath, DWORD dwAttrb) +{ + FIXME("%s 0x%08lx\n", pszPath, dwAttrb); + return FALSE; +} + +/************************************************************************* + * PathIsSystemFolderW [SHLWAPI.@] + */ +BOOL WINAPI PathIsSystemFolderW(LPCWSTR pszPath, DWORD dwAttrb) +{ + FIXME("%s 0x%08lx\n", debugstr_w(pszPath), dwAttrb); + return FALSE; +} + +/************************************************************************* + * PathIsUNCServerA [SHLWAPI.@] + */ +BOOL WINAPI PathIsUNCServerA( + LPCSTR pszPath) +{ + FIXME("%s\n", pszPath); + return FALSE; +} + +/************************************************************************* + * PathIsUNCServerW [SHLWAPI.@] + */ +BOOL WINAPI PathIsUNCServerW( + LPCWSTR pszPath) +{ + FIXME("%s\n", debugstr_w(pszPath)); + return FALSE; +} + +/************************************************************************* + * PathIsUNCServerShareA [SHLWAPI.@] + */ +BOOL WINAPI PathIsUNCServerShareA( + LPCSTR pszPath) +{ + FIXME("%s\n", pszPath); + return FALSE; +} + +/************************************************************************* + * PathIsUNCServerShareW [SHLWAPI.@] + */ +BOOL WINAPI PathIsUNCServerShareW( + LPCWSTR pszPath) +{ + FIXME("%s\n", debugstr_w(pszPath)); + return FALSE; +} + +/************************************************************************* + * PathCanonicalizeA [SHLWAPI.@] + * + * FIXME + * returnvalue, use CharNext + */ + +BOOL WINAPI PathCanonicalizeA(LPSTR pszBuf, LPCSTR pszPath) +{ + int OffsetMin = 0, OffsetSrc = 0, OffsetDst = 0, LenSrc = strlen(pszPath); + BOOL bModifyed = FALSE; + + TRACE("%p %s\n", pszBuf, 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", pszBuf, bModifyed); + return bModifyed; +} + + +/************************************************************************* + * PathCanonicalizeW [SHLWAPI.@] + * + * FIXME + * returnvalue, use CharNext + */ +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; +} + +/************************************************************************* + * PathFindNextComponentA [SHLWAPI.@] + * + * NOTES + * special cases: + * "" null + * aa "" (pointer to traling NULL) + * aa\ "" (pointer to traling NULL) + * aa\\ "" (pointer to traling NULL) + * aa\\bb bb + * aa\\\bb \bb + * c:\aa\ "aa\" + * \\aa aa + * \\aa\b aa\b +*/ +LPSTR WINAPI PathFindNextComponentA(LPCSTR pszPath) +{ + LPSTR pos; + + TRACE("%s\n", pszPath); + + if(!pszPath || !*pszPath) return NULL; + if(!(pos = StrChrA(pszPath, '\\'))) + return (LPSTR) pszPath + strlen(pszPath); + pos++; + if(pos[0] == '\\') pos++; + return pos; +} + +/************************************************************************* + * PathFindNextComponentW [SHLWAPI.@] + */ +LPWSTR WINAPI PathFindNextComponentW(LPCWSTR pszPath) +{ + LPWSTR pos; + + TRACE("%s\n", debugstr_w(pszPath)); + + if(!pszPath || !*pszPath) return NULL; + if (!(pos = StrChrW(pszPath, '\\'))) + return (LPWSTR) pszPath + lstrlenW(pszPath); + pos++; + if(pos[0] == '\\') pos++; + return pos; +} + +/************************************************************************* + * PathAddExtensionA [SHLWAPI.@] + * + * NOTES + * it adds never a dot + */ + +BOOL WINAPI PathAddExtensionA( + LPSTR pszPath, + LPCSTR pszExtension) +{ + if (*pszPath) + { + if (*(PathFindExtensionA(pszPath))) return FALSE; + + if (!pszExtension || *pszExtension=='\0') + strcat(pszPath, "exe"); + else + strcat(pszPath, pszExtension); + } + + return TRUE; +} + +/************************************************************************* + * PathAddExtensionW [SHLWAPI.@] + */ +BOOL WINAPI PathAddExtensionW( + LPWSTR pszPath, + LPCWSTR pszExtension) +{ + static const WCHAR ext[] = { 'e','x','e',0 }; + + if (*pszPath) + { + if (*(PathFindExtensionW(pszPath))) return FALSE; + + if (!pszExtension || *pszExtension=='\0') + lstrcatW(pszPath, ext); + else + lstrcatW(pszPath, pszExtension); + } + return TRUE; + +} + +/************************************************************************* + * PathMakePrettyA [SHLWAPI.@] + */ +BOOL WINAPI PathMakePrettyA( + LPSTR lpPath) +{ + FIXME("%s\n", lpPath); + return TRUE; +} + +/************************************************************************* + * PathMakePrettyW [SHLWAPI.@] + */ +BOOL WINAPI PathMakePrettyW( + LPWSTR lpPath) +{ + FIXME("%s\n", debugstr_w(lpPath)); + return TRUE; + +} + +/************************************************************************* + * PathCommonPrefixA [SHLWAPI.@] + */ +int WINAPI PathCommonPrefixA( + LPCSTR pszFile1, + LPCSTR pszFile2, + LPSTR achPath) +{ + FIXME("%s %s %p\n", pszFile1, pszFile2, achPath); + return 0; +} + +/************************************************************************* + * PathCommonPrefixW [SHLWAPI.@] + */ +int WINAPI PathCommonPrefixW( + LPCWSTR pszFile1, + LPCWSTR pszFile2, + LPWSTR achPath) +{ + FIXME("%s %s %p\n", debugstr_w(pszFile1), debugstr_w(pszFile2),achPath ); + return 0; +} + +/************************************************************************* + * PathCompactPathA [SHLWAPI.@] + */ +BOOL WINAPI PathCompactPathA(HDC hDC, LPSTR pszPath, UINT dx) +{ + FIXME("0x%08x %s 0x%08x\n", hDC, pszPath, dx); + return FALSE; +} + +/************************************************************************* + * PathCompactPathW [SHLWAPI.@] + */ +BOOL WINAPI PathCompactPathW(HDC hDC, LPWSTR pszPath, UINT dx) +{ + FIXME("0x%08x %s 0x%08x\n", hDC, debugstr_w(pszPath), dx); + return FALSE; +} + +/************************************************************************* + * PathGetCharTypeA [SHLWAPI.@] + */ +UINT WINAPI PathGetCharTypeA(UCHAR ch) +{ + FIXME("%c\n", ch); + return 0; +} + +/************************************************************************* + * PathGetCharTypeW [SHLWAPI.@] + */ +UINT WINAPI PathGetCharTypeW(WCHAR ch) +{ + FIXME("%c\n", ch); + return 0; +} + +/************************************************************************* + * PathMakeSystemFolderA [SHLWAPI.@] + */ +BOOL WINAPI PathMakeSystemFolderA(LPCSTR pszPath) +{ + FIXME("%s\n", pszPath); + return FALSE; +} + +/************************************************************************* + * PathMakeSystemFolderW [SHLWAPI.@] + */ +BOOL WINAPI PathMakeSystemFolderW(LPCWSTR pszPath) +{ + FIXME("%s\n", debugstr_w(pszPath)); + return FALSE; +} + +/************************************************************************* + * PathRenameExtensionA [SHLWAPI.@] + */ +BOOL WINAPI PathRenameExtensionA(LPSTR pszPath, LPCSTR pszExt) +{ + FIXME("%s %s\n", pszPath, pszExt); + return FALSE; +} + +/************************************************************************* + * PathRenameExtensionW [SHLWAPI.@] + */ +BOOL WINAPI PathRenameExtensionW(LPWSTR pszPath, LPCWSTR pszExt) +{ + FIXME("%s %s\n", debugstr_w(pszPath), debugstr_w(pszExt)); + return FALSE; +} + +/************************************************************************* + * PathSearchAndQualifyA [SHLWAPI.@] + */ +BOOL WINAPI PathSearchAndQualifyA( + LPCSTR pszPath, + LPSTR pszBuf, + UINT cchBuf) +{ + FIXME("%s %s 0x%08x\n", pszPath, pszBuf, cchBuf); + return FALSE; +} + +/************************************************************************* + * PathSearchAndQualifyW [SHLWAPI.@] + */ +BOOL WINAPI PathSearchAndQualifyW( + LPCWSTR pszPath, + LPWSTR pszBuf, + UINT cchBuf) +{ + FIXME("%s %s 0x%08x\n", debugstr_w(pszPath), debugstr_w(pszBuf), cchBuf); + return FALSE; +} + +/************************************************************************* + * PathSkipRootA [SHLWAPI.@] + */ +LPSTR WINAPI PathSkipRootA(LPCSTR pszPath) +{ + FIXME("%s\n", pszPath); + return (LPSTR)pszPath; +} + +/************************************************************************* + * PathSkipRootW [SHLWAPI.@] + */ +LPWSTR WINAPI PathSkipRootW(LPCWSTR pszPath) +{ + FIXME("%s\n", debugstr_w(pszPath)); + return (LPWSTR)pszPath; +} + +/************************************************************************* + * PathCreateFromUrlA [SHLWAPI.@] + */ +HRESULT WINAPI PathCreateFromUrlA( + LPCSTR pszUrl, + LPSTR pszPath, + LPDWORD pcchPath, + DWORD dwFlags) +{ + FIXME("%s %p %p 0x%08lx\n", + pszUrl, pszPath, pcchPath, dwFlags); + return S_OK; +} + +/************************************************************************* + * PathCreateFromUrlW [SHLWAPI.@] + */ +HRESULT WINAPI PathCreateFromUrlW( + LPCWSTR pszUrl, + LPWSTR pszPath, + LPDWORD pcchPath, + DWORD dwFlags) +{ + FIXME("%s %p %p 0x%08lx\n", + debugstr_w(pszUrl), pszPath, pcchPath, dwFlags); + return S_OK; +} + +/************************************************************************* + * PathRelativePathToA [SHLWAPI.@] + */ +BOOL WINAPI PathRelativePathToA( + LPSTR pszPath, + LPCSTR pszFrom, + DWORD dwAttrFrom, + LPCSTR pszTo, + DWORD dwAttrTo) +{ + FIXME("%s %s 0x%08lx %s 0x%08lx\n", + pszPath, pszFrom, dwAttrFrom, pszTo, dwAttrTo); + return FALSE; +} + +/************************************************************************* + * PathRelativePathToW [SHLWAPI.@] + */ +BOOL WINAPI PathRelativePathToW( + LPWSTR pszPath, + LPCWSTR pszFrom, + DWORD dwAttrFrom, + LPCWSTR pszTo, + DWORD dwAttrTo) +{ + FIXME("%s %s 0x%08lx %s 0x%08lx\n", + debugstr_w(pszPath), debugstr_w(pszFrom), dwAttrFrom, debugstr_w(pszTo), dwAttrTo); + return FALSE; +} + +/************************************************************************* + * PathUnmakeSystemFolderA [SHLWAPI.@] + */ +BOOL WINAPI PathUnmakeSystemFolderA(LPCSTR pszPath) +{ + FIXME("%s\n", pszPath); + return FALSE; +} + +/************************************************************************* + * PathUnmakeSystemFolderW [SHLWAPI.@] + */ +BOOL WINAPI PathUnmakeSystemFolderW(LPCWSTR pszPath) +{ + FIXME("%s\n", debugstr_w(pszPath)); + return FALSE; +} + +/* + ########## special ########## +*/ + +/************************************************************************* + * PathSetDlgItemPathA [SHLWAPI.@] + * + * 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 [SHLWAPI.@] + */ +BOOL WINAPI PathSetDlgItemPathW(HWND hDlg, int id, LPCWSTR pszPath) +{ TRACE("%x %x %s\n",hDlg, id, debugstr_w(pszPath)); + return SetDlgItemTextW(hDlg, id, pszPath); +}
diff --git a/dlls/shlwapi/reg.c b/dlls/shlwapi/reg.c new file mode 100644 index 0000000..9e38a29 --- /dev/null +++ b/dlls/shlwapi/reg.c
@@ -0,0 +1,244 @@ +/* + * SHLWAPI registry functions + */ + +#include "windef.h" +#include "winerror.h" +#include "winreg.h" +#include "wine/undocshell.h" +#include "debugtools.h" + +DEFAULT_DEBUG_CHANNEL(shell); + +/************************************************************************* + * SHRegGetUSValueA [SHLWAPI.@] + * + * Gets a user-specific registry value + */ +LONG WINAPI SHRegGetUSValueA( + LPCSTR pSubKey, + LPCSTR pValue, + LPDWORD pwType, + LPVOID pvData, + LPDWORD pbData, + BOOL fIgnoreHKCU, + LPVOID pDefaultData, + DWORD wDefaultDataSize) +{ + FIXME("(%p),stub!\n", pSubKey); + return ERROR_SUCCESS; /* return success */ +} + +/************************************************************************* + * SHRegGetUSValueW [SHLWAPI.@] + * + * Gets a user-specific registry value + */ +LONG WINAPI SHRegGetUSValueW( + LPCWSTR pSubKey, + LPCWSTR pValue, + LPDWORD pwType, + LPVOID pvData, + LPDWORD pbData, + BOOL flagIgnoreHKCU, + LPVOID pDefaultData, + DWORD wDefaultDataSize) +{ + FIXME("(%p),stub!\n", pSubKey); + return ERROR_SUCCESS; /* return success */ +} + +/************************************************************************* + * SHRegGetBoolUSValueA [SHLWAPI.@] + */ +BOOL WINAPI SHRegGetBoolUSValueA( + LPCSTR pszSubKey, + LPCSTR pszValue, + BOOL fIgnoreHKCU, + BOOL fDefault) +{ + FIXME("%s %s\n", pszSubKey,pszValue); + return fDefault; +} + +/************************************************************************* + * SHRegGetBoolUSValueW [SHLWAPI.@] + */ +BOOL WINAPI SHRegGetBoolUSValueW( + LPCWSTR pszSubKey, + LPCWSTR pszValue, + BOOL fIgnoreHKCU, + BOOL fDefault) +{ + FIXME("%s %s\n", debugstr_w(pszSubKey),debugstr_w(pszValue)); + return fDefault; +} + +/************************************************************************* + * SHRegQueryUSValueA [SHLWAPI] + */ +LONG WINAPI SHRegQueryUSValueA( + HKEY/*HUSKEY*/ hUSKey, + LPCSTR pszValue, + LPDWORD pdwType, + void *pvData, + LPDWORD pcbData, + BOOL fIgnoreHKCU, + void *pvDefaultData, + DWORD dwDefaultDataSize) +{ + FIXME("%s stub\n",pszValue); + return 1; +} + +/************************************************************************* + * SHRegGetPathA [SHLWAPI.@] + */ +DWORD WINAPI SHRegGetPathA( + HKEY hKey, + LPCSTR pcszSubKey, + LPCSTR pcszValue, + LPSTR pszPath, + DWORD dwFlags) +{ + FIXME("%s %s\n", pcszSubKey, pcszValue); + return 0; +} + +/************************************************************************* + * SHRegGetPathW [SHLWAPI.@] + */ +DWORD WINAPI SHRegGetPathW( + HKEY hKey, + LPCWSTR pcszSubKey, + LPCWSTR pcszValue, + LPWSTR pszPath, + DWORD dwFlags) +{ + FIXME("%s %s\n", debugstr_w(pcszSubKey), debugstr_w(pcszValue)); + return 0; +} + +/************************************************************************* + * SHGetValueA [SHLWAPI.@] + * + * Gets a value from the registry + */ +DWORD WINAPI SHGetValueA( + HKEY hkey, + LPCSTR pSubKey, + LPCSTR pValue, + LPDWORD pwType, + LPVOID pvData, + LPDWORD pbData) +{ + HKEY hSubKey; + DWORD res; + + TRACE("(%s %s)\n", pSubKey, pValue); + + if((res = RegOpenKeyA(hkey, pSubKey, &hSubKey))) return res; + res = RegQueryValueExA(hSubKey, pValue, 0, pwType, pvData, pbData); + RegCloseKey( hSubKey ); + + return res; +} + +/************************************************************************* + * SHGetValueW [SHLWAPI.@] + * + * Gets a value from the registry + */ +DWORD WINAPI SHGetValueW( + HKEY hkey, + LPCWSTR pSubKey, + LPCWSTR pValue, + LPDWORD pwType, + LPVOID pvData, + LPDWORD pbData) +{ + HKEY hSubKey; + DWORD res; + + TRACE("(%s %s)\n", debugstr_w(pSubKey), debugstr_w(pValue)); + + if((res = RegOpenKeyW(hkey, pSubKey, &hSubKey))) return res; + res = RegQueryValueExW(hSubKey, pValue, 0, pwType, pvData, pbData); + RegCloseKey( hSubKey ); + + return res; +} + +/************************************************************************* + * SHSetValueA [SHLWAPI.@] + */ +DWORD WINAPI SHSetValueA( + HKEY hkey, + LPCSTR pszSubKey, + LPCSTR pszValue, + DWORD dwType, + LPCVOID pvData, + DWORD cbData) +{ + FIXME("(%s %s)stub\n",pszSubKey, pszValue); + return 1; +} + +/************************************************************************* + * SHQueryValueExA [SHLWAPI.@] + * + */ +HRESULT WINAPI SHQueryValueExA( + HKEY hkey, + LPSTR lpValueName, + LPDWORD lpReserved, + LPDWORD lpType, + LPBYTE lpData, + LPDWORD lpcbData) +{ + TRACE("0x%04x %s %p %p %p %p\n", hkey, lpValueName, lpReserved, lpType, lpData, lpcbData); + return RegQueryValueExA (hkey, lpValueName, lpReserved, lpType, lpData, lpcbData); +} + + +/************************************************************************* + * SHQueryValueExW [SHLWAPI.@] + * + * FIXME + * if the datatype REG_EXPAND_SZ then expand the string and change + * *pdwType to REG_SZ. + */ +HRESULT WINAPI SHQueryValueExW ( + HKEY hkey, + LPWSTR pszValue, + LPDWORD pdwReserved, + LPDWORD pdwType, + LPVOID pvData, + LPDWORD pcbData) +{ + WARN("0x%04x %s %p %p %p %p semi-stub\n", + hkey, debugstr_w(pszValue), pdwReserved, pdwType, pvData, pcbData); + return RegQueryValueExW ( hkey, pszValue, pdwReserved, pdwType, pvData, pcbData); +} + +/************************************************************************* + * SHDeleteKeyA [SHLWAPI.@] + */ +HRESULT WINAPI SHDeleteKeyA( + HKEY hkey, + LPCSTR pszSubKey) +{ + FIXME("hkey=0x%08x, %s\n", hkey, debugstr_a(pszSubKey)); + return 0; +} + +/************************************************************************* + * SHDeleteKeyW [SHLWAPI.@] + */ +HRESULT WINAPI SHDeleteKeyW( + HKEY hkey, + LPCWSTR pszSubKey) +{ + FIXME("hkey=0x%08x, %s\n", hkey, debugstr_w(pszSubKey)); + return 0; +}
diff --git a/dlls/shell32/regstream.c b/dlls/shlwapi/regstream.c similarity index 81% rename from dlls/shell32/regstream.c rename to dlls/shlwapi/regstream.c index 90bb6d5..20a683d 100644 --- a/dlls/shell32/regstream.c +++ b/dlls/shlwapi/regstream.c
@@ -3,16 +3,14 @@ */ #include <string.h> -#include "wine/obj_storage.h" - -#include "debugtools.h" -#include "heap.h" #include "winerror.h" #include "winreg.h" +#include "wine/obj_storage.h" -#include "shell32_main.h" +#include "heap.h" +#include "debugtools.h" -DEFAULT_DEBUG_CHANNEL(shell) +DEFAULT_DEBUG_CHANNEL(shell); typedef struct { ICOM_VFIELD(IStream); @@ -28,7 +26,7 @@ /************************************************************************** * IStream_ConstructorA [internal] */ -IStream *IStream_ConstructorA(HKEY hKey, LPCSTR pszSubKey, LPCSTR pszValue, DWORD grfMode) +static IStream *IStream_ConstructorA(HKEY hKey, LPCSTR pszSubKey, LPCSTR pszValue, DWORD grfMode) { ISHRegStream* rstr; DWORD dwType; @@ -49,7 +47,6 @@ { if (dwType == REG_BINARY ) { - shell32_ObjCount++; TRACE ("%p\n", rstr); return (IStream*)rstr; } @@ -66,7 +63,7 @@ /************************************************************************** * IStream_ConstructorW [internal] */ -IStream *IStream_ConstructorW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD grfMode) +static IStream *IStream_ConstructorW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD grfMode) { ISHRegStream* rstr; DWORD dwType; @@ -87,7 +84,6 @@ { if (dwType == REG_BINARY ) { - shell32_ObjCount++; TRACE ("%p\n", rstr); return (IStream*)rstr; } @@ -138,7 +134,6 @@ TRACE("(%p)->(count=%lu)\n",This, This->ref); - shell32_ObjCount++; return ++(This->ref); } @@ -151,8 +146,6 @@ TRACE("(%p)->()\n",This); - shell32_ObjCount--; - if (!--(This->ref)) { TRACE(" destroying SHReg IStream (%p)\n",This); @@ -168,7 +161,7 @@ return This->ref; } -HRESULT WINAPI IStream_fnRead (IStream * iface, void* pv, ULONG cb, ULONG* pcbRead) +static HRESULT WINAPI IStream_fnRead (IStream * iface, void* pv, ULONG cb, ULONG* pcbRead) { ICOM_THIS(ISHRegStream, iface); @@ -195,7 +188,7 @@ return S_OK; } -HRESULT WINAPI IStream_fnWrite (IStream * iface, const void* pv, ULONG cb, ULONG* pcbWritten) +static HRESULT WINAPI IStream_fnWrite (IStream * iface, const void* pv, ULONG cb, ULONG* pcbWritten) { ICOM_THIS(ISHRegStream, iface); @@ -203,7 +196,7 @@ return E_NOTIMPL; } -HRESULT WINAPI IStream_fnSeek (IStream * iface, LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER* plibNewPosition) +static HRESULT WINAPI IStream_fnSeek (IStream * iface, LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER* plibNewPosition) { ICOM_THIS(ISHRegStream, iface); @@ -211,7 +204,7 @@ return E_NOTIMPL; } -HRESULT WINAPI IStream_fnSetSize (IStream * iface, ULARGE_INTEGER libNewSize) +static HRESULT WINAPI IStream_fnSetSize (IStream * iface, ULARGE_INTEGER libNewSize) { ICOM_THIS(ISHRegStream, iface); @@ -219,7 +212,7 @@ return E_NOTIMPL; } -HRESULT WINAPI IStream_fnCopyTo (IStream * iface, IStream* pstm, ULARGE_INTEGER cb, ULARGE_INTEGER* pcbRead, ULARGE_INTEGER* pcbWritten) +static HRESULT WINAPI IStream_fnCopyTo (IStream * iface, IStream* pstm, ULARGE_INTEGER cb, ULARGE_INTEGER* pcbRead, ULARGE_INTEGER* pcbWritten) { ICOM_THIS(ISHRegStream, iface); @@ -227,7 +220,7 @@ return E_NOTIMPL; } -HRESULT WINAPI IStream_fnCommit (IStream * iface, DWORD grfCommitFlags) +static HRESULT WINAPI IStream_fnCommit (IStream * iface, DWORD grfCommitFlags) { ICOM_THIS(ISHRegStream, iface); @@ -235,7 +228,7 @@ return E_NOTIMPL; } -HRESULT WINAPI IStream_fnRevert (IStream * iface) +static HRESULT WINAPI IStream_fnRevert (IStream * iface) { ICOM_THIS(ISHRegStream, iface); @@ -243,7 +236,7 @@ return E_NOTIMPL; } -HRESULT WINAPI IStream_fnLockRegion (IStream * iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) +static HRESULT WINAPI IStream_fnLockRegion (IStream * iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) { ICOM_THIS(ISHRegStream, iface); @@ -251,7 +244,7 @@ return E_NOTIMPL; } -HRESULT WINAPI IStream_fnUnlockRegion (IStream * iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) +static HRESULT WINAPI IStream_fnUnlockRegion (IStream * iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) { ICOM_THIS(ISHRegStream, iface); @@ -259,7 +252,7 @@ return E_NOTIMPL; } -HRESULT WINAPI IStream_fnStat (IStream * iface, STATSTG* pstatstg, DWORD grfStatFlag) +static HRESULT WINAPI IStream_fnStat (IStream * iface, STATSTG* pstatstg, DWORD grfStatFlag) { ICOM_THIS(ISHRegStream, iface); @@ -267,7 +260,7 @@ return E_NOTIMPL; } -HRESULT WINAPI IStream_fnClone (IStream * iface, IStream** ppstm) +static HRESULT WINAPI IStream_fnClone (IStream * iface, IStream** ppstm) { ICOM_THIS(ISHRegStream, iface); @@ -297,7 +290,7 @@ }; /************************************************************************* - * SHOpenRegStreamA [SHLWAPI.@][SHELL32.85] + * SHOpenRegStreamA [SHLWAPI.@] */ IStream * WINAPI SHOpenRegStreamA( HKEY hkey,
diff --git a/dlls/shlwapi/shlwapi.spec b/dlls/shlwapi/shlwapi.spec index 1aeb598..f7d1781 100644 --- a/dlls/shlwapi/shlwapi.spec +++ b/dlls/shlwapi/shlwapi.spec
@@ -2,6 +2,10 @@ type win32 init SHLWAPI_LibMain +import advapi32 +import user32 +import kernel32 + 1 stdcall @(ptr ptr) SHLWAPI_1 2 stub @ 3 stub @ @@ -555,8 +559,8 @@ @ stdcall SHCreateShellPalette(long)SHCreateShellPalette @ stub SHDeleteEmptyKeyA @ stub SHDeleteEmptyKeyW -@ stdcall SHDeleteKeyA(long str)SHRegDeleteKeyA -@ stdcall SHDeleteKeyW(long wstr)SHRegDeleteKeyW +@ stdcall SHDeleteKeyA(long str) SHDeleteKeyA +@ stdcall SHDeleteKeyW(long wstr) SHDeleteKeyW @ stub SHDeleteOrphanKeyA @ stub SHDeleteOrphanKeyW @ stub SHDeleteValueA @@ -575,8 +579,8 @@ @ stdcall SHOpenRegStream2W(long wstr str long)SHOpenRegStreamW @ stub SHQueryInfoKeyA @ stub SHQueryInfoKeyW -@ stdcall SHQueryValueExA(long str ptr ptr ptr ptr)SHRegQueryValueExA -@ stdcall SHQueryValueExW(long wstr ptr ptr ptr ptr)SHRegQueryValueExW +@ stdcall SHQueryValueExA(long str ptr ptr ptr ptr) SHQueryValueExA +@ stdcall SHQueryValueExW(long wstr ptr ptr ptr ptr) SHQueryValueExW @ stub SHRegCloseUSKey @ stub SHRegCreateUSKeyA @ stub SHRegCreateUSKeyW
diff --git a/dlls/shlwapi/shlwapi_main.c b/dlls/shlwapi/shlwapi_main.c index b110a3a..b900167 100644 --- a/dlls/shlwapi/shlwapi_main.c +++ b/dlls/shlwapi/shlwapi_main.c
@@ -6,6 +6,7 @@ */ #include "winbase.h" +#include "winerror.h" #include "debugtools.h" DEFAULT_DEBUG_CHANNEL(shell); @@ -29,3 +30,39 @@ } return TRUE; } + +/*********************************************************************** + * DllGetVersion [SHLWAPI] + * + * Retrieves version information of the 'SHLWAPI.DLL' + * + * PARAMS + * pdvi [O] pointer to version information structure. + * + * RETURNS + * Success: S_OK + * Failure: E_INVALIDARG + * + * NOTES + * Returns version of a SHLWAPI.dll from IE5.01. + */ + +HRESULT WINAPI SHLWAPI_DllGetVersion (DLLVERSIONINFO *pdvi) +{ + if (pdvi->cbSize != sizeof(DLLVERSIONINFO)) + { + WARN("wrong DLLVERSIONINFO size from app"); + return E_INVALIDARG; + } + + pdvi->dwMajorVersion = 5; + pdvi->dwMinorVersion = 0; + pdvi->dwBuildNumber = 2314; + pdvi->dwPlatformID = 1000; + + TRACE("%lu.%lu.%lu.%lu\n", + pdvi->dwMajorVersion, pdvi->dwMinorVersion, + pdvi->dwBuildNumber, pdvi->dwPlatformID); + + return S_OK; +}
diff --git a/dlls/shlwapi/string.c b/dlls/shlwapi/string.c new file mode 100644 index 0000000..edfb682 --- /dev/null +++ b/dlls/shlwapi/string.c
@@ -0,0 +1,413 @@ +#include <ctype.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#include "winerror.h" +#include "wine/undocshell.h" +#include "wine/unicode.h" +#include "heap.h" +#include "debugtools.h" + +DEFAULT_DEBUG_CHANNEL(shell); + +/************************************************************************* + * StrChrA [SHLWAPI] + */ +LPSTR WINAPI StrChrA (LPCSTR str, INT c) +{ + TRACE("%s %i\n", str,c); + return strchr(str, c); +} + +/************************************************************************* + * StrChrW [SHLWAPI] + * + */ +LPWSTR WINAPI StrChrW (LPWSTR str, WCHAR x ) +{ + TRACE("%s 0x%04x\n",debugstr_w(str),x); + return strchrW(str, x); +} + +/************************************************************************* + * StrCmpNA [SHLWAPI] + */ +INT WINAPI StrCmpNA ( LPCSTR str1, LPCSTR str2, INT len) +{ + TRACE("%s %s %i stub\n", str1,str2,len); + return strncmp(str1, str2, len); +} + +/************************************************************************* + * StrCmpNW [SHLWAPI] + */ +INT WINAPI StrCmpNW ( LPCWSTR wstr1, LPCWSTR wstr2, INT len) +{ + TRACE("%s %s %i stub\n", debugstr_w(wstr1),debugstr_w(wstr2),len); + return strncmpW(wstr1, wstr2, len); +} + +/************************************************************************* + * StrCmpNIA [SHLWAPI] + */ +int WINAPI StrCmpNIA ( LPCSTR str1, LPCSTR str2, int len) +{ + TRACE("%s %s %i stub\n", str1,str2,len); + return strncasecmp(str1, str2, len); +} + +/************************************************************************* + * StrCmpNIW [SHLWAPI] + */ +int WINAPI StrCmpNIW ( LPCWSTR wstr1, LPCWSTR wstr2, int len) +{ + TRACE("%s %s %i stub\n", debugstr_w(wstr1),debugstr_w(wstr2),len); + return strncmpiW(wstr1, wstr2, len); +} + +/************************************************************************* + * StrStrA [SHLWAPI] + */ +LPSTR WINAPI StrStrA(LPCSTR lpFirst, LPCSTR lpSrch) +{ + while (*lpFirst) + { + LPCSTR p1 = lpFirst, p2 = lpSrch; + while (*p1 && *p2 && *p1 == *p2) { p1++; p2++; } + if (!*p2) return (LPSTR)lpFirst; + lpFirst++; + } + return NULL; +} + +/************************************************************************* + * StrStrW [SHLWAPI] + */ +LPWSTR WINAPI StrStrW(LPCWSTR lpFirst, LPCWSTR lpSrch) +{ + while (*lpFirst) + { + LPCWSTR p1 = lpFirst, p2 = lpSrch; + while (*p1 && *p2 && *p1 == *p2) { p1++; p2++; } + if (!*p2) return (LPWSTR)lpFirst; + lpFirst++; + } + return NULL; +} + +/************************************************************************* + * StrStrIA [SHLWAPI] + */ +LPSTR WINAPI StrStrIA(LPCSTR lpFirst, LPCSTR lpSrch) +{ + while (*lpFirst) + { + LPCSTR p1 = lpFirst, p2 = lpSrch; + while (*p1 && *p2 && toupper(*p1) == toupper(*p2)) { p1++; p2++; } + if (!*p2) return (LPSTR)lpFirst; + lpFirst++; + } + return NULL; +} + +/************************************************************************* + * StrStrIW [SHLWAPI] + */ +LPWSTR WINAPI StrStrIW(LPCWSTR lpFirst, LPCWSTR lpSrch) +{ + while (*lpFirst) + { + LPCWSTR p1 = lpFirst, p2 = lpSrch; + while (*p1 && *p2 && toupperW(*p1) == toupperW(*p2)) { p1++; p2++; } + if (!*p2) return (LPWSTR)lpFirst; + lpFirst++; + } + return NULL; +} + +/************************************************************************* + * StrToIntA [SHLWAPI] + */ +int WINAPI StrToIntA(LPCSTR lpSrc) +{ + TRACE("%s\n", lpSrc); + return atol(lpSrc); +} + +/************************************************************************* + * StrToIntW [SHLWAPI] + */ +int WINAPI StrToIntW(LPCWSTR lpSrc) +{ + int ret; + LPSTR lpStr = HEAP_strdupWtoA(GetProcessHeap(),0,lpSrc); + + TRACE("%s\n", debugstr_w(lpSrc)); + + ret = atol(lpStr); + HeapFree(GetProcessHeap(),0,lpStr); + return ret; +} + +/************************************************************************* + * StrDupA [SHLWAPI] + */ +LPSTR WINAPI StrDupA (LPCSTR lpSrc) +{ + int len = strlen(lpSrc); + LPSTR lpDest = (LPSTR) LocalAlloc(LMEM_FIXED, len+1); + + TRACE("%s\n", lpSrc); + + if (lpDest) strcpy(lpDest, lpSrc); + return lpDest; +} + +/************************************************************************* + * StrDupW [SHLWAPI] + */ +LPWSTR WINAPI StrDupW (LPCWSTR lpSrc) +{ + int len = lstrlenW(lpSrc); + LPWSTR lpDest = (LPWSTR) LocalAlloc(LMEM_FIXED, sizeof(WCHAR) * (len+1)); + + TRACE("%s\n", debugstr_w(lpSrc)); + + if (lpDest) lstrcpyW(lpDest, lpSrc); + return lpDest; +} + +/************************************************************************* + * StrCSpnA [SHLWAPI] + */ +int WINAPI StrCSpnA (LPCSTR lpStr, LPCSTR lpSet) +{ + int i,j, pos = strlen(lpStr); + + TRACE("(%p %s %p %s)\n", + lpStr, debugstr_a(lpStr), lpSet, debugstr_a(lpSet)); + + for (i=0; i < strlen(lpSet) ; i++ ) + { + for (j = 0; j < pos;j++) + { + if (lpStr[j] == lpSet[i]) + { + pos = j; + } + } + } + TRACE("-- %u\n", pos); + return pos; +} + +/************************************************************************* + * StrCSpnW [SHLWAPI] + */ +int WINAPI StrCSpnW (LPCWSTR lpStr, LPCWSTR lpSet) +{ + int i,j, pos = lstrlenW(lpStr); + + TRACE("(%p %s %p %s)\n", + lpStr, debugstr_w(lpStr), lpSet, debugstr_w(lpSet)); + + for (i=0; i < lstrlenW(lpSet) ; i++ ) + { + for (j = 0; j < pos;j++) + { + if (lpStr[j] == lpSet[i]) + { + pos = j; + } + } + } + TRACE("-- %u\n", pos); + return pos; +} + +/************************************************************************* + * StrCatBuffA [SHLWAPI] + * + * Appends back onto front, stopping when front is size-1 characters long. + * Returns front. + * + */ +LPSTR WINAPI StrCatBuffA(LPSTR front, LPCSTR back, INT size) +{ + LPSTR dst = front + lstrlenA(front); + LPCSTR src = back, end = front + size - 1; + + while(dst < end && *src) + *dst++ = *src++; + *dst = '\0'; + return front; +} + +/************************************************************************* + * StrCatBuffW [SHLWAPI] + * + * Appends back onto front, stopping when front is size-1 characters long. + * Returns front. + * + */ +LPWSTR WINAPI StrCatBuffW(LPWSTR front, LPCWSTR back, INT size) +{ + LPWSTR dst = front + lstrlenW(front); + LPCWSTR src = back, end = front + size - 1; + + while(dst < end && *src) + *dst++ = *src++; + *dst = '\0'; + return front; +} + +/************************************************************************* + * StrRetToBufA [SHLWAPI.@] + * + * converts a STRRET to a normal string + * + * NOTES + * the pidl is for STRRET OFFSET + */ +HRESULT WINAPI StrRetToBufA (LPSTRRET src, LPITEMIDLIST pidl, LPSTR dest, DWORD len) +{ + TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl); + + switch (src->uType) + { + case STRRET_WSTR: + WideCharToMultiByte(CP_ACP, 0, src->u.pOleStr, -1, (LPSTR)dest, len, NULL, NULL); +/* SHFree(src->u.pOleStr); FIXME: is this right? */ + break; + + case STRRET_CSTRA: + lstrcpynA((LPSTR)dest, src->u.cStr, len); + break; + + case STRRET_OFFSETA: + lstrcpynA((LPSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len); + break; + + default: + FIXME("unknown type!\n"); + if (len) + { + *(LPSTR)dest = '\0'; + } + return(FALSE); + } + return S_OK; +} + +/************************************************************************* + * StrRetToBufW [SHLWAPI.@] + * + * converts a STRRET to a normal string + * + * NOTES + * the pidl is for STRRET OFFSET + */ +HRESULT WINAPI StrRetToBufW (LPSTRRET src, LPITEMIDLIST pidl, LPWSTR dest, DWORD len) +{ + TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl); + + switch (src->uType) + { + case STRRET_WSTR: + lstrcpynW((LPWSTR)dest, src->u.pOleStr, len); +/* SHFree(src->u.pOleStr); FIXME: is this right? */ + break; + + case STRRET_CSTRA: + lstrcpynAtoW((LPWSTR)dest, src->u.cStr, len); + break; + + case STRRET_OFFSETA: + if (pidl) + { + lstrcpynAtoW((LPWSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len); + } + break; + + default: + FIXME("unknown type!\n"); + if (len) + { *(LPSTR)dest = '\0'; + } + return(FALSE); + } + return S_OK; +} + +/************************************************************************* + * StrFormatByteSizeA [SHLWAPI] + */ +LPSTR WINAPI StrFormatByteSizeA ( DWORD dw, LPSTR pszBuf, UINT cchBuf ) +{ char buf[64]; + TRACE("%lx %p %i\n", dw, pszBuf, cchBuf); + if ( dw<1024L ) + { sprintf (buf,"%3.1f bytes", (FLOAT)dw); + } + else if ( dw<1048576L) + { sprintf (buf,"%3.1f KB", (FLOAT)dw/1024); + } + else if ( dw < 1073741824L) + { sprintf (buf,"%3.1f MB", (FLOAT)dw/1048576L); + } + else + { sprintf (buf,"%3.1f GB", (FLOAT)dw/1073741824L); + } + lstrcpynA (pszBuf, buf, cchBuf); + return pszBuf; +} + +/************************************************************************* + * StrFormatByteSizeW [SHLWAPI] + */ +LPWSTR WINAPI StrFormatByteSizeW ( DWORD dw, LPWSTR pszBuf, UINT cchBuf ) +{ char buf[64]; + TRACE("%lx %p %i\n", dw, pszBuf, cchBuf); + if ( dw<1024L ) + { sprintf (buf,"%3.1f bytes", (FLOAT)dw); + } + else if ( dw<1048576L) + { sprintf (buf,"%3.1f KB", (FLOAT)dw/1024); + } + else if ( dw < 1073741824L) + { sprintf (buf,"%3.1f MB", (FLOAT)dw/1048576L); + } + else + { sprintf (buf,"%3.1f GB", (FLOAT)dw/1073741824L); + } + lstrcpynAtoW (pszBuf, buf, cchBuf); + return pszBuf; +} + +/************************************************************************* + * wnsprintfA [SHLWAPI] + */ +int WINAPIV wnsprintfA(LPSTR lpOut, int cchLimitIn, LPCSTR lpFmt, ...) +{ + va_list valist; + INT res; + + va_start( valist, lpFmt ); + res = wvsnprintfA( lpOut, cchLimitIn, lpFmt, valist ); + va_end( valist ); + return res; +} + +/************************************************************************* + * wnsprintfW [SHLWAPI] + */ +int WINAPIV wnsprintfW(LPWSTR lpOut, int cchLimitIn, LPCWSTR lpFmt, ...) +{ + va_list valist; + INT res; + + va_start( valist, lpFmt ); + res = wvsnprintfW( lpOut, cchLimitIn, lpFmt, valist ); + va_end( valist ); + return res; +}