From 08ca572fc4b96f1684fa17b19e408ee17e1347bb Mon Sep 17 00:00:00 2001 From: Gregor Schneider Date: Sat, 29 May 2010 16:49:23 +0000 Subject: [PATCH] [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. svn path=/trunk/; revision=47418 --- reactos/base/shell/cmd/copy.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/reactos/base/shell/cmd/copy.c b/reactos/base/shell/cmd/copy.c index d451fea09e8..a5bf33eefcb 100644 --- a/reactos/base/shell/cmd/copy.c +++ b/reactos/base/shell/cmd/copy.c @@ -604,28 +604,30 @@ INT cmd_copy (LPTSTR param) 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(':')) + _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('\\')) { - GetRootPath(arg[nSrc],szSrcPath,MAX_PATH); + _tcscpy(szSrcPath, tmpName); } - else - /* Get the full path of the source file */ - GetFullPathName (arg[nSrc], MAX_PATH, szSrcPath, NULL); } /* From this point on, we can assume that the shortest path is 3 letters long -- 2.17.1