SHELL32: Implementation of PathCleanupSpecAW

Mike McCormack mike at codeweavers.com
Fri Oct 29 01:23:15 CDT 2004


ChangeLog:
<aric at codeweavers.com>
* Implementation of PathCleanupSpecAW
-------------- next part --------------
Index: dlls/shell32/shellpath.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shellpath.c,v
retrieving revision 1.94
diff -u -r1.94 shellpath.c
--- dlls/shell32/shellpath.c	28 Oct 2004 20:58:51 -0000	1.94
+++ dlls/shell32/shellpath.c	29 Oct 2004 06:15:53 -0000
@@ -558,11 +558,78 @@
 
 /*************************************************************************
  * PathCleanupSpec	[SHELL32.171]
+ *
+ * lpszFile is changed in place. 
  */
-DWORD WINAPI PathCleanupSpecAW (LPCVOID x, LPVOID y)
+DWORD WINAPI PathCleanupSpecAW (LPCVOID lpszPath, LPVOID lpszFile)
 {
-    FIXME("(%p, %p) stub\n",x,y);
-    return TRUE;
+    int i = 0;
+    DWORD rc = 0;
+    int length = 0;
+
+    if (SHELL_OsIsUnicode())
+    {
+        LPWSTR lpszFileW = lpszFile;
+        LPCWSTR lpszPathW = lpszPath;
+        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 = 3; //PCS_REPLACEDCHAR
+            }
+            else
+                lpszFileW[i]=*p;
+            i++;
+            p++;     
+            if (length + i == MAX_PATH)
+            {
+                rc = 0x80000008; //some error
+                break;
+            }
+        }
+        lpszFileW[i]=0;
+    }
+    else
+    {
+        LPSTR lpszFileA = lpszFile;
+        LPCSTR lpszPathA = lpszPath;
+        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 = 3; //PCS_REPLACEDCHAR
+            }
+            else
+                lpszFileA[i]=*p;
+            i++;
+            p++;     
+            if (length + i == MAX_PATH)
+            {
+                rc = 0x80000008; 
+                break;
+            }
+        }
+        lpszFileA[i]=0;
+    }
+    return rc;
 }
 
 /*************************************************************************
@@ -1182,7 +1249,7 @@
 {
     HRESULT hr;
     WCHAR resourcePath[MAX_PATH];
-    LPCWSTR pDefaultPath;
+    LPCWSTR pDefaultPath = NULL;
 
     TRACE("0x%02x,%p\n", folder, pszPath);
 


More information about the wine-patches mailing list