Fix the error returned by GetLongPathNameA

François Gouget fgouget at codeweavers.com
Wed Sep 12 17:16:02 CDT 2001


Changelog:

   François Gouget <fgouget at codeweavers.com>

 * files/dos_fs.c
   Fix the error returned by GetLongPathNameA


-- 
François Gouget
fgouget at codeweavers.com
-------------- next part --------------
Index: files/dos_fs.c
===================================================================
RCS file: /home/wine/wine/files/dos_fs.c,v
retrieving revision 1.91
diff -u -r1.91 dos_fs.c
--- files/dos_fs.c	2001/07/24 21:45:23	1.91
+++ files/dos_fs.c	2001/09/12 18:23:01
@@ -986,7 +986,7 @@
  * NOTES
  *  observed:
  *  longpath=NULL: LastError=ERROR_INVALID_PARAMETER, ret=0
- *  *longpath="" or invalid: LastError=ERROR_BAD_PATHNAME, ret=0
+ *  longpath="" or invalid: LastError=ERROR_BAD_PATHNAME, ret=0
  * 
  * more observations ( with NT 3.51 (WinDD) ):
  * longpath <= 8.3 -> just copy longpath to shortpath
@@ -997,7 +997,7 @@
  *   file is not a directory
  * - the absolute/relative path of the short name is reproduced like found
  *   in the long name
- * - longpath and shortpath may have the same adress
+ * - longpath and shortpath may have the same address
  * Peter Ganten, 1999
  */
 DWORD WINAPI GetShortPathNameA( LPCSTR longpath, LPSTR shortpath,
@@ -1107,13 +1107,27 @@
 
 /***********************************************************************
  *           GetLongPathNameA   (KERNEL32.@)
+ *
+ * NOTES
+ *  observed (Win2000):
+ *  shortpath=NULL: LastError=ERROR_INVALID_PARAMETER, ret=0
+ *  shortpath="":   LastError=ERROR_PATH_NOT_FOUND, ret=0
  */
 DWORD WINAPI GetLongPathNameA( LPCSTR shortpath, LPSTR longpath,
                                   DWORD longlen )
 {
     DOS_FULL_NAME full_name;
     char *p, *r, *ll, *ss;
-    
+
+    if (!shortpath) {
+      SetLastError(ERROR_INVALID_PARAMETER);
+      return 0;
+    }
+    if (!shortpath[0]) {
+      SetLastError(ERROR_PATH_NOT_FOUND);
+      return 0;
+    }
+
     if (!DOSFS_GetFullName( shortpath, TRUE, &full_name )) return 0;
     lstrcpynA( longpath, full_name.short_name, longlen );
 


More information about the wine-patches mailing list