Author: gschneider
Date: Sat May 29 18:49:23 2010
New Revision: 47418
URL:
http://svn.reactos.org/svn/reactos?rev=47418&view=rev
Log:
[CMD] copy command:
- Don't pass device path to FindFirstFile, use short path instead
- Join duplicate code to simplify processing
See issue #3575 for more details.
Modified:
trunk/reactos/base/shell/cmd/copy.c
Modified: trunk/reactos/base/shell/cmd/copy.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/copy.c?rev=…
==============================================================================
--- trunk/reactos/base/shell/cmd/copy.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/copy.c [iso-8859-1] Sat May 29 18:49:23 2010
@@ -604,28 +604,30 @@
bTouch = TRUE;
bDone = TRUE;
}
-
- if(_tcslen(tmpName) == 2)
- {
- if(tmpName[1] == _T(':'))
- {
- GetRootPath(tmpName,szSrcPath,MAX_PATH);
- }
- }
- else
- /* Get the full path to first file in the string of file names */
- GetFullPathName (tmpName, MAX_PATH, szSrcPath, NULL);
}
else
{
bDone = TRUE;
- if(_tcslen(arg[nSrc]) == 2 && arg[nSrc][1] == _T(':'))
- {
- GetRootPath(arg[nSrc],szSrcPath,MAX_PATH);
- }
- else
- /* Get the full path of the source file */
- GetFullPathName (arg[nSrc], MAX_PATH, szSrcPath, NULL);
+ _tcscpy(tmpName, arg[nSrc]);
+ }
+
+ /* Get full path or root names */
+ if(_tcslen(tmpName) == 2 && tmpName[1] == _T(':'))
+ {
+ GetRootPath(tmpName,szSrcPath,MAX_PATH);
+ }
+ else
+ {
+ /* Get the full path to first file in the string of file names */
+ GetFullPathName (tmpName, MAX_PATH, szSrcPath, NULL);
+
+ /* We got a device path of form \\.\x */
+ /* FindFirstFile cannot handle this, therefore use the short path */
+ if (szSrcPath[0] == _T('\\') && szSrcPath[1] ==
_T('\\') &&
+ szSrcPath[2] == _T('.') && szSrcPath[3] ==
_T('\\'))
+ {
+ _tcscpy(szSrcPath, tmpName);
+ }
}
/* From this point on, we can assume that the shortest path is 3 letters long