Implementation of PathCleanupSpec.

This commit is contained in:
Aric Stewart 2004-11-04 04:54:08 +00:00 committed by Alexandre Julliard
parent ac815f5a6a
commit 990ea44e98
4 changed files with 77 additions and 13 deletions

View File

@ -162,7 +162,7 @@
168 stdcall SHCreatePropSheetExtArray(long str long)
169 stdcall SHDestroyPropSheetExtArray(long)
170 stdcall SHReplaceFromPropSheetExtArray(long long long long)
171 stdcall PathCleanupSpec(ptr ptr) PathCleanupSpecAW
171 stdcall PathCleanupSpec(ptr ptr)
172 stdcall SHCreateLinks(long str ptr long ptr)
173 stdcall SHValidateUNC(long long long)
174 stdcall SHCreateShellFolderViewEx (ptr ptr)

View File

@ -558,11 +558,76 @@ BOOL WINAPI PathFindOnPathAW(LPVOID sFile, LPCVOID sOtherDirs)
/*************************************************************************
* PathCleanupSpec [SHELL32.171]
*
* lpszFile is changed in place.
*/
DWORD WINAPI PathCleanupSpecAW (LPCVOID x, LPVOID y)
int WINAPI PathCleanupSpec( LPCWSTR lpszPathW, LPWSTR lpszFileW )
{
FIXME("(%p, %p) stub\n",x,y);
return TRUE;
int i = 0;
DWORD rc = 0;
int length = 0;
if (SHELL_OsIsUnicode())
{
LPWSTR p = lpszFileW;
TRACE("Cleanup %s\n",debugstr_w(lpszFileW));
if (lpszPathW)
length = strlenW(lpszPathW);
while (*p)
{
int gct = PathGetCharTypeW(*p);
if (gct == GCT_INVALID || gct == GCT_WILD || gct == GCT_SEPARATOR)
{
lpszFileW[i]='-';
rc |= PCS_REPLACEDCHAR;
}
else
lpszFileW[i]=*p;
i++;
p++;
if (length + i == MAX_PATH)
{
rc |= PCS_FATAL | PCS_PATHTOOLONG;
break;
}
}
lpszFileW[i]=0;
}
else
{
LPSTR lpszFileA = (LPSTR)lpszFileW;
LPCSTR lpszPathA = (LPSTR)lpszPathW;
LPSTR p = lpszFileA;
TRACE("Cleanup %s\n",debugstr_a(lpszFileA));
if (lpszPathA)
length = strlen(lpszPathA);
while (*p)
{
int gct = PathGetCharTypeA(*p);
if (gct == GCT_INVALID || gct == GCT_WILD || gct == GCT_SEPARATOR)
{
lpszFileA[i]='-';
rc |= PCS_REPLACEDCHAR;
}
else
lpszFileA[i]=*p;
i++;
p++;
if (length + i == MAX_PATH)
{
rc |= PCS_FATAL | PCS_PATHTOOLONG;
break;
}
}
lpszFileA[i]=0;
}
return rc;
}
/*************************************************************************
@ -1182,7 +1247,7 @@ static HRESULT _SHGetDefaultValue(BYTE folder, LPWSTR pszPath)
{
HRESULT hr;
WCHAR resourcePath[MAX_PATH];
LPCWSTR pDefaultPath;
LPCWSTR pDefaultPath = NULL;
TRACE("0x%02x,%p\n", folder, pszPath);

View File

@ -429,14 +429,6 @@ BOOL WINAPI PathYetAnotherMakeUniqueName(
LPCWSTR lpszShortName,
LPCWSTR lpszLongName);
/* PathCleanupSpec return values */
#define PCS_REPLACEDCHARS 0x00000001
#define PCS_REMOVEDCHARS 0x00000002
#define PCS_SHORTENED 0x00000004
#define PCS_PATHTOOLONG 0x80000008
DWORD WINAPI PathCleanupSpecAW(LPCVOID lpszPath, LPVOID lpszFile);
BOOL WINAPI PathQualifyA(LPCSTR path);
BOOL WINAPI PathQualifyW(LPCWSTR path);
#define PathQualify WINELIB_NAME_AW(PathQualify)

View File

@ -62,6 +62,13 @@ int WINAPI RestartDialogEx(HWND,LPCWSTR,DWORD,DWORD);
BOOL WINAPI SHObjectProperties(HWND,UINT,LPCWSTR,LPCWSTR);
#define PCS_FATAL 0x80000000
#define PCS_REPLACEDCHAR 0x00000001
#define PCS_REMOVEDCHAR 0x00000002
#define PCS_TRUNCATED 0x00000004
#define PCS_PATHTOOLONG 0x00000008
int WINAPI PathCleanupSpec(LPCWSTR pszDir, LPWSTR pszSpec);
/*****************************************************************************
* Predeclare interfaces